Compare commits
378 Commits
temp-ghash
...
multiview
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3519a9f517 | ||
![]() |
bdf398daa8 | ||
![]() |
25d55cb560 | ||
![]() |
259c649a0f | ||
![]() |
a400c95c94 | ||
![]() |
cc6c55c4af | ||
![]() |
6ffd218444 | ||
![]() |
3fbab3bbba | ||
![]() |
af38ace3ae | ||
![]() |
ed94a8def2 | ||
![]() |
717d10154b | ||
![]() |
7f02b9e869 | ||
![]() |
bbf2305155 | ||
![]() |
7fc167f10f | ||
![]() |
ed5515dec3 | ||
![]() |
4f0f84fb05 | ||
![]() |
4728dbd309 | ||
![]() |
2179f01ef4 | ||
![]() |
18dab1fa80 | ||
![]() |
781efee98d | ||
![]() |
2bfabfd4b1 | ||
![]() |
2a69362b2b | ||
![]() |
a2ff63ca09 | ||
![]() |
35f1662d25 | ||
![]() |
8c064a83cf | ||
![]() |
3e1790feb1 | ||
![]() |
c6d2db21d3 | ||
![]() |
52ca9a1921 | ||
![]() |
83a729e471 | ||
![]() |
d3b915c273 | ||
![]() |
ced7d8fb79 | ||
![]() |
926a56a5a6 | ||
![]() |
156b1ccba0 | ||
![]() |
e426e18f77 | ||
![]() |
1fb36fe650 | ||
![]() |
2055cced49 | ||
![]() |
20c043d422 | ||
![]() |
bcc3cb7a75 | ||
![]() |
0a1942fbb4 | ||
![]() |
7ad48ff467 | ||
![]() |
fb658d87ff | ||
![]() |
82b26c553d | ||
![]() |
458a78d7f9 | ||
![]() |
8f3f8e66be | ||
![]() |
106d00eec0 | ||
![]() |
34cfd02806 | ||
![]() |
39423a894c | ||
![]() |
83cef40fa6 | ||
![]() |
347339d653 | ||
![]() |
48ab2d5984 | ||
![]() |
6df28be1f7 | ||
![]() |
92780acaeb | ||
![]() |
3cb5a07783 | ||
![]() |
43e10a6853 | ||
![]() |
38b854a544 | ||
![]() |
1566cb3291 | ||
![]() |
3302e5cc49 | ||
5370c00e6b | |||
21f6e13835 | |||
270b487360 | |||
![]() |
82139c399f | ||
![]() |
45d76c110f | ||
![]() |
cc4129b7bb | ||
![]() |
93ca780e4d | ||
![]() |
6da622c95f | ||
![]() |
1a574e51fe | ||
![]() |
56ec0bd871 | ||
![]() |
27a69cf4b0 | ||
![]() |
e6a45d88d8 | ||
f21db785d9 | |||
fa5c238950 | |||
04a9635686 | |||
fd5573c700 | |||
fcbf89b4d6 | |||
606e290500 | |||
9c30eaa675 | |||
ea3aeb974f | |||
f66f765c79 | |||
715db49f42 | |||
7b17b02669 | |||
f53ee18e0e | |||
![]() |
bf3a031e9b | ||
![]() |
a6a8cb846a | ||
![]() |
14c9d575ce | ||
![]() |
f426d4b173 | ||
![]() |
99779ccb6f | ||
![]() |
a1a5bff7d9 | ||
![]() |
7092a7a737 | ||
![]() |
f862307b5a | ||
![]() |
281b49cfa8 | ||
![]() |
84ac66445f | ||
![]() |
9697d1375f | ||
![]() |
c71d3a6232 | ||
![]() |
20e023541c | ||
![]() |
f6bd5b34e0 | ||
![]() |
5891dba59f | ||
![]() |
d6dcae331e | ||
![]() |
ec6b87e89f | ||
![]() |
9b5bb695dd | ||
![]() |
4156618620 | ||
![]() |
d845727661 | ||
![]() |
a07a020e5e | ||
![]() |
6bed3b60d6 | ||
![]() |
8ca0401d67 | ||
![]() |
3694692aec | ||
![]() |
3f795ec6f3 | ||
![]() |
9a6d9c16f3 | ||
![]() |
dce6d7b1ec | ||
![]() |
2cfe4f6858 | ||
![]() |
f7f6a44022 | ||
![]() |
1f3114ef63 | ||
![]() |
6478240648 | ||
![]() |
56cf38b00a | ||
![]() |
1a8769917c | ||
![]() |
39037fe06c | ||
![]() |
089c6d6694 | ||
![]() |
ebdedf8a96 | ||
![]() |
34069b71c4 | ||
4338e1298f | |||
fb7efc0541 | |||
21d3acb79f | |||
6ccc61c346 | |||
![]() |
fc9622a167 | ||
![]() |
4c050676e8 | ||
![]() |
2e207f9154 | ||
![]() |
11cb2ab919 | ||
![]() |
2da034db2f | ||
![]() |
7095b9555e | ||
![]() |
55d75953ce | ||
![]() |
a2ee2d866f | ||
![]() |
6b0b2783d6 | ||
![]() |
e692b3d1e3 | ||
![]() |
56be796099 | ||
![]() |
b6f853a4fc | ||
![]() |
ec4670d857 | ||
![]() |
a5a614e78e | ||
![]() |
2ae2e54a92 | ||
![]() |
7d24f22b79 | ||
![]() |
fb01c00286 | ||
![]() |
a96b382206 | ||
![]() |
0d5c4fceef | ||
![]() |
b9db39ab5e | ||
![]() |
dd3a2979a3 | ||
![]() |
67a2def60a | ||
![]() |
a74c5742cc | ||
![]() |
289c8d6c6c | ||
![]() |
fb2577ab31 | ||
![]() |
e150f4f268 | ||
![]() |
fb37fd9961 | ||
![]() |
7e62853719 | ||
![]() |
a6e05ad1dc | ||
![]() |
a87fd88c6b | ||
![]() |
4c5c103258 | ||
![]() |
803bf25dc8 | ||
![]() |
76ad40fbf7 | ||
![]() |
cc7b45ae1f | ||
![]() |
589209412d | ||
![]() |
0b4c9043e2 | ||
![]() |
046a5babb0 | ||
![]() |
d9d94d0cfc | ||
![]() |
774d02930d | ||
![]() |
f17f665e0c | ||
![]() |
293b795e9b | ||
![]() |
967d65960d | ||
![]() |
610c4273ec | ||
![]() |
7fefdaadc8 | ||
1b1090081b | |||
![]() |
a5176676b8 | ||
6f81acd7f9 | |||
281db468f1 | |||
![]() |
54596a84f5 | ||
d73d9629fb | |||
3480409ae8 | |||
c0c2881a92 | |||
cf1054bb75 | |||
8f4f6f3405 | |||
bce859c805 | |||
22995bf9dc | |||
0fb6b7a71f | |||
![]() |
7f1ebeb6ca | ||
![]() |
9674b10798 | ||
![]() |
058ec78f87 | ||
![]() |
ba81c53ba4 | ||
![]() |
70bb90e1e0 | ||
![]() |
e438d861ed | ||
![]() |
ef109f9032 | ||
![]() |
b132cbda03 | ||
![]() |
0b03ccbbcd | ||
![]() |
8eb050c058 | ||
![]() |
52bc4bff69 | ||
![]() |
5352fef28f | ||
![]() |
af29905d48 | ||
![]() |
6725532363 | ||
![]() |
a094c395c0 | ||
![]() |
d13789ccdc | ||
![]() |
7edc16245a | ||
![]() |
6dcbd52c44 | ||
![]() |
0a6402535d | ||
![]() |
7d36655e51 | ||
![]() |
6d6e0a7736 | ||
![]() |
53f3860622 | ||
![]() |
df888ef0cf | ||
![]() |
4ef8927781 | ||
![]() |
0e163beaf1 | ||
![]() |
aad21b5e17 | ||
![]() |
f8812fab51 | ||
![]() |
df0b4840ed | ||
![]() |
59bf863273 | ||
![]() |
5ed6e4a029 | ||
![]() |
08f2122d7a | ||
![]() |
20a7889df1 | ||
![]() |
306732ec56 | ||
![]() |
1a8cf4f8a4 | ||
![]() |
04a361f090 | ||
![]() |
482eac61a2 | ||
![]() |
3ce1849f25 | ||
![]() |
407d60330d | ||
![]() |
5b16c78913 | ||
![]() |
f9cb232851 | ||
![]() |
b62b55b03b | ||
![]() |
7b0c812a5b | ||
![]() |
53b48b9568 | ||
![]() |
11270fc3f1 | ||
![]() |
a1a66a8887 | ||
![]() |
a913047549 | ||
![]() |
6593212027 | ||
89dd233d5f | |||
97a7d3d7b1 | |||
5bf989d609 | |||
![]() |
c5211463f9 | ||
![]() |
8d4c498cb8 | ||
![]() |
560ee80286 | ||
04516721a0 | |||
6f662de83a | |||
e11fd354d4 | |||
3c70ec25c8 | |||
![]() |
268ab9e1b7 | ||
![]() |
876bc2b947 | ||
![]() |
c95e71a5fe | ||
![]() |
176bbdc3cf | ||
![]() |
3232751301 | ||
![]() |
cb12fac477 | ||
![]() |
fd5ee4dd18 | ||
![]() |
c588080245 | ||
![]() |
bf72d65607 | ||
![]() |
fc35c8ae26 | ||
![]() |
87d67a0c46 | ||
![]() |
4bb1566944 | ||
![]() |
7739ac8691 | ||
![]() |
153696489d | ||
![]() |
f4759ed978 | ||
![]() |
304f81b086 | ||
![]() |
85eadbf776 | ||
![]() |
c36dfb5950 | ||
![]() |
2910b0c77f | ||
![]() |
d75a10e986 | ||
![]() |
f964ccd582 | ||
![]() |
fd377e2612 | ||
![]() |
b0373525ca | ||
![]() |
1111b2101e | ||
![]() |
dbf135f53e | ||
![]() |
2a7f2287e6 | ||
![]() |
9ba7bb0e61 | ||
![]() |
2d1218a76e | ||
![]() |
c1a25c10c3 | ||
![]() |
008474521e | ||
![]() |
d73683af12 | ||
![]() |
6a324c1967 | ||
![]() |
0095ac2186 | ||
![]() |
04cd487448 | ||
![]() |
af178735ad | ||
![]() |
626a2865f5 | ||
![]() |
b3685a8ea3 | ||
![]() |
d2363db238 | ||
![]() |
53edcd5f97 | ||
![]() |
69bac908da | ||
![]() |
192039c355 | ||
![]() |
a4e537d0f4 | ||
![]() |
655804f23e | ||
![]() |
14da4996cc | ||
![]() |
04c20fd7b3 | ||
![]() |
483b9532a5 | ||
![]() |
2d677941f5 | ||
![]() |
58880ec965 | ||
![]() |
4dd894d1f5 | ||
![]() |
26f38f3fc0 | ||
![]() |
8216fb119c | ||
![]() |
7ae4b8ef1a | ||
![]() |
9e1d326892 | ||
![]() |
afe8054596 | ||
![]() |
a16fef8e61 | ||
![]() |
529484ed77 | ||
![]() |
2b606dc130 | ||
![]() |
b239314f29 | ||
![]() |
26ca7deae9 | ||
![]() |
1c33e9bb4d | ||
![]() |
2c35b52d16 | ||
![]() |
ea85ef9a17 | ||
![]() |
055c4feeb5 | ||
![]() |
8884eb8882 | ||
![]() |
c00d8fdb09 | ||
![]() |
cc4236efda | ||
![]() |
c556dc44da | ||
![]() |
327007e933 | ||
![]() |
610a66bf8c | ||
![]() |
920d6403f4 | ||
![]() |
8b96cf5d0b | ||
![]() |
ca14760dad | ||
![]() |
4f1e311d1b | ||
![]() |
45159fa2e3 | ||
![]() |
477daa9337 | ||
![]() |
273345ed84 | ||
![]() |
16d58a115b | ||
![]() |
f424d433f6 | ||
![]() |
92d846c7bb | ||
![]() |
1e2ddc45c1 | ||
![]() |
a79d4e0c1e | ||
2f839c26ac | |||
![]() |
79a3861413 | ||
![]() |
9475d5e8c2 | ||
![]() |
3fbc866077 | ||
![]() |
1e3a4891be | ||
![]() |
7f706ce3ab | ||
![]() |
fd14bbeee1 | ||
![]() |
4d4841f810 | ||
![]() |
d428079782 | ||
![]() |
f955759ba8 | ||
![]() |
eb19c93cb2 | ||
![]() |
77598ecd38 | ||
![]() |
f220d46679 | ||
![]() |
c65d6abd3b | ||
![]() |
6bd7e44a40 | ||
![]() |
a4ac20287c | ||
![]() |
97c8c290e8 | ||
![]() |
3051deeddd | ||
![]() |
f56325f0c1 | ||
![]() |
737e70e4f3 | ||
![]() |
7f3c4200aa | ||
![]() |
04b6f38a64 | ||
![]() |
43ffe6ef0c | ||
![]() |
e85098266d | ||
![]() |
01e15e5037 | ||
![]() |
c47cd40944 | ||
![]() |
09c6b31395 | ||
![]() |
a76a84225c | ||
![]() |
f230d15ce1 | ||
![]() |
4e85d8daea | ||
![]() |
5ec6e7091e | ||
![]() |
bf86d65273 | ||
![]() |
5c1da8a78a | ||
![]() |
05c8590896 | ||
![]() |
6311911466 | ||
![]() |
361ed81048 | ||
![]() |
136823c3d1 | ||
![]() |
633f55ac6b | ||
![]() |
029938fb96 | ||
![]() |
e611409068 | ||
![]() |
4bd686cc95 | ||
![]() |
e480f93e21 | ||
![]() |
65510c0bcd | ||
![]() |
0147d96aea | ||
![]() |
dd7469df12 | ||
![]() |
edeeb7866f | ||
![]() |
0f56e3d6ed | ||
![]() |
9c2dd855ea | ||
![]() |
0bfc90a317 | ||
![]() |
205afa0a06 | ||
![]() |
c7bcd6310b | ||
![]() |
99c988ce84 | ||
![]() |
baaf31864a | ||
![]() |
a0b49f357a | ||
![]() |
5bd7ed4298 | ||
![]() |
042cf19838 | ||
![]() |
aef5800b8c | ||
![]() |
f4eae173c2 | ||
![]() |
63d30c704d | ||
![]() |
04b98f6118 | ||
![]() |
92a1b76e29 |
145
CMakeLists.txt
145
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
|
||||
@@ -198,6 +197,7 @@ 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)
|
||||
@@ -359,7 +359,7 @@ 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")
|
||||
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)
|
||||
@@ -395,7 +395,6 @@ option(WITH_BOOST "Enable features depending on boost" ON)
|
||||
|
||||
# Unit testsing
|
||||
option(WITH_GTESTS "Enable GTest unit testing" OFF)
|
||||
option(WITH_TESTS_PERFORMANCE "Enable performance tests" OFF)
|
||||
|
||||
|
||||
# Documentation
|
||||
@@ -449,10 +448,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()
|
||||
|
||||
@@ -656,13 +651,6 @@ 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
|
||||
@@ -671,6 +659,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)
|
||||
@@ -1065,18 +1058,75 @@ 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()
|
||||
|
||||
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
|
||||
@@ -1105,25 +1155,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(INFO "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")
|
||||
@@ -1848,14 +1879,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
|
||||
@@ -2492,7 +2523,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")
|
||||
@@ -2529,7 +2559,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
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")
|
||||
@@ -2762,29 +2791,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}\"")
|
||||
|
88
GNUmakefile
88
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
|
||||
|
||||
|
||||
@@ -124,12 +117,12 @@ all: FORCE
|
||||
@echo
|
||||
@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 ...
|
||||
@@ -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
|
||||
@@ -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() \
|
||||
|
30
SConstruct
30
SConstruct
@@ -470,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')
|
||||
@@ -766,9 +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_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")
|
||||
@@ -1028,16 +1017,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')
|
||||
@@ -1063,12 +1050,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')
|
||||
@@ -1300,15 +1281,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 = []
|
||||
|
||||
|
@@ -510,7 +510,7 @@ OSL_SOURCE_REPO_UID="22ee5ea298fd215430dfbd160b5aefd507f06db0"
|
||||
OSL_SOURCE_REPO_BRANCH="blender-fixes"
|
||||
|
||||
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" )
|
||||
|
||||
|
||||
@@ -1374,7 +1374,7 @@ EOF
|
||||
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"
|
||||
@@ -1537,7 +1537,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!
|
||||
@@ -2287,7 +2287,7 @@ install_RPM() {
|
||||
OGG_DEV="libogg-devel"
|
||||
THEORA_DEV="libtheora-devel"
|
||||
|
||||
_packages="gcc gcc-c++ make scons libtiff-devel libjpeg-devel\
|
||||
_packages="gcc gcc-c++ make scons libtiff-devel freetype-devel libjpeg-devel\
|
||||
libpng-devel libX11-devel libXi-devel wget ncurses-devel \
|
||||
readline-devel $OPENJPEG_DEV openal-soft-devel \
|
||||
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
|
||||
@@ -2301,7 +2301,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"
|
||||
@@ -2339,7 +2339,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
|
||||
|
@@ -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 !
|
||||
|
||||
|
@@ -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()
|
||||
|
@@ -116,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))
|
||||
|
||||
@@ -142,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)
|
||||
|
@@ -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
|
||||
)
|
||||
|
@@ -66,14 +66,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 +75,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 +147,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 +169,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)
|
||||
@@ -202,28 +201,14 @@ IF(PYTHONLIBSUNIX_FOUND)
|
||||
# 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
|
||||
)
|
||||
|
@@ -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,
|
||||
)
|
||||
|
||||
@@ -72,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()]
|
||||
@@ -136,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]
|
||||
@@ -190,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' % build_cmd)
|
||||
f.write(' <cleanCommand>%s</cleanCommand>\n' % 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')
|
||||
@@ -237,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')
|
||||
|
@@ -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)
|
||||
|
@@ -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}")
|
||||
|
||||
@@ -221,24 +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
|
||||
)
|
||||
includes_sys)
|
||||
|
||||
blender_add_lib_nolist(${name} "${sources}" "${includes}" "${includes_sys}")
|
||||
|
||||
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
|
||||
@@ -298,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
|
||||
@@ -415,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)
|
||||
@@ -451,11 +436,9 @@ function(setup_liblinks
|
||||
${BLENDER_GL_LIBRARIES})
|
||||
|
||||
target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
|
||||
endfunction()
|
||||
|
||||
|
||||
function(SETUP_BLENDER_SORTED_LIBS)
|
||||
endmacro()
|
||||
|
||||
macro(SETUP_BLENDER_SORTED_LIBS)
|
||||
get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
|
||||
|
||||
list(APPEND BLENDER_LINK_LIBS
|
||||
@@ -533,15 +516,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
|
||||
@@ -691,12 +673,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
|
||||
@@ -918,22 +902,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()
|
||||
|
||||
@@ -947,34 +928,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}")
|
||||
@@ -988,15 +963,11 @@ endmacro()
|
||||
|
||||
macro(remove_extra_strict_flags)
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
remove_cc_flag(
|
||||
"-Wunused-parameter"
|
||||
)
|
||||
remove_cc_flag("-Wunused-parameter")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
remove_cc_flag(
|
||||
"-Wunused-parameter"
|
||||
)
|
||||
remove_cc_flag("-Wunused-parameter")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
@@ -1032,39 +1003,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:
|
||||
@@ -1214,7 +1183,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)
|
||||
@@ -1227,7 +1196,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
|
||||
@@ -1246,17 +1216,16 @@ 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)
|
||||
|
||||
@@ -1267,21 +1236,21 @@ function(data_to_c
|
||||
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)
|
||||
|
||||
@@ -1292,13 +1261,17 @@ function(data_to_c_simple
|
||||
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
|
||||
@@ -1310,7 +1283,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)
|
||||
|
||||
@@ -1332,22 +1304,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)
|
||||
@@ -1370,12 +1347,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)
|
||||
@@ -1384,7 +1364,6 @@ 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)
|
||||
|
||||
@@ -1395,11 +1374,15 @@ function(msgfmt_simple
|
||||
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)
|
||||
|
||||
@@ -1437,17 +1420,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()
|
||||
|
||||
|
@@ -112,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")
|
||||
|
@@ -206,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
|
||||
|
||||
@@ -230,8 +230,7 @@ WITH_BF_FREESTYLE = True
|
||||
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 = []
|
||||
|
@@ -145,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'
|
||||
|
@@ -144,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'
|
||||
|
@@ -372,7 +372,7 @@ 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/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']]
|
||||
|
||||
defs = []
|
||||
|
||||
@@ -630,7 +630,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)
|
||||
@@ -670,8 +670,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)
|
||||
|
||||
@@ -764,7 +762,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)
|
||||
@@ -818,8 +816,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.
|
||||
@@ -843,7 +839,6 @@ def UnixPyBundle(target=None, source=None, env=None):
|
||||
|
||||
py_src = env.subst( env['BF_PYTHON_LIBPATH'] + '/python'+env['BF_PYTHON_VERSION'] )
|
||||
py_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):
|
||||
@@ -863,11 +858,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)
|
||||
|
@@ -199,7 +199,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'
|
||||
]
|
||||
|
||||
|
||||
@@ -657,8 +657,6 @@ 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_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
|
||||
|
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
|
||||
*/
|
@@ -93,44 +93,36 @@
|
||||
|
||||
/* ================================ */
|
||||
|
||||
/** \defgroup blender Blender */
|
||||
/** \defgroup blender blender */
|
||||
|
||||
/** \defgroup blf BlenFont
|
||||
/** \defgroup blf blenfont
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup bke BlenKernel
|
||||
/** \defgroup bke blenkernel
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup bli BlenLib
|
||||
/** \defgroup bli blenlib
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
||||
/** \defgroup depsgraph Dependency Graph
|
||||
/** \defgroup nodes nodes
|
||||
* \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
|
||||
*/
|
||||
|
||||
@@ -140,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
|
||||
*/
|
||||
|
||||
@@ -332,7 +324,7 @@
|
||||
* \ingroup externformats
|
||||
*/
|
||||
|
||||
/** \defgroup imbuf Image Buffer (ImBuf)
|
||||
/** \defgroup imbuf IMage Buffer
|
||||
* \ingroup blender
|
||||
*/
|
||||
|
@@ -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,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,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
|
||||
|
@@ -1,11 +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,20 +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
|
||||
|
||||
|
@@ -1,47 +0,0 @@
|
||||
|
||||
Application Data (bge.app)
|
||||
==========================
|
||||
|
||||
Module to access application values that remain unchanged during runtime.
|
||||
|
||||
.. module:: bge.app
|
||||
|
||||
.. data:: version
|
||||
|
||||
The Blender/BGE version as a tuple of 3 ints, eg. (2, 75, 1).
|
||||
|
||||
.. note:: Version tuples can be compared simply with (in)equality symbols;
|
||||
for example, ``(2, 74, 5) <= (2, 75, 0)`` returns True (lexical order).
|
||||
|
||||
:type: tuple of three ints
|
||||
|
||||
.. data:: version_string
|
||||
|
||||
The Blender/BGE version formatted as a string, eg. "2.75 (sub 1)".
|
||||
|
||||
:type: str
|
||||
|
||||
.. data:: version_char
|
||||
|
||||
The Blender/BGE version character (for minor releases).
|
||||
|
||||
:type: str
|
||||
|
||||
.. data:: has_texture_ffmpeg
|
||||
|
||||
True if the BGE has been built with FFmpeg support, enabling use of :class:`~bge.texture.ImageFFmpeg` and :class:`~bge.texture.VideoFFmpeg`.
|
||||
|
||||
:type: bool
|
||||
|
||||
.. data:: has_joystick
|
||||
|
||||
True if the BGE has been built with joystick support.
|
||||
|
||||
:type: bool
|
||||
|
||||
.. data:: has_physics
|
||||
|
||||
True if the BGE has been built with physics support.
|
||||
|
||||
:type: bool
|
||||
|
@@ -4,84 +4,72 @@ Physics Constraints (bge.constraints)
|
||||
|
||||
.. module:: bge.constraints
|
||||
|
||||
|
||||
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, one of...
|
||||
:arg constrainttype: the type of the constraint. The constraint types are:
|
||||
|
||||
- :class:`POINTTOPOINT_CONSTRAINT`
|
||||
- :class:`LINEHINGE_CONSTRAINT`
|
||||
- :class:`ANGULAR_CONSTRAINT`
|
||||
- :class:`CONETWIST_CONSTRAINT`
|
||||
- :class:`VEHICLE_CONSTRAINT`
|
||||
- :class:`GENERIC_6DOF_CONSTRAINT`
|
||||
- :class:`POINTTOPOINT_CONSTRAINT`
|
||||
- :class:`LINEHINGE_CONSTRAINT`
|
||||
- :class:`ANGULAR_CONSTRAINT`
|
||||
- :class:`CONETWIST_CONSTRAINT`
|
||||
- :class:`VEHICLE_CONSTRAINT`
|
||||
- :class:`GENERIC_6DOF_CONSTRAINT`
|
||||
|
||||
:type constraint_type: int
|
||||
:type constrainttype: int
|
||||
|
||||
:arg pivot_x: Pivot X position. (optional)
|
||||
:type pivot_x: float
|
||||
:arg pivotX: pivot X position
|
||||
:type pivotX: float
|
||||
|
||||
:arg pivot_y: Pivot Y position. (optional)
|
||||
:type pivot_y: float
|
||||
:arg pivotY: pivot Y position
|
||||
:type pivotY: float
|
||||
|
||||
:arg pivot_z: Pivot Z position. (optional)
|
||||
:type pivot_z: float
|
||||
:arg pivotZ: pivot Z position
|
||||
:type pivotZ: float
|
||||
|
||||
:arg axis_x: X axis angle in degrees. (optional)
|
||||
:type axis_x: float
|
||||
:arg axisX: X axis
|
||||
:type axisX: float
|
||||
|
||||
:arg axis_y: Y axis angle in degrees. (optional)
|
||||
:type axis_y: float
|
||||
:arg axisY: Y axis
|
||||
:type axisY: float
|
||||
|
||||
:arg axis_z: Z axis angle in degrees. (optional)
|
||||
:type axis_z: float
|
||||
:arg axisZ: Z axis
|
||||
:type axisZ: float
|
||||
|
||||
:arg flag: 128 to disable collision between linked bodies. (optional)
|
||||
:arg flag: 128 to disable collision between linked bodies
|
||||
:type flag: int
|
||||
|
||||
: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)
|
||||
@@ -89,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)
|
||||
|
||||
@@ -152,8 +140,7 @@ Functions
|
||||
|
||||
Sets the debug mode.
|
||||
|
||||
:arg mode: The new debug mode.
|
||||
|
||||
Debug modes:
|
||||
- :class:`DBG_NODEBUG`
|
||||
- :class:`DBG_DRAWWIREFRAME`
|
||||
- :class:`DBG_DRAWAABB`
|
||||
@@ -169,6 +156,7 @@ Functions
|
||||
- :class:`DBG_DRAWCONSTRAINTLIMITS`
|
||||
- :class:`DBG_FASTWIREFRAME`
|
||||
|
||||
:arg mode: The new debug mode.
|
||||
:type mode: int
|
||||
|
||||
.. function:: setGravity(x, y, z)
|
||||
@@ -187,8 +175,7 @@ Functions
|
||||
.. function:: setLinearAirDamping(damping)
|
||||
|
||||
.. note::
|
||||
|
||||
Not implemented
|
||||
Not implemented.
|
||||
|
||||
Sets the linear air damping for rigidbodies.
|
||||
|
||||
@@ -248,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
|
||||
|
@@ -894,8 +894,6 @@ Various
|
||||
2D Filter
|
||||
---------
|
||||
|
||||
.. _Two-D-FilterActuator-mode:
|
||||
|
||||
.. data:: RAS_2DFILTER_BLUR
|
||||
|
||||
:value: 2
|
||||
@@ -1290,3 +1288,5 @@ See :class:`bge.types.KX_StateActuator.operation`
|
||||
Add bits to state mask
|
||||
|
||||
:value: 3
|
||||
|
||||
.. _Two-D-FilterActuator-mode:
|
||||
|
@@ -123,12 +123,6 @@ Functions
|
||||
|
||||
:rtype: bool
|
||||
|
||||
.. function:: getDisplayDimensions()
|
||||
|
||||
Get the actual display dimensions, in pixels, of the physical display (e.g., the monitor).
|
||||
|
||||
:type dimension: list [width,heigh]
|
||||
|
||||
.. function:: makeScreenshot(filename)
|
||||
|
||||
Writes an image file with the current displayed frame.
|
||||
|
@@ -218,8 +218,6 @@ When the texture object is deleted, the new texture is deleted and the old textu
|
||||
|
||||
background color
|
||||
|
||||
:type: int or float list [r, g, b, a] in [0.0, 255.0]
|
||||
|
||||
.. attribute:: capsize
|
||||
|
||||
size of render area
|
||||
@@ -317,8 +315,6 @@ When the texture object is deleted, the new texture is deleted and the old textu
|
||||
|
||||
background color
|
||||
|
||||
:type: int or float list [r, g, b, a] in [0.0, 255.0]
|
||||
|
||||
.. attribute:: capsize
|
||||
|
||||
size of render area
|
||||
|
@@ -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`
|
||||
|
||||
@@ -93,37 +38,35 @@ base class --- :class:`PyObjectPlus`
|
||||
|
||||
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()
|
||||
|
||||
|
@@ -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
|
||||
@@ -133,10 +132,10 @@ base class --- :class:`PyObjectPlus`
|
||||
Returns the contraint type (read only)
|
||||
|
||||
:type: integer
|
||||
- 1 = :class:`~bge.constraints.POINTTOPOINT_CONSTRAINT`
|
||||
- 2 = :class:`~bge.constraints.LINEHINGE_CONSTRAINT`
|
||||
- 3 = :class:`~bge.constraints.ANGULAR_CONSTRAINT`
|
||||
- 4 = :class:`~bge.constraints.CONETWIST_CONSTRAINT`
|
||||
- 11 = :class:`~bge.constraints.VEHICLE_CONSTRAINT`
|
||||
- 12 = :class:`~bge.constraints.GENERIC_6DOF_CONSTRAINT`
|
||||
|
||||
* 1 = POINTTOPOINT_CONSTRAINT
|
||||
* 2 = LINEHINGE_CONSTRAINT
|
||||
* 3 = ANGULAR_CONSTRAINT (aka LINEHINGE_CONSTRAINT)
|
||||
* 4 = CONETWIST_CONSTRAINT
|
||||
* 11 = VEHICLE_CONSTRAINT
|
||||
* 12 = GENERIC_6DOF_CONSTRAINT
|
||||
|
@@ -7,26 +7,6 @@ base class --- :class:`KX_GameObject`
|
||||
|
||||
.. class:: KX_FontObject(KX_GameObject)
|
||||
|
||||
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
|
||||
|
||||
|
@@ -84,8 +84,6 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
: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.
|
||||
@@ -139,29 +137,6 @@ base class --- :class:`SCA_IObject`
|
||||
|
||||
A value of 0.0 disables this option (rather then setting it stationary).
|
||||
|
||||
.. attribute:: angularVelocityMin
|
||||
|
||||
Enforces the object keeps rotating at a minimum velocity. A value of 0.0 disables this.
|
||||
|
||||
:type: non-negative float
|
||||
|
||||
.. note::
|
||||
|
||||
Applies to dynamic and rigid body objects only.
|
||||
While objects are stationary the minimum velocity will not be applied.
|
||||
|
||||
|
||||
.. attribute:: angularVelocityMax
|
||||
|
||||
Clamp the maximum angular velocity to prevent objects rotating beyond a set speed.
|
||||
A value of 0.0 disables clamping; it does not stop rotation.
|
||||
|
||||
:type: non-negative float
|
||||
|
||||
.. note::
|
||||
|
||||
Applies to dynamic and rigid body objects only.
|
||||
|
||||
.. attribute:: localInertia
|
||||
|
||||
the object's inertia vector in local coordinates. Read only.
|
||||
@@ -186,18 +161,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 +659,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::
|
||||
|
||||
|
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())
|
||||
|
@@ -125,27 +125,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`
|
||||
|
@@ -16,7 +16,11 @@ base class --- :class:`PyObjectPlus`
|
||||
|
||||
sce = bge.logic.getCurrentScene()
|
||||
|
||||
sce.world.mistColor = [1.0, 0.0, 0.0]
|
||||
sce.world.mist_color = [1.0, 0.0, 0.0]
|
||||
|
||||
*********
|
||||
Constants
|
||||
*********
|
||||
|
||||
.. data:: KX_MIST_QUADRATIC
|
||||
|
||||
@@ -30,49 +34,53 @@ base class --- :class:`PyObjectPlus`
|
||||
|
||||
Type of inverse quadratic attenuation used to fade mist.
|
||||
|
||||
.. attribute:: mistEnable
|
||||
**********
|
||||
Attributes
|
||||
**********
|
||||
|
||||
.. attribute:: mist_enable
|
||||
|
||||
Return the state of the mist.
|
||||
|
||||
:type: bool
|
||||
|
||||
.. attribute:: mistStart
|
||||
.. attribute:: mist_start
|
||||
|
||||
The mist start point.
|
||||
|
||||
:type: float
|
||||
|
||||
.. attribute:: mistDistance
|
||||
.. attribute:: mist_distance
|
||||
|
||||
The mist distance fom the start point to reach 100% mist.
|
||||
|
||||
:type: float
|
||||
|
||||
.. attribute:: mistIntensity
|
||||
.. attribute:: mist_intensity
|
||||
|
||||
The mist intensity.
|
||||
|
||||
:type: float
|
||||
|
||||
.. attribute:: mistType
|
||||
.. attribute:: mist_type
|
||||
|
||||
The type of mist - must be KX_MIST_QUADRATIC, KX_MIST_LINEAR or KX_MIST_INV_QUADRATIC
|
||||
|
||||
.. attribute:: mistColor
|
||||
.. attribute:: mist_color
|
||||
|
||||
The color of the mist. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
|
||||
Mist and background color sould always set to the same color.
|
||||
|
||||
:type: :class:`mathutils.Vector`
|
||||
|
||||
.. attribute:: backgroundColor
|
||||
.. attribute:: background_color
|
||||
|
||||
The color of the background. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
|
||||
Mist and background color sould always set to the same color.
|
||||
|
||||
:type: :class:`mathutils.Vector`
|
||||
|
||||
.. attribute:: ambientColor
|
||||
.. attribute:: ambient_color
|
||||
|
||||
The color of the ambient light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
|
||||
|
@@ -86,15 +86,9 @@ Consider the calculations that might go into working out the object's final tran
|
||||
To avoid expensive recalculations every time a property is modified, Blender defers making the actual calculations until they are needed.
|
||||
|
||||
However, while the script runs you may want to access the updated values.
|
||||
In this case you need to call :class:`bpy.types.Scene.update` after modifying values, for example:
|
||||
|
||||
.. code-block:: python
|
||||
This can be done by calling :class:`bpy.types.Scene.update` after modifying values which recalculates all data that is tagged to be updated.
|
||||
|
||||
bpy.context.object.location = 1, 2, 3
|
||||
bpy.context.scene.update()
|
||||
|
||||
|
||||
Now all dependent data (child objects, modifiers, drivers... etc) has been recalculated and is available to the script.
|
||||
|
||||
Can I redraw during the script?
|
||||
-------------------------------
|
||||
|
@@ -1,25 +1,18 @@
|
||||
|
||||
.. _info_overview:
|
||||
|
||||
*******************
|
||||
Python API Overview
|
||||
*******************
|
||||
|
||||
This document is to give an understanding of how Python and Blender fit together,
|
||||
covering some of the functionality that isn't obvious from reading the API reference and example scripts.
|
||||
This document is to give an understanding of how python and blender fit together, covering some of the functionality that isn't obvious from reading the API reference and example scripts.
|
||||
|
||||
|
||||
Python in Blender
|
||||
=================
|
||||
|
||||
Blender embeds a Python interpreter which is started with Blender and stays active.
|
||||
This interpreter runs scripts to draw the user interface and is used for some of Blender's internal tools too.
|
||||
Blender embeds a python interpreter which is started with blender and stays active. This interpreter runs scripts to draw the user interface and is used for some of Blender's internal tools too.
|
||||
|
||||
This is a typical Python environment so tutorials on how to write Python scripts
|
||||
will work running the scripts in Blender too.
|
||||
Blender provides the :mod:`bpy` module to the Python interpreter.
|
||||
This module can be imported in a script and gives access to Blender data, classes, and functions.
|
||||
Scripts that deal with Blender data will need to import this module.
|
||||
This is a typical python environment so tutorials on how to write python scripts will work running the scripts in blender too. Blender provides the :mod:`bpy` module to the python interpreter. This module can be imported in a script and gives access to blender data, classes, and functions. Scripts that deal with blender data will need to import this module.
|
||||
|
||||
Here is a simple example of moving a vertex of the object named **Cube**:
|
||||
|
||||
@@ -28,96 +21,84 @@ Here is a simple example of moving a vertex of the object named **Cube**:
|
||||
import bpy
|
||||
bpy.data.objects["Cube"].data.vertices[0].co.x += 1.0
|
||||
|
||||
This modifies Blender's internal data directly.
|
||||
When you run this in the interactive console you will see the 3D viewport update.
|
||||
This modifies Blender's internal data directly. When you run this in the interactive console you will see the 3D viewport update.
|
||||
|
||||
|
||||
The Default Environment
|
||||
=======================
|
||||
|
||||
When developing your own scripts it may help to understand how Blender sets up its Python environment.
|
||||
Many Python scripts come bundled with Blender and can be used as a reference
|
||||
because they use the same API that script authors write tools in.
|
||||
Typical usage for scripts include: user interface, import/export,
|
||||
scene manipulation, automation, defining your own toolset and customization.
|
||||
When developing your own scripts it may help to understand how blender sets up its python environment. Many python scripts come bundled with blender and can be used as a reference because they use the same API that script authors write tools in. Typical usage for scripts include: user interface, import/export, scene manipulation, automation, defining your own toolset and customization.
|
||||
|
||||
On startup Blender scans the ``scripts/startup/`` directory for Python modules and imports them.
|
||||
The exact location of this directory depends on your installation.
|
||||
`See the directory layout docs
|
||||
<https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`__
|
||||
On startup blender scans the ``scripts/startup/`` directory for python modules and imports them. The exact location of this directory depends on your installation. `See the directory layout docs <http://wiki.blender.org/index.php/Doc:2.6/Manual/Introduction/Installing_Blender/DirectoryLayout>`_
|
||||
|
||||
|
||||
Script Loading
|
||||
==============
|
||||
|
||||
This may seem obvious but it's important to note the difference
|
||||
between executing a script directly or importing it as a module.
|
||||
This may seem obvious but it's important to note the difference between executing a script directly or importing it as a module.
|
||||
|
||||
Scripts that extend Blender - define classes that exist beyond the scripts execution,
|
||||
this makes future access to these classes (to unregister for example)
|
||||
more difficult than importing as a module where class instance is kept
|
||||
in the module and can be accessed by importing that module later on.
|
||||
Scripts that extend blender - define classes that exist beyond the scripts execution, this makes future access to these classes (to unregister for example) more difficult than importing as a module where class instance is kept in the module and can be accessed by importing that module later on.
|
||||
|
||||
For this reason it's preferable to only use directly execute scripts that don't extend Blender by registering classes.
|
||||
For this reason it's preferable to only use directly execute scripts that don't extend blender by registering classes.
|
||||
|
||||
|
||||
Here are some ways to run scripts directly in Blender.
|
||||
Here are some ways to run scripts directly in blender.
|
||||
|
||||
- Loaded in the text editor and press **Run Script**.
|
||||
- Typed or pasted into the interactive console.
|
||||
- Execute a Python file from the command line with Blender, eg:
|
||||
* Loaded in the text editor and press **Run Script**.
|
||||
|
||||
.. code-block:: sh
|
||||
* Typed or pasted into the interactive console.
|
||||
|
||||
blender --python /home/me/my_script.py
|
||||
* Execute a python file from the command line with blender, eg:
|
||||
|
||||
``blender --python /home/me/my_script.py``
|
||||
|
||||
|
||||
To run as modules:
|
||||
|
||||
- The obvious way, ``import some_module`` command from the text window or interactive console.
|
||||
- Open as a text block and tick "Register" option, this will load with the blend file.
|
||||
- copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
|
||||
- define as an addon, enabling the addon will load it as a Python module.
|
||||
* The obvious way, ``import some_module`` command from the text window or interactive console.
|
||||
|
||||
* Open as a text block and tick "Register" option, this will load with the blend file.
|
||||
|
||||
* copy into one of the directories ``scripts/startup``, where they will be automatically imported on startup.
|
||||
|
||||
* define as an addon, enabling the addon will load it as a python module.
|
||||
|
||||
|
||||
Addons
|
||||
------
|
||||
|
||||
Some of Blenders functionality is best kept optional,
|
||||
alongside scripts loaded at startup we have addons which are kept in their own directory ``scripts/addons``,
|
||||
and only load on startup if selected from the user preferences.
|
||||
Some of blenders functionality is best kept optional, alongside scripts loaded at startup we have addons which are kept in their own directory ``scripts/addons``, and only load on startup if selected from the user preferences.
|
||||
|
||||
The only difference between addons and built-in Python modules is that addons must contain a ``bl_info``
|
||||
variable which Blender uses to read metadata such as name, author, category and URL.
|
||||
The only difference between addons and built-in python modules is that addons must contain a **bl_info** variable which blender uses to read metadata such as name, author, category and URL.
|
||||
|
||||
The user preferences addon listing uses **bl_info** to display information about each addon.
|
||||
|
||||
`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`__
|
||||
for details on the ``bl_info`` dictionary.
|
||||
`See Addons <http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons>`_ for details on the **bl_info** dictionary.
|
||||
|
||||
|
||||
Integration through Classes
|
||||
===========================
|
||||
|
||||
Running Python scripts in the text editor is useful for testing but you'll
|
||||
want to extend Blender to make tools accessible like other built-in functionality.
|
||||
Running python scripts in the text editor is useful for testing but you’ll want to extend blender to make tools accessible like other built-in functionality.
|
||||
|
||||
The Blender Python api allows integration for:
|
||||
The blender python api allows integration for:
|
||||
|
||||
- :class:`bpy.types.Panel`
|
||||
- :class:`bpy.types.Menu`
|
||||
- :class:`bpy.types.Operator`
|
||||
- :class:`bpy.types.PropertyGroup`
|
||||
- :class:`bpy.types.KeyingSet`
|
||||
- :class:`bpy.types.RenderEngine`
|
||||
* :class:`bpy.types.Panel`
|
||||
|
||||
* :class:`bpy.types.Menu`
|
||||
|
||||
* :class:`bpy.types.Operator`
|
||||
|
||||
* :class:`bpy.types.PropertyGroup`
|
||||
|
||||
* :class:`bpy.types.KeyingSet`
|
||||
|
||||
* :class:`bpy.types.RenderEngine`
|
||||
|
||||
|
||||
This is intentionally limited. Currently, for more advanced features such as mesh modifiers,
|
||||
object types, or shader nodes, C/C++ must be used.
|
||||
This is intentionally limited. Currently, for more advanced features such as mesh modifiers, object types, or shader nodes, C/C++ must be used.
|
||||
|
||||
For Python integration Blender defines methods which are common to all types.
|
||||
This works by creating a Python subclass of a Blender class which contains variables and functions
|
||||
specified by the parent class which are pre-defined to interface with Blender.
|
||||
For python intergration Blender defines methods which are common to all types. This works by creating a python subclass of a Blender class which contains variables and functions specified by the parent class which are pre-defined to interface with Blender.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -134,20 +115,15 @@ For example:
|
||||
|
||||
bpy.utils.register_class(SimpleOperator)
|
||||
|
||||
First note that we subclass a member of :mod:`bpy.types`,
|
||||
this is common for all classes which can be integrated with Blender and
|
||||
used so we know if this is an Operator and not a Panel when registering.
|
||||
First note that we subclass a member of :mod:`bpy.types`, this is common for all classes which can be integrated with blender and used so we know if this is an Operator and not a Panel when registering.
|
||||
|
||||
Both class properties start with a ``bl_`` prefix.
|
||||
This is a convention used to distinguish Blender properties from those you add yourself.
|
||||
Both class properties start with a **bl_** prefix. This is a convention used to distinguish blender properties from those you add yourself.
|
||||
|
||||
Next see the execute function, which takes an instance of the operator and the current context.
|
||||
A common prefix is not used for functions.
|
||||
Next see the execute function, which takes an instance of the operator and the current context. A common prefix is not used for functions.
|
||||
|
||||
Lastly the register function is called, this takes the class and loads it into Blender. See `Class Registration`_.
|
||||
Lastly the register function is called, this takes the class and loads it into blender. See `Class Registration`_.
|
||||
|
||||
Regarding inheritance, Blender doesn't impose restrictions on the kinds of class inheritance used,
|
||||
the registration checks will use attributes and functions defined in parent classes.
|
||||
Regarding inheritance, blender doesn't impose restrictions on the kinds of class inheritance used, the registration checks will use attributes and functions defined in parent classes.
|
||||
|
||||
class mix-in example:
|
||||
|
||||
@@ -165,20 +141,11 @@ class mix-in example:
|
||||
|
||||
bpy.utils.register_class(SimpleOperator)
|
||||
|
||||
Notice these classes don't define an ``__init__(self)`` function.
|
||||
While ``__init__()`` and ``__del__()`` will be called if defined,
|
||||
the class instances lifetime only spans the execution.
|
||||
So a panel for example will have a new instance for every redraw,
|
||||
for this reason there is rarely a cause to store variables in the panel instance.
|
||||
Instead, persistent variables should be stored in Blenders
|
||||
ata so that the state can be restored when Blender is restarted.
|
||||
Notice these classes don't define an ``__init__(self)`` function. While ``__init__()`` and ``__del__()`` will be called if defined, the class instances lifetime only spans the execution. So a panel for example will have a new instance for every redraw, for this reason there is rarely a cause to store variables in the panel instance. Instead, persistent variables should be stored in Blenders data so that the state can be restored when blender is restarted.
|
||||
|
||||
.. note::
|
||||
.. note:: Modal operators are an exception, keeping their instance variable as blender runs, see modal operator template.
|
||||
|
||||
Modal operators are an exception, keeping their instance variable as Blender runs, see modal operator template.
|
||||
|
||||
So once the class is registered with Blender, instancing the class and calling the functions is left up to Blender.
|
||||
In fact you cannot instance these classes from the script as you would expect with most Python API's.
|
||||
So once the class is registered with blender, instancing the class and calling the functions is left up to blender. In fact you cannot instance these classes from the script as you would expect with most python API's.
|
||||
|
||||
To run operators you can call them through the operator api, eg:
|
||||
|
||||
@@ -187,8 +154,7 @@ To run operators you can call them through the operator api, eg:
|
||||
import bpy
|
||||
bpy.ops.object.simple_operator()
|
||||
|
||||
User interface classes are given a context in which to draw, buttons window, file header, toolbar etc,
|
||||
then they are drawn when that area is displayed so they are never called by Python scripts directly.
|
||||
User interface classes are given a context in which to draw, buttons window, file header, toolbar etc, then they are drawn when that area is displayed so they are never called by python scripts directly.
|
||||
|
||||
|
||||
Registration
|
||||
@@ -198,10 +164,9 @@ Registration
|
||||
Module Registration
|
||||
-------------------
|
||||
|
||||
Blender modules loaded at startup require ``register()`` and ``unregister()`` functions.
|
||||
These are the *only* functions that Blender calls from your code, which is otherwise a regular Python module.
|
||||
Blender modules loaded at startup require ``register()`` and ``unregister()`` functions. These are the *only* functions that blender calls from your code, which is otherwise a regular python module.
|
||||
|
||||
A simple Blender/Python module can look like this:
|
||||
A simple blender/python module can look like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -219,16 +184,12 @@ A simple Blender/Python module can look like this:
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
These functions usually appear at the bottom of the script containing class registration sometimes adding menu items.
|
||||
You can also use them for internal purposes setting up data for your own tools but take care
|
||||
since register won't re-run when a new blend file is loaded.
|
||||
These functions usually appear at the bottom of the script containing class registration sometimes adding menu items. You can also use them for internal purposes setting up data for your own tools but take care since register won't re-run when a new blend file is loaded.
|
||||
|
||||
The register/unregister calls are used so it's possible to toggle addons and reload scripts while Blender runs.
|
||||
If the register calls were placed in the body of the script, registration would be called on import,
|
||||
meaning there would be no distinction between importing a module or loading its classes into Blender.
|
||||
The register/unregister calls are used so it's possible to toggle addons and reload scripts while blender runs.
|
||||
If the register calls were placed in the body of the script, registration would be called on import, meaning there would be no distinction between importing a module or loading its classes into blender.
|
||||
|
||||
This becomes problematic when a script imports classes from another module
|
||||
making it difficult to manage which classes are being loaded and when.
|
||||
This becomes problematic when a script imports classes from another module making it difficult to manage which classes are being loaded and when.
|
||||
|
||||
The last 2 lines are only for testing:
|
||||
|
||||
@@ -238,24 +199,19 @@ The last 2 lines are only for testing:
|
||||
register()
|
||||
|
||||
This allows the script to be run directly in the text editor to test changes.
|
||||
This ``register()`` call won't run when the script is imported as a module
|
||||
since ``__main__`` is reserved for direct execution.
|
||||
This ``register()`` call won't run when the script is imported as a module since ``__main__`` is reserved for direct execution.
|
||||
|
||||
|
||||
Class Registration
|
||||
------------------
|
||||
|
||||
Registering a class with Blender results in the class definition being loaded into Blender,
|
||||
where it becomes available alongside existing functionality.
|
||||
Registering a class with blender results in the class definition being loaded into blender, where it becomes available alongside existing functionality.
|
||||
|
||||
Once this class is loaded you can access it from :mod:`bpy.types`,
|
||||
using the bl_idname rather than the classes original name.
|
||||
Once this class is loaded you can access it from :mod:`bpy.types`, using the bl_idname rather than the classes original name.
|
||||
|
||||
When loading a class, Blender performs sanity checks making sure all required properties and functions are found,
|
||||
that properties have the correct type, and that functions have the right number of arguments.
|
||||
When loading a class, blender performs sanity checks making sure all required properties and functions are found, that properties have the correct type, and that functions have the right number of arguments.
|
||||
|
||||
Mostly you will not need concern yourself with this but if there is a problem
|
||||
with the class definition it will be raised on registering:
|
||||
Mostly you will not need concern yourself with this but if there is a problem with the class definition it will be raised on registering:
|
||||
|
||||
Using the function arguments ``def execute(self, context, spam)``, will raise an exception:
|
||||
|
||||
@@ -269,13 +225,9 @@ Using ``bl_idname = 1`` will raise.
|
||||
Multiple-Classes
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
Loading classes into Blender is described above,
|
||||
for simple cases calling :mod:`bpy.utils.register_class` (SomeClass) is sufficient,
|
||||
but when there are many classes or a packages submodule has its own
|
||||
classes it can be tedious to list them all for registration.
|
||||
Loading classes into blender is described above, for simple cases calling :mod:`bpy.utils.register_class` (SomeClass) is sufficient, but when there are many classes or a packages submodule has its own classes it can be tedious to list them all for registration.
|
||||
|
||||
For more convenient loading/unloading :mod:`bpy.utils.register_module` (module)
|
||||
and :mod:`bpy.utils.unregister_module` (module) functions exist.
|
||||
For more convenient loading/unloading :mod:`bpy.utils.register_module` (module) and :mod:`bpy.utils.unregister_module` (module) functions exist.
|
||||
|
||||
A script which defines many of its own operators, panels menus etc. you only need to write:
|
||||
|
||||
@@ -287,19 +239,13 @@ A script which defines many of its own operators, panels menus etc. you only nee
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
Internally Blender collects subclasses on registrable types, storing them by the module in which they are defined.
|
||||
By passing the module name to :mod:`bpy.utils.register_module`
|
||||
Blender can register all classes created by this module and its submodules.
|
||||
Internally blender collects subclasses on registrable types, storing them by the module in which they are defined. By passing the module name to :mod:`bpy.utils.register_module` blender can register all classes created by this module and its submodules.
|
||||
|
||||
|
||||
Inter Classes Dependencies
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
When customizing Blender you may want to group your own settings together,
|
||||
after all, they will likely have to co-exist with other scripts.
|
||||
To group these properties classes need to be defined,
|
||||
for groups within groups or collections within groups
|
||||
you can find yourself having to deal with order of registration/unregistration.
|
||||
When customizing blender you may want to group your own settings together, after all, they will likely have to co-exist with other scripts. To group these properties classes need to be defined, for groups within groups or collections within groups you can find yourself having to deal with order of registration/unregistration.
|
||||
|
||||
Custom properties groups are themselves classes which need to be registered.
|
||||
|
||||
@@ -365,9 +311,7 @@ Say you want to store material settings for a custom engine.
|
||||
Manipulating Classes
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Properties can be added and removed as Blender runs,
|
||||
normally happens on register or unregister but for some
|
||||
special cases it may be useful to modify types as the script runs.
|
||||
Properties can be added and removed as blender runs, normally happens on register or unregister but for some special cases it may be useful to modify types as the script runs.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -397,8 +341,7 @@ This works just as well for PropertyGroup subclasses you define yourself.
|
||||
Dynamic Defined-Classes (Advanced)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
In some cases the specifier for data may not be in Blender,
|
||||
renderman shader definitions for example and it may be useful to define types and remove them on the fly.
|
||||
In some cases the specifier for data may not be in blender, renderman shader definitions for example and it may be useful to define types and remove them on the fly.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -417,8 +360,7 @@ renderman shader definitions for example and it may be useful to define types an
|
||||
|
||||
.. note::
|
||||
|
||||
``type()`` is called to define the class.
|
||||
This is an alternative syntax for class creation in Python, better suited to constructing classes dynamically.
|
||||
Notice ``type()`` is called to define the class. This is an alternative syntax for class creation in python, better suited to constructing classes dynamically.
|
||||
|
||||
|
||||
Calling these operators:
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
.. _info_quickstart:
|
||||
|
||||
***********************
|
||||
@@ -33,15 +32,13 @@ The Blender/Python API **can't** (yet)...
|
||||
Before Starting
|
||||
===============
|
||||
|
||||
This document isn't intended to fully cover each topic.
|
||||
Rather, its purpose is to familiarize you with Blender Python API.
|
||||
This document isn't intended to fully cover each topic. Rather, its purpose is to familiarize you with Blender Python API.
|
||||
|
||||
|
||||
A quick list of helpful things to know before starting:
|
||||
|
||||
- Blender uses Python 3.x; some online documentation still assumes 2.x.
|
||||
- The interactive console is great for testing one-liners.
|
||||
It also has autocompletion so you can inspect the API quickly.
|
||||
- The interactive console is great for testing one-liners, It also has autocompletion so you can inspect the API quickly.
|
||||
- Button tool tips show Python attributes and operator names.
|
||||
- Right clicking on buttons and menu items directly links to API documentation.
|
||||
- For more examples, the text menu has a templates section where some example operators can be found.
|
||||
@@ -54,19 +51,15 @@ A quick list of helpful things to know before starting:
|
||||
Running Scripts
|
||||
---------------
|
||||
|
||||
The two most common ways to execute Python scripts are using the built-in
|
||||
text editor or entering commands in the Python console.
|
||||
The two most common ways to execute Python scripts are using the built-in text editor or entering commands in the Python console.
|
||||
|
||||
Both the *Text Editor* and *Python Console* are space types you can select from the view header.
|
||||
Both the **Text Editor** and **Python Console** are space types you can select from the view header.
|
||||
|
||||
Rather then manually configuring your spaces for Python development,
|
||||
you may prefer to use the *Scripting* screen, included default with Blender,
|
||||
accessible from the top headers screen selector.
|
||||
Rather then manually configuring your spaces for Python development, you may prefer to use the **Scripting** screen, included default with Blender, accessible from the top headers screen selector.
|
||||
|
||||
From the text editor you can open ``.py`` files or paste then from the clipboard, then test using *Run Script*.
|
||||
From the text editor you can open ``.py`` files or paste then from the clipboard, then test using **Run Script**.
|
||||
|
||||
The Python Console is typically used for typing in snippets and for testing to get immediate feedback,
|
||||
but can also have entire scripts pasted into it.
|
||||
The Python Console is typically used for typing in snippets and for testing to get immediate feedback, but can also have entire scripts pasted into it.
|
||||
|
||||
Scripts can also run from the command line with Blender but to learn Blender/Python this isn't essential.
|
||||
|
||||
@@ -80,11 +73,9 @@ Data Access
|
||||
Accessing DataBlocks
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Python accesses Blender's data in the same way as the animation system and user interface;
|
||||
this implies that any setting that can be changed via a button can also be changed from Python.
|
||||
Python accesses Blender's data in the same way as the animation system and user interface; this implies that any setting that can be changed via a button can also be changed from Python.
|
||||
|
||||
Accessing data from the currently loaded blend file is done with the module :mod:`bpy.data`.
|
||||
This gives access to library data. For example:
|
||||
Accessing data from the currently loaded blend file is done with the module :mod:`bpy.data`. This gives access to library data. For example:
|
||||
|
||||
>>> bpy.data.objects
|
||||
<bpy_collection[3], BlendDataObjects>
|
||||
@@ -101,8 +92,7 @@ About Collections
|
||||
|
||||
You'll notice that an index as well as a string can be used to access members of the collection.
|
||||
|
||||
Unlike Python's dictionaries, both methods are acceptable;
|
||||
however, the index of a member may change while running Blender.
|
||||
Unlike Python's dictionaries, both methods are acceptable; however, the index of a member may change while running Blender.
|
||||
|
||||
>>> list(bpy.data.objects)
|
||||
[bpy.data.objects["Cube"], bpy.data.objects["Plane"]]
|
||||
@@ -117,10 +107,7 @@ however, the index of a member may change while running Blender.
|
||||
Accessing Attributes
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Once you have a data block, such as a material, object, groups etc.,
|
||||
its attributes can be accessed much like you would change a setting using the graphical interface.
|
||||
In fact, the tooltip for each button also displays the Python attribute
|
||||
which can help in finding what settings to change in a script.
|
||||
Once you have a data block, such as a material, object, groups etc., its attributes can be accessed much like you would change a setting using the graphical interface. In fact, the tooltip for each button also displays the Python attribute which can help in finding what settings to change in a script.
|
||||
|
||||
>>> bpy.data.objects[0].name
|
||||
'Camera'
|
||||
@@ -132,8 +119,7 @@ which can help in finding what settings to change in a script.
|
||||
bpy.data.materials['MyMaterial']
|
||||
|
||||
|
||||
For testing what data to access it's useful to use the "Console", which is its own space type.
|
||||
This supports auto-complete, giving you a fast way to dig into different data in your file.
|
||||
For testing what data to access it's useful to use the "Console", which is its own space type. This supports auto-complete, giving you a fast way to dig into different data in your file.
|
||||
|
||||
Example of a data path that can be quickly found via the console:
|
||||
|
||||
@@ -146,8 +132,7 @@ Example of a data path that can be quickly found via the console:
|
||||
Data Creation/Removal
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Those of you familiar with other Python API's may be surprised that
|
||||
new datablocks in the bpy API can't be created by calling the class:
|
||||
Those of you familiar with other Python API's may be surprised that new datablocks in the bpy API can't be created by calling the class:
|
||||
|
||||
>>> bpy.types.Mesh()
|
||||
Traceback (most recent call last):
|
||||
@@ -156,8 +141,7 @@ new datablocks in the bpy API can't be created by calling the class:
|
||||
|
||||
|
||||
This is an intentional part of the API design.
|
||||
The Blender/Python API can't create Blender data that exists outside the main Blender database
|
||||
(accessed through :mod:`bpy.data`), because this data is managed by Blender (save/load/undo/append... etc).
|
||||
The Blender/Python API can't create Blender data that exists outside the main Blender database (accessed through :mod:`bpy.data`), because this data is managed by Blender (save/load/undo/append... etc).
|
||||
|
||||
Data is added and removed via methods on the collections in :mod:`bpy.data`, eg:
|
||||
|
||||
@@ -171,10 +155,8 @@ Data is added and removed via methods on the collections in :mod:`bpy.data`, eg:
|
||||
Custom Properties
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
Python can access properties on any datablock that has an ID
|
||||
(data that can be linked in and accessed from :mod:`bpy.data`.
|
||||
When assigning a property, you can make up your own names,
|
||||
these will be created when needed or overwritten if they exist.
|
||||
Python can access properties on any datablock that has an ID (data that can be linked in and accessed from :mod:`bpy.data`.
|
||||
When assigning a property, you can make up your own names, these will be created when needed or overwritten if they exist.
|
||||
|
||||
This data is saved with the blend file and copied with objects.
|
||||
|
||||
@@ -210,10 +192,8 @@ These properties are valid outside of Python. They can be animated by curves or
|
||||
Context
|
||||
-------
|
||||
|
||||
While it's useful to be able to access data directly by name or as a list,
|
||||
it's more common to operate on the user's selection.
|
||||
The context is always available from ``bpy.context`` and can be used to get the active object, scene,
|
||||
tool settings along with many other attributes.
|
||||
While it's useful to be able to access data directly by name or as a list, it's more common to operate on the user's selection.
|
||||
The context is always available from ``bpy.context`` and can be used to get the active object, scene, tool settings along with many other attributes.
|
||||
|
||||
Common-use cases:
|
||||
|
||||
@@ -221,9 +201,7 @@ Common-use cases:
|
||||
>>> bpy.context.selected_objects
|
||||
>>> bpy.context.visible_bones
|
||||
|
||||
Note that the context is read-only.
|
||||
These values cannot be modified directly,
|
||||
though they may be changed by running API functions or by using the data API.
|
||||
Note that the context is read-only. These values cannot be modified directly, though they may be changed by running API functions or by using the data API.
|
||||
|
||||
So ``bpy.context.object = obj`` will raise an error.
|
||||
|
||||
@@ -231,8 +209,7 @@ But ``bpy.context.scene.objects.active = obj`` will work as expected.
|
||||
|
||||
|
||||
The context attributes change depending on where they are accessed.
|
||||
The 3D view has different context members than the console,
|
||||
so take care when accessing context attributes that the user state is known.
|
||||
The 3D view has different context members than the console, so take care when accessing context attributes that the user state is known.
|
||||
|
||||
See :mod:`bpy.context` API reference.
|
||||
|
||||
@@ -240,9 +217,7 @@ See :mod:`bpy.context` API reference.
|
||||
Operators (Tools)
|
||||
-----------------
|
||||
|
||||
Operators are tools generally accessed by the user from buttons, menu items or key shortcuts.
|
||||
From the user perspective they are a tool but Python can run these with its own settings
|
||||
through the :mod:`bpy.ops` module.
|
||||
Operators are tools generally accessed by the user from buttons, menu items or key shortcuts. From the user perspective they are a tool but Python can run these with its own settings through the :mod:`bpy.ops` module.
|
||||
|
||||
Examples:
|
||||
|
||||
@@ -255,16 +230,14 @@ Examples:
|
||||
|
||||
.. note::
|
||||
|
||||
The menu item: :menuselection:`Help --> Operator Cheat Sheet`
|
||||
gives a list of all operators and their default values in Python syntax, along with the generated docs.
|
||||
The menu item: :menuselection:`Help --> Operator Cheat Sheet` gives a list of all operators and their default values in Python syntax, along with the generated docs.
|
||||
This is a good way to get an overview of all Blender's operators.
|
||||
|
||||
|
||||
Operator Poll()
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Many operators have a "poll" function which may check that the cursor
|
||||
is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc).
|
||||
Many operators have a "poll" function which may check that the mouse is in a valid area or that the object is in the correct mode (Edit Mode, Weight Paint etc).
|
||||
When an operator's poll function fails within Python, an exception is raised.
|
||||
|
||||
For example, calling ``bpy.ops.view3d.render_border()`` from the console raises the following error:
|
||||
@@ -275,8 +248,7 @@ For example, calling ``bpy.ops.view3d.render_border()`` from the console raises
|
||||
|
||||
In this case the context must be the 3d view with an active camera.
|
||||
|
||||
To avoid using try/except clauses wherever operators are called you can call the operators
|
||||
own ``poll()`` function to check if it can run in the current context.
|
||||
To avoid using try/except clauses wherever operators are called you can call the operators own .poll() function to check if it can run in the current context.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -303,8 +275,7 @@ Example Operator
|
||||
|
||||
.. literalinclude:: ../../../release/scripts/templates_py/operator_simple.py
|
||||
|
||||
Once this script runs, ``SimpleOperator`` is registered with Blender
|
||||
and can be called from the operator search popup or added to the toolbar.
|
||||
Once this script runs, ``SimpleOperator`` is registered with Blender and can be called from the operator search popup or added to the toolbar.
|
||||
|
||||
To run the script:
|
||||
|
||||
@@ -314,23 +285,19 @@ To run the script:
|
||||
#. Click the button labeled ``New`` and the confirmation pop up in order to create a new text block.
|
||||
#. Press :kbd:`Ctrl-V` to paste the code into the text panel (the upper left frame).
|
||||
#. Click on the button **Run Script**.
|
||||
#. Move your cursor into the 3D view, press spacebar for the operator search menu, and type "Simple".
|
||||
#. Move your mouse into the 3D view, press spacebar for the operator search menu, and type "Simple".
|
||||
#. Click on the "Simple Operator" item found in search.
|
||||
|
||||
|
||||
.. seealso:: The class members with the ``bl_`` prefix are documented in the API
|
||||
reference :class:`bpy.types.Operator`
|
||||
|
||||
.. note::
|
||||
|
||||
The output from the ``main`` function is sent to the terminal;
|
||||
in order to see this, be sure to :ref:`use the terminal <use_the_terminal>`.
|
||||
.. note:: The output from the ``main`` function is sent to the terminal; in order to see this, be sure to :ref:`use the terminal <use_the_terminal>`.
|
||||
|
||||
Example Panel
|
||||
-------------
|
||||
|
||||
Panels register themselves as a class, like an operator.
|
||||
Notice the extra ``bl_`` variables used to set the context they display in.
|
||||
Panels register themselves as a class, like an operator. Notice the extra ``bl_`` variables used to set the context they display in.
|
||||
|
||||
.. literalinclude:: ../../../release/scripts/templates_py/ui_panel_simple.py
|
||||
|
||||
@@ -367,8 +334,7 @@ Blender's Python API can be split up into 3 categories.
|
||||
Native Types
|
||||
------------
|
||||
|
||||
In simple cases returning a number or a string as a custom type would be cumbersome,
|
||||
so these are accessed as normal Python types.
|
||||
In simple cases returning a number or a string as a custom type would be cumbersome, so these are accessed as normal Python types.
|
||||
|
||||
- Blender float/int/boolean -> float/int/boolean
|
||||
- Blender enumerator -> string
|
||||
@@ -393,8 +359,7 @@ Used for Blender datablocks and collections: :class:`bpy.types.bpy_struct`
|
||||
|
||||
For data that contains its own attributes groups/meshes/bones/scenes... etc.
|
||||
|
||||
There are 2 main types that wrap Blenders data, one for datablocks
|
||||
(known internally as ``bpy_struct``), another for properties.
|
||||
There are 2 main types that wrap Blenders data, one for datablocks (known internally as ``bpy_struct``), another for properties.
|
||||
|
||||
>>> bpy.context.object
|
||||
bpy.data.objects['Cube']
|
||||
@@ -410,9 +375,7 @@ Mathutils Types
|
||||
|
||||
Used for vectors, quaternion, eulers, matrix and color types, accessible from :mod:`mathutils`
|
||||
|
||||
Some attributes such as :class:`bpy.types.Object.location`,
|
||||
:class:`bpy.types.PoseBone.rotation_euler` and :class:`bpy.types.Scene.cursor_location`
|
||||
can be accessed as special math types which can be used together and manipulated in various useful ways.
|
||||
Some attributes such as :class:`bpy.types.Object.location`, :class:`bpy.types.PoseBone.rotation_euler` and :class:`bpy.types.Scene.cursor_location` can be accessed as special math types which can be used together and manipulated in various useful ways.
|
||||
|
||||
Example of a matrix, vector multiplication:
|
||||
|
||||
@@ -447,9 +410,7 @@ Animation
|
||||
|
||||
There are 2 ways to add keyframes through Python.
|
||||
|
||||
The first is through key properties directly, which is similar to inserting a keyframe from the button as a user.
|
||||
You can also manually create the curves and keyframe data, then set the path to the property.
|
||||
Here are examples of both methods.
|
||||
The first is through key properties directly, which is similar to inserting a keyframe from the button as a user. You can also manually create the curves and keyframe data, then set the path to the property. Here are examples of both methods.
|
||||
|
||||
Both examples insert a keyframe on the active object's Z axis.
|
||||
|
||||
|
@@ -1,12 +1,10 @@
|
||||
|
||||
***************
|
||||
Tips and Tricks
|
||||
***************
|
||||
|
||||
Here are various suggestions that you might find useful when writing scripts.
|
||||
|
||||
Some of these are just Python features that scripters may not have thought to use with Blender,
|
||||
others are Blender specific.
|
||||
Some of these are just python features that scripters may not have thought to use with blender, others are blender specific.
|
||||
|
||||
|
||||
.. _use_the_terminal:
|
||||
@@ -14,21 +12,18 @@ others are Blender specific.
|
||||
Use The Terminal
|
||||
================
|
||||
|
||||
When writing Python scripts, it's useful to have a terminal open,
|
||||
this is not the built-in Python console but a terminal application which is used to start Blender.
|
||||
When writing python scripts, it's useful to have a terminal open, this is not the built-in python console but a terminal application which is used to start blender.
|
||||
|
||||
There are 3 main uses for the terminal, these are:
|
||||
|
||||
- You can see the output of ``print()`` as your script runs, which is useful to view debug info.
|
||||
- The error trace-back is printed in full to the terminal which won't always generate an error popup in
|
||||
Blender's user interface (depending on how the script is executed).
|
||||
- If the script runs for too long or you accidentally enter an infinite loop,
|
||||
:kbd:`Ctrl-C` in the terminal (:kbd:`Ctrl-Break` on Windows) will quit the script early.
|
||||
* You can see the output of ``print()`` as your script runs, which is useful to view debug info.
|
||||
|
||||
* The error trace-back is printed in full to the terminal which won't always generate an error popup in blender's user interface (depending on how the script is executed).
|
||||
|
||||
* If the script runs for too long or you accidentally enter an infinite loop, Ctrl+C in the terminal (Ctrl+Break on Windows) will quit the script early.
|
||||
|
||||
.. note::
|
||||
|
||||
For Linux and OSX users this means starting the terminal first, then running Blender from within it.
|
||||
On Windows the terminal can be enabled from the help menu.
|
||||
For Linux and OSX users this means starting the terminal first, then running blender from within it. On Windows the terminal can be enabled from the help menu.
|
||||
|
||||
|
||||
Interface Tricks
|
||||
@@ -38,56 +33,43 @@ Interface Tricks
|
||||
Access Operator Commands
|
||||
------------------------
|
||||
|
||||
You may have noticed that the tooltip for menu items and buttons includes the ``bpy.ops.[...])`` command
|
||||
to run that button, a handy (hidden) feature is that you can press :kbd:`Ctrl-C` over
|
||||
any menu item/button to copy this command into the clipboard.
|
||||
You may have noticed that the tooltip for menu items and buttons includes the ``bpy.ops``... command to run that button, a handy (hidden) feature is that you can press Ctrl+C over any menu item/button to copy this command into the clipboard.
|
||||
|
||||
|
||||
Access Data Path
|
||||
----------------
|
||||
|
||||
To find the path from an :class:`ID` datablock to its setting isn't always so simple since it may be nested away.
|
||||
To get this quickly you can right click on the setting and select select **Copy Data Path**,
|
||||
To find the path from an :class:`ID` datablock to its setting isn't always so simple since it may be nested away. To get this quickly you can right click on the setting and select select **Copy Data Path**,
|
||||
if this can't be generated, only the property name is copied.
|
||||
|
||||
.. note::
|
||||
|
||||
This uses the same method for creating the animation path used by
|
||||
:class:`bpy.types.FCurve.data_path` and
|
||||
:class:`bpy.types.DriverTarget.data_path` drivers.
|
||||
This uses the same method for creating the animation path used by :class:`bpy.types.FCurve.data_path` and :class:`bpy.types.DriverTarget.data_path` drivers.
|
||||
|
||||
|
||||
.. _info_show_all_operators:
|
||||
.. _info_show_all_operators
|
||||
|
||||
Show All Operators
|
||||
==================
|
||||
|
||||
While Blender logs operators in the Info space,
|
||||
this only reports operators with the ``REGISTER`` option enabeld so as not to flood the *Info* view
|
||||
with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``.
|
||||
While blender logs operators in the Info space, this only reports operators with the ``REGISTER`` option enabeld so as not to flood the Info view with calls to ``bpy.ops.view3d.smoothview`` and ``bpy.ops.view3d.zoom``.
|
||||
|
||||
However, for testing it can be useful to see **every** operator called in a terminal,
|
||||
do this by enabling the debug option either by passing the ``--debug-wm`` argument when starting Blender
|
||||
or by setting :mod:`bpy.app.debug_wm` to ``True`` while Blender is running.
|
||||
However, for testing it can be useful to see **every** operator called in a terminal, do this by enabling the debug option either by passing the ``--debug-wm`` argument when starting blender or by setting :mod:`bpy.app.debug_wm` to True while blender is running.
|
||||
|
||||
|
||||
Use an External Editor
|
||||
======================
|
||||
|
||||
Blenders text editor is fine for small changes and writing tests but its not full featured,
|
||||
for larger projects you'll probably want to use a standalone editor or Python IDE.
|
||||
Blenders text editor is fine for small changes and writing tests but its not full featured, for larger projects you'll probably want to use a standalone editor or python IDE.
|
||||
|
||||
Editing a text file externally and having the same text open in Blender does work but isn't that optimal
|
||||
so here are 2 ways you can easily use an external file from Blender.
|
||||
|
||||
Using the following examples you'll still need textblock in Blender to execute,
|
||||
but reference an external file rather then including it directly.
|
||||
Editing a text file externally and having the same text open in blender does work but isn't that optimal so here are 2 ways you can easily use an external file from blender.
|
||||
|
||||
Using the following examples you'll still need textblock in blender to execute, but reference an external file rather then including it directly.
|
||||
|
||||
Executing External Scripts
|
||||
--------------------------
|
||||
|
||||
This is the equivalent to running the script directly, referencing a scripts path from a 2 line text-block.
|
||||
This is the equivalent to running the script directly, referencing a scripts path from a 2 line textblock.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -120,17 +102,12 @@ This example shows loading a script in as a module and executing a module functi
|
||||
myscript.main()
|
||||
|
||||
|
||||
Notice that the script is reloaded every time, this forces use of the modified version,
|
||||
otherwise the cached one in ``sys.modules`` would be used until Blender was restarted.
|
||||
Notice that the script is reloaded every time, this forces use of the modified version, otherwise the cached one in ``sys.modules`` would be used until blender was restarted.
|
||||
|
||||
The important difference between this and executing the script directly is it
|
||||
has to call a function in the module, in this case ``main()`` but it can be any function,
|
||||
an advantage with this is you can pass arguments to the function from this
|
||||
small script which is often useful for testing different settings quickly.
|
||||
The important difference between this and executing the script directly is it has to call a function in the module, in this case ``main()`` but it can be any function, an advantage with this is you can pass arguments to the function from this small script which is often useful for testing different settings quickly.
|
||||
|
||||
The other issue with this is the script has to be in Pythons module search path.
|
||||
While this is not best practice - for testing you can extend the search path,
|
||||
this example adds the current blend files directory to the search path, then loads the script as a module.
|
||||
The other issue with this is the script has to be in pythons module search path.
|
||||
While this is not best practice - for testing you can extend the search path, this example adds the current blend files directory to the search path, then loads the script as a module.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -151,86 +128,71 @@ this example adds the current blend files directory to the search path, then loa
|
||||
Don't Use Blender!
|
||||
==================
|
||||
|
||||
While developing your own scripts Blenders interface can get in the way,
|
||||
manually reloading, running the scripts, opening file import etc. adds overhead.
|
||||
While developing your own scripts blenders interface can get in the way, manually reloading, running the scripts, opening file import etc. adds overhead.
|
||||
|
||||
For scripts that are not interactive it can end up being more efficient not to use
|
||||
Blenders interface at all and instead execute the script on the command line.
|
||||
For scripts that are not interactive it can end up being more efficient not to use blenders interface at all and instead execute the script on the command line.
|
||||
|
||||
.. code-block:: sh
|
||||
.. code-block:: python
|
||||
|
||||
blender --background --python myscript.py
|
||||
|
||||
|
||||
You might want to run this with a blend file so the script has some data to operate on.
|
||||
|
||||
.. code-block:: sh
|
||||
.. code-block:: python
|
||||
|
||||
blender myscene.blend --background --python myscript.py
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
Depending on your setup you might have to enter the full path to the Blender executable.
|
||||
Depending on your setup you might have to enter the full path to the blender executable.
|
||||
|
||||
|
||||
Once the script is running properly in background mode, you'll want to check the output of the script,
|
||||
this depends completely on the task at hand however here are some suggestions.
|
||||
Once the script is running properly in background mode, you'll want to check the output of the script, this depends completely on the task at hand however here are some suggestions.
|
||||
|
||||
- render the output to an image, use an image viewer and keep writing over the same image each time.
|
||||
- save a new blend file, or export the file using one of Blenders exporters.
|
||||
- if the results can be displayed as text - print them or write them to a file.
|
||||
* render the output to an image, use an image viewer and keep writing over the same image each time.
|
||||
|
||||
* save a new blend file, or export the file using one of blenders exporters.
|
||||
|
||||
* if the results can be displayed as text - print them or write them to a file.
|
||||
|
||||
|
||||
While this can take a little time to setup, it can be well worth the effort
|
||||
to reduce the time it takes to test changes - you can even have
|
||||
Blender running the script every few seconds with a viewer updating the results,
|
||||
so no need to leave your text editor to see changes.
|
||||
This can take a little time to setup, but it can be well worth the effort to reduce the time it takes to test changes - you can even have blender running the script ever few seconds with a viewer updating the results, so no need to leave your text editor to see changes.
|
||||
|
||||
|
||||
Use External Tools
|
||||
==================
|
||||
|
||||
When there are no readily available Python modules to perform specific tasks it's
|
||||
worth keeping in mind you may be able to have Python execute an external command
|
||||
on your data and read the result back in.
|
||||
When there are no readily available python modules to perform specific tasks it's worth keeping in mind you may be able to have python execute an external command on your data and read the result back in.
|
||||
|
||||
Using external programs adds an extra dependency and may limit who can use the script
|
||||
but to quickly setup your own custom pipeline or writing one-off scripts this can be handy.
|
||||
Using external programs adds an extra dependency and may limit who can use the script but to quickly setup your own custom pipeline or writing one-off scripts this can be handy.
|
||||
|
||||
Examples include:
|
||||
|
||||
- Run The Gimp in batch mode to execute custom scripts for advanced image processing.
|
||||
- Write out 3D models to use external mesh manipulation tools and read back in the results.
|
||||
- Convert files into recognizable formats before reading.
|
||||
* Run The Gimp in batch mode to execute custom scripts for advanced image processing.
|
||||
|
||||
* Write out 3D models to use external mesh manipulation tools and read back in the results.
|
||||
|
||||
* Convert files into recognizable formats before reading.
|
||||
|
||||
|
||||
Bundled Python & Extensions
|
||||
===========================
|
||||
|
||||
The Blender releases distributed from blender.org include a complete Python installation on all platforms,
|
||||
this has the disadvantage that any extensions you have installed in your systems Python wont be found by Blender.
|
||||
The Blender releases distributed from blender.org include a complete python installation on all platforms, this has the disadvantage that any extensions you have installed in your systems python wont be found by blender.
|
||||
|
||||
There are 2 ways around this:
|
||||
|
||||
- remove Blender Python sub-directory, Blender will then fallback on the systems Python and use that instead
|
||||
.. warning::
|
||||
* remove blender python sub-directory, blender will then fallback on the systems python and use that instead **python version must match the one that blender comes with**.
|
||||
|
||||
The Python version must match the one that Blender comes with.
|
||||
|
||||
- copy the extensions into Blender's Python sub-directory so Blender can access them,
|
||||
you could also copy the entire Python installation into Blenders sub-directory,
|
||||
replacing the one Blender comes with.
|
||||
This works as long as the Python versions match and the paths are created in the same relative locations.
|
||||
Doing this has the advantage that you can redistribute this bundle to others with Blender and/or the game player,
|
||||
including any extensions you rely on.
|
||||
* copy the extensions into blender's python sub-directory so blender can access them, you could also copy the entire python installation into blenders sub-directory, replacing the one blender comes with. This works as long as the python versions match and the paths are created in the same relative locations. Doing this has the advantage that you can redistribute this bundle to others with blender and/or the game player, including any extensions you rely on.
|
||||
|
||||
|
||||
Drop Into a Python Interpreter in Your Script
|
||||
=============================================
|
||||
|
||||
In the middle of a script you may want to inspect some variables,
|
||||
run some function and generally dig about to see whats going on.
|
||||
In the middle of a script you may want to inspect some variables, run some function and generally dig about to see whats going on.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -255,13 +217,10 @@ The next example is an equivalent single line version of the script above which
|
||||
__import__('code').interact(local=dict(globals(), **locals()))
|
||||
|
||||
|
||||
``code.interact`` can be added at any line in the script
|
||||
and will pause the script an launch an interactive interpreter in the terminal,
|
||||
when you're done you can quit the interpreter and the script will continue execution.
|
||||
``code.interact`` can be added at any line in the script and will pause the script an launch an interactive interpreter in the terminal, when you're done you can quit the interpreter and the script will continue execution.
|
||||
|
||||
|
||||
If you have **IPython** installed you can use its ``embed()`` function which uses the current namespace.
|
||||
The IPython prompt has auto-complete and some useful features that the standard Python eval-loop doesn't have.
|
||||
If you have **IPython** installed you can use their ``embed()`` function which will implicitly use the current namespace, this has autocomplete and some useful features that the standard python eval-loop doesn't have.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -269,7 +228,7 @@ The IPython prompt has auto-complete and some useful features that the standard
|
||||
IPython.embed()
|
||||
|
||||
|
||||
Admittedly this highlights the lack of any Python debugging support built into Blender, but its still handy to know.
|
||||
Admittedly this highlights the lack of any python debugging support built into blender, but its still handy to know.
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -283,32 +242,27 @@ Advanced
|
||||
Blender as a module
|
||||
-------------------
|
||||
|
||||
From a Python perspective it's nicer to have everything as an extension
|
||||
which lets the Python script combine many components.
|
||||
From a python perspective it's nicer to have everything as an extension which lets the python script combine many components.
|
||||
|
||||
Advantages include:
|
||||
|
||||
- you can use external editors/IDE's with Blenders Python API and execute scripts within the IDE
|
||||
(step over code, inspect variables as the script runs).
|
||||
- editors/IDE's can auto complete Blender modules & variables.
|
||||
- existing scripts can import Blender API's without having to run inside Blender.
|
||||
* you can use external editors/IDE's with blenders python API and execute scripts within the IDE (step over code, inspect variables as the script runs).
|
||||
|
||||
* editors/IDE's can auto complete blender modules & variables.
|
||||
|
||||
* existing scripts can import blender API's without having to run inside blender.
|
||||
|
||||
|
||||
This is marked advanced because to run Blender as a Python module requires a special build option.
|
||||
This is marked advanced because to run blender as a python module requires a special build option.
|
||||
|
||||
For instructions on building see
|
||||
`Building Blender as a Python module <http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
|
||||
For instructions on building see `Building blender as a python module <http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule>`_
|
||||
|
||||
|
||||
Python Safety (Build Option)
|
||||
----------------------------
|
||||
|
||||
Since it's possible to access data which has been removed (see Gotcha's),
|
||||
this can be hard to track down the cause of crashes.
|
||||
Since it's possible to access data which has been removed (see Gotcha's), this can be hard to track down the cause of crashes.
|
||||
|
||||
To raise Python exceptions on accessing freed data (rather then crashing),
|
||||
enable the CMake build option WITH_PYTHON_SAFETY.
|
||||
|
||||
This enables data tracking which makes data access about 2x slower
|
||||
which is why the option isn't enabled in release builds.
|
||||
To raise python exceptions on accessing freed data (rather then crashing), enable the CMake build option WITH_PYTHON_SAFETY.
|
||||
|
||||
This enables data tracking which makes data access about 2x slower which is why the option is not enabled in release builds.
|
||||
|
@@ -208,7 +208,6 @@ The objects should move as before.
|
||||
|
||||
*Keep this addon open in Blender for the next step - Installing.*
|
||||
|
||||
|
||||
Install The Addon
|
||||
-----------------
|
||||
|
||||
@@ -222,11 +221,10 @@ restrictions that apply to Python modules and end with a ``.py`` extension.
|
||||
|
||||
Once the file is on disk, you can install it as you would for an addon downloaded online.
|
||||
|
||||
Open the user :menuselection:`File -> User Preferences`,
|
||||
Select the *Addon* section, press *Install Addon...* and select the file.
|
||||
Open the user **File -> User Preferences**, Select the **Addon** section, press **Install Addon...** and select the file.
|
||||
|
||||
Now the addon will be listed and you can enable it by pressing the check-box,
|
||||
if you want it to be enabled on restart, press *Save as Default*.
|
||||
Now the addon will be listed and you can enable it by pressing the check-box, if you want it to be enabled on restart,
|
||||
press **Save as Default**.
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -240,7 +238,7 @@ if you want it to be enabled on restart, press *Save as Default*.
|
||||
print(addon_utils.paths())
|
||||
|
||||
More is written on this topic here:
|
||||
`Directory Layout <https://www.blender.org/manual/getting_started/installing_blender/directorylayout.html>`_
|
||||
`Directory Layout <http://wiki.blender.org/index.php/Doc:2.6/Manual/Introduction/Installing_Blender/DirectoryLayout>`_
|
||||
|
||||
|
||||
Your Second Addon
|
||||
|
@@ -138,9 +138,19 @@ def handle_args():
|
||||
parser.add_argument("-T", "--sphinx-theme",
|
||||
dest="sphinx_theme",
|
||||
type=str,
|
||||
default="classic",
|
||||
help="Sphinx theme (default='classic'), "
|
||||
"see: http://sphinx-doc.org/theming.html",
|
||||
default='default',
|
||||
help=
|
||||
# see SPHINX_THEMES below
|
||||
"Sphinx theme (default='default')\n"
|
||||
"Available themes\n"
|
||||
"----------------\n"
|
||||
"(Blender Foundation) blender-org\n" # naiad
|
||||
"(Sphinx) agogo, basic, epub, haiku, nature, "
|
||||
"scrolls, sphinxdoc, traditional\n",
|
||||
# choices=['naiad', 'blender-org'] + # bf
|
||||
# ['agogo', 'basic', 'epub',
|
||||
# 'haiku', 'nature', 'scrolls',
|
||||
# 'sphinxdoc', 'traditional'], # sphinx
|
||||
required=False)
|
||||
|
||||
parser.add_argument("-N", "--sphinx-named-output",
|
||||
@@ -234,7 +244,6 @@ else:
|
||||
EXCLUDE_MODULES = [
|
||||
"aud",
|
||||
"bge",
|
||||
"bge.app"
|
||||
"bge.constraints",
|
||||
"bge.events",
|
||||
"bge.logic",
|
||||
@@ -258,7 +267,6 @@ else:
|
||||
"bpy.props",
|
||||
"bpy.types", # supports filtering
|
||||
"bpy.utils",
|
||||
"bpy.utils.previews",
|
||||
"bpy_extras",
|
||||
"gpu",
|
||||
"mathutils",
|
||||
@@ -411,7 +419,23 @@ BLENDER_ZIP_FILENAME = "%s.zip" % REFERENCE_NAME
|
||||
|
||||
# -------------------------------SPHINX-----------------------------------------
|
||||
|
||||
if ARGS.sphinx_theme == "blender-org":
|
||||
SPHINX_THEMES = {'bf': ['blender-org'], # , 'naiad',
|
||||
'sphinx': ['agogo',
|
||||
'basic',
|
||||
'default',
|
||||
'epub',
|
||||
'haiku',
|
||||
'nature',
|
||||
'scrolls',
|
||||
'sphinxdoc',
|
||||
'traditional']}
|
||||
|
||||
available_themes = SPHINX_THEMES['bf'] + SPHINX_THEMES['sphinx']
|
||||
if ARGS.sphinx_theme not in available_themes:
|
||||
print("Please choose a theme among: %s" % ', '.join(available_themes))
|
||||
sys.exit()
|
||||
|
||||
if ARGS.sphinx_theme in SPHINX_THEMES['bf']:
|
||||
SPHINX_THEME_DIR = os.path.join(ARGS.output_dir, ARGS.sphinx_theme)
|
||||
SPHINX_THEME_SVN_DIR = os.path.join(SCRIPT_DIR, ARGS.sphinx_theme)
|
||||
|
||||
@@ -456,11 +480,9 @@ ClassMethodDescriptorType = type(dict.__dict__['fromkeys'])
|
||||
MethodDescriptorType = type(dict.get)
|
||||
GetSetDescriptorType = type(int.real)
|
||||
StaticMethodType = type(staticmethod(lambda: None))
|
||||
from types import (
|
||||
MemberDescriptorType,
|
||||
MethodType,
|
||||
FunctionType,
|
||||
)
|
||||
from types import (MemberDescriptorType,
|
||||
MethodType,
|
||||
)
|
||||
|
||||
_BPY_STRUCT_FAKE = "bpy_struct"
|
||||
_BPY_PROP_COLLECTION_FAKE = "bpy_prop_collection"
|
||||
@@ -637,26 +659,19 @@ def pyfunc2sphinx(ident, fw, module_name, type_name, identifier, py_func, is_cla
|
||||
func_type = "function"
|
||||
|
||||
# ther rest are class methods
|
||||
elif arg_str.startswith("(self, ") or arg_str == "(self)":
|
||||
arg_str = "()" if (arg_str == "(self)") else ("(" + arg_str[7:])
|
||||
elif arg_str.startswith("(self, "):
|
||||
arg_str = "(" + arg_str[7:]
|
||||
func_type = "method"
|
||||
elif arg_str.startswith("(cls, "):
|
||||
arg_str = "()" if (arg_str == "(cls)") else ("(" + arg_str[6:])
|
||||
arg_str = "(" + arg_str[6:]
|
||||
func_type = "classmethod"
|
||||
else:
|
||||
func_type = "staticmethod"
|
||||
|
||||
doc = py_func.__doc__
|
||||
if (not doc) or (not doc.startswith(".. %s:: " % func_type)):
|
||||
fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str))
|
||||
ident_temp = ident + " "
|
||||
else:
|
||||
ident_temp = ident
|
||||
|
||||
if doc:
|
||||
write_indented_lines(ident_temp, fw, doc)
|
||||
fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str))
|
||||
if py_func.__doc__:
|
||||
write_indented_lines(ident + " ", fw, py_func.__doc__)
|
||||
fw("\n")
|
||||
del doc, ident_temp
|
||||
|
||||
if is_class:
|
||||
write_example_ref(ident + " ", fw, module_name + "." + type_name + "." + identifier)
|
||||
@@ -872,7 +887,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
module_dir_value_type.sort(key=lambda triple: str(triple[2]))
|
||||
|
||||
for attribute, value, value_type in module_dir_value_type:
|
||||
if value_type == FunctionType:
|
||||
if value_type == types.FunctionType:
|
||||
pyfunc2sphinx("", fw, module_name, None, attribute, value, is_class=False)
|
||||
elif value_type in {types.BuiltinMethodType, types.BuiltinFunctionType}: # both the same at the moment but to be future proof
|
||||
# note: can't get args from these, so dump the string as is
|
||||
@@ -927,24 +942,19 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
fw(value.__doc__)
|
||||
else:
|
||||
fw(".. class:: %s\n\n" % type_name)
|
||||
write_indented_lines(" ", fw, value.__doc__, True)
|
||||
write_indented_lines(" ", fw, value.__doc__, False)
|
||||
else:
|
||||
fw(".. class:: %s\n\n" % type_name)
|
||||
fw("\n")
|
||||
|
||||
write_example_ref(" ", fw, module_name + "." + type_name)
|
||||
|
||||
descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("_")]
|
||||
descr_items = [(key, descr) for key, descr in sorted(value.__dict__.items()) if not key.startswith("__")]
|
||||
|
||||
for key, descr in descr_items:
|
||||
if type(descr) == ClassMethodDescriptorType:
|
||||
py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
|
||||
|
||||
# needed for pure python classes
|
||||
for key, descr in descr_items:
|
||||
if type(descr) == FunctionType:
|
||||
pyfunc2sphinx(" ", fw, module_name, type_name, key, descr, is_class=True)
|
||||
|
||||
for key, descr in descr_items:
|
||||
if type(descr) == MethodDescriptorType:
|
||||
py_descr2sphinx(" ", fw, descr, module_name, type_name, key)
|
||||
@@ -1255,7 +1265,6 @@ def pyrna2sphinx(basepath):
|
||||
fw("\n\n")
|
||||
|
||||
subclass_ids = [s.identifier for s in structs.values() if s.base is struct if not rna_info.rna_id_ignore(s.identifier)]
|
||||
subclass_ids.sort()
|
||||
if subclass_ids:
|
||||
fw("subclasses --- \n" + ", ".join((":class:`%s`" % s) for s in subclass_ids) + "\n\n")
|
||||
|
||||
@@ -1563,7 +1572,7 @@ def write_sphinx_conf_py(basepath):
|
||||
if ARGS.sphinx_theme != 'default':
|
||||
fw("html_theme = '%s'\n" % ARGS.sphinx_theme)
|
||||
|
||||
if ARGS.sphinx_theme == "blender-org":
|
||||
if ARGS.sphinx_theme in SPHINX_THEMES['bf']:
|
||||
fw("html_theme_path = ['../']\n")
|
||||
# copied with the theme, exclude else we get an error [#28873]
|
||||
fw("html_favicon = 'favicon.ico'\n") # in <theme>/static/
|
||||
@@ -1624,7 +1633,6 @@ def write_rst_contents(basepath):
|
||||
|
||||
# py modules
|
||||
"bpy.utils",
|
||||
"bpy.utils.previews",
|
||||
"bpy.path",
|
||||
"bpy.app",
|
||||
"bpy.app.handlers",
|
||||
@@ -1670,7 +1678,6 @@ def write_rst_contents(basepath):
|
||||
fw(" bge.texture.rst\n\n")
|
||||
fw(" bge.events.rst\n\n")
|
||||
fw(" bge.constraints.rst\n\n")
|
||||
fw(" bge.app.rst\n\n")
|
||||
|
||||
# rna generated change log
|
||||
fw(title_string("API Info", "=", double=True))
|
||||
@@ -1827,7 +1834,6 @@ def copy_handwritten_rsts(basepath):
|
||||
"bge.texture",
|
||||
"bge.events",
|
||||
"bge.constraints",
|
||||
"bge.app",
|
||||
"bgl", # "Blender OpenGl wrapper"
|
||||
"gpu", # "GPU Shader Module"
|
||||
|
||||
@@ -1981,7 +1987,7 @@ def main():
|
||||
copy_function=shutil.copy)
|
||||
|
||||
# eventually, copy the theme dir
|
||||
if ARGS.sphinx_theme == "blender-org":
|
||||
if ARGS.sphinx_theme in SPHINX_THEMES['bf']:
|
||||
if os.path.exists(SPHINX_THEME_DIR):
|
||||
shutil.rmtree(SPHINX_THEME_DIR, True)
|
||||
shutil.copytree(SPHINX_THEME_SVN_DIR,
|
||||
|
1
extern/bullet2/src/Bullet-C-Api.h
vendored
1
extern/bullet2/src/Bullet-C-Api.h
vendored
@@ -171,7 +171,6 @@ extern "C" {
|
||||
/* Convex Hull */
|
||||
PL_DECLARE_HANDLE(plConvexHull);
|
||||
plConvexHull plConvexHullCompute(float (*coords)[3], int count);
|
||||
void plConvexHullDelete(plConvexHull hull);
|
||||
int plConvexHullNumVertices(plConvexHull hull);
|
||||
int plConvexHullNumFaces(plConvexHull hull);
|
||||
void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], int *original_index);
|
||||
|
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
||||
|
||||
|
||||
/**
|
||||
* @page Bullet Documentation
|
||||
* @mainpage Bullet Documentation
|
||||
*
|
||||
* @section intro_sec Introduction
|
||||
* Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the ZLib license ( http://opensource.org/licenses/zlib-license.php ).
|
||||
|
@@ -413,12 +413,6 @@ plConvexHull plConvexHullCompute(float (*coords)[3], int count)
|
||||
return reinterpret_cast<plConvexHull>(computer);
|
||||
}
|
||||
|
||||
void plConvexHullDelete(plConvexHull hull)
|
||||
{
|
||||
btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
|
||||
delete computer;
|
||||
}
|
||||
|
||||
int plConvexHullNumVertices(plConvexHull hull)
|
||||
{
|
||||
btConvexHullComputer *computer(reinterpret_cast< btConvexHullComputer* >(hull));
|
||||
|
24
extern/clew/include/clew.h
vendored
24
extern/clew/include/clew.h
vendored
@@ -2751,30 +2751,6 @@ CLEW_FUN_EXPORT PFNCLGETGLCONTEXTINFOKHR __clewGetGLContextInfoKH
|
||||
#endif
|
||||
#define clGetGLContextInfoKHR CLEW_GET_FUN(__clewGetGLContextInfoKHR )
|
||||
|
||||
/* cl_ext */
|
||||
|
||||
/******************************************
|
||||
* cl_nv_device_attribute_query extension *
|
||||
******************************************/
|
||||
/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
|
||||
#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
|
||||
#define CL_DEVICE_WARP_SIZE_NV 0x4003
|
||||
#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
|
||||
#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
|
||||
#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
|
||||
|
||||
/*********************************
|
||||
* cl_amd_device_attribute_query *
|
||||
*********************************/
|
||||
#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
|
||||
|
||||
/*********************************
|
||||
* cl_arm_printf extension
|
||||
*********************************/
|
||||
#define CL_PRINTF_CALLBACK_ARM 0x40B0
|
||||
#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1
|
||||
|
||||
#define CLEW_SUCCESS 0 //!< Success error code
|
||||
#define CLEW_ERROR_OPEN_FAILED -1 //!< Error code for failing to open the dynamic library
|
||||
|
7
extern/gtest/CMakeLists.txt
vendored
7
extern/gtest/CMakeLists.txt
vendored
@@ -21,13 +21,6 @@
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# avoid noisy warnings
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
remove_cc_flag(
|
||||
"-Wmissing-declarations"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(INC
|
||||
.
|
||||
include
|
||||
|
14
extern/libmv/intern/stub.cc
vendored
14
extern/libmv/intern/stub.cc
vendored
@@ -179,20 +179,20 @@ void libmv_reconstructionDestroy(
|
||||
|
||||
/* ************ Feature detector ************ */
|
||||
|
||||
libmv_Features *libmv_detectFeaturesByte(const unsigned char * /*image_buffer*/,
|
||||
libmv_Features *libmv_detectFeaturesByte(const unsigned char */*image_buffer*/,
|
||||
int /*width*/,
|
||||
int /*height*/,
|
||||
int /*channels*/,
|
||||
libmv_DetectOptions * /*options*/) {
|
||||
libmv_DetectOptions */*options*/) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct libmv_Features *libmv_detectFeaturesFloat(
|
||||
const float * /*image_buffer*/,
|
||||
const float */*image_buffer*/,
|
||||
int /*width*/,
|
||||
int /*height*/,
|
||||
int /*channels*/,
|
||||
libmv_DetectOptions * /*options*/) {
|
||||
libmv_DetectOptions */*options*/) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ void libmv_cameraIntrinsicsSetThreads(
|
||||
}
|
||||
|
||||
void libmv_cameraIntrinsicsExtractOptions(
|
||||
const libmv_CameraIntrinsics * /*libmv_intrinsics*/,
|
||||
const libmv_CameraIntrinsics */*libmv_intrinsics*/,
|
||||
libmv_CameraIntrinsicsOptions *camera_intrinsics_options) {
|
||||
memset(camera_intrinsics_options, 0, sizeof(libmv_CameraIntrinsicsOptions));
|
||||
camera_intrinsics_options->focal_length = 1.0;
|
||||
@@ -355,7 +355,7 @@ void libmv_autoTrackSetOptions(libmv_AutoTrack* /*libmv_autotrack*/,
|
||||
|
||||
int libmv_autoTrackMarker(libmv_AutoTrack* /*libmv_autotrack*/,
|
||||
const libmv_TrackRegionOptions* /*libmv_options*/,
|
||||
libmv_Marker * /*libmv_tracker_marker*/,
|
||||
libmv_Marker */*libmv_tracker_marker*/,
|
||||
libmv_TrackRegionResult* /*libmv_result*/)
|
||||
{
|
||||
return 0;
|
||||
@@ -390,7 +390,7 @@ void libmv_FrameAccessorDestroy(libmv_FrameAccessor* /*frame_accessor*/)
|
||||
}
|
||||
|
||||
int64_t libmv_frameAccessorgetTransformKey(
|
||||
const libmv_FrameTransform * /*transform*/)
|
||||
const libmv_FrameTransform */*transform*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
6
extern/rangetree/range_tree_c_api.h
vendored
6
extern/rangetree/range_tree_c_api.h
vendored
@@ -14,8 +14,8 @@
|
||||
02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __RANGE_TREE_C_API_H__
|
||||
#define __RANGE_TREE_C_API_H__
|
||||
#ifndef RANGE_TREE_C_API_H
|
||||
#define RANGE_TREE_C_API_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -59,4 +59,4 @@ unsigned int range_tree_uint_allocation_lower_bound(const RangeTreeUInt *rt);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __RANGE_TREE_C_API_H__ */
|
||||
#endif /* __DUALCON_H__ */
|
||||
|
@@ -77,27 +77,6 @@
|
||||
# define LG_SIZEOF_INT 2
|
||||
#endif
|
||||
|
||||
/************************/
|
||||
/* Function prototypes. */
|
||||
|
||||
#if (LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
|
||||
ATOMIC_INLINE uint64_t atomic_add_uint64(uint64_t *p, uint64_t x);
|
||||
ATOMIC_INLINE uint64_t atomic_sub_uint64(uint64_t *p, uint64_t x);
|
||||
ATOMIC_INLINE uint64_t atomic_cas_uint64(uint64_t *v, uint64_t old, uint64_t _new);
|
||||
#endif
|
||||
|
||||
ATOMIC_INLINE uint32_t atomic_add_uint32(uint32_t *p, uint32_t x);
|
||||
ATOMIC_INLINE uint32_t atomic_sub_uint32(uint32_t *p, uint32_t x);
|
||||
ATOMIC_INLINE uint32_t atomic_cas_uint32(uint32_t *v, uint32_t old, uint32_t _new);
|
||||
|
||||
ATOMIC_INLINE size_t atomic_add_z(size_t *p, size_t x);
|
||||
ATOMIC_INLINE size_t atomic_sub_z(size_t *p, size_t x);
|
||||
ATOMIC_INLINE size_t atomic_cas_z(size_t *v, size_t old, size_t _new);
|
||||
|
||||
ATOMIC_INLINE unsigned atomic_add_u(unsigned *p, unsigned x);
|
||||
ATOMIC_INLINE unsigned atomic_sub_u(unsigned *p, unsigned x);
|
||||
ATOMIC_INLINE unsigned atomic_cas_u(unsigned *v, unsigned old, unsigned _new);
|
||||
|
||||
/******************************************************************************/
|
||||
/* 64-bit operations. */
|
||||
#if (LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
|
||||
|
@@ -33,7 +33,16 @@
|
||||
#include "AUD_Space.h"
|
||||
|
||||
#include <cstring>
|
||||
#ifdef _MSC_VER
|
||||
#if (_MSC_VER <= 1500)
|
||||
typedef short int16_t;
|
||||
typedef int int32_t;
|
||||
#else
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
typedef void (*AUD_convert_f)(data_t* target, data_t* source, int length);
|
||||
|
||||
|
@@ -64,7 +64,7 @@ elseif(CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CYCLES_AVX_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx -mfpmath=sse")
|
||||
endif()
|
||||
if(CXX_HAS_AVX2)
|
||||
set(CYCLES_AVX2_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mf16c -mfpmath=sse")
|
||||
set(CYCLES_AVX2_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mfpmath=sse")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
@@ -80,7 +80,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CYCLES_AVX_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx")
|
||||
endif()
|
||||
if(CXX_HAS_AVX2)
|
||||
set(CYCLES_AVX2_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mf16c")
|
||||
set(CYCLES_AVX2_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mfma -mlzcnt -mbmi -mbmi2")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
|
||||
endif()
|
||||
|
@@ -34,8 +34,12 @@ cycles.Depends('../../source/blender/makesrna/intern/RNA_blender_cpp.h', 'makesr
|
||||
|
||||
sources = cycles.Glob('bvh/*.cpp') + cycles.Glob('device/*.cpp') + cycles.Glob('kernel/*.cpp') + cycles.Glob('render/*.cpp') + cycles.Glob('subd/*.cpp') + cycles.Glob('util/*.cpp') + cycles.Glob('blender/*.cpp')
|
||||
|
||||
sources.append(path.join('kernel', 'kernels', 'cpu', 'kernel.cpp'))
|
||||
sources.remove(path.join('util', 'util_view.cpp'))
|
||||
sources.remove(path.join('kernel', 'kernel_sse2.cpp'))
|
||||
sources.remove(path.join('kernel', 'kernel_sse3.cpp'))
|
||||
sources.remove(path.join('kernel', 'kernel_sse41.cpp'))
|
||||
sources.remove(path.join('kernel', 'kernel_avx.cpp'))
|
||||
sources.remove(path.join('kernel', 'kernel_avx2.cpp'))
|
||||
|
||||
incs = []
|
||||
defs = []
|
||||
@@ -136,13 +140,13 @@ else:
|
||||
|
||||
if (env['C_COMPILER_ID'] == 'gcc' and env['CCVERSION'] >= '4.6') or (env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.1'):
|
||||
kernel_flags['avx'] = kernel_flags['sse41'] + ' -mavx'
|
||||
kernel_flags['avx2'] = kernel_flags['avx'] + ' -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mf16c'
|
||||
kernel_flags['avx2'] = kernel_flags['avx'] + ' -mavx2 -mfma -mlzcnt -mbmi -mbmi2'
|
||||
|
||||
for kernel_type in kernel_flags.keys():
|
||||
defs.append('WITH_KERNEL_' + kernel_type.upper())
|
||||
|
||||
for kernel_type in kernel_flags.keys():
|
||||
kernel_source = path.join('kernel', 'kernels', 'cpu', 'kernel_' + kernel_type + '.cpp')
|
||||
kernel_source = path.join('kernel', 'kernel_' + kernel_type + '.cpp')
|
||||
kernel_cxxflags = Split(env['CXXFLAGS'])
|
||||
kernel_cxxflags.append(kernel_flags[kernel_type].split())
|
||||
kernel_defs = defs[:]
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#include "device.h"
|
||||
#include "scene.h"
|
||||
#include "session.h"
|
||||
#include "integrator.h"
|
||||
|
||||
#include "util_args.h"
|
||||
#include "util_foreach.h"
|
||||
@@ -273,7 +272,6 @@ static void keyboard(unsigned char key)
|
||||
else if(key == 'i')
|
||||
options.interactive = !(options.interactive);
|
||||
|
||||
/* Navigation */
|
||||
else if(options.interactive && (key == 'w' || key == 'a' || key == 's' || key == 'd')) {
|
||||
Transform matrix = options.session->scene->camera->matrix;
|
||||
float3 translate;
|
||||
@@ -296,25 +294,6 @@ static void keyboard(unsigned char key)
|
||||
|
||||
options.session->reset(session_buffer_params(), options.session_params.samples);
|
||||
}
|
||||
|
||||
/* Set Max Bounces */
|
||||
else if(options.interactive && (key == '0' || key == '1' || key == '2' || key == '3')) {
|
||||
int bounce;
|
||||
switch(key) {
|
||||
case '0': bounce = 0; break;
|
||||
case '1': bounce = 1; break;
|
||||
case '2': bounce = 2; break;
|
||||
case '3': bounce = 3; break;
|
||||
default: bounce = 0; break;
|
||||
}
|
||||
|
||||
options.session->scene->integrator->max_bounce = bounce;
|
||||
|
||||
/* Update and Reset */
|
||||
options.session->scene->integrator->need_update = true;
|
||||
|
||||
options.session->reset(session_buffer_params(), options.session_params.samples);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -398,8 +377,7 @@ static void options_parse(int argc, const char **argv)
|
||||
printf("Devices:\n");
|
||||
|
||||
foreach(DeviceInfo& info, devices) {
|
||||
printf(" %-10s%s%s\n",
|
||||
Device::string_from_type(info.type).c_str(),
|
||||
printf(" %s%s\n",
|
||||
info.description.c_str(),
|
||||
(info.display_device)? " (display)": "");
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include "background.h"
|
||||
#include "camera.h"
|
||||
#include "film.h"
|
||||
#include "graph.h"
|
||||
@@ -56,16 +55,6 @@ struct XMLReadState {
|
||||
string base; /* base path to current file*/
|
||||
float dicing_rate; /* current dicing rate */
|
||||
Mesh::DisplacementMethod displacement_method;
|
||||
|
||||
XMLReadState()
|
||||
: scene(NULL),
|
||||
smooth(false),
|
||||
shader(0),
|
||||
dicing_rate(0.0f),
|
||||
displacement_method(Mesh::DISPLACE_BUMP)
|
||||
{
|
||||
tfm = transform_identity();
|
||||
}
|
||||
};
|
||||
|
||||
/* Attribute Reading */
|
||||
@@ -392,10 +381,6 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
|
||||
for(pugi::xml_node node = graph_node.first_child(); node; node = node.next_sibling()) {
|
||||
ShaderNode *snode = NULL;
|
||||
|
||||
/* ToDo: Add missing nodes
|
||||
* RGBCurvesNode, VectorCurvesNode, RGBRampNode and ConvertNode (RGB -> BW).
|
||||
*/
|
||||
|
||||
if(string_iequals(node.name(), "image_texture")) {
|
||||
ImageTextureNode *img = new ImageTextureNode();
|
||||
|
||||
@@ -406,8 +391,6 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
|
||||
xml_read_enum(&img->projection, ImageTextureNode::projection_enum, node, "projection");
|
||||
xml_read_float(&img->projection_blend, node, "projection_blend");
|
||||
|
||||
/* ToDo: Interpolation */
|
||||
|
||||
snode = img;
|
||||
}
|
||||
else if(string_iequals(node.name(), "environment_texture")) {
|
||||
@@ -510,6 +493,10 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
|
||||
xml_read_int(&magic->depth, node, "depth");
|
||||
snode = magic;
|
||||
}
|
||||
else if(string_iequals(node.name(), "noise_texture")) {
|
||||
NoiseTextureNode *dist = new NoiseTextureNode();
|
||||
snode = dist;
|
||||
}
|
||||
else if(string_iequals(node.name(), "wave_texture")) {
|
||||
WaveTextureNode *wave = new WaveTextureNode();
|
||||
xml_read_enum(&wave->type, WaveTextureNode::type_enum, node, "type");
|
||||
@@ -520,11 +507,6 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
|
||||
xml_read_float3(&normal->direction, node, "direction");
|
||||
snode = normal;
|
||||
}
|
||||
else if(string_iequals(node.name(), "bump")) {
|
||||
BumpNode *bump = new BumpNode();
|
||||
xml_read_bool(&bump->invert, node, "invert");
|
||||
snode = bump;
|
||||
}
|
||||
else if(string_iequals(node.name(), "mapping")) {
|
||||
snode = new MappingNode();
|
||||
}
|
||||
@@ -579,9 +561,6 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
|
||||
else if(string_iequals(node.name(), "background")) {
|
||||
snode = new BackgroundNode();
|
||||
}
|
||||
else if(string_iequals(node.name(), "holdout")) {
|
||||
snode = new HoldoutNode();
|
||||
}
|
||||
else if(string_iequals(node.name(), "absorption_volume")) {
|
||||
snode = new AbsorptionVolumeNode();
|
||||
}
|
||||
@@ -590,14 +569,7 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
|
||||
}
|
||||
else if(string_iequals(node.name(), "subsurface_scattering")) {
|
||||
SubsurfaceScatteringNode *sss = new SubsurfaceScatteringNode();
|
||||
|
||||
string falloff;
|
||||
xml_read_string(&falloff, node, "falloff");
|
||||
if(falloff == "cubic")
|
||||
sss->closure = CLOSURE_BSSRDF_CUBIC_ID;
|
||||
else
|
||||
sss->closure = CLOSURE_BSSRDF_GAUSSIAN_ID;
|
||||
|
||||
//xml_read_enum(&sss->falloff, SubsurfaceScatteringNode::falloff_enum, node, "falloff");
|
||||
snode = sss;
|
||||
}
|
||||
else if(string_iequals(node.name(), "geometry")) {
|
||||
@@ -641,7 +613,6 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
|
||||
snode = new InvertNode();
|
||||
}
|
||||
else if(string_iequals(node.name(), "mix")) {
|
||||
/* ToDo: Tag Mix case for optimization */
|
||||
MixNode *mix = new MixNode();
|
||||
xml_read_enum(&mix->type, MixNode::type_enum, node, "type");
|
||||
xml_read_bool(&mix->use_clamp, node, "use_clamp");
|
||||
@@ -666,10 +637,10 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
|
||||
snode = new SeparateHSVNode();
|
||||
}
|
||||
else if(string_iequals(node.name(), "combine_xyz")) {
|
||||
snode = new CombineXYZNode();
|
||||
snode = new CombineHSVNode();
|
||||
}
|
||||
else if(string_iequals(node.name(), "separate_xyz")) {
|
||||
snode = new SeparateXYZNode();
|
||||
snode = new SeparateHSVNode();
|
||||
}
|
||||
else if(string_iequals(node.name(), "hsv")) {
|
||||
snode = new HSVNode();
|
||||
@@ -851,15 +822,6 @@ static void xml_read_shader(const XMLReadState& state, pugi::xml_node node)
|
||||
|
||||
static void xml_read_background(const XMLReadState& state, pugi::xml_node node)
|
||||
{
|
||||
/* Background Settings */
|
||||
Background *bg = state.scene->background;
|
||||
|
||||
xml_read_float(&bg->ao_distance, node, "ao_distance");
|
||||
xml_read_float(&bg->ao_factor, node, "ao_factor");
|
||||
|
||||
xml_read_bool(&bg->transparent, node, "transparent");
|
||||
|
||||
/* Background Shader */
|
||||
Shader *shader = state.scene->shaders[state.scene->default_background];
|
||||
|
||||
xml_read_bool(&shader->heterogeneous_volume, node, "heterogeneous_volume");
|
||||
@@ -906,7 +868,6 @@ static void xml_read_mesh(const XMLReadState& state, pugi::xml_node node)
|
||||
|
||||
/* read vertices and polygons, RIB style */
|
||||
vector<float3> P;
|
||||
vector<float> UV;
|
||||
vector<int> verts, nverts;
|
||||
|
||||
xml_read_float3_array(P, node, "P");
|
||||
@@ -978,31 +939,6 @@ static void xml_read_mesh(const XMLReadState& state, pugi::xml_node node)
|
||||
|
||||
index_offset += nverts[i];
|
||||
}
|
||||
|
||||
if(xml_read_float_array(UV, node, "UV")) {
|
||||
ustring name = ustring("UVMap");
|
||||
Attribute *attr = mesh->attributes.add(ATTR_STD_UV, name);
|
||||
float3 *fdata = attr->data_float3();
|
||||
|
||||
/* loop over the triangles */
|
||||
index_offset = 0;
|
||||
for(size_t i = 0; i < nverts.size(); i++) {
|
||||
for(int j = 0; j < nverts[i]-2; j++) {
|
||||
int v0 = verts[index_offset];
|
||||
int v1 = verts[index_offset + j + 1];
|
||||
int v2 = verts[index_offset + j + 2];
|
||||
|
||||
assert(v0*2+1 < (int)UV.size());
|
||||
assert(v1*2+1 < (int)UV.size());
|
||||
assert(v2*2+1 < (int)UV.size());
|
||||
|
||||
fdata[0] = make_float3(UV[v0*2], UV[v0*2+1], 0.0);
|
||||
fdata[1] = make_float3(UV[v1*2], UV[v1*2+1], 0.0);
|
||||
fdata[2] = make_float3(UV[v2*2], UV[v2*2+1], 0.0);
|
||||
fdata += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* temporary for test compatibility */
|
||||
@@ -1092,28 +1028,13 @@ static void xml_read_light(const XMLReadState& state, pugi::xml_node node)
|
||||
xml_read_float(&light->sizev, node, "sizev");
|
||||
xml_read_float3(&light->axisu, node, "axisu");
|
||||
xml_read_float3(&light->axisv, node, "axisv");
|
||||
|
||||
/* Portal? (Area light only) */
|
||||
xml_read_bool(&light->is_portal, node, "is_portal");
|
||||
|
||||
|
||||
/* Generic */
|
||||
xml_read_float(&light->size, node, "size");
|
||||
xml_read_float3(&light->dir, node, "dir");
|
||||
xml_read_float3(&light->co, node, "P");
|
||||
light->co = transform_point(&state.tfm, light->co);
|
||||
|
||||
/* Settings */
|
||||
xml_read_bool(&light->cast_shadow, node, "cast_shadow");
|
||||
xml_read_bool(&light->use_mis, node, "use_mis");
|
||||
xml_read_int(&light->samples, node, "samples");
|
||||
xml_read_int(&light->max_bounces, node, "max_bounces");
|
||||
|
||||
/* Ray Visibility */
|
||||
xml_read_bool(&light->use_diffuse, node, "use_diffuse");
|
||||
xml_read_bool(&light->use_glossy, node, "use_glossy");
|
||||
xml_read_bool(&light->use_transmission, node, "use_transmission");
|
||||
xml_read_bool(&light->use_scatter, node, "use_scatter");
|
||||
|
||||
state.scene->lights.push_back(light);
|
||||
}
|
||||
|
||||
@@ -1257,8 +1178,7 @@ static void xml_read_include(const XMLReadState& state, const string& src)
|
||||
XMLReadState substate = state;
|
||||
substate.base = path_dirname(path);
|
||||
|
||||
pugi::xml_node cycles = doc.child("cycles");
|
||||
xml_read_scene(substate, cycles);
|
||||
xml_read_scene(substate, doc);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "%s read error: %s\n", src.c_str(), parse_result.description());
|
||||
|
@@ -30,10 +30,8 @@ bl_info = {
|
||||
|
||||
import bpy
|
||||
|
||||
from . import (
|
||||
engine,
|
||||
version_update,
|
||||
)
|
||||
from . import engine
|
||||
from . import version_update
|
||||
|
||||
|
||||
class CyclesRender(bpy.types.RenderEngine):
|
||||
@@ -67,8 +65,8 @@ class CyclesRender(bpy.types.RenderEngine):
|
||||
def render(self, scene):
|
||||
engine.render(self)
|
||||
|
||||
def bake(self, scene, obj, pass_type, object_id, pixel_array, num_pixels, depth, result):
|
||||
engine.bake(self, obj, pass_type, object_id, pixel_array, num_pixels, depth, result)
|
||||
def bake(self, scene, obj, pass_type, pixel_array, num_pixels, depth, result):
|
||||
engine.bake(self, obj, pass_type, pixel_array, num_pixels, depth, result)
|
||||
|
||||
# viewport render
|
||||
def view_update(self, context):
|
||||
|
@@ -59,11 +59,11 @@ def render(engine):
|
||||
_cycles.render(engine.session)
|
||||
|
||||
|
||||
def bake(engine, obj, pass_type, object_id, pixel_array, num_pixels, depth, result):
|
||||
def bake(engine, obj, pass_type, pixel_array, num_pixels, depth, result):
|
||||
import _cycles
|
||||
session = getattr(engine, "session", None)
|
||||
if session is not None:
|
||||
_cycles.bake(engine.session, obj.as_pointer(), pass_type, object_id, pixel_array.as_pointer(), num_pixels, depth, result.as_pointer())
|
||||
_cycles.bake(engine.session, obj.as_pointer(), pass_type, pixel_array.as_pointer(), num_pixels, depth, result.as_pointer())
|
||||
|
||||
|
||||
def reset(engine, data, scene):
|
||||
|
@@ -66,7 +66,6 @@ enum_panorama_types = (
|
||||
('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
|
||||
('FISHEYE_EQUISOLID', "Fisheye Equisolid",
|
||||
"Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
|
||||
('MIRRORBALL', "Mirror Ball", "Uses the mirror ball mapping"),
|
||||
)
|
||||
|
||||
enum_curve_primitives = (
|
||||
@@ -394,12 +393,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
default=0,
|
||||
)
|
||||
|
||||
cls.use_animated_seed = BoolProperty(
|
||||
name="Use Animated Seed",
|
||||
description="Use different seed values (and hence noise patterns) at different frames",
|
||||
default=False,
|
||||
)
|
||||
|
||||
cls.sample_clamp_direct = FloatProperty(
|
||||
name="Clamp Direct",
|
||||
description="If non-zero, the maximum value for a direct sample, "
|
||||
@@ -700,12 +693,6 @@ class CyclesLampSettings(bpy.types.PropertyGroup):
|
||||
"reduces noise for area lamps and sharp glossy materials",
|
||||
default=False,
|
||||
)
|
||||
cls.is_portal = BoolProperty(
|
||||
name="Is Portal",
|
||||
description="Use this area lamp to guide sampling of the background, "
|
||||
"note that this will make the lamp invisible",
|
||||
default=False,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def unregister(cls):
|
||||
|
@@ -18,11 +18,7 @@
|
||||
|
||||
import bpy
|
||||
|
||||
from bpy.types import (
|
||||
Panel,
|
||||
Menu,
|
||||
Operator,
|
||||
)
|
||||
from bpy.types import Panel, Menu, Operator, UIList
|
||||
|
||||
|
||||
class CYCLES_MT_sampling_presets(Menu):
|
||||
@@ -60,15 +56,7 @@ def use_cpu(context):
|
||||
return (device_type == 'NONE' or cscene.device == 'CPU')
|
||||
|
||||
|
||||
def use_branched_path(context):
|
||||
cscene = context.scene.cycles
|
||||
device_type = context.user_preferences.system.compute_device_type
|
||||
|
||||
return (cscene.progressive == 'BRANCHED_PATH' and device_type != 'OPENCL')
|
||||
|
||||
|
||||
def draw_samples_info(layout, context):
|
||||
cscene = context.scene.cycles
|
||||
def draw_samples_info(layout, cscene):
|
||||
integrator = cscene.progressive
|
||||
|
||||
# Calculate sample values
|
||||
@@ -98,7 +86,7 @@ def draw_samples_info(layout, context):
|
||||
|
||||
# Draw interface
|
||||
# Do not draw for progressive, when Square Samples are disabled
|
||||
if use_branched_path(context) or (cscene.use_square_samples and integrator == 'PATH'):
|
||||
if (integrator == 'BRANCHED_PATH') or (cscene.use_square_samples and integrator == 'PATH'):
|
||||
col = layout.column(align=True)
|
||||
col.scale_y = 0.6
|
||||
col.label("Total Samples:")
|
||||
@@ -122,7 +110,6 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
device_type = context.user_preferences.system.compute_device_type
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.menu("CYCLES_MT_sampling_presets", text=bpy.types.CYCLES_MT_sampling_presets.bl_label)
|
||||
@@ -130,9 +117,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True
|
||||
|
||||
row = layout.row()
|
||||
sub = row.row()
|
||||
sub.active = device_type != 'OPENCL'
|
||||
sub.prop(cscene, "progressive", text="")
|
||||
row.prop(cscene, "progressive", text="")
|
||||
row.prop(cscene, "use_square_samples")
|
||||
|
||||
split = layout.split()
|
||||
@@ -140,15 +125,11 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
col = split.column()
|
||||
sub = col.column(align=True)
|
||||
sub.label("Settings:")
|
||||
|
||||
seed_sub = sub.row(align=True)
|
||||
seed_sub.prop(cscene, "seed")
|
||||
seed_sub.prop(cscene, "use_animated_seed", text="", icon="TIME")
|
||||
|
||||
sub.prop(cscene, "seed")
|
||||
sub.prop(cscene, "sample_clamp_direct")
|
||||
sub.prop(cscene, "sample_clamp_indirect")
|
||||
|
||||
if cscene.progressive == 'PATH' or use_branched_path(context) == False:
|
||||
if cscene.progressive == 'PATH':
|
||||
col = split.column()
|
||||
sub = col.column(align=True)
|
||||
sub.label(text="Samples:")
|
||||
@@ -182,7 +163,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
layout.row().prop(cscene, "use_layer_samples")
|
||||
break
|
||||
|
||||
draw_samples_info(layout, context)
|
||||
draw_samples_info(layout, cscene)
|
||||
|
||||
|
||||
class CyclesRender_PT_volume_sampling(CyclesButtonsPanel, Panel):
|
||||
@@ -431,9 +412,6 @@ class CyclesRender_PT_layer_passes(CyclesButtonsPanel, Panel):
|
||||
col.prop(rl, "use_pass_emit", text="Emission")
|
||||
col.prop(rl, "use_pass_environment")
|
||||
|
||||
if hasattr(rd, "debug_pass_type"):
|
||||
layout.prop(rd, "debug_pass_type")
|
||||
|
||||
|
||||
class CyclesRender_PT_views(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Views"
|
||||
@@ -450,6 +428,7 @@ class CyclesRender_PT_views(CyclesButtonsPanel, Panel):
|
||||
rd = scene.render
|
||||
rv = rd.views.active
|
||||
|
||||
|
||||
layout.active = rd.use_multiview
|
||||
basic_stereo = (rd.views_format == 'STEREO_3D')
|
||||
|
||||
@@ -525,12 +504,12 @@ class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel):
|
||||
sub = col.column(align=True)
|
||||
sub.label("Viewport:")
|
||||
subhq = sub.column()
|
||||
subhq.active = hq_support
|
||||
subhq.active = hq_support;
|
||||
subhq.prop(dof_options, "use_high_quality")
|
||||
sub.prop(dof_options, "fstop")
|
||||
if dof_options.use_high_quality and hq_support:
|
||||
sub.prop(dof_options, "blades")
|
||||
|
||||
|
||||
col = split.column()
|
||||
|
||||
col.label("Aperture:")
|
||||
@@ -563,16 +542,11 @@ class Cycles_PT_context_material(CyclesButtonsPanel, Panel):
|
||||
ob = context.object
|
||||
slot = context.material_slot
|
||||
space = context.space_data
|
||||
is_sortable = len(ob.material_slots) > 1
|
||||
|
||||
if ob:
|
||||
rows = 1
|
||||
if (is_sortable):
|
||||
rows = 4
|
||||
|
||||
row = layout.row()
|
||||
|
||||
row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=rows)
|
||||
row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=1)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("object.material_slot_add", icon='ZOOMIN', text="")
|
||||
@@ -580,12 +554,6 @@ class Cycles_PT_context_material(CyclesButtonsPanel, Panel):
|
||||
|
||||
col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
|
||||
|
||||
if is_sortable:
|
||||
col.separator()
|
||||
|
||||
col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP'
|
||||
col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
|
||||
|
||||
if ob.mode == 'EDIT':
|
||||
row = layout.row(align=True)
|
||||
row.operator("object.material_slot_assign", text="Assign")
|
||||
@@ -647,13 +615,7 @@ class CyclesObject_PT_motion_blur(CyclesButtonsPanel, Panel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
if CyclesButtonsPanel.poll(context) and ob:
|
||||
if ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'}:
|
||||
return True
|
||||
if ob.dupli_type == 'GROUP' and ob.dupli_group:
|
||||
return True
|
||||
# TODO(sergey): More duplicator types here?
|
||||
return False
|
||||
return CyclesButtonsPanel.poll(context) and ob and ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'}
|
||||
|
||||
def draw_header(self, context):
|
||||
layout = self.layout
|
||||
@@ -696,8 +658,8 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
return (CyclesButtonsPanel.poll(context) and
|
||||
ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LAMP'}) or
|
||||
(ob.dupli_type == 'GROUP' and ob.dupli_group)))
|
||||
ob and ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LAMP'} or
|
||||
ob and ob.dupli_type == 'GROUP' and ob.dupli_group)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -742,14 +704,9 @@ def find_node(material, nodetype):
|
||||
if material and material.node_tree:
|
||||
ntree = material.node_tree
|
||||
|
||||
active_output_node = None
|
||||
for node in ntree.nodes:
|
||||
if getattr(node, "type", None) == nodetype:
|
||||
if getattr(node, "is_active_output", True):
|
||||
return node
|
||||
if not active_output_node:
|
||||
active_output_node = node
|
||||
return active_output_node
|
||||
return node
|
||||
|
||||
return None
|
||||
|
||||
@@ -786,10 +743,7 @@ class CyclesLamp_PT_preview(CyclesButtonsPanel, Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.lamp and \
|
||||
not (context.lamp.type == 'AREA' and
|
||||
context.lamp.cycles.is_portal) \
|
||||
and CyclesButtonsPanel.poll(context)
|
||||
return context.lamp and CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
self.layout.template_preview(context.lamp)
|
||||
@@ -827,21 +781,13 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
|
||||
sub.prop(lamp, "size", text="Size X")
|
||||
sub.prop(lamp, "size_y", text="Size Y")
|
||||
|
||||
if not (lamp.type == 'AREA' and clamp.is_portal):
|
||||
sub = col.column(align=True)
|
||||
if use_branched_path(context):
|
||||
sub.prop(clamp, "samples")
|
||||
sub.prop(clamp, "max_bounces")
|
||||
if cscene.progressive == 'BRANCHED_PATH':
|
||||
col.prop(clamp, "samples")
|
||||
col.prop(clamp, "max_bounces")
|
||||
|
||||
col = split.column()
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = not (lamp.type == 'AREA' and clamp.is_portal)
|
||||
sub.prop(clamp, "cast_shadow")
|
||||
sub.prop(clamp, "use_multiple_importance_sampling", text="Multiple Importance")
|
||||
|
||||
if lamp.type == 'AREA':
|
||||
col.prop(clamp, "is_portal", text="Portal")
|
||||
col.prop(clamp, "cast_shadow")
|
||||
col.prop(clamp, "use_multiple_importance_sampling", text="Multiple Importance")
|
||||
|
||||
if lamp.type == 'HEMI':
|
||||
layout.label(text="Not supported, interpreted as sun lamp")
|
||||
@@ -853,9 +799,7 @@ class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.lamp and not (context.lamp.type == 'AREA' and
|
||||
context.lamp.cycles.is_portal) and \
|
||||
CyclesButtonsPanel.poll(context)
|
||||
return context.lamp and CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -1038,7 +982,7 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
|
||||
sub = col.column(align=True)
|
||||
sub.active = cworld.sample_as_light
|
||||
sub.prop(cworld, "sample_map_resolution")
|
||||
if use_branched_path(context):
|
||||
if cscene.progressive == 'BRANCHED_PATH':
|
||||
sub.prop(cworld, "samples")
|
||||
|
||||
col = split.column()
|
||||
@@ -1140,7 +1084,7 @@ class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
|
||||
sub = col.column()
|
||||
sub.active = use_cpu(context)
|
||||
sub.prop(cmat, "volume_sampling", text="")
|
||||
sub.prop(cmat, "volume_interpolation", text="")
|
||||
col.prop(cmat, "volume_interpolation", text="")
|
||||
col.prop(cmat, "homogeneous_volume", text="Homogeneous")
|
||||
|
||||
layout.separator()
|
||||
@@ -1452,17 +1396,10 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
|
||||
rd = context.scene.render
|
||||
|
||||
layout.active = rd.use_simplify
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Viewport:")
|
||||
col.prop(rd, "simplify_subdivision", text="Subdivision")
|
||||
col.prop(rd, "simplify_child_particles", text="Child Particles")
|
||||
|
||||
col = split.column()
|
||||
col.label(text="Render:")
|
||||
col.prop(rd, "simplify_subdivision_render", text="Subdivision")
|
||||
col.prop(rd, "simplify_child_particles_render", text="Child Particles")
|
||||
row = layout.row()
|
||||
row.prop(rd, "simplify_subdivision", text="Subdivision")
|
||||
row.prop(rd, "simplify_child_particles", text="Child Particles")
|
||||
|
||||
|
||||
def draw_device(self, context):
|
||||
|
@@ -148,9 +148,6 @@ static void blender_camera_from_object(BlenderCamera *bcam, BL::RenderEngine b_e
|
||||
case 2:
|
||||
bcam->panorama_type = PANORAMA_FISHEYE_EQUISOLID;
|
||||
break;
|
||||
case 3:
|
||||
bcam->panorama_type = PANORAMA_MIRRORBALL;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
bcam->panorama_type = PANORAMA_EQUIRECTANGULAR;
|
||||
@@ -207,34 +204,19 @@ static void blender_camera_from_object(BlenderCamera *bcam, BL::RenderEngine b_e
|
||||
}
|
||||
}
|
||||
|
||||
static Transform blender_camera_matrix(const Transform& tfm,
|
||||
const CameraType type,
|
||||
const PanoramaType panorama_type)
|
||||
static Transform blender_camera_matrix(const Transform& tfm, CameraType type)
|
||||
{
|
||||
Transform result;
|
||||
|
||||
if(type == CAMERA_PANORAMA) {
|
||||
if(panorama_type == PANORAMA_MIRRORBALL) {
|
||||
/* Mirror ball camera is looking into the negative Y direction
|
||||
* which matches texture mirror ball mapping.
|
||||
*/
|
||||
result = tfm *
|
||||
make_transform(1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
0.0f, 1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
/* Make it so environment camera needs to be pointed in the direction
|
||||
* of the positive x-axis to match an environment texture, this way
|
||||
* it is looking at the center of the texture
|
||||
*/
|
||||
result = tfm *
|
||||
make_transform( 0.0f, -1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
-1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
/* make it so environment camera needs to be pointed in the direction
|
||||
* of the positive x-axis to match an environment texture, this way
|
||||
* it is looking at the center of the texture */
|
||||
result = tfm *
|
||||
make_transform( 0.0f, -1.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 1.0f, 0.0f,
|
||||
-1.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
/* note the blender camera points along the negative z-axis */
|
||||
@@ -380,9 +362,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
|
||||
cam->bladesrotation = bcam->aperturerotation;
|
||||
|
||||
/* transform */
|
||||
cam->matrix = blender_camera_matrix(bcam->matrix,
|
||||
bcam->type,
|
||||
bcam->panorama_type);
|
||||
cam->matrix = blender_camera_matrix(bcam->matrix, bcam->type);
|
||||
cam->motion.pre = cam->matrix;
|
||||
cam->motion.post = cam->matrix;
|
||||
cam->use_motion = false;
|
||||
@@ -441,7 +421,7 @@ void BlenderSync::sync_camera_motion(BL::Object b_ob, float motion_time)
|
||||
BL::Array<float, 16> b_ob_matrix;
|
||||
b_engine.camera_model_matrix(b_ob, b_ob_matrix);
|
||||
Transform tfm = get_transform(b_ob_matrix);
|
||||
tfm = blender_camera_matrix(tfm, cam->type, cam->panorama_type);
|
||||
tfm = blender_camera_matrix(tfm, cam->type);
|
||||
|
||||
if(tfm != cam->matrix) {
|
||||
VLOG(1) << "Camera " << b_ob.name() << " motion detected.";
|
||||
|
@@ -621,7 +621,7 @@ void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData)
|
||||
}
|
||||
|
||||
/* check allocation */
|
||||
if((mesh->curve_keys.size() != num_keys) || (mesh->curves.size() != num_curves)) {
|
||||
if((mesh->curve_keys.size() != num_keys) || (mesh->curves.size() != num_curves)) {
|
||||
VLOG(1) << "Allocation failed, clearing data";
|
||||
mesh->curve_keys.clear();
|
||||
mesh->curves.clear();
|
||||
|
@@ -324,15 +324,15 @@ static void attr_create_uv_map(Scene *scene,
|
||||
size_t i = 0;
|
||||
|
||||
for(l->data.begin(t); t != l->data.end(); ++t, ++i) {
|
||||
fdata[0] = get_float3(t->uv1());
|
||||
fdata[1] = get_float3(t->uv2());
|
||||
fdata[2] = get_float3(t->uv3());
|
||||
fdata[0] = get_float3(t->uv1());
|
||||
fdata[1] = get_float3(t->uv2());
|
||||
fdata[2] = get_float3(t->uv3());
|
||||
fdata += 3;
|
||||
|
||||
if(nverts[i] == 4) {
|
||||
fdata[0] = get_float3(t->uv1());
|
||||
fdata[1] = get_float3(t->uv3());
|
||||
fdata[2] = get_float3(t->uv4());
|
||||
fdata[0] = get_float3(t->uv1());
|
||||
fdata[1] = get_float3(t->uv3());
|
||||
fdata[2] = get_float3(t->uv4());
|
||||
fdata += 3;
|
||||
}
|
||||
}
|
||||
@@ -621,13 +621,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
|
||||
}
|
||||
|
||||
/* test if we need to sync */
|
||||
int requested_geometry_flags = Mesh::GEOMETRY_NONE;
|
||||
if(render_layer.use_surfaces) {
|
||||
requested_geometry_flags |= Mesh::GEOMETRY_TRIANGLES;
|
||||
}
|
||||
if(render_layer.use_hair) {
|
||||
requested_geometry_flags |= Mesh::GEOMETRY_CURVES;
|
||||
}
|
||||
bool use_mesh_geometry = render_layer.use_surfaces || render_layer.use_hair;
|
||||
Mesh *mesh;
|
||||
|
||||
if(!mesh_map.sync(&mesh, key)) {
|
||||
@@ -636,7 +630,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
|
||||
/* test if shaders changed, these can be object level so mesh
|
||||
* does not get tagged for recalc */
|
||||
else if(mesh->used_shaders != used_shaders);
|
||||
else if(requested_geometry_flags != mesh->geometry_flags);
|
||||
else if(use_mesh_geometry != mesh->geometry_synced);
|
||||
else {
|
||||
/* even if not tagged for recalc, we may need to sync anyway
|
||||
* because the shader needs different mesh attributes */
|
||||
@@ -670,7 +664,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
|
||||
mesh->used_shaders = used_shaders;
|
||||
mesh->name = ustring(b_ob_data.name().c_str());
|
||||
|
||||
if(requested_geometry_flags != Mesh::GEOMETRY_NONE) {
|
||||
if(use_mesh_geometry) {
|
||||
/* mesh objects does have special handle in the dependency graph,
|
||||
* they're ensured to have properly updated.
|
||||
*
|
||||
@@ -703,8 +697,8 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
|
||||
/* free derived mesh */
|
||||
b_data.meshes.remove(b_mesh);
|
||||
}
|
||||
mesh->geometry_synced = true;
|
||||
}
|
||||
mesh->geometry_flags = requested_geometry_flags;
|
||||
|
||||
/* displacement method */
|
||||
if(cmesh.data) {
|
||||
|
@@ -90,17 +90,14 @@ static uint object_ray_visibility(BL::Object b_ob)
|
||||
|
||||
/* Light */
|
||||
|
||||
void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm, bool *use_portal)
|
||||
void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm)
|
||||
{
|
||||
/* test if we need to sync */
|
||||
Light *light;
|
||||
ObjectKey key(b_parent, persistent_id, b_ob);
|
||||
|
||||
if(!light_map.sync(&light, b_ob, b_parent, key)) {
|
||||
if(light->is_portal)
|
||||
*use_portal = true;
|
||||
if(!light_map.sync(&light, b_ob, b_parent, key))
|
||||
return;
|
||||
}
|
||||
|
||||
BL::Lamp b_lamp(b_ob.data());
|
||||
|
||||
@@ -174,14 +171,6 @@ void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSI
|
||||
|
||||
light->max_bounces = get_int(clamp, "max_bounces");
|
||||
|
||||
if(light->type == LIGHT_AREA)
|
||||
light->is_portal = get_boolean(clamp, "is_portal");
|
||||
else
|
||||
light->is_portal = false;
|
||||
|
||||
if(light->is_portal)
|
||||
*use_portal = true;
|
||||
|
||||
/* visibility */
|
||||
uint visibility = object_ray_visibility(b_ob);
|
||||
light->use_diffuse = (visibility & PATH_RAY_DIFFUSE) != 0;
|
||||
@@ -193,7 +182,7 @@ void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSI
|
||||
light->tag_update(scene);
|
||||
}
|
||||
|
||||
void BlenderSync::sync_background_light(bool use_portal)
|
||||
void BlenderSync::sync_background_light()
|
||||
{
|
||||
BL::World b_world = b_scene.world();
|
||||
|
||||
@@ -202,20 +191,19 @@ void BlenderSync::sync_background_light(bool use_portal)
|
||||
PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
|
||||
bool sample_as_light = get_boolean(cworld, "sample_as_light");
|
||||
|
||||
if(sample_as_light || use_portal) {
|
||||
if(sample_as_light) {
|
||||
/* test if we need to sync */
|
||||
Light *light;
|
||||
ObjectKey key(b_world, 0, b_world);
|
||||
|
||||
if(light_map.sync(&light, b_world, b_world, key) ||
|
||||
world_recalc ||
|
||||
b_world.ptr.data != world_map)
|
||||
world_recalc ||
|
||||
b_world.ptr.data != world_map)
|
||||
{
|
||||
light->type = LIGHT_BACKGROUND;
|
||||
light->map_resolution = get_int(cworld, "sample_map_resolution");
|
||||
light->shader = scene->default_background;
|
||||
light->use_mis = sample_as_light;
|
||||
|
||||
|
||||
int samples = get_int(cworld, "samples");
|
||||
if(get_boolean(cscene, "use_square_samples"))
|
||||
light->samples = samples * samples;
|
||||
@@ -235,7 +223,7 @@ void BlenderSync::sync_background_light(bool use_portal)
|
||||
/* Object */
|
||||
|
||||
Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
|
||||
Transform& tfm, uint layer_flag, float motion_time, bool hide_tris, bool *use_portal)
|
||||
Transform& tfm, uint layer_flag, float motion_time, bool hide_tris)
|
||||
{
|
||||
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
|
||||
bool motion = motion_time != 0.0f;
|
||||
@@ -244,7 +232,7 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P
|
||||
if(object_is_light(b_ob)) {
|
||||
/* don't use lamps for excluded layers used as mask layer */
|
||||
if(!motion && !((layer_flag & render_layer.holdout_layer) && (layer_flag & render_layer.exclude_layer)))
|
||||
sync_light(b_parent, persistent_id, b_ob, tfm, use_portal);
|
||||
sync_light(b_parent, persistent_id, b_ob, tfm);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -261,9 +249,7 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P
|
||||
if(motion) {
|
||||
object = object_map.find(key);
|
||||
|
||||
if(object && (scene->need_motion() == Scene::MOTION_PASS ||
|
||||
object_use_motion(b_parent, b_ob)))
|
||||
{
|
||||
if(object && (scene->need_motion() == Scene::MOTION_PASS || object_use_motion(b_ob))) {
|
||||
/* object transformation */
|
||||
if(tfm != object->tfm) {
|
||||
VLOG(1) << "Object " << b_ob.name() << " motion detected.";
|
||||
@@ -344,8 +330,8 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P
|
||||
|
||||
mesh->use_motion_blur = false;
|
||||
|
||||
if(object_use_motion(b_parent, b_ob)) {
|
||||
if(object_use_deform_motion(b_parent, b_ob)) {
|
||||
if(object_use_motion(b_ob)) {
|
||||
if(object_use_deform_motion(b_ob)) {
|
||||
mesh->motion_steps = object_motion_steps(b_ob);
|
||||
mesh->use_motion_blur = true;
|
||||
}
|
||||
@@ -490,7 +476,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
|
||||
int dupli_settings = preview ? 1 : 2;
|
||||
|
||||
bool cancel = false;
|
||||
bool use_portal = false;
|
||||
|
||||
for(; b_sce && !cancel; b_sce = b_sce.background_set()) {
|
||||
for(b_sce.object_bases.begin(b_base); b_base != b_sce.object_bases.end() && !cancel; ++b_base) {
|
||||
@@ -521,7 +506,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
|
||||
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup->persistent_id();
|
||||
|
||||
/* sync object and mesh or light data */
|
||||
Object *object = sync_object(b_ob, persistent_id.data, *b_dup, tfm, ob_layer, motion_time, hide_tris, &use_portal);
|
||||
Object *object = sync_object(b_ob, persistent_id.data, *b_dup, tfm, ob_layer, motion_time, hide_tris);
|
||||
|
||||
/* sync possible particle data, note particle_id
|
||||
* starts counting at 1, first is dummy particle */
|
||||
@@ -541,7 +526,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
|
||||
if(!object_render_hide(b_ob, true, true, hide_tris)) {
|
||||
/* object itself */
|
||||
Transform tfm = get_transform(b_ob.matrix_world());
|
||||
sync_object(b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, motion_time, hide_tris, &use_portal);
|
||||
sync_object(b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, motion_time, hide_tris);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,7 +537,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
|
||||
progress.set_sync_status("");
|
||||
|
||||
if(!cancel && !motion) {
|
||||
sync_background_light(use_portal);
|
||||
sync_background_light();
|
||||
|
||||
/* handle removed data and modified pointers */
|
||||
if(light_map.post_sync())
|
||||
|
@@ -189,9 +189,9 @@ static PyObject *bake_func(PyObject * /*self*/, PyObject *args)
|
||||
PyObject *pysession, *pyobject;
|
||||
PyObject *pypixel_array, *pyresult;
|
||||
const char *pass_type;
|
||||
int num_pixels, depth, object_id;
|
||||
int num_pixels, depth;
|
||||
|
||||
if(!PyArg_ParseTuple(args, "OOsiOiiO", &pysession, &pyobject, &pass_type, &object_id, &pypixel_array, &num_pixels, &depth, &pyresult))
|
||||
if(!PyArg_ParseTuple(args, "OOsOiiO", &pysession, &pyobject, &pass_type, &pypixel_array, &num_pixels, &depth, &pyresult))
|
||||
return NULL;
|
||||
|
||||
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
|
||||
@@ -208,7 +208,7 @@ static PyObject *bake_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
python_thread_state_save(&session->python_thread_state);
|
||||
|
||||
session->bake(b_object, pass_type, object_id, b_bake_pixel, (size_t)num_pixels, depth, (float *)b_result);
|
||||
session->bake(b_object, pass_type, b_bake_pixel, (size_t)num_pixels, depth, (float *)b_result);
|
||||
|
||||
python_thread_state_restore(&session->python_thread_state);
|
||||
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include "util_color.h"
|
||||
#include "util_foreach.h"
|
||||
#include "util_function.h"
|
||||
#include "util_logging.h"
|
||||
#include "util_progress.h"
|
||||
#include "util_time.h"
|
||||
|
||||
@@ -272,10 +271,6 @@ static PassType get_pass_type(BL::RenderPass b_pass)
|
||||
{
|
||||
if(b_pass.debug_type() == BL::RenderPass::debug_type_BVH_TRAVERSAL_STEPS)
|
||||
return PASS_BVH_TRAVERSAL_STEPS;
|
||||
if(b_pass.debug_type() == BL::RenderPass::debug_type_BVH_TRAVERSED_INSTANCES)
|
||||
return PASS_BVH_TRAVERSED_INSTANCES;
|
||||
if(b_pass.debug_type() == BL::RenderPass::debug_type_RAY_BOUNCES)
|
||||
return PASS_RAY_BOUNCES;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -444,7 +439,6 @@ void BlenderSession::render()
|
||||
Pass::add(PASS_COMBINED, passes);
|
||||
#ifdef WITH_CYCLES_DEBUG
|
||||
Pass::add(PASS_BVH_TRAVERSAL_STEPS, passes);
|
||||
/* Pass::add(PASS_RAY_BOUNCES, passes); */
|
||||
#endif
|
||||
|
||||
if(session_params.device.advanced_shading) {
|
||||
@@ -503,11 +497,6 @@ void BlenderSession::render()
|
||||
break;
|
||||
}
|
||||
|
||||
double total_time, render_time;
|
||||
session->progress.get_time(total_time, render_time);
|
||||
VLOG(1) << "Total render time: " << total_time;
|
||||
VLOG(1) << "Render time (without synchronization): " << render_time;
|
||||
|
||||
/* clear callback */
|
||||
session->write_render_tile_cb = function_null;
|
||||
session->update_render_tile_cb = function_null;
|
||||
@@ -522,22 +511,18 @@ void BlenderSession::render()
|
||||
sync = NULL;
|
||||
}
|
||||
|
||||
static void populate_bake_data(BakeData *data, const int object_id, BL::BakePixel pixel_array, const int num_pixels)
|
||||
static void populate_bake_data(BakeData *data, BL::BakePixel pixel_array, const int num_pixels)
|
||||
{
|
||||
BL::BakePixel bp = pixel_array;
|
||||
|
||||
int i;
|
||||
for(i=0; i < num_pixels; i++) {
|
||||
if(bp.object_id() == object_id) {
|
||||
data->set(i, bp.primitive_id(), bp.uv(), bp.du_dx(), bp.du_dy(), bp.dv_dx(), bp.dv_dy());
|
||||
} else {
|
||||
data->set_null(i);
|
||||
}
|
||||
data->set(i, bp.primitive_id(), bp.uv(), bp.du_dx(), bp.du_dy(), bp.dv_dx(), bp.dv_dy());
|
||||
bp = bp.next();
|
||||
}
|
||||
}
|
||||
|
||||
void BlenderSession::bake(BL::Object b_object, const string& pass_type, const int object_id, BL::BakePixel pixel_array, const size_t num_pixels, const int /*depth*/, float result[])
|
||||
void BlenderSession::bake(BL::Object b_object, const string& pass_type, BL::BakePixel pixel_array, const size_t num_pixels, const int /*depth*/, float result[])
|
||||
{
|
||||
ShaderEvalType shader_type = get_shader_type(pass_type);
|
||||
size_t object_index = OBJECT_NONE;
|
||||
@@ -593,7 +578,7 @@ void BlenderSession::bake(BL::Object b_object, const string& pass_type, const in
|
||||
|
||||
BakeData *bake_data = scene->bake_manager->init(object, tri_offset, num_pixels);
|
||||
|
||||
populate_bake_data(bake_data, object_id, pixel_array, num_pixels);
|
||||
populate_bake_data(bake_data, pixel_array, num_pixels);
|
||||
|
||||
/* set number of samples */
|
||||
session->tile_manager.set_samples(session_params.samples);
|
||||
@@ -647,7 +632,7 @@ void BlenderSession::do_write_update_render_result(BL::RenderResult b_rr, BL::Re
|
||||
}
|
||||
else {
|
||||
/* copy combined pass */
|
||||
BL::RenderPass b_combined_pass(b_rlay.passes.find_by_type(BL::RenderPass::type_COMBINED, b_rview_name.c_str()));
|
||||
BL::RenderPass b_combined_pass(b_rlay.passes.find_by_type(BL::RenderPass::type_COMBINED, b_rview_name.c_str()));
|
||||
if(buffers->get_pass_rect(PASS_COMBINED, exposure, rtile.sample, 4, &pixels[0]))
|
||||
b_combined_pass.rect(&pixels[0]);
|
||||
}
|
||||
@@ -1031,19 +1016,18 @@ bool BlenderSession::builtin_image_pixels(const string &builtin_name, void *buil
|
||||
|
||||
unsigned char *image_pixels;
|
||||
image_pixels = image_get_pixels_for_frame(b_image, frame);
|
||||
size_t num_pixels = ((size_t)width) * height;
|
||||
|
||||
if(image_pixels) {
|
||||
memcpy(pixels, image_pixels, num_pixels * channels * sizeof(unsigned char));
|
||||
memcpy(pixels, image_pixels, width * height * channels * sizeof(unsigned char));
|
||||
MEM_freeN(image_pixels);
|
||||
}
|
||||
else {
|
||||
if(channels == 1) {
|
||||
memset(pixels, 0, num_pixels * sizeof(unsigned char));
|
||||
memset(pixels, 0, width * height * sizeof(unsigned char));
|
||||
}
|
||||
else {
|
||||
unsigned char *cp = pixels;
|
||||
for(size_t i = 0; i < num_pixels; i++, cp += channels) {
|
||||
for(int i = 0; i < width * height; i++, cp += channels) {
|
||||
cp[0] = 255;
|
||||
cp[1] = 0;
|
||||
cp[2] = 255;
|
||||
@@ -1055,7 +1039,7 @@ bool BlenderSession::builtin_image_pixels(const string &builtin_name, void *buil
|
||||
|
||||
/* premultiply, byte images are always straight for blender */
|
||||
unsigned char *cp = pixels;
|
||||
for(size_t i = 0; i < num_pixels; i++, cp += channels) {
|
||||
for(int i = 0; i < width * height; i++, cp += channels) {
|
||||
cp[0] = (cp[0] * cp[3]) >> 8;
|
||||
cp[1] = (cp[1] * cp[3]) >> 8;
|
||||
cp[2] = (cp[2] * cp[3]) >> 8;
|
||||
@@ -1084,19 +1068,18 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
|
||||
|
||||
float *image_pixels;
|
||||
image_pixels = image_get_float_pixels_for_frame(b_image, frame);
|
||||
size_t num_pixels = ((size_t)width) * height;
|
||||
|
||||
if(image_pixels) {
|
||||
memcpy(pixels, image_pixels, num_pixels * channels * sizeof(float));
|
||||
memcpy(pixels, image_pixels, width * height * channels * sizeof(float));
|
||||
MEM_freeN(image_pixels);
|
||||
}
|
||||
else {
|
||||
if(channels == 1) {
|
||||
memset(pixels, 0, num_pixels * sizeof(float));
|
||||
memset(pixels, 0, width * height * sizeof(float));
|
||||
}
|
||||
else {
|
||||
float *fp = pixels;
|
||||
for(int i = 0; i < num_pixels; i++, fp += channels) {
|
||||
for(int i = 0; i < width * height; i++, fp += channels) {
|
||||
fp[0] = 1.0f;
|
||||
fp[1] = 0.0f;
|
||||
fp[2] = 1.0f;
|
||||
@@ -1122,12 +1105,11 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
|
||||
int width = resolution.x * amplify;
|
||||
int height = resolution.y * amplify;
|
||||
int depth = resolution.z * amplify;
|
||||
size_t num_pixels = ((size_t)width) * height * depth;
|
||||
|
||||
if(builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_DENSITY)) {
|
||||
SmokeDomainSettings_density_grid_get_length(&b_domain.ptr, &length);
|
||||
|
||||
if(length == num_pixels) {
|
||||
if(length == width*height*depth) {
|
||||
SmokeDomainSettings_density_grid_get(&b_domain.ptr, pixels);
|
||||
return true;
|
||||
}
|
||||
@@ -1137,7 +1119,7 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
|
||||
* as 1500..3000 K with the first part faded to zero density */
|
||||
SmokeDomainSettings_flame_grid_get_length(&b_domain.ptr, &length);
|
||||
|
||||
if(length == num_pixels) {
|
||||
if(length == width*height*depth) {
|
||||
SmokeDomainSettings_flame_grid_get(&b_domain.ptr, pixels);
|
||||
return true;
|
||||
}
|
||||
@@ -1146,7 +1128,7 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
|
||||
/* the RGB is "premultiplied" by density for better interpolation results */
|
||||
SmokeDomainSettings_color_grid_get_length(&b_domain.ptr, &length);
|
||||
|
||||
if(length == num_pixels*4) {
|
||||
if(length == width*height*depth*4) {
|
||||
SmokeDomainSettings_color_grid_get(&b_domain.ptr, pixels);
|
||||
return true;
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
/* offline render */
|
||||
void render();
|
||||
|
||||
void bake(BL::Object b_object, const string& pass_type, const int object_id, BL::BakePixel pixel_array, const size_t num_pixels, const int depth, float pixels[]);
|
||||
void bake(BL::Object b_object, const string& pass_type, BL::BakePixel pixel_array, const size_t num_pixels, const int depth, float pixels[]);
|
||||
|
||||
void write_render_result(BL::RenderResult b_rr, BL::RenderLayer b_rlay, RenderTile& rtile);
|
||||
void write_render_tile(RenderTile& rtile);
|
||||
|
@@ -179,13 +179,7 @@ static bool is_output_node(BL::Node b_node)
|
||||
|| b_node.is_a(&RNA_ShaderNodeOutputLamp));
|
||||
}
|
||||
|
||||
static ShaderNode *add_node(Scene *scene,
|
||||
BL::RenderEngine b_engine,
|
||||
BL::BlendData b_data,
|
||||
BL::Scene b_scene,
|
||||
ShaderGraph *graph,
|
||||
BL::ShaderNodeTree b_ntree,
|
||||
BL::ShaderNode b_node)
|
||||
static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, BL::ShaderNode b_node)
|
||||
{
|
||||
ShaderNode *node = NULL;
|
||||
|
||||
@@ -564,8 +558,7 @@ static ShaderNode *add_node(Scene *scene,
|
||||
*/
|
||||
bool is_builtin = b_image.packed_file() ||
|
||||
b_image.source() == BL::Image::source_GENERATED ||
|
||||
b_image.source() == BL::Image::source_MOVIE ||
|
||||
b_engine.is_preview();
|
||||
b_image.source() == BL::Image::source_MOVIE;
|
||||
|
||||
if(is_builtin) {
|
||||
/* for builtin images we're using image datablock name to find an image to
|
||||
@@ -608,8 +601,7 @@ static ShaderNode *add_node(Scene *scene,
|
||||
if(b_image) {
|
||||
bool is_builtin = b_image.packed_file() ||
|
||||
b_image.source() == BL::Image::source_GENERATED ||
|
||||
b_image.source() == BL::Image::source_MOVIE ||
|
||||
b_engine.is_preview();
|
||||
b_image.source() == BL::Image::source_MOVIE;
|
||||
|
||||
if(is_builtin) {
|
||||
int scene_frame = b_scene.frame_current();
|
||||
@@ -813,14 +805,8 @@ static ShaderOutput *node_find_output_by_name(ShaderNode *node, BL::Node b_node,
|
||||
return node->output(name.c_str());
|
||||
}
|
||||
|
||||
static void add_nodes(Scene *scene,
|
||||
BL::RenderEngine b_engine,
|
||||
BL::BlendData b_data,
|
||||
BL::Scene b_scene,
|
||||
ShaderGraph *graph,
|
||||
BL::ShaderNodeTree b_ntree,
|
||||
const ProxyMap &proxy_input_map,
|
||||
const ProxyMap &proxy_output_map)
|
||||
static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNodeTree b_ntree,
|
||||
const ProxyMap &proxy_input_map, const ProxyMap &proxy_output_map)
|
||||
{
|
||||
/* add nodes */
|
||||
BL::ShaderNodeTree::nodes_iterator b_node;
|
||||
@@ -897,16 +883,8 @@ static void add_nodes(Scene *scene,
|
||||
output_map[b_output->ptr.data] = proxy->outputs[0];
|
||||
}
|
||||
|
||||
if(b_group_ntree) {
|
||||
add_nodes(scene,
|
||||
b_engine,
|
||||
b_data,
|
||||
b_scene,
|
||||
graph,
|
||||
b_group_ntree,
|
||||
group_proxy_input_map,
|
||||
group_proxy_output_map);
|
||||
}
|
||||
if(b_group_ntree)
|
||||
add_nodes(scene, b_data, b_scene, graph, b_group_ntree, group_proxy_input_map, group_proxy_output_map);
|
||||
}
|
||||
else if(b_node->is_a(&RNA_NodeGroupInput)) {
|
||||
/* map each socket to a proxy node */
|
||||
@@ -945,13 +923,7 @@ static void add_nodes(Scene *scene,
|
||||
}
|
||||
}
|
||||
else {
|
||||
node = add_node(scene,
|
||||
b_engine,
|
||||
b_data,
|
||||
b_scene,
|
||||
graph,
|
||||
b_ntree,
|
||||
BL::ShaderNode(*b_node));
|
||||
node = add_node(scene, b_data, b_scene, graph, b_ntree, BL::ShaderNode(*b_node));
|
||||
}
|
||||
|
||||
if(node) {
|
||||
@@ -1007,22 +979,10 @@ static void add_nodes(Scene *scene,
|
||||
}
|
||||
}
|
||||
|
||||
static void add_nodes(Scene *scene,
|
||||
BL::RenderEngine b_engine,
|
||||
BL::BlendData b_data,
|
||||
BL::Scene b_scene,
|
||||
ShaderGraph *graph,
|
||||
BL::ShaderNodeTree b_ntree)
|
||||
static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNodeTree b_ntree)
|
||||
{
|
||||
static const ProxyMap empty_proxy_map;
|
||||
add_nodes(scene,
|
||||
b_engine,
|
||||
b_data,
|
||||
b_scene,
|
||||
graph,
|
||||
b_ntree,
|
||||
empty_proxy_map,
|
||||
empty_proxy_map);
|
||||
add_nodes(scene, b_data, b_scene, graph, b_ntree, empty_proxy_map, empty_proxy_map);
|
||||
}
|
||||
|
||||
/* Sync Materials */
|
||||
@@ -1048,7 +1008,7 @@ void BlenderSync::sync_materials(bool update_all)
|
||||
if(b_mat->use_nodes() && b_mat->node_tree()) {
|
||||
BL::ShaderNodeTree b_ntree(b_mat->node_tree());
|
||||
|
||||
add_nodes(scene, b_engine, b_data, b_scene, graph, b_ntree);
|
||||
add_nodes(scene, b_data, b_scene, graph, b_ntree);
|
||||
}
|
||||
else {
|
||||
ShaderNode *closure, *out;
|
||||
@@ -1091,7 +1051,7 @@ void BlenderSync::sync_world(bool update_all)
|
||||
if(b_world && b_world.use_nodes() && b_world.node_tree()) {
|
||||
BL::ShaderNodeTree b_ntree(b_world.node_tree());
|
||||
|
||||
add_nodes(scene, b_engine, b_data, b_scene, graph, b_ntree);
|
||||
add_nodes(scene, b_data, b_scene, graph, b_ntree);
|
||||
|
||||
/* volume */
|
||||
PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
|
||||
@@ -1177,7 +1137,7 @@ void BlenderSync::sync_lamps(bool update_all)
|
||||
|
||||
BL::ShaderNodeTree b_ntree(b_lamp->node_tree());
|
||||
|
||||
add_nodes(scene, b_engine, b_data, b_scene, graph, b_ntree);
|
||||
add_nodes(scene, b_data, b_scene, graph, b_ntree);
|
||||
}
|
||||
else {
|
||||
ShaderNode *closure, *out;
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include "util_debug.h"
|
||||
#include "util_foreach.h"
|
||||
#include "util_opengl.h"
|
||||
#include "util_hash.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
@@ -196,9 +195,6 @@ void BlenderSync::sync_integrator()
|
||||
integrator->filter_glossy = get_float(cscene, "blur_glossy");
|
||||
|
||||
integrator->seed = get_int(cscene, "seed");
|
||||
if(get_boolean(cscene, "use_animated_seed"))
|
||||
integrator->seed = hash_int_2d(b_scene.frame_current(), get_int(cscene, "seed"));
|
||||
|
||||
integrator->sampling_pattern = (SamplingPattern)RNA_enum_get(&cscene, "sampling_pattern");
|
||||
|
||||
integrator->layer_flag = render_layer.layer;
|
||||
@@ -389,8 +385,7 @@ void BlenderSync::sync_images()
|
||||
*/
|
||||
const bool is_builtin = b_image->packed_file() ||
|
||||
b_image->source() == BL::Image::source_GENERATED ||
|
||||
b_image->source() == BL::Image::source_MOVIE ||
|
||||
b_engine.is_preview();
|
||||
b_image->source() == BL::Image::source_MOVIE;
|
||||
if(is_builtin == false) {
|
||||
b_image->buffers_free();
|
||||
}
|
||||
|
@@ -86,9 +86,9 @@ private:
|
||||
Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris);
|
||||
void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool motion, int time_index = 0);
|
||||
Object *sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
|
||||
Transform& tfm, uint layer_flag, float motion_time, bool hide_tris, bool *use_portal);
|
||||
void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm, bool *use_portal);
|
||||
void sync_background_light(bool use_portal);
|
||||
Transform& tfm, uint layer_flag, float motion_time, bool hide_tris);
|
||||
void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm);
|
||||
void sync_background_light();
|
||||
void sync_mesh_motion(BL::Object b_ob, Object *object, float motion_time);
|
||||
void sync_camera_motion(BL::Object b_ob, float motion_time);
|
||||
|
||||
|
@@ -354,20 +354,11 @@ static inline void mesh_texture_space(BL::Mesh b_mesh, float3& loc, float3& size
|
||||
}
|
||||
|
||||
/* object used for motion blur */
|
||||
static inline bool object_use_motion(BL::Object b_parent, BL::Object b_ob)
|
||||
static inline bool object_use_motion(BL::Object b_ob)
|
||||
{
|
||||
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
|
||||
bool use_motion = get_boolean(cobject, "use_motion_blur");
|
||||
/* If motion blur is enabled for the object we also check
|
||||
* whether it's enabled for the parent object as well.
|
||||
*
|
||||
* This way we can control motion blur from the dupligroup
|
||||
* duplicator much easier.
|
||||
*/
|
||||
if(use_motion && b_parent.ptr.data != b_ob.ptr.data) {
|
||||
PointerRNA parent_cobject = RNA_pointer_get(&b_parent.ptr, "cycles");
|
||||
use_motion &= get_boolean(parent_cobject, "use_motion_blur");
|
||||
}
|
||||
|
||||
return use_motion;
|
||||
}
|
||||
|
||||
@@ -384,20 +375,11 @@ static inline uint object_motion_steps(BL::Object b_ob)
|
||||
}
|
||||
|
||||
/* object uses deformation motion blur */
|
||||
static inline bool object_use_deform_motion(BL::Object b_parent, BL::Object b_ob)
|
||||
static inline bool object_use_deform_motion(BL::Object b_ob)
|
||||
{
|
||||
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
|
||||
bool use_deform_motion = get_boolean(cobject, "use_deform_motion");
|
||||
/* If motion blur is enabled for the object we also check
|
||||
* whether it's enabled for the parent object as well.
|
||||
*
|
||||
* This way we can control motion blur from the dupligroup
|
||||
* duplicator much easier.
|
||||
*/
|
||||
if(use_deform_motion && b_parent.ptr.data != b_ob.ptr.data) {
|
||||
PointerRNA parent_cobject = RNA_pointer_get(&b_parent.ptr, "cycles");
|
||||
use_deform_motion &= get_boolean(parent_cobject, "use_deform_motion");
|
||||
}
|
||||
|
||||
return use_deform_motion;
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,6 @@
|
||||
#include "util_cache.h"
|
||||
#include "util_debug.h"
|
||||
#include "util_foreach.h"
|
||||
#include "util_logging.h"
|
||||
#include "util_map.h"
|
||||
#include "util_progress.h"
|
||||
#include "util_system.h"
|
||||
@@ -107,25 +106,25 @@ bool BVH::cache_read(CacheData& key)
|
||||
if(!(value.read(pack.root_index) &&
|
||||
value.read(pack.SAH) &&
|
||||
value.read(pack.nodes) &&
|
||||
value.read(pack.leaf_nodes) &&
|
||||
value.read(pack.object_node) &&
|
||||
value.read(pack.tri_woop) &&
|
||||
value.read(pack.prim_type) &&
|
||||
value.read(pack.prim_visibility) &&
|
||||
value.read(pack.prim_index) &&
|
||||
value.read(pack.prim_object)))
|
||||
value.read(pack.prim_object) &&
|
||||
value.read(pack.is_leaf)))
|
||||
{
|
||||
/* Clear the pack if load failed. */
|
||||
pack.root_index = 0;
|
||||
pack.SAH = 0.0f;
|
||||
pack.nodes.clear();
|
||||
pack.leaf_nodes.clear();
|
||||
pack.object_node.clear();
|
||||
pack.tri_woop.clear();
|
||||
pack.prim_type.clear();
|
||||
pack.prim_visibility.clear();
|
||||
pack.prim_index.clear();
|
||||
pack.prim_object.clear();
|
||||
pack.is_leaf.clear();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -142,13 +141,13 @@ void BVH::cache_write(CacheData& key)
|
||||
value.add(pack.SAH);
|
||||
|
||||
value.add(pack.nodes);
|
||||
value.add(pack.leaf_nodes);
|
||||
value.add(pack.object_node);
|
||||
value.add(pack.tri_woop);
|
||||
value.add(pack.prim_type);
|
||||
value.add(pack.prim_visibility);
|
||||
value.add(pack.prim_index);
|
||||
value.add(pack.prim_object);
|
||||
value.add(pack.is_leaf);
|
||||
|
||||
Cache::global.insert(key, value);
|
||||
|
||||
@@ -190,12 +189,11 @@ void BVH::build(Progress& progress)
|
||||
}
|
||||
|
||||
/* build nodes */
|
||||
BVHBuild bvh_build(objects,
|
||||
pack.prim_type,
|
||||
pack.prim_index,
|
||||
pack.prim_object,
|
||||
params,
|
||||
progress);
|
||||
vector<int> prim_type;
|
||||
vector<int> prim_index;
|
||||
vector<int> prim_object;
|
||||
|
||||
BVHBuild bvh_build(objects, prim_type, prim_index, prim_object, params, progress);
|
||||
BVHNode *root = bvh_build.run();
|
||||
|
||||
if(progress.get_cancel()) {
|
||||
@@ -203,6 +201,14 @@ void BVH::build(Progress& progress)
|
||||
return;
|
||||
}
|
||||
|
||||
/* todo: get rid of this copy */
|
||||
pack.prim_type = prim_type;
|
||||
pack.prim_index = prim_index;
|
||||
pack.prim_object = prim_object;
|
||||
prim_type.free_memory();
|
||||
prim_index.free_memory();
|
||||
prim_object.free_memory();
|
||||
|
||||
/* compute SAH */
|
||||
if(!params.top_level)
|
||||
pack.SAH = root->computeSubtreeSAHCost(params);
|
||||
@@ -316,14 +322,13 @@ void BVH::pack_primitives()
|
||||
|
||||
/* Pack Instances */
|
||||
|
||||
void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
void BVH::pack_instances(size_t nodes_size)
|
||||
{
|
||||
/* The BVH's for instances are built separately, but for traversal all
|
||||
* BVH's are stored in global arrays. This function merges them into the
|
||||
* top level BVH, adjusting indexes and offsets where appropriate. */
|
||||
bool use_qbvh = params.use_qbvh;
|
||||
size_t nsize = (use_qbvh)? BVH_QNODE_SIZE: BVH_NODE_SIZE;
|
||||
size_t nsize_leaf = (use_qbvh)? BVH_QNODE_LEAF_SIZE: BVH_NODE_LEAF_SIZE;
|
||||
|
||||
/* adjust primitive index to point to the triangle in the global array, for
|
||||
* meshes with transform applied and already in the top level BVH */
|
||||
@@ -338,7 +343,6 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
/* track offsets of instanced BVH data in global array */
|
||||
size_t prim_offset = pack.prim_index.size();
|
||||
size_t nodes_offset = nodes_size;
|
||||
size_t nodes_leaf_offset = leaf_nodes_size;
|
||||
|
||||
/* clear array that gives the node indexes for instanced objects */
|
||||
pack.object_node.clear();
|
||||
@@ -350,7 +354,6 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
size_t pack_prim_index_offset = prim_index_size;
|
||||
size_t pack_tri_woop_offset = tri_woop_size;
|
||||
size_t pack_nodes_offset = nodes_size;
|
||||
size_t pack_leaf_nodes_offset = leaf_nodes_size;
|
||||
size_t object_offset = 0;
|
||||
|
||||
map<Mesh*, int> mesh_map;
|
||||
@@ -364,7 +367,6 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
prim_index_size += bvh->pack.prim_index.size();
|
||||
tri_woop_size += bvh->pack.tri_woop.size();
|
||||
nodes_size += bvh->pack.nodes.size();
|
||||
leaf_nodes_size += bvh->pack.leaf_nodes.size();
|
||||
|
||||
mesh_map[mesh] = 1;
|
||||
}
|
||||
@@ -379,7 +381,6 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
pack.prim_visibility.resize(prim_index_size);
|
||||
pack.tri_woop.resize(tri_woop_size);
|
||||
pack.nodes.resize(nodes_size);
|
||||
pack.leaf_nodes.resize(leaf_nodes_size);
|
||||
pack.object_node.resize(objects.size());
|
||||
|
||||
int *pack_prim_index = (pack.prim_index.size())? &pack.prim_index[0]: NULL;
|
||||
@@ -388,7 +389,6 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
uint *pack_prim_visibility = (pack.prim_visibility.size())? &pack.prim_visibility[0]: NULL;
|
||||
float4 *pack_tri_woop = (pack.tri_woop.size())? &pack.tri_woop[0]: NULL;
|
||||
int4 *pack_nodes = (pack.nodes.size())? &pack.nodes[0]: NULL;
|
||||
int4 *pack_leaf_nodes = (pack.leaf_nodes.size())? &pack.leaf_nodes[0]: NULL;
|
||||
|
||||
/* merge */
|
||||
foreach(Object *ob, objects) {
|
||||
@@ -414,13 +414,12 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
BVH *bvh = mesh->bvh;
|
||||
|
||||
int noffset = nodes_offset/nsize;
|
||||
int noffset_leaf = nodes_leaf_offset/nsize_leaf;
|
||||
int mesh_tri_offset = mesh->tri_offset;
|
||||
int mesh_curve_offset = mesh->curve_offset;
|
||||
|
||||
/* fill in node indexes for instances */
|
||||
if(bvh->pack.root_index == -1)
|
||||
pack.object_node[object_offset++] = -noffset_leaf-1;
|
||||
if((bvh->pack.is_leaf.size() != 0) && bvh->pack.is_leaf[0])
|
||||
pack.object_node[object_offset++] = -noffset-1;
|
||||
else
|
||||
pack.object_node[object_offset++] = noffset;
|
||||
|
||||
@@ -454,18 +453,6 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
}
|
||||
|
||||
/* merge nodes */
|
||||
if(bvh->pack.leaf_nodes.size()) {
|
||||
int4 *leaf_nodes_offset = &bvh->pack.leaf_nodes[0];
|
||||
size_t leaf_nodes_offset_size = bvh->pack.leaf_nodes.size();
|
||||
for(size_t i = 0, j = 0; i < leaf_nodes_offset_size; i+=nsize_leaf, j++) {
|
||||
int4 data = leaf_nodes_offset[i];
|
||||
data.x += prim_offset;
|
||||
data.y += prim_offset;
|
||||
pack_leaf_nodes[pack_leaf_nodes_offset] = data;
|
||||
pack_leaf_nodes_offset += nsize_leaf;
|
||||
}
|
||||
}
|
||||
|
||||
if(bvh->pack.nodes.size()) {
|
||||
/* For QBVH we're packing a child bbox into 6 float4,
|
||||
* and for regular BVH they're packed into 3 float4.
|
||||
@@ -473,6 +460,7 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
size_t nsize_bbox = (use_qbvh)? 6: 3;
|
||||
int4 *bvh_nodes = &bvh->pack.nodes[0];
|
||||
size_t bvh_nodes_size = bvh->pack.nodes.size();
|
||||
bool *bvh_is_leaf = (bvh->pack.is_leaf.size() != 0) ? &bvh->pack.is_leaf[0] : NULL;
|
||||
|
||||
for(size_t i = 0, j = 0; i < bvh_nodes_size; i+=nsize, j++) {
|
||||
memcpy(pack_nodes + pack_nodes_offset, bvh_nodes + i, nsize_bbox*sizeof(int4));
|
||||
@@ -480,12 +468,18 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
/* modify offsets into arrays */
|
||||
int4 data = bvh_nodes[i + nsize_bbox];
|
||||
|
||||
data.x += (data.x < 0)? -noffset_leaf: noffset;
|
||||
data.y += (data.y < 0)? -noffset_leaf: noffset;
|
||||
if(bvh_is_leaf && bvh_is_leaf[j]) {
|
||||
data.x += prim_offset;
|
||||
data.y += prim_offset;
|
||||
}
|
||||
else {
|
||||
data.x += (data.x < 0)? -noffset: noffset;
|
||||
data.y += (data.y < 0)? -noffset: noffset;
|
||||
|
||||
if(use_qbvh) {
|
||||
data.z += (data.z < 0)? -noffset_leaf: noffset;
|
||||
data.w += (data.w < 0)? -noffset_leaf: noffset;
|
||||
if(use_qbvh) {
|
||||
data.z += (data.z < 0)? -noffset: noffset;
|
||||
data.w += (data.w < 0)? -noffset: noffset;
|
||||
}
|
||||
}
|
||||
|
||||
pack_nodes[pack_nodes_offset + nsize_bbox] = data;
|
||||
@@ -502,7 +496,6 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
|
||||
}
|
||||
|
||||
nodes_offset += bvh->pack.nodes.size();
|
||||
nodes_leaf_offset += bvh->pack.leaf_nodes.size();
|
||||
prim_offset += bvh->pack.prim_index.size();
|
||||
}
|
||||
}
|
||||
@@ -516,24 +509,20 @@ RegularBVH::RegularBVH(const BVHParams& params_, const vector<Object*>& objects_
|
||||
|
||||
void RegularBVH::pack_leaf(const BVHStackEntry& e, const LeafNode *leaf)
|
||||
{
|
||||
float4 data[BVH_NODE_LEAF_SIZE];
|
||||
memset(data, 0, sizeof(data));
|
||||
if(leaf->num_triangles() == 1 && pack.prim_index[leaf->m_lo] == -1) {
|
||||
/* object */
|
||||
data[0].x = __int_as_float(~(leaf->m_lo));
|
||||
data[0].y = __int_as_float(0);
|
||||
pack_node(e.idx, leaf->m_bounds, leaf->m_bounds, ~(leaf->m_lo), 0,
|
||||
leaf->m_visibility, leaf->m_visibility);
|
||||
}
|
||||
else {
|
||||
/* triangle */
|
||||
data[0].x = __int_as_float(leaf->m_lo);
|
||||
data[0].y = __int_as_float(leaf->m_hi);
|
||||
}
|
||||
data[0].z = __uint_as_float(leaf->m_visibility);
|
||||
if(leaf->num_triangles() != 0) {
|
||||
data[0].w = __uint_as_float(pack.prim_type[leaf->m_lo]);
|
||||
int prim_type = leaf->num_triangles() ? pack.prim_type[leaf->m_lo] : 0;
|
||||
/* Triangle/curve primitive leaf. */
|
||||
pack_node(e.idx, leaf->m_bounds, leaf->m_bounds,
|
||||
leaf->m_lo, leaf->m_hi,
|
||||
leaf->m_visibility,
|
||||
prim_type);
|
||||
}
|
||||
|
||||
memcpy(&pack.leaf_nodes[e.idx * BVH_NODE_LEAF_SIZE], data, sizeof(float4)*BVH_NODE_LEAF_SIZE);
|
||||
}
|
||||
|
||||
void RegularBVH::pack_inner(const BVHStackEntry& e, const BVHStackEntry& e0, const BVHStackEntry& e1)
|
||||
@@ -556,36 +545,31 @@ void RegularBVH::pack_node(int idx, const BoundBox& b0, const BoundBox& b1, int
|
||||
|
||||
void RegularBVH::pack_nodes(const BVHNode *root)
|
||||
{
|
||||
size_t tot_node_size = root->getSubtreeSize(BVH_STAT_NODE_COUNT);
|
||||
size_t leaf_node_size = root->getSubtreeSize(BVH_STAT_LEAF_COUNT);
|
||||
size_t node_size = tot_node_size - leaf_node_size;
|
||||
size_t node_size = root->getSubtreeSize(BVH_STAT_NODE_COUNT);
|
||||
|
||||
/* resize arrays */
|
||||
pack.nodes.clear();
|
||||
pack.is_leaf.clear();
|
||||
pack.is_leaf.resize(node_size);
|
||||
|
||||
/* for top level BVH, first merge existing BVH's so we know the offsets */
|
||||
if(params.top_level) {
|
||||
pack_instances(node_size*BVH_NODE_SIZE,
|
||||
leaf_node_size*BVH_NODE_LEAF_SIZE);
|
||||
}
|
||||
else {
|
||||
if(params.top_level)
|
||||
pack_instances(node_size*BVH_NODE_SIZE);
|
||||
else
|
||||
pack.nodes.resize(node_size*BVH_NODE_SIZE);
|
||||
pack.leaf_nodes.resize(leaf_node_size*BVH_NODE_LEAF_SIZE);
|
||||
}
|
||||
|
||||
int nextNodeIdx = 0, nextLeafNodeIdx = 0;
|
||||
int nextNodeIdx = 0;
|
||||
|
||||
vector<BVHStackEntry> stack;
|
||||
stack.reserve(BVHParams::MAX_DEPTH*2);
|
||||
if(root->is_leaf())
|
||||
stack.push_back(BVHStackEntry(root, nextLeafNodeIdx++));
|
||||
else
|
||||
stack.push_back(BVHStackEntry(root, nextNodeIdx++));
|
||||
stack.push_back(BVHStackEntry(root, nextNodeIdx++));
|
||||
|
||||
while(stack.size()) {
|
||||
BVHStackEntry e = stack.back();
|
||||
stack.pop_back();
|
||||
|
||||
pack.is_leaf[e.idx] = e.node->is_leaf();
|
||||
|
||||
if(e.node->is_leaf()) {
|
||||
/* leaf node */
|
||||
const LeafNode* leaf = reinterpret_cast<const LeafNode*>(e.node);
|
||||
@@ -593,17 +577,15 @@ void RegularBVH::pack_nodes(const BVHNode *root)
|
||||
}
|
||||
else {
|
||||
/* innner node */
|
||||
int idx0 = (e.node->get_child(0)->is_leaf())? (nextLeafNodeIdx++) : (nextNodeIdx++);
|
||||
int idx1 = (e.node->get_child(1)->is_leaf())? (nextLeafNodeIdx++) : (nextNodeIdx++);
|
||||
stack.push_back(BVHStackEntry(e.node->get_child(0), idx0));
|
||||
stack.push_back(BVHStackEntry(e.node->get_child(1), idx1));
|
||||
stack.push_back(BVHStackEntry(e.node->get_child(0), nextNodeIdx++));
|
||||
stack.push_back(BVHStackEntry(e.node->get_child(1), nextNodeIdx++));
|
||||
|
||||
pack_inner(e, stack[stack.size()-2], stack[stack.size()-1]);
|
||||
}
|
||||
}
|
||||
|
||||
/* root index to start traversal at, to handle case of single leaf node */
|
||||
pack.root_index = (root->is_leaf())? -1: 0;
|
||||
pack.root_index = (pack.is_leaf[0])? -1: 0;
|
||||
}
|
||||
|
||||
void RegularBVH::refit_nodes()
|
||||
@@ -612,15 +594,17 @@ void RegularBVH::refit_nodes()
|
||||
|
||||
BoundBox bbox = BoundBox::empty;
|
||||
uint visibility = 0;
|
||||
refit_node(0, (pack.root_index == -1)? true: false, bbox, visibility);
|
||||
refit_node(0, (pack.is_leaf[0])? true: false, bbox, visibility);
|
||||
}
|
||||
|
||||
void RegularBVH::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility)
|
||||
{
|
||||
int4 *data = &pack.nodes[idx*BVH_NODE_SIZE];
|
||||
|
||||
int c0 = data[3].x;
|
||||
int c1 = data[3].y;
|
||||
|
||||
if(leaf) {
|
||||
int4 *data = &pack.leaf_nodes[idx*BVH_NODE_LEAF_SIZE];
|
||||
int c0 = data[0].x;
|
||||
int c1 = data[0].y;
|
||||
/* refit leaf node */
|
||||
for(int prim = c0; prim < c1; prim++) {
|
||||
int pidx = pack.prim_index[prim];
|
||||
@@ -686,20 +670,9 @@ void RegularBVH::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility
|
||||
visibility |= ob->visibility;
|
||||
}
|
||||
|
||||
/* TODO(sergey): De-duplicate with pack_leaf(). */
|
||||
float4 leaf_data[BVH_NODE_LEAF_SIZE];
|
||||
leaf_data[0].x = __int_as_float(c0);
|
||||
leaf_data[0].y = __int_as_float(c1);
|
||||
leaf_data[0].z = __uint_as_float(visibility);
|
||||
leaf_data[0].w = __uint_as_float(data[0].w);
|
||||
memcpy(&pack.leaf_nodes[idx * BVH_NODE_LEAF_SIZE],
|
||||
leaf_data,
|
||||
sizeof(float4)*BVH_NODE_LEAF_SIZE);
|
||||
pack_node(idx, bbox, bbox, c0, c1, visibility, data[3].w);
|
||||
}
|
||||
else {
|
||||
int4 *data = &pack.nodes[idx*BVH_NODE_SIZE];
|
||||
int c0 = data[3].x;
|
||||
int c1 = data[3].y;
|
||||
/* refit inner node, set bbox from children */
|
||||
BoundBox bbox0 = BoundBox::empty, bbox1 = BoundBox::empty;
|
||||
uint visibility0 = 0, visibility1 = 0;
|
||||
@@ -725,24 +698,26 @@ QBVH::QBVH(const BVHParams& params_, const vector<Object*>& objects_)
|
||||
|
||||
void QBVH::pack_leaf(const BVHStackEntry& e, const LeafNode *leaf)
|
||||
{
|
||||
float4 data[BVH_QNODE_LEAF_SIZE];
|
||||
float4 data[BVH_QNODE_SIZE];
|
||||
|
||||
memset(data, 0, sizeof(data));
|
||||
|
||||
if(leaf->num_triangles() == 1 && pack.prim_index[leaf->m_lo] == -1) {
|
||||
/* object */
|
||||
data[0].x = __int_as_float(~(leaf->m_lo));
|
||||
data[0].y = __int_as_float(0);
|
||||
data[6].x = __int_as_float(~(leaf->m_lo));
|
||||
data[6].y = __int_as_float(0);
|
||||
}
|
||||
else {
|
||||
/* triangle */
|
||||
data[0].x = __int_as_float(leaf->m_lo);
|
||||
data[0].y = __int_as_float(leaf->m_hi);
|
||||
data[6].x = __int_as_float(leaf->m_lo);
|
||||
data[6].y = __int_as_float(leaf->m_hi);
|
||||
}
|
||||
data[0].z = __uint_as_float(leaf->m_visibility);
|
||||
data[6].z = __uint_as_float(leaf->m_visibility);
|
||||
if(leaf->num_triangles() != 0) {
|
||||
data[0].w = __uint_as_float(pack.prim_type[leaf->m_lo]);
|
||||
data[6].w = __uint_as_float(pack.prim_type[leaf->m_lo]);
|
||||
}
|
||||
|
||||
memcpy(&pack.leaf_nodes[e.idx * BVH_QNODE_LEAF_SIZE], data, sizeof(float4)*BVH_QNODE_LEAF_SIZE);
|
||||
memcpy(&pack.nodes[e.idx * BVH_QNODE_SIZE], data, sizeof(float4)*BVH_QNODE_SIZE);
|
||||
}
|
||||
|
||||
void QBVH::pack_inner(const BVHStackEntry& e, const BVHStackEntry *en, int num)
|
||||
@@ -786,39 +761,31 @@ void QBVH::pack_inner(const BVHStackEntry& e, const BVHStackEntry *en, int num)
|
||||
|
||||
void QBVH::pack_nodes(const BVHNode *root)
|
||||
{
|
||||
size_t tot_node_size = root->getSubtreeSize(BVH_STAT_QNODE_COUNT);
|
||||
size_t leaf_node_size = root->getSubtreeSize(BVH_STAT_LEAF_COUNT);
|
||||
size_t node_size = tot_node_size - leaf_node_size;
|
||||
size_t node_size = root->getSubtreeSize(BVH_STAT_QNODE_COUNT);
|
||||
|
||||
/* resize arrays */
|
||||
pack.nodes.clear();
|
||||
pack.leaf_nodes.clear();
|
||||
pack.is_leaf.clear();
|
||||
pack.is_leaf.resize(node_size);
|
||||
|
||||
/* for top level BVH, first merge existing BVH's so we know the offsets */
|
||||
if(params.top_level) {
|
||||
pack_instances(node_size*BVH_QNODE_SIZE,
|
||||
leaf_node_size*BVH_QNODE_LEAF_SIZE);
|
||||
}
|
||||
else {
|
||||
if(params.top_level)
|
||||
pack_instances(node_size*BVH_QNODE_SIZE);
|
||||
else
|
||||
pack.nodes.resize(node_size*BVH_QNODE_SIZE);
|
||||
pack.leaf_nodes.resize(leaf_node_size*BVH_QNODE_LEAF_SIZE);
|
||||
}
|
||||
|
||||
int nextNodeIdx = 0, nextLeafNodeIdx = 0;
|
||||
int nextNodeIdx = 0;
|
||||
|
||||
vector<BVHStackEntry> stack;
|
||||
stack.reserve(BVHParams::MAX_DEPTH*2);
|
||||
if(root->is_leaf()) {
|
||||
stack.push_back(BVHStackEntry(root, nextLeafNodeIdx++));
|
||||
}
|
||||
else {
|
||||
stack.push_back(BVHStackEntry(root, nextNodeIdx++));
|
||||
}
|
||||
stack.push_back(BVHStackEntry(root, nextNodeIdx++));
|
||||
|
||||
while(stack.size()) {
|
||||
BVHStackEntry e = stack.back();
|
||||
stack.pop_back();
|
||||
|
||||
pack.is_leaf[e.idx] = e.node->is_leaf();
|
||||
|
||||
if(e.node->is_leaf()) {
|
||||
/* leaf node */
|
||||
const LeafNode* leaf = reinterpret_cast<const LeafNode*>(e.node);
|
||||
@@ -851,16 +818,8 @@ void QBVH::pack_nodes(const BVHNode *root)
|
||||
}
|
||||
|
||||
/* push entries on the stack */
|
||||
for(int i = 0; i < numnodes; i++) {
|
||||
int idx;
|
||||
if(nodes[i]->is_leaf()) {
|
||||
idx = nextLeafNodeIdx++;
|
||||
}
|
||||
else {
|
||||
idx = nextNodeIdx++;
|
||||
}
|
||||
stack.push_back(BVHStackEntry(nodes[i], idx));
|
||||
}
|
||||
for(int i = 0; i < numnodes; i++)
|
||||
stack.push_back(BVHStackEntry(nodes[i], nextNodeIdx++));
|
||||
|
||||
/* set node */
|
||||
pack_inner(e, &stack[stack.size()-numnodes], numnodes);
|
||||
@@ -868,7 +827,7 @@ void QBVH::pack_nodes(const BVHNode *root)
|
||||
}
|
||||
|
||||
/* root index to start traversal at, to handle case of single leaf node */
|
||||
pack.root_index = (root->is_leaf())? -1: 0;
|
||||
pack.root_index = (pack.is_leaf[0])? -1: 0;
|
||||
}
|
||||
|
||||
void QBVH::refit_nodes()
|
||||
@@ -877,14 +836,14 @@ void QBVH::refit_nodes()
|
||||
|
||||
BoundBox bbox = BoundBox::empty;
|
||||
uint visibility = 0;
|
||||
refit_node(0, (pack.root_index == -1)? true: false, bbox, visibility);
|
||||
refit_node(0, (pack.is_leaf[0])? true: false, bbox, visibility);
|
||||
}
|
||||
|
||||
void QBVH::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility)
|
||||
{
|
||||
int4 *data = &pack.nodes[idx*BVH_QNODE_SIZE];
|
||||
int4 c = data[6];
|
||||
if(leaf) {
|
||||
int4 *data = &pack.leaf_nodes[idx*BVH_QNODE_LEAF_SIZE];
|
||||
int4 c = data[0];
|
||||
/* Refit leaf node. */
|
||||
for(int prim = c.x; prim < c.y; prim++) {
|
||||
int pidx = pack.prim_index[prim];
|
||||
@@ -960,18 +919,17 @@ void QBVH::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility)
|
||||
*
|
||||
* Same applies to the inner nodes case below.
|
||||
*/
|
||||
float4 leaf_data[BVH_QNODE_LEAF_SIZE];
|
||||
leaf_data[0].x = __int_as_float(c.x);
|
||||
leaf_data[0].y = __int_as_float(c.y);
|
||||
leaf_data[0].z = __uint_as_float(visibility);
|
||||
leaf_data[0].w = __uint_as_float(c.w);
|
||||
memcpy(&pack.leaf_nodes[idx * BVH_QNODE_LEAF_SIZE],
|
||||
float4 leaf_data[BVH_QNODE_SIZE];
|
||||
memset(leaf_data, 0, sizeof(leaf_data));
|
||||
leaf_data[6].x = __int_as_float(c.x);
|
||||
leaf_data[6].y = __int_as_float(c.y);
|
||||
leaf_data[6].z = __uint_as_float(visibility);
|
||||
leaf_data[6].w = __uint_as_float(c.w);
|
||||
memcpy(&pack.nodes[idx * BVH_QNODE_SIZE],
|
||||
leaf_data,
|
||||
sizeof(float4)*BVH_QNODE_LEAF_SIZE);
|
||||
sizeof(float4)*BVH_QNODE_SIZE);
|
||||
}
|
||||
else {
|
||||
int4 *data = &pack.nodes[idx*BVH_QNODE_SIZE];
|
||||
int4 c = data[6];
|
||||
/* Refit inner node, set bbox from children. */
|
||||
BoundBox child_bbox[4] = {BoundBox::empty,
|
||||
BoundBox::empty,
|
||||
|
@@ -36,9 +36,7 @@ class Object;
|
||||
class Progress;
|
||||
|
||||
#define BVH_NODE_SIZE 4
|
||||
#define BVH_NODE_LEAF_SIZE 1
|
||||
#define BVH_QNODE_SIZE 7
|
||||
#define BVH_QNODE_LEAF_SIZE 1
|
||||
#define BVH_ALIGN 4096
|
||||
#define TRI_NODE_SIZE 3
|
||||
|
||||
@@ -49,9 +47,7 @@ class Progress;
|
||||
struct PackedBVH {
|
||||
/* BVH nodes storage, one node is 4x int4, and contains two bounding boxes,
|
||||
* and child, triangle or object indexes depending on the node type */
|
||||
array<int4> nodes;
|
||||
/* BVH leaf nodes storage. */
|
||||
array<int4> leaf_nodes;
|
||||
array<int4> nodes;
|
||||
/* object index to BVH node index mapping for instances */
|
||||
array<int> object_node;
|
||||
/* precomputed triangle intersection data, one triangle is 4x float4 */
|
||||
@@ -65,6 +61,9 @@ struct PackedBVH {
|
||||
array<int> prim_index;
|
||||
/* mapping from BVH primitive index, to the object id of that primitive. */
|
||||
array<int> prim_object;
|
||||
/* quick array to lookup if a node is a leaf, not used for traversal, only
|
||||
* for instance BVH merging */
|
||||
array<bool> is_leaf;
|
||||
|
||||
/* index of the root node. */
|
||||
int root_index;
|
||||
@@ -109,7 +108,7 @@ protected:
|
||||
void pack_triangle(int idx, float4 woop[3]);
|
||||
|
||||
/* merge instance BVH's */
|
||||
void pack_instances(size_t nodes_size, size_t leaf_nodes_size);
|
||||
void pack_instances(size_t nodes_size);
|
||||
|
||||
/* for subclasses to implement */
|
||||
virtual void pack_nodes(const BVHNode *root) = 0;
|
||||
|
@@ -65,18 +65,15 @@ public:
|
||||
/* Constructor / Destructor */
|
||||
|
||||
BVHBuild::BVHBuild(const vector<Object*>& objects_,
|
||||
array<int>& prim_type_,
|
||||
array<int>& prim_index_,
|
||||
array<int>& prim_object_,
|
||||
const BVHParams& params_,
|
||||
Progress& progress_)
|
||||
: objects(objects_),
|
||||
prim_type(prim_type_),
|
||||
prim_index(prim_index_),
|
||||
prim_object(prim_object_),
|
||||
params(params_),
|
||||
progress(progress_),
|
||||
progress_start_time(0.0)
|
||||
vector<int>& prim_type_, vector<int>& prim_index_, vector<int>& prim_object_,
|
||||
const BVHParams& params_, Progress& progress_)
|
||||
: objects(objects_),
|
||||
prim_type(prim_type_),
|
||||
prim_index(prim_index_),
|
||||
prim_object(prim_object_),
|
||||
params(params_),
|
||||
progress(progress_),
|
||||
progress_start_time(0.0)
|
||||
{
|
||||
spatial_min_overlap = 0.0f;
|
||||
}
|
||||
@@ -449,10 +446,18 @@ BVHNode *BVHBuild::create_object_leaf_nodes(const BVHReference *ref, int start,
|
||||
return new LeafNode(bounds, 0, 0, 0);
|
||||
}
|
||||
else if(num == 1) {
|
||||
assert(start < prim_type.size());
|
||||
prim_type[start] = ref->prim_type();
|
||||
prim_index[start] = ref->prim_index();
|
||||
prim_object[start] = ref->prim_object();
|
||||
if(start == prim_index.size()) {
|
||||
assert(params.use_spatial_split);
|
||||
|
||||
prim_type.push_back(ref->prim_type());
|
||||
prim_index.push_back(ref->prim_index());
|
||||
prim_object.push_back(ref->prim_object());
|
||||
}
|
||||
else {
|
||||
prim_type[start] = ref->prim_type();
|
||||
prim_index[start] = ref->prim_index();
|
||||
prim_object[start] = ref->prim_object();
|
||||
}
|
||||
|
||||
uint visibility = objects[ref->prim_object()]->visibility;
|
||||
return new LeafNode(ref->bounds(), visibility, start, start+1);
|
||||
@@ -479,9 +484,17 @@ BVHNode *BVHBuild::create_primitive_leaf_node(const int *p_type,
|
||||
int num)
|
||||
{
|
||||
for(int i = 0; i < num; ++i) {
|
||||
prim_type[start + i] = p_type[i];
|
||||
prim_index[start + i] = p_index[i];
|
||||
prim_object[start + i] = p_object[i];
|
||||
if(start + i == prim_index.size()) {
|
||||
assert(params.use_spatial_split);
|
||||
prim_type.push_back(p_type[i]);
|
||||
prim_index.push_back(p_index[i]);
|
||||
prim_object.push_back(p_object[i]);
|
||||
}
|
||||
else {
|
||||
prim_type[start + i] = p_type[i];
|
||||
prim_index[start + i] = p_index[i];
|
||||
prim_object[start + i] = p_object[i];
|
||||
}
|
||||
}
|
||||
return new LeafNode(bounds, visibility, start, start + num);
|
||||
}
|
||||
@@ -522,19 +535,6 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range)
|
||||
}
|
||||
}
|
||||
|
||||
/* Extend an array when needed. */
|
||||
if(prim_type.size() < range.end()) {
|
||||
assert(params.use_spatial_split);
|
||||
/* TODO(sergey): We might want to look into different policies of
|
||||
* re-allocation here, so on the one hand we would not do as much
|
||||
* re-allocations and on the other hand will have small memory
|
||||
* overhead.
|
||||
*/
|
||||
prim_type.resize(range.end());
|
||||
prim_index.resize(range.end());
|
||||
prim_object.resize(range.end());
|
||||
}
|
||||
|
||||
/* Create leaf nodes for every existing primitive. */
|
||||
BVHNode *leaves[PRIMITIVE_NUM_TOTAL + 1] = {NULL};
|
||||
int num_leaves = 0;
|
||||
|
@@ -42,12 +42,13 @@ class BVHBuild
|
||||
{
|
||||
public:
|
||||
/* Constructor/Destructor */
|
||||
BVHBuild(const vector<Object*>& objects,
|
||||
array<int>& prim_type,
|
||||
array<int>& prim_index,
|
||||
array<int>& prim_object,
|
||||
const BVHParams& params,
|
||||
Progress& progress);
|
||||
BVHBuild(
|
||||
const vector<Object*>& objects,
|
||||
vector<int>& prim_type,
|
||||
vector<int>& prim_index,
|
||||
vector<int>& prim_object,
|
||||
const BVHParams& params,
|
||||
Progress& progress);
|
||||
~BVHBuild();
|
||||
|
||||
BVHNode *run();
|
||||
@@ -98,9 +99,9 @@ protected:
|
||||
int num_original_references;
|
||||
|
||||
/* output primitive indexes and objects */
|
||||
array<int>& prim_type;
|
||||
array<int>& prim_index;
|
||||
array<int>& prim_object;
|
||||
vector<int>& prim_type;
|
||||
vector<int>& prim_index;
|
||||
vector<int>& prim_object;
|
||||
|
||||
/* build parameters */
|
||||
BVHParams params;
|
||||
|
@@ -24,7 +24,8 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
enum BVH_STAT {
|
||||
enum BVH_STAT
|
||||
{
|
||||
BVH_STAT_NODE_COUNT,
|
||||
BVH_STAT_INNER_COUNT,
|
||||
BVH_STAT_LEAF_COUNT,
|
||||
|
@@ -33,13 +33,6 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Device */
|
||||
|
||||
Device::~Device()
|
||||
{
|
||||
if(!background && vertex_buffer != 0) {
|
||||
glDeleteBuffers(1, &vertex_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void Device::pixels_alloc(device_memory& mem)
|
||||
{
|
||||
mem_alloc(mem, MEM_READ_WRITE);
|
||||
@@ -58,7 +51,7 @@ void Device::pixels_free(device_memory& mem)
|
||||
mem_free(mem);
|
||||
}
|
||||
|
||||
void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dx, int dy, int width, int height, bool transparent,
|
||||
void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int width, int height, bool transparent,
|
||||
const DeviceDrawParams &draw_params)
|
||||
{
|
||||
pixels_copy_from(rgba, y, w, h);
|
||||
@@ -74,9 +67,6 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dx, int d
|
||||
/* for multi devices, this assumes the inefficient method that we allocate
|
||||
* all pixels on the device even though we only render to a subset */
|
||||
GLhalf *data_pointer = (GLhalf*)rgba.data_pointer;
|
||||
float vbuffer[16], *basep;
|
||||
float *vp = NULL;
|
||||
|
||||
data_pointer += 4*y*w;
|
||||
|
||||
/* draw half float texture, GLSL shader for display transform assumed to be bound */
|
||||
@@ -93,63 +83,23 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dx, int d
|
||||
draw_params.bind_display_space_shader_cb();
|
||||
}
|
||||
|
||||
if(GLEW_VERSION_1_5) {
|
||||
if(!vertex_buffer)
|
||||
glGenBuffers(1, &vertex_buffer);
|
||||
glPushMatrix();
|
||||
glTranslatef(0.0f, (float)dy, 0.0f);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
||||
/* invalidate old contents - avoids stalling if buffer is still waiting in queue to be rendered */
|
||||
glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(float), NULL, GL_STREAM_DRAW);
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex2f(0.0f, 0.0f);
|
||||
glTexCoord2f(1.0f, 0.0f);
|
||||
glVertex2f((float)width, 0.0f);
|
||||
glTexCoord2f(1.0f, 1.0f);
|
||||
glVertex2f((float)width, (float)height);
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex2f(0.0f, (float)height);
|
||||
|
||||
vp = (float *)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
glEnd();
|
||||
|
||||
basep = NULL;
|
||||
}
|
||||
else {
|
||||
basep = vbuffer;
|
||||
vp = vbuffer;
|
||||
}
|
||||
|
||||
if(vp) {
|
||||
/* texture coordinate - vertex pair */
|
||||
vp[0] = 0.0f;
|
||||
vp[1] = 0.0f;
|
||||
vp[2] = dx;
|
||||
vp[3] = dy;
|
||||
|
||||
vp[4] = 1.0f;
|
||||
vp[5] = 0.0f;
|
||||
vp[6] = (float)width + dx;
|
||||
vp[7] = dy;
|
||||
|
||||
vp[8] = 1.0f;
|
||||
vp[9] = 1.0f;
|
||||
vp[10] = (float)width + dx;
|
||||
vp[11] = (float)height + dy;
|
||||
|
||||
vp[12] = 0.0f;
|
||||
vp[13] = 1.0f;
|
||||
vp[14] = dx;
|
||||
vp[15] = (float)height + dy;
|
||||
|
||||
if(vertex_buffer)
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
}
|
||||
|
||||
glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), basep);
|
||||
glVertexPointer(2, GL_FLOAT, 4 * sizeof(float), ((char *)basep) + 2 * sizeof(float));
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
if(vertex_buffer) {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
if(draw_params.unbind_display_space_shader_cb) {
|
||||
draw_params.unbind_display_space_shader_cb();
|
||||
@@ -163,7 +113,7 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dx, int d
|
||||
/* fallback for old graphics cards that don't support GLSL, half float,
|
||||
* and non-power-of-two textures */
|
||||
glPixelZoom((float)width/(float)w, (float)height/(float)h);
|
||||
glRasterPos2f(dx, dy);
|
||||
glRasterPos2f(0, dy);
|
||||
|
||||
uint8_t *pixels = (uint8_t*)rgba.data_pointer;
|
||||
|
||||
@@ -327,10 +277,13 @@ string Device::device_capabilities()
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENCL
|
||||
/* TODO(sergey): Needs proper usable implementation. */
|
||||
/*
|
||||
if(device_opencl_init()) {
|
||||
capabilities += "\nOpenCL device capabilities:\n";
|
||||
capabilities += device_opencl_capabilities();
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
return capabilities;
|
||||
|
@@ -55,7 +55,6 @@ public:
|
||||
bool advanced_shading;
|
||||
bool pack_images;
|
||||
bool extended_images; /* flag for GPU and Multi device */
|
||||
bool use_split_kernel; /* Denotes if the device is going to run cycles using split-kernel */
|
||||
vector<DeviceInfo> multi_devices;
|
||||
|
||||
DeviceInfo()
|
||||
@@ -67,54 +66,6 @@ public:
|
||||
advanced_shading = true;
|
||||
pack_images = false;
|
||||
extended_images = false;
|
||||
use_split_kernel = false;
|
||||
}
|
||||
};
|
||||
|
||||
class DeviceRequestedFeatures {
|
||||
public:
|
||||
/* Use experimental feature set. */
|
||||
bool experimental;
|
||||
|
||||
/* Maximum number of closures in shader trees. */
|
||||
int max_closure;
|
||||
|
||||
/* Selective nodes compilation. */
|
||||
|
||||
/* Identifier of a node group up to which all the nodes needs to be
|
||||
* compiled in. Nodes from higher group indices will be ignores.
|
||||
*/
|
||||
int max_nodes_group;
|
||||
|
||||
/* Features bitfield indicating which features from the requested group
|
||||
* will be compiled in. Nodes which corresponds to features which are not
|
||||
* in this bitfield will be ignored even if they're in the requested group.
|
||||
*/
|
||||
int nodes_features;
|
||||
|
||||
/* BVH/sampling kernel features. */
|
||||
bool use_hair;
|
||||
bool use_object_motion;
|
||||
bool use_camera_motion;
|
||||
|
||||
DeviceRequestedFeatures()
|
||||
{
|
||||
/* TODO(sergey): Find more meaningful defaults. */
|
||||
experimental = false;
|
||||
max_closure = 0;
|
||||
max_nodes_group = 0;
|
||||
nodes_features = 0;
|
||||
use_hair = false;
|
||||
use_object_motion = false;
|
||||
use_camera_motion = false;
|
||||
}
|
||||
|
||||
bool modified(const DeviceRequestedFeatures& requested_features)
|
||||
{
|
||||
return !(experimental == requested_features.experimental &&
|
||||
max_closure == requested_features.max_closure &&
|
||||
max_nodes_group == requested_features.max_nodes_group &&
|
||||
nodes_features == requested_features.nodes_features);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -127,16 +78,13 @@ struct DeviceDrawParams {
|
||||
|
||||
class Device {
|
||||
protected:
|
||||
Device(DeviceInfo& info_, Stats &stats_, bool background) : background(background), vertex_buffer(0), info(info_), stats(stats_) {}
|
||||
Device(DeviceInfo& info_, Stats &stats_, bool background) : background(background), info(info_), stats(stats_) {}
|
||||
|
||||
bool background;
|
||||
string error_msg;
|
||||
|
||||
/* used for real time display */
|
||||
unsigned int vertex_buffer;
|
||||
|
||||
public:
|
||||
virtual ~Device();
|
||||
virtual ~Device() {}
|
||||
|
||||
/* info */
|
||||
DeviceInfo info;
|
||||
@@ -177,9 +125,7 @@ public:
|
||||
virtual void *osl_memory() { return NULL; }
|
||||
|
||||
/* load/compile kernels, must be called before adding tasks */
|
||||
virtual bool load_kernels(
|
||||
const DeviceRequestedFeatures& /*requested_features*/)
|
||||
{ return true; }
|
||||
virtual bool load_kernels(bool /*experimental*/) { return true; }
|
||||
|
||||
/* tasks */
|
||||
virtual int get_split_task_count(DeviceTask& task) = 0;
|
||||
@@ -189,7 +135,7 @@ public:
|
||||
|
||||
/* opengl drawing */
|
||||
virtual void draw_pixels(device_memory& mem, int y, int w, int h,
|
||||
int dx, int dy, int width, int height, bool transparent,
|
||||
int dy, int width, int height, bool transparent,
|
||||
const DeviceDrawParams &draw_params);
|
||||
|
||||
#ifdef WITH_NETWORK
|
||||
|
@@ -19,15 +19,6 @@
|
||||
|
||||
/* So ImathMath is included before our kernel_cpu_compat. */
|
||||
#ifdef WITH_OSL
|
||||
# if defined(_MSC_VER)
|
||||
/* Prevent OSL from polluting the context with weird macros from windows.h.
|
||||
* TODO(sergey): Ideally it's only enough to have class/struct declarations in
|
||||
* the header and skip header include here.
|
||||
*/
|
||||
# define NOGDI
|
||||
# define NOMINMAX
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
# include <OSL/oslexec.h>
|
||||
#endif
|
||||
|
||||
@@ -47,7 +38,6 @@
|
||||
#include "util_debug.h"
|
||||
#include "util_foreach.h"
|
||||
#include "util_function.h"
|
||||
#include "util_logging.h"
|
||||
#include "util_opengl.h"
|
||||
#include "util_progress.h"
|
||||
#include "util_system.h"
|
||||
@@ -125,7 +115,6 @@ public:
|
||||
|
||||
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool /*periodic*/)
|
||||
{
|
||||
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
|
||||
kernel_tex_copy(&kernel_globals, name, mem.data_pointer, mem.data_width, mem.data_height, mem.data_depth, interpolation);
|
||||
mem.device_pointer = mem.data_pointer;
|
||||
mem.device_size = mem.memory_size();
|
||||
|
@@ -266,7 +266,7 @@ public:
|
||||
printf("CUDA version %d.%d detected, build may succeed but only CUDA 6.5 is officially supported.\n", cuda_version/10, cuda_version%10);
|
||||
|
||||
/* compile */
|
||||
string kernel = path_join(kernel_path, path_join("kernels", path_join("cuda", "kernel.cu")));
|
||||
string kernel = path_join(kernel_path, "kernel.cu");
|
||||
string include = kernel_path;
|
||||
const int machine = system_cpu_bits();
|
||||
|
||||
@@ -281,7 +281,7 @@ public:
|
||||
nvcc, major, minor, machine, kernel.c_str(), cubin.c_str(), include.c_str(), cuda_version);
|
||||
|
||||
if(experimental)
|
||||
command += " -D__KERNEL_EXPERIMENTAL__";
|
||||
command += " -D__KERNEL_CUDA_EXPERIMENTAL__";
|
||||
|
||||
if(getenv("CYCLES_CUDA_EXTRA_CFLAGS")) {
|
||||
command += string(" ") + getenv("CYCLES_CUDA_EXTRA_CFLAGS");
|
||||
@@ -309,18 +309,18 @@ public:
|
||||
return cubin;
|
||||
}
|
||||
|
||||
bool load_kernels(const DeviceRequestedFeatures& requested_features)
|
||||
bool load_kernels(bool experimental)
|
||||
{
|
||||
/* check if cuda init succeeded */
|
||||
if(cuContext == 0)
|
||||
return false;
|
||||
|
||||
/* check if GPU is supported */
|
||||
if(!support_device(requested_features.experimental))
|
||||
if(!support_device(experimental))
|
||||
return false;
|
||||
|
||||
/* get kernel */
|
||||
string cubin = compile_kernel(requested_features.experimental);
|
||||
string cubin = compile_kernel(experimental);
|
||||
|
||||
if(cubin == "")
|
||||
return false;
|
||||
@@ -419,7 +419,6 @@ public:
|
||||
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
|
||||
{
|
||||
/* todo: support 3D textures, only CPU for now */
|
||||
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
|
||||
|
||||
/* determine format */
|
||||
CUarray_format_enum format;
|
||||
@@ -880,12 +879,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void draw_pixels(device_memory& mem, int y, int w, int h, int dx, int dy, int width, int height, bool transparent,
|
||||
void draw_pixels(device_memory& mem, int y, int w, int h, int dy, int width, int height, bool transparent,
|
||||
const DeviceDrawParams &draw_params)
|
||||
{
|
||||
if(!background) {
|
||||
PixelMem pmem = pixel_mem_map[mem.device_pointer];
|
||||
float *vpointer;
|
||||
|
||||
cuda_push_context();
|
||||
|
||||
@@ -919,52 +917,23 @@ public:
|
||||
draw_params.bind_display_space_shader_cb();
|
||||
}
|
||||
|
||||
if(!vertex_buffer)
|
||||
glGenBuffers(1, &vertex_buffer);
|
||||
glPushMatrix();
|
||||
glTranslatef(0.0f, (float)dy, 0.0f);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex2f(0.0f, 0.0f);
|
||||
glTexCoord2f((float)w/(float)pmem.w, 0.0f);
|
||||
glVertex2f((float)width, 0.0f);
|
||||
glTexCoord2f((float)w/(float)pmem.w, (float)h/(float)pmem.h);
|
||||
glVertex2f((float)width, (float)height);
|
||||
glTexCoord2f(0.0f, (float)h/(float)pmem.h);
|
||||
glVertex2f(0.0f, (float)height);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
||||
/* invalidate old contents - avoids stalling if buffer is still waiting in queue to be rendered */
|
||||
glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(float), NULL, GL_STREAM_DRAW);
|
||||
glEnd();
|
||||
|
||||
vpointer = (float *)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
|
||||
if(vpointer) {
|
||||
/* texture coordinate - vertex pair */
|
||||
vpointer[0] = 0.0f;
|
||||
vpointer[1] = 0.0f;
|
||||
vpointer[2] = dx;
|
||||
vpointer[3] = dy;
|
||||
|
||||
vpointer[4] = (float)w/(float)pmem.w;
|
||||
vpointer[5] = 0.0f;
|
||||
vpointer[6] = (float)width + dx;
|
||||
vpointer[7] = dy;
|
||||
|
||||
vpointer[8] = (float)w/(float)pmem.w;
|
||||
vpointer[9] = (float)h/(float)pmem.h;
|
||||
vpointer[10] = (float)width + dx;
|
||||
vpointer[11] = (float)height + dy;
|
||||
|
||||
vpointer[12] = 0.0f;
|
||||
vpointer[13] = (float)h/(float)pmem.h;
|
||||
vpointer[14] = dx;
|
||||
vpointer[15] = (float)height + dy;
|
||||
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
}
|
||||
|
||||
glTexCoordPointer(2, GL_FLOAT, 4 * sizeof(float), 0);
|
||||
glVertexPointer(2, GL_FLOAT, 4 * sizeof(float), (char *)NULL + 2 * sizeof(float));
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glPopMatrix();
|
||||
|
||||
if(draw_params.unbind_display_space_shader_cb) {
|
||||
draw_params.unbind_display_space_shader_cb();
|
||||
@@ -981,7 +950,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
Device::draw_pixels(mem, y, w, h, dx, dy, width, height, transparent, draw_params);
|
||||
Device::draw_pixels(mem, y, w, h, dy, width, height, transparent, draw_params);
|
||||
}
|
||||
|
||||
void thread_run(DeviceTask *task)
|
||||
@@ -1122,20 +1091,14 @@ void device_cuda_info(vector<DeviceInfo>& devices)
|
||||
}
|
||||
|
||||
vector<DeviceInfo> display_devices;
|
||||
|
||||
|
||||
for(int num = 0; num < count; num++) {
|
||||
char name[256];
|
||||
int attr;
|
||||
|
||||
|
||||
if(cuDeviceGetName(name, 256, num) != CUDA_SUCCESS)
|
||||
continue;
|
||||
|
||||
int major, minor;
|
||||
cuDeviceComputeCapability(&major, &minor, num);
|
||||
if(major < 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DeviceInfo info;
|
||||
|
||||
info.type = DEVICE_CUDA;
|
||||
@@ -1143,6 +1106,8 @@ void device_cuda_info(vector<DeviceInfo>& devices)
|
||||
info.id = string_printf("CUDA_%d", num);
|
||||
info.num = num;
|
||||
|
||||
int major, minor;
|
||||
cuDeviceComputeCapability(&major, &minor, num);
|
||||
info.advanced_shading = (major >= 2);
|
||||
info.extended_images = (major >= 3);
|
||||
info.pack_images = false;
|
||||
@@ -1167,7 +1132,7 @@ string device_cuda_capabilities(void)
|
||||
if(result != CUDA_ERROR_NO_DEVICE) {
|
||||
return string("Error initializing CUDA: ") + cuewErrorString(result);
|
||||
}
|
||||
return "No CUDA device found\n";
|
||||
return "No CUDA device found";
|
||||
}
|
||||
|
||||
int count;
|
||||
|
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "util_foreach.h"
|
||||
#include "util_list.h"
|
||||
#include "util_logging.h"
|
||||
#include "util_map.h"
|
||||
#include "util_time.h"
|
||||
|
||||
@@ -89,10 +88,10 @@ public:
|
||||
return error_msg;
|
||||
}
|
||||
|
||||
bool load_kernels(const DeviceRequestedFeatures& requested_features)
|
||||
bool load_kernels(bool experimental)
|
||||
{
|
||||
foreach(SubDevice& sub, devices)
|
||||
if(!sub.device->load_kernels(requested_features))
|
||||
if(!sub.device->load_kernels(experimental))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -171,8 +170,6 @@ public:
|
||||
|
||||
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
|
||||
{
|
||||
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
|
||||
|
||||
foreach(SubDevice& sub, devices) {
|
||||
mem.device_pointer = 0;
|
||||
sub.device->tex_alloc(name, mem, interpolation, periodic);
|
||||
@@ -236,7 +233,7 @@ public:
|
||||
mem.device_pointer = tmp;
|
||||
}
|
||||
|
||||
void draw_pixels(device_memory& rgba, int y, int w, int h, int dx, int dy, int width, int height, bool transparent,
|
||||
void draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int width, int height, bool transparent,
|
||||
const DeviceDrawParams &draw_params)
|
||||
{
|
||||
device_ptr tmp = rgba.device_pointer;
|
||||
@@ -251,7 +248,7 @@ public:
|
||||
/* adjust math for w/width */
|
||||
|
||||
rgba.device_pointer = sub.ptr_map[tmp];
|
||||
sub.device->draw_pixels(rgba, sy, w, sh, dx, sdy, width, sheight, transparent, draw_params);
|
||||
sub.device->draw_pixels(rgba, sy, w, sh, sdy, width, sheight, transparent, draw_params);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#include "device_network.h"
|
||||
|
||||
#include "util_foreach.h"
|
||||
#include "util_logging.h"
|
||||
|
||||
#if defined(WITH_NETWORK)
|
||||
|
||||
@@ -165,8 +164,6 @@ public:
|
||||
|
||||
void tex_alloc(const char *name, device_memory& mem, InterpolationType interpolation, bool periodic)
|
||||
{
|
||||
VLOG(1) << "Texture allocate: " << name << ", " << mem.memory_size() << " bytes.";
|
||||
|
||||
thread_scoped_lock lock(rpc_lock);
|
||||
|
||||
mem.device_pointer = ++mem_counter;
|
||||
@@ -197,7 +194,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool load_kernels(const DeviceRequestedFeatures& requested_features)
|
||||
bool load_kernels(bool experimental)
|
||||
{
|
||||
if(error_func.have_error())
|
||||
return false;
|
||||
@@ -205,10 +202,7 @@ public:
|
||||
thread_scoped_lock lock(rpc_lock);
|
||||
|
||||
RPCSend snd(socket, &error_func, "load_kernels");
|
||||
snd.add(requested_features.experimental);
|
||||
snd.add(requested_features.max_closure);
|
||||
snd.add(requested_features.max_nodes_group);
|
||||
snd.add(requested_features.nodes_features);
|
||||
snd.add(experimental);
|
||||
snd.write();
|
||||
|
||||
bool result;
|
||||
@@ -611,14 +605,11 @@ protected:
|
||||
device->tex_free(mem);
|
||||
}
|
||||
else if(rcv.name == "load_kernels") {
|
||||
DeviceRequestedFeatures requested_features;
|
||||
rcv.read(requested_features.experimental);
|
||||
rcv.read(requested_features.max_closure);
|
||||
rcv.read(requested_features.max_nodes_group);
|
||||
rcv.read(requested_features.nodes_features);
|
||||
bool experimental;
|
||||
rcv.read(experimental);
|
||||
|
||||
bool result;
|
||||
result = device->load_kernels(requested_features);
|
||||
result = device->load_kernels(experimental);
|
||||
RPCSend snd(socket, &error_func, "load_kernels");
|
||||
snd.add(result);
|
||||
snd.write();
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -65,7 +65,6 @@ public:
|
||||
|
||||
bool need_finish_queue;
|
||||
bool integrator_branched;
|
||||
int2 requested_tile_size;
|
||||
protected:
|
||||
double last_update_time;
|
||||
};
|
||||
|
@@ -12,20 +12,9 @@ set(INC_SYS
|
||||
)
|
||||
|
||||
set(SRC
|
||||
kernels/cpu/kernel.cpp
|
||||
kernels/opencl/kernel.cl
|
||||
kernels/opencl/kernel_data_init.cl
|
||||
kernels/opencl/kernel_queue_enqueue.cl
|
||||
kernels/opencl/kernel_scene_intersect.cl
|
||||
kernels/opencl/kernel_lamp_emission.cl
|
||||
kernels/opencl/kernel_background_buffer_update.cl
|
||||
kernels/opencl/kernel_shader_eval.cl
|
||||
kernels/opencl/kernel_holdout_emission_blurring_pathtermination_ao.cl
|
||||
kernels/opencl/kernel_direct_lighting.cl
|
||||
kernels/opencl/kernel_shadow_blocked.cl
|
||||
kernels/opencl/kernel_next_iteration_setup.cl
|
||||
kernels/opencl/kernel_sum_all_radiance.cl
|
||||
kernels/cuda/kernel.cu
|
||||
kernel.cpp
|
||||
kernel.cl
|
||||
kernel.cu
|
||||
)
|
||||
|
||||
set(SRC_HEADERS
|
||||
@@ -47,22 +36,17 @@ set(SRC_HEADERS
|
||||
kernel_montecarlo.h
|
||||
kernel_passes.h
|
||||
kernel_path.h
|
||||
kernel_path_branched.h
|
||||
kernel_path_common.h
|
||||
kernel_path_state.h
|
||||
kernel_path_surface.h
|
||||
kernel_path_volume.h
|
||||
kernel_projection.h
|
||||
kernel_queues.h
|
||||
kernel_random.h
|
||||
kernel_shader.h
|
||||
kernel_shaderdata_vars.h
|
||||
kernel_shadow.h
|
||||
kernel_subsurface.h
|
||||
kernel_textures.h
|
||||
kernel_types.h
|
||||
kernel_volume.h
|
||||
kernel_work_stealing.h
|
||||
)
|
||||
|
||||
set(SRC_CLOSURE_HEADERS
|
||||
@@ -84,7 +68,6 @@ set(SRC_CLOSURE_HEADERS
|
||||
closure/emissive.h
|
||||
closure/volume.h
|
||||
)
|
||||
|
||||
set(SRC_SVM_HEADERS
|
||||
svm/svm.h
|
||||
svm/svm_attribute.h
|
||||
@@ -136,7 +119,6 @@ set(SRC_GEOM_HEADERS
|
||||
geom/geom_bvh_subsurface.h
|
||||
geom/geom_bvh_traversal.h
|
||||
geom/geom_bvh_volume.h
|
||||
geom/geom_bvh_volume_all.h
|
||||
geom/geom_curve.h
|
||||
geom/geom_motion_curve.h
|
||||
geom/geom_motion_triangle.h
|
||||
@@ -147,14 +129,12 @@ set(SRC_GEOM_HEADERS
|
||||
geom/geom_qbvh_subsurface.h
|
||||
geom/geom_qbvh_traversal.h
|
||||
geom/geom_qbvh_volume.h
|
||||
geom/geom_qbvh_volume_all.h
|
||||
geom/geom_triangle.h
|
||||
geom/geom_triangle_intersect.h
|
||||
geom/geom_volume.h
|
||||
)
|
||||
|
||||
set(SRC_UTIL_HEADERS
|
||||
../util/util_atomic.h
|
||||
../util/util_color.h
|
||||
../util/util_half.h
|
||||
../util/util_math.h
|
||||
@@ -162,21 +142,6 @@ set(SRC_UTIL_HEADERS
|
||||
../util/util_transform.h
|
||||
../util/util_types.h
|
||||
)
|
||||
|
||||
set(SRC_SPLIT_HEADERS
|
||||
split/kernel_background_buffer_update.h
|
||||
split/kernel_data_init.h
|
||||
split/kernel_direct_lighting.h
|
||||
split/kernel_holdout_emission_blurring_pathtermination_ao.h
|
||||
split/kernel_lamp_emission.h
|
||||
split/kernel_next_iteration_setup.h
|
||||
split/kernel_scene_intersect.h
|
||||
split/kernel_shader_eval.h
|
||||
split/kernel_shadow_blocked.h
|
||||
split/kernel_split_common.h
|
||||
split/kernel_sum_all_radiance.h
|
||||
)
|
||||
|
||||
# CUDA module
|
||||
|
||||
if(WITH_CYCLES_CUDA_BINARIES)
|
||||
@@ -202,12 +167,12 @@ if(WITH_CYCLES_CUDA_BINARIES)
|
||||
endif()
|
||||
|
||||
# build for each arch
|
||||
set(cuda_sources kernels/cuda/kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_GEOM_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_UTIL_HEADERS})
|
||||
set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_GEOM_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_UTIL_HEADERS})
|
||||
set(cuda_cubins)
|
||||
|
||||
macro(CYCLES_CUDA_KERNEL_ADD arch experimental)
|
||||
if(${experimental})
|
||||
set(cuda_extra_flags "-D__KERNEL_EXPERIMENTAL__")
|
||||
set(cuda_extra_flags "-D__KERNEL_CUDA_EXPERIMENTAL__")
|
||||
set(cuda_cubin kernel_experimental_${arch}.cubin)
|
||||
else()
|
||||
set(cuda_extra_flags "")
|
||||
@@ -228,7 +193,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
|
||||
COMMAND ${CUDA_NVCC_EXECUTABLE}
|
||||
-arch=${arch}
|
||||
-m${CUDA_BITS}
|
||||
--cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernels/cuda/kernel.cu
|
||||
--cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu
|
||||
-o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin}
|
||||
--ptxas-options="-v"
|
||||
${cuda_arch_flags}
|
||||
@@ -276,28 +241,28 @@ include_directories(SYSTEM ${INC_SYS})
|
||||
|
||||
if(CXX_HAS_SSE)
|
||||
list(APPEND SRC
|
||||
kernels/cpu/kernel_sse2.cpp
|
||||
kernels/cpu/kernel_sse3.cpp
|
||||
kernels/cpu/kernel_sse41.cpp
|
||||
kernel_sse2.cpp
|
||||
kernel_sse3.cpp
|
||||
kernel_sse41.cpp
|
||||
)
|
||||
|
||||
set_source_files_properties(kernels/cpu/kernel_sse2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE2_KERNEL_FLAGS}")
|
||||
set_source_files_properties(kernels/cpu/kernel_sse3.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE3_KERNEL_FLAGS}")
|
||||
set_source_files_properties(kernels/cpu/kernel_sse41.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE41_KERNEL_FLAGS}")
|
||||
set_source_files_properties(kernel_sse2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE2_KERNEL_FLAGS}")
|
||||
set_source_files_properties(kernel_sse3.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE3_KERNEL_FLAGS}")
|
||||
set_source_files_properties(kernel_sse41.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE41_KERNEL_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(CXX_HAS_AVX)
|
||||
list(APPEND SRC
|
||||
kernels/cpu/kernel_avx.cpp
|
||||
kernel_avx.cpp
|
||||
)
|
||||
set_source_files_properties(kernels/cpu/kernel_avx.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX_KERNEL_FLAGS}")
|
||||
set_source_files_properties(kernel_avx.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX_KERNEL_FLAGS}")
|
||||
endif()
|
||||
|
||||
if(CXX_HAS_AVX2)
|
||||
list(APPEND SRC
|
||||
kernels/cpu/kernel_avx2.cpp
|
||||
kernel_avx2.cpp
|
||||
)
|
||||
set_source_files_properties(kernels/cpu/kernel_avx2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
|
||||
set_source_files_properties(kernel_avx2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
|
||||
endif()
|
||||
|
||||
add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_SVM_HEADERS} ${SRC_GEOM_HEADERS})
|
||||
@@ -316,23 +281,11 @@ endif()
|
||||
#add_custom_target(cycles_kernel_preprocess ALL DEPENDS ${KERNEL_PREPROCESSED})
|
||||
#delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${KERNEL_PREPROCESSED}" ${CYCLES_INSTALL_PATH}/kernel)
|
||||
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_data_init.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_queue_enqueue.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_scene_intersect.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_lamp_emission.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_background_buffer_update.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_shader_eval.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_holdout_emission_blurring_pathtermination_ao.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_direct_lighting.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_shadow_blocked.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_next_iteration_setup.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/opencl/kernel_sum_all_radiance.cl" ${CYCLES_INSTALL_PATH}/kernel/kernels/opencl)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernels/cuda/kernel.cu" ${CYCLES_INSTALL_PATH}/kernel/kernels/cuda)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cl" ${CYCLES_INSTALL_PATH}/kernel)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cu" ${CYCLES_INSTALL_PATH}/kernel)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_CLOSURE_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/closure)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SVM_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/svm)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_GEOM_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/geom)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SPLIT_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/split)
|
||||
|
||||
|
@@ -57,9 +57,8 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
|
||||
build_dir = os.path.join(root_build_dir, 'intern/cycles/kernel')
|
||||
|
||||
# source directories and files
|
||||
kernel_file_rel = os.path.join("kernels", "cuda", "kernel.cu")
|
||||
source_dir = Dir('.').srcnode().path
|
||||
kernel_file = os.path.join(source_dir, kernel_file_rel)
|
||||
kernel_file = os.path.join(source_dir, "kernel.cu")
|
||||
util_dir = os.path.join(source_dir, "../util")
|
||||
svm_dir = os.path.join(source_dir, "../svm")
|
||||
geom_dir = os.path.join(source_dir, "../geom")
|
||||
@@ -84,11 +83,11 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
|
||||
nvcc_flags += " -D__KERNEL_DEBUG__"
|
||||
|
||||
# dependencies
|
||||
dependencies = [kernel_file_rel] + kernel.Glob('*.h') + kernel.Glob('../util/*.h') + kernel.Glob('svm/*.h') + kernel.Glob('geom/*.h') + kernel.Glob('closure/*.h')
|
||||
dependencies = ['kernel.cu'] + kernel.Glob('*.h') + kernel.Glob('../util/*.h') + kernel.Glob('svm/*.h') + kernel.Glob('geom/*.h') + kernel.Glob('closure/*.h')
|
||||
last_cubin_file = None
|
||||
|
||||
configs = (("kernel_%s.cubin", ''),
|
||||
("kernel_experimental_%s.cubin", ' -D__KERNEL_EXPERIMENTAL__'))
|
||||
("kernel_experimental_%s.cubin", ' -D__KERNEL_CUDA_EXPERIMENTAL__'))
|
||||
|
||||
# add command for each cuda architecture
|
||||
for arch in cuda_archs:
|
||||
@@ -106,7 +105,7 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
|
||||
else:
|
||||
command = "\"%s\" -arch=%s %s \"%s\" -o \"%s\"" % (nvcc, arch, current_flags, kernel_file, cubin_file)
|
||||
|
||||
kernel.Command(cubin_file, kernel_file_rel, command)
|
||||
kernel.Command(cubin_file, 'kernel.cu', command)
|
||||
kernel.Depends(cubin_file, dependencies)
|
||||
|
||||
kernel_binaries.append(cubin_file)
|
||||
|
@@ -47,79 +47,79 @@ ccl_device int bsdf_sample(KernelGlobals *kg, const ShaderData *sd, const Shader
|
||||
switch(sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_ID:
|
||||
label = bsdf_diffuse_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_diffuse_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
#ifdef __SVM__
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
label = bsdf_oren_nayar_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_oren_nayar_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
/*case CLOSURE_BSDF_PHONG_RAMP_ID:
|
||||
label = bsdf_phong_ramp_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_phong_ramp_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_RAMP_ID:
|
||||
label = bsdf_diffuse_ramp_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_diffuse_ramp_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;*/
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
label = bsdf_translucent_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_translucent_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
label = bsdf_reflection_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_reflection_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
label = bsdf_refraction_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_refraction_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
label = bsdf_transparent_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_transparent_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
label = bsdf_microfacet_ggx_sample(kg, sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_microfacet_ggx_sample(kg, sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
label = bsdf_microfacet_beckmann_sample(kg, sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_microfacet_beckmann_sample(kg, sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID:
|
||||
label = bsdf_ashikhmin_shirley_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_ashikhmin_shirley_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
label = bsdf_ashikhmin_velvet_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_ashikhmin_velvet_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_TOON_ID:
|
||||
label = bsdf_diffuse_toon_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_diffuse_toon_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_GLOSSY_TOON_ID:
|
||||
label = bsdf_glossy_toon_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_glossy_toon_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
|
||||
label = bsdf_hair_reflection_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_hair_reflection_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
label = bsdf_hair_transmission_sample(sc, ccl_fetch(sd, Ng), ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv,
|
||||
label = bsdf_hair_transmission_sample(sc, sd->Ng, sd->I, sd->dI.dx, sd->dI.dy, randu, randv,
|
||||
eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
#endif
|
||||
#ifdef __VOLUME__
|
||||
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
|
||||
label = volume_henyey_greenstein_sample(sc, ccl_fetch(sd, I), ccl_fetch(sd, dI).dx, ccl_fetch(sd, dI).dy, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
label = volume_henyey_greenstein_sample(sc, sd->I, sd->dI.dx, sd->dI.dy, randu, randv, eval, omega_in, &domega_in->dx, &domega_in->dy, pdf);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -139,67 +139,67 @@ ccl_device float3 bsdf_eval(KernelGlobals *kg, const ShaderData *sd, const Shade
|
||||
return OSLShader::bsdf_eval(sd, sc, omega_in, *pdf);
|
||||
#endif
|
||||
|
||||
if(dot(ccl_fetch(sd, Ng), omega_in) >= 0.0f) {
|
||||
if(dot(sd->Ng, omega_in) >= 0.0f) {
|
||||
switch(sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_ID:
|
||||
eval = bsdf_diffuse_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_diffuse_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#ifdef __SVM__
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
eval = bsdf_oren_nayar_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_oren_nayar_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
/*case CLOSURE_BSDF_PHONG_RAMP_ID:
|
||||
eval = bsdf_phong_ramp_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_phong_ramp_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_RAMP_ID:
|
||||
eval = bsdf_diffuse_ramp_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_diffuse_ramp_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;*/
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
eval = bsdf_translucent_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_translucent_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
eval = bsdf_reflection_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_reflection_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
eval = bsdf_refraction_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_refraction_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
eval = bsdf_transparent_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_transparent_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_ggx_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_microfacet_ggx_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_beckmann_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_microfacet_beckmann_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID:
|
||||
eval = bsdf_ashikhmin_shirley_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_ashikhmin_shirley_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
eval = bsdf_ashikhmin_velvet_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_ashikhmin_velvet_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_TOON_ID:
|
||||
eval = bsdf_diffuse_toon_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_diffuse_toon_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_GLOSSY_TOON_ID:
|
||||
eval = bsdf_glossy_toon_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_glossy_toon_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
|
||||
eval = bsdf_hair_reflection_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_hair_reflection_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
eval = bsdf_hair_transmission_eval_reflect(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_hair_transmission_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
#ifdef __VOLUME__
|
||||
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
|
||||
eval = volume_henyey_greenstein_eval_phase(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = volume_henyey_greenstein_eval_phase(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -211,57 +211,57 @@ ccl_device float3 bsdf_eval(KernelGlobals *kg, const ShaderData *sd, const Shade
|
||||
switch(sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_ID:
|
||||
eval = bsdf_diffuse_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_diffuse_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#ifdef __SVM__
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
eval = bsdf_oren_nayar_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_oren_nayar_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
eval = bsdf_translucent_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_translucent_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
eval = bsdf_reflection_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_reflection_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
eval = bsdf_refraction_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_refraction_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
eval = bsdf_transparent_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_transparent_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_ggx_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_microfacet_ggx_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_beckmann_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_microfacet_beckmann_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID:
|
||||
eval = bsdf_ashikhmin_shirley_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_ashikhmin_shirley_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
eval = bsdf_ashikhmin_velvet_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_ashikhmin_velvet_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_TOON_ID:
|
||||
eval = bsdf_diffuse_toon_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_diffuse_toon_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_GLOSSY_TOON_ID:
|
||||
eval = bsdf_glossy_toon_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_glossy_toon_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
|
||||
eval = bsdf_hair_reflection_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_hair_reflection_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
eval = bsdf_hair_transmission_eval_transmit(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = bsdf_hair_transmission_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
#ifdef __VOLUME__
|
||||
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
|
||||
eval = volume_henyey_greenstein_eval_phase(sc, ccl_fetch(sd, I), omega_in, pdf);
|
||||
eval = volume_henyey_greenstein_eval_phase(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@@ -70,7 +70,7 @@ ccl_device float3 bsdf_ashikhmin_shirley_eval_reflect(const ShaderClosure *sc, c
|
||||
float out = 0.0f;
|
||||
|
||||
if(fmaxf(sc->data0, sc->data1) <= 1e-4f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
return make_float3(0, 0, 0);
|
||||
|
||||
if(NdotI > 0.0f && NdotO > 0.0f) {
|
||||
NdotI = fmaxf(NdotI, 1e-6f);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user