Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2009-08-09 22:14:07 +0400
committerJoerg Mueller <nexyon@gmail.com>2009-08-09 22:14:07 +0400
commit88beab2cce50b5dc617eef22395aa82e5991d635 (patch)
tree10f9ac8a8b3e0e30a733ad3a7e25753434320b89
parent212851e176a4fb3e393f2e5f2dffa3d7828fe024 (diff)
Sound Branch:
* Last commit before merge to 2.5 * Merge until revision 22324 of 2.5 branch * Fixes for some compiler warnings * Updated some build system files
-rw-r--r--CMake/macros.cmake5
-rw-r--r--CMakeLists.txt28
-rw-r--r--config/darwin-config.py44
-rw-r--r--config/irix6-config.py2
-rw-r--r--config/linux2-config.py6
-rw-r--r--config/linuxcross-config.py2
-rw-r--r--config/win32-mingw-config.py5
-rw-r--r--config/win32-vc-config.py13
-rw-r--r--config/win64-vc-config.py10
-rw-r--r--intern/audaspace/OpenAL/AUD_OpenALDevice.cpp11
-rw-r--r--intern/audaspace/OpenAL/AUD_OpenALDevice.h4
-rw-r--r--intern/audaspace/intern/AUD_C-API.cpp12
-rw-r--r--intern/audaspace/intern/AUD_SoftwareDevice.cpp2
-rw-r--r--intern/smoke/CMakeLists.txt6
-rw-r--r--intern/smoke/SConscript5
-rw-r--r--intern/smoke/extern/smoke_API.h12
-rw-r--r--intern/smoke/intern/FFT_NOISE.h2
-rw-r--r--intern/smoke/intern/FLUID_3D.cpp139
-rw-r--r--intern/smoke/intern/FLUID_3D.h8
-rw-r--r--intern/smoke/intern/FLUID_3D_SOLVERS.cpp168
-rw-r--r--intern/smoke/intern/FLUID_3D_STATIC.cpp11
-rw-r--r--intern/smoke/intern/WTURBULENCE.cpp37
-rw-r--r--intern/smoke/intern/WTURBULENCE.h9
-rw-r--r--intern/smoke/intern/smoke_API.cpp48
-rw-r--r--release/io/engine_render_pov.py242
-rw-r--r--release/scripts/export_map.py6
-rw-r--r--release/scripts/md2_export.py3
-rw-r--r--release/ui/buttons_data_camera.py2
-rw-r--r--release/ui/buttons_data_mesh.py37
-rw-r--r--release/ui/buttons_data_metaball.py24
-rw-r--r--release/ui/buttons_data_modifier.py158
-rw-r--r--release/ui/buttons_game.py63
-rw-r--r--release/ui/buttons_material.py59
-rw-r--r--release/ui/buttons_object_constraint.py94
-rw-r--r--release/ui/buttons_physics_cloth.py4
-rw-r--r--release/ui/buttons_physics_fluid.py4
-rw-r--r--release/ui/buttons_physics_smoke.py106
-rw-r--r--release/ui/buttons_physics_softbody.py2
-rw-r--r--release/ui/buttons_texture.py272
-rw-r--r--release/ui/space_image.py10
-rw-r--r--release/ui/space_info.py20
-rw-r--r--release/ui/space_text.py8
-rw-r--r--release/ui/space_view3d.py8
-rw-r--r--release/ui/space_view3d_toolbar.py136
-rw-r--r--source/blender/blenfont/BLF_api.h7
-rw-r--r--source/blender/blenfont/intern/blf.c50
-rw-r--r--source/blender/blenfont/intern/blf_font.c25
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c334
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h55
-rw-r--r--source/blender/blenkernel/BKE_library.h1
-rw-r--r--source/blender/blenkernel/BKE_sculpt.h4
-rw-r--r--source/blender/blenkernel/intern/library.c14
-rw-r--r--source/blender/blenkernel/intern/scene.c7
-rw-r--r--source/blender/blenkernel/intern/smoke.c207
-rw-r--r--source/blender/blenkernel/intern/sound.c9
-rw-r--r--source/blender/blenloader/intern/readfile.c26
-rw-r--r--source/blender/editors/interface/interface_style.c3
-rw-r--r--source/blender/editors/interface/interface_templates.c77
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c18
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c73
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c13
-rw-r--r--source/blender/editors/space_view3d/drawobject.c6
-rw-r--r--source/blender/makesdna/DNA_brush_types.h1
-rw-r--r--source/blender/makesdna/DNA_material_types.h2
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h2
-rw-r--r--source/blender/makesdna/DNA_smoke_types.h5
-rw-r--r--source/blender/makesdna/DNA_texture_types.h6
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt4
-rw-r--r--source/blender/makesrna/intern/SConscript3
-rw-r--r--source/blender/makesrna/intern/rna_brush.c11
-rw-r--r--source/blender/makesrna/intern/rna_define.c21
-rw-r--r--source/blender/makesrna/intern/rna_internal.h1
-rw-r--r--source/blender/makesrna/intern/rna_material.c51
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c58
-rw-r--r--source/blender/makesrna/intern/rna_meta.c8
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c4
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c24
-rw-r--r--source/blender/makesrna/intern/rna_texture.c25
-rw-r--r--source/blender/python/intern/bpy_interface.c128
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c13
-rw-r--r--source/blender/python/intern/bpy_rna.c186
-rw-r--r--source/blender/python/intern/bpy_util.h4
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp12
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.cpp91
-rw-r--r--source/gameengine/Converter/KX_BlenderSceneConverter.h16
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp4
-rw-r--r--tools/Blender.py4
-rwxr-xr-xtools/btools.py7
89 files changed, 2020 insertions, 1449 deletions
diff --git a/CMake/macros.cmake b/CMake/macros.cmake
index 3df6cd788da..3f706e5ed95 100644
--- a/CMake/macros.cmake
+++ b/CMake/macros.cmake
@@ -50,6 +50,9 @@ MACRO(SETUP_LIBDIRS)
IF(WITH_OPENAL)
LINK_DIRECTORIES(${OPENAL_LIBPATH})
ENDIF(WITH_OPENAL)
+ IF(WITH_FFTW3)
+ LINK_DIRECTORIES(${FFTW3_LIBPATH})
+ ENDIF(WITH_FFTW3)
IF(WIN32)
LINK_DIRECTORIES(${PTHREADS_LIBPATH})
@@ -61,7 +64,7 @@ MACRO(SETUP_LIBLINKS
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ")
#TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LIB} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
- TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIBRARY} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${SDL_LIB} ${LLIBS})
+ TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${FFTW3_LIB} ${JPEG_LIBRARY} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${SDL_LIB} ${LLIBS})
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b9899d9005..cdb2f789d13 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,6 +68,7 @@ OPTION(WITH_OPENJPEG "Enable OpenJpeg Support (http://www.openjpeg.org/)" OFF)
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF)
+OPTION(WITH_FFTW3 "Enable FFTW3 support" OFF)
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -156,6 +157,13 @@ IF(UNIX AND NOT APPLE)
SET(FFMPEG_INC ${FFMPEG}/include)
SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
+
+ IF(WITH_FFTW3)
+ SET(FFTW3 /usr)
+ SET(FFTW3_INC ${FFTW3}/include)
+ SET(FFTW3_LIB fftw3)
+ SET(FFTW3_LIBPATH ${FFTW3}/lib)
+ ENDIF(WITH_FFTW3)
SET(LIBSAMPLERATE /usr)
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
@@ -212,7 +220,7 @@ IF(WIN32)
ELSE(CMAKE_CL_64)
#SET(WITH_OPENAL ON)
SET(OPENAL ${LIBDIR}/openal)
- SET(OPENAL_INC ${OPENAL}/include ${OPENAL}/include/AL)
+ SET(OPENAL_INC ${OPENAL}/include)
SET(OPENAL_LIB wrap_oal)
SET(OPENAL_LIBPATH ${OPENAL}/lib)
ENDIF(CMAKE_CL_64)
@@ -239,6 +247,13 @@ IF(WIN32)
SET(ICONV_LIB iconv)
SET(ICONV_LIBPATH ${ICONV}/lib)
+ IF(WITH_FFTW3)
+ SET(FFTW3 ${LIBDIR}/fftw3)
+ SET(FFTW3_INC ${FFTW3}/include)
+ SET(FFTW3_LIB libfftw)
+ SET(FFTW3_LIBPATH ${FFTW3}/lib)
+ ENDIF(WITH_FFTW3)
+
SET(GETTEXT ${LIBDIR}/gettext)
SET(GETTEXT_INC ${GETTEXT}/include)
IF(CMAKE_CL_64)
@@ -287,10 +302,6 @@ IF(WIN32)
SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
ENDIF(CMAKE_CL_64)
- IF(WITH_OPENAL)
- SET(LLIBS ${LLIBS} dxguid)
- ENDIF(WITH_OPENAL)
-
SET(CMAKE_CXX_FLAGS_DEBUG "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
SET(CMAKE_CXX_FLAGS_RELEASE "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
@@ -377,6 +388,13 @@ IF(APPLE)
SET(GETTEXT_INC "${GETTEXT}/include")
SET(GETTEXT_LIB intl iconv)
SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
+
+ IF(WITH_FFTW3)
+ SET(FFTW3 ${LIBDIR}/fftw3)
+ SET(FFTW3_INC ${FFTW3}/include)
+ SET(FFTW3_LIB libfftw)
+ SET(FFTW3_LIBPATH ${FFTW3}/lib)
+ ENDIF(WITH_FFTW3)
SET(PNG_LIBRARIES png)
SET(JPEG_LIBRARY jpeg)
diff --git a/config/darwin-config.py b/config/darwin-config.py
index 597ce72a0d3..88f2d1e3cae 100644
--- a/config/darwin-config.py
+++ b/config/darwin-config.py
@@ -32,22 +32,28 @@ BF_PYTHON_VERSION = '3.1'
if MAC_PROC== 'powerpc' and BF_PYTHON_VERSION == '2.3':
MAC_MIN_VERS = '10.3'
MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
-elif MAC_CUR_VER=='10.4':
+else:
MAC_MIN_VERS = '10.4'
MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
-else:
- MAC_MIN_VERS = '10.5'
- MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
# enable ffmpeg support
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
-BF_FFMPEG = "#extern/ffmpeg"
-BF_FFMPEG_INC = '${BF_FFMPEG}'
-if USE_SDK==True:
- BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
-#BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
-#BF_FFMPEG_LIB = 'avformat.a avcodec.a avutil.a'
+FFMPEG_PRECOMPILED = False
+if FFMPEG_PRECOMPILED:
+ # use precompiled ffmpeg in /lib
+ BF_FFMPEG = LIBDIR + '/ffmpeg'
+ BF_FFMPEG_INC = "#extern/ffmpeg"
+ BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
+ BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore'
+else:
+ # use ffmpeg in extern
+ BF_FFMPEG = "#extern/ffmpeg"
+ BF_FFMPEG_INC = '${BF_FFMPEG}'
+ if USE_SDK==True:
+ BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
+ BF_XVIDCORE_CONFIG = '--disable-assembly' # currently causes errors, even with yasm installed
+ BF_X264_CONFIG = '--disable-pthread'
if BF_PYTHON_VERSION=='3.1':
# python 3.1 uses precompiled libraries in bf svn /lib by default
@@ -80,11 +86,6 @@ else:
BF_QUIET = '1'
WITH_BF_OPENMP = '0'
-# Note : should be true, but openal simply dont work on intel
-if MAC_PROC == 'i386':
- WITH_BF_OPENAL = False
-else:
- WITH_BF_OPENAL = True
#different lib must be used following version of gcc
# for gcc 3.3
#BF_OPENAL = LIBDIR + '/openal'
@@ -106,7 +107,7 @@ BF_CXX = '/usr'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
-BF_LIBSAMPLERATE = LIBDIR + '/SRC'
+BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
BF_LIBSAMPLERATE_LIB = 'samplerate'
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
@@ -163,6 +164,12 @@ BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
+WITH_BF_FFTW3 = False
+BF_FFTW3 = LIBDIR + '/fftw3'
+BF_FFTW3_INC = '${BF_FFTW3}/include'
+BF_FFTW3_LIB = 'libfftw3'
+BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
+
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
@@ -194,6 +201,11 @@ BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
#BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
+BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
+BF_LIBSAMPLERATE_LIB = 'samplerate'
+BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
+
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = True
BF_OPENGL_LIB = 'GL GLU'
diff --git a/config/irix6-config.py b/config/irix6-config.py
index ed237d75140..d38665f282a 100644
--- a/config/irix6-config.py
+++ b/config/irix6-config.py
@@ -24,7 +24,7 @@ BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
-BF_LIBSAMPLERATE = LCGDIR+'/SRC'
+BF_LIBSAMPLERATE = LCGDIR+'/samplerate'
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
BF_LIBSAMPLERATE_LIB = 'samplerate'
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
diff --git a/config/linux2-config.py b/config/linux2-config.py
index cad995ad5f6..3960a387f1a 100644
--- a/config/linux2-config.py
+++ b/config/linux2-config.py
@@ -135,6 +135,12 @@ BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
+WITH_BF_FFTW3 = False
+BF_FFTW3 = LIBDIR + '/usr'
+BF_FFTW3_INC = '${BF_FFTW3}/include'
+BF_FFTW3_LIB = 'fftw3'
+BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
+
WITH_BF_REDCODE = False
BF_REDCODE = '#extern/libredcode'
BF_REDCODE_LIB = ''
diff --git a/config/linuxcross-config.py b/config/linuxcross-config.py
index 42110076101..a7ce2dc2908 100644
--- a/config/linuxcross-config.py
+++ b/config/linuxcross-config.py
@@ -22,7 +22,7 @@ BF_CXX = '/usr'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
-BF_LIBSAMPLERATE = LIBDIR + '/SRC'
+BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
BF_LIBSAMPLERATE_LIB = 'samplerate'
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
diff --git a/config/win32-mingw-config.py b/config/win32-mingw-config.py
index 370ebda9944..5bd66ddf179 100644
--- a/config/win32-mingw-config.py
+++ b/config/win32-mingw-config.py
@@ -16,13 +16,10 @@ BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}.a'
WITH_BF_OPENAL = True
-WITH_BF_STATICOPENAL = False
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
-BF_OPENAL_LIB = 'dxguid openal_static'
+BF_OPENAL_LIB = 'wrap_oal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
-# Warning, this static lib configuration is untested! users of this OS please confirm.
-BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
WITH_BF_FFMPEG = True
BF_FFMPEG_LIB = 'avformat swscale avcodec avutil avdevice xvidcore x264'
diff --git a/config/win32-vc-config.py b/config/win32-vc-config.py
index 6d7bc9541ba..bb1bc02ccdb 100644
--- a/config/win32-vc-config.py
+++ b/config/win32-vc-config.py
@@ -16,13 +16,10 @@ BF_PYTHON_LIB = 'python31'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = True
-WITH_BF_STATICOPENAL = False
BF_OPENAL = LIBDIR + '/openal'
-BF_OPENAL_INC = '${BF_OPENAL}/include ${BF_OPENAL}/include/AL '
-BF_OPENAL_LIB = 'OpenAL32 wrap_oal' #'dxguid openal_static'
+BF_OPENAL_INC = '${BF_OPENAL}/include '
+BF_OPENAL_LIB = 'wrap_oal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
-# Warning, this static lib configuration is untested! users of this OS please confirm.
-BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# TODO - are these useful on win32?
# BF_CXX = '/usr'
@@ -141,6 +138,12 @@ BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
+WITH_BF_FFTW3 = False
+BF_FFTW3 = LIBDIR + '/fftw3'
+BF_FFTW3_INC = '${BF_FFTW3}/include'
+BF_FFTW3_LIB = 'libfftw'
+BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
+
WITH_BF_REDCODE = False
BF_REDCODE_INC = '#extern'
diff --git a/config/win64-vc-config.py b/config/win64-vc-config.py
index 0319d577ff3..3d0aa3666e8 100644
--- a/config/win64-vc-config.py
+++ b/config/win64-vc-config.py
@@ -17,8 +17,8 @@ BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = False
BF_OPENAL = LIBDIR + '/openal'
-BF_OPENAL_INC = '${BF_OPENAL}/include ${BF_OPENAL}/include/AL '
-BF_OPENAL_LIB = 'OpenAL32 wrap_oal' #'dxguid openal_static'
+BF_OPENAL_INC = '${BF_OPENAL}/include '
+BF_OPENAL_LIB = 'wrap_oal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
# TODO - are these useful on win32?
@@ -141,6 +141,12 @@ BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
+WITH_BF_FFTW3 = True
+BF_FFTW3 = LIBDIR + '/fftw3'
+BF_FFTW3_INC = '${BF_FFTW3}/include'
+BF_FFTW3_LIB = 'libfftw'
+BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
+
WITH_BF_REDCODE = False
BF_REDCODE_INC = '#extern'
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
index e4c286c1aa4..f94b11a11b8 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
@@ -703,7 +703,6 @@ bool AUD_OpenALDevice::pause(AUD_Handle* handle)
bool AUD_OpenALDevice::resume(AUD_Handle* handle)
{
- ALint info;
lock();
// only songs that are paused can be resumed
@@ -1196,8 +1195,9 @@ bool AUD_OpenALDevice::setSetting(AUD_3DSetting setting, float value)
case AUD_3DS_SPEED_OF_SOUND:
alSpeedOfSound(value);
return true;
+ default:
+ return false;
}
- return false;
}
float AUD_OpenALDevice::getSetting(AUD_3DSetting setting)
@@ -1226,8 +1226,9 @@ float AUD_OpenALDevice::getSetting(AUD_3DSetting setting)
return alGetFloat(AL_DOPPLER_FACTOR);
case AUD_3DS_SPEED_OF_SOUND:
return alGetFloat(AL_SPEED_OF_SOUND);
+ default:
+ return std::numeric_limits<float>::quiet_NaN();
}
- return std::numeric_limits<float>::quiet_NaN();
}
bool AUD_OpenALDevice::updateSource(AUD_Handle* handle, AUD_3DData &data)
@@ -1298,6 +1299,8 @@ bool AUD_OpenALDevice::setSourceSetting(AUD_Handle* handle,
alSourcef(source, AL_ROLLOFF_FACTOR, value);
result = true;
break;
+ default:
+ break;
}
}
@@ -1349,6 +1352,8 @@ float AUD_OpenALDevice::getSourceSetting(AUD_Handle* handle,
case AUD_3DSS_ROLLOFF_FACTOR:
alGetSourcef(source, AL_ROLLOFF_FACTOR, &result);
break;
+ default:
+ break;
}
}
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.h b/intern/audaspace/OpenAL/AUD_OpenALDevice.h
index 8864ccc4e01..074cd3d1924 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.h
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.h
@@ -32,8 +32,8 @@ struct AUD_OpenALHandle;
struct AUD_OpenALBufferedFactory;
class AUD_ConverterFactory;
-#include <al.h>
-#include <alc.h>
+#include <AL/al.h>
+#include <AL/alc.h>
#include <list>
#include <pthread.h>
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp
index 5039b16de2c..830e1147cbb 100644
--- a/intern/audaspace/intern/AUD_C-API.cpp
+++ b/intern/audaspace/intern/AUD_C-API.cpp
@@ -479,11 +479,9 @@ int AUD_setSoundVolume(AUD_Handle* handle, float volume)
{
return AUD_device->setCapability(AUD_CAPS_SOURCE_VOLUME, &caps);
}
- catch(AUD_Exception e)
- {
- return false;
- }
+ catch(AUD_Exception e) {}
}
+ return false;
}
int AUD_setSoundPitch(AUD_Handle* handle, float pitch)
@@ -499,11 +497,9 @@ int AUD_setSoundPitch(AUD_Handle* handle, float pitch)
{
return AUD_device->setCapability(AUD_CAPS_SOURCE_PITCH, &caps);
}
- catch(AUD_Exception e)
- {
- return false;
- }
+ catch(AUD_Exception e) {}
}
+ return false;
}
AUD_Device* AUD_openReadDevice(AUD_Specs specs)
diff --git a/intern/audaspace/intern/AUD_SoftwareDevice.cpp b/intern/audaspace/intern/AUD_SoftwareDevice.cpp
index 1a2a53fed19..174ff8c8979 100644
--- a/intern/audaspace/intern/AUD_SoftwareDevice.cpp
+++ b/intern/audaspace/intern/AUD_SoftwareDevice.cpp
@@ -95,7 +95,7 @@ void AUD_SoftwareDevice::mix(sample_t* buffer, int length)
lock();
AUD_SoftwareHandle* sound;
- int len, left;
+ int len;
sample_t* buf;
int sample_size = AUD_SAMPLE_SIZE(m_specs);
std::list<AUD_SoftwareHandle*> stopSounds;
diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt
index 90768e58be0..0db6acb683f 100644
--- a/intern/smoke/CMakeLists.txt
+++ b/intern/smoke/CMakeLists.txt
@@ -25,7 +25,6 @@
# ***** END GPL LICENSE BLOCK *****
SET(INC ${PNG_INC} ${ZLIB_INC} intern ../../extern/bullet2/src ../memutil ../guardealloc)
-# ${FFTW3_INC}
FILE(GLOB SRC intern/*.cpp)
@@ -33,6 +32,11 @@ IF(WITH_OPENMP)
ADD_DEFINITIONS(-DPARALLEL=1)
ENDIF(WITH_OPENMP)
+IF(WITH_FFTW3)
+ ADD_DEFINITIONS(-DFFTW3=1)
+ SET(INC ${INC} ${FFTW3_INC})
+ENDIF(WITH_FFTW3)
+
BLENDERLIB(bf_smoke "${SRC}" "${INC}")
#, libtype='blender', priority = 0 )
diff --git a/intern/smoke/SConscript b/intern/smoke/SConscript
index c427764e19e..af5bf1aeb20 100644
--- a/intern/smoke/SConscript
+++ b/intern/smoke/SConscript
@@ -10,6 +10,9 @@ if env['WITH_BF_OPENMP']:
incs = env['BF_PNG_INC'] + ' ' + env['BF_ZLIB_INC']
incs += ' intern ../../extern/bullet2/src ../memutil ../guardealloc '
-# incs += env['BF_FFTW3_INC']
+
+if env['WITH_BF_FFTW3']:
+ defs += ' FFTW3=1'
+ incs += env['BF_FFTW3_INC']
env.BlenderLib ('bf_smoke', sources, Split(incs), Split(defs), libtype=['intern'], priority=[40] )
diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h
index b7819d06edc..ba14a247bf1 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -36,11 +36,9 @@ struct FLUID_3D *smoke_init(int *res, int amplify, float *p0, float *p1, float d
void smoke_free(struct FLUID_3D *fluid);
void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta);
-
void smoke_step(struct FLUID_3D *fluid);
float *smoke_get_density(struct FLUID_3D *fluid);
-float *smoke_get_bigdensity(struct FLUID_3D *fluid);
float *smoke_get_heat(struct FLUID_3D *fluid);
float *smoke_get_velocity_x(struct FLUID_3D *fluid);
float *smoke_get_velocity_y(struct FLUID_3D *fluid);
@@ -51,9 +49,15 @@ unsigned char *smoke_get_obstacle(struct FLUID_3D *fluid);
size_t smoke_get_index(int x, int max_x, int y, int max_y, int z);
size_t smoke_get_index2d(int x, int max_x, int y);
-void smoke_set_noise(struct FLUID_3D *fluid, int type);
+// wavelet turbulence functions
+struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype);
+void smoke_turbulence_free(struct WTURBULENCE *wt);
+void smoke_turbulence_step(struct WTURBULENCE *wt, struct FLUID_3D *fluid);
-void smoke_get_bigres(struct FLUID_3D *fluid, int *res);
+float *smoke_turbulence_get_density(struct WTURBULENCE *wt);
+void smoke_turbulence_get_res(struct WTURBULENCE *wt, int *res);
+void smoke_turbulence_set_noise(struct WTURBULENCE *wt, int type);
+void smoke_initWaveletBlenderRNA(struct WTURBULENCE *wt, float *strength);
#ifdef __cplusplus
}
diff --git a/intern/smoke/intern/FFT_NOISE.h b/intern/smoke/intern/FFT_NOISE.h
index 9ae9682e2a0..e1000f72fb3 100644
--- a/intern/smoke/intern/FFT_NOISE.h
+++ b/intern/smoke/intern/FFT_NOISE.h
@@ -22,7 +22,7 @@
#ifndef FFT_NOISE_H_
#define FFT_NOISE_H_
-#if 0
+#if FFTW3==1
#include <iostream>
#include <fftw3.h>
#include <MERSENNETWISTER.h>
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index 344883866a8..7e3a00417c1 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -59,7 +59,12 @@ FLUID_3D::FLUID_3D(int *res, int amplify, float *p0, float dt) :
_maxRes = MAX3(_xRes, _yRes, _zRes);
// initialize wavelet turbulence
- _wTurbulence = new WTURBULENCE(_res[0],_res[1],_res[2], amplify);
+ /*
+ if(amplify)
+ _wTurbulence = new WTURBULENCE(_res[0],_res[1],_res[2], amplify, noisetype);
+ else
+ _wTurbulence = NULL;
+ */
// scale the constants according to the refinement of the grid
_dx = 1.0f / (float)_maxRes;
@@ -93,6 +98,8 @@ FLUID_3D::FLUID_3D(int *res, int amplify, float *p0, float dt) :
_xVorticity = new float[_totalCells];
_yVorticity = new float[_totalCells];
_zVorticity = new float[_totalCells];
+ _h = new float[_totalCells];
+ _Precond = new float[_totalCells];
for (int x = 0; x < _totalCells; x++)
{
@@ -115,6 +122,8 @@ FLUID_3D::FLUID_3D(int *res, int amplify, float *p0, float dt) :
_yVorticity[x] = 0.0f;
_zVorticity[x] = 0.0f;
_residual[x] = 0.0f;
+ _h[x] = 0.0f;
+ _Precond[x] = 0.0f;
_obstacles[x] = false;
}
@@ -186,8 +195,10 @@ FLUID_3D::~FLUID_3D()
if (_yVorticity) delete[] _yVorticity;
if (_zVorticity) delete[] _zVorticity;
if (_vorticity) delete[] _vorticity;
+ if (_h) delete[] _h;
+ if (_Precond) delete[] _Precond;
if (_obstacles) delete[] _obstacles;
- if (_wTurbulence) delete _wTurbulence;
+ // if (_wTurbulence) delete _wTurbulence;
printf("deleted fluid\n");
}
@@ -197,10 +208,6 @@ void FLUID_3D::initBlenderRNA(float *alpha, float *beta)
{
_alpha = alpha;
_beta = beta;
-
- // XXX TODO DEBUG
- // *_alpha = 0;
- // *_beta = 0;
}
//////////////////////////////////////////////////////////////////////
@@ -215,21 +222,21 @@ void FLUID_3D::step()
wipeBoundaries();
// run the solvers
- addVorticity();
- addBuoyancy(_heat, _density);
+ addVorticity();
+ addBuoyancy(_heat, _density);
addForce();
project();
- diffuseHeat();
+ diffuseHeat();
// advect everything
advectMacCormack();
- if(_wTurbulence) {
- _wTurbulence->stepTurbulenceFull(_dt/_dx,
- _xVelocity, _yVelocity, _zVelocity, _obstacles);
+ // if(_wTurbulence) {
+ // _wTurbulence->stepTurbulenceFull(_dt/_dx,
+ // _xVelocity, _yVelocity, _zVelocity, _obstacles);
// _wTurbulence->stepTurbulenceReadable(_dt/_dx,
// _xVelocity, _yVelocity, _zVelocity, _obstacles);
- }
+ // }
/*
// no file output
float *src = _density;
@@ -248,7 +255,7 @@ void FLUID_3D::step()
IMAGE::dumpPBRT(_totalSteps, pbrtPrefix, _density, _res[0],_res[1],_res[2]);
*/
_totalTime += _dt;
- _totalSteps++;
+ _totalSteps++;
}
//////////////////////////////////////////////////////////////////////
@@ -354,6 +361,7 @@ void FLUID_3D::addForce()
void FLUID_3D::project()
{
int index, x, y, z;
+
setObstacleBoundaries();
// copy out the boundaries
@@ -390,12 +398,16 @@ void FLUID_3D::project()
xright - xleft +
yup - ydown +
ztop - zbottom );
- _pressure[index] = 0.0f;
+
+ // DG: commenting this helps CG to get a better start, 10-20% speed improvement
+ // _pressure[index] = 0.0f;
}
copyBorderAll(_pressure);
// solve Poisson equation
- solvePressure(_pressure, _divergence, _obstacles);
+ solvePressurePre(_pressure, _divergence, _obstacles);
+
+ setObstaclePressure();
// project out solution
float invDx = 1.0f / _dx;
@@ -404,9 +416,12 @@ void FLUID_3D::project()
for (y = 1; y < _yRes - 1; y++, index += 2)
for (x = 1; x < _xRes - 1; x++, index++)
{
- _xVelocity[index] -= 0.5f * (_pressure[index + 1] - _pressure[index - 1]) * invDx;
- _yVelocity[index] -= 0.5f * (_pressure[index + _xRes] - _pressure[index - _xRes]) * invDx;
- _zVelocity[index] -= 0.5f * (_pressure[index + _slabSize] - _pressure[index - _slabSize]) * invDx;
+ if(!_obstacles[index])
+ {
+ _xVelocity[index] -= 0.5f * (_pressure[index + 1] - _pressure[index - 1]) * invDx;
+ _yVelocity[index] -= 0.5f * (_pressure[index + _xRes] - _pressure[index - _xRes]) * invDx;
+ _zVelocity[index] -= 0.5f * (_pressure[index + _slabSize] - _pressure[index - _slabSize]) * invDx;
+ }
}
}
@@ -443,34 +458,8 @@ void FLUID_3D::addObstacle(OBSTACLE* obstacle)
//////////////////////////////////////////////////////////////////////
// calculate the obstacle directional types
//////////////////////////////////////////////////////////////////////
-void FLUID_3D::setObstacleBoundaries()
+void FLUID_3D::setObstaclePressure()
{
- // cull degenerate obstacles , move to addObstacle?
- for (int z = 1, index = _slabSize + _xRes + 1;
- z < _zRes - 1; z++, index += 2 * _xRes)
- for (int y = 1; y < _yRes - 1; y++, index += 2)
- for (int x = 1; x < _xRes - 1; x++, index++)
- if (_obstacles[index] != EMPTY)
- {
- const int top = _obstacles[index + _slabSize];
- const int bottom= _obstacles[index - _slabSize];
- const int up = _obstacles[index + _xRes];
- const int down = _obstacles[index - _xRes];
- const int left = _obstacles[index - 1];
- const int right = _obstacles[index + 1];
-
- int counter = 0;
- if (up) counter++;
- if (down) counter++;
- if (left) counter++;
- if (right) counter++;
- if (top) counter++;
- if (bottom) counter++;
-
- if (counter < 3)
- _obstacles[index] = EMPTY;
- }
-
// tag remaining obstacle blocks
for (int z = 1, index = _slabSize + _xRes + 1;
z < _zRes - 1; z++, index += 2 * _xRes)
@@ -478,7 +467,7 @@ void FLUID_3D::setObstacleBoundaries()
for (int x = 1; x < _xRes - 1; x++, index++)
{
// could do cascade of ifs, but they are a pain
- if (_obstacles[index] != EMPTY)
+ if (_obstacles[index])
{
const int top = _obstacles[index + _slabSize];
const int bottom= _obstacles[index - _slabSize];
@@ -498,7 +487,7 @@ void FLUID_3D::setObstacleBoundaries()
_pressure[index] = 0.0f;
// average pressure neighbors
- float pcnt = 0.;
+ float pcnt = 0., vp = 0.;
if (left && !right) {
_pressure[index] += _pressure[index + 1];
pcnt += 1.;
@@ -516,14 +505,24 @@ void FLUID_3D::setObstacleBoundaries()
pcnt += 1.;
}
if (top && !bottom) {
- _pressure[index] += _pressure[index - _xRes];
+ _pressure[index] += _pressure[index - _slabSize];
pcnt += 1.;
+ // _zVelocity[index] += - _zVelocity[index - _slabSize];
+ // vp += 1.0;
}
if (!top && bottom) {
- _pressure[index] += _pressure[index + _xRes];
+ _pressure[index] += _pressure[index + _slabSize];
pcnt += 1.;
+ // _zVelocity[index] += - _zVelocity[index + _slabSize];
+ // vp += 1.0;
}
- _pressure[index] /= pcnt;
+
+ if(pcnt > 0.000001f)
+ _pressure[index] /= pcnt;
+
+ // test - dg
+ // if(vp > 0.000001f)
+ // _zVelocity[index] /= vp;
// TODO? set correct velocity bc's
// velocities are only set to zero right now
@@ -533,6 +532,44 @@ void FLUID_3D::setObstacleBoundaries()
}
}
+void FLUID_3D::setObstacleBoundaries()
+{
+ // cull degenerate obstacles , move to addObstacle?
+ for (int z = 1, index = _slabSize + _xRes + 1;
+ z < _zRes - 1; z++, index += 2 * _xRes)
+ for (int y = 1; y < _yRes - 1; y++, index += 2)
+ for (int x = 1; x < _xRes - 1; x++, index++)
+ {
+ if (_obstacles[index] != EMPTY)
+ {
+ const int top = _obstacles[index + _slabSize];
+ const int bottom= _obstacles[index - _slabSize];
+ const int up = _obstacles[index + _xRes];
+ const int down = _obstacles[index - _xRes];
+ const int left = _obstacles[index - 1];
+ const int right = _obstacles[index + 1];
+
+ int counter = 0;
+ if (up) counter++;
+ if (down) counter++;
+ if (left) counter++;
+ if (right) counter++;
+ if (top) counter++;
+ if (bottom) counter++;
+
+ if (counter < 3)
+ _obstacles[index] = EMPTY;
+ }
+ if (_obstacles[index])
+ {
+ _xVelocity[index] =
+ _yVelocity[index] =
+ _zVelocity[index] = 0.0f;
+ _pressure[index] = 0.0f;
+ }
+ }
+}
+
//////////////////////////////////////////////////////////////////////
// add buoyancy forces
//////////////////////////////////////////////////////////////////////
diff --git a/intern/smoke/intern/FLUID_3D.h b/intern/smoke/intern/FLUID_3D.h
index 2d212caa6d3..ffda34021c3 100644
--- a/intern/smoke/intern/FLUID_3D.h
+++ b/intern/smoke/intern/FLUID_3D.h
@@ -27,7 +27,7 @@
#include <cmath>
#include <iostream>
#include "OBSTACLE.h"
-#include "WTURBULENCE.h"
+// #include "WTURBULENCE.h"
#include "VEC3.h"
using namespace std;
@@ -96,6 +96,8 @@ class FLUID_3D
float* _yVorticity;
float* _zVorticity;
float* _vorticity;
+ float* _h;
+ float* _Precond;
unsigned char* _obstacles;
// CG fields
@@ -113,7 +115,7 @@ class FLUID_3D
float _tempAmb; /* ambient temperature */
// WTURBULENCE object, if active
- WTURBULENCE* _wTurbulence;
+ // WTURBULENCE* _wTurbulence;
// boundary setting functions
void copyBorderAll(float* field);
@@ -128,10 +130,12 @@ class FLUID_3D
void project();
void diffuseHeat();
void solvePressure(float* field, float* b, unsigned char* skip);
+ void solvePressurePre(float* field, float* b, unsigned char* skip);
void solveHeat(float* field, float* b, unsigned char* skip);
// handle obstacle boundaries
void setObstacleBoundaries();
+ void setObstaclePressure();
public:
// advection, accessed e.g. by WTURBULENCE class
diff --git a/intern/smoke/intern/FLUID_3D_SOLVERS.cpp b/intern/smoke/intern/FLUID_3D_SOLVERS.cpp
index 5fd8f72d79d..51929e1194b 100644
--- a/intern/smoke/intern/FLUID_3D_SOLVERS.cpp
+++ b/intern/smoke/intern/FLUID_3D_SOLVERS.cpp
@@ -21,8 +21,171 @@
//////////////////////////////////////////////////////////////////////
#include "FLUID_3D.h"
+
#define SOLVER_ACCURACY 1e-06
+void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip)
+{
+ int x, y, z, index;
+
+ // i = 0
+ int i = 0;
+
+ // r = b - Ax
+ index = _slabSize + _xRes + 1;
+ for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
+ for (y = 1; y < _yRes - 1; y++, index += 2)
+ for (x = 1; x < _xRes - 1; x++, index++)
+ {
+ // if the cell is a variable
+ float Acenter = 0.0f;
+ if (!skip[index])
+ {
+ // set the matrix to the Poisson stencil in order
+ if (!skip[index + 1]) Acenter += 1.;
+ if (!skip[index - 1]) Acenter += 1.;
+ if (!skip[index + _xRes]) Acenter += 1.;
+ if (!skip[index - _xRes]) Acenter += 1.;
+ if (!skip[index + _slabSize]) Acenter += 1.;
+ if (!skip[index - _slabSize]) Acenter += 1.;
+ }
+
+ _residual[index] = b[index] - (Acenter * field[index] +
+ field[index - 1] * (skip[index - 1] ? 0.0 : -1.0f)+
+ field[index + 1] * (skip[index + 1] ? 0.0 : -1.0f)+
+ field[index - _xRes] * (skip[index - _xRes] ? 0.0 : -1.0f)+
+ field[index + _xRes] * (skip[index + _xRes] ? 0.0 : -1.0f)+
+ field[index - _slabSize] * (skip[index - _slabSize] ? 0.0 : -1.0f)+
+ field[index + _slabSize] * (skip[index + _slabSize] ? 0.0 : -1.0f) );
+ _residual[index] = (skip[index]) ? 0.0f : _residual[index];
+
+ // P^-1
+ if(Acenter < 1.0)
+ _Precond[index] = 0.0;
+ else
+ _Precond[index] = 1.0 / Acenter;
+
+ // p = P^-1 * r
+ _direction[index] = _residual[index] * _Precond[index];
+ }
+
+ // deltaNew = transpose(r) * p
+ float deltaNew = 0.0f;
+ index = _slabSize + _xRes + 1;
+ for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
+ for (y = 1; y < _yRes - 1; y++, index += 2)
+ for (x = 1; x < _xRes - 1; x++, index++)
+ deltaNew += _residual[index] * _direction[index];
+
+ // delta0 = deltaNew
+ float delta0 = deltaNew;
+
+ // While deltaNew > (eps^2) * delta0
+ const float eps = SOLVER_ACCURACY;
+ //while ((i < _iterations) && (deltaNew > eps*delta0))
+ float maxR = 2.0f * eps;
+ // while (i < _iterations)
+ while ((i < _iterations) && (maxR > 0.001*eps))
+ {
+ // (s) q = Ad (p)
+ index = _slabSize + _xRes + 1;
+ for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
+ for (y = 1; y < _yRes - 1; y++, index += 2)
+ for (x = 1; x < _xRes - 1; x++, index++)
+ {
+ // if the cell is a variable
+ float Acenter = 0.0f;
+ if (!skip[index])
+ {
+ // set the matrix to the Poisson stencil in order
+ if (!skip[index + 1]) Acenter += 1.;
+ if (!skip[index - 1]) Acenter += 1.;
+ if (!skip[index + _xRes]) Acenter += 1.;
+ if (!skip[index - _xRes]) Acenter += 1.;
+ if (!skip[index + _slabSize]) Acenter += 1.;
+ if (!skip[index - _slabSize]) Acenter += 1.;
+ }
+
+ _q[index] = Acenter * _direction[index] +
+ _direction[index - 1] * (skip[index - 1] ? 0.0 : -1.0f) +
+ _direction[index + 1] * (skip[index + 1] ? 0.0 : -1.0f) +
+ _direction[index - _xRes] * (skip[index - _xRes] ? 0.0 : -1.0f) +
+ _direction[index + _xRes] * (skip[index + _xRes] ? 0.0 : -1.0f)+
+ _direction[index - _slabSize] * (skip[index - _slabSize] ? 0.0 : -1.0f) +
+ _direction[index + _slabSize] * (skip[index + _slabSize] ? 0.0 : -1.0f);
+ _q[index] = (skip[index]) ? 0.0f : _q[index];
+ }
+
+ // alpha = deltaNew / (transpose(d) * q)
+ float alpha = 0.0f;
+ index = _slabSize + _xRes + 1;
+ for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
+ for (y = 1; y < _yRes - 1; y++, index += 2)
+ for (x = 1; x < _xRes - 1; x++, index++)
+ alpha += _direction[index] * _q[index];
+ if (fabs(alpha) > 0.0f)
+ alpha = deltaNew / alpha;
+
+ // x = x + alpha * d
+ index = _slabSize + _xRes + 1;
+ for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
+ for (y = 1; y < _yRes - 1; y++, index += 2)
+ for (x = 1; x < _xRes - 1; x++, index++)
+ field[index] += alpha * _direction[index];
+
+ // r = r - alpha * q
+ maxR = 0.0;
+ index = _slabSize + _xRes + 1;
+ for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
+ for (y = 1; y < _yRes - 1; y++, index += 2)
+ for (x = 1; x < _xRes - 1; x++, index++)
+ {
+ _residual[index] -= alpha * _q[index];
+ // maxR = (_residual[index] > maxR) ? _residual[index] : maxR;
+ }
+
+ // if(maxR <= eps)
+ // break;
+
+ // h = P^-1 * r
+ index = _slabSize + _xRes + 1;
+ for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
+ for (y = 1; y < _yRes - 1; y++, index += 2)
+ for (x = 1; x < _xRes - 1; x++, index++)
+ {
+ _h[index] = _Precond[index] * _residual[index];
+ }
+
+ // deltaOld = deltaNew
+ float deltaOld = deltaNew;
+
+ // deltaNew = transpose(r) * h
+ deltaNew = 0.0f;
+ index = _slabSize + _xRes + 1;
+ for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
+ for (y = 1; y < _yRes - 1; y++, index += 2)
+ for (x = 1; x < _xRes - 1; x++, index++)
+ {
+ deltaNew += _residual[index] * _h[index];
+ maxR = (_residual[index]* _h[index] > maxR) ? _residual[index]* _h[index] : maxR;
+ }
+
+ // beta = deltaNew / deltaOld
+ float beta = deltaNew / deltaOld;
+
+ // d = h + beta * d
+ index = _slabSize + _xRes + 1;
+ for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
+ for (y = 1; y < _yRes - 1; y++, index += 2)
+ for (x = 1; x < _xRes - 1; x++, index++)
+ _direction[index] = _h[index] + beta * _direction[index];
+
+ // i = i + 1
+ i++;
+ }
+ // cout << i << " iterations converged to " << sqrt(maxR) << endl;
+}
+
//////////////////////////////////////////////////////////////////////
// solve the poisson equation with CG
//////////////////////////////////////////////////////////////////////
@@ -61,6 +224,7 @@ void FLUID_3D::solvePressure(float* field, float* b, unsigned char* skip)
field[index + _slabSize] * (skip[index + _slabSize] ? 0.0 : -1.0f) );
_residual[index] = (skip[index]) ? 0.0f : _residual[index];
}
+
// d = r
index = _slabSize + _xRes + 1;
@@ -166,7 +330,7 @@ void FLUID_3D::solvePressure(float* field, float* b, unsigned char* skip)
// i = i + 1
i++;
}
- cout << i << " iterations converged to " << maxR << endl;
+ // cout << i << " iterations converged to " << maxR << endl;
}
//////////////////////////////////////////////////////////////////////
@@ -314,6 +478,6 @@ void FLUID_3D::solveHeat(float* field, float* b, unsigned char* skip)
// i = i + 1
i++;
}
- cout << i << " iterations converged to " << maxR << endl;
+ // cout << i << " iterations converged to " << maxR << endl;
}
diff --git a/intern/smoke/intern/FLUID_3D_STATIC.cpp b/intern/smoke/intern/FLUID_3D_STATIC.cpp
index f2bbcf33075..7d3fe0c1c8d 100644
--- a/intern/smoke/intern/FLUID_3D_STATIC.cpp
+++ b/intern/smoke/intern/FLUID_3D_STATIC.cpp
@@ -80,7 +80,7 @@ void FLUID_3D::addSmokeTestCase(float* field, Vec3Int res, float value)
void FLUID_3D::setNeumannX(float* field, Vec3Int res)
{
const int slabSize = res[0] * res[1];
- int index;
+ size_t index;
for (int z = 0; z < res[2]; z++)
for (int y = 0; y < res[1]; y++)
{
@@ -100,7 +100,7 @@ void FLUID_3D::setNeumannX(float* field, Vec3Int res)
void FLUID_3D::setNeumannY(float* field, Vec3Int res)
{
const int slabSize = res[0] * res[1];
- int index;
+ size_t index;
for (int z = 0; z < res[2]; z++)
for (int x = 0; x < res[0]; x++)
{
@@ -121,7 +121,7 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res)
{
const int slabSize = res[0] * res[1];
const int totalCells = res[0] * res[1] * res[2];
- int index;
+ size_t index;
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++)
{
@@ -141,10 +141,11 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res)
// top slab
index = x + y * res[0];
index += totalCells - slabSize;
- if(field[index]<0.) field[index] = 0.;
+ if(field[index]<0.) field[index] = 0.0f;
index -= slabSize;
- if(field[index]<0.) field[index] = 0.;
+ if(field[index]<0.) field[index] = 0.0f;
}
+
}
//////////////////////////////////////////////////////////////////////
diff --git a/intern/smoke/intern/WTURBULENCE.cpp b/intern/smoke/intern/WTURBULENCE.cpp
index 022c8f28252..06d8d84e821 100644
--- a/intern/smoke/intern/WTURBULENCE.cpp
+++ b/intern/smoke/intern/WTURBULENCE.cpp
@@ -43,7 +43,7 @@ static const float persistence = 0.56123f;
//////////////////////////////////////////////////////////////////////
// constructor
//////////////////////////////////////////////////////////////////////
-WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify)
+WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype)
{
// if noise magnitude is below this threshold, its contribution
// is negilgible, so stop evaluating new octaves
@@ -53,10 +53,10 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify)
_amplify = amplify;
// manually adjust the overall amount of turbulence
- _strength = 2.;
+ // DG - RNA-fied _strength = 2.;
// add the corresponding octaves of noise
- _octaves = (int)log((float)_amplify) / log(2.0f); // XXX DEBUG/ TODO: int casting correct? - dg
+ _octaves = (int)(log((float)_amplify) / log(2.0f) + 0.5); // XXX DEBUG/ TODO: int casting correct? - dg
// noise resolution
_xResBig = _amplify * xResSm;
@@ -136,8 +136,11 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify)
// noise tiles
_noiseTile = new float[noiseTileSize * noiseTileSize * noiseTileSize];
+ /*
std::string noiseTileFilename = std::string("noise.wavelets");
generateTile_WAVELET(_noiseTile, noiseTileFilename);
+ */
+ setNoise(noisetype);
/*
std::string noiseTileFilename = std::string("noise.fft");
generatTile_FFT(_noiseTile, noiseTileFilename);
@@ -173,19 +176,21 @@ WTURBULENCE::~WTURBULENCE() {
//////////////////////////////////////////////////////////////////////
// Change noise type
//
-// type (1<<1) = wavelet / 2
-// type (1<<2) = FFT / 4
-// type (1<<3) = curl / 8
+// type (1<<0) = wavelet / 2
+// type (1<<1) = FFT / 4
+// type (1<<2) = curl / 8
//////////////////////////////////////////////////////////////////////
void WTURBULENCE::setNoise(int type)
{
- if(type == 4) // FFT
+ if(type == (1<<1)) // FFT
{
// needs fft
- // std::string noiseTileFilename = std::string("noise.fft");
- // generatTile_FFT(_noiseTile, noiseTileFilename);
+ #if FFTW3==1
+ std::string noiseTileFilename = std::string("noise.fft");
+ generatTile_FFT(_noiseTile, noiseTileFilename);
+ #endif
}
- else if(type == 8) // curl
+ else if(type == (1<<2)) // curl
{
// TODO: not supported yet
}
@@ -196,6 +201,12 @@ void WTURBULENCE::setNoise(int type)
}
}
+// init direct access functions from blender
+void WTURBULENCE::initBlenderRNA(float *strength)
+{
+ _strength = strength;
+}
+
//////////////////////////////////////////////////////////////////////
// Get the smallest valid x derivative
//
@@ -642,7 +653,7 @@ void WTURBULENCE::stepTurbulenceReadable(float dtOrg, float* xvel, float* yvel,
// base amplitude for octave 0
float coefficient = sqrtf(2.0f * fabs(energy));
- const float amplitude = _strength * fabs(0.5 * coefficient) * persistence;
+ const float amplitude = *_strength * fabs(0.5 * coefficient) * persistence;
// add noise to velocity, but only if the turbulence is
// sufficiently undeformed, and the energy is large enough
@@ -854,7 +865,7 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
// base amplitude for octave 0
float coefficient = sqrtf(2.0f * fabs(energy));
- const float amplitude = _strength * fabs(0.5 * coefficient) * persistence;
+ const float amplitude = *_strength * fabs(0.5 * coefficient) * persistence;
// add noise to velocity, but only if the turbulence is
// sufficiently undeformed, and the energy is large enough
@@ -925,7 +936,7 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
maxVelMag = sqrt(maxVelMag) * dt;
int totalSubsteps = (int)(maxVelMag / (float)maxVel);
totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps;
-
+ // printf("totalSubsteps: %d\n", totalSubsteps);
totalSubsteps = (totalSubsteps > maxSubSteps) ? maxSubSteps : totalSubsteps;
const float dtSubdiv = dt / (float)totalSubsteps;
diff --git a/intern/smoke/intern/WTURBULENCE.h b/intern/smoke/intern/WTURBULENCE.h
index 858a47b7dd1..d4e6b0c6a17 100644
--- a/intern/smoke/intern/WTURBULENCE.h
+++ b/intern/smoke/intern/WTURBULENCE.h
@@ -33,12 +33,13 @@ class WTURBULENCE
{
public:
// both config files can be NULL, altCfg might override values from noiseCfg
- WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify);
+ WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype);
/// destructor
virtual ~WTURBULENCE();
void setNoise(int type);
+ void initBlenderRNA(float *strength);
// step more readable version -- no rotation correction
void stepTurbulenceReadable(float dt, float* xvel, float* yvel, float* zvel, unsigned char *obstacles);
@@ -69,13 +70,15 @@ class WTURBULENCE
inline Vec3Int getResBig() { return _resBig; }
inline int getOctaves() { return _octaves; }
+ // is accessed on through rna gui
+ float *_strength;
+
protected:
// enlargement factor from original velocity field / simulation
// _Big = _amplify * _Sm
int _amplify;
int _octaves;
- float _strength;
-
+
// noise settings
float _cullingThreshold;
float _noiseStrength;
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index 9c835cf87ee..7d476191c90 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -26,6 +26,7 @@
*/
#include "FLUID_3D.h"
+#include "WTURBULENCE.h"
#include <stdio.h>
#include <stdlib.h>
@@ -41,22 +42,48 @@ extern "C" FLUID_3D *smoke_init(int *res, int amplify, float *p0, float *p1, flo
return fluid;
}
+extern "C" WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype)
+{
+ // initialize wavelet turbulence
+ if(amplify)
+ return new WTURBULENCE(res[0],res[1],res[2], amplify, noisetype);
+ else
+ return NULL;
+}
+
extern "C" void smoke_free(FLUID_3D *fluid)
{
delete fluid;
fluid = NULL;
}
+extern "C" void smoke_turbulence_free(WTURBULENCE *wt)
+{
+ delete wt;
+ wt = NULL;
+}
+
extern "C" void smoke_step(FLUID_3D *fluid)
{
fluid->step();
}
+extern "C" void smoke_turbulence_step(WTURBULENCE *wt, FLUID_3D *fluid)
+{
+ if(wt)
+ wt->stepTurbulenceFull(fluid->_dt/fluid->_dx, fluid->_xVelocity, fluid->_yVelocity, fluid->_zVelocity, fluid->_obstacles);
+}
+
extern "C" void smoke_initBlenderRNA(FLUID_3D *fluid, float *alpha, float *beta)
{
fluid->initBlenderRNA(alpha, beta);
}
+extern "C" void smoke_initWaveletBlenderRNA(WTURBULENCE *wt, float *strength)
+{
+ wt->initBlenderRNA(strength);
+}
+
template < class T > inline T ABS( T a ) {
return (0 < a) ? a : -a ;
}
@@ -86,17 +113,20 @@ extern "C" float *smoke_get_velocity_z(FLUID_3D *fluid)
return fluid->_zVorticity;
}
-extern "C" float *smoke_get_bigdensity(FLUID_3D *fluid)
+extern "C" float *smoke_turbulence_get_density(WTURBULENCE *wt)
{
- return fluid->_wTurbulence->getDensityBig();
+ return wt ? wt->getDensityBig() : NULL;
}
-extern "C" void smoke_get_bigres(FLUID_3D *fluid, int *res)
+extern "C" void smoke_turbulence_get_res(WTURBULENCE *wt, int *res)
{
- Vec3Int r = fluid->_wTurbulence->getResBig();
- res[0] = r[0];
- res[1] = r[1];
- res[2] = r[2];
+ if(wt)
+ {
+ Vec3Int r = wt->getResBig();
+ res[0] = r[0];
+ res[1] = r[1];
+ res[2] = r[2];
+ }
}
extern "C" unsigned char *smoke_get_obstacle(FLUID_3D *fluid)
@@ -115,7 +145,7 @@ extern "C" size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z
return x + y * max_x;
}
-extern "C" void smoke_set_noise(FLUID_3D *fluid, int type)
+extern "C" void smoke_turbulence_set_noise(WTURBULENCE *wt, int type)
{
- fluid->_wTurbulence->setNoise(type);
+ wt->setNoise(type);
}
diff --git a/release/io/engine_render_pov.py b/release/io/engine_render_pov.py
index 44f34d890f6..ea419bb0ace 100644
--- a/release/io/engine_render_pov.py
+++ b/release/io/engine_render_pov.py
@@ -19,20 +19,113 @@ def write_pov(filename, scene=None, info_callback = None):
# Only for testing
if not scene:
scene = bpy.data.scenes[0]
-
+
render = scene.render_data
- materialTable = {}
+ world = scene.world
- def saneName(name):
- name = name.lower()
- for ch in ' /\\+=-[]{}().,<>\'":;~!@#$%^&*|?':
- name = name.replace(ch, '_')
+ # --- taken from fbx exporter
+ ## This was used to make V, but faster not to do all that
+ ##valid = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_,.()[]{}'
+ ##v = range(255)
+ ##for c in valid: v.remove(ord(c))
+ v = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,42,43,46,47,58,59,60,61,62,63,64,92,94,96,124,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254]
+ invalid = ''.join([chr(i) for i in v])
+ def cleanName(name):
+ for ch in invalid: name = name.replace(ch, '_')
return name
+ del v
+
+ # --- done with clean name.
+
+ def uniqueName(name, nameSeq):
+
+ if name not in nameSeq:
+ return name
+
+ name_orig = name
+ i = 1
+ while name in nameSeq:
+ name = '%s_%.3d' % (name_orig, i)
+ i+=1
+
+ return name
+
def writeMatrix(matrix):
file.write('\tmatrix <%.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f>\n' %\
(matrix[0][0], matrix[0][1], matrix[0][2], matrix[1][0], matrix[1][1], matrix[1][2], matrix[2][0], matrix[2][1], matrix[2][2], matrix[3][0], matrix[3][1], matrix[3][2]) )
+ def writeObjectMaterial(material):
+ if material and material.raytrace_transparency.enabled:
+ file.write('\tinterior { ior %.6f }\n' % material.raytrace_transparency.ior)
+
+ # Other interior args
+ # fade_distance 2
+ # fade_power [Value]
+ # fade_color
+
+ # dispersion
+ # dispersion_samples
+
+ materialNames = {}
+ DEF_MAT_NAME = 'Default'
+ def writeMaterial(material):
+ # Assumes only called once on each material
+
+ if material:
+ name_orig = material.name
+ else:
+ name_orig = DEF_MAT_NAME
+
+ name = materialNames[name_orig] = uniqueName(cleanName(name_orig), materialNames)
+
+ file.write('#declare %s = finish {\n' % name)
+
+ if material:
+ file.write('\tdiffuse %.3g\n' % material.diffuse_reflection)
+ file.write('\tspecular %.3g\n' % material.specular_reflection)
+
+ file.write('\tambient %.3g\n' % material.ambient)
+ #file.write('\tambient rgb <%.3g, %.3g, %.3g>\n' % tuple([c*material.ambient for c in world.ambient_color])) # povray blends the global value
+
+ # map hardness between 0.0 and 1.0
+ roughness = ((1.0 - ((material.specular_hardness-1.0)/510.0)))
+ # scale from 0.0 to 0.1
+ roughness *= 0.1
+ # add a small value because 0.0 is invalid
+ roughness += (1/511.0)
+
+ file.write('\troughness %.3g\n' % roughness)
+
+ # 'phong 70.0 '
+
+ if material.raytrace_mirror.enabled:
+ raytrace_mirror= material.raytrace_mirror
+ if raytrace_mirror.reflect:
+ file.write('\treflection {\n')
+ file.write('\t\trgb <%.3g, %.3g, %.3g>' % tuple(material.mirror_color))
+ file.write('\t\tfresnel 1 falloff %.3g exponent %.3g metallic %.3g} ' % (raytrace_mirror.fresnel, raytrace_mirror.fresnel_fac, raytrace_mirror.reflect))
+
+ else:
+ file.write('\tdiffuse 0.8\n')
+ file.write('\tspecular 0.2\n')
+
+
+
+ # This is written into the object
+ '''
+ if material.raytrace_transparency.enabled:
+ 'interior { ior %.3g} ' % material.raytrace_transparency.ior
+ '''
+
+ #file.write('\t\t\tcrand 1.0\n') # Sand granyness
+ #file.write('\t\t\tmetallic %.6f\n' % material.spec)
+ #file.write('\t\t\tphong %.6f\n' % material.spec)
+ #file.write('\t\t\tphong_size %.6f\n' % material.spec)
+ #file.write('\t\t\tbrilliance %.6f ' % (material.specular_hardness/256.0) # Like hardness
+
+ file.write('}\n')
+
def exportCamera():
camera = scene.camera
matrix = camera.matrix
@@ -79,6 +172,10 @@ def write_pov(filename, scene=None, info_callback = None):
file.write('\ttightness 0\n') # 0:10f
file.write('\tpoint_at <0, 0, -1>\n')
+ elif lamp.type == 'SUN':
+ file.write('\tparallel\n')
+ file.write('\tpoint_at <0, 0, -1>\n') # *must* be after 'parallel'
+
elif lamp.type == 'AREA':
size_x = lamp.size
@@ -109,47 +206,69 @@ def write_pov(filename, scene=None, info_callback = None):
file.write('}\n')
- def exportMeshs(sel):
- def bMat2PovString(material):
- povstring = 'finish {'
- if world != None:
- povstring += 'ambient <%.6f, %.6f, %.6f> ' % tuple([c*material.ambient for c in world.ambient_color])
+ def exportMeta(metas):
+
+ # TODO - blenders 'motherball' naming is not supported.
+
+ for ob in metas:
+ meta = ob.data
- povstring += 'diffuse %.6f ' % material.diffuse_reflection
- povstring += 'specular %.6f ' % material.specular_reflection
+ file.write('blob {\n')
+ file.write('\t\tthreshold %.4g\n' % meta.threshold)
+ try:
+ material= meta.materials[0] # lame! - blender cant do enything else.
+ except:
+ material= None
- if material.raytrace_mirror.enabled:
- #povstring += 'interior { ior %.6f } ' % material.IOR
- raytrace_mirror= material.raytrace_mirror
- if raytrace_mirror.reflect:
- povstring += 'reflection {'
- povstring += '<%.6f, %.6f, %.6f>' % tuple(material.mirror_color) # Should ask for ray mirror flag
- povstring += 'fresnel 1 falloff %.6f exponent %.6f metallic %.6f} ' % (raytrace_mirror.fresnel, raytrace_mirror.fresnel_fac, raytrace_mirror.reflect)
+ for elem in meta.elements:
+
+ if elem.type not in ('BALL', 'ELLIPSOID'):
+ continue # Not supported
+ loc = elem.location
+ stiffness= elem.stiffness
+ if elem.negative:
+ stiffness = -stiffness
+
+ if elem.type == 'BALL':
- if material.raytrace_transparency.enabled:
- #povstring += 'interior { ior %.6f } ' % material.IOR
- pass
+ file.write('\tsphere { <%.6g, %.6g, %.6g>, %.4g, %.4g ' % (loc.x, loc.y, loc.z, elem.radius, stiffness))
+
+ # After this wecould do something simple like...
+ # "pigment {Blue} }"
+ # except we'll write the color
+
+ elif elem.type == 'ELLIPSOID':
+ # location is modified by scale
+ file.write('\tsphere { <%.6g, %.6g, %.6g>, %.4g, %.4g ' % (loc.x/elem.size_x, loc.y/elem.size_y, loc.z/elem.size_z, elem.radius, stiffness))
+ file.write( 'scale <%.6g, %.6g, %.6g> ' % (elem.size_x, elem.size_y, elem.size_z))
+
+ if material:
+ diffuse_color = material.diffuse_color
+
+ if material.raytrace_transparency.enabled: trans = 1-material.raytrace_transparency.filter
+ else: trans = 0.0
+
+ file.write(
+ 'pigment {rgbft<%.3g, %.3g, %.3g, %.3g, %.3g>} finish {%s} }\n' % \
+ (diffuse_color[0], diffuse_color[1], diffuse_color[2], 1-material.alpha, trans, materialNames[material.name])
+ )
+
+ else:
+ file.write('pigment {rgb<1 1 1>} finish {%s} }\n' % DEF_MAT_NAME) # Write the finish last.
- #file.write('\t\troughness %.6f\n' % (material.hard*0.5))
- #file.write('\t\t\tcrand 0.0\n') # Sand granyness
- #file.write('\t\t\tmetallic %.6f\n' % material.spec)
- #file.write('\t\t\tphong %.6f\n' % material.spec)
- #file.write('\t\t\tphong_size %.6f\n' % material.spec)
- povstring += 'brilliance %.6f ' % (material.specular_hardness/256.0) # Like hardness
- povstring += '}'
- #file.write('\t}\n')
- return povstring
+ writeObjectMaterial(material)
+
+ writeMatrix(ob.matrix)
+ file.write('}\n')
- world = scene.world
-
- # Convert all materials to strings we can access directly per vertex.
- for material in bpy.data.materials:
- materialTable[material.name] = bMat2PovString(material)
+
+
+ def exportMeshs(sel):
ob_num = 0
@@ -304,13 +423,19 @@ def write_pov(filename, scene=None, info_callback = None):
if me_materials:
material = me_materials[col[3]]
- materialString = materialTable[material.name]
+ material_finish = materialNames[material.name]
+
+ if material.raytrace_transparency.enabled: trans = 1-material.raytrace_transparency.filter
+ else: trans = 0.0
+
else:
- materialString = '' # Dont write anything
+ material_finish = DEF_MAT_NAME # not working properly,
+ trans = 0.0
- float_col = col[0], col[1], col[2], 1-material.alpha, materialString
#print material.apl
- file.write(',\n\t\ttexture { pigment {rgbf<%.3g, %.3g, %.3g, %.3g>}%s}' % float_col)
+ file.write( ',\n\t\ttexture { pigment {rgbft<%.3g, %.3g, %.3g, %.3g, %.3g>} finish {%s}}' %
+ (col[0], col[1], col[2], 1-material.alpha, trans, material_finish) )
+
index[0] = idx
idx+=1
@@ -404,8 +529,7 @@ def write_pov(filename, scene=None, info_callback = None):
if me.materials:
material = me.materials[0] # dodgy
- if material and material.raytrace_transparency.enabled:
- file.write('\tinterior { ior %.6f }\n' % material.raytrace_transparency.ior)
+ writeObjectMaterial(material)
writeMatrix(matrix)
file.write('}\n')
@@ -442,22 +566,30 @@ def write_pov(filename, scene=None, info_callback = None):
file.write("\t\terror_bound %.4g\n" % scene.pov_radio_error_bound)
file.write("\t\tgray_threshold %.4g\n" % scene.pov_radio_gray_threshold)
file.write("\t\tlow_error_factor %.4g\n" % scene.pov_radio_low_error_factor)
+ file.write("\t\tmedia %d\n" % scene.pov_radio_media)
file.write("\t\tminimum_reuse %.4g\n" % scene.pov_radio_minimum_reuse)
file.write("\t\tnearest_count %d\n" % scene.pov_radio_nearest_count)
file.write("\t\tnormal %d\n" % scene.pov_radio_normal)
file.write("\t\trecursion_limit %d\n" % scene.pov_radio_recursion_limit)
file.write('\t}\n')
- file.write('}\n')
-
-
+ if world:
+ file.write("\tambient_light rgb<%.3g, %.3g, %.3g>\n" % tuple(world.ambient_color))
+ file.write('}\n')
+
+
+ # Convert all materials to strings we can access directly per vertex.
+ writeMaterial(None) # default material
+
+ for material in bpy.data.materials:
+ writeMaterial(material)
exportCamera()
#exportMaterials()
sel = scene.objects
- lamps = [l for l in sel if l.type == 'LAMP']
- exportLamps(lamps)
+ exportLamps([l for l in sel if l.type == 'LAMP'])
+ exportMeta([l for l in sel if l.type == 'META'])
exportMeshs(sel)
exportWorld(scene.world)
exportGlobalSettings(scene)
@@ -533,8 +665,6 @@ class PovrayRender(bpy.types.RenderEngine):
write_pov_ini(self.temp_file_ini, self.temp_file_in, self.temp_file_out)
print ("***-STARTING-***")
- # This works too but means we have to wait until its done
- # os.system('povray %s' % self.temp_file_ini)
pov_binary = "povray"
@@ -544,7 +674,11 @@ class PovrayRender(bpy.types.RenderEngine):
else:
pov_binary = "pvengine"
- self.process = subprocess.Popen([pov_binary, self.temp_file_ini]) # stdout=subprocess.PIPE, stderr=subprocess.PIPE
+ if 1:
+ self.process = subprocess.Popen([pov_binary, self.temp_file_ini]) # stdout=subprocess.PIPE, stderr=subprocess.PIPE
+ else:
+ # This works too but means we have to wait until its done
+ os.system('%s %s' % (pov_binary, self.temp_file_ini))
print ("***-DONE-***")
@@ -699,6 +833,7 @@ class SCENE_PT_povray_radiosity(RenderButtonsPanel):
col.itemR(scene, "pov_radio_gray_threshold")
col.itemR(scene, "pov_radio_low_error_factor")
col.itemR(scene, "pov_radio_minimum_reuse")
+ col.itemR(scene, "pov_radio_media")
col.itemR(scene, "pov_radio_nearest_count")
col.itemR(scene, "pov_radio_normal")
col.itemR(scene, "pov_radio_always_sample")
@@ -759,6 +894,11 @@ FloatProperty( attr="pov_radio_low_error_factor",
# max_sample - not available yet
+BoolProperty( attr="pov_radio_media",
+ name="Use Media",
+ description="Radiosity estimation can be affected by media.",
+ default= False)
+
FloatProperty( attr="pov_radio_minimum_reuse",
name="Minimum Reuse",
description="Fraction of the screen width which sets the minimum radius of reuse for each sample point (At values higher than 2% expect errors).",
diff --git a/release/scripts/export_map.py b/release/scripts/export_map.py
index ab32f6d5ff5..aca02288c7a 100644
--- a/release/scripts/export_map.py
+++ b/release/scripts/export_map.py
@@ -249,6 +249,10 @@ def write_node_map(file, ob):
file.write('{\n')
for name_value in props:
file.write('"%s" "%s"\n' % name_value)
+ if PREF_GRID_SNAP.val:
+ file.write('"origin" "%d %d %d"\n' % tuple([round(axis*PREF_SCALE.val) for axis in ob.getLocation('worldspace')]) )
+ else:
+ file.write('"origin" "%.6f %.6f %.6f"\n' % tuple([axis*PREF_SCALE.val for axis in ob.getLocation('worldspace')]) )
file.write('}\n')
return True
@@ -447,4 +451,4 @@ def main():
Window.FileSelector(export_map, 'EXPORT MAP', '*.map')
if __name__ == '__main__': main()
-# export_map('/foo.map') \ No newline at end of file
+# export_map('/foo.map')
diff --git a/release/scripts/md2_export.py b/release/scripts/md2_export.py
index cf5752597da..f0fe6b9af40 100644
--- a/release/scripts/md2_export.py
+++ b/release/scripts/md2_export.py
@@ -923,7 +923,8 @@ def fill_md2(md2, object):
maxdot = dot;
maxdotindex = j;
- md2.frames[frame_counter].vertices[vert_counter].lightnormalindex=maxdotindex+2
+ # See patch [#19206], gives good info on this line below.
+ md2.frames[frame_counter].vertices[vert_counter].lightnormalindex=maxdotindex
del maxdot, maxdotindex
del new_x, new_y, new_z
diff --git a/release/ui/buttons_data_camera.py b/release/ui/buttons_data_camera.py
index 811858e3627..51d8c8c61e6 100644
--- a/release/ui/buttons_data_camera.py
+++ b/release/ui/buttons_data_camera.py
@@ -7,7 +7,7 @@ class DataButtonsPanel(bpy.types.Panel):
__context__ = "data"
def poll(self, context):
- return (context.camera)
+ return (context.camera != None)
class DATA_PT_context_camera(DataButtonsPanel):
__show_header__ = False
diff --git a/release/ui/buttons_data_mesh.py b/release/ui/buttons_data_mesh.py
index e8ab59a96dd..3930d1029da 100644
--- a/release/ui/buttons_data_mesh.py
+++ b/release/ui/buttons_data_mesh.py
@@ -44,9 +44,39 @@ class DATA_PT_normals(DataButtonsPanel):
sub.active = mesh.autosmooth
sub.itemR(mesh, "autosmooth_angle", text="Angle")
- sub = split.column()
- sub.itemR(mesh, "vertex_normal_flip")
- sub.itemR(mesh, "double_sided")
+ col = split.column()
+ col.itemR(mesh, "vertex_normal_flip")
+ col.itemR(mesh, "double_sided")
+
+class DATA_PT_meshdraw(DataButtonsPanel):
+ __label__ = "Draw"
+
+ def draw(self, context):
+ layout = self.layout
+
+ mesh = context.mesh
+
+ layout.itemL(text="Edit Mode only, WIP")
+
+ split = layout.split()
+
+ col = split.column()
+ col.itemR(mesh, "draw_edges", text="Edges")
+ col.itemR(mesh, "draw_faces", text="Faces")
+ col.itemR(mesh, "draw_creases", text="Creases")
+ col.itemR(mesh, "draw_bevel_weights", text="Bevel Weights")
+ col.itemR(mesh, "draw_seams", text="Seams")
+ col.itemR(mesh, "draw_sharp", text="Sharp")
+
+ col = split.column()
+ col.itemR(mesh, "draw_normals", text="Face Normals")
+ col.itemR(mesh, "draw_vertex_normals", text="Vertex Normals")
+
+ col.itemS()
+
+ col.itemR(mesh, "draw_edge_lenght")
+ col.itemR(mesh, "draw_edge_angle")
+ col.itemR(mesh, "draw_face_area")
class DATA_PT_vertex_groups(DataButtonsPanel):
__label__ = "Vertex Groups"
@@ -194,6 +224,7 @@ class DATA_PT_vertex_colors(DataButtonsPanel):
bpy.types.register(DATA_PT_context_mesh)
bpy.types.register(DATA_PT_normals)
+bpy.types.register(DATA_PT_meshdraw)
bpy.types.register(DATA_PT_vertex_groups)
bpy.types.register(DATA_PT_shape_keys)
bpy.types.register(DATA_PT_uv_texture)
diff --git a/release/ui/buttons_data_metaball.py b/release/ui/buttons_data_metaball.py
index 74731473683..a3781705799 100644
--- a/release/ui/buttons_data_metaball.py
+++ b/release/ui/buttons_data_metaball.py
@@ -54,12 +54,12 @@ class DATA_PT_metaball_element(DataButtonsPanel):
__label__ = "Active Element"
def poll(self, context):
- return (context.meta_ball and context.meta_ball.last_selected_element)
+ return (context.meta_ball and context.meta_ball.active_element)
def draw(self, context):
layout = self.layout
- metaelem = context.meta_ball.last_selected_element
+ metaelem = context.meta_ball.active_element
split = layout.split(percentage=0.3)
split.itemL(text="Type:")
@@ -81,32 +81,32 @@ class DATA_PT_metaball_element(DataButtonsPanel):
col = split.column(align=True)
col.itemL(text="Size:")
- col.itemR(metaelem, "sizex", text="X")
- col.itemR(metaelem, "sizey", text="Y")
- col.itemR(metaelem, "sizez", text="Z")
+ col.itemR(metaelem, "size_x", text="X")
+ col.itemR(metaelem, "size_y", text="Y")
+ col.itemR(metaelem, "size_z", text="Z")
elif metaelem.type == 'TUBE':
col = split.column(align=True)
col.itemL(text="Size:")
- col.itemR(metaelem, "sizex", text="X")
+ col.itemR(metaelem, "size_x", text="X")
elif metaelem.type == 'PLANE':
col = split.column(align=True)
col.itemL(text="Size:")
- col.itemR(metaelem, "sizex", text="X")
- col.itemR(metaelem, "sizey", text="Y")
+ col.itemR(metaelem, "size_x", text="X")
+ col.itemR(metaelem, "size_y", text="Y")
elif metaelem.type == 'ELLIPSOID':
col = split.column(align=True)
col.itemL(text="Size:")
- col.itemR(metaelem, "sizex", text="X")
- col.itemR(metaelem, "sizey", text="Y")
- col.itemR(metaelem, "sizez", text="Z")
+ col.itemR(metaelem, "size_x", text="X")
+ col.itemR(metaelem, "size_y", text="Y")
+ col.itemR(metaelem, "size_z", text="Z")
bpy.types.register(DATA_PT_context_metaball)
bpy.types.register(DATA_PT_metaball)
-bpy.types.register(DATA_PT_metaball_element) \ No newline at end of file
+bpy.types.register(DATA_PT_metaball_element)
diff --git a/release/ui/buttons_data_modifier.py b/release/ui/buttons_data_modifier.py
index bd39ff1e70e..2b13034af9f 100644
--- a/release/ui/buttons_data_modifier.py
+++ b/release/ui/buttons_data_modifier.py
@@ -16,76 +16,18 @@ class DATA_PT_modifiers(DataButtonsPanel):
row = layout.row()
row.item_menu_enumO("object.modifier_add", "type")
- row.itemL();
+ row.itemL()
for md in ob.modifiers:
box = layout.template_modifier(md)
-
if box:
- if md.type == 'ARMATURE':
- self.armature(box, ob, md)
- elif md.type == 'ARRAY':
- self.array(box, ob, md)
- elif md.type == 'BEVEL':
- self.bevel(box, ob, md)
- elif md.type == 'BOOLEAN':
- self.boolean(box, ob, md)
- elif md.type == 'BUILD':
- self.build(box, ob, md)
- elif md.type == 'CAST':
- self.cast(box, ob, md)
- elif md.type == 'CLOTH':
- self.cloth(box, ob, md)
- elif md.type == 'COLLISION':
- self.collision(box, ob, md)
- elif md.type == 'CURVE':
- self.curve(box, ob, md)
- elif md.type == 'DECIMATE':
- self.decimate(box, ob, md)
- elif md.type == 'DISPLACE':
- self.displace(box, ob, md)
- elif md.type == 'EDGE_SPLIT':
- self.edgesplit(box, ob, md)
- elif md.type == 'EXPLODE':
- self.explode(box, ob, md)
- elif md.type == 'FLUID_SIMULATION':
- self.fluid(box, ob, md)
- elif md.type == 'HOOK':
- self.hook(box, ob, md)
- elif md.type == 'LATTICE':
- self.lattice(box, ob, md)
- elif md.type == 'MASK':
- self.mask(box, ob, md)
- elif md.type == 'MESH_DEFORM':
- self.mesh_deform(box, ob, md)
- elif md.type == 'MIRROR':
- self.mirror(box, ob, md)
- elif md.type == 'MULTIRES':
- self.multires(box, ob, md)
- elif md.type == 'PARTICLE_INSTANCE':
- self.particleinstance(box, ob, md)
- elif md.type == 'PARTICLE_SYSTEM':
- self.particlesystem(box, ob, md)
- elif md.type == 'SHRINKWRAP':
- self.shrinkwrap(box, ob, md)
- elif md.type == 'SIMPLE_DEFORM':
- self.simpledeform(box, ob, md)
- elif md.type == 'SMOKE':
- self.smoke(box, ob, md)
- elif md.type == 'SMOOTH':
- self.smooth(box, ob, md)
- elif md.type == 'SOFTBODY':
- self.softbody(box, ob, md)
- elif md.type == 'SUBSURF':
- self.subsurf(box, ob, md)
- elif md.type == 'SURFACE':
- self.surface(box, ob, md)
- elif md.type == 'UV_PROJECT':
- self.uvproject(box, ob, md)
- elif md.type == 'WAVE':
- self.wave(box, ob, md)
-
- def armature(self, layout, ob, md):
+ # match enum type to our functions, avoids a lookup table.
+ getattr(self, md.type)(box, ob, md)
+
+ # the mt.type enum is (ab)used for a lookup on function names
+ # ...to avoid lengthy if statements
+ # so each type must have a function here.
+ def ARMATURE(self, layout, ob, md):
layout.itemR(md, "object")
row = layout.row()
@@ -98,7 +40,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
flow.itemR(md, "quaternion")
flow.itemR(md, "multi_modifier")
- def array(self, layout, ob, md):
+ def ARRAY(self, layout, ob, md):
layout.itemR(md, "fit_type")
if md.fit_type == 'FIXED_COUNT':
layout.itemR(md, "count")
@@ -144,7 +86,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col.itemR(md, "start_cap")
col.itemR(md, "end_cap")
- def bevel(self, layout, ob, md):
+ def BEVEL(self, layout, ob, md):
row = layout.row()
row.itemR(md, "width")
row.itemR(md, "only_vertices")
@@ -156,11 +98,11 @@ class DATA_PT_modifiers(DataButtonsPanel):
elif md.limit_method == 'WEIGHT':
layout.row().itemR(md, "edge_weight_method", expand=True)
- def boolean(self, layout, ob, md):
+ def BOOLEAN(self, layout, ob, md):
layout.itemR(md, "operation")
layout.itemR(md, "object")
- def build(self, layout, ob, md):
+ def BUILD(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -173,7 +115,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
sub.active = md.randomize
sub.itemR(md, "seed")
- def cast(self, layout, ob, md):
+ def CAST(self, layout, ob, md):
layout.itemR(md, "cast_type")
layout.itemR(md, "object")
if md.object:
@@ -191,22 +133,22 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
- def cloth(self, layout, ob, md):
+ def CLOTH(self, layout, ob, md):
layout.itemL(text="See Cloth panel.")
- def collision(self, layout, ob, md):
+ def COLLISION(self, layout, ob, md):
layout.itemL(text="See Collision panel.")
- def curve(self, layout, ob, md):
+ def CURVE(self, layout, ob, md):
layout.itemR(md, "object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "deform_axis")
- def decimate(self, layout, ob, md):
+ def DECIMATE(self, layout, ob, md):
layout.itemR(md, "ratio")
layout.itemR(md, "face_count")
- def displace(self, layout, ob, md):
+ def DISPLACE(self, layout, ob, md):
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "texture")
layout.itemR(md, "midlevel")
@@ -218,7 +160,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
elif md.texture_coordinates == 'UV' and ob.type == 'MESH':
layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
- def edgesplit(self, layout, ob, md):
+ def EDGE_SPLIT(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -230,7 +172,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
col = split.column()
col.itemR(md, "use_sharp", text="Sharp Edges")
- def explode(self, layout, ob, md):
+ def EXPLODE(self, layout, ob, md):
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "protect")
layout.itemR(md, "split_edges")
@@ -239,21 +181,21 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.itemR(md, "dead")
# Missing: "Refresh" and "Clear Vertex Group" Operator
- def fluid(self, layout, ob, md):
+ def FLUID_SIMULATION(self, layout, ob, md):
layout.itemL(text="See Fluid panel.")
- def hook(self, layout, ob, md):
+ def HOOK(self, layout, ob, md):
layout.itemR(md, "falloff")
layout.itemR(md, "force", slider=True)
layout.itemR(md, "object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
# Missing: "Reset" and "Recenter" Operator
- def lattice(self, layout, ob, md):
+ def LATTICE(self, layout, ob, md):
layout.itemR(md, "object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
- def mask(self, layout, ob, md):
+ def MASK(self, layout, ob, md):
layout.itemR(md, "mode")
if md.mode == 'ARMATURE':
layout.itemR(md, "armature")
@@ -261,7 +203,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "inverse")
- def mesh_deform(self, layout, ob, md):
+ def MESH_DEFORM(self, layout, ob, md):
layout.itemR(md, "object")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "invert")
@@ -273,7 +215,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
row.itemR(md, "precision")
row.itemR(md, "dynamic")
- def mirror(self, layout, ob, md):
+ def MIRROR(self, layout, ob, md):
layout.itemR(md, "merge_limit")
split = layout.split()
@@ -293,12 +235,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.itemR(md, "mirror_object")
- def multires(self, layout, ob, md):
+ def MULTIRES(self, layout, ob, md):
layout.itemR(md, "subdivision_type")
layout.itemO("object.multires_subdivide", text="Subdivide")
layout.itemR(md, "level")
- def particleinstance(self, layout, ob, md):
+ def PARTICLE_INSTANCE(self, layout, ob, md):
layout.itemR(md, "object")
layout.itemR(md, "particle_system_number")
@@ -321,10 +263,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
row.itemR(md, "position", slider=True)
row.itemR(md, "random_position", text = "Random", slider=True)
- def particlesystem(self, layout, ob, md):
+ def PARTICLE_SYSTEM(self, layout, ob, md):
layout.itemL(text="See Particle panel.")
- def shrinkwrap(self, layout, ob, md):
+ def SHRINKWRAP(self, layout, ob, md):
layout.itemR(md, "target")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "offset")
@@ -347,7 +289,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
elif md.mode == 'NEAREST_SURFACEPOINT':
layout.itemR(md, "keep_above_surface")
- def simpledeform(self, layout, ob, md):
+ def SIMPLE_DEFORM(self, layout, ob, md):
layout.itemR(md, "mode")
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
layout.itemR(md, "origin")
@@ -358,32 +300,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.itemR(md, "lock_x_axis")
layout.itemR(md, "lock_y_axis")
- def smoke(self, layout, ob, md):
- layout.itemR(md, "smoke_type")
-
- if md.smoke_type == 'TYPE_DOMAIN':
- layout.itemS()
- layout.itemR(md.domain_settings, "maxres")
- layout.itemR(md.domain_settings, "color")
- layout.itemR(md.domain_settings, "amplify")
- layout.itemR(md.domain_settings, "highres")
- layout.itemR(md.domain_settings, "noise_type")
- layout.itemR(md.domain_settings, "visibility")
- layout.itemR(md.domain_settings, "alpha")
- layout.itemR(md.domain_settings, "beta")
- layout.itemR(md.domain_settings, "fluid_group")
- layout.itemR(md.domain_settings, "eff_group")
- layout.itemR(md.domain_settings, "coll_group")
- elif md.smoke_type == 'TYPE_FLOW':
- layout.itemS()
- layout.itemR(md.flow_settings, "outflow")
- layout.itemR(md.flow_settings, "density")
- layout.itemR(md.flow_settings, "temperature")
- layout.item_pointerR(md.flow_settings, "psys", ob, "particle_systems")
- elif md.smoke_type == 'TYPE_COLL':
- layout.itemS()
+ def SMOKE(self, layout, ob, md):
+ layout.itemL(text="See Smoke panel.")
- def smooth(self, layout, ob, md):
+ def SMOOTH(self, layout, ob, md):
split = layout.split()
col = split.column()
@@ -397,10 +317,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.item_pointerR(md, "vertex_group", ob, "vertex_groups")
- def softbody(self, layout, ob, md):
+ def SOFT_BODY(self, layout, ob, md):
layout.itemL(text="See Soft Body panel.")
- def subsurf(self, layout, ob, md):
+ def SUBSURF(self, layout, ob, md):
layout.itemR(md, "subdivision_type")
flow = layout.column_flow()
@@ -409,10 +329,10 @@ class DATA_PT_modifiers(DataButtonsPanel):
flow.itemR(md, "optimal_draw", text="Optimal Display")
flow.itemR(md, "subsurf_uv")
- def surface(self, layout, ob, md):
+ def SURFACE(self, layout, ob, md):
layout.itemL(text="See Fields panel.")
- def uvproject(self, layout, ob, md):
+ def UV_PROJECT(self, layout, ob, md):
if ob.type == 'MESH':
layout.item_pointerR(md, "uv_layer", ob.data, "uv_layers")
#layout.itemR(md, "projectors")
@@ -422,7 +342,7 @@ class DATA_PT_modifiers(DataButtonsPanel):
layout.itemR(md, "override_image")
#"Projectors" don't work.
- def wave(self, layout, ob, md):
+ def WAVE(self, layout, ob, md):
split = layout.split()
col = split.column()
diff --git a/release/ui/buttons_game.py b/release/ui/buttons_game.py
index 9635ecfa67c..ee6260202e8 100644
--- a/release/ui/buttons_game.py
+++ b/release/ui/buttons_game.py
@@ -176,21 +176,38 @@ class SCENE_PT_game_stereo(SceneButtonsPanel):
# stereo:
if stereo_mode == 'STEREO':
layout.itemR(gs, "stereo_mode")
+ layout.itemL(text="To do: Focal Length")
+ layout.itemL(text="To do: Eye Separation")
# dome:
- if stereo_mode == 'DOME':
+ elif stereo_mode == 'DOME':
layout.itemR(gs, "dome_mode", text="Dome Type")
+ dome_type = gs.dome_mode
+
split=layout.split()
-
- col=split.column()
- col.itemR(gs, "dome_angle", slider=True)
- col.itemR(gs, "dome_tesselation", text="Tesselation")
-
- col=split.column()
- col.itemR(gs, "dome_tilt")
- col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
-
+
+ if dome_type == 'FISHEYE' or \
+ dome_type == 'TRUNCATED_REAR' or \
+ dome_type == 'TRUNCATED_FRONT':
+
+ col=split.column()
+ col.itemR(gs, "dome_angle", slider=True)
+ col.itemR(gs, "dome_tilt")
+
+ col=split.column()
+ col.itemR(gs, "dome_tesselation", text="Tesselation")
+ col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
+
+ elif dome_type == 'PANORAM_SPH':
+ col=split.column()
+ col.itemR(gs, "dome_tesselation", text="Tesselation")
+ col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
+
+ else: # cube map
+ col=split.column()
+ col.itemR(gs, "dome_buffer_resolution", text="Resolution", slider=True)
+
layout.itemR(gs, "dome_text")
bpy.types.register(SCENE_PT_game)
@@ -246,30 +263,6 @@ class WORLD_PT_game_world(WorldButtonsPanel):
row.itemR(world.mist, "start")
row.itemR(world.mist, "depth")
-
-"""
-class WORLD_PT_game(WorldButtonsPanel):
- __space_type__ = "LOGIC_EDITOR"
- __region_type__ = "UI"
- __label__ = "Game Settings"
-
- def draw(self, context):
- layout = self.layout
- world = context.world
-
- flow = layout.column_flow()
- flow.itemR(world, "physics_engine")
- flow.itemR(world, "physics_gravity")
-
- flow.itemR(world, "game_fps")
- flow.itemR(world, "game_logic_step_max")
- flow.itemR(world, "game_physics_substep")
- flow.itemR(world, "game_physics_step_max")
-
- flow.itemR(world, "game_use_occlusion_culling", text="Enable Occlusion Culling")
- flow.itemR(world, "game_occlusion_culling_resolution")
-"""
-
class WORLD_PT_game_physics(WorldButtonsPanel):
__label__ = "Physics"
@@ -279,7 +272,7 @@ class WORLD_PT_game_physics(WorldButtonsPanel):
gs = context.scene.game_data
layout.itemR(gs, "physics_engine")
- if gs.physics_engine != "NONE":
+ if gs.physics_engine != 'NONE':
layout.itemR(gs, "physics_gravity", text="Gravity")
split = layout.split()
diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py
index b570deebfe2..bbb575a14e2 100644
--- a/release/ui/buttons_material.py
+++ b/release/ui/buttons_material.py
@@ -127,7 +127,7 @@ class MATERIAL_PT_strand(MaterialButtonsPanel):
col.itemR(tan, "min_size", text="Minimum")
col.itemR(tan, "blender_units")
sub = col.column()
- sub.active = mat.shadeless == False
+ sub.active = (not mat.shadeless)
sub.itemR(tan, "tangent_shading")
col = split.column()
@@ -135,12 +135,34 @@ class MATERIAL_PT_strand(MaterialButtonsPanel):
col.itemR(tan, "width_fade")
col.itemR(tan, "uv_layer")
sub = col.column()
- sub.active = mat.shadeless == False
+ sub.active = (not mat.shadeless)
sub.itemR(tan, "surface_diffuse")
sub = col.column()
sub.active = tan.surface_diffuse
sub.itemR(tan, "blend_distance", text="Distance")
+class MATERIAL_PT_physics(MaterialButtonsPanel):
+ __label__ = "Physics"
+ COMPAT_ENGINES = set(['BLENDER_GAME'])
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = context.material
+ phys = mat.physics
+
+ split = layout.split()
+
+ col = split.column()
+ col.itemR(phys, "distance")
+ col.itemR(phys, "friction")
+ col.itemR(phys, "align_to_normal")
+
+ col = split.column()
+ col.itemR(phys, "force", slider=True)
+ col.itemR(phys, "elasticity", slider=True)
+ col.itemR(phys, "damp", slider=True)
+
class MATERIAL_PT_options(MaterialButtonsPanel):
__label__ = "Options"
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
@@ -197,7 +219,7 @@ class MATERIAL_PT_shadows(MaterialButtonsPanel):
col.itemR(mat, "ray_shadow_bias", text="Auto Ray Bias")
sub = col.column()
subsub = sub.column()
- subsub.active = not mat.ray_shadow_bias
+ subsub.active = (not mat.ray_shadow_bias)
subsub.itemR(mat, "shadow_ray_bias", text="Ray Shadow Bias")
sub.itemR(mat, "cast_buffer_shadows")
sub.itemR(mat, "shadow_buffer_bias", text="Buffer Bias")
@@ -207,7 +229,8 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
- return (context.material.type != 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ mat = context.material
+ return mat and (mat.type != 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -219,16 +242,16 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel):
col = split.column()
col.itemR(mat, "diffuse_color", text="")
sub = col.column()
- sub.active = mat.shadeless== False
+ sub.active = (not mat.shadeless)
sub.itemR(mat, "diffuse_reflection", text="Intensity", slider=True)
col = split.column()
- col.active = mat.shadeless== False
+ col.active = (not mat.shadeless)
col.itemR(mat, "diffuse_shader", text="")
col.itemR(mat, "use_diffuse_ramp", text="Ramp")
col = layout.column()
- col.active = mat.shadeless== False
+ col.active = (not mat.shadeless)
if mat.diffuse_shader == 'OREN_NAYAR':
col.itemR(mat, "roughness")
elif mat.diffuse_shader == 'MINNAERT':
@@ -260,14 +283,15 @@ class MATERIAL_PT_specular(MaterialButtonsPanel):
COMPAT_ENGINES = set(['BLENDER_RENDER', 'BLENDER_GAME'])
def poll(self, context):
- return (context.material.type != 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ mat = context.material
+ return mat and (mat.type != 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
mat = context.material
- layout.active = mat.shadeless == False
+ layout.active = (not mat.shadeless)
split = layout.split()
@@ -311,7 +335,8 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
- return (context.material.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ mat = context.material
+ return mat and (mat.type in ('SURFACE', 'WIRE')) and (context.scene.render_data.engine in self.COMPAT_ENGINES)
def draw_header(self, context):
layout = self.layout
@@ -328,7 +353,7 @@ class MATERIAL_PT_sss(MaterialButtonsPanel):
layout.active = sss.enabled
split = layout.split()
- split.active = mat.shadeless== False
+ split.active = (not mat.shadeless)
col = split.column(align=True)
col.itemR(sss, "color", text="")
@@ -352,7 +377,8 @@ class MATERIAL_PT_raymir(MaterialButtonsPanel):
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
- return (context.material.type in 'SURFACE', 'WIRE') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ mat = context.material
+ return mat and (mat.type in 'SURFACE', 'WIRE') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
def draw_header(self, context):
layout = self.layout
@@ -403,7 +429,8 @@ class MATERIAL_PT_raytransp(MaterialButtonsPanel):
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
- return (context.material.type in 'SURFACE', 'WIRE') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ mat = context.material
+ return mat and (mat.type in 'SURFACE', 'WIRE') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
def draw_header(self, context):
layout = self.layout
@@ -418,7 +445,7 @@ class MATERIAL_PT_raytransp(MaterialButtonsPanel):
mat = context.material
rayt = context.material.raytrace_transparency
- layout.active = rayt.enabled and mat.shadeless == False
+ layout.active = rayt.enabled and (not mat.shadeless)
split = layout.split()
@@ -454,7 +481,8 @@ class MATERIAL_PT_halo(MaterialButtonsPanel):
COMPAT_ENGINES = set(['BLENDER_RENDER'])
def poll(self, context):
- return (context.material.type == 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
+ mat = context.material
+ return mat and (mat.type == 'HALO') and (context.scene.render_data.engine in self.COMPAT_ENGINES)
def draw(self, context):
layout = self.layout
@@ -509,6 +537,7 @@ bpy.types.register(MATERIAL_PT_raymir)
bpy.types.register(MATERIAL_PT_raytransp)
bpy.types.register(MATERIAL_PT_sss)
bpy.types.register(MATERIAL_PT_halo)
+bpy.types.register(MATERIAL_PT_physics)
bpy.types.register(MATERIAL_PT_strand)
bpy.types.register(MATERIAL_PT_options)
bpy.types.register(MATERIAL_PT_shadows)
diff --git a/release/ui/buttons_object_constraint.py b/release/ui/buttons_object_constraint.py
index 3804ef5d409..5606c6c258a 100644
--- a/release/ui/buttons_object_constraint.py
+++ b/release/ui/buttons_object_constraint.py
@@ -12,50 +12,12 @@ class ConstraintButtonsPanel(bpy.types.Panel):
box = layout.template_constraint(con)
if box:
- if con.type == "CHILD_OF":
- self.child_of(box, con)
- elif con.type == "TRACK_TO":
- self.track_to(box, con)
- elif con.type == "IK":
- self.ik(box, con)
- elif con.type == "FOLLOW_PATH":
- self.follow_path(box, con)
- elif con.type == "LIMIT_ROTATION":
- self.limit_rotation(box, con)
- elif con.type == "LIMIT_LOCATION":
- self.limit_location(box, con)
- elif con.type == "LIMIT_SCALE":
- self.limit_scale(box, con)
- elif con.type == "COPY_ROTATION":
- self.copy_rotation(box, con)
- elif con.type == "COPY_LOCATION":
- self.copy_location(box, con)
- elif con.type == "COPY_SCALE":
- self.copy_scale(box, con)
- #elif con.type == "SCRIPT":
- # self.script(box, con)
- elif con.type == "ACTION":
- self.action(box, con)
- elif con.type == "LOCKED_TRACK":
- self.locked_track(box, con)
- elif con.type == "LIMIT_DISTANCE":
- self.limit_distance(box, con)
- elif con.type == "STRETCH_TO":
- self.stretch_to(box, con)
- elif con.type == "FLOOR":
- self.floor(box, con)
- elif con.type == "RIGID_BODY_JOINT":
- self.rigid_body(box, con)
- elif con.type == "CLAMP_TO":
- self.clamp_to(box, con)
- elif con.type == "TRANSFORM":
- self.transform(box, con)
- elif con.type == "SHRINKWRAP":
- self.shrinkwrap(box, con)
-
+ # match enum type to our functions, avoids a lookup table.
+ getattr(self, con.type)(box, con)
+
# show/key buttons here are most likely obsolete now, with
# keyframing functionality being part of every button
- if con.type not in ("RIGID_BODY_JOINT", "NULL"):
+ if con.type not in ('RIGID_BODY_JOINT', 'NULL'):
box.itemR(con, "influence")
def space_template(self, layout, con, target=True, owner=True):
@@ -68,7 +30,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemR(con, "target_space", text="")
if target and owner:
- row.itemL(icon="ICON_ARROW_LEFTRIGHT")
+ row.itemL(icon='ICON_ARROW_LEFTRIGHT')
if owner:
row.itemR(con, "owner_space", text="")
@@ -84,10 +46,10 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row = layout.row()
row.itemL(text="Head/Tail:")
row.itemR(con, "head_tail", text="")
- elif con.target.type in ("MESH", "LATTICE"):
+ elif con.target.type in ('MESH', 'LATTICE'):
layout.item_pointerR(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
- def child_of(self, layout, con):
+ def CHILD_OF(self, layout, con):
self.target_template(layout, con)
split = layout.split()
@@ -114,7 +76,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemO("constraint.childof_set_inverse")
row.itemO("constraint.childof_clear_inverse")
- def track_to(self, layout, con):
+ def TRACK_TO(self, layout, con):
self.target_template(layout, con)
row = layout.row()
@@ -128,11 +90,11 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con)
- def ik(self, layout, con):
+ def IK(self, layout, con):
self.target_template(layout, con)
layout.itemR(con, "pole_target")
- if con.pole_target and con.pole_target.type == "ARMATURE":
+ if con.pole_target and con.pole_target.type == 'ARMATURE':
layout.item_pointerR(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
flow = layout.column_flow()
@@ -148,7 +110,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
flow.itemR(con, "targetless")
flow.itemR(con, "stretch")
- def follow_path(self, layout, con):
+ def FOLLOW_PATH(self, layout, con):
self.target_template(layout, con)
row = layout.row()
@@ -163,7 +125,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemR(con, "up", text="Up")
row.itemL()
- def limit_rotation(self, layout, con):
+ def LIMIT_ROTATION(self, layout, con):
split = layout.split()
@@ -196,7 +158,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
- def limit_location(self, layout, con):
+ def LIMIT_LOCATION(self, layout, con):
split = layout.split()
col = split.column()
@@ -237,7 +199,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
- def limit_scale(self, layout, con):
+ def LIMIT_SCALE(self, layout, con):
split = layout.split()
col = split.column()
@@ -278,7 +240,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
- def copy_rotation(self, layout, con):
+ def COPY_ROTATION(self, layout, con):
self.target_template(layout, con)
split = layout.split()
@@ -305,7 +267,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con)
- def copy_location(self, layout, con):
+ def COPY_LOCATION(self, layout, con):
self.target_template(layout, con)
split = layout.split()
@@ -332,7 +294,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con)
- def copy_scale(self, layout, con):
+ def COPY_SCALE(self, layout, con):
self.target_template(layout, con)
row = layout.row(align=True)
@@ -344,9 +306,9 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con)
- #def script(self, layout, con):
+ #def SCRIPT(self, layout, con):
- def action(self, layout, con):
+ def ACTION(self, layout, con):
self.target_template(layout, con)
layout.itemR(con, "action")
@@ -366,7 +328,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Convert:")
row.itemR(con, "owner_space", text="")
- def locked_track(self, layout, con):
+ def LOCKED_TRACK(self, layout, con):
self.target_template(layout, con)
row = layout.row()
@@ -377,7 +339,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Lock:")
row.itemR(con, "locked", expand=True)
- def limit_distance(self, layout, con):
+ def LIMIT_DISTANCE(self, layout, con):
self.target_template(layout, con)
col = layout.column(align=True);
@@ -388,7 +350,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Clamp Region:")
row.itemR(con, "limit_mode", text="")
- def stretch_to(self, layout, con):
+ def STRETCH_TO(self, layout, con):
self.target_template(layout, con)
col = layout.column(align=True)
@@ -404,7 +366,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Plane:")
row.itemR(con, "keep_axis", expand=True)
- def floor(self, layout, con):
+ def FLOOR(self, layout, con):
self.target_template(layout, con)
row = layout.row()
@@ -417,7 +379,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row.itemL(text="Min/Max:")
row.itemR(con, "floor_location", expand=True)
- def rigid_body(self, layout, con):
+ def RIGID_BODY_JOINT(self, layout, con):
self.target_template(layout, con)
layout.itemR(con, "pivot_type")
@@ -441,7 +403,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
#Missing: Limit arrays (not wrapped in RNA yet)
- def clamp_to(self, layout, con):
+ def CLAMP_TO(self, layout, con):
self.target_template(layout, con)
row = layout.row()
@@ -451,7 +413,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
row = layout.row()
row.itemR(con, "cyclic")
- def transform(self, layout, con):
+ def TRANSFORM(self, layout, con):
self.target_template(layout, con)
layout.itemR(con, "extrapolate_motion", text="Extrapolate")
@@ -500,7 +462,7 @@ class ConstraintButtonsPanel(bpy.types.Panel):
self.space_template(layout, con)
- def shrinkwrap (self, layout, con):
+ def SHRINKWRAP (self, layout, con):
self.target_template(layout, con)
layout.itemR(con, "distance")
@@ -536,7 +498,7 @@ class BONE_PT_constraints(ConstraintButtonsPanel):
def poll(self, context):
ob = context.object
- return (ob and ob.type == "ARMATURE" and context.bone)
+ return (ob and ob.type == 'ARMATURE' and context.bone)
def draw(self, context):
layout = self.layout
diff --git a/release/ui/buttons_physics_cloth.py b/release/ui/buttons_physics_cloth.py
index 372dc32d063..1bd1c507ccf 100644
--- a/release/ui/buttons_physics_cloth.py
+++ b/release/ui/buttons_physics_cloth.py
@@ -20,7 +20,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
ob = context.object
split = layout.split()
- split.operator_context = "EXEC_DEFAULT"
+ split.operator_context = 'EXEC_DEFAULT'
if md:
# remove modifier + settings
@@ -32,7 +32,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel):
row.itemR(md, "realtime", text="")
else:
# add modifier
- split.item_enumO("object.modifier_add", "type", "CLOTH", text="Add")
+ split.item_enumO("object.modifier_add", "type", 'CLOTH', text="Add")
split.itemL()
if md:
diff --git a/release/ui/buttons_physics_fluid.py b/release/ui/buttons_physics_fluid.py
index 17813beecaa..be695d66448 100644
--- a/release/ui/buttons_physics_fluid.py
+++ b/release/ui/buttons_physics_fluid.py
@@ -21,7 +21,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
ob = context.object
split = layout.split()
- split.operator_context = "EXEC_DEFAULT"
+ split.operator_context = 'EXEC_DEFAULT'
if md:
# remove modifier + settings
@@ -36,7 +36,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel):
else:
# add modifier
- split.item_enumO("object.modifier_add", "type", "FLUID_SIMULATION", text="Add")
+ split.item_enumO("object.modifier_add", "type", 'FLUID_SIMULATION', text="Add")
split.itemL()
fluid = None
diff --git a/release/ui/buttons_physics_smoke.py b/release/ui/buttons_physics_smoke.py
new file mode 100644
index 00000000000..caafb3d58f2
--- /dev/null
+++ b/release/ui/buttons_physics_smoke.py
@@ -0,0 +1,106 @@
+
+import bpy
+
+class PhysicButtonsPanel(bpy.types.Panel):
+ __space_type__ = "BUTTONS_WINDOW"
+ __region_type__ = "WINDOW"
+ __context__ = "physics"
+
+ def poll(self, context):
+ ob = context.object
+ rd = context.scene.render_data
+ return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
+
+class PHYSICS_PT_smoke(PhysicButtonsPanel):
+ __label__ = "Smoke"
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.smoke
+ ob = context.object
+
+ split = layout.split()
+ split.operator_context = 'EXEC_DEFAULT'
+
+ if md:
+ # remove modifier + settings
+ split.set_context_pointer("modifier", md)
+ split.itemO("object.modifier_remove", text="Remove")
+
+ row = split.row(align=True)
+ row.itemR(md, "render", text="")
+ row.itemR(md, "realtime", text="")
+
+ else:
+ # add modifier
+ split.item_enumO("object.modifier_add", "type", 'SMOKE', text="Add")
+ split.itemL()
+
+ if md:
+ layout.itemR(md, "smoke_type", expand=True)
+
+ if md.smoke_type == 'TYPE_DOMAIN':
+ split = layout.split()
+
+ col = split.column()
+ col.itemL(text="Behavior:")
+ col.itemR(md.domain_settings, "alpha")
+ col.itemR(md.domain_settings, "beta")
+
+ col.itemL(text="Resolution:")
+ col.itemR(md.domain_settings, "maxres", text="Low")
+ sub = col.column()
+ sub.active = md.domain_settings.highres
+ sub.itemR(md.domain_settings, "amplify", text="High")
+ col.itemR(md.domain_settings, "highres", text="Use High Resolution")
+
+ col = split.column()
+ col.itemL(text="Display:")
+ col.itemR(md.domain_settings, "visibility")
+ col.itemR(md.domain_settings, "color", slider=True)
+ sub = col.column()
+ sub.active = md.domain_settings.highres
+ sub.itemR(md.domain_settings, "viewhighres")
+
+ layout.itemL(text="Noise Type:")
+ layout.itemR(md.domain_settings, "noise_type", expand=True)
+
+ split = layout.split()
+ col = split.column()
+ col.itemR(md.domain_settings, "strength")
+ sub = split.column()
+
+ split = layout.split()
+
+ col = split.column()
+ col.itemL(text="Flow Group:")
+ col.itemR(md.domain_settings, "fluid_group", text="")
+
+ #col.itemL(text="Effector Group:")
+ #col.itemR(md.domain_settings, "eff_group", text="")
+
+ col = split.column()
+ col.itemL(text="Collision Group:")
+ col.itemR(md.domain_settings, "coll_group", text="")
+
+ elif md.smoke_type == 'TYPE_FLOW':
+ split = layout.split()
+
+ col = split.column()
+ col.itemR(md.flow_settings, "outflow")
+ col.itemL(text="Particle System:")
+ col.item_pointerR(md.flow_settings, "psys", ob, "particle_systems", text="")
+
+ if md.flow_settings.outflow:
+ col = split.column()
+ else:
+ col = split.column()
+ col.itemL(text="Behavior:")
+ col.itemR(md.flow_settings, "temperature")
+ col.itemR(md.flow_settings, "density")
+
+ #elif md.smoke_type == 'TYPE_COLL':
+ # layout.itemS()
+
+bpy.types.register(PHYSICS_PT_smoke) \ No newline at end of file
diff --git a/release/ui/buttons_physics_softbody.py b/release/ui/buttons_physics_softbody.py
index bff9b13f464..c17d6e3bcf9 100644
--- a/release/ui/buttons_physics_softbody.py
+++ b/release/ui/buttons_physics_softbody.py
@@ -33,7 +33,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel):
row.itemR(md, "realtime", text="")
else:
# add modifier
- split.item_enumO("object.modifier_add", "type", "SOFTBODY", text="Add")
+ split.item_enumO("object.modifier_add", "type", 'SOFT_BODY', text="Add")
split.itemL("")
if md:
diff --git a/release/ui/buttons_texture.py b/release/ui/buttons_texture.py
index 5b1269c982c..f3d5d96cc28 100644
--- a/release/ui/buttons_texture.py
+++ b/release/ui/buttons_texture.py
@@ -7,14 +7,14 @@ class TextureButtonsPanel(bpy.types.Panel):
__context__ = "texture"
def poll(self, context):
- return (context.texture != None and context.texture.type != 'NONE')
+ return (context.texture and context.texture.type != 'NONE')
class TEXTURE_PT_preview(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_preview"
__label__ = "Preview"
def draw(self, context):
layout = self.layout
+
tex = context.texture
ma = context.material
la = context.lamp
@@ -33,7 +33,6 @@ class TEXTURE_PT_preview(TextureButtonsPanel):
layout.template_preview(tex)
class TEXTURE_PT_context_texture(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_context_texture"
__show_header__ = False
def poll(self, context):
@@ -43,23 +42,14 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
layout = self.layout
tex = context.texture
- ma = context.material
- la = context.lamp
- wo = context.world
- br = context.brush
+
+ id = context.material
+ if not id: id = context.lamp
+ if not id: id = context.world
+ if not id: id = context.brush
+
space = context.space_data
- if ma:
- id = ma
- elif la:
- id = la
- elif wo:
- id = wo
- elif br:
- id = br
- else:
- id = None
-
if id:
row = layout.row()
row.template_list(id, "textures", id, "active_texture_index", rows=2)
@@ -71,9 +61,11 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
elif tex:
split.template_ID(space, "pin_id")
- if not space.pin_id and \
- (context.sculpt_object or context.vertex_paint_object or \
- context.weight_paint_object or context.texture_paint_object):
+ if (not space.pin_id) and ( context.sculpt_object or \
+ context.vertex_paint_object or \
+ context.weight_paint_object or \
+ context.texture_paint_object \
+ ):
split.itemR(space, "brush_texture", text="Brush", toggle=True)
layout.itemS()
@@ -81,13 +73,10 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel):
if tex:
split = layout.split(percentage=0.2)
- col = split.column()
- col.itemL(text="Type:")
- col = split.column()
- col.itemR(tex, "type", text="")
+ split.itemL(text="Type:")
+ split.itemR(tex, "type", text="")
class TEXTURE_PT_mapping(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_mapping"
__label__ = "Mapping"
def poll(self, context):
@@ -95,6 +84,7 @@ class TEXTURE_PT_mapping(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
ma = context.material
la = context.lamp
wo = context.world
@@ -128,10 +118,8 @@ class TEXTURE_PT_mapping(TextureButtonsPanel):
if ma:
split = layout.split(percentage=0.3)
- col = split.column()
- col.itemL(text="Projection:")
- col = split.column()
- col.itemR(tex, "mapping", text="")
+ split.itemL(text="Projection:")
+ split.itemR(tex, "mapping", text="")
split = layout.split()
@@ -154,7 +142,6 @@ class TEXTURE_PT_mapping(TextureButtonsPanel):
row.column().itemR(tex, "size")
class TEXTURE_PT_influence(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_influence"
__label__ = "Influence"
def poll(self, context):
@@ -181,7 +168,6 @@ class TEXTURE_PT_influence(TextureButtonsPanel):
split = layout.split()
col = split.column()
-
col.itemL(text="Diffuse:")
factor_but(col, tex.map_diffuse, "map_diffuse", "diffuse_factor", "Intensity")
factor_but(col, tex.map_colordiff, "map_colordiff", "colordiff_factor", "Color")
@@ -205,15 +191,16 @@ class TEXTURE_PT_influence(TextureButtonsPanel):
factor_but(col, tex.map_warp, "map_warp", "warp_factor", "Warp")
factor_but(col, tex.map_displacement, "map_displacement", "displacement_factor", "Displace")
- #colsub = col.column()
- #colsub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
- #colsub.itemR(tex, "default_value", text="Amount", slider=True)
+ #sub = col.column()
+ #sub.active = tex.map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
+ #sub.itemR(tex, "default_value", text="Amount", slider=True)
elif la:
row = layout.row()
factor_but(row, tex.map_color, "map_color", "color_factor", "Color")
factor_but(row, tex.map_shadow, "map_shadow", "shadow_factor", "Shadow")
elif wo:
split = layout.split()
+
col = split.column()
factor_but(col, tex.map_blend, "map_blend", "blend_factor", "Blend")
factor_but(col, tex.map_horizon, "map_horizon", "horizon_factor", "Horizon")
@@ -223,15 +210,15 @@ class TEXTURE_PT_influence(TextureButtonsPanel):
factor_but(col, tex.map_zenith_down, "map_zenith_down", "zenith_down_factor", "Zenith Down")
layout.itemS()
+
split = layout.split()
col = split.column()
-
col.itemR(tex, "blend_type", text="Blend")
col.itemR(tex, "rgb_to_intensity")
- colsub = col.column()
- colsub.active = tex.rgb_to_intensity
- colsub.itemR(tex, "color", text="")
+ sub = col.column()
+ sub.active = tex.rgb_to_intensity
+ sub.itemR(tex, "color", text="")
col = split.column()
col.itemR(tex, "negate", text="Negative")
@@ -240,12 +227,12 @@ class TEXTURE_PT_influence(TextureButtonsPanel):
col.itemR(tex, "default_value", text="DVar", slider=True)
class TEXTURE_PT_colors(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_colors"
__label__ = "Colors"
__default_closed__ = True
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemR(tex, "use_color_ramp", text="Ramp")
@@ -253,16 +240,17 @@ class TEXTURE_PT_colors(TextureButtonsPanel):
layout.template_color_ramp(tex.color_ramp, expand=True)
split = layout.split()
- col = split.column()
- col.itemR(tex, "rgb_factor", text="Multiply RGB")
+
+ split.itemR(tex, "rgb_factor", text="Multiply RGB")
col = split.column()
col.itemL(text="Adjust:")
col.itemR(tex, "brightness")
col.itemR(tex, "contrast")
+
+# Texture Type Panels #
class TEXTURE_PT_clouds(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_clouds"
__label__ = "Clouds"
def poll(self, context):
@@ -271,6 +259,7 @@ class TEXTURE_PT_clouds(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemR(tex, "stype", expand=True)
@@ -278,13 +267,12 @@ class TEXTURE_PT_clouds(TextureButtonsPanel):
layout.itemR(tex, "noise_type", text="Type", expand=True)
layout.itemR(tex, "noise_basis", text="Basis")
- col = layout.column_flow()
- col.itemR(tex, "noise_size", text="Size")
- col.itemR(tex, "noise_depth", text="Depth")
- col.itemR(tex, "nabla", text="Nabla")
+ flow = layout.column_flow()
+ flow.itemR(tex, "noise_size", text="Size")
+ flow.itemR(tex, "noise_depth", text="Depth")
+ flow.itemR(tex, "nabla", text="Nabla")
class TEXTURE_PT_wood(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_wood"
__label__ = "Wood"
def poll(self, context):
@@ -293,6 +281,7 @@ class TEXTURE_PT_wood(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemR(tex, "noisebasis2", expand=True)
@@ -304,14 +293,13 @@ class TEXTURE_PT_wood(TextureButtonsPanel):
col.row().itemR(tex, "noise_type", text="Type", expand=True)
col.itemR(tex, "noise_basis", text="Basis")
- col = layout.column_flow()
- col.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
- col.itemR(tex, "noise_size", text="Size")
- col.itemR(tex, "turbulence")
- col.itemR(tex, "nabla")
+ flow = layout.column_flow()
+ flow.active = tex.stype in ('RINGNOISE', 'BANDNOISE')
+ flow.itemR(tex, "noise_size", text="Size")
+ flow.itemR(tex, "turbulence")
+ flow.itemR(tex, "nabla")
class TEXTURE_PT_marble(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_marble"
__label__ = "Marble"
def poll(self, context):
@@ -320,6 +308,7 @@ class TEXTURE_PT_marble(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemR(tex, "stype", expand=True)
@@ -328,14 +317,13 @@ class TEXTURE_PT_marble(TextureButtonsPanel):
layout.itemR(tex, "noise_type", text="Type", expand=True)
layout.itemR(tex, "noise_basis", text="Basis")
- col = layout.column_flow()
- col.itemR(tex, "noise_size", text="Size")
- col.itemR(tex, "noise_depth", text="Depth")
- col.itemR(tex, "turbulence")
- col.itemR(tex, "nabla")
+ flow = layout.column_flow()
+ flow.itemR(tex, "noise_size", text="Size")
+ flow.itemR(tex, "noise_depth", text="Depth")
+ flow.itemR(tex, "turbulence")
+ flow.itemR(tex, "nabla")
class TEXTURE_PT_magic(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_magic"
__label__ = "Magic"
def poll(self, context):
@@ -344,6 +332,7 @@ class TEXTURE_PT_magic(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
row = layout.row()
@@ -351,7 +340,6 @@ class TEXTURE_PT_magic(TextureButtonsPanel):
row.itemR(tex, "turbulence")
class TEXTURE_PT_blend(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_blend"
__label__ = "Blend"
def poll(self, context):
@@ -360,13 +348,13 @@ class TEXTURE_PT_blend(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemR(tex, "progression")
layout.itemR(tex, "flip_axis")
class TEXTURE_PT_stucci(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_stucci"
__label__ = "Stucci"
def poll(self, context):
@@ -375,6 +363,7 @@ class TEXTURE_PT_stucci(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemR(tex, "stype", expand=True)
@@ -387,7 +376,6 @@ class TEXTURE_PT_stucci(TextureButtonsPanel):
row.itemR(tex, "turbulence")
class TEXTURE_PT_image(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_image"
__label__ = "Image"
def poll(self, context):
@@ -396,12 +384,12 @@ class TEXTURE_PT_image(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.template_texture_image(tex)
class TEXTURE_PT_image_sampling(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_image_sampling"
__label__ = "Image Sampling"
__default_closed__ = True
@@ -411,47 +399,48 @@ class TEXTURE_PT_image_sampling(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
slot = context.texture_slot
split = layout.split()
"""
- sub = split.column()
- sub.itemR(tex, "flip_axis")
- sub.itemR(tex, "normal_map")
+ col = split.column()
+ col.itemR(tex, "flip_axis")
+ col.itemR(tex, "normal_map")
if slot:
- row = sub.row()
+ row = col.row()
row.active = tex.normal_map
row.itemR(slot, "normal_map_space", text="")
"""
- sub = split.column()
-
- sub.itemL(text="Alpha:")
- sub.itemR(tex, "use_alpha", text="Use")
- sub.itemR(tex, "calculate_alpha", text="Calculate")
- sub.itemR(tex, "invert_alpha", text="Invert")
+ col = split.column()
+ col.itemL(text="Alpha:")
+ col.itemR(tex, "use_alpha", text="Use")
+ col.itemR(tex, "calculate_alpha", text="Calculate")
+ col.itemR(tex, "invert_alpha", text="Invert")
- sub.itemL(text="Flip:")
- sub.itemR(tex, "flip_axis", text="X/Y Axis")
+ col.itemL(text="Flip:")
+ col.itemR(tex, "flip_axis", text="X/Y Axis")
- sub = split.column()
- sub.itemL(text="Filter:")
- sub.itemR(tex, "filter", text="")
- sub.itemR(tex, "mipmap")
- row = sub.row()
- row.itemR(tex, "mipmap_gauss", text="Gauss")
+ col = split.column()
+ col.itemL(text="Filter:")
+ col.itemR(tex, "filter", text="")
+ col.itemR(tex, "mipmap")
+
+ row = col.row()
row.active = tex.mipmap
- sub.itemR(tex, "interpolation")
+ row.itemR(tex, "mipmap_gauss", text="Gauss")
+
+ col.itemR(tex, "interpolation")
if tex.mipmap and tex.filter != 'DEFAULT':
if tex.filter == 'FELINE':
- sub.itemR(tex, "filter_probes", text="Probes")
+ col.itemR(tex, "filter_probes", text="Probes")
else:
- sub.itemR(tex, "filter_eccentricity", text="Eccentricity")
+ col.itemR(tex, "filter_eccentricity", text="Eccentricity")
class TEXTURE_PT_image_mapping(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_image_mapping"
__label__ = "Image Mapping"
__default_closed__ = True
@@ -461,6 +450,7 @@ class TEXTURE_PT_image_mapping(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemR(tex, "extension")
@@ -468,38 +458,39 @@ class TEXTURE_PT_image_mapping(TextureButtonsPanel):
split = layout.split()
if tex.extension == 'REPEAT':
- sub = split.column(align=True)
- sub.itemL(text="Repeat:")
- sub.itemR(tex, "repeat_x", text="X")
- sub.itemR(tex, "repeat_y", text="Y")
- sub = split.column(align=True)
- sub.itemL(text="Mirror:")
- sub.itemR(tex, "mirror_x", text="X")
- sub.itemR(tex, "mirror_y", text="Y")
+ col = split.column(align=True)
+ col.itemL(text="Repeat:")
+ col.itemR(tex, "repeat_x", text="X")
+ col.itemR(tex, "repeat_y", text="Y")
+
+ col = split.column(align=True)
+ col.itemL(text="Mirror:")
+ col.itemR(tex, "mirror_x", text="X")
+ col.itemR(tex, "mirror_y", text="Y")
elif tex.extension == 'CHECKER':
- sub = split.column(align=True)
- row = sub.row()
+ col = split.column(align=True)
+ row = col.row()
row.itemR(tex, "checker_even", text="Even")
row.itemR(tex, "checker_odd", text="Odd")
- sub = split.column()
- sub.itemR(tex, "checker_distance", text="Distance")
+
+ split.itemR(tex, "checker_distance", text="Distance")
layout.itemS()
split = layout.split()
- sub = split.column(align=True)
- #sub.itemR(tex, "crop_rectangle")
- sub.itemL(text="Crop Minimum:")
- sub.itemR(tex, "crop_min_x", text="X")
- sub.itemR(tex, "crop_min_y", text="Y")
- sub = split.column(align=True)
- sub.itemL(text="Crop Maximum:")
- sub.itemR(tex, "crop_max_x", text="X")
- sub.itemR(tex, "crop_max_y", text="Y")
+ col = split.column(align=True)
+ #col.itemR(tex, "crop_rectangle")
+ col.itemL(text="Crop Minimum:")
+ col.itemR(tex, "crop_min_x", text="X")
+ col.itemR(tex, "crop_min_y", text="Y")
+
+ col = split.column(align=True)
+ col.itemL(text="Crop Maximum:")
+ col.itemR(tex, "crop_max_x", text="X")
+ col.itemR(tex, "crop_max_y", text="Y")
class TEXTURE_PT_plugin(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_plugin"
__label__ = "Plugin"
def poll(self, context):
@@ -508,12 +499,12 @@ class TEXTURE_PT_plugin(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemL(text="Nothing yet")
class TEXTURE_PT_envmap(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_envmap"
__label__ = "Environment Map"
def poll(self, context):
@@ -522,12 +513,12 @@ class TEXTURE_PT_envmap(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemL(text="Nothing yet")
class TEXTURE_PT_musgrave(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_musgrave"
__label__ = "Musgrave"
def poll(self, context):
@@ -536,22 +527,24 @@ class TEXTURE_PT_musgrave(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemR(tex, "musgrave_type")
split = layout.split()
- sub = split.column()
- sub.itemR(tex, "highest_dimension", text="Dimension")
- sub.itemR(tex, "lacunarity")
- sub.itemR(tex, "octaves")
- sub = split.column()
+ col = split.column()
+ col.itemR(tex, "highest_dimension", text="Dimension")
+ col.itemR(tex, "lacunarity")
+ col.itemR(tex, "octaves")
+
+ col = split.column()
if (tex.musgrave_type in ('HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
- sub.itemR(tex, "offset")
+ col.itemR(tex, "offset")
if (tex.musgrave_type in ('RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL')):
- sub.itemR(tex, "gain")
- sub.itemR(tex, "noise_intensity", text="Intensity")
+ col.itemR(tex, "gain")
+ col.itemR(tex, "noise_intensity", text="Intensity")
layout.itemL(text="Noise:")
@@ -562,7 +555,6 @@ class TEXTURE_PT_musgrave(TextureButtonsPanel):
row.itemR(tex, "nabla")
class TEXTURE_PT_voronoi(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_voronoi"
__label__ = "Voronoi"
def poll(self, context):
@@ -571,20 +563,27 @@ class TEXTURE_PT_voronoi(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
-
- layout.itemR(tex, "distance_metric")
- layout.itemR(tex, "coloring")
split = layout.split()
- sub = split.column()
-
- sub.itemR(tex, "noise_intensity", text="Intensity")
- if tex.distance_metric == 'MINKOVSKY':
- sub.itemR(tex, "minkovsky_exponent", text="Exponent")
- sub = split.column()
- sub.itemR(tex, "feature_weights", slider=True)
+ col = split.column()
+ col.itemL(text="Distance Metric:")
+ col.itemR(tex, "distance_metric", text="")
+ sub = col.column()
+ sub.active = tex.distance_metric == 'MINKOVSKY'
+ sub.itemR(tex, "minkovsky_exponent", text="Exponent")
+ col.itemL(text="Coloring:")
+ col.itemR(tex, "coloring", text="")
+ col.itemR(tex, "noise_intensity", text="Intensity")
+
+ col = split.column(align=True)
+ col.itemL(text="Feature Weights:")
+ col.itemR(tex, "weight_1", text="1", slider=True)
+ col.itemR(tex, "weight_2", text="2", slider=True)
+ col.itemR(tex, "weight_3", text="3", slider=True)
+ col.itemR(tex, "weight_4", text="4", slider=True)
layout.itemL(text="Noise:")
@@ -593,7 +592,6 @@ class TEXTURE_PT_voronoi(TextureButtonsPanel):
row.itemR(tex, "nabla")
class TEXTURE_PT_distortednoise(TextureButtonsPanel):
- __idname__= "TEXTURE_PT_distortednoise"
__label__ = "Distorted Noise"
def poll(self, context):
@@ -602,19 +600,16 @@ class TEXTURE_PT_distortednoise(TextureButtonsPanel):
def draw(self, context):
layout = self.layout
+
tex = context.texture
layout.itemR(tex, "noise_distortion")
layout.itemR(tex, "noise_basis", text="Basis")
- split = layout.split()
-
- sub = split.column()
- sub.itemR(tex, "distortion_amount", text="Distortion")
- sub.itemR(tex, "noise_size", text="Size")
-
- sub = split.column()
- sub.itemR(tex, "nabla")
+ flow = layout.column_flow()
+ flow.itemR(tex, "distortion_amount", text="Distortion")
+ flow.itemR(tex, "noise_size", text="Size")
+ flow.itemR(tex, "nabla")
bpy.types.register(TEXTURE_PT_context_texture)
bpy.types.register(TEXTURE_PT_preview)
@@ -635,4 +630,3 @@ bpy.types.register(TEXTURE_PT_distortednoise)
bpy.types.register(TEXTURE_PT_colors)
bpy.types.register(TEXTURE_PT_mapping)
bpy.types.register(TEXTURE_PT_influence)
-
diff --git a/release/ui/space_image.py b/release/ui/space_image.py
index eeac19c04e0..7154bb8ae1c 100644
--- a/release/ui/space_image.py
+++ b/release/ui/space_image.py
@@ -124,9 +124,9 @@ class IMAGE_MT_uvs_transform(bpy.types.Menu):
def draw(self, context):
layout = self.layout
- layout.item_enumO("tfm.transform", "mode", "TRANSLATION")
- layout.item_enumO("tfm.transform", "mode", "ROTATION")
- layout.item_enumO("tfm.transform", "mode", "RESIZE")
+ layout.item_enumO("tfm.transform", "mode", 'TRANSLATION')
+ layout.item_enumO("tfm.transform", "mode", 'ROTATION')
+ layout.item_enumO("tfm.transform", "mode", 'RESIZE')
class IMAGE_MT_uvs_mirror(bpy.types.Menu):
__space_type__ = "IMAGE_EDITOR"
@@ -135,8 +135,8 @@ class IMAGE_MT_uvs_mirror(bpy.types.Menu):
def draw(self, context):
layout = self.layout
- layout.item_enumO("uv.mirror", "axis", "MIRROR_X") # "X Axis", M,
- layout.item_enumO("uv.mirror", "axis", "MIRROR_Y") # "Y Axis", M,
+ layout.item_enumO("uv.mirror", "axis", 'MIRROR_X') # "X Axis", M,
+ layout.item_enumO("uv.mirror", "axis", 'MIRROR_Y') # "Y Axis", M,
class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
__space_type__ = "IMAGE_EDITOR"
diff --git a/release/ui/space_info.py b/release/ui/space_info.py
index 855ce0b4f8f..686600ba4e7 100644
--- a/release/ui/space_info.py
+++ b/release/ui/space_info.py
@@ -110,22 +110,22 @@ class INFO_MT_add(bpy.types.Menu):
layout.operator_context = "EXEC_SCREEN"
- layout.item_menu_enumO( "OBJECT_OT_mesh_add", "type", text="Mesh", icon="ICON_OUTLINER_OB_MESH")
- layout.item_menu_enumO( "OBJECT_OT_curve_add", "type", text="Curve", icon="ICON_OUTLINER_OB_CURVE")
- layout.item_menu_enumO( "OBJECT_OT_surface_add", "type", text="Surface", icon="ICON_OUTLINER_OB_SURFACE")
- layout.item_menu_enumO( "OBJECT_OT_metaball_add", "type", "META", icon="ICON_OUTLINER_OB_META")
- layout.itemO("OBJECT_OT_text_add", text="Text", icon="ICON_OUTLINER_OB_FONT")
+ layout.item_menu_enumO( "OBJECT_OT_mesh_add", "type", text="Mesh", icon='ICON_OUTLINER_OB_MESH')
+ layout.item_menu_enumO( "OBJECT_OT_curve_add", "type", text="Curve", icon='ICON_OUTLINER_OB_CURVE')
+ layout.item_menu_enumO( "OBJECT_OT_surface_add", "type", text="Surface", icon='ICON_OUTLINER_OB_SURFACE')
+ layout.item_menu_enumO( "OBJECT_OT_metaball_add", "type", 'META', icon='ICON_OUTLINER_OB_META')
+ layout.itemO("OBJECT_OT_text_add", text="Text", icon='ICON_OUTLINER_OB_FONT')
layout.itemS()
- layout.itemO("OBJECT_OT_armature_add", text="Armature", icon="ICON_OUTLINER_OB_ARMATURE")
- layout.item_enumO("OBJECT_OT_object_add", "type", "LATTICE", icon="ICON_OUTLINER_OB_LATTICE")
- layout.item_enumO("OBJECT_OT_object_add", "type", "EMPTY", icon="ICON_OUTLINER_OB_EMPTY")
+ layout.itemO("OBJECT_OT_armature_add", text="Armature", icon='ICON_OUTLINER_OB_ARMATURE')
+ layout.item_enumO("OBJECT_OT_object_add", "type", 'LATTICE', icon='ICON_OUTLINER_OB_LATTICE')
+ layout.item_enumO("OBJECT_OT_object_add", "type", 'EMPTY', icon='ICON_OUTLINER_OB_EMPTY')
layout.itemS()
- layout.item_enumO("OBJECT_OT_object_add", "type", "CAMERA", icon="ICON_OUTLINER_OB_CAMERA")
- layout.item_enumO("OBJECT_OT_object_add", "type", "LAMP", icon="ICON_OUTLINER_OB_LAMP")
+ layout.item_enumO("OBJECT_OT_object_add", "type", 'CAMERA', icon='ICON_OUTLINER_OB_CAMERA')
+ layout.item_enumO("OBJECT_OT_object_add", "type", 'LAMP', icon='ICON_OUTLINER_OB_LAMP')
class INFO_MT_game(bpy.types.Menu):
__space_type__ = "USER_PREFERENCES"
diff --git a/release/ui/space_text.py b/release/ui/space_text.py
index 1b4fcea24b6..c54073c2938 100644
--- a/release/ui/space_text.py
+++ b/release/ui/space_text.py
@@ -34,9 +34,9 @@ class TEXT_HT_header(bpy.types.Header):
row = layout.row()
if text.filename != "":
if text.dirty:
- row.itemL(text="File: *" + text.filename + " (unsaved)")
+ row.itemL(text="File: *%s (unsaved)" % text.filename)
else:
- row.itemL(text="File: " + text.filename)
+ row.itemL(text="File: %s" % text.filename )
else:
if text.library:
row.itemL(text="Text: External")
@@ -137,8 +137,8 @@ class TEXT_MT_edit_view(bpy.types.Menu):
def draw(self, context):
layout = self.layout
- layout.item_enumO("text.move", "type", "FILE_TOP", text="Top of File")
- layout.item_enumO("text.move", "type", "FILE_BOTTOM", text="Bottom of File")
+ layout.item_enumO("text.move", "type", 'FILE_TOP', text="Top of File")
+ layout.item_enumO("text.move", "type", 'FILE_BOTTOM', text="Bottom of File")
class TEXT_MT_edit_select(bpy.types.Menu):
__space_type__ = "TEXT_EDITOR"
diff --git a/release/ui/space_view3d.py b/release/ui/space_view3d.py
index fc550982afa..5e0e2fa60b6 100644
--- a/release/ui/space_view3d.py
+++ b/release/ui/space_view3d.py
@@ -53,10 +53,10 @@ class VIEW3D_MT_view(bpy.types.Menu):
layout.itemS()
- layout.item_enumO("view3d.viewnumpad", "type", "CAMERA")
- layout.item_enumO("view3d.viewnumpad", "type", "TOP")
- layout.item_enumO("view3d.viewnumpad", "type", "FRONT")
- layout.item_enumO("view3d.viewnumpad", "type", "RIGHT")
+ layout.item_enumO("view3d.viewnumpad", "type", 'CAMERA')
+ layout.item_enumO("view3d.viewnumpad", "type", 'TOP')
+ layout.item_enumO("view3d.viewnumpad", "type", 'FRONT')
+ layout.item_enumO("view3d.viewnumpad", "type", 'RIGHT')
# layout.itemM("VIEW3D_MT_view_cameras", text="Cameras")
diff --git a/release/ui/space_view3d_toolbar.py b/release/ui/space_view3d_toolbar.py
index be57497a0b4..6edf57c7f58 100644
--- a/release/ui/space_view3d_toolbar.py
+++ b/release/ui/space_view3d_toolbar.py
@@ -324,10 +324,17 @@ class VIEW3D_PT_tools_brush(PaintPanel):
settings = self.paint_settings(context)
brush = settings.brush
+
+ if not context.particle_edit_object:
+ layout.split().row().template_ID(settings, "brush")
+
+ # Particle Mode #
# XXX This needs a check if psys is editable.
if context.particle_edit_object:
+ # XXX Select Particle System
layout.column().itemR(settings, "tool", expand=True)
+
if settings.tool != 'NONE':
col = layout.column(align=True)
col.itemR(brush, "size", slider=True)
@@ -343,40 +350,60 @@ class VIEW3D_PT_tools_brush(PaintPanel):
layout.itemR(brush, "length_mode", expand=True)
elif settings.tool == 'PUFF':
layout.itemR(brush, "puff_mode", expand=True)
+
+ # Sculpt Mode #
+
+ elif context.sculpt_object:
+ layout.column().itemR(brush, "sculpt_tool", expand=True)
- else:
- layout.split().row().template_ID(settings, "brush")
+ col = layout.column()
+
+ row = col.row(align=True)
+ row.itemR(brush, "size", slider=True)
+ row.itemR(brush, "size_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+
+ if brush.sculpt_tool != 'GRAB':
+ row = col.row(align=True)
+ row.itemR(brush, "strength", slider=True)
+ row.itemR(brush, "strength_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+
+ col = layout.column()
+ col.itemR(brush, "airbrush")
+ if brush.sculpt_tool != 'LAYER':
+ col.itemR(brush, "anchored")
- if brush and not context.particle_edit_object:
- if context.sculpt_object:
- layout.column().itemR(brush, "sculpt_tool", expand=True)
+ if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
+ col.itemR(brush, "flip_direction")
- elif context.texture_paint_object:
- col = layout.column(align=True)
- col.item_enumR(settings, "tool", "DRAW")
- col.item_enumR(settings, "tool", "SOFTEN")
- if settings.use_projection:
- col.item_enumR(settings, "tool", "CLONE")
- else:
- col.item_enumR(settings, "tool", "SMEAR")
-
+ if brush.sculpt_tool == 'LAYER':
+ col.itemR(brush, "persistent")
+ col.itemO("sculpt.set_persistent_base")
+
+ # Texture Paint Mode #
+
+ elif context.texture_paint_object:
+ col = layout.column(align=True)
+ col.item_enumR(settings, "tool", 'DRAW')
+ col.item_enumR(settings, "tool", 'SOFTEN')
+ if settings.use_projection:
+ col.item_enumR(settings, "tool", 'CLONE')
+ else:
+ col.item_enumR(settings, "tool", 'SMEAR')
+
col = layout.column()
+ col.itemR(brush, "color", text="")
+
row = col.row(align=True)
row.itemR(brush, "size", slider=True)
row.itemR(brush, "size_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
- if context.weight_paint_object:
- col.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
-
- col.itemR(brush, "strength", slider=True)
+
+ row = col.row(align=True)
+ row.itemR(brush, "strength", slider=True)
+ row.itemR(brush, "strength_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+
row = col.row(align=True)
row.itemR(brush, "falloff", slider=True)
row.itemR(brush, "falloff_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
- if context.vertex_paint_object or context.texture_paint_object:
- col.itemR(brush, "color", text="")
- if context.texture_paint_object:
- row = col.row(align=True)
- row.itemR(brush, "clone_opacity", slider=True, text="Opacity")
- row.itemR(brush, "opacity_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
row = col.row(align=True)
row.itemR(brush, "space", text="")
@@ -384,14 +411,44 @@ class VIEW3D_PT_tools_brush(PaintPanel):
rowsub.active = brush.space
rowsub.itemR(brush, "spacing", text="Spacing", slider=True)
rowsub.itemR(brush, "spacing_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
-
+
col = layout.column()
col.itemR(brush, "airbrush")
- col.itemR(brush, "anchored")
- col.itemR(brush, "rake")
+ sub = col.column()
+ sub.active = brush.airbrush
+ sub.itemR(brush, "rate")
+
+ # Weight Paint Mode #
+
+ elif context.weight_paint_object:
+ layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
+
+ col = layout.column()
+ row = col.row(align=True)
+ row.itemR(brush, "size", slider=True)
+ row.itemR(brush, "size_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+
+ row = col.row(align=True)
+ row.itemR(brush, "strength", slider=True)
+ row.itemR(brush, "strength_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+
+ # Vertex Paint Mode #
+
+ elif context.vertex_paint_object:
+ col = layout.column()
+ col.itemR(brush, "color", text="")
+
+ row = col.row(align=True)
+ row.itemR(brush, "size", slider=True)
+ row.itemR(brush, "size_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
+
+ row = col.row(align=True)
+ row.itemR(brush, "strength", slider=True)
+ row.itemR(brush, "strength_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
class VIEW3D_PT_tools_brush_curve(PaintPanel):
__label__ = "Curve"
+ __default_closed__ = True
def poll(self, context):
settings = self.paint_settings(context)
@@ -503,19 +560,26 @@ class VIEW3D_PT_tools_texture_paint(View3DPanel):
def draw(self, context):
layout = self.layout
+
ipaint = context.tool_settings.image_paint
+ settings = context.tool_settings.image_paint
col = layout.column()
col.itemR(ipaint, "use_projection")
- col.itemR(ipaint, "use_occlude")
- col.itemR(ipaint, "use_backface_cull")
- col.itemR(ipaint, "use_normal_falloff")
- col.itemR(ipaint, "invert_stencil")
- col.itemR(ipaint, "use_clone_layer")
- col.itemR(ipaint, "use_stencil_layer")
-
- col.itemR(ipaint, "seam_bleed")
- col.itemR(ipaint, "normal_angle")
+ sub = col.column()
+ sub.active = ipaint.use_projection
+ sub.itemR(ipaint, "use_occlude")
+ sub.itemR(ipaint, "use_backface_cull")
+ sub.itemR(ipaint, "use_normal_falloff")
+ sub.itemR(ipaint, "use_stencil_layer")
+ subsub = sub.column()
+ subsub.active = ipaint.use_stencil_layer
+ subsub.itemR(ipaint, "invert_stencil")
+ if settings.tool == 'CLONE':
+ sub.itemR(ipaint, "use_clone_layer")
+
+ sub.itemR(ipaint, "seam_bleed")
+ sub.itemR(ipaint, "normal_angle")
# ********** default tools for particle mode ****************
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index c1b14a14f8c..05df927f921 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -140,17 +140,10 @@ char **BLF_dir_get(int *ndir);
/* Free the data return by BLF_dir_get. */
void BLF_dir_free(char **dirs, int count);
-/* Set the current draw mode. */
-void BLF_mode(int mode);
-
/* font->flags. */
#define BLF_ROTATION (1<<0)
#define BLF_CLIPPING (1<<1)
#define BLF_SHADOW (1<<2)
#define BLF_KERNING_DEFAULT (1<<3)
-/* font->mode. */
-#define BLF_MODE_TEXTURE 0
-#define BLF_MODE_BITMAP 1
-
#endif /* BLF_API_H */
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index af57f822c40..ded89d18387 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -333,7 +333,6 @@ void BLF_default_rotation(float angle)
}
}
-
void BLF_draw(char *str)
{
FontBLF *font;
@@ -342,40 +341,24 @@ void BLF_draw(char *str)
* The pixmap alignment hack is handle
* in BLF_position (old ui_rasterpos_safe).
*/
-
font= global_font[global_font_cur];
if (font) {
- if (font->mode == BLF_MODE_BITMAP) {
- glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
- glPushAttrib(GL_ENABLE_BIT);
- glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glDisable(GL_BLEND);
- glRasterPos3f(font->pos[0], font->pos[1], font->pos[2]);
-
- blf_font_draw(font, str);
-
- glPopAttrib();
- glPopClientAttrib();
- }
- else {
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glPushMatrix();
- glTranslatef(font->pos[0], font->pos[1], font->pos[2]);
- glScalef(font->aspect, font->aspect, 1.0);
+ glPushMatrix();
+ glTranslatef(font->pos[0], font->pos[1], font->pos[2]);
+ glScalef(font->aspect, font->aspect, 1.0);
- if (font->flags & BLF_ROTATION)
- glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
+ if (font->flags & BLF_ROTATION)
+ glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
- blf_font_draw(font, str);
+ blf_font_draw(font, str);
- glPopMatrix();
- glDisable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- }
+ glPopMatrix();
+ glDisable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
}
}
@@ -506,15 +489,6 @@ void BLF_clipping(float xmin, float ymin, float xmax, float ymax)
}
}
-void BLF_mode(int mode)
-{
- FontBLF *font;
-
- font= global_font[global_font_cur];
- if (font)
- font->mode= mode;
-}
-
void BLF_shadow(int level, float r, float g, float b, float a)
{
FontBLF *font;
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 6fc35a96e1e..7521b7815f1 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -128,17 +128,6 @@ void blf_font_draw(FontBLF *font, char *str)
if (!g)
continue;
- /*
- * This happen if we change the mode of the
- * font, we don't drop the glyph cache, so it's
- * possible that some glyph don't have the
- * bitmap or texture information.
- */
- if (font->mode == BLF_MODE_BITMAP && (!g->bitmap_data))
- g= blf_glyph_add(font, glyph_index, c);
- else if (font->mode == BLF_MODE_TEXTURE && (!g->tex_data))
- g= blf_glyph_add(font, glyph_index, c);
-
if (has_kerning && g_prev) {
delta.x= 0;
delta.y= 0;
@@ -200,17 +189,6 @@ void blf_font_boundbox(FontBLF *font, char *str, rctf *box)
if (!g)
continue;
- /*
- * This happen if we change the mode of the
- * font, we don't drop the glyph cache, so it's
- * possible that some glyph don't have the
- * bitmap or texture information.
- */
- if (font->mode == BLF_MODE_BITMAP && (!g->bitmap_data))
- g= blf_glyph_add(font, glyph_index, c);
- else if (font->mode == BLF_MODE_TEXTURE && (!g->tex_data))
- g= blf_glyph_add(font, glyph_index, c);
-
if (has_kerning && g_prev) {
delta.x= 0;
delta.y= 0;
@@ -316,7 +294,6 @@ void blf_font_free(FontBLF *font)
void blf_font_fill(FontBLF *font)
{
- font->mode= BLF_MODE_TEXTURE;
font->aspect= 1.0f;
font->pos[0]= 0.0f;
font->pos[1]= 0.0f;
@@ -333,7 +310,7 @@ void blf_font_fill(FontBLF *font)
font->cache.last= NULL;
font->glyph_cache= NULL;
font->blur= 0;
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&font->max_tex_size);
+ font->max_tex_size= -1;
}
FontBLF *blf_font_new(char *name, char *filename)
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 805da02ba36..78df8ff2bc6 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -189,29 +189,18 @@ GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c)
return(NULL);
}
-GlyphBLF *blf_glyph_texture_add(FontBLF *font, FT_UInt index, unsigned int c)
+GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c)
{
FT_GlyphSlot slot;
- GlyphCacheBLF *gc;
GlyphBLF *g;
- GlyphTextureBLF *gt;
FT_Error err;
FT_Bitmap bitmap;
FT_BBox bbox;
unsigned int key;
- int do_new;
g= blf_glyph_search(font->glyph_cache, c);
-
- /* The glyph can be add on Bitmap mode, so we have the
- * glyph, but not the texture data.
- */
- if (g && g->tex_data)
+ if (g)
return(g);
- else if (g)
- do_new= 0;
- else
- do_new= 1;
err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
if (err)
@@ -224,56 +213,31 @@ GlyphBLF *blf_glyph_texture_add(FontBLF *font, FT_UInt index, unsigned int c)
if (err || slot->format != FT_GLYPH_FORMAT_BITMAP)
return(NULL);
- if (do_new) {
- g= (GlyphBLF *)MEM_mallocN(sizeof(GlyphBLF), "blf_glyph_add");
- g->next= NULL;
- g->prev= NULL;
- g->tex_data= NULL;
- g->bitmap_data= NULL;
- g->c= c;
- }
-
- gt= (GlyphTextureBLF *)MEM_mallocN(sizeof(GlyphTextureBLF), "blf_glyph_texture_add");
- gc= font->glyph_cache;
-
- if (gc->cur_tex == -1) {
- blf_glyph_cache_texture(font, gc);
- gc->x_offs= gc->pad;
- gc->y_offs= gc->pad;
- }
-
- if (gc->x_offs > (gc->p2_width - gc->max_glyph_width)) {
- gc->x_offs= gc->pad;
- gc->y_offs += gc->max_glyph_height;
-
- if (gc->y_offs > (gc->p2_height - gc->max_glyph_height)) {
- gc->y_offs= gc->pad;
- blf_glyph_cache_texture(font, gc);
- }
- }
-
+ g= (GlyphBLF *)MEM_mallocN(sizeof(GlyphBLF), "blf_glyph_add");
+ g->next= NULL;
+ g->prev= NULL;
+ g->c= c;
+ g->tex= 0;
+ g->build_tex= 0;
+ g->bitmap= NULL;
+ g->xoff= -1;
+ g->yoff= -1;
+ g->uv[0][0]= 0.0f;
+ g->uv[0][1]= 0.0f;
+ g->uv[1][0]= 0.0f;
+ g->uv[1][1]= 0.0f;
bitmap= slot->bitmap;
- gt->tex= gc->textures[gc->cur_tex];
-
- gt->xoff= gc->x_offs;
- gt->yoff= gc->y_offs;
- gt->width= bitmap.width;
- gt->height= bitmap.rows;
+ g->width= bitmap.width;
+ g->height= bitmap.rows;
- if (gt->width && gt->height) {
- glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
- glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- glBindTexture(GL_TEXTURE_2D, gt->tex);
- glTexSubImage2D(GL_TEXTURE_2D, 0, gt->xoff, gt->yoff, gt->width, gt->height, GL_ALPHA, GL_UNSIGNED_BYTE, bitmap.buffer);
- glPopClientAttrib();
+ if (g->width && g->height) {
+ g->bitmap= (unsigned char *)MEM_mallocN(g->width * g->height, "glyph bitmap");
+ memcpy((void *)g->bitmap, (void *)bitmap.buffer, g->width * g->height);
}
g->advance= ((float)slot->advance.x) / 64.0f;
- gt->pos_x= slot->bitmap_left;
- gt->pos_y= slot->bitmap_top;
+ g->pos_x= slot->bitmap_left;
+ g->pos_y= slot->bitmap_top;
FT_Outline_Get_CBox(&(slot->outline), &bbox);
g->box.xmin= ((float)bbox.xMin) / 64.0f;
@@ -281,143 +245,18 @@ GlyphBLF *blf_glyph_texture_add(FontBLF *font, FT_UInt index, unsigned int c)
g->box.ymin= ((float)bbox.yMin) / 64.0f;
g->box.ymax= ((float)bbox.yMax) / 64.0f;
- gt->uv[0][0]= ((float)gt->xoff) / ((float)gc->p2_width);
- gt->uv[0][1]= ((float)gt->yoff) / ((float)gc->p2_height);
- gt->uv[1][0]= ((float)(gt->xoff + gt->width)) / ((float)gc->p2_width);
- gt->uv[1][1]= ((float)(gt->yoff + gt->height)) / ((float)gc->p2_height);
-
- /* update the x offset for the next glyph. */
- gc->x_offs += (int)(g->box.xmax - g->box.xmin + gc->pad);
-
- if (do_new) {
- key= blf_hash(g->c);
- BLI_addhead(&(gc->bucket[key]), g);
- gc->rem_glyphs--;
- }
-
- /* and attach the texture information. */
- g->tex_data= gt;
-
+ key= blf_hash(g->c);
+ BLI_addhead(&(font->glyph_cache->bucket[key]), g);
return(g);
}
-GlyphBLF *blf_glyph_bitmap_add(FontBLF *font, FT_UInt index, unsigned int c)
-{
- FT_GlyphSlot slot;
- GlyphCacheBLF *gc;
- GlyphBLF *g;
- GlyphBitmapBLF *gt;
- FT_Error err;
- FT_Bitmap bitmap;
- FT_BBox bbox;
- unsigned char *dest, *src;
- unsigned int key, y;
- unsigned int src_width, src_height, src_pitch;
- int do_new;
-
- g= blf_glyph_search(font->glyph_cache, c);
-
- /*
- * The glyph can be add on Texture mode, so we have the
- * glyph, but not the bitmap data.
- */
- if (g && g->bitmap_data)
- return(g);
- else if (g)
- do_new= 0;
- else
- do_new= 1;
-
- err= FT_Load_Glyph(font->face, index, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
- if (err)
- return(NULL);
-
- /* get the glyph. */
- slot= font->face->glyph;
-
- err= FT_Render_Glyph(slot, FT_RENDER_MODE_MONO);
- if (err || slot->format != FT_GLYPH_FORMAT_BITMAP)
- return(NULL);
-
- if (do_new) {
- g= (GlyphBLF *)MEM_mallocN(sizeof(GlyphBLF), "blf_glyph_add");
- g->next= NULL;
- g->prev= NULL;
- g->tex_data= NULL;
- g->bitmap_data= NULL;
- g->c= c;
- }
-
- gt= (GlyphBitmapBLF *)MEM_mallocN(sizeof(GlyphBitmapBLF), "blf_glyph_bitmap_add");
- gc= font->glyph_cache;
-
- bitmap= slot->bitmap;
-
- src_width= bitmap.width;
- src_height= bitmap.rows;
- src_pitch= bitmap.pitch;
-
- gt->width= src_width;
- gt->height= src_height;
- gt->pitch= src_pitch;
- gt->image= NULL;
-
- if (gt->width && gt->height) {
- gt->image= (unsigned char *)malloc(gt->pitch * gt->height);
-
- dest= gt->image + ((gt->height - 1) * gt->pitch);
- src= bitmap.buffer;
-
- for (y= 0; y < src_height; ++y) {
- memcpy((void *)dest, (void *)src, src_pitch);
- dest -= gt->pitch;
- src += src_pitch;
- }
- }
-
- g->advance= ((float)slot->advance.x) / 64.0f;
- gt->pos_x= slot->bitmap_left;
- gt->pos_y= ((int)src_height) - slot->bitmap_top;
-
- FT_Outline_Get_CBox(&(slot->outline), &bbox);
- g->box.xmin= ((float)bbox.xMin) / 64.0f;
- g->box.xmax= ((float)bbox.xMax) / 64.0f;
- g->box.ymin= ((float)bbox.yMin) / 64.0f;
- g->box.ymax= ((float)bbox.yMax) / 64.0f;
-
- if (do_new) {
- key= blf_hash(g->c);
- BLI_addhead(&(gc->bucket[key]), g);
- gc->rem_glyphs--;
- }
-
- /* and attach the bitmap information. */
- g->bitmap_data= gt;
-
- return(g);
-}
-
-GlyphBLF *blf_glyph_add(FontBLF *font, FT_UInt index, unsigned int c)
-{
- if (font->mode == BLF_MODE_BITMAP)
- return(blf_glyph_bitmap_add(font, index, c));
- return(blf_glyph_texture_add(font, index, c));
-}
-
void blf_glyph_free(GlyphBLF *g)
{
- if (g->tex_data)
- MEM_freeN(g->tex_data);
-
- if (g->bitmap_data) {
- if (g->bitmap_data->image)
- free((void *)g->bitmap_data->image);
- MEM_freeN(g->bitmap_data);
- }
-
/* don't need free the texture, the GlyphCache already
* have a list of all the texture and free it.
*/
+ if (g->bitmap)
+ MEM_freeN(g->bitmap);
MEM_freeN(g);
}
@@ -482,16 +321,65 @@ static void blf_texture3_draw(float uv[2][2], float x1, float y1, float x2, floa
glColor4fv(color);
}
-int blf_glyph_texture_render(FontBLF *font, GlyphBLF *g, float x, float y)
+int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
{
- GlyphTextureBLF *gt;
+ GlyphCacheBLF *gc;
GLint cur_tex;
float dx, dx1;
float y1, y2;
float xo, yo;
float color[4];
- gt= g->tex_data;
+ if ((!g->width) || (!g->height))
+ return(1);
+
+ if (g->build_tex == 0) {
+ gc= font->glyph_cache;
+
+ if (font->max_tex_size == -1)
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&font->max_tex_size);
+
+ if (gc->cur_tex == -1) {
+ blf_glyph_cache_texture(font, gc);
+ gc->x_offs= gc->pad;
+ gc->y_offs= gc->pad;
+ }
+
+ if (gc->x_offs > (gc->p2_width - gc->max_glyph_width)) {
+ gc->x_offs= gc->pad;
+ gc->y_offs += gc->max_glyph_height;
+
+ if (gc->y_offs > (gc->p2_height - gc->max_glyph_height)) {
+ gc->y_offs= gc->pad;
+ blf_glyph_cache_texture(font, gc);
+ }
+ }
+
+ g->tex= gc->textures[gc->cur_tex];
+ g->xoff= gc->x_offs;
+ g->yoff= gc->y_offs;
+
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ glBindTexture(GL_TEXTURE_2D, g->tex);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, g->xoff, g->yoff, g->width, g->height, GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap);
+ glPopClientAttrib();
+
+ g->uv[0][0]= ((float)g->xoff) / ((float)gc->p2_width);
+ g->uv[0][1]= ((float)g->yoff) / ((float)gc->p2_height);
+ g->uv[1][0]= ((float)(g->xoff + g->width)) / ((float)gc->p2_width);
+ g->uv[1][1]= ((float)(g->yoff + g->height)) / ((float)gc->p2_height);
+
+ /* update the x offset for the next glyph. */
+ gc->x_offs += (int)(g->box.xmax - g->box.xmin + gc->pad);
+
+ gc->rem_glyphs--;
+ g->build_tex= 1;
+ }
+
xo= 0.0f;
yo= 0.0f;
@@ -502,10 +390,10 @@ int blf_glyph_texture_render(FontBLF *font, GlyphBLF *g, float x, float y)
y += font->shadow_y;
}
- dx= floor(x + gt->pos_x);
- dx1= dx + gt->width;
- y1= y + gt->pos_y;
- y2= y + gt->pos_y - gt->height;
+ dx= floor(x + g->pos_x);
+ dx1= dx + g->width;
+ y1= y + g->pos_y;
+ y2= y + g->pos_y - g->height;
if (font->flags & BLF_CLIPPING) {
if (!BLI_in_rctf(&font->clip_rec, dx + font->pos[0], y1 + font->pos[1]))
@@ -519,70 +407,36 @@ int blf_glyph_texture_render(FontBLF *font, GlyphBLF *g, float x, float y)
}
glGetIntegerv(GL_TEXTURE_2D_BINDING_EXT, &cur_tex);
- if (cur_tex != gt->tex)
- glBindTexture(GL_TEXTURE_2D, gt->tex);
+ if (cur_tex != g->tex)
+ glBindTexture(GL_TEXTURE_2D, g->tex);
if (font->flags & BLF_SHADOW) {
glGetFloatv(GL_CURRENT_COLOR, color);
glColor4fv(font->shadow_col);
if (font->shadow == 3)
- blf_texture3_draw(gt->uv, dx, y1, dx1, y2);
+ blf_texture3_draw(g->uv, dx, y1, dx1, y2);
else if (font->shadow == 5)
- blf_texture5_draw(gt->uv, dx, y1, dx1, y2);
+ blf_texture5_draw(g->uv, dx, y1, dx1, y2);
else
- blf_texture_draw(gt->uv, dx, y1, dx1, y2);
+ blf_texture_draw(g->uv, dx, y1, dx1, y2);
glColor4fv(color);
x= xo;
y= yo;
- dx= floor(x + gt->pos_x);
- dx1= dx + gt->width;
- y1= y + gt->pos_y;
- y2= y + gt->pos_y - gt->height;
+ dx= floor(x + g->pos_x);
+ dx1= dx + g->width;
+ y1= y + g->pos_y;
+ y2= y + g->pos_y - g->height;
}
if (font->blur==3)
- blf_texture3_draw(gt->uv, dx, y1, dx1, y2);
+ blf_texture3_draw(g->uv, dx, y1, dx1, y2);
else if (font->blur==5)
- blf_texture5_draw(gt->uv, dx, y1, dx1, y2);
+ blf_texture5_draw(g->uv, dx, y1, dx1, y2);
else
- blf_texture_draw(gt->uv, dx, y1, dx1, y2);
-
- return(1);
-}
-
-int blf_glyph_bitmap_render(FontBLF *font, GlyphBLF *g, float x, float y)
-{
- GlyphBitmapBLF *gt;
- GLubyte null_bitmap= 0;
-
- gt= g->bitmap_data;
- if (!gt->image)
- return(1);
-
- if (font->flags & BLF_CLIPPING) {
- if (!BLI_in_rctf(&font->clip_rec, x + font->pos[0], y + font->pos[1]))
- return(0);
- if (!BLI_in_rctf(&font->clip_rec, x + font->pos[0], y + gt->height + font->pos[1]))
- return(0);
- if (!BLI_in_rctf(&font->clip_rec, x + gt->width + font->pos[0], y + gt->height + font->pos[1]))
- return(0);
- if (!BLI_in_rctf(&font->clip_rec, x + gt->width + font->pos[0], y + font->pos[1]))
- return(0);
- }
+ blf_texture_draw(g->uv, dx, y1, dx1, y2);
- glBitmap(0, 0, 0.0, 0.0, x + gt->pos_x, y, (const GLubyte *)&null_bitmap);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, gt->pitch * 8);
- glBitmap(gt->width, gt->height, 0.0, gt->pos_y, 0.0, 0.0, (const GLubyte *)gt->image);
- glBitmap(0, 0, 0.0, 0.0, -x - gt->pos_x, -y, (const GLubyte *)&null_bitmap);
return(1);
}
-
-int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
-{
- if (font->mode == BLF_MODE_BITMAP)
- return(blf_glyph_bitmap_render(font, g, x, y));
- return(blf_glyph_texture_render(font, g, x, y));
-}
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 64d95986867..d457225662f 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -78,7 +78,19 @@ typedef struct GlyphCacheBLF {
float descender;
} GlyphCacheBLF;
-typedef struct GlyphTextureBLF {
+typedef struct GlyphBLF {
+ struct GlyphBLF *next;
+ struct GlyphBLF *prev;
+
+ /* and the character, as UTF8 */
+ unsigned int c;
+
+ /* glyph box. */
+ rctf box;
+
+ /* advance size. */
+ float advance;
+
/* texture id where this glyph is store. */
GLuint tex;
@@ -86,6 +98,11 @@ typedef struct GlyphTextureBLF {
int xoff;
int yoff;
+ /* Bitmap data, from freetype. Take care that this
+ * can be NULL.
+ */
+ unsigned char *bitmap;
+
/* glyph width and height. */
int width;
int height;
@@ -99,38 +116,9 @@ typedef struct GlyphTextureBLF {
*/
float pos_x;
float pos_y;
-} GlyphTextureBLF;
-
-typedef struct GlyphBitmapBLF {
- /* image data. */
- unsigned char *image;
-
- int width;
- int height;
- int pitch;
- float pos_x;
- float pos_y;
-} GlyphBitmapBLF;
-
-typedef struct GlyphBLF {
- struct GlyphBLF *next;
- struct GlyphBLF *prev;
-
- /* and the character, as UTF8 */
- unsigned int c;
-
- /* glyph box. */
- rctf box;
-
- /* advance size. */
- float advance;
-
- /* texture information. */
- GlyphTextureBLF *tex_data;
-
- /* bitmap information. */
- GlyphBitmapBLF *bitmap_data;
+ /* with value of zero mean that we need build the texture. */
+ short build_tex;
} GlyphBLF;
typedef struct FontBLF {
@@ -140,9 +128,6 @@ typedef struct FontBLF {
/* filename or NULL. */
char *filename;
- /* draw mode, texture or bitmap. */
- int mode;
-
/* aspect ratio or scale. */
float aspect;
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index ce182267b93..4e7db115168 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -58,6 +58,7 @@ int set_listbasepointers(struct Main *main, struct ListBase **lb);
void free_libblock(struct ListBase *lb, void *idv);
void free_libblock_us(struct ListBase *lb, void *idv);
void free_main(struct Main *mainvar);
+void tag_main(struct Main *mainvar, int tag);
void splitIDname(char *name, char *left, int *nr);
void rename_id(struct ID *id, char *name);
diff --git a/source/blender/blenkernel/BKE_sculpt.h b/source/blender/blenkernel/BKE_sculpt.h
index 08db1ac632e..54cafc984a6 100644
--- a/source/blender/blenkernel/BKE_sculpt.h
+++ b/source/blender/blenkernel/BKE_sculpt.h
@@ -59,6 +59,10 @@ typedef struct SculptSession {
/* Used to cache the render of the active texture */
unsigned int texcache_side, *texcache, texcache_actual;
+ /* Layer brush persistence between strokes */
+ float (*mesh_co_orig)[3]; /* Copy of the mesh vertices' locations */
+ float *layer_disps; /* Displacements for each vertex */
+
void *cursor; /* wm handle */
struct SculptStroke *stroke;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 67f79d026d7..389d06a0414 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1030,6 +1030,20 @@ static void lib_indirect_test_id(ID *id)
}
}
+void tag_main(struct Main *mainvar, int tag)
+{
+ ListBase *lbarray[MAX_LIBARRAY];
+ ID *id;
+ int a;
+
+ a= set_listbasepointers(mainvar, lbarray);
+ while(a--) {
+ for(id= lbarray[a]->first; id; id= id->next) {
+ if(tag) id->flag |= LIB_DOIT;
+ else id->flag &= ~LIB_DOIT;
+ }
+ }
+}
/* if lib!=NULL, only all from lib local */
void all_local(Library *lib, int untagged_only)
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index d501a666a43..0a93874f24e 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -689,6 +689,13 @@ void sculptsession_free(Sculpt *sculpt)
if(ss->texcache)
MEM_freeN(ss->texcache);
+
+ if(ss->layer_disps)
+ MEM_freeN(ss->layer_disps);
+
+ if(ss->mesh_co_orig)
+ MEM_freeN(ss->mesh_co_orig);
+
MEM_freeN(ss);
sculpt->session= NULL;
}
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 3f23fbda484..f053c55cf10 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -126,82 +126,6 @@ void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int n
#define TRI_UVOFFSET (1./4.)
-
-BVHTree *bvhtree_build_from_smoke ( float mat[4][4], MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int numverts, float epsilon )
-{
- BVHTree *tree;
- float co[12];
- int i;
- MFace *tface = mfaces;
-
- // calc quads
- // todo
-
- tree = BLI_bvhtree_new ( numfaces, epsilon, 2, 6 );
-
- // fill tree
- for ( i = 0; i < numfaces; i++, tface++ )
- {
- VECCOPY ( &co[0*3], x[tface->v1].co );
- Mat4MulVecfl (mat, &co[0*3]);
- VECCOPY ( &co[1*3], x[tface->v2].co );
- Mat4MulVecfl (mat, &co[1*3]);
- VECCOPY ( &co[2*3], x[tface->v3].co );
- Mat4MulVecfl (mat, &co[2*3]);
-
- if ( tface->v4 )
- {
- VECCOPY ( &co[3*3], x[tface->v4].co );
- Mat4MulVecfl (mat, &co[3*3]);
- }
-
- BLI_bvhtree_insert ( tree, i, co, ( mfaces->v4 ? 4 : 3 ) );
- }
-
- // balance tree
- BLI_bvhtree_balance ( tree );
-
- return tree;
-}
-
-void bvhtree_update_from_smoke ( float mat[4][4], BVHTree * bvhtree, MFace *faces, int numfaces, MVert *x, int numverts)
-{
- int i;
- MFace *mfaces = faces;
- float co[12];
- int ret = 0;
-
- if ( !bvhtree )
- return;
-
- if ( x )
- {
- for ( i = 0; i < numfaces; i++, mfaces++ )
- {
- VECCOPY ( &co[0*3], x[mfaces->v1].co );
- Mat4MulVecfl (mat, &co[0*3]);
- VECCOPY ( &co[1*3], x[mfaces->v2].co );
- Mat4MulVecfl (mat, &co[1*3]);
- VECCOPY ( &co[2*3], x[mfaces->v3].co );
- Mat4MulVecfl (mat, &co[2*3]);
-
- if ( mfaces->v4 )
- {
- VECCOPY ( &co[3*3], x[mfaces->v4].co );
- Mat4MulVecfl (mat, &co[3*3]);
- }
-
- ret = BLI_bvhtree_update_node ( bvhtree, i, co, NULL, ( mfaces->v4 ? 4 : 3 ) );
-
- // check if tree is already full
- if ( !ret )
- break;
- }
-
- BLI_bvhtree_update_tree ( bvhtree );
- }
-}
-
int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm)
{
if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid)
@@ -283,12 +207,16 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive
// printf("res[0]: %d, res[1]: %d, res[2]: %d\n", smd->domain->res[0], smd->domain->res[1], smd->domain->res[2]);
// dt max is 0.1
- smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->amplify, smd->domain->p0, smd->domain->p1, 2.5 / FPS);
+ smd->domain->fluid = smoke_init(smd->domain->res, 0, smd->domain->p0, smd->domain->p1, 2.5 / FPS);
+ smd->domain->wt = smoke_turbulence_init(smd->domain->res, (smd->domain->flags & MOD_SMOKE_HIGHRES) ? (smd->domain->amplify + 1) : 0, smd->domain->noise);
smd->time = scene->r.cfra;
smd->domain->firstframe = smd->time;
smoke_initBlenderRNA(smd->domain->fluid, &(smd->domain->alpha), &(smd->domain->beta));
+ if(smd->domain->wt)
+ smoke_initWaveletBlenderRNA(smd->domain->wt, &(smd->domain->strength));
+
return 1;
}
else if((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
@@ -324,6 +252,10 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive
size_t max_points = 0;
size_t quads = 0, facecounter = 0;
+ // copy obmat
+ Mat4CpyMat4(scs->mat, ob->obmat);
+ Mat4CpyMat4(scs->mat_old, ob->obmat);
+
// count quads
for(i = 0; i < dm->getNumFaces(dm); i++)
{
@@ -451,7 +383,7 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive
if(!smd->coll->bvhtree)
{
- smd->coll->bvhtree = bvhtree_build_from_smoke ( ob->obmat, dm->getFaceArray(dm), dm->getNumFaces(dm), dm->getVertArray(dm), dm->getNumVerts(dm), 0.0 );
+ smd->coll->bvhtree = NULL; // bvhtree_build_from_smoke ( ob->obmat, dm->getFaceArray(dm), dm->getNumFaces(dm), dm->getVertArray(dm), dm->getNumVerts(dm), 0.0 );
}
}
@@ -504,12 +436,12 @@ void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *faces, int
if(INPR(side1, side1) > fsTri*fsTri)
{
float tmp = Normalize(side1);
- divs1 = (int)(tmp/fsTri);
+ divs1 = (int)ceil(tmp/fsTri);
}
if(INPR(side2, side2) > fsTri*fsTri)
{
float tmp = Normalize(side2);
- divs2 = (int)(tmp/fsTri);
+ divs2 = (int)ceil(tmp/fsTri);
/*
// debug
@@ -529,9 +461,11 @@ void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *faces, int
facecounter++;
- VECCOPY(p1, verts[faces[i].v3].co);
+ VECCOPY(p0, verts[faces[i].v3].co);
+ Mat4MulVecfl (ob->obmat, p0);
+ VECCOPY(p1, verts[faces[i].v4].co);
Mat4MulVecfl (ob->obmat, p1);
- VECCOPY(p2, verts[faces[i].v4].co);
+ VECCOPY(p2, verts[faces[i].v1].co);
Mat4MulVecfl (ob->obmat, p2);
VECSUB(side1, p1, p0);
@@ -541,12 +475,12 @@ void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *faces, int
if(INPR(side1, side1) > fsTri*fsTri)
{
float tmp = Normalize(side1);
- divs1 = (int)(tmp/fsTri);
+ divs1 = (int)ceil(tmp/fsTri);
}
if(INPR(side2, side2) > fsTri*fsTri)
{
float tmp = Normalize(side2);
- divs2 = (int)(tmp/fsTri);
+ divs2 = (int)ceil(tmp/fsTri);
}
(*tridivs)[3 * facecounter + 0] = divs1;
@@ -579,9 +513,11 @@ void smokeModifier_freeDomain(SmokeModifierData *smd)
MEM_freeN(smd->domain->tvoxbig);
if(smd->domain->fluid)
- {
smoke_free(smd->domain->fluid);
- }
+
+ if(smd->domain->wt)
+ smoke_turbulence_free(smd->domain->wt);
+
MEM_freeN(smd->domain);
smd->domain = NULL;
}
@@ -612,6 +548,10 @@ void smokeModifier_freeCollision(SmokeModifierData *smd)
smd->coll->bvhtree = NULL;
}
+ if(smd->coll->dm)
+ smd->coll->dm->release(smd->coll->dm);
+ smd->coll->dm = NULL;
+
MEM_freeN(smd->coll);
smd->coll = NULL;
}
@@ -631,7 +571,10 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
smd->domain->bind = NULL;
}
smd->domain->max_textures = 0;
- smd->domain->viewsettings = 0; // reset view for new frame
+ if(smd->domain->viewsettings < MOD_SMOKE_VIEW_USEBIG)
+ smd->domain->viewsettings = 0;
+ else
+ smd->domain->viewsettings = MOD_SMOKE_VIEW_USEBIG;
if(smd->domain->tray)
MEM_freeN(smd->domain->tray);
@@ -652,6 +595,12 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
smoke_free(smd->domain->fluid);
smd->domain->fluid = NULL;
}
+
+ if(smd->domain->wt)
+ {
+ smoke_turbulence_free(smd->domain->wt);
+ smd->domain->wt = NULL;
+ }
}
else if(smd->flow)
{
@@ -670,6 +619,11 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
BLI_bvhtree_free(smd->coll->bvhtree);
smd->coll->bvhtree = NULL;
}
+
+ if(smd->coll->dm)
+ smd->coll->dm->release(smd->coll->dm);
+ smd->coll->dm = NULL;
+
}
}
}
@@ -699,15 +653,17 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
/* set some standard values */
smd->domain->fluid = NULL;
+ smd->domain->wt = NULL;
smd->domain->eff_group = NULL;
smd->domain->fluid_group = NULL;
smd->domain->coll_group = NULL;
smd->domain->maxres = 32;
- smd->domain->amplify = 2;
+ smd->domain->amplify = 1;
smd->domain->omega = 1.0;
smd->domain->alpha = -0.001;
smd->domain->beta = 0.1;
smd->domain->flags = 0;
+ smd->domain->strength = 2.0;
smd->domain->noise = MOD_SMOKE_NOISEWAVE;
smd->domain->visibility = 1;
@@ -747,6 +703,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
smd->coll->points = NULL;
smd->coll->numpoints = 0;
smd->coll->bvhtree = NULL;
+ smd->coll->dm = NULL;
}
}
}
@@ -779,10 +736,14 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// XXX TODO
smd->time = scene->r.cfra;
- if(smd->coll->bvhtree)
- bvhtree_update_from_smoke ( ob->obmat, smd->coll->bvhtree, dm->getFaceArray(dm), dm->getNumFaces(dm), dm->getVertArray(dm), dm->getNumVerts(dm));
- else
- printf("smoke coll with no bvh\n");
+ if(smd->coll->dm)
+ smd->coll->dm->release(smd->coll->dm);
+
+ smd->coll->dm = CDDM_copy(dm);
+
+ // rigid movement support
+ Mat4CpyMat4(smd->coll->mat_old, smd->coll->mat);
+ Mat4CpyMat4(smd->coll->mat, ob->obmat);
}
else if(scene->r.cfra < smd->time)
{
@@ -802,9 +763,13 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
tstart();
- sds->viewsettings = 0; // reset view for new frame
+ /* reset view for new frame */
+ if(sds->viewsettings < MOD_SMOKE_VIEW_USEBIG)
+ sds->viewsettings = 0;
+ else
+ sds->viewsettings = MOD_SMOKE_VIEW_USEBIG;
- // check for 2nd domain, if not there -> no groups are necessary
+ /* check for 2nd domain, if not there -> no groups are necessary */
for(base = scene->base.first; base; base= base->next)
{
Object *ob1= base->object;
@@ -878,14 +843,12 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
ParticleData *pa = NULL;
int p = 0;
float *density = smoke_get_density(sds->fluid);
- float *bigdensity = smoke_get_bigdensity(sds->fluid);
+ float *bigdensity = smoke_turbulence_get_density(sds->wt);
float *heat = smoke_get_heat(sds->fluid);
float *velocity_x = smoke_get_velocity_x(sds->fluid);
float *velocity_y = smoke_get_velocity_y(sds->fluid);
float *velocity_z = smoke_get_velocity_z(sds->fluid);
- int bigres[3];
-
- smoke_get_bigres(smd->domain->fluid, bigres);
+ int bigres[3];
// mostly copied from particle code
for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++)
@@ -926,20 +889,25 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
{
heat[index] = sfs->temp;
density[index] = sfs->density;
+ /*
velocity_x[index] = pa->state.vel[0];
velocity_y[index] = pa->state.vel[1];
velocity_z[index] = pa->state.vel[2];
+ */
// we need different handling for the high-res feature
if(bigdensity)
{
// init all surrounding cells according to amplification, too
int i, j, k;
- for(i = 0; i < smd->domain->amplify; i++)
- for(j = 0; j < smd->domain->amplify; j++)
- for(k = 0; k < smd->domain->amplify; k++)
+
+ smoke_turbulence_get_res(smd->domain->wt, bigres);
+
+ for(i = 0; i < smd->domain->amplify + 1; i++)
+ for(j = 0; j < smd->domain->amplify + 1; j++)
+ for(k = 0; k < smd->domain->amplify + 1; k++)
{
- index = smoke_get_index(smd->domain->amplify * cell[0] + i, bigres[0], smd->domain->amplify * cell[1] + j, bigres[1], smd->domain->amplify * cell[2] + k);
+ index = smoke_get_index((smd->domain->amplify + 1)* cell[0] + i, bigres[0], (smd->domain->amplify + 1)* cell[1] + j, bigres[1], (smd->domain->amplify + 1)* cell[2] + k);
bigdensity[index] = sfs->density;
}
}
@@ -957,11 +925,14 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
{
// init all surrounding cells according to amplification, too
int i, j, k;
- for(i = 0; i < smd->domain->amplify; i++)
- for(j = 0; j < smd->domain->amplify; j++)
- for(k = 0; k < smd->domain->amplify; k++)
+
+ smoke_turbulence_get_res(smd->domain->wt, bigres);
+
+ for(i = 0; i < smd->domain->amplify + 1; i++)
+ for(j = 0; j < smd->domain->amplify + 1; j++)
+ for(k = 0; k < smd->domain->amplify + 1; k++)
{
- index = smoke_get_index(smd->domain->amplify * cell[0] + i, bigres[0], smd->domain->amplify * cell[1] + j, bigres[1], smd->domain->amplify * cell[2] + k);
+ index = smoke_get_index((smd->domain->amplify + 1)* cell[0] + i, bigres[0], (smd->domain->amplify + 1)* cell[1] + j, bigres[1], (smd->domain->amplify + 1)* cell[2] + k);
bigdensity[index] = 0.f;
}
}
@@ -1039,16 +1010,14 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
{
// we got nice collision object
SmokeCollSettings *scs = smd2->coll;
- int cell[3];
- size_t index = 0;
size_t i, j;
unsigned char *obstacles = smoke_get_obstacle(smd->domain->fluid);
- // int BLI_bvhtree_find_nearest(BVHTree *tree, const float *co, BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata);
-
for(i = 0; i < scs->numpoints; i++)
{
int badcell = 0;
+ size_t index = 0;
+ int cell[3];
// 1. get corresponding cell
get_cell(smd, &scs->points[3 * i], cell, 0);
@@ -1108,6 +1077,8 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// simulate the actual smoke (c++ code in intern/smoke)
smoke_step(sds->fluid);
+ if(sds->wt)
+ smoke_turbulence_step(sds->wt, sds->fluid);
tend();
printf ( "Frame: %d, Time: %f\n", (int)smd->time, ( float ) tval() );
@@ -1163,7 +1134,7 @@ void smoke_prepare_bigView(SmokeModifierData *smd, float *light)
size_t i = 0;
int bigres[3];
- smoke_get_bigres(smd->domain->fluid, bigres);
+ smoke_turbulence_get_res(smd->domain->wt, bigres);
if(!smd->domain->traybig)
{
@@ -1176,14 +1147,14 @@ void smoke_prepare_bigView(SmokeModifierData *smd, float *light)
smd->domain->tvoxbig = MEM_callocN(sizeof(float)*bigres[0]*bigres[1]*bigres[2], "Smoke_tVoxBig");
}
- density = smoke_get_bigdensity(smd->domain->fluid);
+ density = smoke_turbulence_get_density(smd->domain->wt);
for (i = 0; i < bigres[0] * bigres[1] * bigres[2]; i++)
{
// Transparency computation
// formula taken from "Visual Simulation of Smoke" / Fedkiw et al. pg. 4
// T_vox = exp(-C_ext * h)
// C_ext/sigma_t = density * C_ext
- smoke_set_bigtvox(smd, i, exp(-density[i] * 7.0 * smd->domain->dx / smd->domain->amplify) );
+ smoke_set_bigtvox(smd, i, exp(-density[i] * 7.0 * smd->domain->dx / (smd->domain->amplify + 1)) );
}
smoke_calc_transparency(smd, light, 1);
}
@@ -1262,7 +1233,7 @@ static void calc_voxel_transp_big(SmokeModifierData *smd, int *pixel, float *tRa
int bigres[3];
size_t index;
- smoke_get_bigres(smd->domain->fluid, bigres);
+ smoke_turbulence_get_res(smd->domain->wt, bigres);
index = smoke_get_index(pixel[0], bigres[0], pixel[1], bigres[1], pixel[2]);
/*
@@ -1394,11 +1365,11 @@ static void get_bigcell(struct SmokeModifierData *smd, float *pos, int *cell, in
{
float tmp[3];
int res[3];
- smoke_get_bigres(smd->domain->fluid, res);
+ smoke_turbulence_get_res(smd->domain->wt, res);
VECSUB(tmp, pos, smd->domain->p0);
- VecMulf(tmp, smd->domain->amplify / smd->domain->dx );
+ VecMulf(tmp, (smd->domain->amplify + 1)/ smd->domain->dx );
if(correct)
{
@@ -1446,8 +1417,8 @@ void smoke_calc_transparency(struct SmokeModifierData *smd, float *light, int bi
}
else
{
- smoke_get_bigres(smd->domain->fluid, res);
- bigfactor = 1.0 / smd->domain->amplify;
+ smoke_turbulence_get_res(smd->domain->wt, res);
+ bigfactor = 1.0 / (smd->domain->amplify + 1);
}
#pragma omp parallel for schedule(static) private(y, z) shared(big, smd, light, res, bigfactor)
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 5c538a66ed1..347837d1dd0 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -371,9 +371,12 @@ void sound_update_playing(struct bContext *C)
action = 3;
else
{
- int position = AUD_getPosition(handle->handle);
- if(fabs(position - (cfra - handle->startframe) / fps) > SOUND_PLAYBACK_LAMBDA)
-// AUD_XXX if(fabs(position * fps - cfra + handle->startframe) > 5.0f)
+ float diff = AUD_getPosition(handle->handle) - (cfra - handle->startframe) / fps;
+// AUD_XXX float diff = AUD_getPosition(handle->handle) * fps - cfra + handle->startframe
+ if(diff < 0.0)
+ diff = -diff;
+ if(diff > SOUND_PLAYBACK_LAMBDA)
+// AUD_XXX if(diff > 5.0f)
{
action = 2;
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index d8ac61dd146..080c37a26e0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3661,13 +3661,23 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
smd->domain->smd = smd;
smd->domain->fluid = NULL;
+ smd->domain->wt = NULL;
smd->domain->tvox = NULL;
smd->domain->tray = NULL;
smd->domain->tvoxbig = NULL;
smd->domain->traybig = NULL;
smd->domain->bind = NULL;
- smd->domain->max_textures = 0;
- smd->domain->viewsettings = 0; // reset view for new frame
+ smd->domain->max_textures= 0;
+
+ // do_versions trick
+ if(smd->domain->strength < 1.0)
+ smd->domain->strength = 2.0;
+
+ // reset 3dview
+ if(smd->domain->viewsettings < MOD_SMOKE_VIEW_USEBIG)
+ smd->domain->viewsettings = 0;
+ else
+ smd->domain->viewsettings = MOD_SMOKE_VIEW_USEBIG;
}
else if(smd->type==MOD_SMOKE_TYPE_FLOW)
{
@@ -9273,7 +9283,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* move to cameras */
if(sce->r.scemode & R_PANORAMA) {
- for(base=scene->base.first; base; base=base->next) {
+ for(base=sce->base.first; base; base=base->next) {
ob= newlibadr(fd, lib, base->object);
if(ob->type == OB_CAMERA && !ob->id.lib) {
@@ -9431,10 +9441,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* set new bump for unused slots */
for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) {
- if(!ma->mtex[a]->tex)
- ma->mtex[a]->texflag |= MTEX_NEW_BUMP;
- else if(((Tex*)newlibadr(fd, ma->id.lib, ma->mtex[a]->tex))->type == 0)
+ tex= ma->mtex[a]->tex;
+ if(!tex)
ma->mtex[a]->texflag |= MTEX_NEW_BUMP;
+ else {
+ tex= (Tex*)newlibadr(fd, ma->id.lib, tex);
+ if(tex && tex->type == 0) /* invalid type */
+ ma->mtex[a]->texflag |= MTEX_NEW_BUMP;
+ }
}
}
}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 67ee29a1d3c..cb9216ec1c5 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -248,9 +248,6 @@ void uiStyleInit(void)
BLF_size(11, U.dpi);
BLF_size(12, U.dpi);
BLF_size(14, U.dpi);
-
- if (!(U.transopts & USER_USETEXTUREFONT))
- BLF_mode(BLF_MODE_BITMAP);
}
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index edf01f4da2c..0b5edf54a25 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -911,82 +911,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
draw_constraint_spaceselect(block, con, xco, yco-(73+theight), is_armature_owner(ob), -1);
}
break;
-#endif /* DISABLE_PYTHON */
-
- /*case CONSTRAINT_TYPE_RIGIDBODYJOINT:
- {
- if (data->type==CONSTRAINT_RB_GENERIC6DOF) {
- // Draw Pairs of LimitToggle+LimitValue
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 1, B_CONSTRAINT_TEST, "LinMinX", xco, yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-offsetY, (textButWidth-5), 18, &(data->minLimit[0]), -extremeLin, extremeLin, 0.1,0.5,"min x limit");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 1, B_CONSTRAINT_TEST, "LinMaxX", xco+(width-(textButWidth-5)-togButWidth), yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum x limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-offsetY, (textButWidth), 18, &(data->maxLimit[0]), -extremeLin, extremeLin, 0.1,0.5,"max x limit");
- uiBlockEndAlign(block);
-
- offsetY += 20;
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 2, B_CONSTRAINT_TEST, "LinMinY", xco, yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum y limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-offsetY, (textButWidth-5), 18, &(data->minLimit[1]), -extremeLin, extremeLin, 0.1,0.5,"min y limit");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 2, B_CONSTRAINT_TEST, "LinMaxY", xco+(width-(textButWidth-5)-togButWidth), yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum y limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-offsetY, (textButWidth), 18, &(data->maxLimit[1]), -extremeLin, extremeLin, 0.1,0.5,"max y limit");
- uiBlockEndAlign(block);
-
- offsetY += 20;
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 4, B_CONSTRAINT_TEST, "LinMinZ", xco, yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum z limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-offsetY, (textButWidth-5), 18, &(data->minLimit[2]), -extremeLin, extremeLin, 0.1,0.5,"min z limit");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 4, B_CONSTRAINT_TEST, "LinMaxZ", xco+(width-(textButWidth-5)-togButWidth), yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum z limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-offsetY, (textButWidth), 18, &(data->maxLimit[2]), -extremeLin, extremeLin, 0.1,0.5,"max z limit");
- uiBlockEndAlign(block);
- offsetY += 20;
- }
- if ((data->type==CONSTRAINT_RB_GENERIC6DOF) || (data->type==CONSTRAINT_RB_CONETWIST)) {
- // Draw Pairs of LimitToggle+LimitValue /
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 8, B_CONSTRAINT_TEST, "AngMinX", xco, yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-offsetY, (textButWidth-5), 18, &(data->minLimit[3]), -extremeAngX, extremeAngX, 0.1,0.5,"min x limit");
- uiBlockEndAlign(block);
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 8, B_CONSTRAINT_TEST, "AngMaxX", xco+(width-(textButWidth-5)-togButWidth), yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum x limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-offsetY, (textButWidth), 18, &(data->maxLimit[3]), -extremeAngX, extremeAngX, 0.1,0.5,"max x limit");
- uiBlockEndAlign(block);
-
- offsetY += 20;
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 16, B_CONSTRAINT_TEST, "AngMinY", xco, yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum y limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-offsetY, (textButWidth-5), 18, &(data->minLimit[4]), -extremeAngY, extremeAngY, 0.1,0.5,"min y limit");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 16, B_CONSTRAINT_TEST, "AngMaxY", xco+(width-(textButWidth-5)-togButWidth), yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum y limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-offsetY, (textButWidth), 18, &(data->maxLimit[4]), -extremeAngY, extremeAngY, 0.1,0.5,"max y limit");
- uiBlockEndAlign(block);
-
- offsetY += 20;
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 32, B_CONSTRAINT_TEST, "AngMinZ", xco, yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum z limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-offsetY, (textButWidth-5), 18, &(data->minLimit[5]), -extremeAngZ, extremeAngZ, 0.1,0.5,"min z limit");
- uiBlockEndAlign(block);
-
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, 32, B_CONSTRAINT_TEST, "AngMaxZ", xco+(width-(textButWidth-5)-togButWidth), yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use maximum z limit");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+(width-textButWidth-5), yco-offsetY, (textButWidth), 18, &(data->maxLimit[5]), -extremeAngZ, extremeAngZ, 0.1,0.5,"max z limit");
- uiBlockEndAlign(block);
- }
-
- }
- break;
- */
+#endif
case CONSTRAINT_TYPE_NULL:
{
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 86910706540..72ca97921ef 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -4299,6 +4299,18 @@ static int smooth_vertex(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
+static int smooth_vertex_exec(bContext *C, wmOperator *op)
+{
+ int repeat = RNA_int_get(op->ptr, "repeat");
+ int i;
+
+ if (!repeat) repeat = 1;
+
+ for (i=0; i<repeat; i++) {
+ smooth_vertex(C, op);
+ }
+}
+
void MESH_OT_vertices_smooth(wmOperatorType *ot)
{
/* identifiers */
@@ -4306,11 +4318,13 @@ void MESH_OT_vertices_smooth(wmOperatorType *ot)
ot->idname= "MESH_OT_vertices_smooth";
/* api callbacks */
- ot->exec= smooth_vertex;
+ ot->exec= smooth_vertex_exec;
ot->poll= ED_operator_editmesh;
/* flags */
- ot->flag= OPTYPE_UNDO;
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Number of times to smooth the mesh", "", 1, INT_MAX);
}
void vertexnoise(Object *obedit, EditMesh *em)
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index b1dcef39eee..94d3f39d172 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -145,8 +145,6 @@ typedef struct StrokeCache {
ViewContext vc;
bglMats *mats;
- float *layer_disps; /* Displacements for each vertex */
- float (*mesh_store)[3]; /* Copy of the mesh vertices' locations */
short (*orig_norms)[3]; /* Copy of the mesh vertices' normals */
float (*face_norms)[3]; /* Copy of the mesh faces' normals */
float rotation; /* Texture rotation (radians) for anchored and rake modes */
@@ -459,7 +457,7 @@ static void do_layer_brush(Sculpt *sd, SculptSession *ss, const ListBase *active
calc_area_normal(sd, area_normal, active_verts);
while(node){
- float *disp= &ss->cache->layer_disps[node->Index];
+ float *disp= &ss->layer_disps[node->Index];
float *co= ss->mvert[node->Index].co;
float val[3];
@@ -469,9 +467,9 @@ static void do_layer_brush(Sculpt *sd, SculptSession *ss, const ListBase *active
if((lim < 0 && *disp < lim) || (lim > 0 && *disp > lim))
*disp = lim;
- val[0] = ss->cache->mesh_store[node->Index][0]+area_normal[0] * *disp*ss->cache->scale[0];
- val[1] = ss->cache->mesh_store[node->Index][1]+area_normal[1] * *disp*ss->cache->scale[1];
- val[2] = ss->cache->mesh_store[node->Index][2]+area_normal[2] * *disp*ss->cache->scale[2];
+ val[0] = ss->mesh_co_orig[node->Index][0]+area_normal[0] * *disp*ss->cache->scale[0];
+ val[1] = ss->mesh_co_orig[node->Index][1]+area_normal[1] * *disp*ss->cache->scale[1];
+ val[2] = ss->mesh_co_orig[node->Index][2]+area_normal[2] * *disp*ss->cache->scale[2];
sculpt_clip(sd, co, val);
@@ -1170,10 +1168,6 @@ static float unproject_brush_radius(SculptSession *ss, float offset)
static void sculpt_cache_free(StrokeCache *cache)
{
- if(cache->layer_disps)
- MEM_freeN(cache->layer_disps);
- if(cache->mesh_store)
- MEM_freeN(cache->mesh_store);
if(cache->orig_norms)
MEM_freeN(cache->orig_norms);
if(cache->face_norms)
@@ -1209,14 +1203,24 @@ static void sculpt_update_cache_invariants(Sculpt *sd, bContext *C, wmOperator *
sculpt_update_mesh_elements(C);
- if(sd->brush->sculpt_tool == SCULPT_TOOL_LAYER)
- cache->layer_disps = MEM_callocN(sizeof(float) * sd->session->totvert, "layer brush displacements");
+ /* Initialize layer brush displacements */
+ if(sd->brush->sculpt_tool == SCULPT_TOOL_LAYER &&
+ (!sd->session->layer_disps || !(sd->brush->flag & BRUSH_PERSISTENT))) {
+ if(sd->session->layer_disps)
+ MEM_freeN(sd->session->layer_disps);
+ sd->session->layer_disps = MEM_callocN(sizeof(float) * sd->session->totvert, "layer brush displacements");
+ }
/* Make copies of the mesh vertex locations and normals for some tools */
if(sd->brush->sculpt_tool == SCULPT_TOOL_LAYER || (sd->brush->flag & BRUSH_ANCHORED)) {
- cache->mesh_store= MEM_mallocN(sizeof(float) * 3 * sd->session->totvert, "sculpt mesh vertices copy");
- for(i = 0; i < sd->session->totvert; ++i)
- VecCopyf(cache->mesh_store[i], sd->session->mvert[i].co);
+ if(sd->brush->sculpt_tool != SCULPT_TOOL_LAYER ||
+ !sd->session->mesh_co_orig || !(sd->brush->flag & BRUSH_PERSISTENT)) {
+ if(!sd->session->mesh_co_orig)
+ sd->session->mesh_co_orig= MEM_mallocN(sizeof(float) * 3 * sd->session->totvert,
+ "sculpt mesh vertices copy");
+ for(i = 0; i < sd->session->totvert; ++i)
+ VecCopyf(sd->session->mesh_co_orig[i], sd->session->mvert[i].co);
+ }
if(sd->brush->flag & BRUSH_ANCHORED) {
cache->orig_norms= MEM_mallocN(sizeof(short) * 3 * sd->session->totvert, "Sculpt orig norm");
@@ -1360,9 +1364,9 @@ static void sculpt_restore_mesh(Sculpt *sd)
int i;
/* Restore the mesh before continuing with anchored stroke */
- if((sd->brush->flag & BRUSH_ANCHORED) && cache->mesh_store) {
+ if((sd->brush->flag & BRUSH_ANCHORED) && ss->mesh_co_orig) {
for(i = 0; i < ss->totvert; ++i) {
- VecCopyf(ss->mvert[i].co, cache->mesh_store[i]);
+ VecCopyf(ss->mvert[i].co, ss->mesh_co_orig[i]);
ss->mvert[i].no[0] = cache->orig_norms[i][0];
ss->mvert[i].no[1] = cache->orig_norms[i][1];
ss->mvert[i].no[2] = cache->orig_norms[i][2];
@@ -1375,7 +1379,7 @@ static void sculpt_restore_mesh(Sculpt *sd)
}
if(sd->brush->sculpt_tool == SCULPT_TOOL_LAYER)
- memset(cache->layer_disps, 0, sizeof(float) * ss->totvert);
+ memset(ss->layer_disps, 0, sizeof(float) * ss->totvert);
}
}
@@ -1610,6 +1614,38 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
RNA_def_float(ot->srna, "depth", 0.0f, 0.0f, FLT_MAX, "depth", "", 0.0f, FLT_MAX);
}
+/**** Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) ****/
+
+static int sculpt_set_persistent_base(bContext *C, wmOperator *op)
+{
+ SculptSession *ss = CTX_data_tool_settings(C)->sculpt->session;
+
+ if(ss) {
+ if(ss->layer_disps)
+ MEM_freeN(ss->layer_disps);
+ ss->layer_disps = NULL;
+
+ if(ss->mesh_co_orig)
+ MEM_freeN(ss->mesh_co_orig);
+ ss->mesh_co_orig = NULL;
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+static void SCULPT_OT_set_persistent_base(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Set Persistent Base";
+ ot->idname= "SCULPT_OT_set_persistent_base";
+
+ /* api callbacks */
+ ot->exec= sculpt_set_persistent_base;
+ ot->poll= sculpt_mode_poll;
+
+ ot->flag= OPTYPE_REGISTER;
+}
+
/**** Toggle operator for turning sculpt mode on or off ****/
static int sculpt_toggle_mode(bContext *C, wmOperator *op)
@@ -1670,4 +1706,5 @@ void ED_operatortypes_sculpt()
WM_operatortype_append(SCULPT_OT_brush_stroke);
WM_operatortype_append(SCULPT_OT_sculptmode_toggle);
WM_operatortype_append(SCULPT_OT_brush_curve_preset);
+ WM_operatortype_append(SCULPT_OT_set_persistent_base);
}
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 614017cc4c6..59d6a0ec6be 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -558,7 +558,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
"world", "object", "mesh", "armature", "lattice", "curve",
"meta_ball", "lamp", "camera", "material", "material_slot",
"texture", "texture_slot", "bone", "edit_bone", "particle_system",
- "cloth", "soft_body", "fluid", "collision", "brush", NULL};
+ "cloth", "soft_body", "fluid", "smoke", "collision", "brush", NULL};
CTX_data_dir_set(result, dir);
return 1;
@@ -691,6 +691,17 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
}
+
+ else if(CTX_data_equals(member, "smoke")) {
+ PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
+
+ if(ptr && ptr->data) {
+ Object *ob= ptr->data;
+ ModifierData *md= modifiers_findByType(ob, eModifierType_Smoke);
+ CTX_data_pointer_set(result, &ob->id, &RNA_SmokeModifier, md);
+ return 1;
+ }
+ }
else if(CTX_data_equals(member, "collision")) {
PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index f9d46cff9e6..05336d29dc3 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -5349,7 +5349,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
float *buffer = NULL;
int res[3];
float bigfactor = 1.0;
- int big = smd->domain->flags & MOD_SMOKE_HIGHRES;
+ int big = (smd->domain->flags & MOD_SMOKE_HIGHRES) && (smd->domain->viewsettings & MOD_SMOKE_VIEW_USEBIG);
int new = 0;
// GUI sent redraw event
@@ -5367,8 +5367,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
else
{
- smoke_get_bigres(smd->domain->fluid, res);
- bigfactor = 1.0 / smd->domain->amplify;
+ smoke_turbulence_get_res(smd->domain->wt, res);
+ bigfactor = 1.0 / (smd->domain->amplify + 1);
}
wmLoadMatrix(rv3d->viewmat);
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index f88d3b68ebf..adb7fa2303d 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -85,6 +85,7 @@ typedef struct Brush {
#define BRUSH_DIR_IN 512
#define BRUSH_SPACE 1024
#define BRUSH_SMOOTH_STROKE 2048
+#define BRUSH_PERSISTENT 4096
/* Brush.blend */
#define BRUSH_BLEND_MIX 0
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 5b566a244b4..8428e750025 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -224,7 +224,7 @@ typedef struct Material {
#define MA_SPEC_WARDISO 4
/* dynamode */
-#define MA_DRAW_DYNABUTS 1
+#define MA_DRAW_DYNABUTS 1 /* deprecated */
#define MA_FH_NOR 2
/* ramps */
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index 3ecfe416c79..f7f1d3b53bd 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -139,7 +139,7 @@ typedef struct TFace {
#define ME_DRAWCREASES (1 << 6)
#define ME_DRAWSEAMS (1 << 7)
#define ME_DRAWSHARP (1 << 8)
-#define ME_DRAWBWEIGHTS (1 << 8)
+#define ME_DRAWBWEIGHTS (1 << 9)
#define ME_DRAW_EDGELEN (1 << 10)
#define ME_DRAW_FACEAREA (1 << 11)
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index c3efc5e04dd..7d64862ba32 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -44,6 +44,7 @@
#define MOD_SMOKE_VIEW_CHANGETOBIG (1<<5)
#define MOD_SMOKE_VIEW_REDRAWNICE (1<<6)
#define MOD_SMOKE_VIEW_REDRAWALL (1<<7)
+#define MOD_SMOKE_VIEW_USEBIG (1<<8)
typedef struct SmokeDomainSettings {
struct SmokeModifierData *smd; /* for fast RNA access */
@@ -76,7 +77,8 @@ typedef struct SmokeDomainSettings {
short noise; /* noise type: wave, curl, anisotropic */
short pad2;
int pad;
- int pad3;
+ float strength;
+ struct WTURBULENCE *wt; // WTURBULENCE object, if active
} SmokeDomainSettings;
@@ -103,6 +105,7 @@ typedef struct SmokeFlowSettings {
typedef struct SmokeCollSettings {
struct SmokeModifierData *smd; /* for fast RNA access */
struct BVHTree *bvhtree; /* bounding volume hierarchy for this cloth object */
+ struct DerivedMesh *dm;
float *points;
float *points_old;
float *vel;
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index 7325181ee14..7367ee3cf71 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -143,7 +143,11 @@ typedef struct Tex {
float dist_amount, ns_outscale;
/* newnoise: voronoi nearest neighbour weights, minkovsky exponent, distance metric & color type */
- float vn_w1, vn_w2, vn_w3, vn_w4, vn_mexp;
+ float vn_w1;
+ float vn_w2;
+ float vn_w3;
+ float vn_w4;
+ float vn_mexp;
short vn_distm, vn_coltype;
short noisedepth, noisetype;
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 2aa0fcc79ff..343df04d4ff 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -67,6 +67,10 @@ IF(NOT WITH_ELBEEM)
ADD_DEFINITIONS(-DDISABLE_ELBEEM)
ENDIF(NOT WITH_ELBEEM)
+IF(WITH_FFTW3)
+ ADD_DEFINITIONS(-DFFTW3=1)
+ENDIF(WITH_FFTW3)
+
# Build makesrna executable
ADD_EXECUTABLE(makesrna ${SRC} ${INC_FILES})
TARGET_LINK_LIBRARIES(makesrna bf_dna)
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index 6c8038bd509..1a3687af51e 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -58,6 +58,9 @@ if env['WITH_BF_LCMS']:
if env['WITH_BF_GAMEENGINE']:
defs.append('GAMEBLENDER=1')
+
+if env['WITH_BF_FFTW3']:
+ defs.append('FFTW3=1')
makesrna_tool.Append(CPPDEFINES=defs)
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 2bb4333365b..1bc3987139f 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -94,6 +94,7 @@ void rna_def_brush(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
+
static EnumPropertyItem prop_blend_items[] = {
{BRUSH_BLEND_MIX, "MIX", 0, "Mix", "Use mix blending mode while painting."},
{BRUSH_BLEND_ADD, "ADD", 0, "Add", "Use add blending mode while painting."},
@@ -104,11 +105,13 @@ void rna_def_brush(BlenderRNA *brna)
{BRUSH_BLEND_ERASE_ALPHA, "ERASE_ALPHA", 0, "Erase Alpha", "Erase alpha while painting."},
{BRUSH_BLEND_ADD_ALPHA, "ADD_ALPHA", 0, "Add Alpha", "Add alpha while painting."},
{0, NULL, 0, NULL, NULL}};
+
static EnumPropertyItem prop_texture_mode_items[] = {
{BRUSH_TEX_DRAG, "TEX_DRAG", 0, "Drag", ""},
{BRUSH_TEX_TILE, "TEX_TILE", 0, "Tile", ""},
{BRUSH_TEX_3D, "TEX_3D", 0, "3D", ""},
{0, NULL, 0, NULL, NULL}};
+
static EnumPropertyItem prop_sculpt_tool_items[] = {
{SCULPT_TOOL_DRAW, "DRAW", 0, "Draw", ""},
{SCULPT_TOOL_SMOOTH, "SMOOTH", 0, "Smooth", ""},
@@ -182,9 +185,9 @@ void rna_def_brush(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_TORUS);
RNA_def_property_ui_text(prop, "Wrap", "Enable torus wrapping while painting.");
- prop= RNA_def_property(srna, "opacity_pressure", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "strength_pressure", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE);
- RNA_def_property_ui_text(prop, "Opacity Pressure", "Enable tablet pressure sensitivity for opacity.");
+ RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength.");
prop= RNA_def_property(srna, "size_pressure", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE);
@@ -217,6 +220,10 @@ void rna_def_brush(BlenderRNA *brna)
prop= RNA_def_property(srna, "smooth_stroke", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SMOOTH_STROKE);
RNA_def_property_ui_text(prop, "Smooth Stroke", "Brush lags behind mouse and follows a smoother path.");
+
+ prop= RNA_def_property(srna, "persistent", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PERSISTENT);
+ RNA_def_property_ui_text(prop, "Persistent", "Sculpts on a persistent layer of the mesh.");
/* not exposed in the interface yet
prop= RNA_def_property(srna, "fixed_tex", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 42c6f74b6ec..755089b9af1 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -77,6 +77,20 @@ void rna_remlink(ListBase *listbase, void *vlink)
if (listbase->first == link) listbase->first = link->next;
}
+PropertyDefRNA *rna_findlink(ListBase *listbase, const char *identifier)
+{
+ Link *link;
+
+ for(link=listbase->first; link; link=link->next) {
+ PropertyRNA *prop= ((PropertyDefRNA *)link)->prop;
+ if(prop && (strcmp(prop->identifier, identifier)==0)) {
+ return (PropertyDefRNA *)link;
+ }
+ }
+
+ return NULL;
+}
+
void rna_freelinkN(ListBase *listbase, void *vlink)
{
rna_remlink(listbase, vlink);
@@ -821,6 +835,13 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
}
dcont= rna_find_container_def(cont);
+
+ /* XXX - toto, detect supertype collisions */
+ if(rna_findlink(&dcont->properties, identifier)) {
+ fprintf(stderr, "RNA_def_property: duplicate identifier \"%s\"\n", identifier);
+ DefRNA.error= 1;
+ }
+
dprop= MEM_callocN(sizeof(PropertyDefRNA), "PropertyDefRNA");
rna_addtail(&dcont->properties, dprop);
}
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 99f527f8875..a8c7032733f 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -259,6 +259,7 @@ void rna_iterator_array_end(struct CollectionPropertyIterator *iter);
void rna_addtail(struct ListBase *listbase, void *vlink);
void rna_freelinkN(struct ListBase *listbase, void *vlink);
void rna_freelistN(struct ListBase *listbase);
+PropertyDefRNA *rna_findlink(ListBase *listbase, const char *identifier);
StructDefRNA *rna_find_struct_def(StructRNA *srna);
FunctionDefRNA *rna_find_function_def(FunctionRNA *func);
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 87efe6c39c0..bf4f9734770 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -66,6 +66,11 @@ static PointerRNA rna_Material_strand_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_MaterialStrand, ptr->id.data);
}
+static PointerRNA rna_Material_physics_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_MaterialPhysics, ptr->id.data);
+}
+
static void rna_Material_type_set(PointerRNA *ptr, int value)
{
Material *ma= (Material*)ptr->data;
@@ -1123,6 +1128,46 @@ void rna_def_material_strand(BlenderRNA *brna)
RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
}
+void rna_def_material_physics(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "MaterialPhysics", NULL);
+ RNA_def_struct_sdna(srna, "Material");
+ RNA_def_struct_nested(brna, srna, "Material");
+ RNA_def_struct_ui_text(srna, "Material Physics", "Physics settings for a Material datablock.");
+
+ prop= RNA_def_property(srna, "align_to_normal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FH_NOR);
+ RNA_def_property_ui_text(prop, "Align to Normal", "Align dynamic game objects along the surface normal, when inside the physics distance area");
+
+ prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "friction");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Friction", "Coulomb friction coeffecient, when inside the physics distance area");
+
+ prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fh");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Force", "Upward spring force, when inside the physics distance area");
+
+ prop= RNA_def_property(srna, "elasticity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "reflect");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Elasticity", "Elasticity of collisions");
+
+ prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fhdist");
+ RNA_def_property_range(prop, 0, 20);
+ RNA_def_property_ui_text(prop, "Distance", "Distance of the physics area");
+
+ prop= RNA_def_property(srna, "damp", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "xyfrict");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Damping", "Damping of the spring force, when inside the physics distance area");
+}
+
void RNA_def_material(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1322,6 +1367,11 @@ void RNA_def_material(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "MaterialStrand");
RNA_def_property_pointer_funcs(prop, "rna_Material_strand_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Strand", "Strand settings for the material.");
+
+ prop= RNA_def_property(srna, "physics", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "MaterialPhysics");
+ RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Physics", "Game physics settings.");
/* nodetree */
prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
@@ -1344,6 +1394,7 @@ void RNA_def_material(BlenderRNA *brna)
rna_def_material_sss(brna);
rna_def_material_mtex(brna);
rna_def_material_strand(brna);
+ rna_def_material_physics(brna);
}
void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname)
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 525814f1f5e..769c4f485fa 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1339,6 +1339,64 @@ static void rna_def_mesh(BlenderRNA *brna)
prop= RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "key");
RNA_def_property_ui_text(prop, "Shape Keys", "");
+
+ /* Mesh Draw Options for Edit Mode*/
+
+ prop= RNA_def_property(srna, "draw_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEDGES);
+ RNA_def_property_ui_text(prop, "Draw Edges", "Displays selected edges using hilights in the 3d view and UV editor");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "draw_faces", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWFACES);
+ RNA_def_property_ui_text(prop, "Draw Faces", "Displays all faces as shades in the 3d view and UV editor");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "draw_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWNORMALS);
+ RNA_def_property_ui_text(prop, "Draw Normals", "Displays face normals as lines");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "draw_vertex_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_VNORMALS);
+ RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Displays vertex normals as lines");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "draw_creases", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWCREASES);
+ RNA_def_property_ui_text(prop, "Draw Creases", "Displays creases created for subsurf weighting");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "draw_bevel_weights", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWBWEIGHTS);
+ RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Displays weights created for the Bevel modifier");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "draw_seams", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSEAMS);
+ RNA_def_property_ui_text(prop, "Draw Seams", "Displays UV unwrapping seams");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "draw_sharp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSHARP);
+ RNA_def_property_ui_text(prop, "Draw Sharp", "Displays sharp edges, used with the EdgeSplit modifier");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+
+ prop= RNA_def_property(srna, "draw_edge_lenght", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_EDGELEN);
+ RNA_def_property_ui_text(prop, "Edge Length", "Displays selected edge lengths");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "draw_edge_angle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_EDGEANG);
+ RNA_def_property_ui_text(prop, "Edge Angles", "Displays the angles in the selected edges in degrees");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "draw_face_area", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FACEAREA);
+ RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index e142bc4b2aa..ad16c5a7c5c 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -118,19 +118,19 @@ void rna_def_metaelement(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Radius", "");
RNA_def_property_update(prop, 0, "rna_MetaElem_update_data");
- prop= RNA_def_property(srna, "sizex", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "expx");
RNA_def_property_range(prop, 0.0f, 20.0f);
RNA_def_property_ui_text(prop, "Size X", "Size of element, use of components depends on element type.");
RNA_def_property_update(prop, 0, "rna_MetaElem_update_data");
- prop= RNA_def_property(srna, "sizey", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "expy");
RNA_def_property_range(prop, 0.0f, 20.0f);
RNA_def_property_ui_text(prop, "Size Y", "Size of element, use of components depends on element type.");
RNA_def_property_update(prop, 0, "rna_MetaElem_update_data");
- prop= RNA_def_property(srna, "sizez", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "size_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "expz");
RNA_def_property_range(prop, 0.0f, 20.0f);
RNA_def_property_ui_text(prop, "Size Z", "Size of element, use of components depends on element type.");
@@ -174,7 +174,7 @@ void rna_def_metaball(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "MetaElement");
RNA_def_property_ui_text(prop, "Elements", "Meta elements.");
- prop= RNA_def_property(srna, "last_selected_element", PROP_POINTER, PROP_NONE);
+ prop= RNA_def_property(srna, "active_element", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "lastelem");
RNA_def_property_ui_text(prop, "Last selected element.", "Last selected element.");
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 9771e83468b..7a27b87056b 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -69,7 +69,7 @@ EnumPropertyItem modifier_type_items[] ={
{eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""},
{eModifierType_Smoke, "SMOKE", 0, "Smoke", ""},
{eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""},
- {eModifierType_Softbody, "SOFTBODY", ICON_MOD_SOFT, "Soft Body", ""},
+ {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
{eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
{eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""},
{eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
@@ -1860,7 +1860,7 @@ void RNA_def_modifier(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Realtime);
RNA_def_property_ui_text(prop, "Realtime", "Realtime display of a modifier.");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
- RNA_def_property_ui_icon(prop, ICON_VIEW3D, 0);
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 0);
prop= RNA_def_property(srna, "render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Render);
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index cedbc992dde..1cd98ca3a9c 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -118,7 +118,9 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
static EnumPropertyItem prop_noise_type_items[] = {
{MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""},
- /* {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""}, */
+#if FFTW3 == 1
+ {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""},
+#endif
/* {MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */
{0, NULL, 0, NULL, NULL}};
@@ -150,8 +152,13 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "highres", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGHRES);
- RNA_def_property_ui_text(prop, "High res", "Show high resolution (using amplification).");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
+ RNA_def_property_ui_text(prop, "High res", "Enable high resolution (using amplification).");
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
+
+ prop= RNA_def_property(srna, "viewhighres", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "viewsettings", MOD_SMOKE_VIEW_USEBIG);
+ RNA_def_property_ui_text(prop, "Show High Resolution", "Show high resolution (using amplification).");
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_redraw");
prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "noise");
@@ -171,14 +178,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_range(prop, -5.0, 5.0);
RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
RNA_def_property_ui_text(prop, "Gravity", "Higher value results in sinking smoke");
- RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL);
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
prop= RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "beta");
RNA_def_property_range(prop, -5.0, 5.0);
RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
RNA_def_property_ui_text(prop, "Heat", "Higher value results in faster rising smoke.");
- RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL);
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
prop= RNA_def_property(srna, "coll_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "coll_group");
@@ -200,6 +207,13 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this group.");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy");
+
+ prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "strength");
+ RNA_def_property_range(prop, -5.0, 5.0);
+ RNA_def_property_ui_range(prop, 1.0, 10.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Strength", "Strength of wavelet noise");
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
}
static void rna_def_smoke_flow_settings(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 694f980e5e9..25b16d4b3ef 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -1085,17 +1085,34 @@ static void rna_def_texture_voronoi(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Voronoi", "Procedural voronoi texture.");
RNA_def_struct_sdna(srna, "Tex");
- prop= RNA_def_property(srna, "feature_weights", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "weight_1", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vn_w1");
- RNA_def_property_array(prop, 4);
RNA_def_property_range(prop, -2, 2);
- RNA_def_property_ui_text(prop, "Feature Weights", "");
+ RNA_def_property_ui_text(prop, "Weight 1", "Voronoi feature weight 1");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "weight_2", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vn_w2");
+ RNA_def_property_range(prop, -2, 2);
+ RNA_def_property_ui_text(prop, "Weight 2", "Voronoi feature weight 2");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "weight_3", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vn_w3");
+ RNA_def_property_range(prop, -2, 2);
+ RNA_def_property_ui_text(prop, "Weight 3", "Voronoi feature weight 3");
+ RNA_def_property_update(prop, NC_TEXTURE, NULL);
+
+ prop= RNA_def_property(srna, "weight_4", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vn_w4");
+ RNA_def_property_range(prop, -2, 2);
+ RNA_def_property_ui_text(prop, "Weight 4", "Voronoi feature weight 4");
RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "minkovsky_exponent", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vn_mexp");
RNA_def_property_range(prop, 0.01, 10);
- RNA_def_property_ui_text(prop, "Minkovsky Exponent", "");
+ RNA_def_property_ui_text(prop, "Minkovsky Exponent", "Minkovsky exponent");
RNA_def_property_update(prop, NC_TEXTURE, NULL);
prop= RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 707c5769357..4fd4c9caf89 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -45,6 +45,80 @@
#include "../generic/BGL.h"
+/* for internal use, when starting and ending python scripts */
+
+/* incase a python script triggers another python call, stop bpy_context_clear from invalidating */
+static int py_call_level= 0;
+
+
+// only for tests
+#define TIME_PY_RUN
+
+#ifdef TIME_PY_RUN
+#include "PIL_time.h"
+static int bpy_timer_count = 0;
+static double bpy_timer; /* time since python starts */
+static double bpy_timer_run; /* time for each python script run */
+static double bpy_timer_run_tot; /* accumulate python runs */
+#endif
+
+void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
+{
+ py_call_level++;
+
+ if(gilstate)
+ *gilstate = PyGILState_Ensure();
+
+ if(py_call_level==1) {
+
+ BPY_update_modules(); /* can give really bad results if this isnt here */
+
+ if(C) { // XXX - should always be true.
+ BPy_SetContext(C);
+ bpy_import_main_set(CTX_data_main(C));
+ }
+ else {
+ fprintf(stderr, "ERROR: Python context called with a NULL Context. this should not happen!\n");
+ }
+
+#ifdef TIME_PY_RUN
+ if(bpy_timer_count==0) {
+ /* record time from the beginning */
+ bpy_timer= PIL_check_seconds_timer();
+ bpy_timer_run = bpy_timer_run_tot = 0.0;
+ }
+ bpy_timer_run= PIL_check_seconds_timer();
+
+
+ bpy_timer_count++;
+#endif
+ }
+}
+
+void bpy_context_clear(bContext *C, PyGILState_STATE *gilstate)
+{
+ py_call_level--;
+
+ if(gilstate)
+ PyGILState_Release(*gilstate);
+
+ if(py_call_level < 0) {
+ fprintf(stderr, "ERROR: Python context internal state bug. this should not happen!\n");
+ }
+ else if(py_call_level==0) {
+ // XXX - Calling classes currently wont store the context :\, cant set NULL because of this. but this is very flakey still.
+ //BPy_SetContext(NULL);
+ //bpy_import_main_set(NULL);
+
+#ifdef TIME_PY_RUN
+ bpy_timer_run_tot += PIL_check_seconds_timer() - bpy_timer_run;
+ bpy_timer_count++;
+#endif
+
+ }
+}
+
+
void BPY_free_compiled_text( struct Text *text )
{
if( text->compiled ) {
@@ -106,9 +180,6 @@ static PyObject *CreateGlobalDictionary( bContext *C )
PyDict_SetItemString( dict, "__name__", item );
Py_DECREF(item);
- // XXX - evil, need to access context
- BPy_SetContext(C);
-
// XXX - put somewhere more logical
{
PyMethodDef *ml;
@@ -218,25 +289,36 @@ void BPY_end_python( void )
Py_Finalize( );
- return;
+#ifdef TIME_PY_RUN
+ // measure time since py started
+ bpy_timer = PIL_check_seconds_timer() - bpy_timer;
+
+ printf("*bpy stats* - ");
+ printf("tot exec: %d, ", bpy_timer_count);
+ printf("tot run: %.4fsec, ", bpy_timer_run_tot);
+ if(bpy_timer_count>0)
+ printf("average run: %.6fsec, ", (bpy_timer_run_tot/bpy_timer_count));
+
+ if(bpy_timer>0.0)
+ printf("tot usage %.4f%%", (bpy_timer_run_tot/bpy_timer)*100.0);
+
+ printf("\n");
+
+#endif
+
}
/* Can run a file or text block */
int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struct ReportList *reports)
{
- PyObject *py_dict, *py_result;
+ PyObject *py_dict, *py_result= NULL;
PyGILState_STATE gilstate;
if (fn==NULL && text==NULL) {
return 0;
}
- //BPY_start_python();
-
- gilstate = PyGILState_Ensure();
-
- BPY_update_modules(); /* can give really bad results if this isnt here */
- bpy_import_main_set(CTX_data_main(C));
+ bpy_context_set(C, &gilstate);
py_dict = CreateGlobalDictionary(C);
@@ -251,13 +333,11 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc
MEM_freeN( buf );
if( PyErr_Occurred( ) ) {
- BPy_errors_to_report(reports);
BPY_free_compiled_text( text );
- PyGILState_Release(gilstate);
- return 0;
}
}
- py_result = PyEval_EvalCode( text->compiled, py_dict, py_dict );
+ if(text->compiled)
+ py_result = PyEval_EvalCode( text->compiled, py_dict, py_dict );
} else {
#if 0
@@ -287,10 +367,9 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc
}
Py_DECREF(py_dict);
- PyGILState_Release(gilstate);
- bpy_import_main_set(NULL);
- //BPY_end_python();
+ bpy_context_clear(C, &gilstate);
+
return py_result ? 1:0;
}
@@ -473,12 +552,7 @@ void BPY_run_ui_scripts(bContext *C, int reload)
PyGILState_STATE gilstate;
PyObject *sys_path;
- gilstate = PyGILState_Ensure();
-
- // XXX - evil, need to access context
- BPy_SetContext(C);
- bpy_import_main_set(CTX_data_main(C));
-
+ bpy_context_set(C, &gilstate);
sys_path= PySys_GetObject("path"); /* borrow */
PyList_Insert(sys_path, 0, Py_None); /* place holder, resizes the list */
@@ -537,12 +611,14 @@ void BPY_run_ui_scripts(bContext *C, int reload)
PyList_SetSlice(sys_path, 0, 1, NULL); /* remove the first item */
- bpy_import_main_set(NULL);
+ bpy_context_clear(C, &gilstate);
- PyGILState_Release(gilstate);
#ifdef TIME_REGISTRATION
printf("script time %f\n", (PIL_check_seconds_timer()-time));
#endif
+
+ /* reset the timer so as not to take loading into the stats */
+ bpy_timer_count = 0;
}
/* ****************************************** */
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 080d2e8ce6a..a0cbc4637a4 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -93,11 +93,9 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
PointerRNA ptr_event;
PyObject *py_operator;
- PyGILState_STATE gilstate = PyGILState_Ensure();
+ PyGILState_STATE gilstate;
- bpy_import_main_set(CTX_data_main(C));
-
- BPY_update_modules(); // XXX - the RNA pointers can change so update before running, would like a nicer solutuon for this.
+ bpy_context_set(C, &gilstate);
args = PyTuple_New(1);
PyTuple_SET_ITEM(args, 0, PyObject_GetAttrString(py_class, "__rna__")); // need to use an rna instance as the first arg
@@ -221,8 +219,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
}
#endif
- PyGILState_Release(gilstate);
- bpy_import_main_set(NULL);
+ bpy_context_clear(C, &gilstate);
return ret_flag;
}
@@ -299,7 +296,7 @@ void PYTHON_OT_wrapper(wmOperatorType *ot, void *userdata)
PyObject *py_func_ptr, *py_kw, *py_srna_cobject, *py_ret;
item = PyList_GET_ITEM(props, i);
- if (PyArg_ParseTuple(item, "O!O!", &PyCObject_Type, &py_func_ptr, &PyDict_Type, &py_kw)) {
+ if (PyArg_ParseTuple(item, "O!O!:PYTHON_OT_wrapper", &PyCObject_Type, &py_func_ptr, &PyDict_Type, &py_kw)) {
PyObject *(*pyfunc)(PyObject *, PyObject *, PyObject *);
pyfunc = PyCObject_AsVoidPtr(py_func_ptr);
@@ -309,6 +306,8 @@ void PYTHON_OT_wrapper(wmOperatorType *ot, void *userdata)
if (py_ret) {
Py_DECREF(py_ret);
} else {
+ fprintf(stderr, "BPy Operator \"%s\" registration error: %s item %d could not run\n", ot->idname, PYOP_ATTR_PROP, i);
+ PyLineSpit();
PyErr_Print();
PyErr_Clear();
}
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 27bfb89b963..c3fcb9a6036 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -2585,6 +2585,45 @@ PyObject *BPY_rna_props( void )
/* Orphan functions, not sure where they should go */
+/* get the srna for methods attached to types */
+static StructRNA *srna_from_self(PyObject *self)
+{
+ BPy_StructRNA *py_srna;
+
+ if(self==NULL) {
+ PyErr_SetString(PyExc_SystemError, "internal error, self was NULL, should never happen.");
+ return NULL;
+ }
+
+ if (PyCObject_Check(self)) {
+ return PyCObject_AsVoidPtr(self);
+ }
+
+ py_srna= (BPy_StructRNA *)PyObject_GetAttrString(self, "__rna__");
+
+ if(py_srna==NULL) {
+ PyErr_SetString(PyExc_SystemError, "internal error, self had no __rna__ attribute, should never happen.");
+ return NULL;
+ }
+
+ if(!BPy_StructRNA_Check(py_srna)) {
+ PyErr_SetString(PyExc_SystemError, "internal error, self's __rna__ attribute isnt a StructRNA type, should never happen.");
+ return NULL;
+ }
+
+ if((py_srna->ptr.data && py_srna->ptr.type == &RNA_Struct) == 0) {
+ PyErr_SetString(PyExc_SystemError, "internal error, self's __rna__ attribute wasnt an RNA_Struct, should never happen.");
+ return NULL;
+ }
+
+ if(!RNA_struct_is_ID(py_srna->ptr.data)) {
+ PyErr_SetString(PyExc_TypeError, "only ID types support python defined properties");
+ return NULL;
+ }
+
+ return py_srna->ptr.data;
+}
+
/* Function that sets RNA, NOTE - self is NULL when called from python, but being abused from C so we can pass the srna allong
* This isnt incorrect since its a python object - but be careful */
PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
@@ -2593,7 +2632,8 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
char *id, *name="", *description="";
float min=FLT_MIN, max=FLT_MAX, soft_min=FLT_MIN, soft_max=FLT_MAX, def=0.0f;
PropertyRNA *prop;
-
+ StructRNA *srna;
+
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssfffff:FloatProperty", kwlist, &id, &name, &description, &min, &max, &soft_min, &soft_max, &def))
return NULL;
@@ -2602,35 +2642,21 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- if (self && PyCObject_Check(self)) {
- StructRNA *srna = PyCObject_AsVoidPtr(self);
- prop= RNA_def_float(srna, id, def, min, max, name, description, soft_min, soft_max);
- RNA_def_property_duplicate_pointers(prop);
- Py_RETURN_NONE;
- } else if(self && PyType_Check(self)) {
- PyObject *pyob= PyObject_GetAttrString(self, "__rna__");
-
- if(pyob && BPy_StructRNA_Check(pyob)) {
- BPy_StructRNA *py_srna= (BPy_StructRNA*)pyob;
-
- if(py_srna->ptr.data && py_srna->ptr.type == &RNA_Struct) {
- if(RNA_struct_is_ID(py_srna->ptr.data)) {
- prop= RNA_def_float(py_srna->ptr.data, id, def, min, max, name, description, soft_min, soft_max);
- RNA_def_property_duplicate_pointers(prop);
- Py_RETURN_NONE;
- }
- }
- }
-
- PyErr_SetString(PyExc_ValueError, "only works on ID types");
- return NULL;
- } else {
+ if(((self && (PyCObject_Check(self))) || (self && BPy_StructRNA_Check(self))) == 0) {
PyObject *ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, PyCObject_FromVoidPtr((void *)BPy_FloatProperty, NULL));
PyTuple_SET_ITEM(ret, 1, kw);
Py_INCREF(kw);
return ret;
}
+
+ srna= srna_from_self(self);
+ if(srna==NULL)
+ return NULL;
+
+ prop= RNA_def_float(srna, id, def, min, max, name, description, soft_min, soft_max);
+ RNA_def_property_duplicate_pointers(prop);
+ Py_RETURN_NONE;
}
PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
@@ -2639,7 +2665,8 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
char *id, *name="", *description="";
int min=INT_MIN, max=INT_MAX, soft_min=INT_MIN, soft_max=INT_MAX, def=0;
PropertyRNA *prop;
-
+ StructRNA *srna;
+
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssiiiii:IntProperty", kwlist, &id, &name, &description, &min, &max, &soft_min, &soft_max, &def))
return NULL;
@@ -2648,35 +2675,21 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- if (self && PyCObject_Check(self)) {
- StructRNA *srna = PyCObject_AsVoidPtr(self);
- prop= RNA_def_int(srna, id, def, min, max, name, description, soft_min, soft_max);
- RNA_def_property_duplicate_pointers(prop);
- Py_RETURN_NONE;
- } else if(self && PyType_Check(self)) {
- PyObject *pyob= PyObject_GetAttrString(self, "__rna__");
-
- if(pyob && BPy_StructRNA_Check(pyob)) {
- BPy_StructRNA *py_srna= (BPy_StructRNA*)pyob;
-
- if(py_srna->ptr.data && py_srna->ptr.type == &RNA_Struct) {
- if(RNA_struct_is_ID(py_srna->ptr.data)) {
- prop= RNA_def_int(py_srna->ptr.data, id, def, min, max, name, description, soft_min, soft_max);
- RNA_def_property_duplicate_pointers(prop);
- Py_RETURN_NONE;
- }
- }
- }
-
- PyErr_SetString(PyExc_ValueError, "only works on ID types");
- return NULL;
- } else {
+ if(((self && (PyCObject_Check(self))) || (self && BPy_StructRNA_Check(self))) == 0) {
PyObject *ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, PyCObject_FromVoidPtr((void *)BPy_IntProperty, NULL));
PyTuple_SET_ITEM(ret, 1, kw);
Py_INCREF(kw);
return ret;
}
+
+ srna= srna_from_self(self);
+ if(srna==NULL)
+ return NULL;
+
+ prop= RNA_def_int(srna, id, def, min, max, name, description, soft_min, soft_max);
+ RNA_def_property_duplicate_pointers(prop);
+ Py_RETURN_NONE;
}
PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
@@ -2685,7 +2698,8 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
char *id, *name="", *description="";
int def=0;
PropertyRNA *prop;
-
+ StructRNA *srna;
+
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssi:BoolProperty", kwlist, &id, &name, &description, &def))
return NULL;
@@ -2694,35 +2708,21 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- if (self && PyCObject_Check(self)) {
- StructRNA *srna = PyCObject_AsVoidPtr(self);
- prop= RNA_def_boolean(srna, id, def, name, description);
- RNA_def_property_duplicate_pointers(prop);
- Py_RETURN_NONE;
- } else if(self && PyType_Check(self)) {
- PyObject *pyob= PyObject_GetAttrString(self, "__rna__");
-
- if(pyob && BPy_StructRNA_Check(pyob)) {
- BPy_StructRNA *py_srna= (BPy_StructRNA*)pyob;
-
- if(py_srna->ptr.data && py_srna->ptr.type == &RNA_Struct) {
- if(RNA_struct_is_ID(py_srna->ptr.data)) {
- prop= RNA_def_boolean(py_srna->ptr.data, id, def, name, description);
- RNA_def_property_duplicate_pointers(prop);
- Py_RETURN_NONE;
- }
- }
- }
-
- PyErr_SetString(PyExc_ValueError, "only works on ID types");
- return NULL;
- } else {
+ if(((self && (PyCObject_Check(self))) || (self && BPy_StructRNA_Check(self))) == 0) {
PyObject *ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, PyCObject_FromVoidPtr((void *)BPy_BoolProperty, NULL));
PyTuple_SET_ITEM(ret, 1, kw);
Py_INCREF(kw);
return ret;
}
+
+ srna= srna_from_self(self);
+ if(srna==NULL)
+ return NULL;
+
+ prop= RNA_def_boolean(srna, id, def, name, description);
+ RNA_def_property_duplicate_pointers(prop);
+ Py_RETURN_NONE;
}
PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
@@ -2731,7 +2731,8 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
char *id, *name="", *description="", *def="";
int maxlen=0;
PropertyRNA *prop;
-
+ StructRNA *srna;
+
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssis:StringProperty", kwlist, &id, &name, &description, &maxlen, &def))
return NULL;
@@ -2739,36 +2740,22 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
PyErr_SetString(PyExc_ValueError, "all args must be keywors"); // TODO - py3 can enforce this.
return NULL;
}
-
- if (self && PyCObject_Check(self)) {
- StructRNA *srna = PyCObject_AsVoidPtr(self);
- prop= RNA_def_string(srna, id, def, maxlen, name, description);
- RNA_def_property_duplicate_pointers(prop);
- Py_RETURN_NONE;
- } else if(self && PyType_Check(self)) {
- PyObject *pyob= PyObject_GetAttrString(self, "__rna__");
-
- if(pyob && BPy_StructRNA_Check(pyob)) {
- BPy_StructRNA *py_srna= (BPy_StructRNA*)pyob;
- if(py_srna->ptr.data && py_srna->ptr.type == &RNA_Struct) {
- if(RNA_struct_is_ID(py_srna->ptr.data)) {
- prop= RNA_def_string(py_srna->ptr.data, id, def, maxlen, name, description);
- RNA_def_property_duplicate_pointers(prop);
- Py_RETURN_NONE;
- }
- }
- }
-
- PyErr_SetString(PyExc_ValueError, "only works on ID types");
- return NULL;
- } else {
+ if(((self && (PyCObject_Check(self))) || (self && BPy_StructRNA_Check(self))) == 0) {
PyObject *ret = PyTuple_New(2);
PyTuple_SET_ITEM(ret, 0, PyCObject_FromVoidPtr((void *)BPy_StringProperty, NULL));
PyTuple_SET_ITEM(ret, 1, kw);
Py_INCREF(kw);
return ret;
}
+
+ srna= srna_from_self(self);
+ if(srna==NULL)
+ return NULL;
+
+ prop= RNA_def_string(srna, id, def, maxlen, name, description);
+ RNA_def_property_duplicate_pointers(prop);
+ Py_RETURN_NONE;
}
/*-------------------- Type Registration ------------------------*/
@@ -2918,9 +2905,10 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
void *retdata= NULL;
int err= 0, i, flag;
- PyGILState_STATE gilstate = PyGILState_Ensure();
+ PyGILState_STATE gilstate;
- BPY_update_modules(); // XXX - the RNA pointers can change so update before running, would like a nicer solution for this.
+ bContext *C= BPy_GetContext(); // XXX - NEEDS FIXING, QUITE BAD.
+ bpy_context_set(C, &gilstate);
py_class= RNA_struct_py_type_get(ptr->type);
@@ -2996,7 +2984,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par
PyErr_Clear();
}
- PyGILState_Release(gilstate);
+ bpy_context_clear(C, &gilstate);
return err;
}
diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h
index 470dd4c2a45..df204b7b90d 100644
--- a/source/blender/python/intern/bpy_util.h
+++ b/source/blender/python/intern/bpy_util.h
@@ -82,4 +82,8 @@ int BPy_errors_to_report(struct ReportList *reports);
struct bContext *BPy_GetContext(void);
void BPy_SetContext(struct bContext *C);
+extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate);
+extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate);
+
+
#endif
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index db8c33cb9d5..a4b23feb3c7 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -2501,7 +2501,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
for (i=0;i<sumolist->GetCount();i++)
{
KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i);
- struct Object* blenderobject = converter->FindBlenderObject(gameobj);
+ struct Object* blenderobject = gameobj->GetBlenderObject();
int nummeshes = gameobj->GetMeshCount();
RAS_MeshObject* meshobj = 0;
if (nummeshes > 0)
@@ -2517,7 +2517,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
for (i=0;i<sumolist->GetCount();i++)
{
KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i);
- struct Object* blenderobject = converter->FindBlenderObject(gameobj);
+ struct Object* blenderobject = gameobj->GetBlenderObject();
int nummeshes = gameobj->GetMeshCount();
RAS_MeshObject* meshobj = 0;
if (nummeshes > 0)
@@ -2545,7 +2545,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
for (i=0;i<sumolist->GetCount();i++)
{
KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i);
- struct Object* blenderobject = converter->FindBlenderObject(gameobj);
+ struct Object* blenderobject = gameobj->GetBlenderObject();
ListBase *conlist;
bConstraint *curcon;
conlist = get_active_constraints2(blenderobject);
@@ -2626,7 +2626,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
for (i=0;i<logicbrick_conversionlist->GetCount();i++)
{
KX_GameObject* gameobj = static_cast<KX_GameObject*>(logicbrick_conversionlist->GetValue(i));
- struct Object* blenderobj = converter->FindBlenderObject(gameobj);
+ struct Object* blenderobj = gameobj->GetBlenderObject();
int layerMask = (groupobj.find(blenderobj) == groupobj.end()) ? activeLayerBitInfo : 0;
bool isInActiveLayer = (blenderobj->lay & layerMask)!=0;
BL_ConvertActuators(maggie->name, blenderobj,gameobj,logicmgr,kxscene,ketsjiEngine,layerMask,isInActiveLayer,rendertools,converter);
@@ -2634,7 +2634,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
for ( i=0;i<logicbrick_conversionlist->GetCount();i++)
{
KX_GameObject* gameobj = static_cast<KX_GameObject*>(logicbrick_conversionlist->GetValue(i));
- struct Object* blenderobj = converter->FindBlenderObject(gameobj);
+ struct Object* blenderobj = gameobj->GetBlenderObject();
int layerMask = (groupobj.find(blenderobj) == groupobj.end()) ? activeLayerBitInfo : 0;
bool isInActiveLayer = (blenderobj->lay & layerMask)!=0;
BL_ConvertControllers(blenderobj,gameobj,logicmgr,pythondictionary,layerMask,isInActiveLayer,converter);
@@ -2642,7 +2642,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
for ( i=0;i<logicbrick_conversionlist->GetCount();i++)
{
KX_GameObject* gameobj = static_cast<KX_GameObject*>(logicbrick_conversionlist->GetValue(i));
- struct Object* blenderobj = converter->FindBlenderObject(gameobj);
+ struct Object* blenderobj = gameobj->GetBlenderObject();
int layerMask = (groupobj.find(blenderobj) == groupobj.end()) ? activeLayerBitInfo : 0;
bool isInActiveLayer = (blenderobj->lay & layerMask)!=0;
BL_ConvertSensors(blenderobj,gameobj,logicmgr,kxscene,ketsjiEngine,layerMask,isInActiveLayer,canvas,converter);
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 4df9df75d3d..ebabaa55e21 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -260,38 +260,34 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
if (blenderscene)
{
- if (blenderscene->world)
+ switch (blenderscene->gm.physicsEngine)
{
- switch (blenderscene->world->physicsEngine)
+ case WOPHY_BULLET:
{
- case WOPHY_BULLET:
- {
- physics_engine = UseBullet;
- useDbvtCulling = (blenderscene->world->mode & WO_DBVT_CULLING) != 0;
- break;
- }
-
- case WOPHY_ODE:
- {
- physics_engine = UseODE;
- break;
- }
- case WOPHY_DYNAMO:
- {
- physics_engine = UseDynamo;
- break;
- }
- case WOPHY_SUMO:
- {
- physics_engine = UseSumo;
- break;
- }
- case WOPHY_NONE:
- {
- physics_engine = UseNone;
- }
+ physics_engine = UseBullet;
+ useDbvtCulling = (blenderscene->gm.mode & WO_DBVT_CULLING) != 0;
+ break;
+ }
+
+ case WOPHY_ODE:
+ {
+ physics_engine = UseODE;
+ break;
+ }
+ case WOPHY_DYNAMO:
+ {
+ physics_engine = UseDynamo;
+ break;
+ }
+ case WOPHY_SUMO:
+ {
+ physics_engine = UseSumo;
+ break;
+ }
+ case WOPHY_NONE:
+ {
+ physics_engine = UseNone;
}
-
}
}
@@ -349,10 +345,6 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
//This cache mecanism is buggy so I leave it disable and the memory leak
//that would result from this is fixed in RemoveScene()
m_map_mesh_to_gamemesh.clear();
- //Don't clear this lookup, it is needed for the baking physics into ipo animation
- //To avoid it's infinite grows, object will be unregister when they are deleted
- //see KX_Scene::NewRemoveObject
- //m_map_gameobject_to_blender.clear();
}
// This function removes all entities stored in the converter for that scene
@@ -466,27 +458,28 @@ void KX_BlenderSceneConverter::RegisterGameObject(
KX_GameObject *gameobject,
struct Object *for_blenderobject)
{
- m_map_gameobject_to_blender.insert(CHashedPtr(gameobject),for_blenderobject);
+ /* only maintained while converting, freed during game runtime */
m_map_blender_to_gameobject.insert(CHashedPtr(for_blenderobject),gameobject);
}
void KX_BlenderSceneConverter::UnregisterGameObject(
KX_GameObject *gameobject)
{
- CHashedPtr gptr(gameobject);
- struct Object **bobp= m_map_gameobject_to_blender[gptr];
+#if 0
+ struct Object *bobp= gameobject->GetBlenderObject();
if (bobp) {
- CHashedPtr bptr(*bobp);
+ CHashedPtr bptr(bobp);
KX_GameObject **gobp= m_map_blender_to_gameobject[bptr];
if (gobp && *gobp == gameobject)
+ {
// also maintain m_map_blender_to_gameobject if the gameobject
// being removed is matching the blender object
m_map_blender_to_gameobject.remove(bptr);
- m_map_gameobject_to_blender.remove(gptr);
+ }
}
+#endif
}
-
KX_GameObject *KX_BlenderSceneConverter::FindGameObject(
struct Object *for_blenderobject)
{
@@ -495,18 +488,6 @@ KX_GameObject *KX_BlenderSceneConverter::FindGameObject(
return obp?*obp:NULL;
}
-
-
-struct Object *KX_BlenderSceneConverter::FindBlenderObject(
- KX_GameObject *for_gameobject)
-{
- struct Object **obp= m_map_gameobject_to_blender[CHashedPtr(for_gameobject)];
-
- return obp?*obp:NULL;
-}
-
-
-
void KX_BlenderSceneConverter::RegisterGameMesh(
RAS_MeshObject *gamemesh,
struct Mesh *for_blendermesh)
@@ -693,7 +674,7 @@ void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo)
{
//KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController();
- Object* blenderObject = FindBlenderObject(gameObj);
+ Object* blenderObject = gameObj->GetBlenderObject();
if (blenderObject)
{
//erase existing ipo's
@@ -757,7 +738,7 @@ void KX_BlenderSceneConverter::resetNoneDynamicObjectToIpo(){
for (int ix=0;ix<parentList->GetCount();ix++){
KX_GameObject* gameobj = (KX_GameObject*)parentList->GetValue(ix);
if (!gameobj->IsDynamic()){
- Object* blenderobject = FindBlenderObject(gameobj);
+ Object* blenderobject = gameobj->GetBlenderObject();
if (!blenderobject)
continue;
if (blenderobject->type==OB_ARMATURE)
@@ -811,7 +792,7 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
{
//KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController();
- Object* blenderObject = FindBlenderObject(gameObj);
+ Object* blenderObject = gameObj->GetBlenderObject();
if (blenderObject && blenderObject->ipo)
{
const MT_Point3& position = gameObj->NodeGetWorldPosition();
@@ -912,7 +893,7 @@ void KX_BlenderSceneConverter::TestHandlesPhysicsObjectToAnimationIpo()
{
//KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController();
- Object* blenderObject = FindBlenderObject(gameObj);
+ Object* blenderObject = gameObj->GetBlenderObject();
if (blenderObject && blenderObject->ipo)
{
// XXX animato
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h
index 50ce8d61336..7b5351344ae 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.h
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h
@@ -56,14 +56,10 @@ class KX_BlenderSceneConverter : public KX_ISceneConverter
// Should also have a list of collision shapes.
// For the time being this is held in KX_Scene::m_shapes
- GEN_Map<CHashedPtr,struct Object*> m_map_gameobject_to_blender;
- GEN_Map<CHashedPtr,KX_GameObject*> m_map_blender_to_gameobject;
-
- GEN_Map<CHashedPtr,RAS_MeshObject*> m_map_mesh_to_gamemesh;
-// GEN_Map<CHashedPtr,DT_ShapeHandle> m_map_gamemesh_to_sumoshape;
-
- GEN_Map<CHashedPtr,SCA_IActuator*> m_map_blender_to_gameactuator;
- GEN_Map<CHashedPtr,SCA_IController*> m_map_blender_to_gamecontroller;
+ GEN_Map<CHashedPtr,KX_GameObject*> m_map_blender_to_gameobject; /* cleared after conversion */
+ GEN_Map<CHashedPtr,RAS_MeshObject*> m_map_mesh_to_gamemesh; /* cleared after conversion */
+ GEN_Map<CHashedPtr,SCA_IActuator*> m_map_blender_to_gameactuator; /* cleared after conversion */
+ GEN_Map<CHashedPtr,SCA_IController*>m_map_blender_to_gamecontroller; /* cleared after conversion */
GEN_Map<CHashedPtr,BL_InterpolatorList*> m_map_blender_to_gameAdtList;
@@ -107,14 +103,10 @@ public:
void RegisterGameObject(KX_GameObject *gameobject, struct Object *for_blenderobject);
void UnregisterGameObject(KX_GameObject *gameobject);
KX_GameObject *FindGameObject(struct Object *for_blenderobject);
- struct Object *FindBlenderObject(KX_GameObject *for_gameobject);
void RegisterGameMesh(RAS_MeshObject *gamemesh, struct Mesh *for_blendermesh);
RAS_MeshObject *FindGameMesh(struct Mesh *for_blendermesh/*, unsigned int onlayer*/);
-// void RegisterSumoShape(DT_ShapeHandle shape, RAS_MeshObject *for_gamemesh);
-// DT_ShapeHandle FindSumoShape(RAS_MeshObject *for_gamemesh);
-
void RegisterPolyMaterial(RAS_IPolyMaterial *polymat);
void RegisterBlenderMaterial(BL_Material *mat);
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 729fff31052..04454f8232a 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -87,8 +87,8 @@ PyTypeObject PyObjectPlus::Type = {
PyObjectPlus::~PyObjectPlus()
{
if(m_proxy) {
- Py_DECREF(m_proxy); /* Remove own reference, python may still have 1 */
BGE_PROXY_REF(m_proxy)= NULL;
+ Py_DECREF(m_proxy); /* Remove own reference, python may still have 1 */
}
// assert(ob_refcnt==0);
}
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index b6448666ec4..3600d132b18 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -995,8 +995,12 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
// in case this is a camera
m_cameras.remove((KX_Camera*)newobj);
+ /* currently does nothing, keep incase we need to Unregister something */
+#if 0
if (m_sceneConverter)
m_sceneConverter->UnregisterGameObject(newobj);
+#endif
+
// return value will be 0 if the object is actually deleted (all reference gone)
return ret;
diff --git a/tools/Blender.py b/tools/Blender.py
index aeb2efac369..6b07853ac85 100644
--- a/tools/Blender.py
+++ b/tools/Blender.py
@@ -132,6 +132,8 @@ def setup_staticlibs(lenv):
libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
if lenv['WITH_BF_STATICOPENEXR']:
statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC'])
+ if lenv['WITH_BF_FFTW3']:
+ libincs += Split(lenv['BF_FFTW3_LIBPATH'])
if lenv['WITH_BF_INTERNATIONAL']:
libincs += Split(lenv['BF_GETTEXT_LIBPATH'])
if lenv['WITH_BF_OPENAL']:
@@ -185,6 +187,8 @@ def setup_syslibs(lenv):
syslibs += Split(lenv['BF_FFMPEG_LIB'])
if lenv['WITH_BF_OGG']:
syslibs += Split(lenv['BF_OGG_LIB'])
+ if lenv['WITH_BF_FFTW3']:
+ syslibs += Split(lenv['BF_FFTW3_LIB'])
if lenv['WITH_BF_SDL']:
syslibs += Split(lenv['BF_SDL_LIB'])
if not lenv['WITH_BF_STATICOPENGL']:
diff --git a/tools/btools.py b/tools/btools.py
index 2e7f110699a..543c503376e 100755
--- a/tools/btools.py
+++ b/tools/btools.py
@@ -49,6 +49,7 @@ def validate_arguments(args, bc):
'BF_WINTAB', 'BF_WINTAB_INC',
'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH',
'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
+ 'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH',
'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC',
'WITH_BF_PLAYER',
'WITH_BF_NOBLENDER',
@@ -297,6 +298,12 @@ def read_opts(cfg, args):
('BF_QUICKTIME_INC', 'QuickTime include path', ''),
('BF_QUICKTIME_LIB', 'QuickTime library', ''),
('BF_QUICKTIME_LIBPATH', 'QuickTime library path', ''),
+
+ (BoolVariable('WITH_BF_FFTW3', 'Use FFTW3 if true', False)),
+ ('BF_FFTW3', 'FFTW3 base path', ''),
+ ('BF_FFTW3_INC', 'FFTW3 include path', ''),
+ ('BF_FFTW3_LIB', 'FFTW3 library', ''),
+ ('BF_FFTW3_LIBPATH', 'FFTW3 library path', ''),
(BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)),
('BF_OPENGL', 'OpenGL base path', ''),