Compare commits
530 Commits
temp-dynam
...
temp-eevee
Author | SHA1 | Date | |
---|---|---|---|
05517c9bed | |||
ff11750ee9 | |||
abbd997193 | |||
0f13e53669 | |||
6100c236fb | |||
0bbccd3741 | |||
07e368cb5f | |||
881cc17ffa | |||
113b053d5b | |||
12d4ebcaa3 | |||
8c528a4f0a | |||
5a56e4997f | |||
cf9f0b35be | |||
deaa90b5a5 | |||
be8855a2ef | |||
0e6abf414f | |||
a21742a07b | |||
65ac6e214d | |||
0b9350bb51 | |||
edeb9e5b01 | |||
e8bc8bf618 | |||
7bb7c3e5cb | |||
49099c9048 | |||
edb78d528b | |||
d37929c85b | |||
f84956738b | |||
bf02c4ba00 | |||
53c24bf97c | |||
a724963640 | |||
ce885edfee | |||
b24232ff34 | |||
d2923d7d62 | |||
32396b3164 | |||
ac8aff2b28 | |||
6793aebad2 | |||
4c5541feef | |||
70e2824126 | |||
fb81446f56 | |||
9856dd9fec | |||
4ab37b3225 | |||
aed82dafff | |||
907dd3d34a | |||
73d2d75eed | |||
9fb9125184 | |||
804205babe | |||
392ed710d6 | |||
6d72d3c862 | |||
9d43ed521c | |||
1f51b0212f | |||
b5811bccf8 | |||
8467a7a351 | |||
f7bce99e4d | |||
5480de3fca | |||
6d0d237be3 | |||
1f539cd7ef | |||
97cd8bfae1 | |||
0f1000ce0b | |||
80a31d30a4 | |||
4b373ed086 | |||
252207cc7a | |||
a6340a5068 | |||
aed09d4329 | |||
74fd17e9d7 | |||
4ac048f4e4 | |||
![]() |
29b8adec61 | ||
![]() |
2a199f5093 | ||
b94222b090 | |||
d360eced65 | |||
![]() |
4674cffe29 | ||
a48b52d546 | |||
63f3e1ac7c | |||
22150eb409 | |||
49af17beb8 | |||
4e4e88f02b | |||
5402529deb | |||
7538716d57 | |||
7ea26cc9c5 | |||
15f4aa182f | |||
571e773fbe | |||
79dabc537e | |||
3527857cdc | |||
b0c32818ba | |||
9fc79a4033 | |||
3da1207b48 | |||
a364150c14 | |||
02f903d099 | |||
2aba2de92b | |||
843d5d707d | |||
81a93df6d2 | |||
0987c11c76 | |||
12ce0cfb21 | |||
7691040166 | |||
ccef83b2fb | |||
dd5c25fab2 | |||
3cc2a9b934 | |||
![]() |
df30b50f2f | ||
3e0920c61a | |||
6379c7bd47 | |||
174a3348ab | |||
![]() |
d20d2bcb7f | ||
de777ad9e6 | |||
1daa20ad9f | |||
6d38d82437 | |||
aff8b02394 | |||
62fbb7d4a1 | |||
ed2204933a | |||
27e0d6cbd0 | |||
3314d0bcb6 | |||
5b3545f99f | |||
d56b90705e | |||
288bcb2593 | |||
a71c2deac5 | |||
88a6aab8bb | |||
08ae597d63 | |||
f5d096798c | |||
52655f5161 | |||
8dff538989 | |||
0e2915b292 | |||
45fdf41be8 | |||
a3f5d4cb14 | |||
72e04f9890 | |||
e5ca319f9d | |||
7112e96e0f | |||
1bf5cc57bd | |||
f2de8a190f | |||
a883f0fd54 | |||
dbdafe1209 | |||
5bd57aaa05 | |||
d8223468fe | |||
c974a35953 | |||
997b73c1db | |||
404bacc639 | |||
35f8198c9d | |||
4dfcc6c25a | |||
5db711fdd9 | |||
ec98d8cc9e | |||
d192d72312 | |||
c1678a3723 | |||
f7ec70895c | |||
![]() |
4d00e95ee3 | ||
a4328a4b70 | |||
d13fb7a7c4 | |||
397d088611 | |||
1517fa4309 | |||
03ef9f3214 | |||
f4ce6d02cd | |||
99a6d616e8 | |||
edd59aa2be | |||
30680b8d51 | |||
49b86bcfec | |||
cd17b32583 | |||
656739067f | |||
74a17505fd | |||
53c63db2ee | |||
cc6fd329e6 | |||
b1bc3dfb89 | |||
535fec0661 | |||
c43443d530 | |||
4e2228525f | |||
2bef8ca1b8 | |||
5a1aa5b935 | |||
54fba73812 | |||
59415598e4 | |||
a8b5658437 | |||
1df1514d31 | |||
7e0ceb2ff6 | |||
46d8aa6d94 | |||
49fdf0b946 | |||
7c47b338c0 | |||
56ace4b209 | |||
4bbbfdb26a | |||
03ff3aebc4 | |||
da71d831c3 | |||
c767523727 | |||
a232b4926f | |||
f03079eff0 | |||
1545657d7a | |||
fd341dd6f7 | |||
d663ec48c0 | |||
175fe29e58 | |||
60b9d413db | |||
c960804747 | |||
f1525cf534 | |||
9db8bdbc65 | |||
97a0d6fcc7 | |||
b10c64bd2f | |||
88b297da99 | |||
7d355008bf | |||
8aa1ef2675 | |||
72e090a3cf | |||
8da2e97ec3 | |||
67f4e9783b | |||
f9660a78ea | |||
b575c50753 | |||
769c57b38a | |||
9e4d667c2c | |||
75b5ff6698 | |||
13ec4be594 | |||
405c6c077f | |||
969111f9b5 | |||
46bdbc6c78 | |||
9e5002aded | |||
16878072a4 | |||
bb9355e703 | |||
79152371c3 | |||
81a23d1f2d | |||
51acd54760 | |||
00db85ea81 | |||
3da9d36554 | |||
f14680b1be | |||
4632e4fde4 | |||
cde6bbfea1 | |||
48d7cf680e | |||
69e512243c | |||
14b0510d21 | |||
1c5b375390 | |||
fbafa4352b | |||
c0c0eb7e7e | |||
33a5cde313 | |||
76d7186d61 | |||
03ca4a57c7 | |||
a2ce6af2f5 | |||
952ae70109 | |||
c118b852b7 | |||
967b84534a | |||
e30f25ba22 | |||
433e3db8d8 | |||
6c9fe9cd8c | |||
d78bcf9055 | |||
7a8403dbb0 | |||
c50e1216a6 | |||
48c93640d2 | |||
b868e58d9b | |||
6d0e172fef | |||
268bcb8027 | |||
cf2096cfd9 | |||
72a051f957 | |||
b4ccec6742 | |||
a94d582a40 | |||
a9211e808c | |||
4bc11b72e5 | |||
6016abc1a3 | |||
8dc18b54ad | |||
39678442e1 | |||
d7982f71e9 | |||
1ff5cc8c1a | |||
7a0750016e | |||
eb7286bfd2 | |||
105192e5a2 | |||
646f8bdb48 | |||
00fc1d70a7 | |||
8c15d612a5 | |||
b66aa0b0a6 | |||
e856eb7e8b | |||
![]() |
be5482ba2f | ||
98d2055089 | |||
5b5e23cec3 | |||
![]() |
2203b041e1 | ||
8c7ddf944e | |||
6fce49ab08 | |||
31c9bd35bc | |||
dc87648970 | |||
e35f9f0408 | |||
dbe1b07e05 | |||
![]() |
12603826ea | ||
9f80429ab6 | |||
c2814f5b28 | |||
73c577d46a | |||
![]() |
ac8b641b77 | ||
ae6872e26f | |||
5d77216ef7 | |||
861cf1d131 | |||
94bc1a40b4 | |||
778b272552 | |||
adc8569deb | |||
![]() |
bea364fe2a | ||
878b09562c | |||
f4f85b9db7 | |||
ecc0945117 | |||
5fd2ea58a6 | |||
41a7225794 | |||
4d05dd880a | |||
e5767eaad1 | |||
8e0cfcfc90 | |||
f2124c5624 | |||
6a323d196f | |||
69e437ba22 | |||
79c8f5ac0d | |||
ea57345adb | |||
fd6d149347 | |||
5b7f0d36f3 | |||
cec11c86e5 | |||
34678388f3 | |||
b3098c30a6 | |||
20046defd7 | |||
2e15ee0dcf | |||
3b0148d2aa | |||
06994e954b | |||
ec22327a5f | |||
c6416ae653 | |||
b076b3853c | |||
b88e51dd55 | |||
ad5a20efce | |||
bfbfb1c47e | |||
bf7c815169 | |||
37994e0af2 | |||
26c5a1c301 | |||
192e5d65a7 | |||
71e65daf5c | |||
9c5203c98f | |||
36a9436d80 | |||
ddee0931b8 | |||
3ec6f2172d | |||
fadad17c58 | |||
bc95c7a3ea | |||
1c0aa4e396 | |||
b4998548ab | |||
ab6e23ffbb | |||
0d31ab362e | |||
24979ccb65 | |||
9daf6b12a6 | |||
9738de820a | |||
6a13b6324b | |||
7d48a342d6 | |||
bea62c5c1a | |||
62fcf34a41 | |||
![]() |
b08fa7a6d9 | ||
eb47ac4569 | |||
![]() |
7f4ce6c62b | ||
b35aa659d1 | |||
eb63b32dee | |||
bdc1108e8c | |||
41176cd3d8 | |||
62ff53ff19 | |||
b89307acfd | |||
a42fd3de5d | |||
ea6fef9385 | |||
b26e9f0000 | |||
16a8f35df1 | |||
d15bff5e96 | |||
ba1f292b32 | |||
25b7bdb6a9 | |||
5c0d8bcdc7 | |||
![]() |
1f1c2d8ce8 | ||
![]() |
a55b00b53b | ||
![]() |
48ad67ef82 | ||
728e92422e | |||
![]() |
ac2e10d47b | ||
![]() |
9b6aed845a | ||
0c94528829 | |||
3bc21bc5f7 | |||
3aa61499d0 | |||
ccacf3ae3c | |||
ccca2c0164 | |||
5ba87cf22e | |||
a59df21ad8 | |||
ece72c9ec0 | |||
dcdde6bedb | |||
2223d63c58 | |||
3733be8731 | |||
3eff6f7a5e | |||
04f8929271 | |||
15ebe30bc5 | |||
3169160a97 | |||
18d87e79e9 | |||
b372766816 | |||
3325487530 | |||
f44c9b0c93 | |||
899d100dd4 | |||
d34b0faa65 | |||
9bd0c63382 | |||
af36dd4664 | |||
![]() |
be983295ea | ||
4d39da1060 | |||
46dceefc35 | |||
![]() |
4d1c5f1ec5 | ||
![]() |
c7954df96c | ||
![]() |
ca8f787349 | ||
![]() |
a71d53cb15 | ||
dbbea2fc22 | |||
aacd15e8a9 | |||
8caedc27d9 | |||
e65d7665f1 | |||
ed7b8e847f | |||
60e2e1058d | |||
![]() |
aa6247a385 | ||
d2757d149b | |||
747843516f | |||
ce6cc756c3 | |||
2b4c7600b7 | |||
daa47e5e80 | |||
d2745986c8 | |||
3c37354c97 | |||
e35d956860 | |||
4626ca47b9 | |||
7ad0e8300d | |||
98a0bcd425 | |||
9b050b736b | |||
89e0d9848a | |||
af9fcb6a33 | |||
2928590431 | |||
d2851b78f0 | |||
fddfc416ef | |||
f827ab1d0c | |||
de30c47513 | |||
f22ef1706d | |||
3f74a5c5fd | |||
33306cabbe | |||
0bf33a1e33 | |||
d125e777b3 | |||
ed0ca7258e | |||
![]() |
c1aaa6b24b | ||
54beb7b433 | |||
f3065ed365 | |||
274bde23fb | |||
d5a8c0c414 | |||
071ec6b397 | |||
f09480b212 | |||
3f2bde5a39 | |||
b01392e9ac | |||
20880d8744 | |||
53e191e0a5 | |||
8777b33699 | |||
597122d72b | |||
d8d245917d | |||
a18a6a1441 | |||
8e02106d0d | |||
![]() |
fe258fd445 | ||
![]() |
7a8c49ef91 | ||
![]() |
ed8fca8782 | ||
![]() |
9f4b7bed29 | ||
![]() |
3e1b755ead | ||
![]() |
252d1d8e22 | ||
a009f2659f | |||
8b2297847f | |||
9536f67e7e | |||
35bfc8c748 | |||
b633d760a2 | |||
31f0c9182e | |||
![]() |
609805eed3 | ||
cf7ff47e3e | |||
31137f772b | |||
d3b814e9ec | |||
0e304ca8f5 | |||
f55f2db6bd | |||
08b105654d | |||
3766b93853 | |||
05bcb2d5f5 | |||
c3594f6469 | |||
fad585d6f4 | |||
eda770f884 | |||
66298a99e3 | |||
3df82335dd | |||
310796214f | |||
![]() |
d48600fddc | ||
20b8e1d8f1 | |||
cf2dcd57c0 | |||
![]() |
a5ba97e58c | ||
65128cde51 | |||
e878f1d00d | |||
9c7a561883 | |||
c3544df207 | |||
6f2c9ea3e1 | |||
a61480c271 | |||
532c8ac583 | |||
a3cd57ea8c | |||
e0b28306df | |||
df02675e21 | |||
ecb56eac57 | |||
c817a89e73 | |||
6b0670951f | |||
b4c01aca30 | |||
d5a42bce38 | |||
599e979d90 | |||
0954085e1e | |||
e69e62a90a | |||
cf8a059769 | |||
a1549065f2 | |||
0de33fb883 | |||
6364780b63 | |||
![]() |
73eb1bfd55 | ||
93aca278d2 | |||
c5e7dff566 | |||
922ebe960c | |||
7f3ea60aa7 | |||
7213006cef | |||
12d98d8a48 | |||
7ea7eae41f | |||
b28b6c62ed | |||
a498ffd4f6 | |||
76f49c7a7b | |||
e50aa8dc9d | |||
077dba6ac2 | |||
025b260144 | |||
d73bdecea4 | |||
c8859d8f66 | |||
77fd1a6a4b | |||
506f5654fe | |||
d8a7fd1006 | |||
e05b7c1616 | |||
e8d4930c4d | |||
02e2428fda | |||
56fd8978a5 | |||
90fdb427af | |||
1cbb195f8d | |||
29a834e530 | |||
5d280a2397 | |||
ce6418fc16 | |||
873acfb124 | |||
007d3074fa | |||
84c0446150 | |||
fbeae8ab13 | |||
43efefdbba | |||
8713dd1621 | |||
38eb004977 | |||
de0c3f563d | |||
51a4af4eb5 | |||
a0f5f3116a | |||
f00a590fd4 | |||
d3c645f72d | |||
ccea4d13b3 | |||
99e236e4d2 | |||
ffa5468bd9 | |||
8c18f79bd3 | |||
44e1c5d817 | |||
60ff71cc40 | |||
71c2768dcf | |||
312b12d172 | |||
49b0ac57c1 | |||
d380267b61 |
@@ -439,7 +439,7 @@ mark_as_advanced(WITH_MEM_VALGRIND)
|
||||
option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
|
||||
mark_as_advanced(WITH_CXX_GUARDEDALLOC)
|
||||
|
||||
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF)
|
||||
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
|
||||
mark_as_advanced(WITH_ASSERT_ABORT)
|
||||
|
||||
option(WITH_BOOST "Enable features depending on boost" ON)
|
||||
|
@@ -58,4 +58,3 @@ if(MSVC)
|
||||
DEPENDEES mkdir update patch download configure build install
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@@ -216,4 +216,3 @@ if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe")
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@@ -216,4 +216,3 @@ if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe")
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw64/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@@ -37,4 +37,3 @@ endif()
|
||||
if(MSVC)
|
||||
set_target_properties(external_zlib_mingw PROPERTIES FOLDER Mingw)
|
||||
endif()
|
||||
|
||||
|
@@ -79,4 +79,3 @@ macro( select_library_configurations basename )
|
||||
${basename}_LIBRARY_DEBUG
|
||||
)
|
||||
endmacro( select_library_configurations )
|
||||
|
||||
|
@@ -93,4 +93,3 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LLVM DEFAULT_MSG
|
||||
MARK_AS_ADVANCED(
|
||||
LLVM_LIBRARY
|
||||
)
|
||||
|
||||
|
@@ -674,7 +674,9 @@ function(SETUP_BLENDER_SORTED_LIBS)
|
||||
extern_openjpeg
|
||||
ge_videotex
|
||||
bf_dna
|
||||
|
||||
bf_blenfont
|
||||
bf_gpu # duplicate for blenfont
|
||||
bf_blentranslation
|
||||
bf_intern_audaspace
|
||||
audaspace
|
||||
|
@@ -7,7 +7,7 @@
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
@@ -22,21 +22,21 @@
|
||||
#
|
||||
# Name:
|
||||
# dna.py
|
||||
#
|
||||
#
|
||||
# Description:
|
||||
# Creates a browsable DNA output to HTML.
|
||||
#
|
||||
#
|
||||
# Author:
|
||||
# Jeroen Bakker
|
||||
#
|
||||
#
|
||||
# Version:
|
||||
# v0.1 (12-05-2009) - migration of original source code to python.
|
||||
# Added code to support blender 2.5 branch
|
||||
# v0.2 (25-05-2009) - integrated with BlendFileReader.py
|
||||
#
|
||||
#
|
||||
# Input:
|
||||
# blender build executable
|
||||
#
|
||||
#
|
||||
# Output:
|
||||
# dna.html
|
||||
# dna.css (will only be created when not existing)
|
||||
@@ -76,12 +76,12 @@ class DNACatalogHTML:
|
||||
DNACatalog is a catalog of all information in the DNA1 file-block
|
||||
'''
|
||||
|
||||
def __init__(self, catalog, bpy_module = None):
|
||||
def __init__(self, catalog, bpy_module=None):
|
||||
self.Catalog = catalog
|
||||
self.bpy = bpy_module
|
||||
|
||||
|
||||
def WriteToHTML(self, handle):
|
||||
|
||||
|
||||
dna_html_template = """
|
||||
<!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd>
|
||||
<html>
|
||||
@@ -105,10 +105,10 @@ class DNACatalogHTML:
|
||||
${structs_content}
|
||||
</body>
|
||||
</html>"""
|
||||
|
||||
|
||||
header = self.Catalog.Header
|
||||
bpy = self.bpy
|
||||
|
||||
|
||||
# ${version} and ${revision}
|
||||
if bpy:
|
||||
version = '.'.join(map(str, bpy.app.version))
|
||||
@@ -116,7 +116,7 @@ class DNACatalogHTML:
|
||||
else:
|
||||
version = str(header.Version)
|
||||
revision = 'Unknown'
|
||||
|
||||
|
||||
# ${bitness}
|
||||
if header.PointerSize == 8:
|
||||
bitness = '64 bit'
|
||||
@@ -125,10 +125,10 @@ class DNACatalogHTML:
|
||||
|
||||
# ${endianness}
|
||||
if header.LittleEndianness:
|
||||
endianess= 'Little endianness'
|
||||
endianess = 'Little endianness'
|
||||
else:
|
||||
endianess= 'Big endianness'
|
||||
|
||||
endianess = 'Big endianness'
|
||||
|
||||
# ${structs_list}
|
||||
log.debug("Creating structs index")
|
||||
structs_list = ''
|
||||
@@ -136,7 +136,7 @@ class DNACatalogHTML:
|
||||
structureIndex = 0
|
||||
for structure in self.Catalog.Structs:
|
||||
structs_list += list_item.format(structureIndex, structure.Type.Name)
|
||||
structureIndex+=1
|
||||
structureIndex += 1
|
||||
|
||||
# ${structs_content}
|
||||
log.debug("Creating structs content")
|
||||
@@ -144,20 +144,20 @@ class DNACatalogHTML:
|
||||
for structure in self.Catalog.Structs:
|
||||
log.debug(structure.Type.Name)
|
||||
structs_content += self.Structure(structure)
|
||||
|
||||
|
||||
d = dict(
|
||||
version = version,
|
||||
revision = revision,
|
||||
bitness = bitness,
|
||||
endianness = endianess,
|
||||
structs_list = structs_list,
|
||||
structs_content = structs_content
|
||||
version=version,
|
||||
revision=revision,
|
||||
bitness=bitness,
|
||||
endianness=endianess,
|
||||
structs_list=structs_list,
|
||||
structs_content=structs_content
|
||||
)
|
||||
|
||||
dna_html = Template(dna_html_template).substitute(d)
|
||||
dna_html = self.format(dna_html)
|
||||
handle.write(dna_html)
|
||||
|
||||
|
||||
def Structure(self, structure):
|
||||
struct_table_template = """
|
||||
<table><a name="${struct_name}"></a>
|
||||
@@ -178,23 +178,23 @@ class DNACatalogHTML:
|
||||
</table>
|
||||
<label>Total size: ${size} bytes</label><br/>
|
||||
<label>(<a href="#top">top</a>)</label><br/>"""
|
||||
|
||||
|
||||
d = dict(
|
||||
struct_name = structure.Type.Name,
|
||||
fields = self.StructureFields(structure, None, 0),
|
||||
size = str(structure.Type.Size)
|
||||
struct_name=structure.Type.Name,
|
||||
fields=self.StructureFields(structure, None, 0),
|
||||
size=str(structure.Type.Size)
|
||||
)
|
||||
|
||||
|
||||
struct_table = Template(struct_table_template).substitute(d)
|
||||
return struct_table
|
||||
|
||||
|
||||
def StructureFields(self, structure, parentReference, offset):
|
||||
fields = ''
|
||||
for field in structure.Fields:
|
||||
fields += self.StructureField(field, structure, parentReference, offset)
|
||||
offset += field.Size(self.Catalog.Header)
|
||||
return fields
|
||||
|
||||
|
||||
def StructureField(self, field, structure, parentReference, offset):
|
||||
structure_field_template = """
|
||||
<tr>
|
||||
@@ -205,7 +205,7 @@ class DNACatalogHTML:
|
||||
<td>${offset}</td>
|
||||
<td>${size}</td>
|
||||
</tr>"""
|
||||
|
||||
|
||||
if field.Type.Structure is None or field.Name.IsPointer():
|
||||
|
||||
# ${reference}
|
||||
@@ -216,37 +216,37 @@ class DNACatalogHTML:
|
||||
struct = '<a href="#{0}">{0}</a>'.format(structure.Type.Name)
|
||||
else:
|
||||
struct = structure.Type.Name
|
||||
|
||||
|
||||
# ${type}
|
||||
type = field.Type.Name
|
||||
|
||||
|
||||
# ${name}
|
||||
name = field.Name.Name
|
||||
|
||||
|
||||
# ${offset}
|
||||
# offset already set
|
||||
|
||||
|
||||
# ${size}
|
||||
size = field.Size(self.Catalog.Header)
|
||||
|
||||
|
||||
d = dict(
|
||||
reference = reference,
|
||||
struct = struct,
|
||||
type = type,
|
||||
name = name,
|
||||
offset = offset,
|
||||
size = size
|
||||
reference=reference,
|
||||
struct=struct,
|
||||
type=type,
|
||||
name=name,
|
||||
offset=offset,
|
||||
size=size
|
||||
)
|
||||
|
||||
|
||||
structure_field = Template(structure_field_template).substitute(d)
|
||||
|
||||
|
||||
elif field.Type.Structure is not None:
|
||||
reference = field.Name.AsReference(parentReference)
|
||||
structure_field = self.StructureFields(field.Type.Structure, reference, offset)
|
||||
structure_field = self.StructureFields(field.Type.Structure, reference, offset)
|
||||
|
||||
return structure_field
|
||||
|
||||
def indent(self, input, dent, startswith = ''):
|
||||
def indent(self, input, dent, startswith=''):
|
||||
output = ''
|
||||
if dent < 0:
|
||||
for line in input.split('\n'):
|
||||
@@ -257,19 +257,19 @@ class DNACatalogHTML:
|
||||
output += line.lstrip() + '\n' # remove indentation completely
|
||||
elif dent > 0:
|
||||
for line in input.split('\n'):
|
||||
output += ' '* dent + line + '\n'
|
||||
output += ' ' * dent + line + '\n'
|
||||
return output
|
||||
|
||||
|
||||
def format(self, input):
|
||||
diff = {
|
||||
'\n<!DOCTYPE':'<!DOCTYPE',
|
||||
'\n</ul>' :'</ul>',
|
||||
'<a name' :'\n<a name',
|
||||
'<tr>\n' :'<tr>',
|
||||
'<tr>' :' <tr>',
|
||||
'</th>\n' :'</th>',
|
||||
'</td>\n' :'</td>',
|
||||
'<tbody>\n' :'<tbody>'
|
||||
'\n<!DOCTYPE': '<!DOCTYPE',
|
||||
'\n</ul>': '</ul>',
|
||||
'<a name': '\n<a name',
|
||||
'<tr>\n': '<tr>',
|
||||
'<tr>': ' <tr>',
|
||||
'</th>\n': '</th>',
|
||||
'</td>\n': '</td>',
|
||||
'<tbody>\n': '<tbody>'
|
||||
}
|
||||
output = self.indent(input, 0)
|
||||
for key, value in diff.items():
|
||||
@@ -283,17 +283,17 @@ class DNACatalogHTML:
|
||||
'''
|
||||
css = """
|
||||
@CHARSET "ISO-8859-1";
|
||||
|
||||
|
||||
body {
|
||||
font-family: verdana;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
|
||||
div.title {
|
||||
font-size: large;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
h1 {
|
||||
page-break-before: always;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ class DNACatalogHTML:
|
||||
margin-right: 3%;
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
|
||||
h1:hover{
|
||||
background-color: #EBEBEB;
|
||||
}
|
||||
@@ -312,7 +312,7 @@ class DNACatalogHTML:
|
||||
h3 {
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
|
||||
table {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
@@ -321,21 +321,21 @@ class DNACatalogHTML:
|
||||
width: 94%;
|
||||
margin: 20px 3% 10px;
|
||||
}
|
||||
|
||||
|
||||
caption {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
|
||||
th {
|
||||
background-color: #000000;
|
||||
color:#ffffff;
|
||||
padding-left:5px;
|
||||
padding-right:5px;
|
||||
}
|
||||
|
||||
|
||||
tr {
|
||||
}
|
||||
|
||||
|
||||
td {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
@@ -343,12 +343,12 @@ class DNACatalogHTML:
|
||||
padding-left:5px;
|
||||
padding-right:5px;
|
||||
}
|
||||
|
||||
|
||||
label {
|
||||
float:right;
|
||||
margin-right: 3%;
|
||||
}
|
||||
|
||||
|
||||
ul.multicolumn {
|
||||
list-style:none;
|
||||
float:left;
|
||||
@@ -361,18 +361,18 @@ class DNACatalogHTML:
|
||||
width:200px;
|
||||
margin-right:0px;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
color:#a000a0;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
|
||||
a:hover {
|
||||
color:#a000a0;
|
||||
text-decoration:underline;
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
css = self.indent(css, 0)
|
||||
|
||||
handle.write(css)
|
||||
@@ -389,13 +389,13 @@ def usage():
|
||||
print("\tdefault: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py")
|
||||
print("\twith options: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug\n")
|
||||
|
||||
|
||||
|
||||
######################################################
|
||||
# Main
|
||||
######################################################
|
||||
|
||||
def main():
|
||||
|
||||
|
||||
import os, os.path
|
||||
|
||||
try:
|
||||
@@ -408,37 +408,37 @@ def main():
|
||||
else:
|
||||
filename = 'dna'
|
||||
dir = os.path.dirname(__file__)
|
||||
Path_Blend = os.path.join(dir, filename + '.blend') # temporary blend file
|
||||
Path_HTML = os.path.join(dir, filename + '.html') # output html file
|
||||
Path_CSS = os.path.join(dir, 'dna.css') # output css file
|
||||
Path_Blend = os.path.join(dir, filename + '.blend') # temporary blend file
|
||||
Path_HTML = os.path.join(dir, filename + '.html') # output html file
|
||||
Path_CSS = os.path.join(dir, 'dna.css') # output css file
|
||||
|
||||
# create a blend file for dna parsing
|
||||
if not os.path.exists(Path_Blend):
|
||||
log.info("1: write temp blend file with SDNA info")
|
||||
log.info(" saving to: " + Path_Blend)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath = Path_Blend, copy = True, compress = False)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=Path_Blend, copy=True, compress=False)
|
||||
except:
|
||||
log.error("Filename {0} does not exist and can't be created... quitting".format(Path_Blend))
|
||||
return
|
||||
else:
|
||||
log.info("1: found blend file with SDNA info")
|
||||
log.info(" " + Path_Blend)
|
||||
|
||||
|
||||
# read blend header from blend file
|
||||
log.info("2: read file:")
|
||||
|
||||
|
||||
if not dir in sys.path:
|
||||
sys.path.append(dir)
|
||||
import BlendFileReader
|
||||
|
||||
|
||||
handle = BlendFileReader.openBlendFile(Path_Blend)
|
||||
blendfile = BlendFileReader.BlendFile(handle)
|
||||
catalog = DNACatalogHTML(blendfile.Catalog, bpy)
|
||||
|
||||
# close temp file
|
||||
handle.close()
|
||||
|
||||
|
||||
# deleting or not?
|
||||
if '--dna-keep-blend' in sys.argv:
|
||||
# keep the blend, useful for studying hexdumps
|
||||
@@ -449,7 +449,7 @@ def main():
|
||||
log.info("5: close and delete temp blend:")
|
||||
log.info(" {0}".format(Path_Blend))
|
||||
os.remove(Path_Blend)
|
||||
|
||||
|
||||
# export dna to xhtml
|
||||
log.info("6: export sdna to xhtml file: %r" % Path_HTML)
|
||||
handleHTML = open(Path_HTML, "w")
|
||||
@@ -466,12 +466,12 @@ def main():
|
||||
if not bpy.app.background:
|
||||
log.info("7: quit blender")
|
||||
bpy.ops.wm.exit_blender()
|
||||
|
||||
|
||||
except ImportError:
|
||||
log.warning(" skipping, not running in Blender")
|
||||
usage()
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@@ -7,7 +7,7 @@
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
@@ -34,6 +34,7 @@ log = logging.getLogger("BlendFileReader")
|
||||
# module global routines
|
||||
######################################################
|
||||
|
||||
|
||||
def ReadString(handle, length):
|
||||
'''
|
||||
ReadString reads a String of given length or a zero terminating String
|
||||
@@ -45,7 +46,7 @@ def ReadString(handle, length):
|
||||
# length == 0 means we want a zero terminating string
|
||||
result = ""
|
||||
s = ReadString(handle, 1)
|
||||
while s!="\0":
|
||||
while s != "\0":
|
||||
result += s
|
||||
s = ReadString(handle, 1)
|
||||
return result
|
||||
@@ -57,7 +58,7 @@ def Read(type, handle, fileheader):
|
||||
'''
|
||||
def unpacked_bytes(type_char, size):
|
||||
return struct.unpack(fileheader.StructPre + type_char, handle.read(size))[0]
|
||||
|
||||
|
||||
if type == 'ushort':
|
||||
return unpacked_bytes("H", 2) # unsigned short
|
||||
elif type == 'short':
|
||||
@@ -94,10 +95,10 @@ def openBlendFile(filename):
|
||||
log.debug("decompressing started")
|
||||
fs = gzip.open(filename, "rb")
|
||||
handle = tempfile.TemporaryFile()
|
||||
data = fs.read(1024*1024)
|
||||
while data:
|
||||
handle.write(data)
|
||||
data = fs.read(1024*1024)
|
||||
data = fs.read(1024 * 1024)
|
||||
while data:
|
||||
handle.write(data)
|
||||
data = fs.read(1024 * 1024)
|
||||
log.debug("decompressing finished")
|
||||
fs.close()
|
||||
log.debug("resetting decompressed file")
|
||||
@@ -112,7 +113,7 @@ def Align(handle):
|
||||
offset = handle.tell()
|
||||
trim = offset % 4
|
||||
if trim != 0:
|
||||
handle.seek(4-trim, os.SEEK_CUR)
|
||||
handle.seek(4 - trim, os.SEEK_CUR)
|
||||
|
||||
|
||||
######################################################
|
||||
@@ -121,14 +122,14 @@ def Align(handle):
|
||||
|
||||
class BlendFile:
|
||||
'''
|
||||
Reads a blendfile and store the header, all the fileblocks, and catalogue
|
||||
Reads a blendfile and store the header, all the fileblocks, and catalogue
|
||||
structs foound in the DNA fileblock
|
||||
|
||||
|
||||
- BlendFile.Header (BlendFileHeader instance)
|
||||
- BlendFile.Blocks (list of BlendFileBlock instances)
|
||||
- BlendFile.Catalog (DNACatalog instance)
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, handle):
|
||||
log.debug("initializing reading blend-file")
|
||||
self.Header = BlendFileHeader(handle)
|
||||
@@ -141,13 +142,13 @@ class BlendFile:
|
||||
found_dna_block = True
|
||||
else:
|
||||
fileblock.Header.skip(handle)
|
||||
|
||||
|
||||
self.Blocks.append(fileblock)
|
||||
fileblock = BlendFileBlock(handle, self)
|
||||
|
||||
|
||||
# appending last fileblock, "ENDB"
|
||||
self.Blocks.append(fileblock)
|
||||
|
||||
|
||||
# seems unused?
|
||||
"""
|
||||
def FindBlendFileBlocksWithCode(self, code):
|
||||
@@ -164,27 +165,27 @@ class BlendFileHeader:
|
||||
BlendFileHeader allocates the first 12 bytes of a blend file.
|
||||
It contains information about the hardware architecture.
|
||||
Header example: BLENDER_v254
|
||||
|
||||
|
||||
BlendFileHeader.Magic (str)
|
||||
BlendFileHeader.PointerSize (int)
|
||||
BlendFileHeader.LittleEndianness (bool)
|
||||
BlendFileHeader.StructPre (str) see http://docs.python.org/py3k/library/struct.html#byte-order-size-and-alignment
|
||||
BlendFileHeader.Version (int)
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, handle):
|
||||
log.debug("reading blend-file-header")
|
||||
|
||||
|
||||
self.Magic = ReadString(handle, 7)
|
||||
log.debug(self.Magic)
|
||||
|
||||
|
||||
pointersize = ReadString(handle, 1)
|
||||
log.debug(pointersize)
|
||||
if pointersize == "-":
|
||||
self.PointerSize = 8
|
||||
if pointersize == "_":
|
||||
self.PointerSize = 4
|
||||
|
||||
|
||||
endianness = ReadString(handle, 1)
|
||||
log.debug(endianness)
|
||||
if endianness == "v":
|
||||
@@ -193,11 +194,11 @@ class BlendFileHeader:
|
||||
if endianness == "V":
|
||||
self.LittleEndianness = False
|
||||
self.StructPre = ">"
|
||||
|
||||
|
||||
version = ReadString(handle, 3)
|
||||
log.debug(version)
|
||||
self.Version = int(version)
|
||||
|
||||
|
||||
log.debug("{0} {1} {2} {3}".format(self.Magic, self.PointerSize, self.LittleEndianness, version))
|
||||
|
||||
|
||||
@@ -206,11 +207,11 @@ class BlendFileBlock:
|
||||
BlendFileBlock.File (BlendFile)
|
||||
BlendFileBlock.Header (FileBlockHeader)
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, handle, blendfile):
|
||||
self.File = blendfile
|
||||
self.Header = FileBlockHeader(handle, blendfile.Header)
|
||||
|
||||
|
||||
def Get(self, handle, path):
|
||||
log.debug("find dna structure")
|
||||
dnaIndex = self.Header.SDNAIndex
|
||||
@@ -232,7 +233,7 @@ class FileBlockHeader:
|
||||
Count (int)
|
||||
FileOffset (= file pointer of datablock)
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, handle, fileheader):
|
||||
self.Code = ReadString(handle, 4).strip()
|
||||
if self.Code != "ENDB":
|
||||
@@ -257,28 +258,28 @@ class FileBlockHeader:
|
||||
class DNACatalog:
|
||||
'''
|
||||
DNACatalog is a catalog of all information in the DNA1 file-block
|
||||
|
||||
|
||||
Header = None
|
||||
Names = None
|
||||
Types = None
|
||||
Structs = None
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, fileheader, handle):
|
||||
log.debug("building DNA catalog")
|
||||
self.Names=[]
|
||||
self.Types=[]
|
||||
self.Structs=[]
|
||||
self.Names = []
|
||||
self.Types = []
|
||||
self.Structs = []
|
||||
self.Header = fileheader
|
||||
|
||||
|
||||
SDNA = ReadString(handle, 4)
|
||||
|
||||
|
||||
# names
|
||||
NAME = ReadString(handle, 4)
|
||||
numberOfNames = Read('uint', handle, fileheader)
|
||||
log.debug("building #{0} names".format(numberOfNames))
|
||||
for i in range(numberOfNames):
|
||||
name = ReadString(handle,0)
|
||||
name = ReadString(handle, 0)
|
||||
self.Names.append(DNAName(name))
|
||||
Align(handle)
|
||||
|
||||
@@ -287,7 +288,7 @@ class DNACatalog:
|
||||
numberOfTypes = Read('uint', handle, fileheader)
|
||||
log.debug("building #{0} types".format(numberOfTypes))
|
||||
for i in range(numberOfTypes):
|
||||
type = ReadString(handle,0)
|
||||
type = ReadString(handle, 0)
|
||||
self.Types.append(DNAType(type))
|
||||
Align(handle)
|
||||
|
||||
@@ -321,24 +322,24 @@ class DNACatalog:
|
||||
class DNAName:
|
||||
'''
|
||||
DNAName is a C-type name stored in the DNA.
|
||||
|
||||
|
||||
Name = str
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, name):
|
||||
self.Name = name
|
||||
|
||||
|
||||
def AsReference(self, parent):
|
||||
if parent is None:
|
||||
result = ""
|
||||
else:
|
||||
result = parent+"."
|
||||
|
||||
result = parent + "."
|
||||
|
||||
result = result + self.ShortName()
|
||||
return result
|
||||
|
||||
def ShortName(self):
|
||||
result = self.Name;
|
||||
result = self.Name
|
||||
result = result.replace("*", "")
|
||||
result = result.replace("(", "")
|
||||
result = result.replace(")", "")
|
||||
@@ -346,12 +347,12 @@ class DNAName:
|
||||
if Index != -1:
|
||||
result = result[0:Index]
|
||||
return result
|
||||
|
||||
|
||||
def IsPointer(self):
|
||||
return self.Name.find("*")>-1
|
||||
return self.Name.find("*") > -1
|
||||
|
||||
def IsMethodPointer(self):
|
||||
return self.Name.find("(*")>-1
|
||||
return self.Name.find("(*") > -1
|
||||
|
||||
def ArraySize(self):
|
||||
result = 1
|
||||
@@ -360,10 +361,10 @@ class DNAName:
|
||||
|
||||
while Index != -1:
|
||||
Index2 = Temp.find("]")
|
||||
result*=int(Temp[Index+1:Index2])
|
||||
Temp = Temp[Index2+1:]
|
||||
result *= int(Temp[Index + 1:Index2])
|
||||
Temp = Temp[Index2 + 1:]
|
||||
Index = Temp.find("[")
|
||||
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@@ -375,46 +376,46 @@ class DNAType:
|
||||
Size = int
|
||||
Structure = DNAStructure
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, aName):
|
||||
self.Name = aName
|
||||
self.Structure=None
|
||||
self.Structure = None
|
||||
|
||||
|
||||
class DNAStructure:
|
||||
'''
|
||||
DNAType is a C-type structure stored in the DNA
|
||||
|
||||
|
||||
Type = DNAType
|
||||
Fields = [DNAField]
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self, aType):
|
||||
self.Type = aType
|
||||
self.Type.Structure = self
|
||||
self.Fields=[]
|
||||
|
||||
self.Fields = []
|
||||
|
||||
def GetField(self, header, handle, path):
|
||||
splitted = path.partition(".")
|
||||
name = splitted[0]
|
||||
rest = splitted[2]
|
||||
offset = 0;
|
||||
offset = 0
|
||||
for field in self.Fields:
|
||||
if field.Name.ShortName() == name:
|
||||
log.debug("found "+name+"@"+str(offset))
|
||||
log.debug("found " + name + "@" + str(offset))
|
||||
handle.seek(offset, os.SEEK_CUR)
|
||||
return field.DecodeField(header, handle, rest)
|
||||
else:
|
||||
offset += field.Size(header)
|
||||
|
||||
log.debug("error did not find "+path)
|
||||
log.debug("error did not find " + path)
|
||||
return None
|
||||
|
||||
|
||||
class DNAField:
|
||||
'''
|
||||
DNAField is a coupled DNAType and DNAName.
|
||||
|
||||
|
||||
Type = DNAType
|
||||
Name = DNAName
|
||||
'''
|
||||
@@ -422,25 +423,24 @@ class DNAField:
|
||||
def __init__(self, aType, aName):
|
||||
self.Type = aType
|
||||
self.Name = aName
|
||||
|
||||
|
||||
def Size(self, header):
|
||||
if self.Name.IsPointer() or self.Name.IsMethodPointer():
|
||||
return header.PointerSize*self.Name.ArraySize()
|
||||
return header.PointerSize * self.Name.ArraySize()
|
||||
else:
|
||||
return self.Type.Size*self.Name.ArraySize()
|
||||
return self.Type.Size * self.Name.ArraySize()
|
||||
|
||||
def DecodeField(self, header, handle, path):
|
||||
if path == "":
|
||||
if self.Name.IsPointer():
|
||||
return Read('pointer', handle, header)
|
||||
if self.Type.Name=="int":
|
||||
if self.Type.Name == "int":
|
||||
return Read('int', handle, header)
|
||||
if self.Type.Name=="short":
|
||||
if self.Type.Name == "short":
|
||||
return Read('short', handle, header)
|
||||
if self.Type.Name=="float":
|
||||
if self.Type.Name == "float":
|
||||
return Read('float', handle, header)
|
||||
if self.Type.Name=="char":
|
||||
if self.Type.Name == "char":
|
||||
return ReadString(handle, self.Name.ArraySize())
|
||||
else:
|
||||
return self.Type.Structure.GetField(header, handle, path)
|
||||
|
||||
|
@@ -42,6 +42,7 @@ def man_format(data):
|
||||
data = data.replace("\t", " ")
|
||||
return data
|
||||
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
import getopt
|
||||
raise getopt.GetoptError("Usage: %s <path-to-blender> <output-filename>" % sys.argv[0])
|
||||
|
@@ -15,6 +15,7 @@ font_info = {
|
||||
"handler": None,
|
||||
}
|
||||
|
||||
|
||||
def init():
|
||||
"""init function - runs once"""
|
||||
import os
|
||||
|
@@ -10,22 +10,22 @@ bm = bmesh.new()
|
||||
|
||||
# Add a circle XXX, should return all geometry created, not just verts.
|
||||
bmesh.ops.create_circle(
|
||||
bm,
|
||||
cap_ends=False,
|
||||
radius=0.2,
|
||||
segments=8)
|
||||
bm,
|
||||
cap_ends=False,
|
||||
radius=0.2,
|
||||
segments=8)
|
||||
|
||||
|
||||
# Spin and deal with geometry on side 'a'
|
||||
edges_start_a = bm.edges[:]
|
||||
geom_start_a = bm.verts[:] + edges_start_a
|
||||
ret = bmesh.ops.spin(
|
||||
bm,
|
||||
geom=geom_start_a,
|
||||
angle=math.radians(180.0),
|
||||
steps=8,
|
||||
axis=(1.0, 0.0, 0.0),
|
||||
cent=(0.0, 1.0, 0.0))
|
||||
bm,
|
||||
geom=geom_start_a,
|
||||
angle=math.radians(180.0),
|
||||
steps=8,
|
||||
axis=(1.0, 0.0, 0.0),
|
||||
cent=(0.0, 1.0, 0.0))
|
||||
edges_end_a = [ele for ele in ret["geom_last"]
|
||||
if isinstance(ele, bmesh.types.BMEdge)]
|
||||
del ret
|
||||
@@ -33,8 +33,8 @@ del ret
|
||||
|
||||
# Extrude and create geometry on side 'b'
|
||||
ret = bmesh.ops.extrude_edge_only(
|
||||
bm,
|
||||
edges=edges_start_a)
|
||||
bm,
|
||||
edges=edges_start_a)
|
||||
geom_extrude_mid = ret["geom"]
|
||||
del ret
|
||||
|
||||
@@ -45,19 +45,19 @@ verts_extrude_b = [ele for ele in geom_extrude_mid
|
||||
edges_extrude_b = [ele for ele in geom_extrude_mid
|
||||
if isinstance(ele, bmesh.types.BMEdge) and ele.is_boundary]
|
||||
bmesh.ops.translate(
|
||||
bm,
|
||||
verts=verts_extrude_b,
|
||||
vec=(0.0, 0.0, 1.0))
|
||||
bm,
|
||||
verts=verts_extrude_b,
|
||||
vec=(0.0, 0.0, 1.0))
|
||||
|
||||
|
||||
# Create the circle on side 'b'
|
||||
ret = bmesh.ops.spin(
|
||||
bm,
|
||||
geom=verts_extrude_b + edges_extrude_b,
|
||||
angle=-math.radians(180.0),
|
||||
steps=8,
|
||||
axis=(1.0, 0.0, 0.0),
|
||||
cent=(0.0, 1.0, 1.0))
|
||||
bm,
|
||||
geom=verts_extrude_b + edges_extrude_b,
|
||||
angle=-math.radians(180.0),
|
||||
steps=8,
|
||||
axis=(1.0, 0.0, 0.0),
|
||||
cent=(0.0, 1.0, 1.0))
|
||||
edges_end_b = [ele for ele in ret["geom_last"]
|
||||
if isinstance(ele, bmesh.types.BMEdge)]
|
||||
del ret
|
||||
@@ -65,30 +65,30 @@ del ret
|
||||
|
||||
# Bridge the resulting edge loops of both spins 'a & b'
|
||||
bmesh.ops.bridge_loops(
|
||||
bm,
|
||||
edges=edges_end_a + edges_end_b)
|
||||
bm,
|
||||
edges=edges_end_a + edges_end_b)
|
||||
|
||||
|
||||
# Now we have made a links of the chain, make a copy and rotate it
|
||||
# (so this looks something like a chain)
|
||||
|
||||
ret = bmesh.ops.duplicate(
|
||||
bm,
|
||||
geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
|
||||
bm,
|
||||
geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
|
||||
geom_dupe = ret["geom"]
|
||||
verts_dupe = [ele for ele in geom_dupe if isinstance(ele, bmesh.types.BMVert)]
|
||||
del ret
|
||||
|
||||
# position the new link
|
||||
bmesh.ops.translate(
|
||||
bm,
|
||||
verts=verts_dupe,
|
||||
vec=(0.0, 0.0, 2.0))
|
||||
bm,
|
||||
verts=verts_dupe,
|
||||
vec=(0.0, 0.0, 2.0))
|
||||
bmesh.ops.rotate(
|
||||
bm,
|
||||
verts=verts_dupe,
|
||||
cent=(0.0, 1.0, 0.0),
|
||||
matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))
|
||||
bm,
|
||||
verts=verts_dupe,
|
||||
cent=(0.0, 1.0, 0.0),
|
||||
matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))
|
||||
|
||||
# Done with creating the mesh, simply link it into the scene so we can see it
|
||||
|
||||
|
@@ -17,4 +17,5 @@ from bpy.app.handlers import persistent
|
||||
def load_handler(dummy):
|
||||
print("Load Handler:", bpy.data.filepath)
|
||||
|
||||
|
||||
bpy.app.handlers.load_post.append(load_handler)
|
||||
|
@@ -11,4 +11,5 @@ import bpy
|
||||
def my_handler(scene):
|
||||
print("Frame Change", scene.frame_current)
|
||||
|
||||
|
||||
bpy.app.handlers.frame_change_pre.append(my_handler)
|
||||
|
@@ -54,19 +54,19 @@ translations_tuple = (
|
||||
"Copyright (C) 2013 The Blender Foundation.",
|
||||
"This file is distributed under the same license as the Blender package.",
|
||||
"FIRST AUTHOR <EMAIL@ADDRESS>, YEAR."))),
|
||||
),
|
||||
),
|
||||
(("Operator", "Render: Copy Settings"),
|
||||
(("bpy.types.SCENE_OT_render_copy_settings",),
|
||||
()),
|
||||
("fr_FR", "Rendu : copier réglages",
|
||||
(False, ())),
|
||||
),
|
||||
),
|
||||
(("*", "Copy render settings from current scene to others"),
|
||||
(("bpy.types.SCENE_OT_render_copy_settings",),
|
||||
()),
|
||||
("fr_FR", "Copier les réglages de rendu depuis la scène courante vers d’autres",
|
||||
(False, ())),
|
||||
),
|
||||
),
|
||||
# ... etc, all messages from your addon.
|
||||
)
|
||||
|
||||
@@ -81,6 +81,7 @@ for msg in translations_tuple:
|
||||
|
||||
# Define remaining addon (operators, UI...) here.
|
||||
|
||||
|
||||
def register():
|
||||
# Usual operator/UI/etc. registration...
|
||||
|
||||
|
@@ -14,6 +14,7 @@ class MaterialSettings(bpy.types.PropertyGroup):
|
||||
my_float = bpy.props.FloatProperty()
|
||||
my_string = bpy.props.StringProperty()
|
||||
|
||||
|
||||
bpy.utils.register_class(MaterialSettings)
|
||||
|
||||
bpy.types.Material.my_settings = \
|
||||
|
@@ -14,6 +14,7 @@ class SceneSettingItem(bpy.types.PropertyGroup):
|
||||
name = bpy.props.StringProperty(name="Test Prop", default="Unknown")
|
||||
value = bpy.props.IntProperty(name="Test Prop", default=22)
|
||||
|
||||
|
||||
bpy.utils.register_class(SceneSettingItem)
|
||||
|
||||
bpy.types.Scene.my_settings = \
|
||||
|
@@ -14,6 +14,7 @@ import bpy
|
||||
def update_func(self, context):
|
||||
print("my test function", self)
|
||||
|
||||
|
||||
bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func)
|
||||
|
||||
bpy.context.scene.testprop = 11.0
|
||||
|
@@ -19,6 +19,7 @@ def get_float(self):
|
||||
def set_float(self, value):
|
||||
self["testprop"] = value
|
||||
|
||||
|
||||
bpy.types.Scene.test_float = bpy.props.FloatProperty(get=get_float, set=set_float)
|
||||
|
||||
|
||||
@@ -27,6 +28,7 @@ def get_date(self):
|
||||
import datetime
|
||||
return str(datetime.datetime.now())
|
||||
|
||||
|
||||
bpy.types.Scene.test_date = bpy.props.StringProperty(get=get_date)
|
||||
|
||||
|
||||
@@ -40,6 +42,7 @@ def get_array(self):
|
||||
def set_array(self, values):
|
||||
self["somebool"] = values[0] and values[1]
|
||||
|
||||
|
||||
bpy.types.Scene.test_array = bpy.props.BoolVectorProperty(size=2, get=get_array, set=set_array)
|
||||
|
||||
|
||||
@@ -50,7 +53,7 @@ test_items = [
|
||||
("GREEN", "Green", "", 2),
|
||||
("BLUE", "Blue", "", 3),
|
||||
("YELLOW", "Yellow", "", 4),
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
def get_enum(self):
|
||||
@@ -61,6 +64,7 @@ def get_enum(self):
|
||||
def set_enum(self, value):
|
||||
print("setting value", value)
|
||||
|
||||
|
||||
bpy.types.Scene.test_enum = bpy.props.EnumProperty(items=test_items, get=get_enum, set=set_enum)
|
||||
|
||||
|
||||
|
@@ -9,7 +9,7 @@ bl_info = {
|
||||
"wiki_url": "",
|
||||
"tracker_url": "",
|
||||
"category": "Object",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
import bpy
|
||||
@@ -23,17 +23,17 @@ class ExampleAddonPreferences(AddonPreferences):
|
||||
bl_idname = __name__
|
||||
|
||||
filepath = StringProperty(
|
||||
name="Example File Path",
|
||||
subtype='FILE_PATH',
|
||||
)
|
||||
name="Example File Path",
|
||||
subtype='FILE_PATH',
|
||||
)
|
||||
number = IntProperty(
|
||||
name="Example Number",
|
||||
default=4,
|
||||
)
|
||||
name="Example Number",
|
||||
default=4,
|
||||
)
|
||||
boolean = BoolProperty(
|
||||
name="Example Boolean",
|
||||
default=False,
|
||||
)
|
||||
name="Example Boolean",
|
||||
default=False,
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@@ -14,4 +14,5 @@ import bpy
|
||||
def menu_draw(self, context):
|
||||
self.layout.operator("wm.save_homefile")
|
||||
|
||||
|
||||
bpy.types.INFO_MT_file.append(menu_draw)
|
||||
|
@@ -32,7 +32,7 @@ class AddPresetObjectDraw(AddPresetBase, Operator):
|
||||
# variable used for all preset values
|
||||
preset_defines = [
|
||||
"obj = bpy.context.object"
|
||||
]
|
||||
]
|
||||
|
||||
# properties to store in the preset
|
||||
preset_values = [
|
||||
@@ -42,7 +42,7 @@ class AddPresetObjectDraw(AddPresetBase, Operator):
|
||||
"obj.show_name",
|
||||
"obj.show_axis",
|
||||
"obj.show_wire",
|
||||
]
|
||||
]
|
||||
|
||||
# where to store the preset
|
||||
preset_subdir = "object/draw"
|
||||
@@ -61,7 +61,7 @@ def panel_func(self, context):
|
||||
classes = (
|
||||
OBJECT_MT_draw_presets,
|
||||
AddPresetObjectDraw,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def register():
|
||||
|
@@ -60,6 +60,7 @@ def menu_func(self, context):
|
||||
layout.separator()
|
||||
layout.operator(WM_OT_button_context_test.bl_idname)
|
||||
|
||||
|
||||
classes = (
|
||||
WM_OT_button_context_test,
|
||||
WM_MT_button_context,
|
||||
@@ -77,5 +78,6 @@ def unregister():
|
||||
bpy.utils.unregister_class(cls)
|
||||
bpy.types.WM_MT_button_context.remove(menu_func)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
@@ -21,4 +21,5 @@ class CyclesNodeTree(bpy.types.NodeTree):
|
||||
def poll(cls, context):
|
||||
return context.scene.render.engine == 'CYCLES'
|
||||
|
||||
|
||||
bpy.utils.register_class(CyclesNodeTree)
|
||||
|
@@ -42,6 +42,7 @@ class SimpleMouseOperator(bpy.types.Operator):
|
||||
self.y = event.mouse_y
|
||||
return self.execute(context)
|
||||
|
||||
|
||||
bpy.utils.register_class(SimpleMouseOperator)
|
||||
|
||||
# Test call to the newly defined operator.
|
||||
|
@@ -42,6 +42,7 @@ def menu_func(self, context):
|
||||
self.layout.operator_context = 'INVOKE_DEFAULT'
|
||||
self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
|
||||
|
||||
|
||||
# Register and add to the file selector
|
||||
bpy.utils.register_class(ExportSomeData)
|
||||
bpy.types.INFO_MT_file_export.append(menu_func)
|
||||
|
@@ -41,6 +41,7 @@ class CustomDrawOperator(bpy.types.Operator):
|
||||
|
||||
col.prop(self, "my_string")
|
||||
|
||||
|
||||
bpy.utils.register_class(CustomDrawOperator)
|
||||
|
||||
# test call
|
||||
|
@@ -22,6 +22,7 @@ class HelloWorldOperator(bpy.types.Operator):
|
||||
print("Hello World")
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
bpy.utils.register_class(HelloWorldOperator)
|
||||
|
||||
# test call to the newly defined operator
|
||||
|
@@ -31,6 +31,7 @@ class MyPropertyGroup(bpy.types.PropertyGroup):
|
||||
custom_1 = bpy.props.FloatProperty(name="My Float")
|
||||
custom_2 = bpy.props.IntProperty(name="My Int")
|
||||
|
||||
|
||||
bpy.utils.register_class(MyPropertyGroup)
|
||||
|
||||
bpy.types.Object.my_prop_grp = bpy.props.PointerProperty(type=MyPropertyGroup)
|
||||
|
@@ -10,4 +10,5 @@ import bpy
|
||||
def draw(self, context):
|
||||
self.layout.label("Hello World")
|
||||
|
||||
|
||||
bpy.context.window_manager.popup_menu(draw, title="Greeting", icon='INFO')
|
||||
|
@@ -12,6 +12,7 @@ from bpy.props import PointerProperty
|
||||
class MyPropGroup(bpy.types.PropertyGroup):
|
||||
nested = bpy.props.FloatProperty(name="Nested", default=0.0)
|
||||
|
||||
|
||||
# register it so its available for all bones
|
||||
bpy.utils.register_class(MyPropGroup)
|
||||
bpy.types.Bone.my_prop = PointerProperty(type=MyPropGroup,
|
||||
|
@@ -23,9 +23,9 @@ class OffScreenDraw(bpy.types.Operator):
|
||||
@staticmethod
|
||||
def handle_add(self, context):
|
||||
OffScreenDraw._handle_draw = bpy.types.SpaceView3D.draw_handler_add(
|
||||
self.draw_callback_px, (self, context),
|
||||
'WINDOW', 'POST_PIXEL',
|
||||
)
|
||||
self.draw_callback_px, (self, context),
|
||||
'WINDOW', 'POST_PIXEL',
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def handle_remove():
|
||||
@@ -58,20 +58,20 @@ class OffScreenDraw(bpy.types.Operator):
|
||||
|
||||
modelview_matrix = camera.matrix_world.inverted()
|
||||
projection_matrix = camera.calc_matrix_camera(
|
||||
render.resolution_x,
|
||||
render.resolution_y,
|
||||
render.pixel_aspect_x,
|
||||
render.pixel_aspect_y,
|
||||
)
|
||||
render.resolution_x,
|
||||
render.resolution_y,
|
||||
render.pixel_aspect_x,
|
||||
render.pixel_aspect_y,
|
||||
)
|
||||
|
||||
offscreen.draw_view3d(
|
||||
scene,
|
||||
render_layer,
|
||||
context.space_data,
|
||||
context.region,
|
||||
projection_matrix,
|
||||
modelview_matrix,
|
||||
)
|
||||
scene,
|
||||
render_layer,
|
||||
context.space_data,
|
||||
context.region,
|
||||
projection_matrix,
|
||||
modelview_matrix,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _opengl_draw(context, texture, aspect_ratio, scale):
|
||||
|
@@ -73,6 +73,8 @@ def rna_info_BuildRNAInfo_cache():
|
||||
if rna_info_BuildRNAInfo_cache.ret is None:
|
||||
rna_info_BuildRNAInfo_cache.ret = rna_info.BuildRNAInfo()
|
||||
return rna_info_BuildRNAInfo_cache.ret
|
||||
|
||||
|
||||
rna_info_BuildRNAInfo_cache.ret = None
|
||||
# --- end rna_info cache
|
||||
|
||||
@@ -434,7 +436,7 @@ else:
|
||||
BLENDER_VERSION_DOTS = ".".join(blender_version_strings)
|
||||
if BLENDER_REVISION != "Unknown":
|
||||
# '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release)
|
||||
BLENDER_VERSION_DOTS += " " + BLENDER_REVISION
|
||||
BLENDER_VERSION_DOTS += " " + BLENDER_REVISION
|
||||
|
||||
if is_release:
|
||||
# '2_62a_release'
|
||||
@@ -516,6 +518,8 @@ def escape_rst(text):
|
||||
""" Escape plain text which may contain characters used by RST.
|
||||
"""
|
||||
return text.translate(escape_rst.trans)
|
||||
|
||||
|
||||
escape_rst.trans = str.maketrans({
|
||||
"`": "\\`",
|
||||
"|": "\\|",
|
||||
@@ -1018,6 +1022,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
|
||||
|
||||
file.close()
|
||||
|
||||
|
||||
# Changes in Blender will force errors here
|
||||
context_type_map = {
|
||||
"active_base": ("ObjectBase", False),
|
||||
|
@@ -21,7 +21,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
bpy_types_Operator_bl_property__doc__ = (
|
||||
"""
|
||||
"""
|
||||
The name of a property to use as this operators primary property.
|
||||
Currently this is only used to select the default property when
|
||||
expanding an operator into a menu.
|
||||
|
@@ -29,7 +29,7 @@ You'll need to specify your user login and password, obviously.
|
||||
|
||||
Example usage:
|
||||
|
||||
./sphinx_doc_update.py --mirror ../../../docs/remote_api_backup/ --source ../.. --blender ../../../build_cmake/bin/blender --user foobar --password barfoo
|
||||
./sphinx_doc_update.py --mirror ../../../docs/remote_api_backup/ --source ../.. --blender ../../../build_cmake/bin/blender --user foobar --password barfoo
|
||||
|
||||
"""
|
||||
|
||||
@@ -107,14 +107,16 @@ def main():
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
# II) Generate doc source in temp dir.
|
||||
doc_gen_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
||||
"--python", "%s/doc/python_api/sphinx_doc_gen.py" % args.source_dir, "--",
|
||||
"--output", tmp_dir)
|
||||
doc_gen_cmd = (
|
||||
args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
||||
"--python", "%s/doc/python_api/sphinx_doc_gen.py" % args.source_dir, "--",
|
||||
"--output", tmp_dir
|
||||
)
|
||||
subprocess.run(doc_gen_cmd)
|
||||
|
||||
# III) Get Blender version info.
|
||||
getver_file = os.path.join(tmp_dir, "blendver.txt")
|
||||
getver_script = (""
|
||||
getver_script = (
|
||||
"import sys, bpy\n"
|
||||
"with open(sys.argv[-1], 'w') as f:\n"
|
||||
" is_release = bpy.app.version_cycle in {'rc', 'release'}\n"
|
||||
@@ -124,7 +126,8 @@ def main():
|
||||
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
|
||||
" if is_release else '%s\\n' % branch)\n"
|
||||
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
|
||||
" if is_release else '%d_%d_%d' % bpy.app.version)\n")
|
||||
" if is_release else '%d_%d_%d' % bpy.app.version)\n"
|
||||
)
|
||||
get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
|
||||
"--python-expr", getver_script, "--", getver_file)
|
||||
subprocess.run(get_ver_cmd)
|
||||
|
1
extern/rangetree/CMakeLists.txt
vendored
1
extern/rangetree/CMakeLists.txt
vendored
@@ -28,4 +28,3 @@ set(SRC
|
||||
)
|
||||
|
||||
blender_add_lib(extern_rangetree "${SRC}" "${INC}" "")
|
||||
|
||||
|
@@ -355,4 +355,3 @@ endif()
|
||||
if(NOT WITH_BLENDER AND WITH_CYCLES_STANDALONE)
|
||||
delayed_do_install(${CMAKE_BINARY_DIR}/bin)
|
||||
endif()
|
||||
|
||||
|
@@ -164,7 +164,7 @@ bool link_ptxas(CompilationSettings &settings)
|
||||
ptx += " --verbose";
|
||||
printf("%s\n", ptx.c_str());
|
||||
}
|
||||
|
||||
|
||||
int pxresult = system(ptx.c_str());
|
||||
if(pxresult) {
|
||||
fprintf(stderr, "Error: ptxas failed (%x)\n\n", pxresult);
|
||||
|
@@ -112,4 +112,3 @@ int main(int argc, const char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -524,4 +524,3 @@ int main(int argc, const char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -184,7 +184,7 @@ static bool xml_equal_string(xml_node node, const char *name, const char *value)
|
||||
|
||||
if(attr)
|
||||
return string_iequals(attr.value(), value);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -697,4 +697,3 @@ void xml_read_file(Scene *scene, const char *filepath)
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -39,7 +39,7 @@ def write(node, fname):
|
||||
|
||||
f = open(fname, "w")
|
||||
f.write(s)
|
||||
|
||||
|
||||
class CyclesXMLSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
def register(cls):
|
||||
@@ -53,11 +53,11 @@ class CyclesXMLSettings(bpy.types.PropertyGroup):
|
||||
maxlen=256,
|
||||
default='',
|
||||
subtype='FILE_PATH')
|
||||
|
||||
|
||||
@classmethod
|
||||
def unregister(cls):
|
||||
del bpy.types.Scene.cycles_xml
|
||||
|
||||
|
||||
# User Interface Drawing Code
|
||||
class RenderButtonsPanel():
|
||||
bl_space_type = 'PROPERTIES'
|
||||
@@ -74,13 +74,13 @@ class PHYSICS_PT_fluid_export(RenderButtonsPanel, bpy.types.Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
cycles = context.scene.cycles_xml
|
||||
|
||||
|
||||
#layout.prop(cycles, "filepath")
|
||||
layout.operator("export_mesh.cycles_xml")
|
||||
|
||||
|
||||
|
||||
# Export Operator
|
||||
class ExportCyclesXML(bpy.types.Operator, ExportHelper):
|
||||
bl_idname = "export_mesh.cycles_xml"
|
||||
@@ -117,23 +117,23 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper):
|
||||
P += "%f %f %f " % (v.co[0], v.co[1], v.co[2])
|
||||
|
||||
verts_and_uvs = zip(mesh.tessfaces, mesh.tessface_uv_textures.active.data)
|
||||
|
||||
|
||||
for f, uvf in verts_and_uvs:
|
||||
vcount = len(f.vertices)
|
||||
nverts += str(vcount) + " "
|
||||
|
||||
for v in f.vertices:
|
||||
verts += str(v) + " "
|
||||
|
||||
|
||||
uvs += str(uvf.uv1[0]) + " " + str(uvf.uv1[1]) + " "
|
||||
uvs += str(uvf.uv2[0]) + " " + str(uvf.uv2[1]) + " "
|
||||
uvs += str(uvf.uv3[0]) + " " + str(uvf.uv3[1]) + " "
|
||||
if vcount==4:
|
||||
uvs += " " + str(uvf.uv4[0]) + " " + str(uvf.uv4[1]) + " "
|
||||
|
||||
|
||||
|
||||
node = etree.Element('mesh', attrib={'nverts': nverts.strip(), 'verts': verts.strip(), 'P': P, 'UV' : uvs.strip()})
|
||||
|
||||
|
||||
# write to file
|
||||
write(node, filepath)
|
||||
|
||||
@@ -147,5 +147,3 @@ def unregister():
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
||||
|
||||
|
@@ -63,4 +63,3 @@ endif()
|
||||
add_dependencies(bf_intern_cycles bf_rna)
|
||||
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${ADDON_FILES}" ${CYCLES_INSTALL_PATH})
|
||||
|
||||
|
@@ -887,17 +887,17 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
|
||||
del bpy.types.Material.cycles
|
||||
|
||||
|
||||
class CyclesLampSettings(bpy.types.PropertyGroup):
|
||||
class CyclesLightSettings(bpy.types.PropertyGroup):
|
||||
@classmethod
|
||||
def register(cls):
|
||||
bpy.types.Lamp.cycles = PointerProperty(
|
||||
name="Cycles Lamp Settings",
|
||||
description="Cycles lamp settings",
|
||||
bpy.types.Light.cycles = PointerProperty(
|
||||
name="Cycles Light Settings",
|
||||
description="Cycles light settings",
|
||||
type=cls,
|
||||
)
|
||||
cls.cast_shadow = BoolProperty(
|
||||
name="Cast Shadow",
|
||||
description="Lamp casts shadows",
|
||||
description="Light casts shadows",
|
||||
default=True,
|
||||
)
|
||||
cls.samples = IntProperty(
|
||||
@@ -914,20 +914,20 @@ class CyclesLampSettings(bpy.types.PropertyGroup):
|
||||
)
|
||||
cls.use_multiple_importance_sampling = BoolProperty(
|
||||
name="Multiple Importance Sample",
|
||||
description="Use multiple importance sampling for the lamp, "
|
||||
"reduces noise for area lamps and sharp glossy materials",
|
||||
description="Use multiple importance sampling for the light, "
|
||||
"reduces noise for area lights and sharp glossy materials",
|
||||
default=True,
|
||||
)
|
||||
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",
|
||||
description="Use this area light to guide sampling of the background, "
|
||||
"note that this will make the light invisible",
|
||||
default=False,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def unregister(cls):
|
||||
del bpy.types.Lamp.cycles
|
||||
del bpy.types.Light.cycles
|
||||
|
||||
|
||||
class CyclesWorldSettings(bpy.types.PropertyGroup):
|
||||
@@ -1460,7 +1460,7 @@ def register():
|
||||
bpy.utils.register_class(CyclesRenderSettings)
|
||||
bpy.utils.register_class(CyclesCameraSettings)
|
||||
bpy.utils.register_class(CyclesMaterialSettings)
|
||||
bpy.utils.register_class(CyclesLampSettings)
|
||||
bpy.utils.register_class(CyclesLightSettings)
|
||||
bpy.utils.register_class(CyclesWorldSettings)
|
||||
bpy.utils.register_class(CyclesVisibilitySettings)
|
||||
bpy.utils.register_class(CyclesMeshSettings)
|
||||
@@ -1475,7 +1475,7 @@ def unregister():
|
||||
bpy.utils.unregister_class(CyclesRenderSettings)
|
||||
bpy.utils.unregister_class(CyclesCameraSettings)
|
||||
bpy.utils.unregister_class(CyclesMaterialSettings)
|
||||
bpy.utils.unregister_class(CyclesLampSettings)
|
||||
bpy.utils.unregister_class(CyclesLightSettings)
|
||||
bpy.utils.unregister_class(CyclesWorldSettings)
|
||||
bpy.utils.unregister_class(CyclesMeshSettings)
|
||||
bpy.utils.unregister_class(CyclesObjectSettings)
|
||||
|
@@ -17,7 +17,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy_extras.node_utils import find_node_input, find_output_node
|
||||
from bpy_extras.node_utils import find_node_input
|
||||
from bl_operators.presets import PresetMenu
|
||||
|
||||
from bpy.types import (
|
||||
@@ -847,7 +847,7 @@ class CYCLES_CAMERA_PT_dof_aperture(CyclesButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
|
||||
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
|
||||
|
||||
cam = context.camera
|
||||
ccam = cam.cycles
|
||||
@@ -878,7 +878,7 @@ class CYCLES_CAMERA_PT_dof_viewport(CyclesButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
|
||||
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
|
||||
|
||||
cam = context.camera
|
||||
dof_options = cam.gpu_dof
|
||||
@@ -1008,7 +1008,7 @@ class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel):
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
return (CyclesButtonsPanel.poll(context) and
|
||||
ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LAMP'}) or
|
||||
ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or
|
||||
(ob.dupli_type == 'COLLECTION' and ob.dupli_group)))
|
||||
|
||||
def draw(self, context):
|
||||
@@ -1029,7 +1029,7 @@ class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel):
|
||||
flow.prop(visibility, "transmission")
|
||||
flow.prop(visibility, "scatter")
|
||||
|
||||
if ob.type != 'LAMP':
|
||||
if ob.type != 'LIGHT':
|
||||
flow.prop(visibility, "shadow")
|
||||
|
||||
row = layout.row()
|
||||
@@ -1049,7 +1049,7 @@ class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel):
|
||||
|
||||
|
||||
class CYCLES_OT_use_shading_nodes(Operator):
|
||||
"""Enable nodes on a material, world or lamp"""
|
||||
"""Enable nodes on a material, world or light"""
|
||||
bl_idname = "cycles.use_shading_nodes"
|
||||
bl_label = "Use Nodes"
|
||||
|
||||
@@ -1063,20 +1063,20 @@ class CYCLES_OT_use_shading_nodes(Operator):
|
||||
context.material.use_nodes = True
|
||||
elif context.world:
|
||||
context.world.use_nodes = True
|
||||
elif context.lamp:
|
||||
context.lamp.use_nodes = True
|
||||
elif context.light:
|
||||
context.light.use_nodes = True
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def panel_node_draw(layout, id_data, output_types, input_name):
|
||||
def panel_node_draw(layout, id_data, output_type, input_name):
|
||||
if not id_data.use_nodes:
|
||||
layout.operator("cycles.use_shading_nodes", icon='NODETREE')
|
||||
return False
|
||||
|
||||
ntree = id_data.node_tree
|
||||
|
||||
node = find_output_node(ntree, output_types)
|
||||
node = ntree.get_output_node('CYCLES')
|
||||
if node:
|
||||
input = find_node_input(node, input_name)
|
||||
if input:
|
||||
@@ -1089,7 +1089,7 @@ def panel_node_draw(layout, id_data, output_types, input_name):
|
||||
return True
|
||||
|
||||
|
||||
class CYCLES_LAMP_PT_preview(CyclesButtonsPanel, Panel):
|
||||
class CYCLES_LIGHT_PT_preview(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Preview"
|
||||
bl_context = "data"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
@@ -1097,113 +1097,107 @@ class CYCLES_LAMP_PT_preview(CyclesButtonsPanel, Panel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (
|
||||
context.lamp and
|
||||
context.light and
|
||||
not (
|
||||
context.lamp.type == 'AREA' and
|
||||
context.lamp.cycles.is_portal
|
||||
context.light.type == 'AREA' and
|
||||
context.light.cycles.is_portal
|
||||
) and
|
||||
CyclesButtonsPanel.poll(context)
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
self.layout.template_preview(context.lamp)
|
||||
self.layout.template_preview(context.light)
|
||||
|
||||
|
||||
class CYCLES_LAMP_PT_lamp(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Lamp"
|
||||
class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Light"
|
||||
bl_context = "data"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.lamp and CyclesButtonsPanel.poll(context)
|
||||
return context.light and CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
lamp = context.lamp
|
||||
clamp = lamp.cycles
|
||||
light = context.light
|
||||
clamp = light.cycles
|
||||
# cscene = context.scene.cycles
|
||||
|
||||
layout.prop(lamp, "type", expand=True)
|
||||
layout.prop(light, "type", expand=True)
|
||||
|
||||
split = layout.split()
|
||||
col = split.column(align=True)
|
||||
layout.use_property_split = True
|
||||
|
||||
if lamp.type in {'POINT', 'SUN', 'SPOT'}:
|
||||
col.prop(lamp, "shadow_soft_size", text="Size")
|
||||
elif lamp.type == 'AREA':
|
||||
col.prop(lamp, "shape", text="")
|
||||
col = layout.column()
|
||||
|
||||
if light.type in {'POINT', 'SUN', 'SPOT'}:
|
||||
col.prop(light, "shadow_soft_size", text="Size")
|
||||
elif light.type == 'AREA':
|
||||
col.prop(light, "shape", text="Shape")
|
||||
sub = col.column(align=True)
|
||||
|
||||
if lamp.shape in {'SQUARE', 'DISK'}:
|
||||
sub.prop(lamp, "size")
|
||||
elif lamp.shape in {'RECTANGLE', 'ELLIPSE'}:
|
||||
sub.prop(lamp, "size", text="Size X")
|
||||
sub.prop(lamp, "size_y", text="Size Y")
|
||||
if light.shape in {'SQUARE', 'DISK'}:
|
||||
sub.prop(light, "size")
|
||||
elif light.shape in {'RECTANGLE', 'ELLIPSE'}:
|
||||
sub.prop(light, "size", text="Size X")
|
||||
sub.prop(light, "size_y", text="Y")
|
||||
|
||||
if not (lamp.type == 'AREA' and clamp.is_portal):
|
||||
sub = col.column(align=True)
|
||||
if not (light.type == 'AREA' and clamp.is_portal):
|
||||
sub = col.column()
|
||||
if use_branched_path(context):
|
||||
subsub = sub.row(align=True)
|
||||
subsub.active = use_sample_all_lights(context)
|
||||
subsub.prop(clamp, "samples")
|
||||
sub.prop(clamp, "max_bounces")
|
||||
|
||||
col = split.column()
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.active = not (lamp.type == 'AREA' and clamp.is_portal)
|
||||
sub.active = not (light.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':
|
||||
if light.type == 'AREA':
|
||||
col.prop(clamp, "is_portal", text="Portal")
|
||||
|
||||
if lamp.type == 'HEMI':
|
||||
layout.label(text="Not supported, interpreted as sun lamp")
|
||||
if light.type == 'HEMI':
|
||||
layout.label(text="Not supported, interpreted as sun light")
|
||||
|
||||
|
||||
class CYCLES_LAMP_PT_nodes(CyclesButtonsPanel, Panel):
|
||||
class CYCLES_LIGHT_PT_nodes(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Nodes"
|
||||
bl_context = "data"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.lamp and not (context.lamp.type == 'AREA' and
|
||||
context.lamp.cycles.is_portal) and \
|
||||
return context.light and not (context.light.type == 'AREA' and
|
||||
context.light.cycles.is_portal) and \
|
||||
CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
lamp = context.lamp
|
||||
if not panel_node_draw(layout, lamp, ('OUTPUT_LAMP',), 'Surface'):
|
||||
layout.prop(lamp, "color")
|
||||
light = context.light
|
||||
if not panel_node_draw(layout, light, 'OUTPUT_LIGHT', 'Surface'):
|
||||
layout.prop(light, "color")
|
||||
|
||||
|
||||
class CYCLES_LAMP_PT_spot(CyclesButtonsPanel, Panel):
|
||||
class CYCLES_LIGHT_PT_spot(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Spot Shape"
|
||||
bl_context = "data"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
lamp = context.lamp
|
||||
return (lamp and lamp.type == 'SPOT') and CyclesButtonsPanel.poll(context)
|
||||
light = context.light
|
||||
return (light and light.type == 'SPOT') and CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
light = context.light
|
||||
layout.use_property_split = True
|
||||
|
||||
lamp = context.lamp
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
sub = col.column()
|
||||
sub.prop(lamp, "spot_size", text="Size")
|
||||
sub.prop(lamp, "spot_blend", text="Blend", slider=True)
|
||||
|
||||
col = split.column()
|
||||
col.prop(lamp, "show_cone")
|
||||
col = layout.column()
|
||||
col.prop(light, "spot_size", text="Size")
|
||||
col.prop(light, "spot_blend", text="Blend", slider=True)
|
||||
col.prop(light, "show_cone")
|
||||
|
||||
|
||||
class CYCLES_WORLD_PT_preview(CyclesButtonsPanel, Panel):
|
||||
@@ -1232,7 +1226,7 @@ class CYCLES_WORLD_PT_surface(CyclesButtonsPanel, Panel):
|
||||
|
||||
world = context.world
|
||||
|
||||
if not panel_node_draw(layout, world, ('OUTPUT_WORLD',), 'Surface'):
|
||||
if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
|
||||
layout.prop(world, "horizon_color", text="Color")
|
||||
|
||||
|
||||
@@ -1250,7 +1244,7 @@ class CYCLES_WORLD_PT_volume(CyclesButtonsPanel, Panel):
|
||||
layout = self.layout
|
||||
|
||||
world = context.world
|
||||
panel_node_draw(layout, world, ('OUTPUT_WORLD',), 'Volume')
|
||||
panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
|
||||
|
||||
|
||||
class CYCLES_WORLD_PT_ambient_occlusion(CyclesButtonsPanel, Panel):
|
||||
@@ -1431,7 +1425,7 @@ class CYCLES_MATERIAL_PT_surface(CyclesButtonsPanel, Panel):
|
||||
layout = self.layout
|
||||
|
||||
mat = context.material
|
||||
if not panel_node_draw(layout, mat, ('OUTPUT_MATERIAL', 'OUTPUT_EEVEE_MATERIAL'), 'Surface'):
|
||||
if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'):
|
||||
layout.prop(mat, "diffuse_color")
|
||||
|
||||
|
||||
@@ -1451,7 +1445,7 @@ class CYCLES_MATERIAL_PT_volume(CyclesButtonsPanel, Panel):
|
||||
mat = context.material
|
||||
# cmat = mat.cycles
|
||||
|
||||
panel_node_draw(layout, mat, ('OUTPUT_MATERIAL', 'OUTPUT_EEVEE_MATERIAL'), 'Volume')
|
||||
panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Volume')
|
||||
|
||||
|
||||
class CYCLES_MATERIAL_PT_displacement(CyclesButtonsPanel, Panel):
|
||||
@@ -1467,7 +1461,7 @@ class CYCLES_MATERIAL_PT_displacement(CyclesButtonsPanel, Panel):
|
||||
layout = self.layout
|
||||
|
||||
mat = context.material
|
||||
panel_node_draw(layout, mat, ('OUTPUT_MATERIAL', 'OUTPUT_EEVEE_MATERIAL'), 'Displacement')
|
||||
panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement')
|
||||
|
||||
|
||||
class CYCLES_MATERIAL_PT_settings(CyclesButtonsPanel, Panel):
|
||||
@@ -1545,7 +1539,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False # No animation.
|
||||
layout.use_property_decorate = False # No animation.
|
||||
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
@@ -1574,7 +1568,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
|
||||
if cscene.bake_type == 'NORMAL':
|
||||
col.prop(cbk, "normal_space", text="Space")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub = col.column(align=True)
|
||||
sub.prop(cbk, "normal_r", text="Swizzle R")
|
||||
sub.prop(cbk, "normal_g", text="G")
|
||||
sub.prop(cbk, "normal_b", text="B")
|
||||
@@ -1596,7 +1590,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
|
||||
|
||||
elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION', 'SUBSURFACE'}:
|
||||
row = col.row(align=True)
|
||||
row.use_property_split = False
|
||||
row.use_property_split = False
|
||||
row.prop(cbk, "use_pass_direct", toggle=True)
|
||||
row.prop(cbk, "use_pass_indirect", toggle=True)
|
||||
row.prop(cbk, "use_pass_color", toggle=True)
|
||||
@@ -1615,12 +1609,12 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
|
||||
sub.prop(cbk, "use_cage", text="Cage")
|
||||
if cbk.use_cage:
|
||||
sub.prop(cbk, "cage_extrusion", text="Extrusion")
|
||||
sub.prop_search(cbk, "cage_object", scene, "objects", text="Cage Object")
|
||||
sub.prop_search(cbk, "cage_object", scene, "objects", text="Cage Object")
|
||||
else:
|
||||
sub.prop(cbk, "cage_extrusion", text="Ray Distance")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("object.bake", icon='RENDER_STILL').type = cscene.bake_type
|
||||
|
||||
|
||||
@@ -1795,7 +1789,7 @@ def get_panels():
|
||||
'DATA_PT_area',
|
||||
'DATA_PT_camera_dof',
|
||||
'DATA_PT_falloff_curve',
|
||||
'DATA_PT_lamp',
|
||||
'DATA_PT_light',
|
||||
'DATA_PT_preview',
|
||||
'DATA_PT_spot',
|
||||
'MATERIAL_PT_context_material',
|
||||
@@ -1849,10 +1843,10 @@ classes = (
|
||||
CYCLES_OBJECT_PT_motion_blur,
|
||||
CYCLES_OBJECT_PT_cycles_settings,
|
||||
CYCLES_OT_use_shading_nodes,
|
||||
CYCLES_LAMP_PT_preview,
|
||||
CYCLES_LAMP_PT_lamp,
|
||||
CYCLES_LAMP_PT_nodes,
|
||||
CYCLES_LAMP_PT_spot,
|
||||
CYCLES_LIGHT_PT_preview,
|
||||
CYCLES_LIGHT_PT_light,
|
||||
CYCLES_LIGHT_PT_nodes,
|
||||
CYCLES_LIGHT_PT_spot,
|
||||
CYCLES_WORLD_PT_preview,
|
||||
CYCLES_WORLD_PT_surface,
|
||||
CYCLES_WORLD_PT_volume,
|
||||
|
@@ -22,45 +22,6 @@ import math
|
||||
from bpy.app.handlers import persistent
|
||||
|
||||
|
||||
def check_is_new_shading_ntree(node_tree):
|
||||
for node in node_tree.nodes:
|
||||
# If material has any node with ONLY new shading system
|
||||
# compatibility then it's considered a Cycles material
|
||||
# and versioning code would need to perform on it.
|
||||
#
|
||||
# We can not check for whether NEW_SHADING in compatibility
|
||||
# because some nodes could have compatibility with both old
|
||||
# and new shading system and they can't be used for any
|
||||
# decision here.
|
||||
if node.shading_compatibility == {'NEW_SHADING'}:
|
||||
return True
|
||||
|
||||
# If node is only compatible with old shading system
|
||||
# then material can not be Cycles material and we
|
||||
# can stopiterating nodes now.
|
||||
if node.shading_compatibility == {'OLD_SHADING'}:
|
||||
return False
|
||||
return False
|
||||
|
||||
|
||||
def check_is_new_shading_material(material):
|
||||
if not material.node_tree:
|
||||
return False
|
||||
return check_is_new_shading_ntree(material.node_tree)
|
||||
|
||||
|
||||
def check_is_new_shading_world(world):
|
||||
if not world.node_tree:
|
||||
return False
|
||||
return check_is_new_shading_ntree(world.node_tree)
|
||||
|
||||
|
||||
def check_is_new_shading_lamp(lamp):
|
||||
if not lamp.node_tree:
|
||||
return False
|
||||
return check_is_new_shading_ntree(lamp.node_tree)
|
||||
|
||||
|
||||
def foreach_notree_node(nodetree, callback, traversed):
|
||||
if nodetree in traversed:
|
||||
return
|
||||
@@ -74,20 +35,20 @@ def foreach_notree_node(nodetree, callback, traversed):
|
||||
def foreach_cycles_node(callback):
|
||||
traversed = set()
|
||||
for material in bpy.data.materials:
|
||||
if check_is_new_shading_material(material):
|
||||
foreach_notree_node(material.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
if material.node_tree:
|
||||
foreach_notree_node(material.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
for world in bpy.data.worlds:
|
||||
if check_is_new_shading_world(world):
|
||||
foreach_notree_node(world.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
for lamp in bpy.data.lamps:
|
||||
if check_is_new_shading_world(lamp):
|
||||
foreach_notree_node(lamp.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
if world.node_tree:
|
||||
foreach_notree_node(world.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
for light in bpy.data.lights:
|
||||
if light.node_tree:
|
||||
foreach_notree_node(light.node_tree,
|
||||
callback,
|
||||
traversed)
|
||||
|
||||
|
||||
def displacement_node_insert(material, nodetree, traversed):
|
||||
@@ -128,7 +89,7 @@ def displacement_node_insert(material, nodetree, traversed):
|
||||
def displacement_nodes_insert():
|
||||
traversed = set()
|
||||
for material in bpy.data.materials:
|
||||
if check_is_new_shading_material(material):
|
||||
if material.node_tree:
|
||||
displacement_node_insert(material, material.node_tree, traversed)
|
||||
|
||||
def displacement_principled_nodes(node):
|
||||
@@ -186,7 +147,7 @@ def square_roughness_node_insert(material, nodetree, traversed):
|
||||
def square_roughness_nodes_insert():
|
||||
traversed = set()
|
||||
for material in bpy.data.materials:
|
||||
if check_is_new_shading_material(material):
|
||||
if material.node_tree:
|
||||
square_roughness_node_insert(material, material.node_tree, traversed)
|
||||
|
||||
|
||||
@@ -301,7 +262,7 @@ def ambient_occlusion_node_relink(material, nodetree, traversed):
|
||||
def ambient_occlusion_nodes_relink():
|
||||
traversed = set()
|
||||
for material in bpy.data.materials:
|
||||
if check_is_new_shading_material(material):
|
||||
if material.node_tree:
|
||||
ambient_occlusion_node_relink(material, material.node_tree, traversed)
|
||||
|
||||
|
||||
@@ -393,12 +354,12 @@ def do_versions(self):
|
||||
if not cscene.is_property_set("tile_order"):
|
||||
cscene.tile_order = 'CENTER'
|
||||
|
||||
for lamp in bpy.data.lamps:
|
||||
clamp = lamp.cycles
|
||||
for light in bpy.data.lights:
|
||||
clight = light.cycles
|
||||
|
||||
# MIS
|
||||
if not clamp.is_property_set("use_multiple_importance_sampling"):
|
||||
clamp.use_multiple_importance_sampling = False
|
||||
if not clight.is_property_set("use_multiple_importance_sampling"):
|
||||
clight.use_multiple_importance_sampling = False
|
||||
|
||||
for mat in bpy.data.materials:
|
||||
cmat = mat.cycles
|
||||
|
@@ -124,7 +124,7 @@ static float blender_camera_focal_distance(BL::RenderEngine& b_engine,
|
||||
|
||||
if(!b_dof_object)
|
||||
return b_camera.dof_distance();
|
||||
|
||||
|
||||
/* for dof object, return distance along camera Z direction */
|
||||
BL::Array<float, 16> b_ob_matrix;
|
||||
b_engine.camera_model_matrix(b_ob, bcam->use_spherical_stereo, b_ob_matrix);
|
||||
@@ -232,7 +232,7 @@ static void blender_camera_from_object(BlenderCamera *bcam,
|
||||
bcam->motion_steps = object_motion_steps(b_ob, b_ob);
|
||||
}
|
||||
else {
|
||||
/* from lamp not implemented yet */
|
||||
/* from light not implemented yet */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,6 +457,7 @@ static void blender_camera_sync(Camera *cam,
|
||||
cam->matrix = blender_camera_matrix(bcam->matrix,
|
||||
bcam->type,
|
||||
bcam->panorama_type);
|
||||
cam->motion.clear();
|
||||
cam->motion.resize(bcam->motion_steps, cam->matrix);
|
||||
cam->use_perspective_motion = false;
|
||||
cam->shuttertime = bcam->shuttertime;
|
||||
@@ -725,7 +726,7 @@ static void blender_camera_view_subset(BL::RenderEngine& b_engine,
|
||||
|
||||
blender_camera_viewplane(&cam_bcam, cam_bcam.full_width, cam_bcam.full_height,
|
||||
&cam, &cam_aspect, &sensor_size);
|
||||
|
||||
|
||||
/* return */
|
||||
*view_box = view * (1.0f/view_aspect);
|
||||
*cam_box = cam * (1.0f/cam_aspect);
|
||||
@@ -894,4 +895,3 @@ BufferParams BlenderSync::get_buffer_params(BL::RenderSettings& b_render,
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -89,7 +89,7 @@ bool BlenderSync::object_is_light(BL::Object& b_ob)
|
||||
{
|
||||
BL::ID b_ob_data = b_ob.data();
|
||||
|
||||
return (b_ob_data && b_ob_data.is_a(&RNA_Lamp));
|
||||
return (b_ob_data && b_ob_data.is_a(&RNA_Light));
|
||||
}
|
||||
|
||||
static uint object_ray_visibility(BL::Object& b_ob)
|
||||
@@ -126,57 +126,57 @@ void BlenderSync::sync_light(BL::Object& b_parent,
|
||||
*use_portal = true;
|
||||
return;
|
||||
}
|
||||
|
||||
BL::Lamp b_lamp(b_ob.data());
|
||||
|
||||
BL::Light b_light(b_ob.data());
|
||||
|
||||
/* type */
|
||||
switch(b_lamp.type()) {
|
||||
case BL::Lamp::type_POINT: {
|
||||
BL::PointLamp b_point_lamp(b_lamp);
|
||||
light->size = b_point_lamp.shadow_soft_size();
|
||||
switch(b_light.type()) {
|
||||
case BL::Light::type_POINT: {
|
||||
BL::PointLight b_point_light(b_light);
|
||||
light->size = b_point_light.shadow_soft_size();
|
||||
light->type = LIGHT_POINT;
|
||||
break;
|
||||
}
|
||||
case BL::Lamp::type_SPOT: {
|
||||
BL::SpotLamp b_spot_lamp(b_lamp);
|
||||
light->size = b_spot_lamp.shadow_soft_size();
|
||||
case BL::Light::type_SPOT: {
|
||||
BL::SpotLight b_spot_light(b_light);
|
||||
light->size = b_spot_light.shadow_soft_size();
|
||||
light->type = LIGHT_SPOT;
|
||||
light->spot_angle = b_spot_lamp.spot_size();
|
||||
light->spot_smooth = b_spot_lamp.spot_blend();
|
||||
light->spot_angle = b_spot_light.spot_size();
|
||||
light->spot_smooth = b_spot_light.spot_blend();
|
||||
break;
|
||||
}
|
||||
case BL::Lamp::type_HEMI: {
|
||||
case BL::Light::type_HEMI: {
|
||||
light->type = LIGHT_DISTANT;
|
||||
light->size = 0.0f;
|
||||
break;
|
||||
}
|
||||
case BL::Lamp::type_SUN: {
|
||||
BL::SunLamp b_sun_lamp(b_lamp);
|
||||
light->size = b_sun_lamp.shadow_soft_size();
|
||||
case BL::Light::type_SUN: {
|
||||
BL::SunLight b_sun_light(b_light);
|
||||
light->size = b_sun_light.shadow_soft_size();
|
||||
light->type = LIGHT_DISTANT;
|
||||
break;
|
||||
}
|
||||
case BL::Lamp::type_AREA: {
|
||||
BL::AreaLamp b_area_lamp(b_lamp);
|
||||
case BL::Light::type_AREA: {
|
||||
BL::AreaLight b_area_light(b_light);
|
||||
light->size = 1.0f;
|
||||
light->axisu = transform_get_column(&tfm, 0);
|
||||
light->axisv = transform_get_column(&tfm, 1);
|
||||
light->sizeu = b_area_lamp.size();
|
||||
switch(b_area_lamp.shape()) {
|
||||
case BL::AreaLamp::shape_SQUARE:
|
||||
light->sizeu = b_area_light.size();
|
||||
switch(b_area_light.shape()) {
|
||||
case BL::AreaLight::shape_SQUARE:
|
||||
light->sizev = light->sizeu;
|
||||
light->round = false;
|
||||
break;
|
||||
case BL::AreaLamp::shape_RECTANGLE:
|
||||
light->sizev = b_area_lamp.size_y();
|
||||
case BL::AreaLight::shape_RECTANGLE:
|
||||
light->sizev = b_area_light.size_y();
|
||||
light->round = false;
|
||||
break;
|
||||
case BL::AreaLamp::shape_DISK:
|
||||
case BL::AreaLight::shape_DISK:
|
||||
light->sizev = light->sizeu;
|
||||
light->round = true;
|
||||
break;
|
||||
case BL::AreaLamp::shape_ELLIPSE:
|
||||
light->sizev = b_area_lamp.size_y();
|
||||
case BL::AreaLight::shape_ELLIPSE:
|
||||
light->sizev = b_area_light.size_y();
|
||||
light->round = true;
|
||||
break;
|
||||
}
|
||||
@@ -192,22 +192,22 @@ void BlenderSync::sync_light(BL::Object& b_parent,
|
||||
|
||||
/* shader */
|
||||
vector<Shader*> used_shaders;
|
||||
find_shader(b_lamp, used_shaders, scene->default_light);
|
||||
find_shader(b_light, used_shaders, scene->default_light);
|
||||
light->shader = used_shaders[0];
|
||||
|
||||
/* shadow */
|
||||
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
||||
PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
|
||||
light->cast_shadow = get_boolean(clamp, "cast_shadow");
|
||||
light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling");
|
||||
|
||||
int samples = get_int(clamp, "samples");
|
||||
PointerRNA clight = RNA_pointer_get(&b_light.ptr, "cycles");
|
||||
light->cast_shadow = get_boolean(clight, "cast_shadow");
|
||||
light->use_mis = get_boolean(clight, "use_multiple_importance_sampling");
|
||||
|
||||
int samples = get_int(clight, "samples");
|
||||
if(get_boolean(cscene, "use_square_samples"))
|
||||
light->samples = samples * samples;
|
||||
else
|
||||
light->samples = samples;
|
||||
|
||||
light->max_bounces = get_int(clamp, "max_bounces");
|
||||
light->max_bounces = get_int(clight, "max_bounces");
|
||||
|
||||
if(b_ob != b_ob_instance) {
|
||||
light->random_id = random_id;
|
||||
@@ -217,7 +217,7 @@ void BlenderSync::sync_light(BL::Object& b_parent,
|
||||
}
|
||||
|
||||
if(light->type == LIGHT_AREA)
|
||||
light->is_portal = get_boolean(clamp, "is_portal");
|
||||
light->is_portal = get_boolean(clight, "is_portal");
|
||||
else
|
||||
light->is_portal = false;
|
||||
|
||||
@@ -315,7 +315,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
|
||||
|
||||
/* light is handled separately */
|
||||
if(object_is_light(b_ob)) {
|
||||
/* don't use lamps for excluded layers used as mask layer */
|
||||
/* don't use lights for excluded layers used as mask layer */
|
||||
if(!motion && !((layer_flag & view_layer.holdout_layer) &&
|
||||
(layer_flag & view_layer.exclude_layer)))
|
||||
{
|
||||
@@ -394,7 +394,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
|
||||
|
||||
if(object_map.sync(&object, b_ob, b_parent, key))
|
||||
object_updated = true;
|
||||
|
||||
|
||||
/* mesh sync */
|
||||
object->mesh = sync_mesh(b_depsgraph, b_ob, b_ob_instance, object_updated, hide_tris);
|
||||
|
||||
@@ -448,6 +448,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
|
||||
mesh->motion_steps = motion_steps;
|
||||
}
|
||||
|
||||
object->motion.clear();
|
||||
object->motion.resize(motion_steps, transform_empty());
|
||||
|
||||
if(motion_steps) {
|
||||
@@ -542,7 +543,7 @@ static bool object_render_hide(BL::Object& b_ob,
|
||||
}
|
||||
parent = parent.parent();
|
||||
}
|
||||
|
||||
|
||||
hide_triangles = hide_emitter;
|
||||
|
||||
if(show_emitter) {
|
||||
@@ -562,7 +563,7 @@ void BlenderSync::sync_objects(BL::Depsgraph& b_depsgraph, float motion_time)
|
||||
{
|
||||
/* layer data */
|
||||
bool motion = motion_time != 0.0f;
|
||||
|
||||
|
||||
if(!motion) {
|
||||
/* prepare for sync */
|
||||
light_map.pre_sync();
|
||||
@@ -728,4 +729,3 @@ void BlenderSync::sync_motion(BL::RenderSettings& b_render,
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -146,4 +146,3 @@ bool BlenderObjectCulling::test_distance(Scene *scene, float3 bb[8])
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -68,7 +68,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object& b_ob,
|
||||
/* add particle */
|
||||
BL::Particle b_pa = b_psys.particles[persistent_id[0]];
|
||||
Particle pa;
|
||||
|
||||
|
||||
pa.index = persistent_id[0];
|
||||
pa.age = b_scene.frame_current() - b_pa.birth_time();
|
||||
pa.lifetime = b_pa.lifetime();
|
||||
|
@@ -326,7 +326,7 @@ static PyObject *draw_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
if(!PyArg_ParseTuple(args, "OOOO", &pysession, &pygraph, &pyv3d, &pyrv3d))
|
||||
return NULL;
|
||||
|
||||
|
||||
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
|
||||
|
||||
if(PyLong_AsVoidPtr(pyrv3d)) {
|
||||
@@ -594,7 +594,7 @@ static PyObject *osl_compile_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
if(!PyArg_ParseTuple(args, "ss", &inputfile, &outputfile))
|
||||
return NULL;
|
||||
|
||||
|
||||
/* return */
|
||||
if(!OSLShaderManager::osl_compile(inputfile, outputfile))
|
||||
Py_RETURN_FALSE;
|
||||
|
@@ -154,7 +154,7 @@ static SocketType::Type convert_socket_type(BL::NodeSocket& b_socket)
|
||||
return SocketType::STRING;
|
||||
case BL::NodeSocket::type_SHADER:
|
||||
return SocketType::CLOSURE;
|
||||
|
||||
|
||||
default:
|
||||
return SocketType::UNDEFINED;
|
||||
}
|
||||
@@ -436,7 +436,7 @@ static ShaderNode *add_node(Scene *scene,
|
||||
else if(b_node.is_a(&RNA_ShaderNodeBsdfGlossy)) {
|
||||
BL::ShaderNodeBsdfGlossy b_glossy_node(b_node);
|
||||
GlossyBsdfNode *glossy = new GlossyBsdfNode();
|
||||
|
||||
|
||||
switch(b_glossy_node.distribution()) {
|
||||
case BL::ShaderNodeBsdfGlossy::distribution_SHARP:
|
||||
glossy->distribution = CLOSURE_BSDF_REFLECTION_ID;
|
||||
@@ -940,7 +940,7 @@ static ShaderInput *node_find_input_by_name(ShaderNode *node,
|
||||
BL::NodeSocket& b_socket)
|
||||
{
|
||||
string name = b_socket.name();
|
||||
|
||||
|
||||
if(node_use_modified_socket_name(node)) {
|
||||
BL::Node::inputs_iterator b_input;
|
||||
bool found = false;
|
||||
@@ -1001,31 +1001,6 @@ static ShaderOutput *node_find_output_by_name(ShaderNode *node,
|
||||
return node->output(name.c_str());
|
||||
}
|
||||
|
||||
static BL::ShaderNode find_output_node(BL::ShaderNodeTree& b_ntree)
|
||||
{
|
||||
BL::ShaderNodeTree::nodes_iterator b_node;
|
||||
BL::ShaderNode output_node(PointerRNA_NULL);
|
||||
|
||||
for(b_ntree.nodes.begin(b_node); b_node != b_ntree.nodes.end(); ++b_node) {
|
||||
BL::ShaderNodeOutputMaterial b_output_node(*b_node);
|
||||
|
||||
if (b_output_node.is_a(&RNA_ShaderNodeOutputMaterial) ||
|
||||
b_output_node.is_a(&RNA_ShaderNodeOutputWorld) ||
|
||||
b_output_node.is_a(&RNA_ShaderNodeOutputLamp)) {
|
||||
/* regular Cycles output node */
|
||||
if(b_output_node.is_active_output()) {
|
||||
output_node = b_output_node;
|
||||
break;
|
||||
}
|
||||
else if(!output_node.ptr.data) {
|
||||
output_node = b_output_node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return output_node;
|
||||
}
|
||||
|
||||
static void add_nodes(Scene *scene,
|
||||
BL::RenderEngine& b_engine,
|
||||
BL::BlendData& b_data,
|
||||
@@ -1045,7 +1020,7 @@ static void add_nodes(Scene *scene,
|
||||
BL::Node::outputs_iterator b_output;
|
||||
|
||||
/* find the node to use for output if there are multiple */
|
||||
BL::ShaderNode output_node = find_output_node(b_ntree);
|
||||
BL::ShaderNode output_node = b_ntree.get_output_node(BL::ShaderNodeOutputMaterial::target_CYCLES);
|
||||
|
||||
/* add nodes */
|
||||
for(b_ntree.nodes.begin(b_node); b_node != b_ntree.nodes.end(); ++b_node) {
|
||||
@@ -1068,7 +1043,7 @@ static void add_nodes(Scene *scene,
|
||||
}
|
||||
}
|
||||
else if(b_node->is_a(&RNA_ShaderNodeGroup) || b_node->is_a(&RNA_NodeCustomGroup)) {
|
||||
|
||||
|
||||
BL::ShaderNodeTree b_group_ntree(PointerRNA_NULL);
|
||||
if(b_node->is_a(&RNA_ShaderNodeGroup))
|
||||
b_group_ntree = BL::ShaderNodeTree(((BL::NodeGroup)(*b_node)).node_tree());
|
||||
@@ -1110,7 +1085,7 @@ static void add_nodes(Scene *scene,
|
||||
|
||||
output_map[b_output->ptr.data] = proxy->outputs[0];
|
||||
}
|
||||
|
||||
|
||||
if(b_group_ntree) {
|
||||
add_nodes(scene,
|
||||
b_engine,
|
||||
@@ -1418,45 +1393,45 @@ void BlenderSync::sync_world(BL::Depsgraph& b_depsgraph, bool update_all)
|
||||
background->tag_update(scene);
|
||||
}
|
||||
|
||||
/* Sync Lamps */
|
||||
/* Sync Lights */
|
||||
|
||||
void BlenderSync::sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all)
|
||||
void BlenderSync::sync_lights(BL::Depsgraph& b_depsgraph, bool update_all)
|
||||
{
|
||||
shader_map.set_default(scene->default_light);
|
||||
|
||||
BL::Depsgraph::ids_iterator b_id;
|
||||
for(b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) {
|
||||
if (!b_id->is_a(&RNA_Lamp)) {
|
||||
if (!b_id->is_a(&RNA_Light)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BL::Lamp b_lamp(*b_id);
|
||||
BL::Light b_light(*b_id);
|
||||
Shader *shader;
|
||||
|
||||
/* test if we need to sync */
|
||||
if(shader_map.sync(&shader, b_lamp) || update_all) {
|
||||
if(shader_map.sync(&shader, b_light) || update_all) {
|
||||
ShaderGraph *graph = new ShaderGraph();
|
||||
|
||||
/* create nodes */
|
||||
if(b_lamp.use_nodes() && b_lamp.node_tree()) {
|
||||
shader->name = b_lamp.name().c_str();
|
||||
if(b_light.use_nodes() && b_light.node_tree()) {
|
||||
shader->name = b_light.name().c_str();
|
||||
|
||||
BL::ShaderNodeTree b_ntree(b_lamp.node_tree());
|
||||
BL::ShaderNodeTree b_ntree(b_light.node_tree());
|
||||
|
||||
add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree);
|
||||
}
|
||||
else {
|
||||
float strength = 1.0f;
|
||||
|
||||
if(b_lamp.type() == BL::Lamp::type_POINT ||
|
||||
b_lamp.type() == BL::Lamp::type_SPOT ||
|
||||
b_lamp.type() == BL::Lamp::type_AREA)
|
||||
if(b_light.type() == BL::Light::type_POINT ||
|
||||
b_light.type() == BL::Light::type_SPOT ||
|
||||
b_light.type() == BL::Light::type_AREA)
|
||||
{
|
||||
strength = 100.0f;
|
||||
}
|
||||
|
||||
EmissionNode *emission = new EmissionNode();
|
||||
emission->color = get_float3(b_lamp.color());
|
||||
emission->color = get_float3(b_light.color());
|
||||
emission->strength = strength;
|
||||
graph->add(emission);
|
||||
|
||||
@@ -1484,7 +1459,7 @@ void BlenderSync::sync_shaders(BL::Depsgraph& b_depsgraph)
|
||||
shader_map.pre_sync();
|
||||
|
||||
sync_world(b_depsgraph, auto_refresh_update);
|
||||
sync_lamps(b_depsgraph, auto_refresh_update);
|
||||
sync_lights(b_depsgraph, auto_refresh_update);
|
||||
sync_materials(b_depsgraph, auto_refresh_update);
|
||||
|
||||
/* false = don't delete unused shaders, not supported */
|
||||
@@ -1492,4 +1467,3 @@ void BlenderSync::sync_shaders(BL::Depsgraph& b_depsgraph)
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -113,17 +113,17 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
|
||||
BL::Material b_mat(b_id);
|
||||
shader_map.set_recalc(b_mat);
|
||||
}
|
||||
/* Lamp */
|
||||
else if (b_id.is_a(&RNA_Lamp)) {
|
||||
BL::Lamp b_lamp(b_id);
|
||||
shader_map.set_recalc(b_lamp);
|
||||
/* Light */
|
||||
else if (b_id.is_a(&RNA_Light)) {
|
||||
BL::Light b_light(b_id);
|
||||
shader_map.set_recalc(b_light);
|
||||
}
|
||||
/* Object */
|
||||
else if (b_id.is_a(&RNA_Object)) {
|
||||
BL::Object b_ob(b_id);
|
||||
const bool updated_geometry = b_update->updated_geometry();
|
||||
const bool updated_geometry = !b_update->is_dirty_geometry();
|
||||
|
||||
if (b_update->updated_transform()) {
|
||||
if (!b_update->is_dirty_transform()) {
|
||||
object_map.set_recalc(b_ob);
|
||||
light_map.set_recalc(b_ob);
|
||||
}
|
||||
@@ -292,7 +292,7 @@ void BlenderSync::sync_integrator()
|
||||
integrator->mesh_light_samples = mesh_light_samples * mesh_light_samples;
|
||||
integrator->subsurface_samples = subsurface_samples * subsurface_samples;
|
||||
integrator->volume_samples = volume_samples * volume_samples;
|
||||
}
|
||||
}
|
||||
else {
|
||||
integrator->diffuse_samples = diffuse_samples;
|
||||
integrator->glossy_samples = glossy_samples;
|
||||
@@ -327,7 +327,7 @@ void BlenderSync::sync_film()
|
||||
|
||||
Film *film = scene->film;
|
||||
Film prevfilm = *film;
|
||||
|
||||
|
||||
film->exposure = get_float(cscene, "film_exposure");
|
||||
film->filter_type = (FilterType)get_enum(cscene,
|
||||
"pixel_filter_type",
|
||||
@@ -580,7 +580,7 @@ SceneParams BlenderSync::get_scene_params(BL::Scene& b_scene,
|
||||
params.shadingsystem = SHADINGSYSTEM_SVM;
|
||||
else if(shadingsystem == 1)
|
||||
params.shadingsystem = SHADINGSYSTEM_OSL;
|
||||
|
||||
|
||||
if(background || DebugFlags().viewport_static_bvh)
|
||||
params.bvh_type = SceneParams::BVH_STATIC;
|
||||
else
|
||||
@@ -645,7 +645,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
|
||||
|
||||
/* device type */
|
||||
vector<DeviceInfo>& devices = Device::available_devices();
|
||||
|
||||
|
||||
/* device default CPU */
|
||||
foreach(DeviceInfo& device, devices) {
|
||||
if(device.type == DEVICE_CPU) {
|
||||
@@ -720,7 +720,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
|
||||
int aa_samples = get_int(cscene, "aa_samples");
|
||||
int preview_samples = get_int(cscene, "preview_samples");
|
||||
int preview_aa_samples = get_int(cscene, "preview_aa_samples");
|
||||
|
||||
|
||||
if(get_boolean(cscene, "use_square_samples")) {
|
||||
aa_samples = aa_samples * aa_samples;
|
||||
preview_aa_samples = preview_aa_samples * preview_aa_samples;
|
||||
@@ -817,7 +817,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
|
||||
params.shadingsystem = SHADINGSYSTEM_SVM;
|
||||
else if(shadingsystem == 1)
|
||||
params.shadingsystem = SHADINGSYSTEM_OSL;
|
||||
|
||||
|
||||
/* color managagement */
|
||||
params.display_buffer_linear = GLEW_ARB_half_float_pixel &&
|
||||
b_engine.support_display_space_shader(b_scene);
|
||||
@@ -833,4 +833,3 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -100,7 +100,7 @@ public:
|
||||
|
||||
private:
|
||||
/* sync */
|
||||
void sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all);
|
||||
void sync_lights(BL::Depsgraph& b_depsgraph, bool update_all);
|
||||
void sync_materials(BL::Depsgraph& b_depsgraph, bool update_all);
|
||||
void sync_objects(BL::Depsgraph& b_depsgraph, float motion_time = 0.0f);
|
||||
void sync_motion(BL::RenderSettings& b_render,
|
||||
@@ -218,4 +218,3 @@ private:
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __BLENDER_SYNC_H__ */
|
||||
|
||||
|
@@ -293,7 +293,7 @@ static inline int4 get_int4(const BL::Array<int, 4>& array)
|
||||
return make_int4(array[0], array[1], array[2], array[3]);
|
||||
}
|
||||
|
||||
static inline uint get_layer(const BL::Array<int, 20>& array)
|
||||
static inline uint get_layer(const BL::Array<bool, 20>& array)
|
||||
{
|
||||
uint layer = 0;
|
||||
|
||||
@@ -304,8 +304,8 @@ static inline uint get_layer(const BL::Array<int, 20>& array)
|
||||
return layer;
|
||||
}
|
||||
|
||||
static inline uint get_layer(const BL::Array<int, 20>& array,
|
||||
const BL::Array<int, 8>& local_array,
|
||||
static inline uint get_layer(const BL::Array<bool, 20>& array,
|
||||
const BL::Array<bool, 8>& local_array,
|
||||
bool is_light = false,
|
||||
uint view_layers = (1 << 20) - 1)
|
||||
{
|
||||
|
@@ -251,4 +251,3 @@ void BVHObjectBinning::split(BVHReference* prims,
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -206,7 +206,7 @@ void InnerNode::print(int depth) const
|
||||
{
|
||||
for(int i = 0; i < depth; i++)
|
||||
printf(" ");
|
||||
|
||||
|
||||
printf("inner node %p\n", (void*)this);
|
||||
|
||||
if(children[0])
|
||||
@@ -219,9 +219,8 @@ void LeafNode::print(int depth) const
|
||||
{
|
||||
for(int i = 0; i < depth; i++)
|
||||
printf(" ");
|
||||
|
||||
|
||||
printf("leaf node %d to %d\n", lo, hi);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -201,4 +201,3 @@ void bvh_reference_sort(int start,
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -123,7 +123,7 @@ public:
|
||||
|
||||
/* Use OpenSubdiv patch evaluation */
|
||||
bool use_patch_evaluation;
|
||||
|
||||
|
||||
/* Use Transparent shadows */
|
||||
bool use_transparent;
|
||||
|
||||
@@ -307,7 +307,7 @@ public:
|
||||
/* open shading language, only for CPU device */
|
||||
virtual void *osl_memory() { return NULL; }
|
||||
|
||||
/* load/compile kernels, must be called before adding tasks */
|
||||
/* load/compile kernels, must be called before adding tasks */
|
||||
virtual bool load_kernels(
|
||||
const DeviceRequestedFeatures& /*requested_features*/)
|
||||
{ return true; }
|
||||
@@ -317,7 +317,7 @@ public:
|
||||
virtual void task_add(DeviceTask& task) = 0;
|
||||
virtual void task_wait() = 0;
|
||||
virtual void task_cancel() = 0;
|
||||
|
||||
|
||||
/* opengl drawing */
|
||||
virtual void draw_pixels(device_memory& mem, int y,
|
||||
int w, int h, int width, int height,
|
||||
@@ -376,4 +376,3 @@ private:
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __DEVICE_H__ */
|
||||
|
||||
|
@@ -21,10 +21,7 @@
|
||||
#ifdef WITH_OSL
|
||||
/* So no context pollution happens from indirectly included windows.h */
|
||||
# include "util/util_windows.h"
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wdeprecated-register"
|
||||
# include <OSL/oslexec.h>
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "device/device.h"
|
||||
@@ -182,8 +179,8 @@ public:
|
||||
KernelFunctions<void(*)(KernelGlobals *, uchar4 *, float *, float, int, int, int, int)> convert_to_byte_kernel;
|
||||
KernelFunctions<void(*)(KernelGlobals *, uint4 *, float4 *, int, int, int, int, int)> shader_kernel;
|
||||
|
||||
KernelFunctions<void(*)(int, TilesInfo*, int, int, float*, float*, float*, float*, float*, int*, int, int)> filter_divide_shadow_kernel;
|
||||
KernelFunctions<void(*)(int, TilesInfo*, int, int, int, int, float*, float*, int*, int, int)> filter_get_feature_kernel;
|
||||
KernelFunctions<void(*)(int, TileInfo*, int, int, float*, float*, float*, float*, float*, int*, int, int)> filter_divide_shadow_kernel;
|
||||
KernelFunctions<void(*)(int, TileInfo*, int, int, int, int, float*, float*, int*, int, int)> filter_get_feature_kernel;
|
||||
KernelFunctions<void(*)(int, int, float*, float*, float*, float*, int*, int)> filter_detect_outliers_kernel;
|
||||
KernelFunctions<void(*)(int, int, float*, float*, float*, float*, int*, int)> filter_combine_halves_kernel;
|
||||
|
||||
@@ -462,18 +459,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
bool denoising_set_tiles(device_ptr *buffers, DenoisingTask *task)
|
||||
{
|
||||
TilesInfo *tiles = (TilesInfo*) task->tiles_mem.host_pointer;
|
||||
for(int i = 0; i < 9; i++) {
|
||||
tiles->buffers[i] = buffers[i];
|
||||
}
|
||||
|
||||
task->tiles_mem.copy_to_device();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool denoising_non_local_means(device_ptr image_ptr, device_ptr guide_ptr, device_ptr variance_ptr, device_ptr out_ptr,
|
||||
DenoisingTask *task)
|
||||
{
|
||||
@@ -629,7 +614,7 @@ public:
|
||||
for(int y = task->rect.y; y < task->rect.w; y++) {
|
||||
for(int x = task->rect.x; x < task->rect.z; x++) {
|
||||
filter_divide_shadow_kernel()(task->render_buffer.samples,
|
||||
task->tiles,
|
||||
task->tile_info,
|
||||
x, y,
|
||||
(float*) a_ptr,
|
||||
(float*) b_ptr,
|
||||
@@ -638,7 +623,7 @@ public:
|
||||
(float*) buffer_variance_ptr,
|
||||
&task->rect.x,
|
||||
task->render_buffer.pass_stride,
|
||||
task->render_buffer.denoising_data_offset);
|
||||
task->render_buffer.offset);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -653,7 +638,7 @@ public:
|
||||
for(int y = task->rect.y; y < task->rect.w; y++) {
|
||||
for(int x = task->rect.x; x < task->rect.z; x++) {
|
||||
filter_get_feature_kernel()(task->render_buffer.samples,
|
||||
task->tiles,
|
||||
task->tile_info,
|
||||
mean_offset,
|
||||
variance_offset,
|
||||
x, y,
|
||||
@@ -661,7 +646,7 @@ public:
|
||||
(float*) variance_ptr,
|
||||
&task->rect.x,
|
||||
task->render_buffer.pass_stride,
|
||||
task->render_buffer.denoising_data_offset);
|
||||
task->render_buffer.offset);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -714,7 +699,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void denoise(DeviceTask &task, DenoisingTask& denoising, RenderTile &tile)
|
||||
void denoise(DenoisingTask& denoising, RenderTile &tile)
|
||||
{
|
||||
tile.sample = tile.start_sample + tile.num_samples;
|
||||
|
||||
@@ -725,23 +710,11 @@ public:
|
||||
denoising.functions.combine_halves = function_bind(&CPUDevice::denoising_combine_halves, this, _1, _2, _3, _4, _5, _6, &denoising);
|
||||
denoising.functions.get_feature = function_bind(&CPUDevice::denoising_get_feature, this, _1, _2, _3, _4, &denoising);
|
||||
denoising.functions.detect_outliers = function_bind(&CPUDevice::denoising_detect_outliers, this, _1, _2, _3, _4, &denoising);
|
||||
denoising.functions.set_tiles = function_bind(&CPUDevice::denoising_set_tiles, this, _1, &denoising);
|
||||
|
||||
denoising.filter_area = make_int4(tile.x, tile.y, tile.w, tile.h);
|
||||
denoising.render_buffer.samples = tile.sample;
|
||||
|
||||
RenderTile rtiles[9];
|
||||
rtiles[4] = tile;
|
||||
task.map_neighbor_tiles(rtiles, this);
|
||||
denoising.tiles_from_rendertiles(rtiles);
|
||||
|
||||
denoising.init_from_devicetask(task);
|
||||
|
||||
denoising.run_denoising();
|
||||
|
||||
task.unmap_neighbor_tiles(rtiles, this);
|
||||
|
||||
task.update_progress(&tile, tile.w*tile.h);
|
||||
denoising.run_denoising(&tile);
|
||||
}
|
||||
|
||||
void thread_render(DeviceTask& task)
|
||||
@@ -769,7 +742,7 @@ public:
|
||||
}
|
||||
|
||||
RenderTile tile;
|
||||
DenoisingTask denoising(this);
|
||||
DenoisingTask denoising(this, task);
|
||||
|
||||
while(task.acquire_tile(this, tile)) {
|
||||
if(tile.task == RenderTile::PATH_TRACE) {
|
||||
@@ -782,7 +755,9 @@ public:
|
||||
}
|
||||
}
|
||||
else if(tile.task == RenderTile::DENOISE) {
|
||||
denoise(task, denoising, tile);
|
||||
denoise(denoising, tile);
|
||||
|
||||
task.update_progress(&tile, tile.w*tile.h);
|
||||
}
|
||||
|
||||
task.release_tile(tile);
|
||||
|
@@ -1072,6 +1072,7 @@ public:
|
||||
CUarray_format_enum format;
|
||||
switch(mem.data_type) {
|
||||
case TYPE_UCHAR: format = CU_AD_FORMAT_UNSIGNED_INT8; break;
|
||||
case TYPE_UINT16: format = CU_AD_FORMAT_UNSIGNED_INT16; break;
|
||||
case TYPE_UINT: format = CU_AD_FORMAT_UNSIGNED_INT32; break;
|
||||
case TYPE_INT: format = CU_AD_FORMAT_SIGNED_INT32; break;
|
||||
case TYPE_FLOAT: format = CU_AD_FORMAT_FLOAT; break;
|
||||
@@ -1251,18 +1252,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool denoising_set_tiles(device_ptr *buffers, DenoisingTask *task)
|
||||
{
|
||||
TilesInfo *tiles = (TilesInfo*) task->tiles_mem.host_pointer;
|
||||
for(int i = 0; i < 9; i++) {
|
||||
tiles->buffers[i] = buffers[i];
|
||||
}
|
||||
|
||||
task->tiles_mem.copy_to_device();
|
||||
|
||||
return !have_error();
|
||||
}
|
||||
|
||||
#define CUDA_GET_BLOCKSIZE(func, w, h) \
|
||||
int threads_per_block; \
|
||||
cuda_assert(cuFuncGetAttribute(&threads_per_block, CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, func)); \
|
||||
@@ -1534,7 +1523,7 @@ public:
|
||||
task->rect.w-task->rect.y);
|
||||
|
||||
void *args[] = {&task->render_buffer.samples,
|
||||
&task->tiles_mem.device_pointer,
|
||||
&task->tile_info_mem.device_pointer,
|
||||
&a_ptr,
|
||||
&b_ptr,
|
||||
&sample_variance_ptr,
|
||||
@@ -1542,7 +1531,7 @@ public:
|
||||
&buffer_variance_ptr,
|
||||
&task->rect,
|
||||
&task->render_buffer.pass_stride,
|
||||
&task->render_buffer.denoising_data_offset};
|
||||
&task->render_buffer.offset};
|
||||
CUDA_LAUNCH_KERNEL(cuFilterDivideShadow, args);
|
||||
cuda_assert(cuCtxSynchronize());
|
||||
|
||||
@@ -1568,14 +1557,14 @@ public:
|
||||
task->rect.w-task->rect.y);
|
||||
|
||||
void *args[] = {&task->render_buffer.samples,
|
||||
&task->tiles_mem.device_pointer,
|
||||
&task->tile_info_mem.device_pointer,
|
||||
&mean_offset,
|
||||
&variance_offset,
|
||||
&mean_ptr,
|
||||
&variance_ptr,
|
||||
&task->rect,
|
||||
&task->render_buffer.pass_stride,
|
||||
&task->render_buffer.denoising_data_offset};
|
||||
&task->render_buffer.offset};
|
||||
CUDA_LAUNCH_KERNEL(cuFilterGetFeature, args);
|
||||
cuda_assert(cuCtxSynchronize());
|
||||
|
||||
@@ -1613,7 +1602,7 @@ public:
|
||||
return !have_error();
|
||||
}
|
||||
|
||||
void denoise(RenderTile &rtile, DenoisingTask& denoising, const DeviceTask &task)
|
||||
void denoise(RenderTile &rtile, DenoisingTask& denoising)
|
||||
{
|
||||
denoising.functions.construct_transform = function_bind(&CUDADevice::denoising_construct_transform, this, &denoising);
|
||||
denoising.functions.reconstruct = function_bind(&CUDADevice::denoising_reconstruct, this, _1, _2, _3, &denoising);
|
||||
@@ -1622,21 +1611,11 @@ public:
|
||||
denoising.functions.combine_halves = function_bind(&CUDADevice::denoising_combine_halves, this, _1, _2, _3, _4, _5, _6, &denoising);
|
||||
denoising.functions.get_feature = function_bind(&CUDADevice::denoising_get_feature, this, _1, _2, _3, _4, &denoising);
|
||||
denoising.functions.detect_outliers = function_bind(&CUDADevice::denoising_detect_outliers, this, _1, _2, _3, _4, &denoising);
|
||||
denoising.functions.set_tiles = function_bind(&CUDADevice::denoising_set_tiles, this, _1, &denoising);
|
||||
|
||||
denoising.filter_area = make_int4(rtile.x, rtile.y, rtile.w, rtile.h);
|
||||
denoising.render_buffer.samples = rtile.sample;
|
||||
|
||||
RenderTile rtiles[9];
|
||||
rtiles[4] = rtile;
|
||||
task.map_neighbor_tiles(rtiles, this);
|
||||
denoising.tiles_from_rendertiles(rtiles);
|
||||
|
||||
denoising.init_from_devicetask(task);
|
||||
|
||||
denoising.run_denoising();
|
||||
|
||||
task.unmap_neighbor_tiles(rtiles, this);
|
||||
denoising.run_denoising(&rtile);
|
||||
}
|
||||
|
||||
void path_trace(DeviceTask& task, RenderTile& rtile, device_vector<WorkTile>& work_tiles)
|
||||
@@ -2092,7 +2071,7 @@ public:
|
||||
|
||||
/* keep rendering tiles until done */
|
||||
RenderTile tile;
|
||||
DenoisingTask denoising(this);
|
||||
DenoisingTask denoising(this, *task);
|
||||
|
||||
while(task->acquire_tile(this, tile)) {
|
||||
if(tile.task == RenderTile::PATH_TRACE) {
|
||||
@@ -2107,7 +2086,7 @@ public:
|
||||
else if(tile.task == RenderTile::DENOISE) {
|
||||
tile.sample = tile.start_sample + tile.num_samples;
|
||||
|
||||
denoise(tile, denoising, *task);
|
||||
denoise(tile, denoising);
|
||||
|
||||
task->update_progress(&tile, tile.w*tile.h);
|
||||
}
|
||||
|
@@ -20,12 +20,29 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
DenoisingTask::DenoisingTask(Device *device)
|
||||
: tiles_mem(device, "denoising tiles_mem", MEM_READ_WRITE),
|
||||
DenoisingTask::DenoisingTask(Device *device, const DeviceTask &task)
|
||||
: tile_info_mem(device, "denoising tile info mem", MEM_READ_WRITE),
|
||||
storage(device),
|
||||
buffer(device),
|
||||
device(device)
|
||||
{
|
||||
radius = task.denoising_radius;
|
||||
nlm_k_2 = powf(2.0f, lerp(-5.0f, 3.0f, task.denoising_strength));
|
||||
if(task.denoising_relative_pca) {
|
||||
pca_threshold = -powf(10.0f, lerp(-8.0f, 0.0f, task.denoising_feature_strength));
|
||||
}
|
||||
else {
|
||||
pca_threshold = powf(10.0f, lerp(-5.0f, 3.0f, task.denoising_feature_strength));
|
||||
}
|
||||
|
||||
render_buffer.pass_stride = task.pass_stride;
|
||||
render_buffer.offset = task.pass_denoising_data;
|
||||
|
||||
target_buffer.pass_stride = task.pass_stride;
|
||||
target_buffer.denoising_clean_offset = task.pass_denoising_clean;
|
||||
|
||||
functions.map_neighbor_tiles = function_bind(task.map_neighbor_tiles, _1, device);
|
||||
functions.unmap_neighbor_tiles = function_bind(task.unmap_neighbor_tiles, _1, device);
|
||||
}
|
||||
|
||||
DenoisingTask::~DenoisingTask()
|
||||
@@ -38,170 +55,170 @@ DenoisingTask::~DenoisingTask()
|
||||
storage.temporary_2.free();
|
||||
storage.temporary_color.free();
|
||||
buffer.mem.free();
|
||||
tiles_mem.free();
|
||||
tile_info_mem.free();
|
||||
}
|
||||
|
||||
void DenoisingTask::init_from_devicetask(const DeviceTask &task)
|
||||
void DenoisingTask::set_render_buffer(RenderTile *rtiles)
|
||||
{
|
||||
radius = task.denoising_radius;
|
||||
nlm_k_2 = powf(2.0f, lerp(-5.0f, 3.0f, task.denoising_strength));
|
||||
if(task.denoising_relative_pca) {
|
||||
pca_threshold = -powf(10.0f, lerp(-8.0f, 0.0f, task.denoising_feature_strength));
|
||||
}
|
||||
else {
|
||||
pca_threshold = powf(10.0f, lerp(-5.0f, 3.0f, task.denoising_feature_strength));
|
||||
}
|
||||
tile_info = (TileInfo*) tile_info_mem.alloc(sizeof(TileInfo)/sizeof(int));
|
||||
|
||||
render_buffer.pass_stride = task.pass_stride;
|
||||
render_buffer.denoising_data_offset = task.pass_denoising_data;
|
||||
render_buffer.denoising_clean_offset = task.pass_denoising_clean;
|
||||
for(int i = 0; i < 9; i++) {
|
||||
tile_info->offsets[i] = rtiles[i].offset;
|
||||
tile_info->strides[i] = rtiles[i].stride;
|
||||
tile_info->buffers[i] = rtiles[i].buffer;
|
||||
}
|
||||
tile_info->x[0] = rtiles[3].x;
|
||||
tile_info->x[1] = rtiles[4].x;
|
||||
tile_info->x[2] = rtiles[5].x;
|
||||
tile_info->x[3] = rtiles[5].x + rtiles[5].w;
|
||||
tile_info->y[0] = rtiles[1].y;
|
||||
tile_info->y[1] = rtiles[4].y;
|
||||
tile_info->y[2] = rtiles[7].y;
|
||||
tile_info->y[3] = rtiles[7].y + rtiles[7].h;
|
||||
|
||||
target_buffer.offset = rtiles[9].offset;
|
||||
target_buffer.stride = rtiles[9].stride;
|
||||
target_buffer.ptr = rtiles[9].buffer;
|
||||
|
||||
tile_info_mem.copy_to_device();
|
||||
}
|
||||
|
||||
void DenoisingTask::setup_denoising_buffer()
|
||||
{
|
||||
/* Expand filter_area by radius pixels and clamp the result to the extent of the neighboring tiles */
|
||||
rect = rect_from_shape(filter_area.x, filter_area.y, filter_area.z, filter_area.w);
|
||||
rect = rect_expand(rect, radius);
|
||||
rect = rect_clip(rect, make_int4(tiles->x[0], tiles->y[0], tiles->x[3], tiles->y[3]));
|
||||
}
|
||||
rect = rect_clip(rect, make_int4(tile_info->x[0], tile_info->y[0], tile_info->x[3], tile_info->y[3]));
|
||||
|
||||
void DenoisingTask::tiles_from_rendertiles(RenderTile *rtiles)
|
||||
{
|
||||
tiles = (TilesInfo*) tiles_mem.alloc(sizeof(TilesInfo)/sizeof(int));
|
||||
|
||||
device_ptr buffers[9];
|
||||
for(int i = 0; i < 9; i++) {
|
||||
buffers[i] = rtiles[i].buffer;
|
||||
tiles->offsets[i] = rtiles[i].offset;
|
||||
tiles->strides[i] = rtiles[i].stride;
|
||||
}
|
||||
tiles->x[0] = rtiles[3].x;
|
||||
tiles->x[1] = rtiles[4].x;
|
||||
tiles->x[2] = rtiles[5].x;
|
||||
tiles->x[3] = rtiles[5].x + rtiles[5].w;
|
||||
tiles->y[0] = rtiles[1].y;
|
||||
tiles->y[1] = rtiles[4].y;
|
||||
tiles->y[2] = rtiles[7].y;
|
||||
tiles->y[3] = rtiles[7].y + rtiles[7].h;
|
||||
|
||||
render_buffer.offset = rtiles[4].offset;
|
||||
render_buffer.stride = rtiles[4].stride;
|
||||
render_buffer.ptr = rtiles[4].buffer;
|
||||
|
||||
functions.set_tiles(buffers);
|
||||
}
|
||||
|
||||
bool DenoisingTask::run_denoising()
|
||||
{
|
||||
/* Allocate denoising buffer. */
|
||||
buffer.passes = 14;
|
||||
buffer.width = rect.z - rect.x;
|
||||
buffer.stride = align_up(buffer.width, 4);
|
||||
buffer.h = rect.w - rect.y;
|
||||
buffer.pass_stride = align_up(buffer.stride * buffer.h, divide_up(device->mem_sub_ptr_alignment(), sizeof(float)));
|
||||
buffer.mem.alloc_to_device(buffer.pass_stride * buffer.passes, false);
|
||||
int alignment_floats = divide_up(device->mem_sub_ptr_alignment(), sizeof(float));
|
||||
buffer.pass_stride = align_up(buffer.stride * buffer.h, alignment_floats);
|
||||
/* Pad the total size by four floats since the SIMD kernels might go a bit over the end. */
|
||||
int mem_size = align_up(buffer.pass_stride * buffer.passes + 4, alignment_floats);
|
||||
buffer.mem.alloc_to_device(mem_size, false);
|
||||
}
|
||||
|
||||
void DenoisingTask::prefilter_shadowing()
|
||||
{
|
||||
device_ptr null_ptr = (device_ptr) 0;
|
||||
|
||||
/* Prefilter shadow feature. */
|
||||
{
|
||||
device_sub_ptr unfiltered_a (buffer.mem, 0, buffer.pass_stride);
|
||||
device_sub_ptr unfiltered_b (buffer.mem, 1*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr sample_var (buffer.mem, 2*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr sample_var_var (buffer.mem, 3*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr buffer_var (buffer.mem, 5*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr filtered_var (buffer.mem, 6*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_1(buffer.mem, 7*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_2(buffer.mem, 8*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_3(buffer.mem, 9*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr unfiltered_a (buffer.mem, 0, buffer.pass_stride);
|
||||
device_sub_ptr unfiltered_b (buffer.mem, 1*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr sample_var (buffer.mem, 2*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr sample_var_var (buffer.mem, 3*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr buffer_var (buffer.mem, 5*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr filtered_var (buffer.mem, 6*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_1(buffer.mem, 7*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_2(buffer.mem, 8*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_3(buffer.mem, 9*buffer.pass_stride, buffer.pass_stride);
|
||||
|
||||
nlm_state.temporary_1_ptr = *nlm_temporary_1;
|
||||
nlm_state.temporary_2_ptr = *nlm_temporary_2;
|
||||
nlm_state.temporary_3_ptr = *nlm_temporary_3;
|
||||
nlm_state.temporary_1_ptr = *nlm_temporary_1;
|
||||
nlm_state.temporary_2_ptr = *nlm_temporary_2;
|
||||
nlm_state.temporary_3_ptr = *nlm_temporary_3;
|
||||
|
||||
/* Get the A/B unfiltered passes, the combined sample variance, the estimated variance of the sample variance and the buffer variance. */
|
||||
functions.divide_shadow(*unfiltered_a, *unfiltered_b, *sample_var, *sample_var_var, *buffer_var);
|
||||
/* Get the A/B unfiltered passes, the combined sample variance, the estimated variance of the sample variance and the buffer variance. */
|
||||
functions.divide_shadow(*unfiltered_a, *unfiltered_b, *sample_var, *sample_var_var, *buffer_var);
|
||||
|
||||
/* Smooth the (generally pretty noisy) buffer variance using the spatial information from the sample variance. */
|
||||
nlm_state.set_parameters(6, 3, 4.0f, 1.0f);
|
||||
functions.non_local_means(*buffer_var, *sample_var, *sample_var_var, *filtered_var);
|
||||
/* Smooth the (generally pretty noisy) buffer variance using the spatial information from the sample variance. */
|
||||
nlm_state.set_parameters(6, 3, 4.0f, 1.0f);
|
||||
functions.non_local_means(*buffer_var, *sample_var, *sample_var_var, *filtered_var);
|
||||
|
||||
/* Reuse memory, the previous data isn't needed anymore. */
|
||||
device_ptr filtered_a = *buffer_var,
|
||||
filtered_b = *sample_var;
|
||||
/* Use the smoothed variance to filter the two shadow half images using each other for weight calculation. */
|
||||
nlm_state.set_parameters(5, 3, 1.0f, 0.25f);
|
||||
functions.non_local_means(*unfiltered_a, *unfiltered_b, *filtered_var, filtered_a);
|
||||
functions.non_local_means(*unfiltered_b, *unfiltered_a, *filtered_var, filtered_b);
|
||||
/* Reuse memory, the previous data isn't needed anymore. */
|
||||
device_ptr filtered_a = *buffer_var,
|
||||
filtered_b = *sample_var;
|
||||
/* Use the smoothed variance to filter the two shadow half images using each other for weight calculation. */
|
||||
nlm_state.set_parameters(5, 3, 1.0f, 0.25f);
|
||||
functions.non_local_means(*unfiltered_a, *unfiltered_b, *filtered_var, filtered_a);
|
||||
functions.non_local_means(*unfiltered_b, *unfiltered_a, *filtered_var, filtered_b);
|
||||
|
||||
device_ptr residual_var = *sample_var_var;
|
||||
/* Estimate the residual variance between the two filtered halves. */
|
||||
functions.combine_halves(filtered_a, filtered_b, null_ptr, residual_var, 2, rect);
|
||||
device_ptr residual_var = *sample_var_var;
|
||||
/* Estimate the residual variance between the two filtered halves. */
|
||||
functions.combine_halves(filtered_a, filtered_b, null_ptr, residual_var, 2, rect);
|
||||
|
||||
device_ptr final_a = *unfiltered_a,
|
||||
final_b = *unfiltered_b;
|
||||
/* Use the residual variance for a second filter pass. */
|
||||
nlm_state.set_parameters(4, 2, 1.0f, 0.5f);
|
||||
functions.non_local_means(filtered_a, filtered_b, residual_var, final_a);
|
||||
functions.non_local_means(filtered_b, filtered_a, residual_var, final_b);
|
||||
device_ptr final_a = *unfiltered_a,
|
||||
final_b = *unfiltered_b;
|
||||
/* Use the residual variance for a second filter pass. */
|
||||
nlm_state.set_parameters(4, 2, 1.0f, 0.5f);
|
||||
functions.non_local_means(filtered_a, filtered_b, residual_var, final_a);
|
||||
functions.non_local_means(filtered_b, filtered_a, residual_var, final_b);
|
||||
|
||||
/* Combine the two double-filtered halves to a final shadow feature. */
|
||||
device_sub_ptr shadow_pass(buffer.mem, 4*buffer.pass_stride, buffer.pass_stride);
|
||||
functions.combine_halves(final_a, final_b, *shadow_pass, null_ptr, 0, rect);
|
||||
/* Combine the two double-filtered halves to a final shadow feature. */
|
||||
device_sub_ptr shadow_pass(buffer.mem, 4*buffer.pass_stride, buffer.pass_stride);
|
||||
functions.combine_halves(final_a, final_b, *shadow_pass, null_ptr, 0, rect);
|
||||
}
|
||||
|
||||
void DenoisingTask::prefilter_features()
|
||||
{
|
||||
device_sub_ptr unfiltered (buffer.mem, 8*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr variance (buffer.mem, 9*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_1(buffer.mem, 10*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_2(buffer.mem, 11*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_3(buffer.mem, 12*buffer.pass_stride, buffer.pass_stride);
|
||||
|
||||
nlm_state.temporary_1_ptr = *nlm_temporary_1;
|
||||
nlm_state.temporary_2_ptr = *nlm_temporary_2;
|
||||
nlm_state.temporary_3_ptr = *nlm_temporary_3;
|
||||
|
||||
int mean_from[] = { 0, 1, 2, 12, 6, 7, 8 };
|
||||
int variance_from[] = { 3, 4, 5, 13, 9, 10, 11};
|
||||
int pass_to[] = { 1, 2, 3, 0, 5, 6, 7};
|
||||
for(int pass = 0; pass < 7; pass++) {
|
||||
device_sub_ptr feature_pass(buffer.mem, pass_to[pass]*buffer.pass_stride, buffer.pass_stride);
|
||||
/* Get the unfiltered pass and its variance from the RenderBuffers. */
|
||||
functions.get_feature(mean_from[pass], variance_from[pass], *unfiltered, *variance);
|
||||
/* Smooth the pass and store the result in the denoising buffers. */
|
||||
nlm_state.set_parameters(2, 2, 1.0f, 0.25f);
|
||||
functions.non_local_means(*unfiltered, *unfiltered, *variance, *feature_pass);
|
||||
}
|
||||
}
|
||||
|
||||
void DenoisingTask::prefilter_color()
|
||||
{
|
||||
int mean_from[] = {20, 21, 22};
|
||||
int variance_from[] = {23, 24, 25};
|
||||
int mean_to[] = { 8, 9, 10};
|
||||
int variance_to[] = {11, 12, 13};
|
||||
int num_color_passes = 3;
|
||||
|
||||
storage.temporary_color.alloc_to_device(3*buffer.pass_stride, false);
|
||||
device_sub_ptr nlm_temporary_1(storage.temporary_color, 0*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_2(storage.temporary_color, 1*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_3(storage.temporary_color, 2*buffer.pass_stride, buffer.pass_stride);
|
||||
|
||||
nlm_state.temporary_1_ptr = *nlm_temporary_1;
|
||||
nlm_state.temporary_2_ptr = *nlm_temporary_2;
|
||||
nlm_state.temporary_3_ptr = *nlm_temporary_3;
|
||||
|
||||
for(int pass = 0; pass < num_color_passes; pass++) {
|
||||
device_sub_ptr color_pass(storage.temporary_color, pass*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr color_var_pass(buffer.mem, variance_to[pass]*buffer.pass_stride, buffer.pass_stride);
|
||||
functions.get_feature(mean_from[pass], variance_from[pass], *color_pass, *color_var_pass);
|
||||
}
|
||||
|
||||
/* Prefilter general features. */
|
||||
{
|
||||
device_sub_ptr unfiltered (buffer.mem, 8*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr variance (buffer.mem, 9*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_1(buffer.mem, 10*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_2(buffer.mem, 11*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr nlm_temporary_3(buffer.mem, 12*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr depth_pass (buffer.mem, 0, buffer.pass_stride);
|
||||
device_sub_ptr color_var_pass(buffer.mem, variance_to[0]*buffer.pass_stride, 3*buffer.pass_stride);
|
||||
device_sub_ptr output_pass (buffer.mem, mean_to[0]*buffer.pass_stride, 3*buffer.pass_stride);
|
||||
functions.detect_outliers(storage.temporary_color.device_pointer, *color_var_pass, *depth_pass, *output_pass);
|
||||
|
||||
nlm_state.temporary_1_ptr = *nlm_temporary_1;
|
||||
nlm_state.temporary_2_ptr = *nlm_temporary_2;
|
||||
nlm_state.temporary_3_ptr = *nlm_temporary_3;
|
||||
|
||||
int mean_from[] = { 0, 1, 2, 12, 6, 7, 8 };
|
||||
int variance_from[] = { 3, 4, 5, 13, 9, 10, 11};
|
||||
int pass_to[] = { 1, 2, 3, 0, 5, 6, 7};
|
||||
for(int pass = 0; pass < 7; pass++) {
|
||||
device_sub_ptr feature_pass(buffer.mem, pass_to[pass]*buffer.pass_stride, buffer.pass_stride);
|
||||
/* Get the unfiltered pass and its variance from the RenderBuffers. */
|
||||
functions.get_feature(mean_from[pass], variance_from[pass], *unfiltered, *variance);
|
||||
/* Smooth the pass and store the result in the denoising buffers. */
|
||||
nlm_state.set_parameters(2, 2, 1.0f, 0.25f);
|
||||
functions.non_local_means(*unfiltered, *unfiltered, *variance, *feature_pass);
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy color passes. */
|
||||
{
|
||||
int mean_from[] = {20, 21, 22};
|
||||
int variance_from[] = {23, 24, 25};
|
||||
int mean_to[] = { 8, 9, 10};
|
||||
int variance_to[] = {11, 12, 13};
|
||||
int num_color_passes = 3;
|
||||
|
||||
storage.temporary_color.alloc_to_device(3*buffer.pass_stride, false);
|
||||
|
||||
for(int pass = 0; pass < num_color_passes; pass++) {
|
||||
device_sub_ptr color_pass(storage.temporary_color, pass*buffer.pass_stride, buffer.pass_stride);
|
||||
device_sub_ptr color_var_pass(buffer.mem, variance_to[pass]*buffer.pass_stride, buffer.pass_stride);
|
||||
functions.get_feature(mean_from[pass], variance_from[pass], *color_pass, *color_var_pass);
|
||||
}
|
||||
|
||||
{
|
||||
device_sub_ptr depth_pass (buffer.mem, 0, buffer.pass_stride);
|
||||
device_sub_ptr color_var_pass(buffer.mem, variance_to[0]*buffer.pass_stride, 3*buffer.pass_stride);
|
||||
device_sub_ptr output_pass (buffer.mem, mean_to[0]*buffer.pass_stride, 3*buffer.pass_stride);
|
||||
functions.detect_outliers(storage.temporary_color.device_pointer, *color_var_pass, *depth_pass, *output_pass);
|
||||
}
|
||||
}
|
||||
storage.temporary_color.free();
|
||||
}
|
||||
|
||||
void DenoisingTask::construct_transform()
|
||||
{
|
||||
storage.w = filter_area.z;
|
||||
storage.h = filter_area.w;
|
||||
|
||||
storage.transform.alloc_to_device(storage.w*storage.h*TRANSFORM_SIZE, false);
|
||||
storage.rank.alloc_to_device(storage.w*storage.h, false);
|
||||
|
||||
functions.construct_transform();
|
||||
}
|
||||
|
||||
void DenoisingTask::reconstruct()
|
||||
{
|
||||
|
||||
device_only_memory<float> temporary_1(device, "Denoising NLM temporary 1");
|
||||
device_only_memory<float> temporary_2(device, "Denoising NLM temporary 2");
|
||||
@@ -214,21 +231,36 @@ bool DenoisingTask::run_denoising()
|
||||
storage.XtWY.alloc_to_device(storage.w*storage.h*XTWY_SIZE, false);
|
||||
|
||||
reconstruction_state.filter_window = rect_from_shape(filter_area.x-rect.x, filter_area.y-rect.y, storage.w, storage.h);
|
||||
int tile_coordinate_offset = filter_area.y*render_buffer.stride + filter_area.x;
|
||||
reconstruction_state.buffer_params = make_int4(render_buffer.offset + tile_coordinate_offset,
|
||||
render_buffer.stride,
|
||||
render_buffer.pass_stride,
|
||||
render_buffer.denoising_clean_offset);
|
||||
int tile_coordinate_offset = filter_area.y*target_buffer.stride + filter_area.x;
|
||||
reconstruction_state.buffer_params = make_int4(target_buffer.offset + tile_coordinate_offset,
|
||||
target_buffer.stride,
|
||||
target_buffer.pass_stride,
|
||||
target_buffer.denoising_clean_offset);
|
||||
reconstruction_state.source_w = rect.z-rect.x;
|
||||
reconstruction_state.source_h = rect.w-rect.y;
|
||||
|
||||
{
|
||||
device_sub_ptr color_ptr (buffer.mem, 8*buffer.pass_stride, 3*buffer.pass_stride);
|
||||
device_sub_ptr color_var_ptr(buffer.mem, 11*buffer.pass_stride, 3*buffer.pass_stride);
|
||||
functions.reconstruct(*color_ptr, *color_var_ptr, render_buffer.ptr);
|
||||
}
|
||||
device_sub_ptr color_ptr (buffer.mem, 8*buffer.pass_stride, 3*buffer.pass_stride);
|
||||
device_sub_ptr color_var_ptr(buffer.mem, 11*buffer.pass_stride, 3*buffer.pass_stride);
|
||||
functions.reconstruct(*color_ptr, *color_var_ptr, target_buffer.ptr);
|
||||
}
|
||||
|
||||
return true;
|
||||
void DenoisingTask::run_denoising(RenderTile *tile)
|
||||
{
|
||||
RenderTile rtiles[10];
|
||||
rtiles[4] = *tile;
|
||||
functions.map_neighbor_tiles(rtiles);
|
||||
set_render_buffer(rtiles);
|
||||
|
||||
setup_denoising_buffer();
|
||||
|
||||
prefilter_shadowing();
|
||||
prefilter_features();
|
||||
prefilter_color();
|
||||
|
||||
construct_transform();
|
||||
reconstruct();
|
||||
|
||||
functions.unmap_neighbor_tiles(rtiles);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -32,20 +32,24 @@ public:
|
||||
float nlm_k_2;
|
||||
float pca_threshold;
|
||||
|
||||
/* Pointer and parameters of the RenderBuffers. */
|
||||
/* Parameters of the RenderBuffers. */
|
||||
struct RenderBuffers {
|
||||
int denoising_data_offset;
|
||||
int denoising_clean_offset;
|
||||
int pass_stride;
|
||||
int offset;
|
||||
int stride;
|
||||
device_ptr ptr;
|
||||
int pass_stride;
|
||||
int samples;
|
||||
} render_buffer;
|
||||
|
||||
TilesInfo *tiles;
|
||||
device_vector<int> tiles_mem;
|
||||
void tiles_from_rendertiles(RenderTile *rtiles);
|
||||
/* Pointer and parameters of the target buffer. */
|
||||
struct TargetBuffer {
|
||||
int offset;
|
||||
int stride;
|
||||
int pass_stride;
|
||||
int denoising_clean_offset;
|
||||
device_ptr ptr;
|
||||
} target_buffer;
|
||||
|
||||
TileInfo *tile_info;
|
||||
device_vector<int> tile_info_mem;
|
||||
|
||||
int4 rect;
|
||||
int4 filter_area;
|
||||
@@ -85,7 +89,8 @@ public:
|
||||
device_ptr depth_ptr,
|
||||
device_ptr output_ptr
|
||||
)> detect_outliers;
|
||||
function<bool(device_ptr*)> set_tiles;
|
||||
function<void(RenderTile *rtiles)> map_neighbor_tiles;
|
||||
function<void(RenderTile *rtiles)> unmap_neighbor_tiles;
|
||||
} functions;
|
||||
|
||||
/* Stores state of the current Reconstruction operation,
|
||||
@@ -138,12 +143,10 @@ public:
|
||||
{}
|
||||
} storage;
|
||||
|
||||
DenoisingTask(Device *device);
|
||||
DenoisingTask(Device *device, const DeviceTask &task);
|
||||
~DenoisingTask();
|
||||
|
||||
void init_from_devicetask(const DeviceTask &task);
|
||||
|
||||
bool run_denoising();
|
||||
void run_denoising(RenderTile *tile);
|
||||
|
||||
struct DenoiseBuffers {
|
||||
int pass_stride;
|
||||
@@ -160,6 +163,14 @@ public:
|
||||
|
||||
protected:
|
||||
Device *device;
|
||||
|
||||
void set_render_buffer(RenderTile *rtiles);
|
||||
void setup_denoising_buffer();
|
||||
void prefilter_shadowing();
|
||||
void prefilter_features();
|
||||
void prefilter_color();
|
||||
void construct_transform();
|
||||
void reconstruct();
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -41,4 +41,3 @@ string device_cuda_capabilities(void);
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __DEVICE_INTERN_H__ */
|
||||
|
||||
|
@@ -104,6 +104,26 @@ void device_memory::device_zero()
|
||||
}
|
||||
}
|
||||
|
||||
void device_memory::swap_device(Device *new_device,
|
||||
size_t new_device_size,
|
||||
device_ptr new_device_ptr)
|
||||
{
|
||||
original_device = device;
|
||||
original_device_size = device_size;
|
||||
original_device_ptr = device_pointer;
|
||||
|
||||
device = new_device;
|
||||
device_size = new_device_size;
|
||||
device_pointer = new_device_ptr;
|
||||
}
|
||||
|
||||
void device_memory::restore_device()
|
||||
{
|
||||
device = original_device;
|
||||
device_size = original_device_size;
|
||||
device_pointer = original_device_ptr;
|
||||
}
|
||||
|
||||
/* Device Sub Ptr */
|
||||
|
||||
device_sub_ptr::device_sub_ptr(device_memory& mem, int offset, int size)
|
||||
@@ -118,4 +138,3 @@ device_sub_ptr::~device_sub_ptr()
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -43,6 +43,7 @@ enum MemoryType {
|
||||
enum DataType {
|
||||
TYPE_UNKNOWN,
|
||||
TYPE_UCHAR,
|
||||
TYPE_UINT16,
|
||||
TYPE_UINT,
|
||||
TYPE_INT,
|
||||
TYPE_FLOAT,
|
||||
@@ -50,13 +51,14 @@ enum DataType {
|
||||
TYPE_UINT64,
|
||||
};
|
||||
|
||||
static inline size_t datatype_size(DataType datatype)
|
||||
static inline size_t datatype_size(DataType datatype)
|
||||
{
|
||||
switch(datatype) {
|
||||
case TYPE_UNKNOWN: return 1;
|
||||
case TYPE_UCHAR: return sizeof(uchar);
|
||||
case TYPE_FLOAT: return sizeof(float);
|
||||
case TYPE_UINT: return sizeof(uint);
|
||||
case TYPE_UINT16: return sizeof(uint16_t);
|
||||
case TYPE_INT: return sizeof(int);
|
||||
case TYPE_HALF: return sizeof(half);
|
||||
case TYPE_UINT64: return sizeof(uint64_t);
|
||||
@@ -156,6 +158,16 @@ template<> struct device_type_traits<half> {
|
||||
static const int num_elements = 1;
|
||||
};
|
||||
|
||||
template<> struct device_type_traits<ushort4> {
|
||||
static const DataType data_type = TYPE_UINT16;
|
||||
static const int num_elements = 4;
|
||||
};
|
||||
|
||||
template<> struct device_type_traits<uint16_t> {
|
||||
static const DataType data_type = TYPE_UINT16;
|
||||
static const int num_elements = 1;
|
||||
};
|
||||
|
||||
template<> struct device_type_traits<half4> {
|
||||
static const DataType data_type = TYPE_HALF;
|
||||
static const int num_elements = 4;
|
||||
@@ -200,6 +212,9 @@ public:
|
||||
|
||||
virtual ~device_memory();
|
||||
|
||||
void swap_device(Device *new_device, size_t new_device_size, device_ptr new_device_ptr);
|
||||
void restore_device();
|
||||
|
||||
protected:
|
||||
friend class CUDADevice;
|
||||
|
||||
@@ -222,6 +237,10 @@ protected:
|
||||
void device_copy_to();
|
||||
void device_copy_from(int y, int w, int h, int elem);
|
||||
void device_zero();
|
||||
|
||||
device_ptr original_device_ptr;
|
||||
size_t original_device_size;
|
||||
Device *original_device;
|
||||
};
|
||||
|
||||
/* Device Only Memory
|
||||
@@ -478,4 +497,3 @@ protected:
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __DEVICE_MEMORY_H__ */
|
||||
|
||||
|
@@ -285,26 +285,27 @@ public:
|
||||
mem.copy_from_device(0, mem.data_size, 1);
|
||||
}
|
||||
|
||||
Device *original_device = mem.device;
|
||||
device_ptr original_ptr = mem.device_pointer;
|
||||
size_t original_size = mem.device_size;
|
||||
|
||||
mem.device = sub_device;
|
||||
mem.device_pointer = 0;
|
||||
mem.device_size = 0;
|
||||
mem.swap_device(sub_device, 0, 0);
|
||||
|
||||
mem.copy_to_device();
|
||||
tiles[i].buffer = mem.device_pointer;
|
||||
tiles[i].device_size = mem.device_size;
|
||||
|
||||
mem.device = original_device;
|
||||
mem.device_pointer = original_ptr;
|
||||
mem.device_size = original_size;
|
||||
mem.restore_device();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void unmap_neighbor_tiles(Device * sub_device, RenderTile * tiles)
|
||||
{
|
||||
/* Copy denoised result back to the host. */
|
||||
device_vector<float> &mem = tiles[9].buffers->buffer;
|
||||
mem.swap_device(sub_device, tiles[9].device_size, tiles[9].buffer);
|
||||
mem.copy_from_device(0, mem.data_size, 1);
|
||||
mem.restore_device();
|
||||
/* Copy denoised result to the original device. */
|
||||
mem.copy_to_device();
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
if(!tiles[i].buffers) {
|
||||
continue;
|
||||
@@ -312,28 +313,9 @@ public:
|
||||
|
||||
device_vector<float> &mem = tiles[i].buffers->buffer;
|
||||
if(mem.device != sub_device) {
|
||||
Device *original_device = mem.device;
|
||||
device_ptr original_ptr = mem.device_pointer;
|
||||
size_t original_size = mem.device_size;
|
||||
|
||||
mem.device = sub_device;
|
||||
mem.device_pointer = tiles[i].buffer;
|
||||
|
||||
/* Copy denoised tile to the host. */
|
||||
if(i == 4) {
|
||||
mem.copy_from_device(0, mem.data_size, 1);
|
||||
}
|
||||
|
||||
mem.swap_device(sub_device, tiles[i].device_size, tiles[i].buffer);
|
||||
sub_device->mem_free(mem);
|
||||
|
||||
mem.device = original_device;
|
||||
mem.device_pointer = original_ptr;
|
||||
mem.device_size = original_size;
|
||||
|
||||
/* Copy denoised tile to the original device. */
|
||||
if(i == 4) {
|
||||
mem.copy_to_device();
|
||||
}
|
||||
mem.restore_device();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -397,4 +379,3 @@ Device *device_multi_create(DeviceInfo& info, Stats &stats, bool background)
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -797,5 +797,3 @@ void Device::server_run()
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -179,7 +179,7 @@ public:
|
||||
boost::asio::write(socket,
|
||||
boost::asio::buffer(archive_str),
|
||||
boost::asio::transfer_all(), error);
|
||||
|
||||
|
||||
if(error.value())
|
||||
error_func->network_error(error.message());
|
||||
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
boost::asio::write(socket,
|
||||
boost::asio::buffer(buffer, size),
|
||||
boost::asio::transfer_all(), error);
|
||||
|
||||
|
||||
if(error.value())
|
||||
error_func->network_error(error.message());
|
||||
}
|
||||
@@ -467,7 +467,7 @@ private:
|
||||
/* buffer and endpoint for receiving messages */
|
||||
char receive_buffer[256];
|
||||
boost::asio::ip::udp::endpoint receive_endpoint;
|
||||
|
||||
|
||||
// os, version, devices, status, host name, group name, ip as far as fields go
|
||||
struct ServerInfo {
|
||||
string cycles_version;
|
||||
@@ -489,4 +489,3 @@ CCL_NAMESPACE_END
|
||||
#endif
|
||||
|
||||
#endif /* __DEVICE_NETWORK_H__ */
|
||||
|
||||
|
@@ -137,6 +137,10 @@ void device_opencl_info(vector<DeviceInfo>& devices)
|
||||
info.has_volume_decoupled = false;
|
||||
info.bvh_layout_mask = BVH_LAYOUT_BVH2;
|
||||
info.id = id;
|
||||
|
||||
/* Check OpenCL extensions */
|
||||
info.has_half_images = platform_device.device_extensions.find("cl_khr_fp16") != string::npos;
|
||||
|
||||
devices.push_back(info);
|
||||
num_devices++;
|
||||
}
|
||||
|
@@ -261,7 +261,7 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
|
||||
ENQUEUE_SPLIT_KERNEL(buffer_update, global_size, local_size);
|
||||
|
||||
if(task->get_cancel() && cancel_time == DBL_MAX) {
|
||||
/* Wait up to twice as many seconds for current samples to finish
|
||||
/* Wait up to twice as many seconds for current samples to finish
|
||||
* to avoid artifacts in render result from ending too soon.
|
||||
*/
|
||||
cancel_time = time_dt() + 2.0 * time_multiplier;
|
||||
@@ -322,5 +322,3 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
||||
|
@@ -131,6 +131,3 @@ public:
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __DEVICE_SPLIT_KERNEL_H__ */
|
||||
|
||||
|
||||
|
||||
|
@@ -126,4 +126,3 @@ void DeviceTask::update_progress(RenderTile *rtile, int pixel_samples)
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -86,4 +86,3 @@ protected:
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __DEVICE_TASK_H__ */
|
||||
|
||||
|
@@ -254,4 +254,3 @@ void MemoryManager::set_kernel_arg_buffers(cl_kernel kernel, cl_uint *narg)
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* WITH_OPENCL */
|
||||
|
||||
|
@@ -104,4 +104,3 @@ public:
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -59,19 +59,22 @@ struct OpenCLPlatformDevice {
|
||||
cl_device_id device_id,
|
||||
cl_device_type device_type,
|
||||
const string& device_name,
|
||||
const string& hardware_id)
|
||||
const string& hardware_id,
|
||||
const string& device_extensions)
|
||||
: platform_id(platform_id),
|
||||
platform_name(platform_name),
|
||||
device_id(device_id),
|
||||
device_type(device_type),
|
||||
device_name(device_name),
|
||||
hardware_id(hardware_id) {}
|
||||
hardware_id(hardware_id),
|
||||
device_extensions(device_extensions) {}
|
||||
cl_platform_id platform_id;
|
||||
string platform_name;
|
||||
cl_device_id device_id;
|
||||
cl_device_type device_type;
|
||||
string device_name;
|
||||
string hardware_id;
|
||||
string device_extensions;
|
||||
};
|
||||
|
||||
/* Contains all static OpenCL helper functions. */
|
||||
@@ -130,6 +133,12 @@ public:
|
||||
|
||||
static string get_device_name(cl_device_id device_id);
|
||||
|
||||
static bool get_device_extensions(cl_device_id device_id,
|
||||
string *device_extensions,
|
||||
cl_int* error = NULL);
|
||||
|
||||
static string get_device_extensions(cl_device_id device_id);
|
||||
|
||||
static bool get_device_type(cl_device_id device_id,
|
||||
cl_device_type *device_type,
|
||||
cl_int* error = NULL);
|
||||
@@ -362,7 +371,7 @@ public:
|
||||
void film_convert(DeviceTask& task, device_ptr buffer, device_ptr rgba_byte, device_ptr rgba_half);
|
||||
void shader(DeviceTask& task);
|
||||
|
||||
void denoise(RenderTile& tile, DenoisingTask& denoising, const DeviceTask& task);
|
||||
void denoise(RenderTile& tile, DenoisingTask& denoising);
|
||||
|
||||
class OpenCLDeviceTask : public DeviceTask {
|
||||
public:
|
||||
@@ -436,8 +445,6 @@ protected:
|
||||
device_ptr depth_ptr,
|
||||
device_ptr output_ptr,
|
||||
DenoisingTask *task);
|
||||
bool denoising_set_tiles(device_ptr *buffers,
|
||||
DenoisingTask *task);
|
||||
|
||||
device_ptr mem_alloc_sub_ptr(device_memory& mem, int offset, int size);
|
||||
void mem_free_sub_ptr(device_ptr ptr);
|
||||
|
@@ -246,7 +246,6 @@ bool OpenCLDeviceBase::load_kernels(const DeviceRequestedFeatures& requested_fea
|
||||
denoising_program.add_kernel(ustring("filter_nlm_normalize"));
|
||||
denoising_program.add_kernel(ustring("filter_nlm_construct_gramian"));
|
||||
denoising_program.add_kernel(ustring("filter_finalize"));
|
||||
denoising_program.add_kernel(ustring("filter_set_tiles"));
|
||||
|
||||
vector<OpenCLProgram*> programs;
|
||||
programs.push_back(&base_program);
|
||||
@@ -977,13 +976,20 @@ bool OpenCLDeviceBase::denoising_divide_shadow(device_ptr a_ptr,
|
||||
cl_mem sv_variance_mem = CL_MEM_PTR(sv_variance_ptr);
|
||||
cl_mem buffer_variance_mem = CL_MEM_PTR(buffer_variance_ptr);
|
||||
|
||||
cl_mem tiles_mem = CL_MEM_PTR(task->tiles_mem.device_pointer);
|
||||
cl_mem tile_info_mem = CL_MEM_PTR(task->tile_info_mem.device_pointer);
|
||||
|
||||
cl_kernel ckFilterDivideShadow = denoising_program(ustring("filter_divide_shadow"));
|
||||
|
||||
kernel_set_args(ckFilterDivideShadow, 0,
|
||||
task->render_buffer.samples,
|
||||
tiles_mem,
|
||||
int arg_ofs = kernel_set_args(ckFilterDivideShadow, 0,
|
||||
task->render_buffer.samples,
|
||||
tile_info_mem);
|
||||
cl_mem buffers[9];
|
||||
for(int i = 0; i < 9; i++) {
|
||||
buffers[i] = CL_MEM_PTR(task->tile_info->buffers[i]);
|
||||
arg_ofs += kernel_set_args(ckFilterDivideShadow, arg_ofs,
|
||||
buffers[i]);
|
||||
}
|
||||
kernel_set_args(ckFilterDivideShadow, arg_ofs,
|
||||
a_mem,
|
||||
b_mem,
|
||||
sample_variance_mem,
|
||||
@@ -991,7 +997,7 @@ bool OpenCLDeviceBase::denoising_divide_shadow(device_ptr a_ptr,
|
||||
buffer_variance_mem,
|
||||
task->rect,
|
||||
task->render_buffer.pass_stride,
|
||||
task->render_buffer.denoising_data_offset);
|
||||
task->render_buffer.offset);
|
||||
enqueue_kernel(ckFilterDivideShadow,
|
||||
task->rect.z-task->rect.x,
|
||||
task->rect.w-task->rect.y);
|
||||
@@ -1008,20 +1014,27 @@ bool OpenCLDeviceBase::denoising_get_feature(int mean_offset,
|
||||
cl_mem mean_mem = CL_MEM_PTR(mean_ptr);
|
||||
cl_mem variance_mem = CL_MEM_PTR(variance_ptr);
|
||||
|
||||
cl_mem tiles_mem = CL_MEM_PTR(task->tiles_mem.device_pointer);
|
||||
cl_mem tile_info_mem = CL_MEM_PTR(task->tile_info_mem.device_pointer);
|
||||
|
||||
cl_kernel ckFilterGetFeature = denoising_program(ustring("filter_get_feature"));
|
||||
|
||||
kernel_set_args(ckFilterGetFeature, 0,
|
||||
task->render_buffer.samples,
|
||||
tiles_mem,
|
||||
int arg_ofs = kernel_set_args(ckFilterGetFeature, 0,
|
||||
task->render_buffer.samples,
|
||||
tile_info_mem);
|
||||
cl_mem buffers[9];
|
||||
for(int i = 0; i < 9; i++) {
|
||||
buffers[i] = CL_MEM_PTR(task->tile_info->buffers[i]);
|
||||
arg_ofs += kernel_set_args(ckFilterGetFeature, arg_ofs,
|
||||
buffers[i]);
|
||||
}
|
||||
kernel_set_args(ckFilterGetFeature, arg_ofs,
|
||||
mean_offset,
|
||||
variance_offset,
|
||||
mean_mem,
|
||||
variance_mem,
|
||||
task->rect,
|
||||
task->render_buffer.pass_stride,
|
||||
task->render_buffer.denoising_data_offset);
|
||||
task->render_buffer.offset);
|
||||
enqueue_kernel(ckFilterGetFeature,
|
||||
task->rect.z-task->rect.x,
|
||||
task->rect.w-task->rect.y);
|
||||
@@ -1056,29 +1069,8 @@ bool OpenCLDeviceBase::denoising_detect_outliers(device_ptr image_ptr,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenCLDeviceBase::denoising_set_tiles(device_ptr *buffers,
|
||||
DenoisingTask *task)
|
||||
void OpenCLDeviceBase::denoise(RenderTile &rtile, DenoisingTask& denoising)
|
||||
{
|
||||
task->tiles_mem.copy_to_device();
|
||||
|
||||
cl_mem tiles_mem = CL_MEM_PTR(task->tiles_mem.device_pointer);
|
||||
|
||||
cl_kernel ckFilterSetTiles = denoising_program(ustring("filter_set_tiles"));
|
||||
|
||||
kernel_set_args(ckFilterSetTiles, 0, tiles_mem);
|
||||
for(int i = 0; i < 9; i++) {
|
||||
cl_mem buffer_mem = CL_MEM_PTR(buffers[i]);
|
||||
kernel_set_args(ckFilterSetTiles, i+1, buffer_mem);
|
||||
}
|
||||
|
||||
enqueue_kernel(ckFilterSetTiles, 1, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OpenCLDeviceBase::denoise(RenderTile &rtile, DenoisingTask& denoising, const DeviceTask &task)
|
||||
{
|
||||
denoising.functions.set_tiles = function_bind(&OpenCLDeviceBase::denoising_set_tiles, this, _1, &denoising);
|
||||
denoising.functions.construct_transform = function_bind(&OpenCLDeviceBase::denoising_construct_transform, this, &denoising);
|
||||
denoising.functions.reconstruct = function_bind(&OpenCLDeviceBase::denoising_reconstruct, this, _1, _2, _3, &denoising);
|
||||
denoising.functions.divide_shadow = function_bind(&OpenCLDeviceBase::denoising_divide_shadow, this, _1, _2, _3, _4, _5, &denoising);
|
||||
@@ -1090,16 +1082,7 @@ void OpenCLDeviceBase::denoise(RenderTile &rtile, DenoisingTask& denoising, cons
|
||||
denoising.filter_area = make_int4(rtile.x, rtile.y, rtile.w, rtile.h);
|
||||
denoising.render_buffer.samples = rtile.sample;
|
||||
|
||||
RenderTile rtiles[9];
|
||||
rtiles[4] = rtile;
|
||||
task.map_neighbor_tiles(rtiles, this);
|
||||
denoising.tiles_from_rendertiles(rtiles);
|
||||
|
||||
denoising.init_from_devicetask(task);
|
||||
|
||||
denoising.run_denoising();
|
||||
|
||||
task.unmap_neighbor_tiles(rtiles, this);
|
||||
denoising.run_denoising(&rtile);
|
||||
}
|
||||
|
||||
void OpenCLDeviceBase::shader(DeviceTask& task)
|
||||
|
@@ -107,7 +107,7 @@ public:
|
||||
}
|
||||
else if(task->type == DeviceTask::RENDER) {
|
||||
RenderTile tile;
|
||||
DenoisingTask denoising(this);
|
||||
DenoisingTask denoising(this, *task);
|
||||
|
||||
/* Keep rendering tiles until done. */
|
||||
while(task->acquire_tile(this, tile)) {
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
}
|
||||
else if(tile.task == RenderTile::DENOISE) {
|
||||
tile.sample = tile.start_sample + tile.num_samples;
|
||||
denoise(tile, denoising, *task);
|
||||
denoise(tile, denoising);
|
||||
task->update_progress(&tile, tile.w*tile.h);
|
||||
}
|
||||
|
||||
|
@@ -129,7 +129,7 @@ public:
|
||||
}
|
||||
else if(task->type == DeviceTask::RENDER) {
|
||||
RenderTile tile;
|
||||
DenoisingTask denoising(this);
|
||||
DenoisingTask denoising(this, *task);
|
||||
|
||||
/* Allocate buffer for kernel globals */
|
||||
device_only_memory<KernelGlobalsDummy> kgbuffer(this, "kernel_globals");
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
}
|
||||
else if(tile.task == RenderTile::DENOISE) {
|
||||
tile.sample = tile.start_sample + tile.num_samples;
|
||||
denoise(tile, denoising, *task);
|
||||
denoise(tile, denoising);
|
||||
task->update_progress(&tile, tile.w*tile.h);
|
||||
}
|
||||
|
||||
|
@@ -831,13 +831,15 @@ void OpenCLInfo::get_usable_devices(vector<OpenCLPlatformDevice> *usable_devices
|
||||
FIRST_VLOG(2) << "Adding new device "
|
||||
<< readable_device_name << ".";
|
||||
string hardware_id = get_hardware_id(platform_name, device_id);
|
||||
string device_extensions = get_device_extensions(device_id);
|
||||
usable_devices->push_back(OpenCLPlatformDevice(
|
||||
platform_id,
|
||||
platform_name,
|
||||
device_id,
|
||||
device_type,
|
||||
readable_device_name,
|
||||
hardware_id));
|
||||
hardware_id,
|
||||
device_extensions));
|
||||
}
|
||||
else {
|
||||
FIRST_VLOG(2) << "Ignoring device " << device_name
|
||||
@@ -1047,6 +1049,40 @@ string OpenCLInfo::get_device_name(cl_device_id device_id)
|
||||
return device_name;
|
||||
}
|
||||
|
||||
bool OpenCLInfo::get_device_extensions(cl_device_id device_id,
|
||||
string *device_extensions,
|
||||
cl_int* error)
|
||||
{
|
||||
char buffer[1024];
|
||||
cl_int err;
|
||||
if((err = clGetDeviceInfo(device_id,
|
||||
CL_DEVICE_EXTENSIONS,
|
||||
sizeof(buffer),
|
||||
&buffer,
|
||||
NULL)) != CL_SUCCESS)
|
||||
{
|
||||
if(error != NULL) {
|
||||
*error = err;
|
||||
}
|
||||
*device_extensions = "";
|
||||
return false;
|
||||
}
|
||||
if(error != NULL) {
|
||||
*error = CL_SUCCESS;
|
||||
}
|
||||
*device_extensions = buffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
string OpenCLInfo::get_device_extensions(cl_device_id device_id)
|
||||
{
|
||||
string device_extensions;
|
||||
if(!get_device_extensions(device_id, &device_extensions)) {
|
||||
return "";
|
||||
}
|
||||
return device_extensions;
|
||||
}
|
||||
|
||||
bool OpenCLInfo::get_device_type(cl_device_id device_id,
|
||||
cl_device_type *device_type,
|
||||
cl_int* error)
|
||||
|
@@ -200,4 +200,3 @@
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
@@ -13,7 +13,7 @@ met:
|
||||
distribution.
|
||||
* Neither the name of Industrial Light & Magic nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
@@ -26,4 +26,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
@@ -33,4 +33,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
@@ -25,4 +25,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
@@ -26,4 +26,3 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
@@ -13,4 +13,3 @@ MIT license
|
||||
|
||||
Boost License
|
||||
* Boost and OpenCL dynamic loading
|
||||
|
||||
|
@@ -20,4 +20,3 @@ include_directories(${INC})
|
||||
include_directories(SYSTEM ${INC_SYS})
|
||||
|
||||
cycles_add_library(cycles_graph ${SRC} ${SRC_HEADERS})
|
||||
|
||||
|
@@ -496,4 +496,3 @@ void Node::hash(MD5Hash& md5)
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -97,4 +97,3 @@ struct Node
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -45,4 +45,3 @@ private:
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -217,4 +217,3 @@ const NodeType *NodeType::find(ustring name)
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -263,4 +263,3 @@ const NodeType *structname::register_type()
|
||||
{ type->register_output(ustring(#name), ustring(ui_name), SocketType::ENUM); }
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -458,4 +458,3 @@ xml_node xml_write_node(Node *node, xml_node xml_root)
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -32,4 +32,3 @@ void xml_read_node(XMLReader& reader, Node *node, xml_node xml_node);
|
||||
xml_node xml_write_node(Node *node, xml_node xml_root);
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -287,6 +287,7 @@ set(SRC_UTIL_HEADERS
|
||||
../util/util_types_uint3_impl.h
|
||||
../util/util_types_uint4.h
|
||||
../util/util_types_uint4_impl.h
|
||||
../util/util_types_ushort4.h
|
||||
../util/util_types_vector3.h
|
||||
../util/util_types_vector3_impl.h
|
||||
)
|
||||
@@ -520,4 +521,3 @@ delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SVM_HEADERS}" ${CYCLES_INSTAL
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_GEOM_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/geom)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/source/util)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SPLIT_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/split)
|
||||
|
||||
|
@@ -486,4 +486,3 @@ ccl_device bool bsdf_merge(ShaderClosure *a, ShaderClosure *b)
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
|
@@ -117,7 +117,7 @@ ccl_device_forceinline float3 bsdf_ashikhmin_shirley_eval_reflect(
|
||||
lobe = 1.0f;
|
||||
}
|
||||
float norm = sqrtf((n_x + 1.0f)*(n_y + 1.0f)) / (8.0f * M_PI_F);
|
||||
|
||||
|
||||
out = NdotO * norm * lobe * pump;
|
||||
*pdf = norm * lobe / HdotI;
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Modifications Copyright 2011, Blender Foundation.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
@@ -46,7 +46,7 @@ ccl_device int bsdf_ashikhmin_velvet_setup(VelvetBsdf *bsdf)
|
||||
{
|
||||
float sigma = fmaxf(bsdf->sigma, 0.01f);
|
||||
bsdf->invsigma2 = 1.0f/(sigma * sigma);
|
||||
|
||||
|
||||
bsdf->type = CLOSURE_BSDF_ASHIKHMIN_VELVET_ID;
|
||||
|
||||
return SD_BSDF|SD_BSDF_HAS_EVAL;
|
||||
@@ -159,4 +159,3 @@ ccl_device int bsdf_ashikhmin_velvet_sample(const ShaderClosure *sc, float3 Ng,
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __BSDF_ASHIKHMIN_VELVET_H__ */
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user