Compare commits
246 Commits
temp-geome
...
soc-2012-b
Author | SHA1 | Date | |
---|---|---|---|
d8e2ed8ae2 | |||
5323a2f18f | |||
c112e1b796 | |||
4e39a8f939 | |||
803c462f04 | |||
cd47ae2f98 | |||
2d836dbd06 | |||
2ea6bce72b | |||
97da892ed1 | |||
fad0a9954e | |||
db15c04783 | |||
4414509071 | |||
11b0aadf8c | |||
d0a4234d6d | |||
0eb51702d4 | |||
19885babaf | |||
78f393f0c3 | |||
1f40c0ffa7 | |||
522af38d6a | |||
892ccaea80 | |||
74f0263a1f | |||
43a2baa935 | |||
09b53a5e4e | |||
14eb8a895c | |||
a5616dff7f | |||
534d106cfa | |||
30d31089db | |||
08010511b0 | |||
d664ae35f8 | |||
8b7021c56a | |||
5d12b5c4f3 | |||
0c128dec7c | |||
43e4e3f451 | |||
85400cf7cb | |||
539c3d296d | |||
30fda0216b | |||
a71155ec95 | |||
778938ee1f | |||
df6683c4c5 | |||
942a5545c0 | |||
5013881074 | |||
2fc95ffbde | |||
89b241304f | |||
028634c9ab | |||
32c51654c0 | |||
4c0bda38b9 | |||
205f24b8a3 | |||
1c304e27a4 | |||
5b17058430 | |||
cdb83471a3 | |||
2000254119 | |||
243927d20a | |||
1cf0edb370 | |||
56c8076d56 | |||
966d54d07d | |||
ff8441dcd7 | |||
7a3054126c | |||
d048fd36a8 | |||
5d7915ace9 | |||
7ae476991c | |||
4fdf7d431e | |||
10ddbd2a76 | |||
15112dc8b0 | |||
142492f066 | |||
a891ac3ce8 | |||
ca2b7d6fa5 | |||
35b1591bd4 | |||
d4ff8f911c | |||
4ae1d51db5 | |||
02fb1cf686 | |||
9a11885c70 | |||
af175013c7 | |||
a5c99a57e8 | |||
dcc59e5b52 | |||
f1828714a8 | |||
1e44465c0f | |||
193e6ab816 | |||
257931bba1 | |||
bf24b557ed | |||
9d1c214ca7 | |||
22bb90d57d | |||
b14202c8fe | |||
2d2b64a7f0 | |||
a508c58793 | |||
9f07335efb | |||
fc5fd8ed0e | |||
e9eab8e661 | |||
2a3d6244b1 | |||
d22172c0ef | |||
8626f05626 | |||
d7e8d13e6a | |||
be268b9baf | |||
27c2af959c | |||
b2afee8546 | |||
9057600e70 | |||
b749aad05d | |||
2d434f61f5 | |||
2b5eafe9c9 | |||
c25a23c81f | |||
fbb0a2e33d | |||
e333cd9e59 | |||
8fce748a21 | |||
93abfa3b02 | |||
f995e4c71e | |||
e13791655b | |||
4b3eea4b81 | |||
d714ccaeb3 | |||
cbcc618a33 | |||
fd321a01ab | |||
656a8d276b | |||
ea0047d2aa | |||
a1083934f4 | |||
07300856cd | |||
ca2e5347c5 | |||
b5c7bd26ac | |||
b07a8126c7 | |||
d99651defe | |||
1f0b0ef6ad | |||
b98cb11d22 | |||
522fa17972 | |||
3a20f5ce45 | |||
45c6d10a2d | |||
a9bbf4d3df | |||
6b2cb71552 | |||
4ad64e7547 | |||
66f571f824 | |||
e200e360f6 | |||
d6c8adcef8 | |||
28c15e1735 | |||
061763d18d | |||
3eda0f35bb | |||
33295c43d1 | |||
0045c579c3 | |||
111ed9852b | |||
b20ddef743 | |||
295ab026d8 | |||
0caf9d4ac7 | |||
079e43a35e | |||
78f3454833 | |||
f5b358ea00 | |||
0a584f991d | |||
63c3221343 | |||
861592eb05 | |||
1083be35cf | |||
f2dabad45b | |||
bf50e84c1f | |||
1191e4dfc5 | |||
21d5e29ae4 | |||
dfa5cefbb2 | |||
5b1ae63f4c | |||
dd2475fce6 | |||
d281a2621a | |||
b6d13803c6 | |||
5fb5a1e262 | |||
f0ab977f0b | |||
5e38ae4d1f | |||
fae40f3218 | |||
4f79b0f058 | |||
2777cd63eb | |||
5b5fa99578 | |||
01d6919dc6 | |||
0d59599afd | |||
d8f1a71f46 | |||
0c4bdde377 | |||
fc8ed3855a | |||
e8e131171e | |||
a37e9d2b09 | |||
c60787634c | |||
50bf24a903 | |||
6a86d86c99 | |||
d7b3f43807 | |||
2940b11668 | |||
ba693b08c5 | |||
8c626fe487 | |||
5468474e1d | |||
43c5b2903e | |||
cb87b8b3f7 | |||
7b183d0ed1 | |||
ee7ba49462 | |||
aa7db6c9cb | |||
5aeb130df6 | |||
e03c1adfa9 | |||
c8a1077264 | |||
46f66fe5fd | |||
f287c1d04c | |||
5b32f6a210 | |||
833f3262eb | |||
f2810202e8 | |||
53fc210dd3 | |||
61db28bef7 | |||
5c0b0765a1 | |||
8f0c324db4 | |||
b47344d5e1 | |||
9effec5f26 | |||
e0976e3b0f | |||
6b0c7a76e7 | |||
aa637b4b53 | |||
32787351ee | |||
40d928cfe2 | |||
e2da1a0332 | |||
a4acc62346 | |||
8b814caad0 | |||
c541cee5c5 | |||
ebe84e5f3f | |||
1f36116aac | |||
f967d9fb93 | |||
edb8514495 | |||
5de103d589 | |||
63887f1c0f | |||
0481a56416 | |||
4b946c9690 | |||
734764ab7b | |||
bf3d8885f7 | |||
b7f082040d | |||
a5dfc9895e | |||
01b461279d | |||
3e0263009c | |||
fe36c75000 | |||
61572a4233 | |||
1eb0936e20 | |||
3cc214b41d | |||
b4b930c240 | |||
60c89c54cc | |||
f75c55da10 | |||
07a2f208b5 | |||
6f0c31f58c | |||
d97fe70ec7 | |||
b49100ae5f | |||
81756f32a9 | |||
55539ec70f | |||
69be2f51a2 | |||
e68b07f8d9 | |||
c5a426c5a5 | |||
e6ad102bf9 | |||
233c223fc2 | |||
a91262499e | |||
ba9df2c63c | |||
ebef726fad | |||
e7572d428e | |||
c261618ffd | |||
d1e187a148 | |||
dee8f6ea87 | |||
7973e19209 | |||
5b421fbc32 | |||
459d28a6c4 | |||
f8e8078996 |
@@ -120,7 +120,7 @@ option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
|
||||
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
|
||||
option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF)
|
||||
mark_as_advanced(WITH_PYTHON) # dont want people disabling this unless they really know what they are doing.
|
||||
mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a security issue, rather than have them patch it, make a build option.
|
||||
mark_as_advanced(WITH_PYTHON_SECURITY) # some distrobutions see this as a security issue, rather than have them patch it, make a build option.
|
||||
|
||||
option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
|
||||
option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)" OFF)
|
||||
@@ -216,6 +216,8 @@ endif()
|
||||
# 3D format support
|
||||
# disable opencollada on non-apple unix because opencollada has no package for debian
|
||||
option(WITH_OPENCOLLADA "Enable OpenCollada Support (http://www.opencollada.org)" OFF)
|
||||
option(WITH_ASSIMP "Enable Assimp Support (http://www.assimp.sourceforge.net)" OFF)
|
||||
option(WITH_FBX "Enable FBX support using Assimp" OFF)
|
||||
|
||||
# Sound output
|
||||
option(WITH_SDL "Enable SDL for sound and joystick support" ON)
|
||||
@@ -356,6 +358,10 @@ if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
|
||||
message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
|
||||
endif()
|
||||
|
||||
if(NOT WITH_ASSIMP AND WITH_FBX)
|
||||
message(FATAL_ERROR "WITH_FBX requires WITH_ASSIMP")
|
||||
endif()
|
||||
|
||||
# may as well build python module without a UI
|
||||
if(WITH_PYTHON_MODULE)
|
||||
set(WITH_HEADLESS ON)
|
||||
@@ -371,7 +377,7 @@ if(WITH_CYCLES OR WITH_MOD_BOOLEAN)
|
||||
set(WITH_BOOST ON)
|
||||
endif()
|
||||
|
||||
# don't store paths to libs for portable distribution
|
||||
# don't store paths to libs for portable distrobution
|
||||
if(WITH_INSTALL_PORTABLE)
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
endif()
|
||||
@@ -566,7 +572,7 @@ if(UNIX AND NOT APPLE)
|
||||
|
||||
mark_as_advanced(FFMPEG)
|
||||
|
||||
# lame, but until we have proper find module for ffmpeg
|
||||
# lame, but until we have propper find module for ffmpeg
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
|
||||
if(EXISTS "${FFMPEG}/include/ffmpeg/")
|
||||
list(APPEND FFMPEG_INCLUDE_DIRS "${FFMPEG}/include/ffmpeg")
|
||||
@@ -1010,6 +1016,7 @@ elseif(WIN32)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
set(FFMPEG_INCLUDE_DIRS
|
||||
${LIBDIR}/ffmpeg/include
|
||||
@@ -1303,7 +1310,7 @@ elseif(WIN32)
|
||||
set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
|
||||
|
||||
## DISABLE - causes linking errors
|
||||
## for re-distribution, so users dont need mingw installed
|
||||
## for re-distrobution, so users dont need mingw installed
|
||||
# set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-libgcc -static-libstdc++")
|
||||
|
||||
endif()
|
||||
@@ -1648,13 +1655,12 @@ elseif(APPLE)
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
|
||||
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
|
||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
|
||||
endif()
|
||||
if(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -fvariable-expansion-in-unroller")
|
||||
elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
|
||||
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -ftree-vectorize -msse -msse2 -msse3 -mssse3 -fvariable-expansion-in-unroller")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
|
||||
@@ -1828,6 +1834,9 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
|
||||
|
||||
# # this causes too many warnings, disable
|
||||
# ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEFINED -Wundef)
|
||||
|
||||
# disable because it gives warnings for printf() & friends.
|
||||
# ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
|
||||
|
||||
@@ -1838,17 +1847,14 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_LOGICAL_OP -Wlogical-op)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_INIT_SELF -Winit-self) # needs -Wuninitialized
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
|
||||
|
||||
# causes too many warnings
|
||||
if(NOT APPLE)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations)
|
||||
endif()
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEFINED -Wundef)
|
||||
|
||||
# flags to undo strict flags
|
||||
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
|
||||
@@ -2033,6 +2039,8 @@ if(FIRST_RUN)
|
||||
info_cfg_option(WITH_IK_SOLVER)
|
||||
info_cfg_option(WITH_IK_ITASC)
|
||||
info_cfg_option(WITH_OPENCOLLADA)
|
||||
info_cfg_option(WITH_ASSIMP)
|
||||
info_cfg_option(WITH_FBX)
|
||||
info_cfg_option(WITH_FFTW3)
|
||||
info_cfg_option(WITH_INTERNATIONAL)
|
||||
info_cfg_option(WITH_INPUT_NDOF)
|
||||
|
@@ -262,6 +262,10 @@ BF_OPENGL_LIB = 'GL GLU'
|
||||
BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
|
||||
BF_OPENGL_LINKFLAGS = ['-framework', 'OpenGL']
|
||||
|
||||
# note: WITH_BF_FBX==True needs WITH_BF_ASSIMP to be enabled as well
|
||||
WITH_BF_ASSIMP = False
|
||||
WITH_BF_FBX = False
|
||||
|
||||
#OpenCollada flags
|
||||
WITH_BF_COLLADA = True
|
||||
BF_COLLADA = '#source/blender/collada'
|
||||
|
@@ -148,6 +148,10 @@ BF_OPENGL_LIB = 'GL GLU X11 Xi'
|
||||
BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
|
||||
BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a'
|
||||
|
||||
# note: WITH_BF_FBX==True needs WITH_BF_ASSIMP to be enabled as well
|
||||
WITH_BF_ASSIMP = False
|
||||
WITH_BF_FBX = False
|
||||
|
||||
WITH_BF_COLLADA = False
|
||||
BF_COLLADA = '#source/blender/collada'
|
||||
BF_COLLADA_INC = '${BF_COLLADA}'
|
||||
|
@@ -148,6 +148,10 @@ BF_OPENGL_LIB = 'GL GLU X11 Xi'
|
||||
BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
|
||||
BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a'
|
||||
|
||||
# note: WITH_BF_FBX==True needs WITH_BF_ASSIMP to be enabled as well
|
||||
WITH_BF_ASSIMP = False
|
||||
WITH_BF_FBX = False
|
||||
|
||||
WITH_BF_COLLADA = False
|
||||
BF_COLLADA = '#source/blender/collada'
|
||||
BF_COLLADA_INC = '${BF_COLLADA}'
|
||||
|
@@ -148,6 +148,10 @@ BF_OPENGL_LIB = 'GL GLU X11 Xi'
|
||||
BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
|
||||
BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a'
|
||||
|
||||
# note: WITH_BF_FBX==True needs WITH_BF_ASSIMP to be enabled as well
|
||||
WITH_BF_ASSIMP = False
|
||||
WITH_BF_FBX = False
|
||||
|
||||
WITH_BF_COLLADA = False
|
||||
BF_COLLADA = '#source/blender/collada'
|
||||
BF_COLLADA_INC = '${BF_COLLADA}'
|
||||
|
@@ -182,6 +182,11 @@ BF_OPENGL_LIB = 'GL GLU X11 Xi'
|
||||
BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
|
||||
BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a'
|
||||
|
||||
# note: WITH_BF_FBX==True needs WITH_BF_ASSIMP to be enabled as well
|
||||
WITH_BF_ASSIMP = False
|
||||
WITH_BF_FBX = False
|
||||
|
||||
|
||||
WITH_BF_COLLADA = False
|
||||
BF_COLLADA = '#source/blender/collada'
|
||||
BF_COLLADA_INC = '${BF_COLLADA}'
|
||||
|
@@ -155,6 +155,10 @@ BF_OPENMP = LIBDIR + '/gcc/gomp'
|
||||
BF_OPENMP_INC = '${BF_OPENMP}/include'
|
||||
BF_OPENMP_LIBPATH = '${BF_OPENMP}/lib'
|
||||
|
||||
# note: WITH_BF_FBX==True needs WITH_BF_ASSIMP to be enabled as well
|
||||
WITH_BF_ASSIMP = False
|
||||
WITH_BF_FBX = False
|
||||
|
||||
WITH_BF_COLLADA = False
|
||||
BF_COLLADA = '#source/blender/collada'
|
||||
BF_COLLADA_INC = '${BF_COLLADA}'
|
||||
|
@@ -140,6 +140,10 @@ BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a'
|
||||
'${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
|
||||
'${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
|
||||
|
||||
# note: WITH_BF_FBX==True needs WITH_BF_ASSIMP to be enabled as well
|
||||
WITH_BF_ASSIMP = False
|
||||
WITH_BF_FBX = False
|
||||
|
||||
WITH_BF_COLLADA = True
|
||||
BF_COLLADA = '#source/blender/collada'
|
||||
BF_COLLADA_INC = '${BF_COLLADA}'
|
||||
@@ -201,7 +205,7 @@ LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32
|
||||
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
|
||||
|
||||
## DISABLED, causes linking errors!
|
||||
## for re-distribution, so users dont need mingw installed
|
||||
## for re-distrobution, so users dont need mingw installed
|
||||
# PLATFORM_LINKFLAGS += ["-static-libgcc", "-static-libstdc++"]
|
||||
|
||||
BF_DEBUG = False
|
||||
|
@@ -138,6 +138,10 @@ BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
|
||||
WITH_BF_REDCODE = False
|
||||
BF_REDCODE_INC = '#extern'
|
||||
|
||||
# note: WITH_BF_FBX==True needs WITH_BF_ASSIMP to be enabled as well
|
||||
WITH_BF_ASSIMP = False
|
||||
WITH_BF_FBX = False
|
||||
|
||||
WITH_BF_COLLADA = True
|
||||
BF_COLLADA = '#source/blender/collada'
|
||||
BF_COLLADA_INC = '${BF_COLLADA}'
|
||||
|
@@ -137,6 +137,10 @@ BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a'
|
||||
'${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
|
||||
'${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
|
||||
|
||||
# note: WITH_BF_FBX==True needs WITH_BF_ASSIMP to be enabled as well
|
||||
WITH_BF_ASSIMP = False
|
||||
WITH_BF_FBX = False
|
||||
|
||||
WITH_BF_COLLADA = True
|
||||
BF_COLLADA = '#source/blender/collada'
|
||||
BF_COLLADA_INC = '${BF_COLLADA}'
|
||||
@@ -199,7 +203,7 @@ LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32
|
||||
PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
|
||||
|
||||
## DISABLED, causes linking errors!
|
||||
## for re-distribution, so users dont need mingw installed
|
||||
## for re-distrobution, so users dont need mingw installed
|
||||
# PLATFORM_LINKFLAGS += ["-static-libgcc", "-static-libstdc++"]
|
||||
|
||||
BF_DEBUG = False
|
||||
|
@@ -134,6 +134,10 @@ BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
|
||||
WITH_BF_REDCODE = False
|
||||
BF_REDCODE_INC = '#extern'
|
||||
|
||||
# note: WITH_BF_FBX==True needs WITH_BF_ASSIMP to be enabled as well
|
||||
WITH_BF_ASSIMP = False
|
||||
WITH_BF_FBX = False
|
||||
|
||||
WITH_BF_COLLADA = True
|
||||
BF_COLLADA = '#source/blender/collada'
|
||||
BF_COLLADA_INC = '${BF_COLLADA}'
|
||||
|
@@ -127,6 +127,8 @@ def validate_arguments(args, bc):
|
||||
'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH', 'WITH_BF_STATICFFTW3', 'BF_FFTW3_LIB_STATIC',
|
||||
'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC',
|
||||
'WITH_BF_COLLADA', 'BF_COLLADA', 'BF_COLLADA_INC', 'BF_COLLADA_LIB', 'BF_OPENCOLLADA', 'BF_OPENCOLLADA_INC', 'BF_OPENCOLLADA_LIB', 'BF_OPENCOLLADA_LIBPATH', 'BF_PCRE', 'BF_PCRE_LIB', 'BF_PCRE_LIBPATH', 'BF_EXPAT', 'BF_EXPAT_LIB', 'BF_EXPAT_LIBPATH',
|
||||
'WITH_BF_ASSIMP',
|
||||
'WITH_BF_FBX',
|
||||
'WITH_BF_PLAYER',
|
||||
'WITH_BF_NOBLENDER',
|
||||
'WITH_BF_BINRELOC',
|
||||
@@ -464,6 +466,9 @@ def read_opts(env, cfg, args):
|
||||
('BF_EXPAT_LIB', 'Expat library', ''),
|
||||
('BF_EXPAT_LIBPATH', 'Expat library path', ''),
|
||||
|
||||
(BoolVariable('WITH_BF_ASSIMP', 'Build assimp import module if true', False)),
|
||||
(BoolVariable('WITH_BF_FBX', 'Build fbx import module if true (depends on WITH_BF_ASSIMP)', False)),
|
||||
|
||||
(BoolVariable('WITH_BF_JEMALLOC', 'Use jemalloc if true', False)),
|
||||
(BoolVariable('WITH_BF_STATICJEMALLOC', 'Staticly link to jemalloc', False)),
|
||||
('BF_JEMALLOC', 'jemalloc base path', ''),
|
||||
@@ -475,14 +480,6 @@ def read_opts(env, cfg, args):
|
||||
(BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)),
|
||||
(BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)),
|
||||
|
||||
(BoolVariable('WITH_BF_3DMOUSE', 'Build blender with support of 3D mouses', False)),
|
||||
(BoolVariable('WITH_BF_STATIC3DMOUSE', 'Staticly link to 3d mouse library', False)),
|
||||
('BF_3DMOUSE', '3d mouse library base path', ''),
|
||||
('BF_3DMOUSE_INC', '3d mouse library include path', ''),
|
||||
('BF_3DMOUSE_LIB', '3d mouse library', ''),
|
||||
('BF_3DMOUSE_LIBPATH', '3d mouse library path', ''),
|
||||
('BF_3DMOUSE_LIB_STATIC', '3d mouse static library', ''),
|
||||
|
||||
('CFLAGS', 'C only flags', []),
|
||||
('CCFLAGS', 'Generic C and C++ flags', []),
|
||||
('CXXFLAGS', 'C++ only flags', []),
|
||||
@@ -591,6 +588,14 @@ def read_opts(env, cfg, args):
|
||||
('BF_BOOST_LIB', 'Boost library', ''),
|
||||
('BF_BOOST_LIBPATH', 'Boost library path', ''),
|
||||
('BF_BOOST_LIB_STATIC', 'Boost static library', ''),
|
||||
|
||||
(BoolVariable('WITH_BF_3DMOUSE', 'Build blender with support of 3D mouses', False)),
|
||||
(BoolVariable('WITH_BF_STATIC3DMOUSE', 'Staticly link to 3d mouse library', False)),
|
||||
('BF_3DMOUSE', '3d mouse library base path', ''),
|
||||
('BF_3DMOUSE_INC', '3d mouse library include path', ''),
|
||||
('BF_3DMOUSE_LIB', '3d mouse library', ''),
|
||||
('BF_3DMOUSE_LIBPATH', '3d mouse library path', ''),
|
||||
('BF_3DMOUSE_LIB_STATIC', '3d mouse static library', ''),
|
||||
|
||||
(BoolVariable('WITH_GHOST_XDND', 'Build with drag-n-drop support on Linux platforms using XDND protocol', True)),
|
||||
(BoolVariable('WITH_BF_COMPOSITOR_LEGACY', 'Enable the legacy compositor', False))
|
||||
|
4
extern/CMakeLists.txt
vendored
4
extern/CMakeLists.txt
vendored
@@ -77,3 +77,7 @@ if(WITH_GHOST_XDND)
|
||||
add_subdirectory(xdnd)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_ASSIMP)
|
||||
add_subdirectory(assimp)
|
||||
endif()
|
||||
|
3
extern/SConscript
vendored
3
extern/SConscript
vendored
@@ -34,6 +34,9 @@ if env['WITH_BF_LIBMV']:
|
||||
|
||||
if env['WITH_BF_BOOLEAN']:
|
||||
SConscript(['carve/SConscript'])
|
||||
print(env)
|
||||
if env['WITH_BF_ASSIMP']:
|
||||
SConscript(['assimp/SConscript'])
|
||||
|
||||
if env['WITH_GHOST_XDND']:
|
||||
# FreeBSD doesn't seems to support XDND protocol
|
||||
|
@@ -84,7 +84,7 @@ public:
|
||||
* Sets the highest passed frequency.
|
||||
* \param high The highest passed frequency.
|
||||
*/
|
||||
void setHigh(float high);
|
||||
void setHigh(float hight);
|
||||
|
||||
virtual AUD_IReader* createReader();
|
||||
};
|
||||
|
@@ -38,7 +38,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initializes the Python module.
|
||||
* Initalizes the Python module.
|
||||
*/
|
||||
extern PyObject *AUD_initPython(void);
|
||||
|
||||
|
@@ -59,7 +59,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
|
||||
|
||||
col = split.column()
|
||||
sub = col.column()
|
||||
sub.active = (device_type == 'NONE' or cscene.device == 'CPU')
|
||||
sub.enabled = (device_type == 'NONE' or cscene.device == 'CPU')
|
||||
sub.prop(cscene, "progressive")
|
||||
|
||||
sub = col.column(align=True)
|
||||
@@ -437,7 +437,6 @@ class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
|
||||
layout.prop(cdata, "use_subdivision")
|
||||
layout.prop(cdata, "dicing_rate")
|
||||
|
||||
|
||||
class Cycles_PT_mesh_normals(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Normals"
|
||||
bl_context = "data"
|
||||
@@ -457,7 +456,7 @@ class Cycles_PT_mesh_normals(CyclesButtonsPanel, Panel):
|
||||
col.prop(mesh, "show_double_sided")
|
||||
|
||||
col = split.column()
|
||||
col.label()
|
||||
prop.label()
|
||||
|
||||
|
||||
class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
|
||||
@@ -954,7 +953,7 @@ def draw_device(self, context):
|
||||
layout.prop(cscene, "device")
|
||||
elif device_type == 'OPENCL' and cscene.feature_set == 'EXPERIMENTAL':
|
||||
layout.prop(cscene, "device")
|
||||
|
||||
|
||||
if cscene.feature_set == 'EXPERIMENTAL' and cscene.device == 'CPU' and engine.with_osl():
|
||||
layout.prop(cscene, "shading_system")
|
||||
|
||||
|
@@ -94,7 +94,7 @@ static float blender_camera_focal_distance(BL::Object b_ob, BL::Camera b_camera)
|
||||
return fabsf(transform_get_column(&mat, 3).z);
|
||||
}
|
||||
|
||||
static void blender_camera_from_object(BlenderCamera *bcam, BL::Object b_ob, bool skip_panorama = false)
|
||||
static void blender_camera_from_object(BlenderCamera *bcam, BL::Object b_ob)
|
||||
{
|
||||
BL::ID b_ob_data = b_ob.data();
|
||||
|
||||
@@ -111,10 +111,7 @@ static void blender_camera_from_object(BlenderCamera *bcam, BL::Object b_ob, boo
|
||||
bcam->type = CAMERA_ORTHOGRAPHIC;
|
||||
break;
|
||||
case BL::Camera::type_PANO:
|
||||
if(!skip_panorama)
|
||||
bcam->type = CAMERA_PANORAMA;
|
||||
else
|
||||
bcam->type = CAMERA_PERSPECTIVE;
|
||||
bcam->type = CAMERA_PANORAMA;
|
||||
break;
|
||||
case BL::Camera::type_PERSP:
|
||||
default:
|
||||
@@ -381,7 +378,7 @@ void BlenderSync::sync_camera_motion(BL::Object b_ob, int motion)
|
||||
|
||||
/* Sync 3D View Camera */
|
||||
|
||||
static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height, bool skip_panorama = false)
|
||||
static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height)
|
||||
{
|
||||
/* 3d view parameters */
|
||||
bcam->nearclip = b_v3d.clip_start();
|
||||
@@ -394,7 +391,7 @@ static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL:
|
||||
BL::Object b_ob = (b_v3d.lock_camera_and_layers())? b_scene.camera(): b_v3d.camera();
|
||||
|
||||
if(b_ob) {
|
||||
blender_camera_from_object(bcam, b_ob, skip_panorama);
|
||||
blender_camera_from_object(bcam, b_ob);
|
||||
|
||||
/* magic zoom formula */
|
||||
bcam->zoom = (float)b_rv3d.view_camera_zoom();
|
||||
@@ -450,7 +447,7 @@ static void blender_camera_border(BlenderCamera *bcam, BL::Scene b_scene, BL::Sp
|
||||
/* get viewport viewplane */
|
||||
BlenderCamera view_bcam;
|
||||
blender_camera_init(&view_bcam);
|
||||
blender_camera_from_view(&view_bcam, b_scene, b_v3d, b_rv3d, width, height, true);
|
||||
blender_camera_from_view(&view_bcam, b_scene, b_v3d, b_rv3d, width, height);
|
||||
|
||||
blender_camera_viewplane(&view_bcam, width, height,
|
||||
&view_left, &view_right, &view_bottom, &view_top, &view_aspect, &sensor_size);
|
||||
@@ -463,7 +460,7 @@ static void blender_camera_border(BlenderCamera *bcam, BL::Scene b_scene, BL::Sp
|
||||
/* get camera viewplane */
|
||||
BlenderCamera cam_bcam;
|
||||
blender_camera_init(&cam_bcam);
|
||||
blender_camera_from_object(&cam_bcam, b_ob, true);
|
||||
blender_camera_from_object(&cam_bcam, b_ob);
|
||||
|
||||
width = (int)(r.resolution_x()*r.resolution_percentage()/100);
|
||||
height = (int)(r.resolution_y()*r.resolution_percentage()/100);
|
||||
|
@@ -320,7 +320,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
|
||||
hide = hide || !(ob_layer & scene_layer);
|
||||
|
||||
if(!hide) {
|
||||
progress.set_sync_status("Synchronizing object", (*b_ob).name());
|
||||
progress.set_status("Synchronizing object", (*b_ob).name());
|
||||
|
||||
int num_particles = object_count_particles(*b_ob);
|
||||
|
||||
@@ -367,8 +367,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
|
||||
}
|
||||
}
|
||||
|
||||
progress.set_sync_status("");
|
||||
|
||||
if(!cancel && !motion) {
|
||||
sync_background_light();
|
||||
|
||||
|
@@ -125,18 +125,8 @@ __device_inline void kernel_write_light_passes(KernelGlobals *kg, __global float
|
||||
kernel_write_pass_float3(buffer + kernel_data.film.pass_glossy_color, sample, L->color_glossy);
|
||||
if(flag & PASS_TRANSMISSION_COLOR)
|
||||
kernel_write_pass_float3(buffer + kernel_data.film.pass_transmission_color, sample, L->color_transmission);
|
||||
if(flag & PASS_SHADOW) {
|
||||
float4 shadow = L->shadow;
|
||||
|
||||
/* bit of an ugly hack to compensate for emitting triangles influencing
|
||||
* amount of samples we get for this pass */
|
||||
if(kernel_data.integrator.progressive && kernel_data.integrator.pdf_triangles != 0.0f)
|
||||
shadow.w = 0.5f;
|
||||
else
|
||||
shadow.w = 1.0f;
|
||||
|
||||
kernel_write_pass_float4(buffer + kernel_data.film.pass_shadow, sample, shadow);
|
||||
}
|
||||
if(flag & PASS_SHADOW)
|
||||
kernel_write_pass_float4(buffer + kernel_data.film.pass_shadow, sample, L->shadow);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -196,18 +196,7 @@ bool RenderBuffers::get_pass_rect(PassType type, float exposure, int sample, int
|
||||
else if(components == 3) {
|
||||
assert(pass.components == 4);
|
||||
|
||||
/* RGBA */
|
||||
if(type == PASS_SHADOW) {
|
||||
for(int i = 0; i < size; i++, in += pass_stride, pixels += 3) {
|
||||
float4 f = make_float4(in[0], in[1], in[2], in[3]);
|
||||
float invw = (f.w > 0.0f)? 1.0f/f.w: 1.0f;
|
||||
|
||||
pixels[0] = f.x*invw;
|
||||
pixels[1] = f.y*invw;
|
||||
pixels[2] = f.z*invw;
|
||||
}
|
||||
}
|
||||
else if(pass.divide_type != PASS_NONE) {
|
||||
if(pass.divide_type != PASS_NONE) {
|
||||
/* RGB lighting passes that need to divide out color */
|
||||
pass_offset = 0;
|
||||
foreach(Pass& color_pass, params.passes) {
|
||||
|
@@ -366,10 +366,8 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl
|
||||
|
||||
device_vector<float4>& tex_img = dscene->tex_float_image[slot];
|
||||
|
||||
if(tex_img.device_pointer) {
|
||||
thread_scoped_lock device_lock(device_mutex);
|
||||
if(tex_img.device_pointer)
|
||||
device->tex_free(tex_img);
|
||||
}
|
||||
|
||||
if(!file_load_float_image(img, tex_img)) {
|
||||
/* on failure to load, we set a 1x1 pixels pink image */
|
||||
@@ -386,10 +384,8 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl
|
||||
if(slot >= 10) name = string_printf("__tex_image_float_0%d", slot);
|
||||
else name = string_printf("__tex_image_float_00%d", slot);
|
||||
|
||||
if(!pack_images) {
|
||||
thread_scoped_lock device_lock(device_mutex);
|
||||
if(!pack_images)
|
||||
device->tex_alloc(name.c_str(), tex_img, true, true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
string filename = path_filename(images[slot - tex_image_byte_start]->filename);
|
||||
@@ -397,10 +393,8 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl
|
||||
|
||||
device_vector<uchar4>& tex_img = dscene->tex_image[slot - tex_image_byte_start];
|
||||
|
||||
if(tex_img.device_pointer) {
|
||||
thread_scoped_lock device_lock(device_mutex);
|
||||
if(tex_img.device_pointer)
|
||||
device->tex_free(tex_img);
|
||||
}
|
||||
|
||||
if(!file_load_image(img, tex_img)) {
|
||||
/* on failure to load, we set a 1x1 pixels pink image */
|
||||
@@ -417,10 +411,8 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl
|
||||
if(slot >= 10) name = string_printf("__tex_image_0%d", slot);
|
||||
else name = string_printf("__tex_image_00%d", slot);
|
||||
|
||||
if(!pack_images) {
|
||||
thread_scoped_lock device_lock(device_mutex);
|
||||
if(!pack_images)
|
||||
device->tex_alloc(name.c_str(), tex_img, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
img->need_load = false;
|
||||
@@ -448,27 +440,15 @@ void ImageManager::device_free_image(Device *device, DeviceScene *dscene, int sl
|
||||
#endif
|
||||
}
|
||||
else if(is_float) {
|
||||
device_vector<float4>& tex_img = dscene->tex_float_image[slot];
|
||||
|
||||
if(tex_img.device_pointer) {
|
||||
thread_scoped_lock device_lock(device_mutex);
|
||||
device->tex_free(tex_img);
|
||||
}
|
||||
|
||||
tex_img.clear();
|
||||
device->tex_free(dscene->tex_float_image[slot]);
|
||||
dscene->tex_float_image[slot].clear();
|
||||
|
||||
delete float_images[slot];
|
||||
float_images[slot] = NULL;
|
||||
}
|
||||
else {
|
||||
device_vector<uchar4>& tex_img = dscene->tex_image[slot - tex_image_byte_start];
|
||||
|
||||
if(tex_img.device_pointer) {
|
||||
thread_scoped_lock device_lock(device_mutex);
|
||||
device->tex_free(tex_img);
|
||||
}
|
||||
|
||||
tex_img.clear();
|
||||
device->tex_free(dscene->tex_image[slot - tex_image_byte_start]);
|
||||
dscene->tex_image[slot - tex_image_byte_start].clear();
|
||||
|
||||
delete images[slot - tex_image_byte_start];
|
||||
images[slot - tex_image_byte_start] = NULL;
|
||||
@@ -480,7 +460,7 @@ void ImageManager::device_update(Device *device, DeviceScene *dscene, Progress&
|
||||
{
|
||||
if(!need_update)
|
||||
return;
|
||||
|
||||
|
||||
TaskPool pool;
|
||||
|
||||
for(size_t slot = 0; slot < images.size(); slot++) {
|
||||
@@ -562,9 +542,9 @@ void ImageManager::device_free(Device *device, DeviceScene *dscene)
|
||||
device_free_image(device, dscene, slot);
|
||||
|
||||
device->tex_free(dscene->tex_image_packed);
|
||||
device->tex_free(dscene->tex_image_packed_info);
|
||||
|
||||
dscene->tex_image_packed.clear();
|
||||
|
||||
device->tex_free(dscene->tex_image_packed_info);
|
||||
dscene->tex_image_packed_info.clear();
|
||||
|
||||
images.clear();
|
||||
|
@@ -22,7 +22,6 @@
|
||||
#include "device_memory.h"
|
||||
|
||||
#include "util_string.h"
|
||||
#include "util_thread.h"
|
||||
#include "util_vector.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
@@ -67,7 +66,6 @@ private:
|
||||
int tex_num_images;
|
||||
int tex_num_float_images;
|
||||
int tex_image_byte_start;
|
||||
thread_mutex device_mutex;
|
||||
|
||||
struct Image {
|
||||
string filename;
|
||||
|
@@ -67,19 +67,13 @@ static void dump_background_pixels(Device *device, DeviceScene *dscene, int res,
|
||||
main_task.shader_x = 0;
|
||||
main_task.shader_w = width*height;
|
||||
|
||||
/* disabled splitting for now, there's an issue with multi-GPU mem_copy_from */
|
||||
#if 0
|
||||
list<DeviceTask> split_tasks;
|
||||
main_task.split_max_size(split_tasks, 128*128);
|
||||
main_task.split_max_size(split_tasks, 128*128);
|
||||
|
||||
foreach(DeviceTask& task, split_tasks) {
|
||||
device->task_add(task);
|
||||
device->task_wait();
|
||||
}
|
||||
#else
|
||||
device->task_add(main_task);
|
||||
device->task_wait();
|
||||
#endif
|
||||
|
||||
device->mem_copy_from(d_output, 0, 1, d_output.size(), sizeof(float4));
|
||||
device->mem_free(d_input);
|
||||
|
@@ -43,8 +43,6 @@ public:
|
||||
tile_time = 0.0f;
|
||||
status = "Initializing";
|
||||
substatus = "";
|
||||
sync_status = "";
|
||||
sync_substatus = "";
|
||||
update_cb = NULL;
|
||||
cancel = false;
|
||||
cancel_message = "";
|
||||
@@ -166,42 +164,11 @@ public:
|
||||
set_update();
|
||||
}
|
||||
|
||||
void set_sync_status(const string& status_, const string& substatus_ = "")
|
||||
{
|
||||
{
|
||||
thread_scoped_lock lock(progress_mutex);
|
||||
sync_status = status_;
|
||||
sync_substatus = substatus_;
|
||||
total_time = time_dt() - start_time;
|
||||
}
|
||||
|
||||
set_update();
|
||||
|
||||
}
|
||||
|
||||
void set_sync_substatus(const string& substatus_)
|
||||
{
|
||||
{
|
||||
thread_scoped_lock lock(progress_mutex);
|
||||
sync_substatus = substatus_;
|
||||
total_time = time_dt() - start_time;
|
||||
}
|
||||
|
||||
set_update();
|
||||
}
|
||||
|
||||
void get_status(string& status_, string& substatus_)
|
||||
{
|
||||
thread_scoped_lock lock(progress_mutex);
|
||||
|
||||
if(sync_status != "") {
|
||||
status_ = sync_status;
|
||||
substatus_ = sync_substatus;
|
||||
}
|
||||
else {
|
||||
status_ = status;
|
||||
substatus_ = substatus;
|
||||
}
|
||||
status_ = status;
|
||||
substatus_ = substatus;
|
||||
}
|
||||
|
||||
/* callback */
|
||||
@@ -235,9 +202,6 @@ protected:
|
||||
string status;
|
||||
string substatus;
|
||||
|
||||
string sync_status;
|
||||
string sync_substatus;
|
||||
|
||||
volatile bool cancel;
|
||||
string cancel_message;
|
||||
};
|
||||
|
@@ -275,8 +275,7 @@ def enable(module_name, default_set=True, persistent=False):
|
||||
try:
|
||||
mod.register()
|
||||
except:
|
||||
print("Exception in module register(): %r" %
|
||||
getattr(mod, "__file__", module_name))
|
||||
print("Exception in module register(): %r" % getattr(mod, "__file__", module_name))
|
||||
handle_error()
|
||||
del sys.modules[module_name]
|
||||
return None
|
||||
@@ -318,8 +317,7 @@ def disable(module_name, default_set=True):
|
||||
try:
|
||||
mod.unregister()
|
||||
except:
|
||||
print("Exception in module unregister(): %r" %
|
||||
getattr(mod, "__file__", module_name))
|
||||
print("Exception in module unregister(): %r" % getattr(mod, "__file__", module_name))
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
else:
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# <pep8 compliant>
|
||||
# <pep8-80 compliant>
|
||||
|
||||
# Write out messages.txt from Blender.
|
||||
# XXX: This script is meant to be used from inside Blender!
|
||||
@@ -43,7 +43,6 @@ UNDOC_OPS_STR = settings.UNDOC_OPS_STR
|
||||
|
||||
NC_ALLOWED = settings.WARN_MSGID_NOT_CAPITALIZED_ALLOWED
|
||||
|
||||
|
||||
def check(check_ctxt, messages, key, msgsrc):
|
||||
if check_ctxt is None:
|
||||
return
|
||||
@@ -79,8 +78,7 @@ def dump_messages_rna(messages, check_ctxt):
|
||||
import bpy
|
||||
|
||||
def classBlackList():
|
||||
blacklist_rna_class = [
|
||||
# core classes
|
||||
blacklist_rna_class = [# core classes
|
||||
"Context", "Event", "Function", "UILayout",
|
||||
"BlendData",
|
||||
# registerable classes
|
||||
|
@@ -162,9 +162,9 @@ def main():
|
||||
" {} specific context{} present:\n {}\n"
|
||||
"".format(glob_stats["nbr"], glob_stats["lvl"] / glob_stats["nbr"],
|
||||
glob_stats["lvl_ttips"] / glob_stats["nbr"],
|
||||
glob_stats["lvl_trans_ttips"] / glob_stats["nbr"],
|
||||
glob_stats["lvl_ttips_in_trans"] / glob_stats["nbr"],
|
||||
glob_stats["lvl_comm"] / glob_stats["nbr"], glob_stats["nbr_signs"],
|
||||
glob_stats["lvl_trans_ttips"]/glob_stats["nbr"],
|
||||
glob_stats["lvl_ttips_in_trans"]/glob_stats["nbr"],
|
||||
glob_stats["lvl_comm"]/glob_stats["nbr"], glob_stats["nbr_signs"],
|
||||
glob_stats["nbr_trans_signs"], nbr_contexts, _ctx_txt,
|
||||
"\n ".join(glob_stats["contexts"]-{""})))
|
||||
|
||||
|
@@ -95,6 +95,7 @@ def parse_messages(fname):
|
||||
msgctxt_lines = []
|
||||
comment_lines = []
|
||||
|
||||
|
||||
def finalize_message():
|
||||
nonlocal reading_msgid, reading_msgstr, reading_msgctxt, \
|
||||
reading_comment, is_fuzzy, is_translated, is_commented, \
|
||||
@@ -224,6 +225,7 @@ def parse_messages(fname):
|
||||
if reading_msgstr:
|
||||
finalize_message()
|
||||
|
||||
|
||||
return (messages,
|
||||
{"trans_msg": translated_messages,
|
||||
"fuzzy_msg": fuzzy_messages,
|
||||
|
@@ -59,7 +59,6 @@ import addon_utils as _addon_utils
|
||||
|
||||
_script_module_dirs = "startup", "modules"
|
||||
|
||||
|
||||
def _test_import(module_name, loaded_modules):
|
||||
use_time = _bpy.app.debug_python
|
||||
|
||||
@@ -616,15 +615,12 @@ def _blender_default_map():
|
||||
# hooks for doc lookups
|
||||
_manual_map = [_blender_default_map]
|
||||
|
||||
|
||||
def register_manual_map(manual_hook):
|
||||
_manual_map.append(manual_hook)
|
||||
|
||||
|
||||
def unregister_manual_map(manual_hook):
|
||||
_manual_map.remove(manual_hook)
|
||||
|
||||
|
||||
def manual_map():
|
||||
# reverse so default is called last
|
||||
for cb in reversed(_manual_map):
|
||||
@@ -637,3 +633,4 @@ def manual_map():
|
||||
continue
|
||||
|
||||
yield prefix, url_manual_mapping
|
||||
|
||||
|
@@ -304,7 +304,7 @@ def copy_as_script(context):
|
||||
for line in sc.scrollback:
|
||||
text = line.body
|
||||
type = line.type
|
||||
|
||||
|
||||
if type == 'INFO': # ignore autocomp.
|
||||
continue
|
||||
if type == 'INPUT':
|
||||
|
@@ -259,7 +259,7 @@ def xml2rna(root_xml,
|
||||
except ValueError:
|
||||
try:
|
||||
value_xml_coerce = [float(v) for v in value_xml_split]
|
||||
except ValueError: # bool vector property
|
||||
except ValueError: # bool vector property
|
||||
value_xml_coerce = [{'TRUE': True, 'FALSE': False}[v] for v in value_xml_split]
|
||||
del value_xml_split
|
||||
tp_name = 'ARRAY'
|
||||
|
@@ -7,6 +7,7 @@ bpy.context.user_preferences.view.use_zoom_to_mouse = False
|
||||
bpy.context.user_preferences.view.use_rotate_around_active = False
|
||||
bpy.context.user_preferences.edit.use_drag_immediately = False
|
||||
bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
|
||||
bpy.context.user_preferences.edit.floating_controls = 'BOTTOM'
|
||||
bpy.context.user_preferences.inputs.select_mouse = 'RIGHT'
|
||||
bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
|
||||
bpy.context.user_preferences.inputs.view_zoom_axis = 'VERTICAL'
|
||||
|
@@ -3,6 +3,7 @@ import bpy
|
||||
|
||||
bpy.context.user_preferences.edit.use_drag_immediately = True
|
||||
bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False
|
||||
bpy.context.user_preferences.edit.floating_controls = 'BOTTOM'
|
||||
bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
|
||||
bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
|
||||
bpy.context.user_preferences.inputs.view_zoom_axis = 'HORIZONTAL'
|
||||
|
@@ -9,7 +9,6 @@
|
||||
handle_auto="#909000"
|
||||
handle_sel_auto="#f0ff40"
|
||||
bone_pose="#50c8ff"
|
||||
bone_pose_active="#8cffff"
|
||||
bone_solid="#c8c8c8"
|
||||
bundle_solid="#c8c8c8"
|
||||
camera="#000000"
|
||||
|
@@ -9,7 +9,6 @@
|
||||
handle_auto="#909000"
|
||||
handle_sel_auto="#f0ff40"
|
||||
bone_pose="#50c8ff"
|
||||
bone_pose_active="#8cffff"
|
||||
bone_solid="#c8c8c8"
|
||||
bundle_solid="#c8c8c8"
|
||||
camera="#000000"
|
||||
|
@@ -9,7 +9,6 @@
|
||||
handle_auto="#909000"
|
||||
handle_sel_auto="#f0ff40"
|
||||
bone_pose="#50c8ff"
|
||||
bone_pose_active="#8cffff"
|
||||
bone_solid="#c8c8c8"
|
||||
bundle_solid="#c8c8c8"
|
||||
camera="#000000"
|
||||
|
@@ -9,7 +9,6 @@
|
||||
handle_auto="#909000"
|
||||
handle_sel_auto="#f0ff40"
|
||||
bone_pose="#50c8ff"
|
||||
bone_pose_active="#8cffff"
|
||||
bone_solid="#c8c8c8"
|
||||
bundle_solid="#c8c8c8"
|
||||
camera="#000000"
|
||||
|
@@ -9,7 +9,6 @@
|
||||
handle_auto="#909000"
|
||||
handle_sel_auto="#f0ff40"
|
||||
bone_pose="#50c8ff"
|
||||
bone_pose_active="#8cffff"
|
||||
bone_solid="#c8c8c8"
|
||||
bundle_solid="#c8c8c8"
|
||||
camera="#000000"
|
||||
|
@@ -14,4 +14,4 @@ settings.default_margin = 0
|
||||
settings.use_default_red_channel = True
|
||||
settings.use_default_green_channel = True
|
||||
settings.use_default_blue_channel = True
|
||||
settings.default_correlation_min = 0.6
|
||||
settings.default_correlation_min = 0.6
|
@@ -14,4 +14,4 @@ settings.default_margin = 0
|
||||
settings.use_default_red_channel = True
|
||||
settings.use_default_green_channel = True
|
||||
settings.use_default_blue_channel = True
|
||||
settings.default_correlation_min = 0.75
|
||||
settings.default_correlation_min = 0.75
|
@@ -14,4 +14,4 @@ settings.default_margin = 0
|
||||
settings.use_default_red_channel = True
|
||||
settings.use_default_green_channel = True
|
||||
settings.use_default_blue_channel = True
|
||||
settings.default_correlation_min = 0.6
|
||||
settings.default_correlation_min = 0.6
|
@@ -14,4 +14,4 @@ settings.default_margin = 0
|
||||
settings.use_default_red_channel = True
|
||||
settings.use_default_green_channel = True
|
||||
settings.use_default_blue_channel = True
|
||||
settings.default_correlation_min = 0.75
|
||||
settings.default_correlation_min = 0.75
|
@@ -22,16 +22,12 @@ import bpy
|
||||
from bpy.types import Operator
|
||||
from bpy.props import EnumProperty
|
||||
|
||||
# XXX These node item lists should actually be generated by a callback at
|
||||
# operator execution time (see node_type_items below),
|
||||
# using the active node tree from the context.
|
||||
# Due to a difficult bug in bpy this is not possible
|
||||
# (item list memory gets freed too early),
|
||||
# XXX These node item lists should actually be generated by a callback at operator execution time (see node_type_items below),
|
||||
# using the active node tree from the context. Due to a difficult bug in bpy this is not possible (item list memory gets freed too early),
|
||||
# so for now just copy the static item lists to these global variables.
|
||||
#
|
||||
# In the custom_nodes branch, the static per-tree-type node items are replaced
|
||||
# by a single independent type list anyway (with a poll function to limit node
|
||||
# types to the respective trees). So this workaround is only temporary.
|
||||
# In the custom_nodes branch, the static per-tree-type node items are replaced by a single independent type list anyway (with a poll function
|
||||
# to limit node types to the respective trees). So this workaround is only temporary.
|
||||
|
||||
# lazy init
|
||||
node_type_items_dict = {}
|
||||
@@ -43,21 +39,18 @@ node_group_prefix = 'GROUP_'
|
||||
|
||||
# Generate a list of enum items for a given node class
|
||||
# Copy existing type enum, adding a prefix to distinguish from node groups
|
||||
# Skip the base node group type,
|
||||
# node groups will be added below for all existing group trees
|
||||
# Skip the base node group type, node groups will be added below for all existing group trees
|
||||
def node_type_items(node_class):
|
||||
return [(node_type_prefix + item.identifier, item.name, item.description)
|
||||
for item in node_class.bl_rna.properties['type'].enum_items
|
||||
if item.identifier != 'GROUP']
|
||||
for item in node_class.bl_rna.properties['type'].enum_items if item.identifier != 'GROUP']
|
||||
|
||||
|
||||
# Generate items for node group types
|
||||
# Filter by the given tree_type
|
||||
# Node group trees don't have a description property yet
|
||||
# (could add this as a custom property though)
|
||||
# Node group trees don't have a description property yet (could add this as a custom property though)
|
||||
def node_group_items(tree_type):
|
||||
return [(node_group_prefix + group.name, group.name, '')
|
||||
for group in bpy.data.node_groups if group.type == tree_type]
|
||||
for group in bpy.data.node_groups if group.type == tree_type]
|
||||
|
||||
|
||||
# Returns the enum item list for the edited tree in the context
|
||||
@@ -78,11 +71,7 @@ def node_type_items_cb(self, context):
|
||||
})
|
||||
|
||||
# XXX Does not work correctly, see comment above
|
||||
'''
|
||||
return [(item.identifier, item.name, item.description, item.value)
|
||||
for item in
|
||||
tree.nodes.bl_rna.functions['new'].parameters['type'].enum_items]
|
||||
'''
|
||||
#return [(item.identifier, item.name, item.description, item.value) for item in tree.nodes.bl_rna.functions['new'].parameters['type'].enum_items]
|
||||
|
||||
if tree.type in node_type_items_dict:
|
||||
return node_type_items_dict[tree.type] + node_group_items(tree.type)
|
||||
@@ -96,8 +85,7 @@ class NODE_OT_add_search(Operator):
|
||||
bl_label = "Search and Add Node"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
# XXX this should be called 'node_type' but the operator search
|
||||
# property is hardcoded to 'type' by a hack in bpy_operator_wrap.c ...
|
||||
# XXX this should be called 'node_type' but the operator search property is hardcoded to 'type' by a hack in bpy_operator_wrap.c ...
|
||||
type = EnumProperty(
|
||||
name="Node Type",
|
||||
description="Node type",
|
||||
@@ -110,17 +98,14 @@ class NODE_OT_add_search(Operator):
|
||||
space = context.space_data
|
||||
tree = space.edit_tree
|
||||
|
||||
# Enum item identifier has an additional prefix to
|
||||
# distinguish base node types from node groups
|
||||
# Enum item identifier has an additional prefix to distinguish base node types from node groups
|
||||
item = self.type
|
||||
if item.startswith(node_type_prefix):
|
||||
# item means base node type
|
||||
node = tree.nodes.new(type=item[len(node_type_prefix):])
|
||||
elif item.startswith(node_group_prefix):
|
||||
# item means node group type
|
||||
node = tree.nodes.new(
|
||||
type='GROUP',
|
||||
group=bpy.data.node_groups[item[len(node_group_prefix):]])
|
||||
node = tree.nodes.new(type='GROUP', group=bpy.data.node_groups[item[len(node_group_prefix):]])
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -148,8 +133,7 @@ class NODE_OT_add_search(Operator):
|
||||
v2d = context.region.view2d
|
||||
|
||||
# convert mouse position to the View2D for later node placement
|
||||
space.cursor_location = v2d.region_to_view(event.mouse_region_x,
|
||||
event.mouse_region_y)
|
||||
space.cursor_location = v2d.region_to_view(event.mouse_region_x, event.mouse_region_y)
|
||||
|
||||
context.window_manager.invoke_search_popup(self)
|
||||
return {'CANCELLED'}
|
||||
|
@@ -216,7 +216,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||
|
||||
def DISPLACE(self, layout, ob, md):
|
||||
has_texture = (md.texture is not None)
|
||||
|
||||
|
||||
split = layout.split()
|
||||
|
||||
col = split.column()
|
||||
|
@@ -185,7 +185,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
|
||||
split = col.box().split()
|
||||
|
||||
col = split.column()
|
||||
col.prop(group, "layers", text="Dupli Visibility")
|
||||
col.prop(group, "layers", text="Dupli")
|
||||
|
||||
col = split.column()
|
||||
col.prop(group, "dupli_offset", text="")
|
||||
|
@@ -70,26 +70,27 @@ class UnifiedPaintPanel():
|
||||
|
||||
|
||||
# Used in both the View3D toolbar and texture properties
|
||||
def sculpt_brush_texture_settings(layout, brush):
|
||||
def brush_texture_settings(layout, brush, sculpt):
|
||||
tex_slot = brush.texture_slot
|
||||
|
||||
layout.label(text="Brush Mapping:")
|
||||
|
||||
# map_mode
|
||||
layout.row().prop(tex_slot, "map_mode", text="")
|
||||
layout.separator()
|
||||
if sculpt:
|
||||
layout.row().prop(tex_slot, "map_mode", text="")
|
||||
layout.separator()
|
||||
|
||||
# angle and texture_angle_source
|
||||
col = layout.column()
|
||||
col.active = brush.sculpt_capabilities.has_texture_angle_source
|
||||
col.active = brush.paint_capabilities.has_texture_angle_source
|
||||
col.label(text="Angle:")
|
||||
if brush.sculpt_capabilities.has_random_texture_angle:
|
||||
if brush.paint_capabilities.has_random_texture_angle:
|
||||
col.prop(brush, "texture_angle_source_random", text="")
|
||||
else:
|
||||
col.prop(brush, "texture_angle_source_no_random", text="")
|
||||
|
||||
col = layout.column()
|
||||
col.active = brush.sculpt_capabilities.has_texture_angle
|
||||
col.active = brush.paint_capabilities.has_texture_angle
|
||||
col.prop(tex_slot, "angle", text="")
|
||||
|
||||
# scale and offset
|
||||
@@ -101,3 +102,19 @@ def sculpt_brush_texture_settings(layout, brush):
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Sample Bias:")
|
||||
col.prop(brush, "texture_sample_bias", slider=True, text="")
|
||||
|
||||
def brush_mask_texture_settings(layout, brush):
|
||||
mask_tex_slot = brush.mask_texture_slot
|
||||
|
||||
if(brush.mask_texture):
|
||||
layout.label(text="Mask Mapping:")
|
||||
col = layout.column()
|
||||
col.active = brush.paint_capabilities.has_texture_angle
|
||||
col.prop(mask_tex_slot, "angle", text="")
|
||||
|
||||
# scale and offset
|
||||
split = layout.split()
|
||||
split.prop(mask_tex_slot, "offset")
|
||||
split.prop(mask_tex_slot, "scale")
|
||||
|
||||
|
||||
|
@@ -316,6 +316,7 @@ class RENDER_PT_shading(RenderButtonsPanel, Panel):
|
||||
|
||||
col = split.column()
|
||||
col.prop(rd, "use_raytrace", text="Ray Tracing")
|
||||
col.prop(rd, "use_color_unpremultiply")
|
||||
col.prop(rd, "alpha_mode", text="Alpha")
|
||||
|
||||
|
||||
|
@@ -241,7 +241,6 @@ class SCENE_PT_color_management(Panel):
|
||||
layout = self.layout
|
||||
|
||||
scene = context.scene
|
||||
rd = scene.render
|
||||
|
||||
col = layout.column()
|
||||
col.label(text="Display:")
|
||||
@@ -251,7 +250,6 @@ class SCENE_PT_color_management(Panel):
|
||||
col.separator()
|
||||
col.label(text="Render:")
|
||||
col.template_colormanaged_view_settings(scene, "view_settings")
|
||||
col.prop(rd, "use_color_unpremultiply")
|
||||
|
||||
col = layout.column()
|
||||
col.separator()
|
||||
|
@@ -30,7 +30,7 @@ from bpy.types import (Brush,
|
||||
|
||||
from rna_prop_ui import PropertyPanel
|
||||
|
||||
from bl_ui.properties_paint_common import sculpt_brush_texture_settings
|
||||
from bl_ui.properties_paint_common import brush_texture_settings
|
||||
|
||||
|
||||
class TEXTURE_MT_specials(Menu):
|
||||
@@ -868,8 +868,8 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel):
|
||||
split.prop(tex, "object", text="")
|
||||
|
||||
if isinstance(idblock, Brush):
|
||||
if context.sculpt_object:
|
||||
sculpt_brush_texture_settings(layout, idblock)
|
||||
if context.sculpt_object or context.image_paint_object:
|
||||
brush_texture_settings(layout, idblock, context.sculpt_object)
|
||||
else:
|
||||
if isinstance(idblock, Material):
|
||||
split = layout.split(percentage=0.3)
|
||||
|
@@ -790,45 +790,42 @@ class CLIP_PT_proxy(CLIP_PT_clip_view_panel, Panel):
|
||||
sc = context.space_data
|
||||
clip = sc.clip
|
||||
|
||||
col = layout.column()
|
||||
col.active = clip.use_proxy
|
||||
layout.active = clip.use_proxy
|
||||
|
||||
col.label(text="Build Original:")
|
||||
layout.label(text="Build Original:")
|
||||
|
||||
row = col.row(align=True)
|
||||
row = layout.row(align=True)
|
||||
row.prop(clip.proxy, "build_25", toggle=True)
|
||||
row.prop(clip.proxy, "build_50", toggle=True)
|
||||
row.prop(clip.proxy, "build_75", toggle=True)
|
||||
row.prop(clip.proxy, "build_100", toggle=True)
|
||||
|
||||
col.label(text="Build Undistorted:")
|
||||
layout.label(text="Build Undistorted:")
|
||||
|
||||
row = col.row(align=True)
|
||||
row = layout.row(align=True)
|
||||
row.prop(clip.proxy, "build_undistorted_25", toggle=True)
|
||||
row.prop(clip.proxy, "build_undistorted_50", toggle=True)
|
||||
row.prop(clip.proxy, "build_undistorted_75", toggle=True)
|
||||
row.prop(clip.proxy, "build_undistorted_100", toggle=True)
|
||||
|
||||
col.prop(clip.proxy, "quality")
|
||||
layout.prop(clip.proxy, "quality")
|
||||
|
||||
col.prop(clip, "use_proxy_custom_directory")
|
||||
layout.prop(clip, "use_proxy_custom_directory")
|
||||
if clip.use_proxy_custom_directory:
|
||||
col.prop(clip.proxy, "directory")
|
||||
layout.prop(clip.proxy, "directory")
|
||||
|
||||
col.operator("clip.rebuild_proxy", text="Build Proxy")
|
||||
layout.operator("clip.rebuild_proxy", text="Build Proxy")
|
||||
|
||||
if clip.source == 'MOVIE':
|
||||
col2 = col.column()
|
||||
col = layout.column()
|
||||
|
||||
col2.label(text="Use timecode index:")
|
||||
col2.prop(clip.proxy, "timecode", text="")
|
||||
|
||||
col2 = col.column()
|
||||
col2.label(text="Proxy render size:")
|
||||
|
||||
col.prop(sc.clip_user, "proxy_render_size", text="")
|
||||
col.label(text="Use timecode index:")
|
||||
col.prop(clip.proxy, "timecode", text="")
|
||||
|
||||
col = layout.column()
|
||||
col.label(text="Proxy render size:")
|
||||
|
||||
col.prop(sc.clip_user, "proxy_render_size", text="")
|
||||
col.prop(sc.clip_user, "use_render_undistorted")
|
||||
|
||||
|
||||
|
@@ -20,6 +20,8 @@
|
||||
import bpy
|
||||
from bpy.types import Header, Menu, Panel
|
||||
from bl_ui.properties_paint_common import UnifiedPaintPanel
|
||||
from bl_ui.properties_paint_common import brush_texture_settings
|
||||
from bl_ui.properties_paint_common import brush_mask_texture_settings
|
||||
|
||||
|
||||
class ImagePaintPanel(UnifiedPaintPanel):
|
||||
@@ -686,6 +688,7 @@ class IMAGE_PT_paint(Panel, ImagePaintPanel):
|
||||
col = layout.column()
|
||||
col.template_color_wheel(brush, "color", value_slider=True)
|
||||
col.prop(brush, "color", text="")
|
||||
col.prop(toolsettings, "invert_color")
|
||||
|
||||
row = col.row(align=True)
|
||||
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
|
||||
@@ -721,6 +724,27 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
|
||||
col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
|
||||
col.prop(brush, "use_fixed_texture")
|
||||
|
||||
class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel):
|
||||
bl_label = "Texture Mask"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw_header(self, context):
|
||||
brush = context.tool_settings.image_paint.brush
|
||||
tex_slot_alpha = brush.mask_texture_slot
|
||||
self.layout.prop(brush, 'use_mask', text="")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
brush = context.tool_settings.image_paint.brush
|
||||
tex_slot_alpha = brush.mask_texture_slot
|
||||
|
||||
col = layout.column()
|
||||
|
||||
col.template_ID_preview(brush, "mask_texture", new="texture.new", rows=3, cols=8)
|
||||
|
||||
brush_mask_texture_settings(col, brush)
|
||||
|
||||
|
||||
class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, Panel):
|
||||
bl_label = "Tool"
|
||||
|
@@ -157,6 +157,10 @@ class INFO_MT_file_import(Menu):
|
||||
def draw(self, context):
|
||||
if hasattr(bpy.types, "WM_OT_collada_import"):
|
||||
self.layout.operator("wm.collada_import", text="Collada (Default) (.dae)")
|
||||
if hasattr(bpy.types, "WM_OT_assimp_import"):
|
||||
self.layout.operator("wm.assimp_import", text="Open Asset Import Library (Default) (multiple)")
|
||||
if hasattr(bpy.types, "WM_OT_fbx_import"):
|
||||
self.layout.operator("wm.fbx_import", text="FBX (.fbx)")
|
||||
|
||||
|
||||
class INFO_MT_file_export(Menu):
|
||||
@@ -272,9 +276,7 @@ class INFO_MT_add(Menu):
|
||||
|
||||
# note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
|
||||
|
||||
# Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
|
||||
# "align_view" to work on first call (see [#32719]).
|
||||
layout.operator_context = 'EXEC_REGION_WIN'
|
||||
layout.operator_context = 'EXEC_AREA'
|
||||
|
||||
#layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
|
||||
layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
|
||||
|
@@ -20,6 +20,7 @@
|
||||
import bpy
|
||||
from bpy.types import Header, Menu, Panel
|
||||
import os
|
||||
import addon_utils
|
||||
|
||||
|
||||
def ui_items_general(col, context):
|
||||
@@ -84,7 +85,7 @@ class USERPREF_HT_header(Header):
|
||||
userpref = context.user_preferences
|
||||
|
||||
layout.operator_context = 'EXEC_AREA'
|
||||
layout.operator("wm.save_homefile", text="Save As Default")
|
||||
layout.operator("wm.save_preferences", text="Save As Default")
|
||||
|
||||
layout.operator_context = 'INVOKE_DEFAULT'
|
||||
|
||||
@@ -184,6 +185,8 @@ class USERPREF_PT_interface(Panel):
|
||||
col.separator()
|
||||
col.separator()
|
||||
|
||||
col.label(text="3D view floating controls:")
|
||||
col.prop(view, "floating_controls")
|
||||
col.prop(view, "show_mini_axis", text="Display Mini Axis")
|
||||
sub = col.column()
|
||||
sub.active = view.show_mini_axis
|
||||
@@ -865,7 +868,7 @@ class USERPREF_MT_ndof_settings(Menu):
|
||||
|
||||
layout.separator()
|
||||
layout.label(text="Orbit options")
|
||||
layout.row().prop(input_prefs, "ndof_view_rotate_method", text="")
|
||||
layout.prop(input_prefs, "ndof_turntable")
|
||||
layout.prop(input_prefs, "ndof_roll_invert_axis")
|
||||
layout.prop(input_prefs, "ndof_tilt_invert_axis")
|
||||
layout.prop(input_prefs, "ndof_rotate_invert_axis")
|
||||
@@ -952,8 +955,6 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel):
|
||||
sub = col.column()
|
||||
sub.label(text="NDOF Device:")
|
||||
sub.prop(inputs, "ndof_sensitivity", text="NDOF Sensitivity")
|
||||
sub.prop(inputs, "ndof_orbit_sensitivity", text="NDOF Orbit Sensitivity")
|
||||
sub.row().prop(inputs, "ndof_view_rotate_method", expand=True)
|
||||
|
||||
row.separator()
|
||||
|
||||
@@ -1032,8 +1033,6 @@ class USERPREF_PT_addons(Panel):
|
||||
box.label(l)
|
||||
|
||||
def draw(self, context):
|
||||
import addon_utils
|
||||
|
||||
layout = self.layout
|
||||
|
||||
userpref = context.user_preferences
|
||||
|
@@ -2710,6 +2710,125 @@ class VIEW3D_PT_context_properties(Panel):
|
||||
rna_prop_ui.draw(self.layout, context, member, object, False)
|
||||
|
||||
|
||||
class VIEW3D_PT_floating_controls(Panel):
|
||||
bl_space_type = 'VIEW_3D'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_label = "Floating Controls"
|
||||
bl_options = {'HIDE_HEADER'}
|
||||
|
||||
def make_lastop(self, context, layout):
|
||||
wm = context.window_manager
|
||||
|
||||
last_operator = wm.last_redo()
|
||||
if last_operator != None:
|
||||
lastop = layout.row()
|
||||
lastop.alignment = 'RIGHT'
|
||||
|
||||
lastop_name = last_operator.name
|
||||
for id, p in last_operator.properties.items():
|
||||
if last_operator.properties.is_property_primary(id):
|
||||
if str(p.__class__) == "<class 'IDPropertyArray'>":
|
||||
lastop_name = lastop_name + " ("
|
||||
for v in p:
|
||||
if type(v) is float:
|
||||
string_formatted = "%(pretty_number).3f" % { "pretty_number": v }
|
||||
else:
|
||||
string_formatted = str(v)
|
||||
lastop_name = lastop_name + string_formatted + " "
|
||||
lastop_name = lastop_name[:-1] # cut off the last space
|
||||
lastop_name = lastop_name + ")"
|
||||
else:
|
||||
lastop_name = lastop_name + " (" + str(p) + ")"
|
||||
|
||||
lastop.operator("screen.redo_last", text=lastop_name, emboss=False)
|
||||
|
||||
def draw(self, context):
|
||||
view = context.space_data
|
||||
tools = context.tool_settings
|
||||
wm = context.window_manager
|
||||
floating_controls = context.user_preferences.view.floating_controls
|
||||
|
||||
if floating_controls in {'BOTTOM', 'TOP'}:
|
||||
layout = self.layout
|
||||
|
||||
row = None
|
||||
|
||||
if floating_controls == 'BOTTOM':
|
||||
layout.alignment = 'BOTTOM'
|
||||
row = layout.row() # Create this first so it floats on the bottom
|
||||
|
||||
self.make_lastop(context, layout)
|
||||
|
||||
if floating_controls == 'TOP':
|
||||
row = layout.row()
|
||||
|
||||
row = row.row(align=True)
|
||||
row.alignment = 'CENTER'
|
||||
row.scale_x = 1.5
|
||||
row.scale_y = 1.5
|
||||
row.prop(view, "use_manipulator_translate", text="", icon='MAN_TRANS', clearfield=True)
|
||||
row.prop(view, "use_manipulator_rotate", text="", icon='MAN_ROT', clearfield=True)
|
||||
row.prop(view, "use_manipulator_scale", text="", icon='MAN_SCALE', clearfield=True)
|
||||
|
||||
row.separator()
|
||||
|
||||
# When the user is in edit mode, these buttons are property controls so that they can remember state,
|
||||
# toggle on and off, make use of shift, etc. However, when the user is in object mode they're drawn
|
||||
# as operator controls so that they render off (popped, not toggled) and when the user clicks they
|
||||
# invoke edit mode.
|
||||
|
||||
if context.object.mode == 'EDIT':
|
||||
props = row.operator("object.mode_set", text="", icon='OBJECT_DATA')
|
||||
props.mode='OBJECT'
|
||||
row.prop(tools, "use_select_vertex", text="", clearfield=True)
|
||||
row.prop(tools, "use_select_edge", text="", clearfield=True)
|
||||
row.prop(tools, "use_select_face", text="", clearfield=True)
|
||||
|
||||
else:
|
||||
row.prop(tools, "object_select_mode", text="")
|
||||
props = row.operator("mesh.selection_mode_set", text="", icon='VERTEXSEL')
|
||||
props.mode='VERTEX'
|
||||
props = row.operator("mesh.selection_mode_set", text="", icon='EDGESEL')
|
||||
props.mode='EDGE'
|
||||
props = row.operator("mesh.selection_mode_set", text="", icon='FACESEL')
|
||||
props.mode='FACE'
|
||||
|
||||
elif floating_controls in {'LEFT', 'RIGHT'}:
|
||||
layout = self.layout
|
||||
|
||||
self.make_lastop(context, layout)
|
||||
|
||||
row = layout.row()
|
||||
if floating_controls == 'RIGHT':
|
||||
row.alignment = 'RIGHT'
|
||||
|
||||
column = row.column(align=True)
|
||||
column.alignment = 'CENTER'
|
||||
column.scale_x = 1.5
|
||||
column.scale_y = 1.5
|
||||
column.prop(view, "use_manipulator_translate", text="", icon='MAN_TRANS', clearfield=True)
|
||||
column.prop(view, "use_manipulator_rotate", text="", icon='MAN_ROT', clearfield=True)
|
||||
column.prop(view, "use_manipulator_scale", text="", icon='MAN_SCALE', clearfield=True)
|
||||
|
||||
column.separator()
|
||||
|
||||
if context.object.mode == 'EDIT':
|
||||
props = row.operator("object.mode_set", text="", icon='OBJECT_DATA')
|
||||
props.mode='OBJECT'
|
||||
column.prop(tools, "use_select_vertex", text="", clearfield=True)
|
||||
column.prop(tools, "use_select_edge", text="", clearfield=True)
|
||||
column.prop(tools, "use_select_face", text="", clearfield=True)
|
||||
|
||||
else:
|
||||
column.prop(tools, "object_select_mode", text="")
|
||||
props = column.operator("mesh.selection_mode_set", text="", icon='VERTEXSEL')
|
||||
props.mode='VERTEX'
|
||||
props = column.operator("mesh.selection_mode_set", text="", icon='EDGESEL')
|
||||
props.mode='EDGE'
|
||||
props = column.operator("mesh.selection_mode_set", text="", icon='FACESEL')
|
||||
props.mode='FACE'
|
||||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
|
||||
|
@@ -20,8 +20,8 @@
|
||||
import bpy
|
||||
from bpy.types import Menu, Panel
|
||||
from bl_ui.properties_paint_common import UnifiedPaintPanel
|
||||
from bl_ui.properties_paint_common import sculpt_brush_texture_settings
|
||||
|
||||
from bl_ui.properties_paint_common import brush_texture_settings
|
||||
from bl_ui.properties_paint_common import brush_mask_texture_settings
|
||||
|
||||
class View3DPanel():
|
||||
bl_space_type = 'VIEW_3D'
|
||||
@@ -207,6 +207,8 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
|
||||
col.label("Edge Select Mode:")
|
||||
col.prop(tool_settings, "edge_path_mode", text="")
|
||||
col.prop(tool_settings, "edge_path_live_unwrap")
|
||||
col.prop(tool_settings, "correct_uv")
|
||||
|
||||
col.label("Double Threshold:")
|
||||
col.prop(tool_settings, "double_threshold", text="")
|
||||
|
||||
@@ -511,7 +513,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
|
||||
# Sculpt Mode #
|
||||
|
||||
elif context.sculpt_object and brush:
|
||||
capabilities = brush.sculpt_capabilities
|
||||
capabilities = brush.paint_capabilities
|
||||
|
||||
col = layout.column()
|
||||
|
||||
@@ -635,11 +637,16 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
|
||||
col = layout.column()
|
||||
col.template_color_wheel(brush, "color", value_slider=True)
|
||||
col.prop(brush, "color", text="")
|
||||
col.prop(settings, "invert_color")
|
||||
|
||||
row = col.row(align=True)
|
||||
self.prop_unified_size(row, context, brush, "use_locked_size", icon='LOCKED')
|
||||
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
|
||||
self.prop_unified_size(row, context, brush, "use_pressure_size")
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(brush, "random_size", slider=True)
|
||||
|
||||
row = col.row(align=True)
|
||||
self.prop_unified_strength(row, context, brush, "strength", text="Strength")
|
||||
self.prop_unified_strength(row, context, brush, "use_pressure_strength")
|
||||
@@ -665,6 +672,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
|
||||
self.prop_unified_weight(row, context, brush, "weight", slider=True, text="Weight")
|
||||
|
||||
row = col.row(align=True)
|
||||
self.prop_unified_size(row, context, brush, "use_locked_size", icon='LOCKED')
|
||||
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
|
||||
self.prop_unified_size(row, context, brush, "use_pressure_size")
|
||||
|
||||
@@ -685,6 +693,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
|
||||
col.prop(brush, "color", text="")
|
||||
|
||||
row = col.row(align=True)
|
||||
self.prop_unified_size(row, context, brush, "use_locked_size", icon='LOCKED')
|
||||
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
|
||||
self.prop_unified_size(row, context, brush, "use_pressure_size")
|
||||
|
||||
@@ -707,8 +716,7 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
settings = cls.paint_settings(context)
|
||||
return (settings and settings.brush and (context.sculpt_object or
|
||||
context.image_paint_object))
|
||||
return (settings and settings.brush and (context.sculpt_object or context.image_paint_object))
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -720,15 +728,13 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
|
||||
col = layout.column()
|
||||
|
||||
col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
|
||||
if brush.use_paint_image:
|
||||
col.prop(brush, "use_fixed_texture")
|
||||
|
||||
if context.sculpt_object:
|
||||
sculpt_brush_texture_settings(col, brush)
|
||||
if context.sculpt_object or context.image_paint_object:
|
||||
brush_texture_settings(col, brush, context.sculpt_object)
|
||||
|
||||
# use_texture_overlay and texture_overlay_alpha
|
||||
col = layout.column(align=True)
|
||||
col.active = brush.sculpt_capabilities.has_overlay
|
||||
col.active = brush.paint_capabilities.has_overlay
|
||||
col.label(text="Overlay:")
|
||||
|
||||
row = col.row()
|
||||
@@ -740,6 +746,34 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
|
||||
sub.prop(brush, "texture_overlay_alpha", text="Alpha")
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_mask_texture(View3DPanel, Panel):
|
||||
bl_context = "imagepaint"
|
||||
bl_label = "Texture Mask"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
brush = context.tool_settings.image_paint.brush
|
||||
return (context.image_paint_object and brush and brush.image_tool != 'SOFTEN')
|
||||
|
||||
def draw_header(self, context):
|
||||
brush = context.tool_settings.image_paint.brush
|
||||
tex_slot_alpha = brush.mask_texture_slot
|
||||
self.layout.prop(brush, 'use_mask', text="")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
brush = context.tool_settings.image_paint.brush
|
||||
tex_slot_alpha = brush.mask_texture_slot
|
||||
|
||||
col = layout.column()
|
||||
|
||||
col.template_ID_preview(brush, "mask_texture", new="texture.new", rows=3, cols=8)
|
||||
|
||||
brush_mask_texture_settings(col, brush)
|
||||
|
||||
|
||||
class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
|
||||
bl_label = "Stroke"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
@@ -779,7 +813,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
|
||||
row.active = brush.use_space
|
||||
row.prop(brush, "spacing", text="Spacing")
|
||||
|
||||
if brush.sculpt_capabilities.has_smooth_stroke:
|
||||
if brush.paint_capabilities.has_smooth_stroke:
|
||||
col = layout.column()
|
||||
col.separator()
|
||||
|
||||
@@ -790,7 +824,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
|
||||
sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
|
||||
sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
|
||||
|
||||
if brush.sculpt_capabilities.has_jitter:
|
||||
if brush.paint_capabilities.has_jitter:
|
||||
col.separator()
|
||||
|
||||
row = col.row(align=True)
|
||||
@@ -817,7 +851,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
|
||||
col.separator()
|
||||
|
||||
col = layout.column()
|
||||
col.active = brush.sculpt_capabilities.has_spacing
|
||||
col.active = brush.paint_capabilities.has_spacing
|
||||
col.prop(brush, "use_space")
|
||||
|
||||
row = col.row()
|
||||
@@ -931,7 +965,7 @@ class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel):
|
||||
col = layout.column()
|
||||
|
||||
if context.sculpt_object and context.tool_settings.sculpt:
|
||||
if brush.sculpt_capabilities.has_secondary_color:
|
||||
if brush.paint_capabilities.has_secondary_color:
|
||||
col.prop(brush, "cursor_color_add", text="Add Color")
|
||||
col.prop(brush, "cursor_color_subtract", text="Subtract Color")
|
||||
else:
|
||||
|
@@ -39,9 +39,10 @@ def add_object(self, context):
|
||||
|
||||
|
||||
class OBJECT_OT_add_object(Operator, AddObjectHelper):
|
||||
"""Create a new Mesh Object"""
|
||||
"""Add a Mesh Object"""
|
||||
bl_idname = "mesh.add_object"
|
||||
bl_label = "Add Mesh Object"
|
||||
bl_description = "Create a new Mesh Object"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
scale = FloatVectorProperty(
|
||||
@@ -81,7 +82,6 @@ def register():
|
||||
bpy.utils.register_manual_map(add_object_manual_map)
|
||||
bpy.types.INFO_MT_mesh_add.append(add_object_button)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(OBJECT_OT_add_object)
|
||||
bpy.utils.unregister_manual_map(add_object_manual_map)
|
||||
|
@@ -188,7 +188,7 @@ HRESULT __stdcall VF_OpenFileFunc_Blen(
|
||||
SOCKET s_in;
|
||||
char buf[256];
|
||||
struct sockaddr_in addr;
|
||||
FILE *fp;
|
||||
FILE* fp;
|
||||
|
||||
p = lpFileName;
|
||||
while (*p && *p != '.') p++;
|
||||
@@ -229,7 +229,7 @@ HRESULT __stdcall VF_OpenFileFunc_Blen(
|
||||
return VF_ERROR;
|
||||
}
|
||||
|
||||
rval = (conndesc *) malloc(sizeof(conndesc));
|
||||
rval = (conndesc*) malloc(sizeof(conndesc));
|
||||
|
||||
rval->addr = addr;
|
||||
|
||||
@@ -281,7 +281,7 @@ HRESULT __stdcall VF_OpenFileFunc_Blen(
|
||||
HRESULT __stdcall VF_CloseFileFunc_Blen(
|
||||
VF_FileHandle hFileHandle )
|
||||
{
|
||||
free((conndesc *) hFileHandle);
|
||||
free((conndesc*) hFileHandle);
|
||||
|
||||
return VF_OK;
|
||||
}
|
||||
@@ -290,7 +290,7 @@ HRESULT __stdcall VF_GetFileInfoFunc_Blen(
|
||||
VF_FileHandle hFileHandle,
|
||||
LPVF_FileInfo lpFileInfo )
|
||||
{
|
||||
conndesc *c = (conndesc *) hFileHandle;
|
||||
conndesc * c = (conndesc*) hFileHandle;
|
||||
if (c == 0) {
|
||||
return VF_ERROR;
|
||||
}
|
||||
@@ -385,10 +385,10 @@ HRESULT __stdcall VF_ReadDataFunc_Blen(
|
||||
framebuf = (unsigned char*) v->lpData;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
unsigned char *p = framebuf + v->lPitch * y;
|
||||
unsigned char *e = p + width * 3;
|
||||
unsigned char * p = framebuf + v->lPitch * y;
|
||||
unsigned char * e = p + width * 3;
|
||||
|
||||
my_recv(s_in, (char *)p, width * 3);
|
||||
my_recv(s_in, (char*) p, width * 3);
|
||||
while (p != e) {
|
||||
unsigned char tmp = p[2];
|
||||
p[2] = p[0];
|
||||
|
@@ -135,3 +135,11 @@ endif()
|
||||
if(WITH_OPENCOLLADA)
|
||||
add_subdirectory(collada)
|
||||
endif()
|
||||
|
||||
if(WITH_ASSIMP)
|
||||
add_subdirectory(assimp)
|
||||
endif()
|
||||
|
||||
if(WITH_FBX)
|
||||
add_subdirectory(fbx)
|
||||
endif()
|
||||
|
@@ -38,6 +38,12 @@ if env['WITH_BF_QUICKTIME']:
|
||||
if env['WITH_BF_COLLADA']:
|
||||
SConscript (['collada/SConscript'])
|
||||
|
||||
if env['WITH_BF_ASSIMP']:
|
||||
SConscript (['assimp/SConscript'])
|
||||
|
||||
if env['WITH_BF_FBX']:
|
||||
SConscript (['fbx/SConscript'])
|
||||
|
||||
if env['WITH_BF_COMPOSITOR']:
|
||||
SConscript (['compositor/SConscript',
|
||||
'opencl/SConscript'])
|
||||
|
@@ -203,7 +203,7 @@ void BKE_pose_ikparam_init(struct bPose *pose);
|
||||
void BKE_pose_itasc_init(struct bItasc *itasc);
|
||||
|
||||
/* clears BONE_UNKEYED flags for frame changing */
|
||||
// XXX to be deprecated for a more general solution in animsys...
|
||||
// XXX to be depreceated for a more general solution in animsys...
|
||||
void framechange_poses_clear_unkeyed(void);
|
||||
|
||||
/* Bone Groups API --------------------- */
|
||||
|
@@ -67,14 +67,15 @@ float BKE_brush_curve_strength_clamp(struct Brush *br, float p, const float len)
|
||||
float BKE_brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */
|
||||
|
||||
/* sampling */
|
||||
void BKE_brush_sample_tex(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4], const int thread);
|
||||
void BKE_brush_sample_tex(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4], const int thread, float angle);
|
||||
float BKE_brush_sample_masktex(const struct Scene *scene, struct Brush *brush, const float xy[2], const int thread, float angle);
|
||||
void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size,
|
||||
struct ImBuf **imbuf, int use_color_correction);
|
||||
struct ImBuf **imbuf, float angle, int use_color_correction, short invert);
|
||||
|
||||
/* painting */
|
||||
struct BrushPainter;
|
||||
typedef struct BrushPainter BrushPainter;
|
||||
typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, const float lastpos[2], const float pos[2]);
|
||||
typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, const float lastpos[2], const float pos[2], float rotation);
|
||||
|
||||
BrushPainter *BKE_brush_painter_new(struct Scene *scene, struct Brush *brush);
|
||||
void BKE_brush_painter_require_imbuf(BrushPainter *painter, short flt,
|
||||
@@ -91,7 +92,8 @@ unsigned int *BKE_brush_gen_texture_cache(struct Brush *br, int half_side);
|
||||
struct ImBuf *BKE_brush_gen_radial_control_imbuf(struct Brush *br);
|
||||
|
||||
/* unified strength and size */
|
||||
|
||||
void BKE_brush_randomize_size(struct Brush *brush);
|
||||
int BKE_brush_size_randomized_get(const struct Scene *scene, struct Brush *brush);
|
||||
int BKE_brush_size_get(const struct Scene *scene, struct Brush *brush);
|
||||
void BKE_brush_size_set(struct Scene *scene, struct Brush *brush, int value);
|
||||
|
||||
@@ -99,8 +101,9 @@ float BKE_brush_unprojected_radius_get(const struct Scene *scene, struct Brush *
|
||||
void BKE_brush_unprojected_radius_set(struct Scene *scene, struct Brush *brush, float value);
|
||||
|
||||
float BKE_brush_alpha_get(const struct Scene *scene, struct Brush *brush);
|
||||
float BKE_brush_weight_get(const Scene *scene, struct Brush *brush);
|
||||
void BKE_brush_weight_set(const Scene *scene, struct Brush *brush, float value);
|
||||
void BKE_brush_alpha_set(struct Scene *scene, struct Brush *brush, float alpha);
|
||||
float BKE_brush_weight_get(const struct Scene *scene, struct Brush *brush);
|
||||
void BKE_brush_weight_set(const struct Scene *scene, struct Brush *brush, float value);
|
||||
|
||||
int BKE_brush_use_locked_size(const struct Scene *scene, struct Brush *brush);
|
||||
int BKE_brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush);
|
||||
|
@@ -102,6 +102,12 @@ typedef struct Global {
|
||||
|
||||
/* save the allowed windowstate of blender when using -W or -w */
|
||||
int windowstate;
|
||||
|
||||
double last_tooltip_close;
|
||||
|
||||
// Fields to enable dragging a list of toggle buttons to turn them all on or off
|
||||
void* drag_button_func; // It's a func pointer, but we only need the value to compare and we won't call the function, so I use void* to avoid a dependency on uiButHandleFunc
|
||||
int drag_button_state; // Turn them on or off as we drag?
|
||||
} Global;
|
||||
|
||||
/* **************** GLOBAL ********************* */
|
||||
@@ -166,6 +172,8 @@ enum {
|
||||
#define G_FILE_RELATIVE_REMAP (1 << 24)
|
||||
#define G_FILE_HISTORY (1 << 25)
|
||||
#define G_FILE_MESH_COMPAT (1 << 26) /* BMesh option to save as older mesh format */
|
||||
#define G_FILE_PREFERENCES (1 << 27)
|
||||
#define G_FILE_NO_DATA (1 << 28)
|
||||
|
||||
/* G.windowstate */
|
||||
#define G_WINDOWSTATE_USERDEF 0
|
||||
|
@@ -68,7 +68,7 @@ typedef struct Main {
|
||||
ListBase latt;
|
||||
ListBase lamp;
|
||||
ListBase camera;
|
||||
ListBase ipo; // XXX deprecated
|
||||
ListBase ipo; // XXX depreceated
|
||||
ListBase key;
|
||||
ListBase world;
|
||||
ListBase screen;
|
||||
|
@@ -83,7 +83,7 @@ void assign_matarar(struct Object *ob, struct Material ***matar, short totcol);
|
||||
short find_material_index(struct Object *ob, struct Material *ma);
|
||||
|
||||
int object_add_material_slot(struct Object *ob);
|
||||
int object_remove_material_slot(struct Object *ob);
|
||||
int object_remove_material_slot(struct Object *ob, int slot);
|
||||
|
||||
/* rna api */
|
||||
void material_append_id(struct ID *id, struct Material *ma);
|
||||
|
42
source/blender/blenkernel/BKE_mirror.h
Normal file
42
source/blender/blenkernel/BKE_mirror.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef __BKE_MIRROR_H__
|
||||
#define __BKE_MIRROR_H__
|
||||
|
||||
/** \file BKE_mirror.h
|
||||
* \ingroup bke
|
||||
*/
|
||||
|
||||
struct DerivedMesh;
|
||||
struct MirrorModifierData;
|
||||
struct Object;
|
||||
|
||||
DerivedMesh *mirror_make_derived_from_derived(MirrorModifierData *mmd,
|
||||
Object *ob, DerivedMesh *dm, int orig);
|
||||
|
||||
#endif
|
@@ -475,8 +475,6 @@ struct bNodeSocket *node_group_add_extern_socket(struct bNodeTree *ntree, ListBa
|
||||
void register_node_type_frame(struct bNodeTreeType *ttype);
|
||||
void register_node_type_reroute(struct bNodeTreeType *ttype);
|
||||
|
||||
void BKE_node_tree_unlink_id_cb(void *calldata, struct ID *owner_id, struct bNodeTree *ntree);
|
||||
|
||||
/* ************** SHADER NODES *************** */
|
||||
|
||||
struct ShadeInput;
|
||||
|
@@ -54,7 +54,7 @@ void BKE_object_workob_clear(struct Object *workob);
|
||||
void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
|
||||
|
||||
void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src);
|
||||
struct SoftBody *copy_softbody(struct SoftBody *sb, int copy_caches);
|
||||
struct SoftBody *copy_softbody(struct SoftBody *sb);
|
||||
struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb);
|
||||
void BKE_object_copy_particlesystems(struct Object *obn, struct Object *ob);
|
||||
void BKE_object_copy_softbody(struct Object *obn, struct Object *ob);
|
||||
@@ -82,7 +82,6 @@ struct Object *BKE_object_add(struct Scene *scene, int type);
|
||||
void *BKE_object_obdata_add_from_type(int type);
|
||||
|
||||
struct Object *BKE_object_copy(struct Object *ob);
|
||||
struct Object *BKE_object_copy_with_caches(struct Object *ob);
|
||||
void BKE_object_make_local(struct Object *ob);
|
||||
int BKE_object_is_libdata(struct Object *ob);
|
||||
int BKE_object_obdata_is_libdata(struct Object *ob);
|
||||
|
@@ -45,6 +45,7 @@ struct Paint;
|
||||
struct PBVH;
|
||||
struct Scene;
|
||||
struct StrokeCache;
|
||||
struct UnifiedPaintSettings;
|
||||
|
||||
extern const char PAINT_CURSOR_SCULPT[3];
|
||||
extern const char PAINT_CURSOR_VERTEX_PAINT[3];
|
||||
@@ -76,6 +77,8 @@ int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
|
||||
float paint_grid_paint_mask(const struct GridPaintMask *gpm, unsigned level,
|
||||
unsigned x, unsigned y);
|
||||
|
||||
void paint_calculate_rake_rotation(struct UnifiedPaintSettings *ups, const float mouse_pos[]);
|
||||
|
||||
/* Session data (mode-specific) */
|
||||
|
||||
typedef struct SculptSession {
|
||||
|
@@ -303,7 +303,7 @@ struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches);
|
||||
void BKE_ptcache_free_mem(struct ListBase *mem_cache);
|
||||
void BKE_ptcache_free(struct PointCache *cache);
|
||||
void BKE_ptcache_free_list(struct ListBase *ptcaches);
|
||||
struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct ListBase *ptcaches_old, int copy_data);
|
||||
struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct ListBase *ptcaches_old);
|
||||
|
||||
/********************** Baking *********************/
|
||||
|
||||
|
@@ -109,7 +109,6 @@ float get_render_aosss_error(struct RenderData *r, float error);
|
||||
int BKE_scene_use_new_shading_nodes(struct Scene *scene);
|
||||
|
||||
void BKE_scene_disable_color_management(struct Scene *scene);
|
||||
int BKE_scene_check_color_management_enabled(const struct Scene *scene);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -155,6 +155,8 @@ typedef struct ARegionType {
|
||||
short do_lock, lock;
|
||||
/* call cursor function on each move event */
|
||||
short event_cursor;
|
||||
/* If it's enabled, don't clear the region before drawing panels (ED_region_panels) */
|
||||
char dont_clear;
|
||||
} ARegionType;
|
||||
|
||||
/* panel types */
|
||||
|
@@ -109,6 +109,7 @@ set(SRC
|
||||
intern/mball.c
|
||||
intern/mesh.c
|
||||
intern/mesh_validate.c
|
||||
intern/mirror.c
|
||||
intern/modifier.c
|
||||
intern/modifiers_bmesh.c
|
||||
intern/movieclip.c
|
||||
@@ -199,6 +200,7 @@ set(SRC
|
||||
BKE_material.h
|
||||
BKE_mball.h
|
||||
BKE_mesh.h
|
||||
BKE_mirror.h
|
||||
BKE_modifier.h
|
||||
BKE_movieclip.h
|
||||
BKE_multires.h
|
||||
|
@@ -578,13 +578,6 @@ void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask)
|
||||
CustomData_set_only_copy(&dm->vertData, mask);
|
||||
CustomData_set_only_copy(&dm->edgeData, mask);
|
||||
CustomData_set_only_copy(&dm->faceData, mask);
|
||||
/* this wasn't in 2.63 and is disabled for 2.64 because it gives problems with
|
||||
* weight paint mode when there are modifiers applied, needs further investigation,
|
||||
* see replies to r50969, Campbell */
|
||||
#if 0
|
||||
CustomData_set_only_copy(&dm->loopData, mask);
|
||||
CustomData_set_only_copy(&dm->polyData, mask);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DM_add_vert_layer(DerivedMesh *dm, int type, int alloctype, void *layer)
|
||||
|
@@ -639,7 +639,7 @@ static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char
|
||||
if (fcu->rna_path != old_path) {
|
||||
bActionGroup *agrp = fcu->grp;
|
||||
|
||||
if ((agrp) && strcmp(oldName, agrp->name) == 0) {
|
||||
if ((agrp) && strcmp(oldName, agrp->name)==0) {
|
||||
BLI_strncpy(agrp->name, newName, sizeof(agrp->name));
|
||||
}
|
||||
}
|
||||
|
@@ -150,6 +150,8 @@ void initglobals(void)
|
||||
#else
|
||||
G.f &= ~G_SCRIPT_AUTOEXEC;
|
||||
#endif
|
||||
|
||||
G.drag_button_func = 0;
|
||||
}
|
||||
|
||||
/***/
|
||||
@@ -249,11 +251,13 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
|
||||
sound_init_main(G.main);
|
||||
|
||||
if (bfd->user) {
|
||||
|
||||
/* only here free userdef themes... */
|
||||
BKE_userdef_free();
|
||||
|
||||
U = *bfd->user;
|
||||
|
||||
if (G.fileflags & G_FILE_PREFERENCES) {
|
||||
/* only here free userdef themes... */
|
||||
BKE_userdef_free();
|
||||
U = *bfd->user;
|
||||
}
|
||||
|
||||
MEM_freeN(bfd->user);
|
||||
}
|
||||
|
||||
@@ -275,7 +279,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
|
||||
}
|
||||
|
||||
/* this can happen when active scene was lib-linked, and doesn't exist anymore */
|
||||
if (CTX_data_scene(C) == NULL) {
|
||||
if (CTX_data_scene(C) == NULL && CTX_wm_screen(C) && bfd->main->scene.first) {
|
||||
CTX_data_scene_set(C, bfd->main->scene.first);
|
||||
CTX_wm_screen(C)->scene = CTX_data_scene(C);
|
||||
curscene = CTX_data_scene(C);
|
||||
@@ -321,7 +325,8 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
|
||||
BLI_strncpy(G.main->name, filepath, FILE_MAX);
|
||||
|
||||
/* baseflags, groups, make depsgraph, etc */
|
||||
BKE_scene_set_background(G.main, CTX_data_scene(C));
|
||||
if (CTX_data_scene(C))
|
||||
BKE_scene_set_background(G.main, CTX_data_scene(C));
|
||||
|
||||
if (mode != 'u') {
|
||||
IMB_colormanagement_check_file_config(G.main);
|
||||
@@ -392,7 +397,7 @@ int BKE_read_file(bContext *C, const char *filepath, ReportList *reports)
|
||||
BlendFileData *bfd;
|
||||
int retval = BKE_READ_FILE_OK;
|
||||
|
||||
if (strstr(filepath, BLENDER_STARTUP_FILE) == NULL) /* don't print user-pref loading */
|
||||
if (strstr(filepath, BLENDER_STARTUP_FILE) == NULL && strstr(filepath, BLENDER_PREFERENCES_FILE) == NULL) /* don't print user-pref loading */
|
||||
printf("read blend: %s\n", filepath);
|
||||
|
||||
bfd = BLO_read_from_file(filepath, reports);
|
||||
|
@@ -96,7 +96,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
|
||||
ysize = (bytes + (ibuf->x - 1)) / ibuf->x;
|
||||
|
||||
if (ysize < ibuf->y) {
|
||||
/* we're first going to copy all data into a linear buffer.
|
||||
/* we're first going to copy all data into a liniar buffer.
|
||||
* step can be 4 or 1 bytes, and the data is not sequential because
|
||||
* the bitmap was flipped vertically. */
|
||||
|
||||
|
@@ -29,27 +29,16 @@
|
||||
* \ingroup bke
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "DNA_brush_types.h"
|
||||
#include "DNA_color_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_windowmanager_types.h"
|
||||
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
||||
#include "BLI_bpath.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_rand.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_colortools.h"
|
||||
@@ -102,9 +91,11 @@ static void brush_defaults(Brush *brush)
|
||||
brush->rate = 0.1f; /* time delay between dots of paint or sculpting when doing airbrush mode */
|
||||
|
||||
brush->jitter = 0.0f;
|
||||
|
||||
brush->random_size = 0.0;
|
||||
brush->random_factor_cache = 1.0;
|
||||
/* BRUSH TEXTURE SETTINGS */
|
||||
default_mtex(&brush->mtex);
|
||||
default_mtex(&brush->mask_mtex);
|
||||
|
||||
brush->texture_sample_bias = 0; /* value to added to texture samples */
|
||||
brush->texture_overlay_alpha = 33;
|
||||
@@ -150,6 +141,9 @@ Brush *BKE_brush_copy(Brush *brush)
|
||||
if (brush->mtex.tex)
|
||||
id_us_plus((ID *)brush->mtex.tex);
|
||||
|
||||
if (brush->mask_mtex.tex)
|
||||
id_us_plus((ID *)brush->mask_mtex.tex);
|
||||
|
||||
if (brush->icon_imbuf)
|
||||
brushn->icon_imbuf = IMB_dupImBuf(brush->icon_imbuf);
|
||||
|
||||
@@ -172,6 +166,9 @@ void BKE_brush_free(Brush *brush)
|
||||
if (brush->mtex.tex)
|
||||
brush->mtex.tex->id.us--;
|
||||
|
||||
if (brush->mask_mtex.tex)
|
||||
brush->mask_mtex.tex->id.us--;
|
||||
|
||||
if (brush->icon_imbuf)
|
||||
IMB_freeImBuf(brush->icon_imbuf);
|
||||
|
||||
@@ -183,6 +180,7 @@ void BKE_brush_free(Brush *brush)
|
||||
static void extern_local_brush(Brush *brush)
|
||||
{
|
||||
id_lib_extern((ID *)brush->mtex.tex);
|
||||
id_lib_extern((ID *)brush->mask_mtex.tex);
|
||||
id_lib_extern((ID *)brush->clone.image);
|
||||
}
|
||||
|
||||
@@ -296,6 +294,8 @@ void BKE_brush_debug_print_state(Brush *br)
|
||||
BR_TEST_FLAG(BRUSH_CUSTOM_ICON);
|
||||
|
||||
BR_TEST(jitter, f);
|
||||
BR_TEST(random_size, f);
|
||||
BR_TEST(random_factor_cache, f);
|
||||
BR_TEST(spacing, d);
|
||||
BR_TEST(smooth_stroke_radius, d);
|
||||
BR_TEST(smooth_stroke_factor, f);
|
||||
@@ -485,20 +485,40 @@ int BKE_brush_clone_image_delete(Brush *brush)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* reset the random size cache to a random value, proportional to the size of the brush.
|
||||
* due to the many places BKE_brush_size_get is called it is not safe to generate a random
|
||||
* number for every call. Instead we will generate a random number before each stroke */
|
||||
void BKE_brush_randomize_size(Brush *brush)
|
||||
{
|
||||
brush->random_factor_cache = (1.0 - brush->random_size / 2.0) + brush->random_size * BLI_frand();
|
||||
}
|
||||
|
||||
|
||||
/* Brush Sampling */
|
||||
void BKE_brush_sample_tex(const Scene *scene, Brush *brush, const float xy[2], float rgba[4], const int thread)
|
||||
void BKE_brush_sample_tex(const Scene *scene, Brush *brush, const float xy[2], float rgba[4], const int thread, float angle)
|
||||
{
|
||||
MTex *mtex = &brush->mtex;
|
||||
|
||||
if (mtex && mtex->tex) {
|
||||
float co_angle, length;
|
||||
float co[3], tin, tr, tg, tb, ta;
|
||||
int hasrgb;
|
||||
const int radius = BKE_brush_size_get(scene, brush);
|
||||
const int radius = BKE_brush_size_randomized_get(scene, brush);
|
||||
|
||||
co[0] = xy[0] / radius;
|
||||
co[1] = xy[1] / radius;
|
||||
co[2] = 0.0f;
|
||||
|
||||
if (fabsf(angle) > 0.0001f) {
|
||||
length = normalize_v2(co);
|
||||
co_angle = acos(co[0]);
|
||||
co_angle = (co[1] > 0)? co_angle : - co_angle;
|
||||
|
||||
co_angle -= angle;
|
||||
co[0] = cos(co_angle)*length;
|
||||
co[1] = sin(co_angle)*length;
|
||||
}
|
||||
|
||||
hasrgb = externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, thread);
|
||||
|
||||
if (hasrgb) {
|
||||
@@ -519,17 +539,56 @@ void BKE_brush_sample_tex(const Scene *scene, Brush *brush, const float xy[2], f
|
||||
}
|
||||
}
|
||||
|
||||
/* Brush Mask Sampling */
|
||||
float BKE_brush_sample_masktex(const Scene *scene, Brush *brush, const float xy[2], const int thread, float angle)
|
||||
{
|
||||
MTex *mtex = &brush->mask_mtex;
|
||||
|
||||
if (mtex && mtex->tex) {
|
||||
float co_angle, length;
|
||||
float co[3], tin, rgb[3], ta;
|
||||
int hasrgb;
|
||||
const int radius = BKE_brush_size_randomized_get(scene, brush);
|
||||
|
||||
co[0] = xy[0] / radius;
|
||||
co[1] = xy[1] / radius;
|
||||
co[2] = 0.0f;
|
||||
|
||||
if (fabsf(angle) > 0.0001f) {
|
||||
length = normalize_v2(co);
|
||||
co_angle = acos(co[0]);
|
||||
co_angle = (co[1] > 0) ? co_angle : -co_angle;
|
||||
|
||||
co_angle -= angle;
|
||||
co[0] = cos(co_angle)*length;
|
||||
co[1] = sin(co_angle)*length;
|
||||
}
|
||||
|
||||
hasrgb = externtex(mtex, co, &tin, rgb, rgb+1, rgb+2, &ta, thread);
|
||||
|
||||
if (hasrgb) {
|
||||
return rgb_to_grayscale(rgb);
|
||||
}
|
||||
else {
|
||||
return tin;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO, use define for 'texfall' arg */
|
||||
void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall, int bufsize, ImBuf **outbuf, int use_color_correction)
|
||||
void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall, int bufsize, ImBuf **outbuf, float angle, int use_color_correction, short invert)
|
||||
{
|
||||
ImBuf *ibuf;
|
||||
float xy[2], rgba[4], *dstf;
|
||||
int x, y, rowbytes, xoff, yoff, imbflag;
|
||||
const int radius = BKE_brush_size_get(scene, brush);
|
||||
const int radius = BKE_brush_size_randomized_get(scene, brush);
|
||||
unsigned char *dst, crgb[3];
|
||||
const float alpha = BKE_brush_alpha_get(scene, brush);
|
||||
float brush_rgb[3];
|
||||
|
||||
|
||||
imbflag = (flt) ? IB_rectfloat : IB_rect;
|
||||
xoff = -bufsize / 2.0f + 0.5f;
|
||||
yoff = -bufsize / 2.0f + 0.5f;
|
||||
@@ -553,17 +612,22 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf
|
||||
xy[0] = x + xoff;
|
||||
xy[1] = y + yoff;
|
||||
|
||||
/* texfall = 0, 1 seem unused from a quick search */
|
||||
if (texfall == 0) {
|
||||
copy_v3_v3(dstf, brush_rgb);
|
||||
dstf[3] = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
|
||||
if (invert) rgb_invert(dstf);
|
||||
}
|
||||
else if (texfall == 1) {
|
||||
BKE_brush_sample_tex(scene, brush, xy, dstf, 0);
|
||||
BKE_brush_sample_tex(scene, brush, xy, dstf, 0, angle);
|
||||
if (invert) rgb_invert(dstf);
|
||||
}
|
||||
else {
|
||||
BKE_brush_sample_tex(scene, brush, xy, rgba, 0);
|
||||
BKE_brush_sample_tex(scene, brush, xy, rgba, 0, angle);
|
||||
mul_v3_v3v3(dstf, rgba, brush_rgb);
|
||||
dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
|
||||
if (invert) rgb_invert(dstf);
|
||||
dstf[3] = rgba[3] *alpha *BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius)
|
||||
*BKE_brush_sample_masktex(scene, brush, xy, 0, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -588,26 +652,31 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf
|
||||
dst[3] = FTOCHAR(alpha_f);
|
||||
}
|
||||
else if (texfall == 1) {
|
||||
BKE_brush_sample_tex(scene, brush, xy, rgba, 0);
|
||||
BKE_brush_sample_tex(scene, brush, xy, rgba, 0, angle);
|
||||
rgba_float_to_uchar(dst, rgba);
|
||||
if (invert) rgb_invert_uchar(dst);
|
||||
}
|
||||
else if (texfall == 2) {
|
||||
BKE_brush_sample_tex(scene, brush, xy, rgba, 0);
|
||||
BKE_brush_sample_tex(scene, brush, xy, rgba, 0, angle);
|
||||
mul_v3_v3(rgba, brush->rgb);
|
||||
alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
|
||||
alpha_f = rgba[3] *alpha *BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius)
|
||||
*BKE_brush_sample_masktex(scene, brush, xy, 0, angle);
|
||||
|
||||
rgb_float_to_uchar(dst, rgba);
|
||||
if (invert) rgb_invert_uchar(dst);
|
||||
|
||||
dst[3] = FTOCHAR(alpha_f);
|
||||
}
|
||||
else {
|
||||
BKE_brush_sample_tex(scene, brush, xy, rgba, 0);
|
||||
alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
|
||||
BKE_brush_sample_tex(scene, brush, xy, rgba, 0, angle);
|
||||
alpha_f = rgba[3] *alpha *BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius)
|
||||
*BKE_brush_sample_masktex(scene, brush, xy, 0, angle);
|
||||
|
||||
dst[0] = crgb[0];
|
||||
dst[1] = crgb[1];
|
||||
dst[2] = crgb[2];
|
||||
dst[3] = FTOCHAR(alpha_f);
|
||||
if (invert) rgb_invert_uchar(dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -648,6 +717,13 @@ int BKE_brush_size_get(const Scene *scene, Brush *brush)
|
||||
return (ups->flag & UNIFIED_PAINT_SIZE) ? ups->size : brush->size;
|
||||
}
|
||||
|
||||
int BKE_brush_size_randomized_get(const Scene *scene, Brush *brush)
|
||||
{
|
||||
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
|
||||
|
||||
return (ups->flag & UNIFIED_PAINT_SIZE) ? brush->random_factor_cache * ups->size : brush->random_factor_cache * brush->size;
|
||||
}
|
||||
|
||||
int BKE_brush_use_locked_size(const Scene *scene, Brush *brush)
|
||||
{
|
||||
const short us_flag = scene->toolsettings->unified_paint_settings.flag;
|
||||
@@ -694,7 +770,7 @@ float BKE_brush_unprojected_radius_get(const Scene *scene, Brush *brush)
|
||||
brush->unprojected_radius;
|
||||
}
|
||||
|
||||
static void brush_alpha_set(Scene *scene, Brush *brush, float alpha)
|
||||
void BKE_brush_alpha_set(Scene *scene, Brush *brush, float alpha)
|
||||
{
|
||||
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
|
||||
|
||||
@@ -752,315 +828,6 @@ void BKE_brush_scale_size(int *BKE_brush_size_get,
|
||||
(*BKE_brush_size_get) = (int)((float)(*BKE_brush_size_get) * scale);
|
||||
}
|
||||
|
||||
/* Brush Painting */
|
||||
|
||||
typedef struct BrushPainterCache {
|
||||
short enabled;
|
||||
|
||||
int size; /* size override, if 0 uses 2*BKE_brush_size_get(brush) */
|
||||
short flt; /* need float imbuf? */
|
||||
short texonly; /* no alpha, color or fallof, only texture in imbuf */
|
||||
|
||||
int lastsize;
|
||||
float lastalpha;
|
||||
float lastjitter;
|
||||
|
||||
ImBuf *ibuf;
|
||||
ImBuf *texibuf;
|
||||
ImBuf *maskibuf;
|
||||
} BrushPainterCache;
|
||||
|
||||
struct BrushPainter {
|
||||
Scene *scene;
|
||||
Brush *brush;
|
||||
|
||||
float lastmousepos[2]; /* mouse position of last paint call */
|
||||
|
||||
float accumdistance; /* accumulated distance of brush since last paint op */
|
||||
float lastpaintpos[2]; /* position of last paint op */
|
||||
float startpaintpos[2]; /* position of first paint */
|
||||
|
||||
double accumtime; /* accumulated time since last paint op (airbrush) */
|
||||
double lasttime; /* time of last update */
|
||||
|
||||
float lastpressure;
|
||||
|
||||
short firsttouch; /* first paint op */
|
||||
|
||||
float startsize;
|
||||
float startalpha;
|
||||
float startjitter;
|
||||
float startspacing;
|
||||
|
||||
BrushPainterCache cache;
|
||||
};
|
||||
|
||||
BrushPainter *BKE_brush_painter_new(Scene *scene, Brush *brush)
|
||||
{
|
||||
BrushPainter *painter = MEM_callocN(sizeof(BrushPainter), "BrushPainter");
|
||||
|
||||
painter->brush = brush;
|
||||
painter->scene = scene;
|
||||
painter->firsttouch = 1;
|
||||
painter->cache.lastsize = -1; /* force ibuf create in refresh */
|
||||
|
||||
painter->startsize = BKE_brush_size_get(scene, brush);
|
||||
painter->startalpha = BKE_brush_alpha_get(scene, brush);
|
||||
painter->startjitter = brush->jitter;
|
||||
painter->startspacing = brush->spacing;
|
||||
|
||||
return painter;
|
||||
}
|
||||
|
||||
void BKE_brush_painter_require_imbuf(BrushPainter *painter, short flt, short texonly, int size)
|
||||
{
|
||||
if ((painter->cache.flt != flt) || (painter->cache.size != size) ||
|
||||
((painter->cache.texonly != texonly) && texonly))
|
||||
{
|
||||
if (painter->cache.ibuf) IMB_freeImBuf(painter->cache.ibuf);
|
||||
if (painter->cache.maskibuf) IMB_freeImBuf(painter->cache.maskibuf);
|
||||
painter->cache.ibuf = painter->cache.maskibuf = NULL;
|
||||
painter->cache.lastsize = -1; /* force ibuf create in refresh */
|
||||
}
|
||||
|
||||
if (painter->cache.flt != flt) {
|
||||
if (painter->cache.texibuf) IMB_freeImBuf(painter->cache.texibuf);
|
||||
painter->cache.texibuf = NULL;
|
||||
painter->cache.lastsize = -1; /* force ibuf create in refresh */
|
||||
}
|
||||
|
||||
painter->cache.size = size;
|
||||
painter->cache.flt = flt;
|
||||
painter->cache.texonly = texonly;
|
||||
painter->cache.enabled = 1;
|
||||
}
|
||||
|
||||
void BKE_brush_painter_free(BrushPainter *painter)
|
||||
{
|
||||
Brush *brush = painter->brush;
|
||||
|
||||
BKE_brush_size_set(painter->scene, brush, painter->startsize);
|
||||
brush_alpha_set(painter->scene, brush, painter->startalpha);
|
||||
brush->jitter = painter->startjitter;
|
||||
brush->spacing = painter->startspacing;
|
||||
|
||||
if (painter->cache.ibuf) IMB_freeImBuf(painter->cache.ibuf);
|
||||
if (painter->cache.texibuf) IMB_freeImBuf(painter->cache.texibuf);
|
||||
if (painter->cache.maskibuf) IMB_freeImBuf(painter->cache.maskibuf);
|
||||
MEM_freeN(painter);
|
||||
}
|
||||
|
||||
static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf,
|
||||
int x, int y, int w, int h, int xt, int yt,
|
||||
const float pos[2])
|
||||
{
|
||||
Scene *scene = painter->scene;
|
||||
Brush *brush = painter->brush;
|
||||
ImBuf *ibuf, *maskibuf, *texibuf;
|
||||
float *bf, *mf, *tf, *otf = NULL, xoff, yoff, xy[2], rgba[4];
|
||||
unsigned char *b, *m, *t, *ot = NULL;
|
||||
int dotexold, origx = x, origy = y;
|
||||
const int radius = BKE_brush_size_get(painter->scene, brush);
|
||||
|
||||
xoff = -radius + 0.5f;
|
||||
yoff = -radius + 0.5f;
|
||||
xoff += (int)pos[0] - (int)painter->startpaintpos[0];
|
||||
yoff += (int)pos[1] - (int)painter->startpaintpos[1];
|
||||
|
||||
ibuf = painter->cache.ibuf;
|
||||
texibuf = painter->cache.texibuf;
|
||||
maskibuf = painter->cache.maskibuf;
|
||||
|
||||
dotexold = (oldtexibuf != NULL);
|
||||
|
||||
/* not sure if it's actually needed or it's a mistake in coords/sizes
|
||||
* calculation in brush_painter_fixed_tex_partial_update(), but without this
|
||||
* limitation memory gets corrupted at fast strokes with quite big spacing (sergey) */
|
||||
w = MIN2(w, ibuf->x);
|
||||
h = MIN2(h, ibuf->y);
|
||||
|
||||
if (painter->cache.flt) {
|
||||
for (; y < h; y++) {
|
||||
bf = ibuf->rect_float + (y * ibuf->x + origx) * 4;
|
||||
tf = texibuf->rect_float + (y * texibuf->x + origx) * 4;
|
||||
mf = maskibuf->rect_float + (y * maskibuf->x + origx) * 4;
|
||||
|
||||
if (dotexold)
|
||||
otf = oldtexibuf->rect_float + ((y - origy + yt) * oldtexibuf->x + xt) * 4;
|
||||
|
||||
for (x = origx; x < w; x++, bf += 4, mf += 4, tf += 4) {
|
||||
if (dotexold) {
|
||||
copy_v3_v3(tf, otf);
|
||||
tf[3] = otf[3];
|
||||
otf += 4;
|
||||
}
|
||||
else {
|
||||
xy[0] = x + xoff;
|
||||
xy[1] = y + yoff;
|
||||
|
||||
BKE_brush_sample_tex(scene, brush, xy, tf, 0);
|
||||
}
|
||||
|
||||
bf[0] = tf[0] * mf[0];
|
||||
bf[1] = tf[1] * mf[1];
|
||||
bf[2] = tf[2] * mf[2];
|
||||
bf[3] = tf[3] * mf[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (; y < h; y++) {
|
||||
b = (unsigned char *)ibuf->rect + (y * ibuf->x + origx) * 4;
|
||||
t = (unsigned char *)texibuf->rect + (y * texibuf->x + origx) * 4;
|
||||
m = (unsigned char *)maskibuf->rect + (y * maskibuf->x + origx) * 4;
|
||||
|
||||
if (dotexold)
|
||||
ot = (unsigned char *)oldtexibuf->rect + ((y - origy + yt) * oldtexibuf->x + xt) * 4;
|
||||
|
||||
for (x = origx; x < w; x++, b += 4, m += 4, t += 4) {
|
||||
if (dotexold) {
|
||||
t[0] = ot[0];
|
||||
t[1] = ot[1];
|
||||
t[2] = ot[2];
|
||||
t[3] = ot[3];
|
||||
ot += 4;
|
||||
}
|
||||
else {
|
||||
xy[0] = x + xoff;
|
||||
xy[1] = y + yoff;
|
||||
|
||||
BKE_brush_sample_tex(scene, brush, xy, rgba, 0);
|
||||
rgba_float_to_uchar(t, rgba);
|
||||
}
|
||||
|
||||
b[0] = t[0] * m[0] / 255;
|
||||
b[1] = t[1] * m[1] / 255;
|
||||
b[2] = t[2] * m[2] / 255;
|
||||
b[3] = t[3] * m[3] / 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, const float pos[2])
|
||||
{
|
||||
const Scene *scene = painter->scene;
|
||||
Brush *brush = painter->brush;
|
||||
BrushPainterCache *cache = &painter->cache;
|
||||
ImBuf *oldtexibuf, *ibuf;
|
||||
int imbflag, destx, desty, srcx, srcy, w, h, x1, y1, x2, y2;
|
||||
const int diameter = 2 * BKE_brush_size_get(scene, brush);
|
||||
|
||||
imbflag = (cache->flt) ? IB_rectfloat : IB_rect;
|
||||
if (!cache->ibuf)
|
||||
cache->ibuf = IMB_allocImBuf(diameter, diameter, 32, imbflag);
|
||||
ibuf = cache->ibuf;
|
||||
|
||||
oldtexibuf = cache->texibuf;
|
||||
cache->texibuf = IMB_allocImBuf(diameter, diameter, 32, imbflag);
|
||||
|
||||
if (oldtexibuf) {
|
||||
srcx = srcy = 0;
|
||||
destx = (int)painter->lastpaintpos[0] - (int)pos[0];
|
||||
desty = (int)painter->lastpaintpos[1] - (int)pos[1];
|
||||
w = oldtexibuf->x;
|
||||
h = oldtexibuf->y;
|
||||
|
||||
IMB_rectclip(cache->texibuf, oldtexibuf, &destx, &desty, &srcx, &srcy, &w, &h);
|
||||
}
|
||||
else {
|
||||
srcx = srcy = 0;
|
||||
destx = desty = 0;
|
||||
w = h = 0;
|
||||
}
|
||||
|
||||
x1 = destx;
|
||||
y1 = desty;
|
||||
x2 = destx + w;
|
||||
y2 = desty + h;
|
||||
|
||||
/* blend existing texture in new position */
|
||||
if ((x1 < x2) && (y1 < y2))
|
||||
brush_painter_do_partial(painter, oldtexibuf, x1, y1, x2, y2, srcx, srcy, pos);
|
||||
|
||||
if (oldtexibuf)
|
||||
IMB_freeImBuf(oldtexibuf);
|
||||
|
||||
/* sample texture in new areas */
|
||||
if ((0 < x1) && (0 < ibuf->y))
|
||||
brush_painter_do_partial(painter, NULL, 0, 0, x1, ibuf->y, 0, 0, pos);
|
||||
if ((x2 < ibuf->x) && (0 < ibuf->y))
|
||||
brush_painter_do_partial(painter, NULL, x2, 0, ibuf->x, ibuf->y, 0, 0, pos);
|
||||
if ((x1 < x2) && (0 < y1))
|
||||
brush_painter_do_partial(painter, NULL, x1, 0, x2, y1, 0, 0, pos);
|
||||
if ((x1 < x2) && (y2 < ibuf->y))
|
||||
brush_painter_do_partial(painter, NULL, x1, y2, x2, ibuf->y, 0, 0, pos);
|
||||
}
|
||||
|
||||
static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2], int use_color_correction)
|
||||
{
|
||||
const Scene *scene = painter->scene;
|
||||
Brush *brush = painter->brush;
|
||||
BrushPainterCache *cache = &painter->cache;
|
||||
MTex *mtex = &brush->mtex;
|
||||
int size;
|
||||
short flt;
|
||||
const int diameter = 2 * BKE_brush_size_get(scene, brush);
|
||||
const float alpha = BKE_brush_alpha_get(scene, brush);
|
||||
|
||||
if (diameter != cache->lastsize ||
|
||||
alpha != cache->lastalpha ||
|
||||
brush->jitter != cache->lastjitter)
|
||||
{
|
||||
if (cache->ibuf) {
|
||||
IMB_freeImBuf(cache->ibuf);
|
||||
cache->ibuf = NULL;
|
||||
}
|
||||
if (cache->maskibuf) {
|
||||
IMB_freeImBuf(cache->maskibuf);
|
||||
cache->maskibuf = NULL;
|
||||
}
|
||||
|
||||
flt = cache->flt;
|
||||
size = (cache->size) ? cache->size : diameter;
|
||||
|
||||
if (brush->flag & BRUSH_FIXED_TEX) {
|
||||
BKE_brush_imbuf_new(scene, brush, flt, 3, size, &cache->maskibuf, use_color_correction);
|
||||
brush_painter_fixed_tex_partial_update(painter, pos);
|
||||
}
|
||||
else
|
||||
BKE_brush_imbuf_new(scene, brush, flt, 2, size, &cache->ibuf, use_color_correction);
|
||||
|
||||
cache->lastsize = diameter;
|
||||
cache->lastalpha = alpha;
|
||||
cache->lastjitter = brush->jitter;
|
||||
}
|
||||
else if ((brush->flag & BRUSH_FIXED_TEX) && mtex && mtex->tex) {
|
||||
int dx = (int)painter->lastpaintpos[0] - (int)pos[0];
|
||||
int dy = (int)painter->lastpaintpos[1] - (int)pos[1];
|
||||
|
||||
if ((dx != 0) || (dy != 0))
|
||||
brush_painter_fixed_tex_partial_update(painter, pos);
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_brush_painter_break_stroke(BrushPainter *painter)
|
||||
{
|
||||
painter->firsttouch = 1;
|
||||
}
|
||||
|
||||
static void brush_pressure_apply(BrushPainter *painter, Brush *brush, float pressure)
|
||||
{
|
||||
if (BKE_brush_use_alpha_pressure(painter->scene, brush))
|
||||
brush_alpha_set(painter->scene, brush, maxf(0.0f, painter->startalpha * pressure));
|
||||
if (BKE_brush_use_size_pressure(painter->scene, brush))
|
||||
BKE_brush_size_set(painter->scene, brush, maxf(1.0f, painter->startsize * pressure));
|
||||
if (brush->flag & BRUSH_JITTER_PRESSURE)
|
||||
brush->jitter = maxf(0.0f, painter->startjitter * pressure);
|
||||
if (brush->flag & BRUSH_SPACING_PRESSURE)
|
||||
brush->spacing = maxf(1.0f, painter->startspacing * (1.5f - pressure));
|
||||
}
|
||||
|
||||
void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], float jitterpos[2])
|
||||
{
|
||||
int use_jitter = brush->jitter != 0;
|
||||
@@ -1088,164 +855,6 @@ void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2],
|
||||
}
|
||||
}
|
||||
|
||||
int BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2], double time, float pressure,
|
||||
void *user, int use_color_correction)
|
||||
{
|
||||
Scene *scene = painter->scene;
|
||||
Brush *brush = painter->brush;
|
||||
int totpaintops = 0;
|
||||
|
||||
if (pressure == 0.0f) {
|
||||
if (painter->lastpressure) // XXX - hack, operator misses
|
||||
pressure = painter->lastpressure;
|
||||
else
|
||||
pressure = 1.0f; /* zero pressure == not using tablet */
|
||||
}
|
||||
if (painter->firsttouch) {
|
||||
/* paint exactly once on first touch */
|
||||
painter->startpaintpos[0] = pos[0];
|
||||
painter->startpaintpos[1] = pos[1];
|
||||
|
||||
brush_pressure_apply(painter, brush, pressure);
|
||||
if (painter->cache.enabled)
|
||||
brush_painter_refresh_cache(painter, pos, use_color_correction);
|
||||
totpaintops += func(user, painter->cache.ibuf, pos, pos);
|
||||
|
||||
painter->lasttime = time;
|
||||
painter->firsttouch = 0;
|
||||
painter->lastpaintpos[0] = pos[0];
|
||||
painter->lastpaintpos[1] = pos[1];
|
||||
}
|
||||
#if 0
|
||||
else if (painter->brush->flag & BRUSH_AIRBRUSH) {
|
||||
float spacing, step, paintpos[2], dmousepos[2], len;
|
||||
double starttime, curtime = time;
|
||||
|
||||
/* compute brush spacing adapted to brush size */
|
||||
spacing = brush->rate; //radius*brush->spacing*0.01f;
|
||||
|
||||
/* setup starting time, direction vector and accumulated time */
|
||||
starttime = painter->accumtime;
|
||||
sub_v2_v2v2(dmousepos, pos, painter->lastmousepos);
|
||||
len = normalize_v2(dmousepos);
|
||||
painter->accumtime += curtime - painter->lasttime;
|
||||
|
||||
/* do paint op over unpainted time distance */
|
||||
while (painter->accumtime >= spacing) {
|
||||
step = (spacing - starttime) * len;
|
||||
paintpos[0] = painter->lastmousepos[0] + dmousepos[0] * step;
|
||||
paintpos[1] = painter->lastmousepos[1] + dmousepos[1] * step;
|
||||
|
||||
if (painter->cache.enabled)
|
||||
brush_painter_refresh_cache(painter);
|
||||
totpaintops += func(user, painter->cache.ibuf,
|
||||
painter->lastpaintpos, paintpos);
|
||||
|
||||
painter->lastpaintpos[0] = paintpos[0];
|
||||
painter->lastpaintpos[1] = paintpos[1];
|
||||
painter->accumtime -= spacing;
|
||||
starttime -= spacing;
|
||||
}
|
||||
|
||||
painter->lasttime = curtime;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
float startdistance, spacing, step, paintpos[2], dmousepos[2], finalpos[2];
|
||||
float t, len, press;
|
||||
const int radius = BKE_brush_size_get(scene, brush);
|
||||
|
||||
/* compute brush spacing adapted to brush radius, spacing may depend
|
||||
* on pressure, so update it */
|
||||
brush_pressure_apply(painter, brush, painter->lastpressure);
|
||||
spacing = maxf(1.0f, radius) * brush->spacing * 0.01f;
|
||||
|
||||
/* setup starting distance, direction vector and accumulated distance */
|
||||
startdistance = painter->accumdistance;
|
||||
sub_v2_v2v2(dmousepos, pos, painter->lastmousepos);
|
||||
len = normalize_v2(dmousepos);
|
||||
painter->accumdistance += len;
|
||||
|
||||
if (brush->flag & BRUSH_SPACE) {
|
||||
/* do paint op over unpainted distance */
|
||||
while ((len > 0.0f) && (painter->accumdistance >= spacing)) {
|
||||
step = spacing - startdistance;
|
||||
paintpos[0] = painter->lastmousepos[0] + dmousepos[0] * step;
|
||||
paintpos[1] = painter->lastmousepos[1] + dmousepos[1] * step;
|
||||
|
||||
t = step / len;
|
||||
press = (1.0f - t) * painter->lastpressure + t * pressure;
|
||||
brush_pressure_apply(painter, brush, press);
|
||||
spacing = maxf(1.0f, radius) * brush->spacing * 0.01f;
|
||||
|
||||
BKE_brush_jitter_pos(scene, brush, paintpos, finalpos);
|
||||
|
||||
if (painter->cache.enabled)
|
||||
brush_painter_refresh_cache(painter, finalpos, use_color_correction);
|
||||
|
||||
totpaintops +=
|
||||
func(user, painter->cache.ibuf, painter->lastpaintpos, finalpos);
|
||||
|
||||
painter->lastpaintpos[0] = paintpos[0];
|
||||
painter->lastpaintpos[1] = paintpos[1];
|
||||
painter->accumdistance -= spacing;
|
||||
startdistance -= spacing;
|
||||
}
|
||||
}
|
||||
else {
|
||||
BKE_brush_jitter_pos(scene, brush, pos, finalpos);
|
||||
|
||||
if (painter->cache.enabled)
|
||||
brush_painter_refresh_cache(painter, finalpos, use_color_correction);
|
||||
|
||||
totpaintops += func(user, painter->cache.ibuf, pos, finalpos);
|
||||
|
||||
painter->lastpaintpos[0] = pos[0];
|
||||
painter->lastpaintpos[1] = pos[1];
|
||||
painter->accumdistance = 0;
|
||||
}
|
||||
|
||||
/* do airbrush paint ops, based on the number of paint ops left over
|
||||
* from regular painting. this is a temporary solution until we have
|
||||
* accurate time stamps for mouse move events */
|
||||
if (brush->flag & BRUSH_AIRBRUSH) {
|
||||
double curtime = time;
|
||||
double painttime = brush->rate * totpaintops;
|
||||
|
||||
painter->accumtime += curtime - painter->lasttime;
|
||||
if (painter->accumtime <= painttime)
|
||||
painter->accumtime = 0.0;
|
||||
else
|
||||
painter->accumtime -= painttime;
|
||||
|
||||
while (painter->accumtime >= (double)brush->rate) {
|
||||
brush_pressure_apply(painter, brush, pressure);
|
||||
|
||||
BKE_brush_jitter_pos(scene, brush, pos, finalpos);
|
||||
|
||||
if (painter->cache.enabled)
|
||||
brush_painter_refresh_cache(painter, finalpos, use_color_correction);
|
||||
|
||||
totpaintops +=
|
||||
func(user, painter->cache.ibuf, painter->lastmousepos, finalpos);
|
||||
painter->accumtime -= (double)brush->rate;
|
||||
}
|
||||
|
||||
painter->lasttime = curtime;
|
||||
}
|
||||
}
|
||||
|
||||
painter->lastmousepos[0] = pos[0];
|
||||
painter->lastmousepos[1] = pos[1];
|
||||
painter->lastpressure = pressure;
|
||||
|
||||
brush_alpha_set(scene, brush, painter->startalpha);
|
||||
BKE_brush_size_set(scene, brush, painter->startsize);
|
||||
brush->jitter = painter->startjitter;
|
||||
brush->spacing = painter->startspacing;
|
||||
|
||||
return totpaintops;
|
||||
}
|
||||
|
||||
/* Uses the brush curve control to find a strength value between 0 and 1 */
|
||||
float BKE_brush_curve_strength_clamp(Brush *br, float p, const float len)
|
||||
|
@@ -2768,7 +2768,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n
|
||||
|
||||
if (skip_align) {
|
||||
/* handles need to be updated during animation and applying stuff like hooks,
|
||||
* but in such situations it's quite difficult to distinguish in which order
|
||||
* but in such situatios it's quite difficult to distinguish in which order
|
||||
* align handles should be aligned so skip them for now */
|
||||
return;
|
||||
}
|
||||
|
@@ -1999,7 +1999,7 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
|
||||
}
|
||||
|
||||
/* if there are no more dest layers, we're done */
|
||||
if (dest_i >= dest->totlayer) break;
|
||||
if (dest_i >= dest->totlayer) return;
|
||||
|
||||
/* if we found a matching layer, copy the data */
|
||||
if (dest->layers[dest_i].type == source->layers[src_i].type) {
|
||||
|
@@ -1944,7 +1944,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
|
||||
{
|
||||
/* Note: Current method only uses polygon edges to detect neighboring pixels.
|
||||
* -> It doesn't always lead to the optimum pixel but is accurate enough
|
||||
* and faster/simpler than including possible face tip point links)
|
||||
* and faster/simplier than including possible face tip point links)
|
||||
*/
|
||||
|
||||
int x, y;
|
||||
@@ -2852,15 +2852,15 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float c
|
||||
|
||||
/***************************** Brush Painting Calls ******************************/
|
||||
|
||||
/**
|
||||
* Mix color values to canvas point.
|
||||
/*
|
||||
* Mix color values to canvas point.
|
||||
*
|
||||
* \param surface canvas surface
|
||||
* \param index surface point index
|
||||
* \param paintFlags paint object flags
|
||||
* \param paintColor,Alpha,Wetness to be mixed paint values
|
||||
* \param timescale value used to adjust time dependent
|
||||
* operations when using substeps
|
||||
* surface : canvas surface
|
||||
* index : surface point index
|
||||
* paintFlags : paint object flags
|
||||
* paintColor,Alpha,Wetness : to be mixed paint values
|
||||
* timescale : value used to adjust time dependand
|
||||
* operations when using substeps
|
||||
*/
|
||||
static void dynamicPaint_mixPaintColors(DynamicPaintSurface *surface, int index, int paintFlags,
|
||||
const float paintColor[3], float *paintAlpha, float *paintWetness, float *timescale)
|
||||
@@ -4161,7 +4161,7 @@ static int dynamicPaint_prepareEffectStep(DynamicPaintSurface *surface, Scene *s
|
||||
pdEndEffectors(&effectors);
|
||||
}
|
||||
|
||||
/* Get number of required steps using average point distance
|
||||
/* Get number of required steps using averate point distance
|
||||
* so that just a few ultra close pixels wont up substeps to max */
|
||||
|
||||
/* adjust number of required substep by fastest active effect */
|
||||
@@ -4224,7 +4224,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
|
||||
/* Only continue if surrounding point has higher wetness */
|
||||
if (ePoint->wetness < pPoint->wetness || ePoint->wetness < MIN_WETNESS) continue;
|
||||
|
||||
w_factor = 1.0f / numOfNeighs * MIN2(ePoint->wetness, 1.0f) * speed_scale;
|
||||
w_factor = 1.0f / numOfNeighs *MIN2(ePoint->wetness, 1.0f) * speed_scale;
|
||||
CLAMP(w_factor, 0.0f, 1.0f);
|
||||
|
||||
/* mix new wetness and color */
|
||||
|
@@ -2607,7 +2607,8 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
|
||||
|
||||
/* invalidate color managed buffers if render result changed */
|
||||
BLI_lock_thread(LOCK_COLORMANAGE);
|
||||
if (ibuf->x != rres.rectx || ibuf->y != rres.recty || ibuf->rect_float != rectf) {
|
||||
if (ibuf->x != rres.rectx || ibuf->y != rres.recty || ibuf->rect_float != rectf)
|
||||
{
|
||||
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
|
||||
/* NOTE:
|
||||
*
|
||||
* This file is no longer used to provide tools for the deprecated IPO system. Instead, it
|
||||
* This file is no longer used to provide tools for the depreceated IPO system. Instead, it
|
||||
* is only used to house the conversion code to the new system.
|
||||
*
|
||||
* -- Joshua Leung, Jan 2009
|
||||
@@ -1765,7 +1765,7 @@ void do_versions_ipos_to_animato(Main *main)
|
||||
/* Any actuators set to ACT_IPO at this point are actually Action Actuators that
|
||||
* need this converted IPO to finish converting the actuator. */
|
||||
if (act->type == ACT_IPO) {
|
||||
aa = (bActionActuator *)act->data;
|
||||
aa = (bActionActuator*)act->data;
|
||||
aa->act = ob->adt->action;
|
||||
act->type = ACT_ACTION;
|
||||
}
|
||||
|
@@ -133,7 +133,7 @@ Key *BKE_key_add(ID *id) /* common function */
|
||||
|
||||
key->uidgen = 1;
|
||||
|
||||
/* XXX the code here uses some defines which will soon be deprecated... */
|
||||
/* XXX the code here uses some defines which will soon be depreceated... */
|
||||
switch (GS(id->name)) {
|
||||
case ID_ME:
|
||||
el = key->elemstr;
|
||||
|
@@ -916,6 +916,19 @@ void BKE_mask_free_nolib(Mask *mask)
|
||||
BKE_mask_layer_free_list(&mask->masklayers);
|
||||
}
|
||||
|
||||
|
||||
static void ntree_unlink_mask_cb(void *calldata, struct ID *UNUSED(owner_id), struct bNodeTree *ntree)
|
||||
{
|
||||
ID *id = (ID *)calldata;
|
||||
bNode *node;
|
||||
|
||||
for (node = ntree->nodes.first; node; node = node->next) {
|
||||
if (node->id == id) {
|
||||
node->id = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_mask_free(Main *bmain, Mask *mask)
|
||||
{
|
||||
bScreen *scr;
|
||||
@@ -962,11 +975,21 @@ void BKE_mask_free(Main *bmain, Mask *mask)
|
||||
}
|
||||
SEQ_END
|
||||
}
|
||||
|
||||
|
||||
if (scene->nodetree) {
|
||||
bNode *node;
|
||||
for (node = scene->nodetree->nodes.first; node; node = node->next) {
|
||||
if (node->id == &mask->id) {
|
||||
node->id = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
bNodeTreeType *treetype = ntreeGetType(NTREE_COMPOSIT);
|
||||
treetype->foreach_nodetree(bmain, (void *)mask, &BKE_node_tree_unlink_id_cb);
|
||||
treetype->foreach_nodetree(bmain, (void *)mask, &ntree_unlink_mask_cb);
|
||||
}
|
||||
|
||||
/* free mask data */
|
||||
@@ -1525,7 +1548,7 @@ void BKE_mask_parent_init(MaskParent *parent)
|
||||
}
|
||||
|
||||
|
||||
/* *** own animation/shapekey implementation ***
|
||||
/* *** own animation/shapekey implimentation ***
|
||||
* BKE_mask_layer_shape_XXX */
|
||||
|
||||
int BKE_mask_layer_shape_totvert(MaskLayer *masklay)
|
||||
|
@@ -1208,7 +1208,7 @@ static float maskrasterize_layer_isect(unsigned int *face, float (*cos)[3], cons
|
||||
|
||||
/* needs work */
|
||||
#if 1
|
||||
/* quad check fails for bow-tie, so keep using 2 tri checks */
|
||||
/* quad check fails for bowtie, so keep using 2 tri checks */
|
||||
//if (isect_point_quad_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]]))
|
||||
if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]]) ||
|
||||
isect_point_tri_v2(xy, cos[face[0]], cos[face[2]], cos[face[3]]))
|
||||
@@ -1216,7 +1216,7 @@ static float maskrasterize_layer_isect(unsigned int *face, float (*cos)[3], cons
|
||||
return maskrasterize_layer_z_depth_quad(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]]);
|
||||
}
|
||||
#elif 1
|
||||
/* don't use isect_point_tri_v2_cw because we could have bow-tie quads */
|
||||
/* don't use isect_point_tri_v2_cw because we could have bowtie quads */
|
||||
|
||||
if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]])) {
|
||||
return maskrasterize_layer_z_depth_tri(xy, cos[face[0]], cos[face[1]], cos[face[2]]);
|
||||
|
@@ -873,7 +873,7 @@ void assign_matarar(struct Object *ob, struct Material ***matar, short totcol)
|
||||
int actcol_orig = ob->actcol;
|
||||
short i;
|
||||
|
||||
while (object_remove_material_slot(ob)) {}
|
||||
while (object_remove_material_slot(ob, -1)) {}
|
||||
|
||||
/* now we have the right number of slots */
|
||||
for (i = 0; i < totcol; i++)
|
||||
@@ -1194,7 +1194,7 @@ void automatname(Material *ma)
|
||||
}
|
||||
#endif
|
||||
|
||||
int object_remove_material_slot(Object *ob)
|
||||
int object_remove_material_slot(Object *ob, int slot)
|
||||
{
|
||||
Material *mao, ***matarar;
|
||||
Object *obt;
|
||||
@@ -1205,9 +1205,12 @@ int object_remove_material_slot(Object *ob)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (slot < 0)
|
||||
slot = ob->actcol;
|
||||
|
||||
/* this should never happen and used to crash */
|
||||
if (ob->actcol <= 0) {
|
||||
printf("%s: invalid material index %d, report a bug!\n", __func__, ob->actcol);
|
||||
if (slot <= 0) {
|
||||
printf("%s: invalid material index %d, report a bug!\n", __func__, slot);
|
||||
BLI_assert(0);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1224,10 +1227,10 @@ int object_remove_material_slot(Object *ob)
|
||||
if (*matarar == NULL) return FALSE;
|
||||
|
||||
/* we delete the actcol */
|
||||
mao = (*matarar)[ob->actcol - 1];
|
||||
mao = (*matarar)[slot - 1];
|
||||
if (mao) mao->id.us--;
|
||||
|
||||
for (a = ob->actcol; a < ob->totcol; a++)
|
||||
for (a = slot; a < ob->totcol; a++)
|
||||
(*matarar)[a - 1] = (*matarar)[a];
|
||||
(*totcolp)--;
|
||||
|
||||
@@ -1236,7 +1239,7 @@ int object_remove_material_slot(Object *ob)
|
||||
*matarar = NULL;
|
||||
}
|
||||
|
||||
actcol = ob->actcol;
|
||||
actcol = slot;
|
||||
obt = G.main->object.first;
|
||||
while (obt) {
|
||||
|
||||
@@ -1327,9 +1330,9 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
|
||||
r_col[2] = facm * (r_col[2]) + fac * (r_col[2]) / col[2];
|
||||
break;
|
||||
case MA_RAMP_DIFF:
|
||||
r_col[0] = facm * (r_col[0]) + fac * fabsf(r_col[0] - col[0]);
|
||||
r_col[1] = facm * (r_col[1]) + fac * fabsf(r_col[1] - col[1]);
|
||||
r_col[2] = facm * (r_col[2]) + fac * fabsf(r_col[2] - col[2]);
|
||||
r_col[0] = facm * (r_col[0]) + fac *fabsf(r_col[0] - col[0]);
|
||||
r_col[1] = facm * (r_col[1]) + fac *fabsf(r_col[1] - col[1]);
|
||||
r_col[2] = facm * (r_col[2]) + fac *fabsf(r_col[2] - col[2]);
|
||||
break;
|
||||
case MA_RAMP_DARK:
|
||||
tmp = col[0] + ((1 - col[0]) * facm);
|
||||
@@ -1490,7 +1493,7 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief copy/paste buffer, if we had a proper py api that would be better
|
||||
* \brief copy/paste buffer, if we had a propper py api that would be better
|
||||
* \note matcopybuf.nodetree does _NOT_ use ID's
|
||||
* \todo matcopybuf.nodetree's node->id's are NOT validated, this will crash!
|
||||
*/
|
||||
|
@@ -788,7 +788,7 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
|
||||
nr--;
|
||||
}
|
||||
|
||||
/* check corrupt cases, bow-tie geometry, cant handle these because edge data wont exist so just return 0 */
|
||||
/* check corrupt cases, bowtie geometry, cant handle these because edge data wont exist so just return 0 */
|
||||
if (nr == 3) {
|
||||
if (
|
||||
/* real edges */
|
||||
@@ -2043,7 +2043,7 @@ static void bm_corners_to_loops_ex(ID *id, CustomData *fdata, CustomData *ldata,
|
||||
int side, corners;
|
||||
|
||||
if (CustomData_external_test(fdata, CD_MDISPS)) {
|
||||
if (id && fdata->external) {
|
||||
if (id) {
|
||||
CustomData_external_add(ldata, id, CD_MDISPS,
|
||||
totloop, fdata->external->filename);
|
||||
}
|
||||
|
275
source/blender/blenkernel/intern/mirror.c
Normal file
275
source/blender/blenkernel/intern/mirror.c
Normal file
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
|
||||
#include "DNA_object_types.h"
|
||||
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_modifier.h"
|
||||
#include "BKE_deform.h"
|
||||
#include "BKE_mirror.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
|
||||
Object *ob,
|
||||
DerivedMesh *dm,
|
||||
int axis, int skip_orig)
|
||||
{
|
||||
const float tolerance_sq = mmd->tolerance * mmd->tolerance;
|
||||
const int do_vtargetmap = !(mmd->flag & MOD_MIR_NO_MERGE);
|
||||
int is_vtargetmap = FALSE; /* true when it should be used */
|
||||
|
||||
DerivedMesh *result;
|
||||
const int maxVerts = dm->getNumVerts(dm);
|
||||
const int maxEdges = dm->getNumEdges(dm);
|
||||
const int maxLoops = dm->getNumLoops(dm);
|
||||
const int maxPolys = dm->getNumPolys(dm);
|
||||
MVert *mv, *mv_prev;
|
||||
MEdge *me;
|
||||
MLoop *ml;
|
||||
MPoly *mp;
|
||||
float mtx[4][4];
|
||||
int i, j;
|
||||
int a, totshape;
|
||||
int *orig_index;
|
||||
int *vtargetmap = NULL, *vtmap_a = NULL, *vtmap_b = NULL;
|
||||
|
||||
/* mtx is the mirror transformation */
|
||||
unit_m4(mtx);
|
||||
mtx[axis][axis] = -1.0f;
|
||||
|
||||
if (mmd->mirror_ob) {
|
||||
float tmp[4][4];
|
||||
float itmp[4][4];
|
||||
|
||||
/* tmp is a transform from coords relative to the object's own origin,
|
||||
* to coords relative to the mirror object origin */
|
||||
invert_m4_m4(tmp, mmd->mirror_ob->obmat);
|
||||
mult_m4_m4m4(tmp, tmp, ob->obmat);
|
||||
|
||||
/* itmp is the reverse transform back to origin-relative coordinates */
|
||||
invert_m4_m4(itmp, tmp);
|
||||
|
||||
/* combine matrices to get a single matrix that translates coordinates into
|
||||
* mirror-object-relative space, does the mirror, and translates back to
|
||||
* origin-relative space */
|
||||
mult_m4_m4m4(mtx, mtx, tmp);
|
||||
mult_m4_m4m4(mtx, itmp, mtx);
|
||||
}
|
||||
|
||||
result = CDDM_from_template(dm, maxVerts * 2, maxEdges * 2, 0, maxLoops * 2, maxPolys * 2);
|
||||
|
||||
/*copy customdata to original geometry*/
|
||||
DM_copy_vert_data(dm, result, 0, 0, maxVerts);
|
||||
DM_copy_edge_data(dm, result, 0, 0, maxEdges);
|
||||
DM_copy_loop_data(dm, result, 0, 0, maxLoops);
|
||||
DM_copy_poly_data(dm, result, 0, 0, maxPolys);
|
||||
|
||||
|
||||
/* subsurf for eg wont have mesh data in the */
|
||||
/* now add mvert/medge/mface layers */
|
||||
|
||||
if (!CustomData_has_layer(&dm->vertData, CD_MVERT)) {
|
||||
dm->copyVertArray(dm, CDDM_get_verts(result));
|
||||
}
|
||||
if (!CustomData_has_layer(&dm->edgeData, CD_MEDGE)) {
|
||||
dm->copyEdgeArray(dm, CDDM_get_edges(result));
|
||||
}
|
||||
if (!CustomData_has_layer(&dm->polyData, CD_MPOLY)) {
|
||||
dm->copyLoopArray(dm, CDDM_get_loops(result));
|
||||
dm->copyPolyArray(dm, CDDM_get_polys(result));
|
||||
}
|
||||
|
||||
/* copy customdata to new geometry,
|
||||
* copy from its self because this data may have been created in the checks above */
|
||||
DM_copy_vert_data(result, result, 0, maxVerts, maxVerts);
|
||||
DM_copy_edge_data(result, result, 0, maxEdges, maxEdges);
|
||||
/* loops are copied later */
|
||||
DM_copy_poly_data(result, result, 0, maxPolys, maxPolys);
|
||||
|
||||
if (do_vtargetmap) {
|
||||
/* second half is filled with -1 */
|
||||
vtargetmap = MEM_mallocN(sizeof(int) * maxVerts * 2, "MOD_mirror tarmap");
|
||||
|
||||
vtmap_a = vtargetmap;
|
||||
vtmap_b = vtargetmap + maxVerts;
|
||||
}
|
||||
|
||||
/* mirror vertex coordinates */
|
||||
mv_prev = CDDM_get_verts(result);
|
||||
mv = mv_prev + maxVerts;
|
||||
|
||||
orig_index = (int *)CustomData_get_layer(&result->vertData, CD_ORIGINDEX) + maxVerts;
|
||||
|
||||
for (i = 0; i < maxVerts; i++, mv++, mv_prev++, orig_index++) {
|
||||
mul_m4_v3(mtx, mv->co);
|
||||
|
||||
if (skip_orig)
|
||||
*orig_index = ORIGINDEX_NONE;
|
||||
|
||||
if (do_vtargetmap) {
|
||||
/* compare location of the original and mirrored vertex, to see if they
|
||||
* should be mapped for merging */
|
||||
if (UNLIKELY(len_squared_v3v3(mv_prev->co, mv->co) < tolerance_sq)) {
|
||||
*vtmap_a = maxVerts + i;
|
||||
is_vtargetmap = TRUE;
|
||||
if (skip_orig)
|
||||
*orig_index = i;
|
||||
}
|
||||
else {
|
||||
*vtmap_a = -1;
|
||||
}
|
||||
|
||||
*vtmap_b = -1; /* fill here to avoid 2x loops */
|
||||
|
||||
vtmap_a++;
|
||||
vtmap_b++;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle shape keys */
|
||||
totshape = CustomData_number_of_layers(&result->vertData, CD_SHAPEKEY);
|
||||
for (a = 0; a < totshape; a++) {
|
||||
float (*cos)[3] = CustomData_get_layer_n(&result->vertData, CD_SHAPEKEY, a);
|
||||
for (i = maxVerts; i < result->numVertData; i++) {
|
||||
mul_m4_v3(mtx, cos[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* adjust mirrored edge vertex indices */
|
||||
me = CDDM_get_edges(result) + maxEdges;
|
||||
for (i = 0; i < maxEdges; i++, me++) {
|
||||
me->v1 += maxVerts;
|
||||
me->v2 += maxVerts;
|
||||
}
|
||||
|
||||
/* adjust mirrored poly loopstart indices, and reverse loop order (normals) */
|
||||
mp = CDDM_get_polys(result) + maxPolys;
|
||||
ml = CDDM_get_loops(result);
|
||||
for (i = 0; i < maxPolys; i++, mp++) {
|
||||
MLoop *ml2;
|
||||
int e;
|
||||
|
||||
/* reverse the loop, but we keep the first vertex in the face the same,
|
||||
* to ensure that quads are split the same way as on the other side */
|
||||
DM_copy_loop_data(result, result, mp->loopstart, mp->loopstart + maxLoops, 1);
|
||||
for (j = 1; j < mp->totloop; j++)
|
||||
DM_copy_loop_data(result, result, mp->loopstart + j, mp->loopstart + maxLoops + mp->totloop - j, 1);
|
||||
|
||||
ml2 = ml + mp->loopstart + maxLoops;
|
||||
e = ml2[0].e;
|
||||
for (j = 0; j < mp->totloop - 1; j++) {
|
||||
ml2[j].e = ml2[j + 1].e;
|
||||
}
|
||||
ml2[mp->totloop - 1].e = e;
|
||||
|
||||
mp->loopstart += maxLoops;
|
||||
}
|
||||
|
||||
/* adjust mirrored loop vertex and edge indices */
|
||||
ml = CDDM_get_loops(result) + maxLoops;
|
||||
for (i = 0; i < maxLoops; i++, ml++) {
|
||||
ml->v += maxVerts;
|
||||
ml->e += maxEdges;
|
||||
}
|
||||
|
||||
/* handle uvs,
|
||||
* let tessface recalc handle updating the MTFace data */
|
||||
if (mmd->flag & (MOD_MIR_MIRROR_U | MOD_MIR_MIRROR_V)) {
|
||||
const int do_mirr_u = (mmd->flag & MOD_MIR_MIRROR_U) != 0;
|
||||
const int do_mirr_v = (mmd->flag & MOD_MIR_MIRROR_V) != 0;
|
||||
|
||||
const int totuv = CustomData_number_of_layers(&result->loopData, CD_MLOOPUV);
|
||||
|
||||
for (a = 0; a < totuv; a++) {
|
||||
MLoopUV *dmloopuv = CustomData_get_layer_n(&result->loopData, CD_MLOOPUV, a);
|
||||
int j = maxLoops;
|
||||
dmloopuv += j; /* second set of loops only */
|
||||
for (; j-- > 0; dmloopuv++) {
|
||||
if (do_mirr_u) dmloopuv->uv[0] = 1.0f - dmloopuv->uv[0];
|
||||
if (do_mirr_v) dmloopuv->uv[1] = 1.0f - dmloopuv->uv[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* handle vgroup stuff */
|
||||
if ((mmd->flag & MOD_MIR_VGROUP) && CustomData_has_layer(&result->vertData, CD_MDEFORMVERT)) {
|
||||
MDeformVert *dvert = (MDeformVert *) CustomData_get_layer(&result->vertData, CD_MDEFORMVERT) + maxVerts;
|
||||
int *flip_map = NULL, flip_map_len = 0;
|
||||
|
||||
flip_map = defgroup_flip_map(ob, &flip_map_len, FALSE);
|
||||
|
||||
if (flip_map) {
|
||||
for (i = 0; i < maxVerts; dvert++, i++) {
|
||||
/* merged vertices get both groups, others get flipped */
|
||||
if (do_vtargetmap && (vtargetmap[i] != -1))
|
||||
defvert_flip_merged(dvert, flip_map, flip_map_len);
|
||||
else
|
||||
defvert_flip(dvert, flip_map, flip_map_len);
|
||||
}
|
||||
|
||||
MEM_freeN(flip_map);
|
||||
}
|
||||
}
|
||||
|
||||
if (do_vtargetmap) {
|
||||
/* slow - so only call if one or more merge verts are found,
|
||||
* users may leave this on and not realize there is nothing to merge - campbell */
|
||||
if (is_vtargetmap) {
|
||||
result = CDDM_merge_verts(result, vtargetmap);
|
||||
}
|
||||
MEM_freeN(vtargetmap);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
DerivedMesh *mirror_make_derived_from_derived(MirrorModifierData *mmd,
|
||||
Object *ob, DerivedMesh *dm, int orig)
|
||||
{
|
||||
DerivedMesh *result = dm;
|
||||
|
||||
/* check which axes have been toggled and mirror accordingly */
|
||||
if (mmd->flag & MOD_MIR_AXIS_X) {
|
||||
result = doMirrorOnAxis(mmd, ob, result, 0, orig);
|
||||
}
|
||||
if (mmd->flag & MOD_MIR_AXIS_Y) {
|
||||
DerivedMesh *tmp = result;
|
||||
result = doMirrorOnAxis(mmd, ob, result, 1, orig);
|
||||
if (tmp != dm) tmp->release(tmp); /* free intermediate results */
|
||||
}
|
||||
if (mmd->flag & MOD_MIR_AXIS_Z) {
|
||||
DerivedMesh *tmp = result;
|
||||
result = doMirrorOnAxis(mmd, ob, result, 2, orig);
|
||||
if (tmp != dm) tmp->release(tmp); /* free intermediate results */
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
@@ -49,7 +49,7 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
|
||||
MLoop *mloop, *ml;
|
||||
BMVert *v, **vtable, **verts = NULL;
|
||||
BMEdge *e, **etable, **edges = NULL;
|
||||
float (*face_normals)[3];
|
||||
float has_face_normals;
|
||||
BMFace *f;
|
||||
BMIter liter;
|
||||
BLI_array_declare(verts);
|
||||
@@ -72,8 +72,8 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
|
||||
BM_data_layer_add(bm, &bm->edata, CD_BWEIGHT);
|
||||
BM_data_layer_add(bm, &bm->vdata, CD_BWEIGHT);
|
||||
|
||||
vtable = MEM_callocN(sizeof(void **) * totvert, __func__);
|
||||
etable = MEM_callocN(sizeof(void **) * totedge, __func__);
|
||||
vtable = MEM_callocN(sizeof(void **) * totvert, "vert table in BMDM_Copy");
|
||||
etable = MEM_callocN(sizeof(void **) * totedge, "edge table in BMDM_Copy");
|
||||
|
||||
/*do verts*/
|
||||
mv = mvert = dm->dupVertArray(dm);
|
||||
@@ -110,7 +110,7 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
|
||||
/*do faces*/
|
||||
mp = dm->getPolyArray(dm);
|
||||
mloop = dm->getLoopArray(dm);
|
||||
face_normals = CustomData_get_layer(&dm->polyData, CD_NORMAL); /* can be NULL */
|
||||
has_face_normals = CustomData_has_layer(&dm->polyData, CD_NORMAL);
|
||||
for (i = 0; i < dm->numPolyData; i++, mp++) {
|
||||
BMLoop *l;
|
||||
|
||||
@@ -129,9 +129,8 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
|
||||
|
||||
f = BM_face_create_ngon(bm, verts[0], verts[1], edges, mp->totloop, FALSE);
|
||||
|
||||
if (UNLIKELY(f == NULL)) {
|
||||
if (!f)
|
||||
continue;
|
||||
}
|
||||
|
||||
f->head.hflag = BM_face_flag_from_mflag(mp->flag);
|
||||
f->mat_nr = mp->mat_nr;
|
||||
@@ -144,11 +143,11 @@ void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
|
||||
|
||||
CustomData_to_bmesh_block(&dm->polyData, &bm->pdata, i, &f->head.data);
|
||||
|
||||
if (face_normals) {
|
||||
copy_v3_v3(f->no, face_normals[i]);
|
||||
}
|
||||
else {
|
||||
BM_face_normal_update(f);
|
||||
if (has_face_normals) {
|
||||
float *fno;
|
||||
|
||||
fno = CustomData_bmesh_get(&bm->pdata, &f->head.data, CD_NORMAL);
|
||||
copy_v3_v3(f->no, fno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,6 @@
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_movieclip_types.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
@@ -72,7 +71,6 @@
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_movieclip.h"
|
||||
#include "BKE_node.h"
|
||||
#include "BKE_image.h" /* openanim */
|
||||
#include "BKE_tracking.h"
|
||||
|
||||
@@ -626,22 +624,24 @@ static ImBuf *get_undistorted_ibuf(MovieClip *clip, struct MovieDistortion *dist
|
||||
return undistibuf;
|
||||
}
|
||||
|
||||
static int need_undistortion_postprocess(MovieClipUser *user)
|
||||
static int need_undistortion_postprocess(MovieClipUser *user, int flag)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
/* only full undistorted render can be used as on-fly undistorting image */
|
||||
result |= (user->render_size == MCLIP_PROXY_RENDER_SIZE_FULL) &&
|
||||
(user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) != 0;
|
||||
if (flag & MCLIP_USE_PROXY) {
|
||||
result |= (user->render_size == MCLIP_PROXY_RENDER_SIZE_FULL) &&
|
||||
(user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) != 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int need_postprocessed_frame(MovieClipUser *user, int postprocess_flag)
|
||||
static int need_postprocessed_frame(MovieClipUser *user, int flag, int postprocess_flag)
|
||||
{
|
||||
int result = postprocess_flag;
|
||||
|
||||
result |= need_undistortion_postprocess(user);
|
||||
result |= need_undistortion_postprocess(user, flag);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -688,7 +688,7 @@ static ImBuf *get_postprocessed_cached_frame(MovieClip *clip, MovieClipUser *use
|
||||
if (cache->postprocessed.flag != postprocess_flag)
|
||||
return NULL;
|
||||
|
||||
if (need_undistortion_postprocess(user)) {
|
||||
if (need_undistortion_postprocess(user, flag)) {
|
||||
if (!check_undistortion_cache_flags(clip))
|
||||
return NULL;
|
||||
}
|
||||
@@ -719,7 +719,7 @@ static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *u
|
||||
cache->postprocessed.render_flag = 0;
|
||||
}
|
||||
|
||||
if (need_undistortion_postprocess(user)) {
|
||||
if (need_undistortion_postprocess(user, flag)) {
|
||||
copy_v2_v2(cache->postprocessed.principal, camera->principal);
|
||||
copy_v3_v3(&cache->postprocessed.k1, &camera->k1);
|
||||
cache->postprocessed.undistortion_used = TRUE;
|
||||
@@ -763,7 +763,7 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip, MovieClipUser *u
|
||||
BLI_lock_thread(LOCK_MOVIECLIP);
|
||||
|
||||
/* try to obtain cached postprocessed frame first */
|
||||
if (need_postprocessed_frame(user, postprocess_flag)) {
|
||||
if (need_postprocessed_frame(user, flag, postprocess_flag)) {
|
||||
ibuf = get_postprocessed_cached_frame(clip, user, flag, postprocess_flag);
|
||||
|
||||
if (!ibuf)
|
||||
@@ -1326,11 +1326,6 @@ void BKE_movieclip_unlink(Main *bmain, MovieClip *clip)
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
bNodeTreeType *treetype = ntreeGetType(NTREE_COMPOSIT);
|
||||
treetype->foreach_nodetree(bmain, (void *)clip, &BKE_node_tree_unlink_id_cb);
|
||||
}
|
||||
|
||||
clip->id.us = 0;
|
||||
}
|
||||
|
||||
|
@@ -666,9 +666,7 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
|
||||
mdisp->totdisp = totdisp;
|
||||
mdisp->level = lvl;
|
||||
|
||||
if (gpm) {
|
||||
multires_grid_paint_mask_downsample(&gpm[g], lvl);
|
||||
}
|
||||
multires_grid_paint_mask_downsample(&gpm[g], lvl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -895,16 +893,15 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
|
||||
CCGKey highGridKey, lowGridKey;
|
||||
CCGSubSurf *ss;
|
||||
int i, numGrids, highGridSize;
|
||||
int has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK);
|
||||
|
||||
/* create subsurf DM from original mesh at high level */
|
||||
cddm = CDDM_from_mesh(me, NULL);
|
||||
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
|
||||
highdm = subsurf_dm_create_local(ob, cddm, totlvl, simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask);
|
||||
highdm = subsurf_dm_create_local(ob, cddm, totlvl, simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, TRUE);
|
||||
ss = ((CCGDerivedMesh *)highdm)->ss;
|
||||
|
||||
/* create multires DM from original mesh at low level */
|
||||
lowdm = multires_dm_create_local(ob, cddm, lvl, lvl, simple, has_mask);
|
||||
lowdm = multires_dm_create_local(ob, cddm, lvl, lvl, simple, TRUE);
|
||||
cddm->release(cddm);
|
||||
|
||||
/* copy subsurf grids and replace them with low displaced grids */
|
||||
@@ -1167,18 +1164,17 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
|
||||
CCGKey highGridKey, lowGridKey;
|
||||
CCGSubSurf *ss;
|
||||
int i, j, numGrids, highGridSize, lowGridSize;
|
||||
int has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK);
|
||||
|
||||
/* create subsurf DM from original mesh at high level */
|
||||
if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform);
|
||||
else cddm = CDDM_from_mesh(me, NULL);
|
||||
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
|
||||
|
||||
highdm = subsurf_dm_create_local(ob, cddm, totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask);
|
||||
highdm = subsurf_dm_create_local(ob, cddm, totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, TRUE);
|
||||
ss = ((CCGDerivedMesh *)highdm)->ss;
|
||||
|
||||
/* create multires DM from original mesh and displacements */
|
||||
lowdm = multires_dm_create_local(ob, cddm, lvl, totlvl, mmd->simple, has_mask);
|
||||
lowdm = multires_dm_create_local(ob, cddm, lvl, totlvl, mmd->simple, TRUE);
|
||||
cddm->release(cddm);
|
||||
|
||||
/* gather grid data */
|
||||
@@ -1230,13 +1226,12 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
|
||||
}
|
||||
else {
|
||||
DerivedMesh *cddm, *subdm;
|
||||
int has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK);
|
||||
|
||||
if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform);
|
||||
else cddm = CDDM_from_mesh(me, NULL);
|
||||
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
|
||||
|
||||
subdm = subsurf_dm_create_local(ob, cddm, mmd->totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask);
|
||||
subdm = subsurf_dm_create_local(ob, cddm, mmd->totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, TRUE);
|
||||
cddm->release(cddm);
|
||||
|
||||
multiresModifier_disp_run(dm, me, NULL, CALC_DISPLACEMENTS, subdm->getGridData(subdm), mmd->totlvl);
|
||||
@@ -2112,7 +2107,7 @@ void multires_load_old(Object *ob, Mesh *me)
|
||||
* reference subsurfed dm with this option, before calling multiresModifier_disp_run(),
|
||||
* which implicitly expects both subsurfs from its first dm and oldGridData parameters to
|
||||
* be of the same "format"! */
|
||||
dm = multires_make_derived_from_derived(orig, mmd, ob, 0);
|
||||
dm = multires_make_derived_from_derived(orig, mmd, ob, MULTIRES_ALLOC_PAINT_MASK);
|
||||
|
||||
multires_load_old_dm(dm, me, mmd->totlvl + 1);
|
||||
|
||||
|
@@ -889,44 +889,23 @@ Object *BKE_object_add(struct Scene *scene, int type)
|
||||
return ob;
|
||||
}
|
||||
|
||||
SoftBody *copy_softbody(SoftBody *sb, int copy_caches)
|
||||
SoftBody *copy_softbody(SoftBody *sb)
|
||||
{
|
||||
SoftBody *sbn;
|
||||
|
||||
if (sb == NULL) return(NULL);
|
||||
|
||||
sbn = MEM_dupallocN(sb);
|
||||
|
||||
if (copy_caches == FALSE) {
|
||||
sbn->totspring = sbn->totpoint = 0;
|
||||
sbn->bpoint = NULL;
|
||||
sbn->bspring = NULL;
|
||||
}
|
||||
else {
|
||||
sbn->totspring = sb->totspring;
|
||||
sbn->totpoint = sb->totpoint;
|
||||
|
||||
if (sbn->bpoint) {
|
||||
int i;
|
||||
|
||||
sbn->bpoint = MEM_dupallocN(sbn->bpoint);
|
||||
|
||||
for (i = 0; i < sbn->totpoint; i++) {
|
||||
if (sbn->bpoint[i].springs)
|
||||
sbn->bpoint[i].springs = MEM_dupallocN(sbn->bpoint[i].springs);
|
||||
}
|
||||
}
|
||||
|
||||
if (sb->bspring)
|
||||
sbn->bspring = MEM_dupallocN(sb->bspring);
|
||||
}
|
||||
sbn->totspring = sbn->totpoint = 0;
|
||||
sbn->bpoint = NULL;
|
||||
sbn->bspring = NULL;
|
||||
|
||||
sbn->keys = NULL;
|
||||
sbn->totkey = sbn->totpointkey = 0;
|
||||
|
||||
sbn->scratch = NULL;
|
||||
|
||||
sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches, copy_caches);
|
||||
sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches);
|
||||
|
||||
if (sb->effector_weights)
|
||||
sbn->effector_weights = MEM_dupallocN(sb->effector_weights);
|
||||
@@ -999,7 +978,7 @@ static ParticleSystem *copy_particlesystem(ParticleSystem *psys)
|
||||
psysn->childcachebufs.first = psysn->childcachebufs.last = NULL;
|
||||
psysn->renderdata = NULL;
|
||||
|
||||
psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches, FALSE);
|
||||
psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches);
|
||||
|
||||
/* XXX - from reading existing code this seems correct but intended usage of
|
||||
* pointcache should /w cloth should be added in 'ParticleSystem' - campbell */
|
||||
@@ -1060,7 +1039,7 @@ void BKE_object_copy_particlesystems(Object *obn, Object *ob)
|
||||
void BKE_object_copy_softbody(Object *obn, Object *ob)
|
||||
{
|
||||
if (ob->soft)
|
||||
obn->soft = copy_softbody(ob->soft, FALSE);
|
||||
obn->soft = copy_softbody(ob->soft);
|
||||
}
|
||||
|
||||
static void copy_object_pose(Object *obn, Object *ob)
|
||||
@@ -1141,7 +1120,7 @@ void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src)
|
||||
copy_v3_v3(ob_tar->size, ob_src->size);
|
||||
}
|
||||
|
||||
static Object *object_copy_do(Object *ob, int copy_caches)
|
||||
Object *BKE_object_copy(Object *ob)
|
||||
{
|
||||
Object *obn;
|
||||
ModifierData *md;
|
||||
@@ -1202,7 +1181,7 @@ static Object *object_copy_do(Object *ob, int copy_caches)
|
||||
if (obn->pd->rng)
|
||||
obn->pd->rng = MEM_dupallocN(ob->pd->rng);
|
||||
}
|
||||
obn->soft = copy_softbody(ob->soft, copy_caches);
|
||||
obn->soft = copy_softbody(ob->soft);
|
||||
obn->bsoft = copy_bulletsoftbody(ob->bsoft);
|
||||
|
||||
BKE_object_copy_particlesystems(obn, ob);
|
||||
@@ -1218,18 +1197,6 @@ static Object *object_copy_do(Object *ob, int copy_caches)
|
||||
return obn;
|
||||
}
|
||||
|
||||
/* copy objects, will re-initialize cached simulation data */
|
||||
Object *BKE_object_copy(Object *ob)
|
||||
{
|
||||
return object_copy_do(ob, FALSE);
|
||||
}
|
||||
|
||||
/* copy objects, will duplicate cached simulation data */
|
||||
Object *BKE_object_copy_with_caches(Object *ob)
|
||||
{
|
||||
return object_copy_do(ob, TRUE);
|
||||
}
|
||||
|
||||
static void extern_local_object(Object *ob)
|
||||
{
|
||||
ParticleSystem *psys;
|
||||
|
@@ -39,6 +39,7 @@
|
||||
|
||||
#include "BLI_bitmap.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
#include "BKE_brush.h"
|
||||
#include "BKE_context.h"
|
||||
@@ -190,7 +191,7 @@ void BKE_paint_free(Paint *paint)
|
||||
}
|
||||
|
||||
/* called when copying scene settings, so even if 'src' and 'tar' are the same
|
||||
* still do a id_us_plus(), rather then if we were copying between 2 existing
|
||||
* still do a id_us_plus(), rather then if we were copying betweem 2 existing
|
||||
* scenes where a matching value should decrease the existing user count as
|
||||
* with paint_brush_set() */
|
||||
void BKE_paint_copy(Paint *src, Paint *tar)
|
||||
@@ -230,3 +231,21 @@ float paint_grid_paint_mask(const GridPaintMask *gpm, unsigned level,
|
||||
|
||||
return gpm->data[(y * factor) * gridsize + (x * factor)];
|
||||
}
|
||||
|
||||
void paint_calculate_rake_rotation(UnifiedPaintSettings *ups, const float mouse_pos[2])
|
||||
{
|
||||
const float u = 0.5f;
|
||||
const float r = RAKE_THRESHHOLD;
|
||||
|
||||
float dpos[2];
|
||||
sub_v2_v2v2(dpos, ups->last_pos, mouse_pos);
|
||||
|
||||
if (len_squared_v2(dpos) >= r * r) {
|
||||
ups->last_angle = atan2(dpos[0], dpos[1]);
|
||||
|
||||
interp_v2_v2v2(ups->last_pos, ups->last_pos,
|
||||
mouse_pos, u);
|
||||
|
||||
copy_v2_v2(ups->last_pos, mouse_pos);
|
||||
}
|
||||
}
|
||||
|
@@ -116,7 +116,7 @@ int count_particles_mod(ParticleSystem *psys, int totgr, int cur)
|
||||
}
|
||||
return tot;
|
||||
}
|
||||
/* we allocate path cache memory in chunks instead of a big contiguous
|
||||
/* we allocate path cache memory in chunks instead of a big continguous
|
||||
* chunk, windows' memory allocater fails to find big blocks of memory often */
|
||||
|
||||
#define PATH_CACHE_BUF_SIZE 1024
|
||||
@@ -3776,7 +3776,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
|
||||
ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink =
|
||||
ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.f;
|
||||
|
||||
ptex->length = 1.0f - part->randlength * PSYS_FRAND(child_index + 26);
|
||||
ptex->length = 1.0f - part->randlength *PSYS_FRAND(child_index + 26);
|
||||
ptex->length *= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f;
|
||||
|
||||
for (m = 0; m < MAX_MTEX; m++, mtexp++) {
|
||||
@@ -3968,7 +3968,7 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED
|
||||
size *= part->childsize;
|
||||
|
||||
if (part->childrandsize != 0.0f)
|
||||
size *= 1.0f - part->childrandsize * PSYS_FRAND(cpa - psys->child + 26);
|
||||
size *= 1.0f - part->childrandsize *PSYS_FRAND(cpa - psys->child + 26);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@@ -3777,7 +3777,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
|
||||
/* Calculate the speed of the particle relative to the local scale of the
|
||||
* simulation. This should be called once per particle during a simulation
|
||||
* step, after the velocity has been updated. element_size defines the scale of
|
||||
* the simulation, and is typically the distance to neighboring particles. */
|
||||
* the simulation, and is typically the distance to neighbourning particles. */
|
||||
static void update_courant_num(ParticleSimulationData *sim, ParticleData *pa,
|
||||
float dtime, SPHData *sphdata)
|
||||
{
|
||||
|
@@ -2663,59 +2663,32 @@ void BKE_ptcache_free_list(ListBase *ptcaches)
|
||||
}
|
||||
}
|
||||
|
||||
static PointCache *ptcache_copy(PointCache *cache, int copy_data)
|
||||
static PointCache *ptcache_copy(PointCache *cache)
|
||||
{
|
||||
PointCache *ncache;
|
||||
|
||||
ncache= MEM_dupallocN(cache);
|
||||
|
||||
/* hmm, should these be copied over instead? */
|
||||
ncache->mem_cache.first = NULL;
|
||||
ncache->mem_cache.last = NULL;
|
||||
|
||||
if (copy_data == FALSE) {
|
||||
ncache->mem_cache.first = NULL;
|
||||
ncache->mem_cache.last = NULL;
|
||||
ncache->cached_frames = NULL;
|
||||
|
||||
ncache->flag= 0;
|
||||
ncache->simframe= 0;
|
||||
}
|
||||
else {
|
||||
PTCacheMem *pm;
|
||||
|
||||
for (pm = cache->mem_cache.first; pm; pm = pm->next) {
|
||||
PTCacheMem *pmn = MEM_dupallocN(pm);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < BPHYS_TOT_DATA; i++) {
|
||||
if (pmn->data[i])
|
||||
pmn->data[i] = MEM_dupallocN(pm->data[i]);
|
||||
}
|
||||
|
||||
BKE_ptcache_mem_pointers_init(pm);
|
||||
|
||||
BLI_addtail(&ncache->mem_cache, pmn);
|
||||
}
|
||||
|
||||
if (ncache->cached_frames)
|
||||
ncache->cached_frames = MEM_dupallocN(cache->cached_frames);
|
||||
}
|
||||
|
||||
/* hmm, should these be copied over instead? */
|
||||
ncache->cached_frames = NULL;
|
||||
ncache->edit = NULL;
|
||||
|
||||
ncache->flag= 0;
|
||||
ncache->simframe= 0;
|
||||
|
||||
return ncache;
|
||||
}
|
||||
|
||||
/* returns first point cache */
|
||||
PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old, int copy_data)
|
||||
PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old)
|
||||
{
|
||||
PointCache *cache = ptcaches_old->first;
|
||||
|
||||
ptcaches_new->first = ptcaches_new->last = NULL;
|
||||
|
||||
for (; cache; cache=cache->next)
|
||||
BLI_addtail(ptcaches_new, ptcache_copy(cache, copy_data));
|
||||
BLI_addtail(ptcaches_new, ptcache_copy(cache));
|
||||
|
||||
return ptcaches_new->first;
|
||||
}
|
||||
|
@@ -383,7 +383,7 @@ Scene *BKE_scene_add(const char *name)
|
||||
sce->r.edgeint = 10;
|
||||
sce->r.ocres = 128;
|
||||
|
||||
/* OCIO_TODO: for forwards compatibility only, so if no tonecurve are used,
|
||||
/* OCIO_TODO: for forwards compatibiliy only, so if no tonecurve are used,
|
||||
* images would look in the same way as in current blender
|
||||
*
|
||||
* perhaps at some point should be completely deprecated?
|
||||
@@ -1278,8 +1278,3 @@ void BKE_scene_disable_color_management(Scene *scene)
|
||||
BLI_strncpy(view_settings->view_transform, view, sizeof(view_settings->view_transform));
|
||||
}
|
||||
}
|
||||
|
||||
int BKE_scene_check_color_management_enabled(const Scene *scene)
|
||||
{
|
||||
return strcmp(scene->display_settings.display_device, "None") != 0;
|
||||
}
|
||||
|
@@ -151,7 +151,7 @@ typedef struct SB_thread_context {
|
||||
|
||||
#define SOFTGOALSNAP 0.999f
|
||||
/* if bp-> goal is above make it a *forced follow original* and skip all ODE stuff for this bp
|
||||
* removes *unnecessary* stiffness from ODE system
|
||||
* removes *unnecessary* stiffnes from ODE system
|
||||
*/
|
||||
#define HEUNWARNLIMIT 1 /* 500 would be fine i think for detecting severe *stiff* stuff */
|
||||
|
||||
@@ -3925,7 +3925,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
|
||||
|
||||
sst=PIL_check_seconds_timer();
|
||||
/* Integration back in time is possible in theory, but pretty useless here.
|
||||
* So we refuse to do so. Since we do not know anything about 'outside' changes
|
||||
* So we refuse to do so. Since we do not know anything about 'outside' canges
|
||||
* especially colliders we refuse to go more than 10 frames.
|
||||
*/
|
||||
if (dtime < 0 || dtime > 10.5f) return;
|
||||
|
@@ -803,6 +803,10 @@ void BKE_texture_make_local(Tex *tex)
|
||||
if (br->id.lib) is_lib = TRUE;
|
||||
else is_local = TRUE;
|
||||
}
|
||||
if (br->mask_mtex.tex == tex) {
|
||||
if (br->id.lib) is_lib = TRUE;
|
||||
else is_local = TRUE;
|
||||
}
|
||||
br = br->id.next;
|
||||
}
|
||||
pa = bmain->particle.first;
|
||||
@@ -876,6 +880,13 @@ void BKE_texture_make_local(Tex *tex)
|
||||
tex->id.us--;
|
||||
}
|
||||
}
|
||||
if (br->mask_mtex.tex == tex) {
|
||||
if (br->id.lib == NULL) {
|
||||
br->mask_mtex.tex = tex_new;
|
||||
tex_new->id.us++;
|
||||
tex->id.us--;
|
||||
}
|
||||
}
|
||||
br = br->id.next;
|
||||
}
|
||||
pa = bmain->particle.first;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user