1
1

Compare commits

...

37 Commits

Author SHA1 Message Date
7b6eefea41 Merge from trunk r51234-r51251 2012-10-10 11:32:27 +00:00
a355ff367b * Revert "zer000"'s Cycles test node commits. (r47479 and 47556)
* Some cleanup to smoke code.
2012-10-10 10:39:49 +00:00
864b886af1 Merging revisions 51077-51234 from trunk 2012-10-09 19:53:51 +00:00
4c9ea030a5 Merge with trunk r51077 2012-10-05 12:02:42 +00:00
b3f311784d Merge with trunk r50245 + fixed issues caused by previous (failed?) merge. 2012-08-27 10:59:15 +00:00
e777ee95f0 svn merge ^/trunk/blender -r50097:50211 2012-08-25 23:05:59 +00:00
3f50e01c38 minor changes needed for building with smoke disabled 2012-08-25 22:51:30 +00:00
037626024a svn merge ^/trunk/blender -r49776:50097 2012-08-21 18:32:30 +00:00
122d92e5b7 Fix: Smoke flow texture used UV maps incorrectly. (Double size) 2012-08-11 10:56:30 +00:00
d9a60226b6 * Some improvements to fire simulation code.
* It's now possible to set "flame rate" higher than 1.0. Higher rate basically means taller flame.
* More tweaking to "Quick Smoke" operator settings. Fire material is now also added by default even for smoke preset. -> You can now use quick smoke to easily setup a basic render settings that cover colored smoke and fire.
* Added settings to use a texture to define smoke flow "strength" for mesh emission. You can use automatically generated coordinates or UV layer.
* Fix: Adaptive domain bounds weren't drawn at all if smoke was uninitialized.
* Code cleanup.
2012-08-10 16:44:39 +00:00
35de87d10b Merge with trunk r49776 2012-08-10 16:23:54 +00:00
49f0d0cc14 * Fix: smoke collision velocity got messed up if domain was moved during simulation.
* Fixed possible crash when changing smoke collision type.
* Fix: Viewport preview of high resolution smoke was drawn with too low density.
2012-08-06 11:23:43 +00:00
bca2ca5636 Two fixes for domain boundary conditions.
* Domain vertical velocity was accelerating over time. This issue has been in trunk since smoke was first introduced, but was especially troublesome for fire simulations due to higher temperatures and therefore higher buoyancy lift.
* Domain sides were partly considered obstacles regardless of the active "Border Collisions" setting. Now all boundaries behave identically. This should be especially useful when using new gsoc features like domain rotation or changing gravity direction.
2012-08-06 09:47:52 +00:00
b4d7f7c496 Merge with trunk r49600 2012-08-06 09:20:12 +00:00
61111325f1 * Active simulation fields are now set dynamically based on simulation content.
- For example fire related data/simulation is only processed when there is a fire type brush affecting the domain. Color data is enabled only when multiple colors are needed.
- This way most simulations require less disk space and are faster to calculate compared to previous branch versions.
* Tweaked smoke 3D-view shader to match previous non-colored version.
* Fixed memory leak with smoke colors.
2012-07-24 18:08:17 +00:00
5e29bd93c0 * Added colors to smoke simulations. You can select smoke color for flows and for smoke emitted from fire.
* Added color support to smoke 3D-view preview.
* Added color support to Blender Internal "Voxel Data" textures. To render smoke with colors also enable "Reflection Color" from texture settings.
* Added options to disable heat, fire and colors from simulations. I'm going to make this automatic during next week, but until then you can use these settings for additional speedup if you don't need certain parts of simulation.
* Fix: It wasn't possible to select "Domain Object" for smoke force field from same object.
* Fix: Force fields affected smoke incorrectly when using adaptive domain.
* Fix: Smoke initial velocity sometimes got messed up for first frame.
* Fix: Smoke initial velocity was applied incorrectly in some cases.
* Some code cleanup and refactoring.
2012-07-20 18:06:51 +00:00
801b9d62a8 Merge with trunk r49076 2012-07-20 11:45:26 +00:00
f68753d3db * Fix: Emitting smoke from particles didn't work after last commit.
* "Map to Bounds" is now enabled by default for new textures. One less thing to worry about when rendering adaptive domain. :p
2012-07-05 08:33:26 +00:00
35b5caca54 Added a new force field type: "Smoke Flow".
It applies smoke simulation air flow velocity as a force to other Blender simulations that use force fields. To use it you need to add a "Smoke Flow" force field and select domain object for it.

To get an idea of what this is about, here is a video of it being used on particles: http://www.youtube.com/watch?v=lqRIxVQuVno
2012-07-04 19:30:30 +00:00
9324503b84 Merge with trunk r48602 2012-07-04 17:15:05 +00:00
234c338655 Fix: Smoke obstacles were sometimes processed in wrong location when adaptive domain was enabled. 2012-06-29 17:36:34 +00:00
63ad7f0b62 Committed out conflicting part from previous merge. It was no longer possible to compile with Cycles.
Philipp Volguine can you check that out?
2012-06-26 19:36:00 +00:00
40ac94929e * Changing (most) smoke domain settings no longer clears whole domain but just the cache. This way it's easier to try out different settings while playback.
* Copying domain object now also preserves adaptive settings. :p
* Heat/velocity debug visualization (dev only) works again.
* Some code cleanup.
2012-06-26 19:15:47 +00:00
7f0137ece1 Merge with trunk r48317 2012-06-26 17:51:25 +00:00
1a52abb04f * Added "map to bounds" option also for "Object" coordinates.
* Fix: smoke viewport shading and force fields now work properly for rotated/moved domains again.
* Fix: first frame was initialized with maximum resolution even when using adaptive domain.
* Some code cleanup.
2012-06-25 16:32:26 +00:00
465ff2313a Fix compile on non-Windows platforms. 2012-06-25 08:52:45 +00:00
51ead096c7 This commit includes my smoke work from previous weeks.
There are lots of changes in the code but here is a list of new things visible to users:
* A new "Adaptive Domain" setting. It makes smoke domain dynamically adapt to domain and fluid changes:
1) Domain resolution and size adapts to only cover areas where smoke is, so that as small domain as possible has to be calculated at a time. You can also add additional simulation cells around the original domain area if needed.
2) When you move the domain object during simulation you only move the smoke "boundaries". Smoke itself remains still. This way you can limit simulated area to stay around moving emitters etc.
* Domain is now rotatable. This means you are no longer need to align your simulation on x, y or z axis but you can freely rotate the domain to match the target area.
* Rotation and scaling also work during simulation with one limitation: Domain contents (smoke,fire) move with the domain.
* Smoke now uses the scene gravity setting, so you can change gravity direction if required.
* Added a new option for volume textures when "Generated" coordinates are used: "Map to Bounds". This maps texture coordinates to mesh bounding box allowing you to render adaptive domain content. It also solves issues with domains scaled in edit mode, so I'm considering to make this enabled by default.

Please note that this feature is not yet finished. I still have quite a few todos left and I'm sure there are still several bugs there.
2012-06-24 20:21:57 +00:00
Philipp Volguine
5a92d9895b Added node_shader_mybsdf_diffuse.c to CMakeLists.txt
-this fixes the compilation error from revision r47479
2012-06-07 06:35:37 +00:00
ff04fcafc9 Fix: Smoke flow vertex group didn't work with subdivision modifier. 2012-06-06 11:47:07 +00:00
Philipp Volguine
4cd600b80e Added copy of Diffuse BSDF node for testing
-Changed blender nodes source for UI changes,
-Added new cycles node type MY_BSDF_NODE
-Did not copy shader closure

Conflicts:

	source/blender/blenkernel/BKE_node.h
2012-06-05 20:07:01 +00:00
252e3ab5f4 Fixed smoke compile on non-Windows platforms: I had added the "ADD_IF_LOWER" macro inside a "#ifdef _WIN32" block... 2012-06-05 17:32:57 +00:00
01490607ee * Added ability to emit smoke directly from mesh surface and volume without particles. (Now default flow type)
* Surface emission strength can be controlled using vertex groups.
* Surface emission can have normal or mesh movement directional initial velocity.
* Refactor and cleanup of smoke emission code.
* Fixed "quick smoke" to work with branch changes.
* Added debug code for visualization of velocity and heat.
2012-06-05 13:13:17 +00:00
d4f9413a39 Merge with trunk r47460 2012-06-05 12:33:20 +00:00
0aedf41759 * Added basic implementation of fire simulation:
* Flow settings now have a "Flow Type" menu where you can change if flow emits smoke or fire.
* Domain has a new "Flames" panel where you can adjust fire behavior.
* Added 3D-view rendering of fire together with smoke.
* Added new "Flames" voxel data type to render fire in Blender Internal render engine.

Current fire quality is very similar to the old way of using dissolving smoke to simulate fire. I'm going to work later this summer on allowing more realistic fire behavior by implementing a way to simulate the reaction "blue core".

Flow settings and initial velocity also play an important role in modeling gaseous expansion typical for burning fuel. That's what I'm going to work on next. :)
2012-05-29 13:41:20 +00:00
5bbf564863 Merge with trunk r47087 2012-05-27 18:58:41 +00:00
94feb0db3b svn merge ^/trunk/blender -r46037:46827 2012-05-21 06:39:03 +00:00
101ee5da82 new gsoc branch 2012-05-20 15:34:41 +00:00
609 changed files with 12750 additions and 5852 deletions

View File

@@ -206,6 +206,7 @@ option(WITH_IMAGE_REDCODE "Enable RedCode Image Support" OFF)
option(WITH_IMAGE_FRAMESERVER "Enable image FrameServer Support for rendering" ON)
# Audio/Video format support
option(WITH_CODEC_AVI "Enable Blenders own AVI file support (raw/jpeg)" ON)
option(WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
option(WITH_CODEC_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
@@ -254,6 +255,9 @@ set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 sm_30 CACHE STRING "CUDA archite
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
# LLVM
option(WITH_LLVM "Use LLVM" OFF)
# disable for now, but plan to support on all platforms eventually
option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
mark_as_advanced(WITH_MEM_JEMALLOC)
@@ -316,6 +320,9 @@ if(APPLE)
option(WITH_COCOA "Use Cocoa framework instead of deprecated Carbon" ON)
option(USE_QTKIT "Use QtKit instead of Carbon quicktime (needed for having partial quicktime for 64bit)" OFF)
option(WITH_LIBS10.5 "Use 10.5 libs (needed for 64bit builds)" OFF)
if(CMAKE_OSX_ARCHITECTURES MATCHES x86_64)
set(USE_QTKIT ON CACHE BOOL "ON" FORCE) # no Quicktime in 64bit
endif()
endif()
@@ -371,6 +378,11 @@ if(WITH_CYCLES OR WITH_MOD_BOOLEAN)
set(WITH_BOOST ON)
endif()
# auto enable llvm for cycles_osl
if(WITH_CYCLES_OSL)
set(WITH_LLVM ON CACHE BOOL "ON" FORCE)
endif()
# don't store paths to libs for portable distribution
if(WITH_INSTALL_PORTABLE)
set(CMAKE_SKIP_BUILD_RPATH TRUE)
@@ -704,6 +716,56 @@ if(UNIX AND NOT APPLE)
endif()
endif()
if(WITH_LLVM)
set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_VERSION "3.0" CACHE STRING "Version of LLVM to use" "")
set(LLVM_STATIC YES)
if(LLVM_DIRECTORY)
set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
else()
set(LLVM_CONFIG llvm-config)
endif()
execute_process(COMMAND ${LLVM_CONFIG} --version
OUTPUT_VARIABLE LLVM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_DIRECTORY
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --libdir
OUTPUT_VARIABLE LLVM_LIB_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --includedir
OUTPUT_VARIABLE LLVM_INCLUDES
OUTPUT_STRIP_TRAILING_WHITESPACE)
find_library(LLVM_LIBRARY
NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get
PATHS ${LLVM_LIB_DIR})
message(STATUS "LLVM version = ${LLVM_VERSION}")
message(STATUS "LLVM dir = ${LLVM_DIRECTORY}")
message(STATUS "LLVM includes = ${LLVM_INCLUDES}")
message(STATUS "LLVM lib dir = ${LLVM_LIB_DIR}")
if(LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
# ensure include directory is added (in case of non-standard locations
include_directories(BEFORE "${LLVM_INCLUDES}")
string(REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION})
message(STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}")
add_definitions("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}")
if(LLVM_STATIC)
# if static LLVM libraries were requested, use llvm-config to generate
# the list of what libraries we need, and substitute that in the right
# way for LLVM_LIBRARY.
execute_process(COMMAND ${LLVM_CONFIG} --libfiles
OUTPUT_VARIABLE LLVM_LIBRARY
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
endif()
message(STATUS "LLVM library = ${LLVM_LIBRARY}")
else()
message(FATAL_ERROR "LLVM not found.")
endif()
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
@@ -712,8 +774,9 @@ if(UNIX AND NOT APPLE)
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
# WARNING! depends on correct order of OSL libs linking
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
# Note: --whole-archive is needed to force loading of all symbols in liboslexec,
# otherwise LLVM is missing the osl_allocate_closure_component function
list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -Wl,--whole-archive ${OSL_LIB_EXEC} -Wl,--no-whole-archive ${OSL_LIB_QUERY})
find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
@@ -1559,6 +1622,56 @@ elseif(APPLE)
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
endif()
if(WITH_LLVM)
set(LLVM_DIRECTORY ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_VERSION "3.1" CACHE STRING "Version of LLVM to use" "")
set(LLVM_STATIC YES)
if(LLVM_DIRECTORY)
set(LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
else()
set(LLVM_CONFIG llvm-config)
endif()
execute_process(COMMAND ${LLVM_CONFIG} --version
OUTPUT_VARIABLE LLVM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_DIRECTORY
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --libdir
OUTPUT_VARIABLE LLVM_LIB_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${LLVM_CONFIG} --includedir
OUTPUT_VARIABLE LLVM_INCLUDES
OUTPUT_STRIP_TRAILING_WHITESPACE)
find_library(LLVM_LIBRARY
NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get
PATHS ${LLVM_LIB_DIR})
message(STATUS "LLVM version = ${LLVM_VERSION}")
message(STATUS "LLVM dir = ${LLVM_DIRECTORY}")
message(STATUS "LLVM includes = ${LLVM_INCLUDES}")
message(STATUS "LLVM lib dir = ${LLVM_LIB_DIR}")
if(LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
# ensure include directory is added (in case of non-standard locations
include_directories(BEFORE "${LLVM_INCLUDES}")
string(REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION})
message(STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}")
add_definitions("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}")
if(LLVM_STATIC)
# if static LLVM libraries were requested, use llvm-config to generate
# the list of what libraries we need, and substitute that in the right
# way for LLVM_LIBRARY.
execute_process(COMMAND ${LLVM_CONFIG} --libfiles
OUTPUT_VARIABLE LLVM_LIBRARY
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
endif()
message(STATUS "LLVM library = ${LLVM_LIBRARY}")
else()
message(FATAL_ERROR "LLVM not found.")
endif()
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
@@ -1582,66 +1695,6 @@ elseif(APPLE)
endif()
include_directories(${OSL_INCLUDES})
# LLVM library setup, needed for osl
set(LLVM_DIRECTORY "${LIBDIR}/llvm")
set(LLVM_STATIC YES)
if (LLVM_DIRECTORY)
set (LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config")
else ()
set (LLVM_CONFIG llvm-config)
endif ()
execute_process (COMMAND ${LLVM_CONFIG} --version
OUTPUT_VARIABLE LLVM_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${LLVM_CONFIG} --prefix
OUTPUT_VARIABLE LLVM_DIRECTORY
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${LLVM_CONFIG} --libdir
OUTPUT_VARIABLE LLVM_LIB_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${LLVM_CONFIG} --includedir
OUTPUT_VARIABLE LLVM_INCLUDES
OUTPUT_STRIP_TRAILING_WHITESPACE)
find_library ( LLVM_LIBRARY
NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get
PATHS ${LLVM_LIB_DIR})
message (STATUS "LLVM version = ${LLVM_VERSION}")
message (STATUS "LLVM dir = ${LLVM_DIRECTORY}")
message (STATUS "LLVM includes = ${LLVM_INCLUDES}")
message (STATUS "LLVM lib dir = ${LLVM_LIB_DIR}")
if (LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
# ensure include directory is added (in case of non-standard locations
include_directories (BEFORE "${LLVM_INCLUDES}")
string (REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION})
message (STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}")
add_definitions ("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}")
if (LLVM_STATIC)
# if static LLVM libraries were requested, use llvm-config to generate
# the list of what libraries we need, and substitute that in the right
# way for LLVM_LIBRARY.
set (LLVM_LIBRARY "")
execute_process (COMMAND ${LLVM_CONFIG} --libs
OUTPUT_VARIABLE llvm_library_list
OUTPUT_STRIP_TRAILING_WHITESPACE)
string (REPLACE "-l" "" llvm_library_list ${llvm_library_list})
string (REPLACE " " ";" llvm_library_list ${llvm_library_list})
foreach (f ${llvm_library_list})
list (APPEND LLVM_LIBRARY "${LLVM_LIB_DIR}/lib${f}.a")
endforeach ()
endif ()
string (REPLACE ";" " " LLVM_LIBRARY "${LLVM_LIBRARY}")
message (STATUS "LLVM library = ${LLVM_LIBRARY}")
else ()
message (FATAL_ERROR "LLVM not found.")
endif ()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${LLVM_LIBRARY}")
# end LLVM library setup
endif()
set(EXETYPE MACOSX_BUNDLE)
@@ -1677,6 +1730,12 @@ if(WITH_CYCLES)
if(NOT WITH_BOOST)
message(FATAL_ERROR "Cycles reqires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_CYCLES")
endif()
if(WITH_CYCLES_OSL)
if(NOT WITH_LLVM)
message(FATAL_ERROR "Cycles OSL reqires WITH_LLVM, the library may not have been found. Configure LLVM or disable WITH_CYCLES_OSL")
endif()
endif()
endif()
@@ -2065,6 +2124,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_OPENAL)
info_cfg_option(WITH_SDL)
info_cfg_option(WITH_JACK)
info_cfg_option(WITH_CODEC_AVI)
info_cfg_option(WITH_CODEC_FFMPEG)
info_cfg_option(WITH_CODEC_SNDFILE)

View File

@@ -171,6 +171,7 @@ help:
@echo ""
@echo "Static Source Code Checking (not associated with building blender)"
@echo " * check_cppcheck - run blender source through cppcheck (C & C++)"
@echo " * check_clang_array - run blender source through clang array checking script (C & C++)"
@echo " * check_splint - run blenders source through splint (C only)"
@echo " * check_sparse - run blenders source through sparse (C only)"
@echo " * check_smatch - run blenders source through smatch (C only)"
@@ -244,6 +245,10 @@ check_cppcheck:
$(CMAKE_CONFIG)
cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py
check_clang_array:
$(CMAKE_CONFIG)
cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py
check_splint:
$(CMAKE_CONFIG)
cd $(BUILD_DIR) ; python3.2 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py

View File

@@ -366,6 +366,7 @@ else:
# TODO, make optional
env['CPPFLAGS'].append('-DWITH_AUDASPACE')
env['CPPFLAGS'].append('-DWITH_AVI')
# lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
B.root_build_dir = env['BF_BUILDDIR']

View File

@@ -28,8 +28,8 @@ c['slavePortnum'] = 9989
from buildbot.changes.svnpoller import SVNPoller
c['change_source'] = SVNPoller(
'https://svn.blender.org/svnroot/bf-blender/trunk/',
pollinterval=1200)
'https://svn.blender.org/svnroot/bf-blender/trunk/',
pollinterval=1200)
# BUILDERS
#
@@ -137,7 +137,8 @@ c['schedulers'] = []
# builderNames=buildernames,
# periodicBuildTimer=24*60*60))
c['schedulers'].append(timed.Nightly(name='nightly',
c['schedulers'].append(timed.Nightly(
name='nightly',
builderNames=buildernames,
hour=3,
minute=0))

View File

@@ -112,7 +112,7 @@ branch = get_branch(packagename)
if platform == '':
sys.stderr.write('Failed to detect platform ' +
'from package: %r\n' % packagename)
'from package: %r\n' % packagename)
sys.exit(1)
# extract

View File

@@ -50,9 +50,9 @@ if builder.find('scons') != -1:
install_dir = os.path.join('..', 'install', builder)
scons_options += ['WITH_BF_NOBLENDER=True', 'WITH_BF_PLAYER=False',
'BF_BUILDDIR=' + build_dir,
'BF_INSTALLDIR=' + install_dir,
'WITHOUT_BF_INSTALL=True']
'BF_BUILDDIR=' + build_dir,
'BF_INSTALLDIR=' + install_dir,
'WITHOUT_BF_INSTALL=True']
config = None
bits = None

View File

@@ -0,0 +1,353 @@
# ---
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# ---
# by Campbell Barton
"""
Invocation:
export CLANG_BIND_DIR="/dsk/src/llvm/tools/clang/bindings/python"
export CLANG_LIB_DIR="/opt/llvm/lib"
python2 clang_array_check.py somefile.c -DSOME_DEFINE -I/some/include
... defines and includes are optional
"""
# delay parsing functions until we need them
USE_LAZY_INIT = True
# -----------------------------------------------------------------------------
# predefined function/arg sizes, handy sometimes, but not complete...
defs_precalc = {
"glColor3bv": {0: 3},
"glColor4bv": {0: 4},
"glColor3ubv": {0: 3},
"glColor4ubv": {0: 4},
"glColor4usv": {0: 3},
"glColor4usv": {0: 4},
"glColor3fv": {0: 3},
"glColor4fv": {0: 4},
"glColor3dv": {0: 3},
"glColor4dv": {0: 4},
"glVertex2fv": {0: 2},
"glVertex3fv": {0: 3},
"glVertex4fv": {0: 4},
"glEvalCoord1fv": {0: 1},
"glEvalCoord1dv": {0: 1},
"glEvalCoord2fv": {0: 2},
"glEvalCoord2dv": {0: 2},
"glRasterPos2dv": {0: 2},
"glRasterPos3dv": {0: 3},
"glRasterPos4dv": {0: 4},
"glRasterPos2fv": {0: 2},
"glRasterPos3fv": {0: 3},
"glRasterPos4fv": {0: 4},
"glRasterPos2sv": {0: 2},
"glRasterPos3sv": {0: 3},
"glRasterPos4sv": {0: 4},
"glTexCoord2fv": {0: 2},
"glTexCoord3fv": {0: 3},
"glTexCoord4fv": {0: 4},
"glTexCoord2dv": {0: 2},
"glTexCoord3dv": {0: 3},
"glTexCoord4dv": {0: 4},
"glNormal3fv": {0: 3},
"glNormal3dv": {0: 3},
"glNormal3bv": {0: 3},
"glNormal3iv": {0: 3},
"glNormal3sv": {0: 3},
}
# -----------------------------------------------------------------------------
import sys
if 0:
# Examples with LLVM as the root dir: '/dsk/src/llvm'
# path containing 'clang/__init__.py'
CLANG_BIND_DIR = "/dsk/src/llvm/tools/clang/bindings/python"
# path containing libclang.so
CLANG_LIB_DIR = "/opt/llvm/lib"
else:
import os
CLANG_BIND_DIR = os.environ.get("CLANG_BIND_DIR")
CLANG_LIB_DIR = os.environ.get("CLANG_LIB_DIR")
if CLANG_BIND_DIR is None:
print("$CLANG_BIND_DIR python binding dir not set")
if CLANG_LIB_DIR is None:
print("$CLANG_LIB_DIR clang lib dir not set")
sys.path.append(CLANG_BIND_DIR)
import clang
import clang.cindex
from clang.cindex import (CursorKind,
TypeKind,
TokenKind)
clang.cindex.Config.set_library_path(CLANG_LIB_DIR)
index = clang.cindex.Index.create()
args = sys.argv[2:]
# print(args)
tu = index.parse(sys.argv[1], args)
print('Translation unit: %s' % tu.spelling)
# -----------------------------------------------------------------------------
def function_parm_wash_tokens(parm):
# print(parm.kind)
assert parm.kind in (CursorKind.PARM_DECL,
CursorKind.VAR_DECL, # XXX, double check this
CursorKind.FIELD_DECL,
)
"""
Return tolens without trailing commads and 'const'
"""
tokens = [t for t in parm.get_tokens()]
if not tokens:
return tokens
#if tokens[-1].kind == To
# remove trailing char
if tokens[-1].kind == TokenKind.PUNCTUATION:
if tokens[-1].spelling in (",", ")", ";"):
tokens.pop()
#else:
# print(tokens[-1].spelling)
t_new = []
for t in tokens:
t_kind = t.kind
t_spelling = t.spelling
ok = True
if t_kind == TokenKind.KEYWORD:
if t_spelling in ("const", "restrict", "volatile"):
ok = False
elif t_spelling.startswith("__"):
ok = False # __restrict
elif t_kind in (TokenKind.COMMENT, ):
ok = False
# Use these
elif t_kind in (TokenKind.LITERAL,
TokenKind.PUNCTUATION,
TokenKind.IDENTIFIER):
# use but ignore
pass
else:
print("Unknown!", t_kind, t_spelling)
# if its OK we will add
if ok:
t_new.append(t)
return t_new
def parm_size(node_child):
tokens = function_parm_wash_tokens(node_child)
# print(" ".join([t.spelling for t in tokens]))
# NOT PERFECT CODE, EXTRACT SIZE FROM TOKENS
if len(tokens) >= 3: # foo [ 1 ]
if ((tokens[-3].kind == TokenKind.PUNCTUATION and tokens[-3].spelling == "[") and
(tokens[-2].kind == TokenKind.LITERAL and tokens[-2].spelling.isdigit()) and
(tokens[-1].kind == TokenKind.PUNCTUATION and tokens[-1].spelling == "]")):
# ---
return int(tokens[-2].spelling)
return -1
def function_get_arg_sizes(node):
# Return a dict if (index: size) items
# {arg_indx: arg_array_size, ... ]
arg_sizes = {}
if 1: # node.spelling == "BM_vert_create", for debugging
node_parms = [node_child for node_child in node.get_children()
if node_child.kind == CursorKind.PARM_DECL]
for i, node_child in enumerate(node_parms):
# print(node_child.kind, node_child.spelling)
#print(node_child.type.kind, node_child.spelling) # TypeKind.POINTER
if node_child.type.kind == TypeKind.POINTER:
pointee = node_child.type.get_pointee()
if pointee.is_pod():
size = parm_size(node_child)
if size != -1:
arg_sizes[i] = size
return arg_sizes
# -----------------------------------------------------------------------------
_defs = {}
def lookup_function_size_def(func_id):
if USE_LAZY_INIT:
result = _defs.get(func_id, {})
if type(result) != dict:
result = _defs[func_id] = function_get_arg_sizes(result)
return result
else:
return _defs.get(func_id, {})
# -----------------------------------------------------------------------------
def file_check_arg_sizes(tu):
# main checking function
def validate_arg_size(node):
"""
Loop over args and validate sizes for args we KNOW the size of.
"""
assert node.kind == CursorKind.CALL_EXPR
if 0:
print("---",
" <~> ".join(
[" ".join([t.spelling for t in C.get_tokens()])
for C in node.get_children()]
))
# print(node.location)
# first child is the function call, skip that.
children = list(node.get_children())
if not children:
return # XXX, look into this, happens on C++
func = children[0]
# get the func declaration!
# works but we can better scan for functions ahead of time.
if 0:
func_dec = func.get_definition()
if func_dec:
print("FD", " ".join([t.spelling for t in func_dec.get_tokens()]))
else:
# HRMP'f - why does this fail?
print("AA", " ".join([t.spelling for t in node.get_tokens()]))
else:
args_size_definition = () # dummy
# get the key
tok = list(func.get_tokens())
if tok:
func_id = tok[0].spelling
args_size_definition = lookup_function_size_def(func_id)
if not args_size_definition:
return
children = children[1:]
for i, node_child in enumerate(children):
children = list(node_child.get_children())
# skip if we dont have an index...
size_def = args_size_definition.get(i, -1)
if size_def == -1:
continue
#print([c.kind for c in children])
# print(" ".join([t.spelling for t in node_child.get_tokens()]))
if len(children) == 1:
arg = children[0]
if arg.kind in (CursorKind.DECL_REF_EXPR,
CursorKind.UNEXPOSED_EXPR):
if arg.type.kind == TypeKind.POINTER:
dec = arg.get_definition()
if dec:
size = parm_size(dec)
# size == 0 is for 'float *a'
if size != -1 and size != 0:
# nice print!
if 0:
print("".join([t.spelling for t in func.get_tokens()]),
i,
" ".join([t.spelling for t in dec.get_tokens()]))
# testing
# size_def = 100
if size < size_def and size != 1:
location = node.location
print("%s:%d:%d: argument %d is size %d, should be %d" %
(location.file,
location.line,
location.column,
i + 1, size, size_def
))
# we dont really care what we are looking at, just scan entire file for
# function calls.
def recursive_func_call_check(node):
if node.kind == CursorKind.CALL_EXPR:
validate_arg_size(node)
for c in node.get_children():
recursive_func_call_check(c)
recursive_func_call_check(tu.cursor)
# -- first pass, cache function definitions sizes
# PRINT FUNC DEFINES
def recursive_arg_sizes(node, ):
# print(node.kind, node.spelling)
if node.kind == CursorKind.FUNCTION_DECL:
if USE_LAZY_INIT:
args_sizes = node
else:
args_sizes = function_get_arg_sizes(node)
#if args_sizes:
# print(node.spelling, args_sizes)
_defs[node.spelling] = args_sizes
# print("adding", node.spelling)
for c in node.get_children():
recursive_arg_sizes(c)
# cache function sizes
recursive_arg_sizes(tu.cursor)
_defs.update(defs_precalc)
# --- second pass, check against def's
file_check_arg_sizes(tu)

View File

@@ -105,7 +105,13 @@ def create_qtc_project_main():
qtc_cfg = os.path.join(PROJECT_DIR, "%s.config" % FILE_NAME)
f = open(qtc_cfg, 'w')
f.write("// ADD PREDEFINED MACROS HERE!\n")
f.write("// ADD PREDEFINED MACROS TO %s_custom.config!\n" % FILE_NAME)
qtc_custom_cfg = os.path.join(PROJECT_DIR, "%s_custom.config" % FILE_NAME)
if os.path.exists(qtc_custom_cfg):
fc = open(qtc_custom_cfg, 'r')
f.write(fc.read())
fc.close()
f.write("\n")
defines_final = [("#define %s %s" % (item[0], quote_define(item[1]))) for item in defines]
if sys.platform != "win32":
defines_final += cmake_compiler_defines()

View File

@@ -0,0 +1,77 @@
#!/usr/bin/env python3.2
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Contributor(s): Campbell Barton
#
# ***** END GPL LICENSE BLOCK *****
# <pep8 compliant>
import project_source_info
import subprocess
import sys
import os
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
"blender/intern/opennl",
]
CHECKER_BIN = "python2"
CHECKER_ARGS = [
os.path.join(os.path.dirname(__file__), "clang_array_check.py"),
# not sure why this is needed, but it is.
"-I" + os.path.join(project_source_info.SOURCE_DIR, "extern", "glew", "include"),
]
def main():
source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
check_commands = []
for c, inc_dirs, defs in source_info:
cmd = ([CHECKER_BIN] +
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs]
)
check_commands.append((c, cmd))
process_functions = []
def my_process(i, c, cmd):
percent = 100.0 * (i / (len(check_commands) - 1))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush()
sys.stdout.write("%s " % percent_str)
return subprocess.Popen(cmd)
for i, (c, cmd) in enumerate(check_commands):
process_functions.append((my_process, (i, c, cmd)))
project_source_info.queue_processes(process_functions)
if __name__ == "__main__":
main()

View File

@@ -30,6 +30,7 @@ import os
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
"blender/intern/opennl",
]
CHECKER_BIN = "cppcheck"
@@ -54,7 +55,7 @@ def main():
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs]
)
)
check_commands.append((c, cmd))

View File

@@ -25,6 +25,7 @@
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
"blender/intern/opennl",
]
CHECKER_BIN = "smatch"
@@ -49,7 +50,7 @@ def main():
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs]
)
)
check_commands.append((c, cmd))

View File

@@ -25,6 +25,7 @@
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
"blender/intern/opennl",
]
CHECKER_BIN = "sparse"
@@ -47,7 +48,7 @@ def main():
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs]
)
)
check_commands.append((c, cmd))

View File

@@ -25,6 +25,7 @@
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
"blender/intern/opennl",
]
CHECKER_BIN = "splint"
@@ -79,7 +80,7 @@ def main():
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs]
)
)
check_commands.append((c, cmd))

View File

@@ -10,6 +10,7 @@ set(WITH_SYSTEM_GLEW ON CACHE FORCE BOOL)
set(WITH_BUILDINFO OFF CACHE FORCE BOOL)
set(WITH_BULLET OFF CACHE FORCE BOOL)
set(WITH_CODEC_AVI OFF CACHE FORCE BOOL)
set(WITH_CODEC_FFMPEG OFF CACHE FORCE BOOL)
set(WITH_CODEC_SNDFILE OFF CACHE FORCE BOOL)
set(WITH_CYCLES OFF CACHE FORCE BOOL)

View File

@@ -244,6 +244,9 @@ macro(SETUP_LIBDIRS)
link_directories(${PCRE_LIBPATH})
link_directories(${EXPAT_LIBPATH})
endif()
if(WITH_LLVM)
link_directories(${LLVM_LIB_DIR})
endif()
if(WITH_MEM_JEMALLOC)
link_directories(${JEMALLOC_LIBPATH})
endif()
@@ -382,6 +385,9 @@ macro(setup_liblinks
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES})
endif()
if(WITH_LLVM)
target_link_libraries(${target} ${LLVM_LIBRARY})
endif()
if(WIN32 AND NOT UNIX)
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
endif()

View File

@@ -85,7 +85,7 @@ def makefile_log():
print("running make with --dry-run ...")
process = subprocess.Popen(["make", "--always-make", "--dry-run", "--keep-going", "VERBOSE=1"],
stdout=subprocess.PIPE,
)
)
while process.poll():
time.sleep(1)

View File

@@ -50,7 +50,7 @@ Contents
- It works with only OpenGL calls, for the full 100%. This means that it has some quirks
built-in to work with all OS's and OpenGL versions. Especially frontbuffer drawing is
a continuous point of attention. Buttons can be drawn with any window matrix. However,
errors can still occor when buttons are created in windows with non-standard glViewports.
errors can still occur when buttons are created in windows with non-standard glViewports.
- The code was written to replace the old 1.8 button system, but under high pressure. Quite
some button methods from the old system were copied for that reason.
@@ -95,7 +95,7 @@ blender/source/blender/src/toolbox.c (extra GUI elements built on top of this AP
All GUI elements are collected in uiBlocks, which in turn are linked together in a list that's
part of a Blender Area-window.
uiBlock *block= uiNewBlock(&curarea->uiblocks, "stuff", UI_EMBOSSX, UI_HELV, curarea->win);
uiBlock *block = uiNewBlock(&curarea->uiblocks, "stuff", UI_EMBOSSX, UI_HELV, curarea->win);
The next code example makes a new block, and puts it in the list of blocks of the current active
Area:
@@ -221,7 +221,7 @@ void uiBlockSetButmFunc(uiBlock *block, void (*menufunc)(void *arg, int event),
void uiAutoBlock(uiBlock *block, float minx, float miny, float sizex, float sizey, UI_BLOCK_ROWS)
Sets the buttons in this block to automatically align, and fit within boundaries.
Internally it allows multiple collums or rows as well. Only 'row order' has been implemented.
Internally it allows multiple colums or rows as well. Only 'row order' has been implemented.
The uiDefBut definitions don't need coordinates as input here, but instead:
- first value (x1) to indicate row number
- width and height values (if filled in) will be used to define a relative width/height.
@@ -346,7 +346,7 @@ type:
without returnvalues, the first item gets value 0 (incl. title!)
Example: "Do something %t| turn left %2| turn right %1| nothing %0"
11. COL
11. COLOR
A special button that only visualizes a RGB value
In 'retval' you can put a code, which is used to identify for sliders if it needs
redraws while using the sliders. Check button '5'.
@@ -363,7 +363,7 @@ uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon,
float min, float max, float a1, float a2, char *tip)
Same syntax and types available as previous uiDefBut, but now with an icon code
instead of a name. THe icons are numbered in resources.c
instead of a name. The icons are numbered in resources.c
uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str,
short x1, short y1, short x2, short y2, float *poin,
@@ -397,9 +397,9 @@ void uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str,
static uiBlock *info_file_importmenu(void *arg_unused)
{
uiBlock *block;
short yco= 0, xco = 20;
short yco = 0, xco = 20;
block= uiNewBlock(&curarea->uiblocks, "importmenu", UI_EMBOSSW, UI_HELV, G.curscreen->mainwin);
block = uiNewBlock(&curarea->uiblocks, "importmenu", UI_EMBOSSW, UI_HELV, G.curscreen->mainwin);
uiBlockSetXOfs(block, -40); // offset to parent button
/* flags are defines */
@@ -409,7 +409,7 @@ void uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, char *str,
uiDefButS(block, TOG|BIT|2, 0, "Two Sided", xco, yco-=20, 75, 19, &U.vrmlflag, 0.0, 0.0, 0, 0, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 50); // checks for fontsize
uiTextBoundsBlock(block, 50); /* checks for fontsize */
return block;
}

View File

@@ -333,7 +333,8 @@ Types
.. attribute:: useContinue
The actions continue option, True or False. When True, the action will always play from where last left off, otherwise negative events to this actuator will reset it to its start frame.
The actions continue option, True or False. When True, the action will always play from where last left off,
otherwise negative events to this actuator will reset it to its start frame.
:type: boolean
@@ -879,7 +880,8 @@ Types
.. note::
Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError, if an object may have been removed since last accessing it use the :data:`invalid` attribute to check.
Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError,
if an object may have been removed since last accessing it use the :data:`invalid` attribute to check.
KX_GameObject can be subclassed to extend functionality. For example:
@@ -986,6 +988,24 @@ Types
The object's parent object. (read-only).
:type: :class:`KX_GameObject` or None
.. attribute:: group_children
Returns the list of group members if the object is a group object, otherwise None is returned.
:type: :class:`CListValue` of :class:`KX_GameObject` or None
.. attribute:: group_parent
Returns the group object that the object belongs to or None if the object is not part of a group.
:type: :class:`KX_GameObject` or None
.. attribute:: scene
The object's scene. (read-only).
:type: :class:`KX_Scene` or None
.. attribute:: visible
@@ -4546,7 +4566,9 @@ Types
.. data:: KX_ACT_ARMATURE_RUN
Just make sure the armature will be updated on the next graphic frame. This is the only persistent mode of the actuator: it executes automatically once per frame until stopped by a controller
Just make sure the armature will be updated on the next graphic frame.
This is the only persistent mode of the actuator:
it executes automatically once per frame until stopped by a controller
:value: 0

File diff suppressed because it is too large Load Diff

View File

@@ -28,15 +28,15 @@ blender --background --python doc/python_api/sphinx_changelog_gen.py -- --dump
# create changelog
blender --background --python doc/python_api/sphinx_changelog_gen.py -- \
--api_from blender_2_56_1.py \
--api_to blender_2_57_0.py \
--api_from blender_2_63_0.py \
--api_to blender_2_64_0.py \
--api_out changes.rst
# Api comparison can also run without blender
python doc/python_api/sphinx_changelog_gen.py \
--api_from blender_api_2_56_6.py \
--api_to blender_api_2_57.py \
python doc/python_api/sphinx_changelog_gen.py -- \
--api_from blender_api_2_63_0.py \
--api_to blender_api_2_64_0.py \
--api_out changes.rst
# Save the latest API dump in this folder, renaming it with its revision.
@@ -307,6 +307,8 @@ def api_changelog(api_from, api_to, api_out):
fout.close()
print("Written: %r" % api_out)
def main():
import sys
@@ -347,6 +349,7 @@ def main():
args = parser.parse_args(argv) # In this example we wont use the args
if not argv:
print("No args given!")
parser.print_help()
return

View File

@@ -399,7 +399,7 @@ SPHINX_THEMES = {'bf': ['blender-org'], # , 'naiad',
available_themes = SPHINX_THEMES['bf'] + SPHINX_THEMES['sphinx']
if ARGS.sphinx_theme not in available_themes:
print ("Please choose a theme among: %s" % ', '.join(available_themes))
print("Please choose a theme among: %s" % ', '.join(available_themes))
sys.exit()
if ARGS.sphinx_theme in SPHINX_THEMES['bf']:

View File

@@ -131,13 +131,9 @@ class CyclesRender_PT_light_paths(CyclesButtonsPanel, Panel):
class CyclesRender_PT_motion_blur(CyclesButtonsPanel, Panel):
bl_label = "Motion Blur"
bl_label = "Camera Motion Blur"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
return False
def draw_header(self, context):
rd = context.scene.render
@@ -955,7 +951,7 @@ def draw_device(self, context):
elif device_type == 'OPENCL' and cscene.feature_set == 'EXPERIMENTAL':
layout.prop(cscene, "device")
if cscene.feature_set == 'EXPERIMENTAL' and cscene.device == 'CPU' and engine.with_osl():
if engine.with_osl() and (cscene.device == 'CPU' or device_type == 'None'):
layout.prop(cscene, "shading_system")

View File

@@ -17,6 +17,7 @@
*/
#include "camera.h"
#include "integrator.h"
#include "graph.h"
#include "light.h"
#include "mesh.h"
@@ -227,7 +228,9 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::DupliObject
object->use_motion = true;
}
sync_mesh_motion(b_ob, object->mesh, motion);
/* mesh deformation blur not supported yet */
if(!scene->integrator->motion_blur)
sync_mesh_motion(b_ob, object->mesh, motion);
}
return;

View File

@@ -149,6 +149,9 @@ void BlenderSync::sync_data(BL::SpaceView3D b_v3d, BL::Object b_override, const
void BlenderSync::sync_integrator()
{
#ifdef __CAMERA_MOTION__
BL::RenderSettings r = b_scene.render();
#endif
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
experimental = (RNA_enum_get(&cscene, "feature_set") != 0);
@@ -175,7 +178,7 @@ void BlenderSync::sync_integrator()
integrator->layer_flag = render_layer.layer;
integrator->sample_clamp = get_float(cscene, "sample_clamp");
#ifdef __MOTION__
#ifdef __CAMERA_MOTION__
integrator->motion_blur = (!preview && r.use_motion_blur());
#endif

View File

@@ -349,7 +349,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, ShaderData *sd, co
#ifdef __INTERSECTION_REFINE__
if(isect->object != ~0) {
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
Transform tfm = sd->ob_itfm;
#else
Transform tfm = object_fetch_transform(kg, isect->object, ray->time, OBJECT_INVERSE_TRANSFORM);
@@ -370,7 +370,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, ShaderData *sd, co
P = P + D*rt;
if(isect->object != ~0) {
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
Transform tfm = sd->ob_tfm;
#else
Transform tfm = object_fetch_transform(kg, isect->object, ray->time, OBJECT_TRANSFORM);

View File

@@ -63,7 +63,7 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float
/* transform ray from camera to world */
Transform cameratoworld = kernel_data.cam.cameratoworld;
#ifdef __MOTION__
#ifdef __CAMERA_MOTION__
if(kernel_data.cam.have_motion)
transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time);
#endif
@@ -106,7 +106,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
/* transform ray from camera to world */
Transform cameratoworld = kernel_data.cam.cameratoworld;
#ifdef __MOTION__
#ifdef __CAMERA_MOTION__
if(kernel_data.cam.have_motion)
transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time);
#endif
@@ -180,7 +180,7 @@ __device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float ra
/* transform ray from camera to world */
Transform cameratoworld = kernel_data.cam.cameratoworld;
#ifdef __MOTION__
#ifdef __CAMERA_MOTION__
if(kernel_data.cam.have_motion)
transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time);
#endif
@@ -212,7 +212,7 @@ __device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, flo
float raster_x = x + kernel_tex_interp(__filter_table, filter_u, FILTER_TABLE_SIZE);
float raster_y = y + kernel_tex_interp(__filter_table, filter_v, FILTER_TABLE_SIZE);
#ifdef __MOTION__
#ifdef __CAMERA_MOTION__
/* motion blur */
if(kernel_data.cam.shuttertime == 0.0f)
ray->time = TIME_INVALID;

View File

@@ -31,7 +31,7 @@ __device_inline Transform object_fetch_transform(KernelGlobals *kg, int object,
{
Transform tfm;
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
/* if we do motion blur */
if(sd->flag & SD_OBJECT_MOTION) {
/* fetch motion transforms */
@@ -70,7 +70,7 @@ __device_inline Transform object_fetch_transform(KernelGlobals *kg, int object,
__device_inline void object_position_transform(KernelGlobals *kg, ShaderData *sd, float3 *P)
{
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
*P = transform_point(&sd->ob_tfm, *P);
#else
Transform tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_TRANSFORM);
@@ -80,7 +80,7 @@ __device_inline void object_position_transform(KernelGlobals *kg, ShaderData *sd
__device_inline void object_inverse_position_transform(KernelGlobals *kg, ShaderData *sd, float3 *P)
{
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
*P = transform_point(&sd->ob_itfm, *P);
#else
Transform tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_INVERSE_TRANSFORM);
@@ -90,7 +90,7 @@ __device_inline void object_inverse_position_transform(KernelGlobals *kg, Shader
__device_inline void object_inverse_normal_transform(KernelGlobals *kg, ShaderData *sd, float3 *N)
{
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
*N = normalize(transform_direction_transposed(&sd->ob_tfm, *N));
#else
Transform tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_TRANSFORM);
@@ -100,7 +100,7 @@ __device_inline void object_inverse_normal_transform(KernelGlobals *kg, ShaderDa
__device_inline void object_normal_transform(KernelGlobals *kg, ShaderData *sd, float3 *N)
{
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
*N = normalize(transform_direction_transposed(&sd->ob_itfm, *N));
#else
Transform tfm = object_fetch_transform(kg, sd->object, TIME_INVALID, OBJECT_INVERSE_TRANSFORM);
@@ -110,7 +110,7 @@ __device_inline void object_normal_transform(KernelGlobals *kg, ShaderData *sd,
__device_inline void object_dir_transform(KernelGlobals *kg, ShaderData *sd, float3 *D)
{
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
*D = transform_direction(&sd->ob_tfm, *D);
#else
Transform tfm = object_fetch_transform(kg, sd->object, 0.0f, OBJECT_TRANSFORM);
@@ -120,7 +120,7 @@ __device_inline void object_dir_transform(KernelGlobals *kg, ShaderData *sd, flo
__device_inline float3 object_location(KernelGlobals *kg, ShaderData *sd)
{
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
return make_float3(sd->ob_tfm.x.w, sd->ob_tfm.y.w, sd->ob_tfm.z.w);
#else
Transform tfm = object_fetch_transform(kg, sd->object, 0.0f, OBJECT_TRANSFORM);

View File

@@ -343,7 +343,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
light_ray.P = ray_offset(sd.P, sd.Ng);
light_ray.D = ao_D;
light_ray.t = kernel_data.background.ao_distance;
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
light_ray.time = sd.time;
#endif
@@ -368,7 +368,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample,
BsdfEval L_light;
bool is_lamp;
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
light_ray.time = sd.time;
#endif
@@ -520,7 +520,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
light_ray.P = ray_offset(sd.P, sd.Ng);
light_ray.D = ao_D;
light_ray.t = kernel_data.background.ao_distance;
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
light_ray.time = sd.time;
#endif
@@ -545,7 +545,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray
BsdfEval L_light;
bool is_lamp;
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
light_ray.time = sd.time;
#endif
@@ -728,7 +728,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
light_ray.P = ray_offset(sd.P, sd.Ng);
light_ray.D = ao_D;
light_ray.t = kernel_data.background.ao_distance;
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
light_ray.time = sd.time;
#endif
@@ -748,7 +748,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
BsdfEval L_light;
bool is_lamp;
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
light_ray.time = sd.time;
#endif
@@ -867,7 +867,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam
bsdf_ray.dP = sd.dP;
bsdf_ray.dD = bsdf_domega_in;
#endif
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
bsdf_ray.time = sd.time;
#endif
@@ -925,7 +925,7 @@ __device void kernel_path_trace(KernelGlobals *kg,
float lens_u = path_rng(kg, &rng, sample, PRNG_LENS_U);
float lens_v = path_rng(kg, &rng, sample, PRNG_LENS_V);
#ifdef __MOTION__
#ifdef __CAMERA_MOTION__
float time = path_rng(kg, &rng, sample, PRNG_TIME);
#else
float time = 0.0f;

View File

@@ -68,7 +68,7 @@ __device_inline void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd,
#endif
/* matrices and time */
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
sd->ob_tfm = object_fetch_transform(kg, sd->object, ray->time, OBJECT_TRANSFORM);
sd->ob_itfm = object_fetch_transform(kg, sd->object, ray->time, OBJECT_INVERSE_TRANSFORM);
@@ -171,7 +171,7 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
}
#endif
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
sd->time = time;
sd->ob_tfm = object_fetch_transform(kg, sd->object, time, OBJECT_TRANSFORM);
@@ -275,7 +275,7 @@ __device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData
sd->I = -sd->P;
sd->shader = kernel_data.background.shader;
sd->flag = kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2);
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
sd->time = ray->time;
#endif
sd->ray_length = 0.0f;

View File

@@ -108,7 +108,8 @@ CCL_NAMESPACE_BEGIN
#define __PASSES__
#define __BACKGROUND_MIS__
#define __AO__
//#define __MOTION__
#define __CAMERA_MOTION__
//#define __OBJECT_MOTION__
#endif
//#define __SOBOL_FULL_SCREEN__
@@ -129,7 +130,7 @@ enum PathTraceDimension {
PRNG_FILTER_V = 1,
PRNG_LENS_U = 2,
PRNG_LENS_V = 3,
#ifdef __MOTION__
#ifdef __CAMERA_MOTION__
PRNG_TIME = 4,
PRNG_UNUSED = 5,
PRNG_BASE_NUM = 6,
@@ -426,7 +427,7 @@ typedef struct ShaderData {
/* length of the ray being shaded */
float ray_length;
#ifdef __MOTION__
#ifdef __OBJECT_MOTION__
/* object <-> world space transformations, cached to avoid
* re-interpolating them constantly for shading */
Transform ob_tfm;

View File

@@ -85,16 +85,25 @@ public:
}
};
ClosureParam closure_background_params[] = {
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(GenericBackgroundClosure)
};
ClosureParam *closure_background_params()
{
static ClosureParam params[] = {
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(GenericBackgroundClosure)
};
return params;
}
CLOSURE_PREPARE(closure_background_prepare, GenericBackgroundClosure)
ClosureParam closure_holdout_params[] = {
CLOSURE_FINISH_PARAM(HoldoutClosure)
};
ClosureParam *closure_holdout_params()
{
static ClosureParam params[] = {
CLOSURE_FINISH_PARAM(HoldoutClosure)
};
return params;
}
CLOSURE_PREPARE(closure_holdout_prepare, HoldoutClosure)

View File

@@ -173,12 +173,16 @@ public:
ClosureParam bsdf_ashikhmin_velvet_params[] = {
CLOSURE_VECTOR_PARAM(AshikhminVelvetClosure, m_N),
CLOSURE_FLOAT_PARAM(AshikhminVelvetClosure, m_sigma),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(AshikhminVelvetClosure)
};
ClosureParam *bsdf_ashikhmin_velvet_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(AshikhminVelvetClosure, m_N),
CLOSURE_FLOAT_PARAM(AshikhminVelvetClosure, m_sigma),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(AshikhminVelvetClosure)
};
return params;
}
CLOSURE_PREPARE(bsdf_ashikhmin_velvet_prepare, AshikhminVelvetClosure)

View File

@@ -168,17 +168,25 @@ public:
}
};
ClosureParam bsdf_diffuse_params[] = {
CLOSURE_VECTOR_PARAM(DiffuseClosure, m_N),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(DiffuseClosure)
};
ClosureParam *bsdf_diffuse_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(DiffuseClosure, m_N),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(DiffuseClosure)
};
return params;
}
ClosureParam bsdf_translucent_params[] = {
CLOSURE_VECTOR_PARAM(TranslucentClosure, m_N),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(TranslucentClosure)
};
ClosureParam *bsdf_translucent_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(TranslucentClosure, m_N),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(TranslucentClosure)
};
return params;
}
CLOSURE_PREPARE(bsdf_diffuse_prepare, DiffuseClosure)
CLOSURE_PREPARE(bsdf_translucent_prepare, TranslucentClosure)

View File

@@ -503,35 +503,51 @@ public:
ClosureParam bsdf_microfacet_ggx_params[] = {
CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure<0>, m_N),
CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<0>, m_ag),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(MicrofacetGGXClosure<0>)
};
ClosureParam *bsdf_microfacet_ggx_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure<0>, m_N),
CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<0>, m_ag),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(MicrofacetGGXClosure<0>)
};
return params;
}
ClosureParam bsdf_microfacet_ggx_refraction_params[] = {
CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure<1>, m_N),
CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<1>, m_ag),
CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<1>, m_eta),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(MicrofacetGGXClosure<1>)
};
ClosureParam *bsdf_microfacet_ggx_refraction_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(MicrofacetGGXClosure<1>, m_N),
CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<1>, m_ag),
CLOSURE_FLOAT_PARAM(MicrofacetGGXClosure<1>, m_eta),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(MicrofacetGGXClosure<1>)
};
return params;
}
ClosureParam bsdf_microfacet_beckmann_params[] = {
CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure<0>, m_N),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<0>, m_ab),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(MicrofacetBeckmannClosure<0>)
};
ClosureParam *bsdf_microfacet_beckmann_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure<0>, m_N),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<0>, m_ab),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(MicrofacetBeckmannClosure<0>)
};
return params;
}
ClosureParam bsdf_microfacet_beckmann_refraction_params[] = {
CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure<1>, m_N),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<1>, m_ab),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<1>, m_eta),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(MicrofacetBeckmannClosure<1>)
};
ClosureParam *bsdf_microfacet_beckmann_refraction_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(MicrofacetBeckmannClosure<1>, m_N),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<1>, m_ab),
CLOSURE_FLOAT_PARAM(MicrofacetBeckmannClosure<1>, m_eta),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(MicrofacetBeckmannClosure<1>)
};
return params;
}
CLOSURE_PREPARE(bsdf_microfacet_ggx_prepare, MicrofacetGGXClosure<0>)
CLOSURE_PREPARE(bsdf_microfacet_ggx_refraction_prepare, MicrofacetGGXClosure<1>)

View File

@@ -125,12 +125,16 @@ private:
}
};
ClosureParam bsdf_oren_nayar_params[] = {
CLOSURE_VECTOR_PARAM(OrenNayarClosure, m_N),
CLOSURE_FLOAT_PARAM(OrenNayarClosure, m_sigma),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(OrenNayarClosure)
};
ClosureParam *bsdf_oren_nayar_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(OrenNayarClosure, m_N),
CLOSURE_FLOAT_PARAM(OrenNayarClosure, m_sigma),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(OrenNayarClosure)
};
return params;
}
CLOSURE_PREPARE(bsdf_oren_nayar_prepare, OrenNayarClosure)

View File

@@ -258,18 +258,28 @@ public:
ClosureParam bsdf_phong_params[] = {
CLOSURE_VECTOR_PARAM(PhongClosure, m_N),
CLOSURE_FLOAT_PARAM (PhongClosure, m_exponent),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(PhongClosure) };
ClosureParam *bsdf_phong_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(PhongClosure, m_N),
CLOSURE_FLOAT_PARAM (PhongClosure, m_exponent),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(PhongClosure)
};
return params;
}
ClosureParam bsdf_phong_ramp_params[] = {
CLOSURE_VECTOR_PARAM (PhongRampClosure, m_N),
CLOSURE_FLOAT_PARAM (PhongRampClosure, m_exponent),
CLOSURE_COLOR_ARRAY_PARAM(PhongRampClosure, m_colors, PhongRampClosure::MAXCOLORS),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM (PhongRampClosure) };
ClosureParam *bsdf_phong_ramp_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM (PhongRampClosure, m_N),
CLOSURE_FLOAT_PARAM (PhongRampClosure, m_exponent),
CLOSURE_COLOR_ARRAY_PARAM(PhongRampClosure, m_colors, PhongRampClosure::MAXCOLORS),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM (PhongRampClosure)
};
return params;
}
CLOSURE_PREPARE(bsdf_phong_prepare, PhongClosure)
CLOSURE_PREPARE(bsdf_phong_ramp_prepare, PhongRampClosure)

View File

@@ -97,11 +97,15 @@ public:
}
};
ClosureParam bsdf_reflection_params[] = {
CLOSURE_VECTOR_PARAM(ReflectionClosure, m_N),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(ReflectionClosure)
};
ClosureParam *bsdf_reflection_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(ReflectionClosure, m_N),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(ReflectionClosure)
};
return params;
}
CLOSURE_PREPARE(bsdf_reflection_prepare, ReflectionClosure)

View File

@@ -108,12 +108,16 @@ public:
}
};
ClosureParam bsdf_refraction_params[] = {
CLOSURE_VECTOR_PARAM(RefractionClosure, m_N),
CLOSURE_FLOAT_PARAM(RefractionClosure, m_eta),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(RefractionClosure)
};
ClosureParam *bsdf_refraction_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(RefractionClosure, m_N),
CLOSURE_FLOAT_PARAM(RefractionClosure, m_eta),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(RefractionClosure)
};
return params;
}
CLOSURE_PREPARE(bsdf_refraction_prepare, RefractionClosure)

View File

@@ -87,10 +87,14 @@ public:
ClosureParam bsdf_transparent_params[] = {
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(TransparentClosure)
};
ClosureParam *bsdf_transparent_params()
{
static ClosureParam params[] = {
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(TransparentClosure)
};
return params;
}
CLOSURE_PREPARE(bsdf_transparent_prepare, TransparentClosure)

View File

@@ -211,14 +211,18 @@ public:
ClosureParam bsdf_ward_params[] = {
CLOSURE_VECTOR_PARAM(WardClosure, m_N),
CLOSURE_VECTOR_PARAM(WardClosure, m_T),
CLOSURE_FLOAT_PARAM(WardClosure, m_ax),
CLOSURE_FLOAT_PARAM(WardClosure, m_ay),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(WardClosure)
};
ClosureParam *bsdf_ward_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(WardClosure, m_N),
CLOSURE_VECTOR_PARAM(WardClosure, m_T),
CLOSURE_FLOAT_PARAM(WardClosure, m_ax),
CLOSURE_FLOAT_PARAM(WardClosure, m_ay),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(WardClosure)
};
return params;
}
CLOSURE_PREPARE(bsdf_ward_prepare, WardClosure)

View File

@@ -222,19 +222,27 @@ public:
ClosureParam bsdf_westin_backscatter_params[] = {
CLOSURE_VECTOR_PARAM(WestinBackscatterClosure, m_N),
CLOSURE_FLOAT_PARAM(WestinBackscatterClosure, m_roughness),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(WestinBackscatterClosure)
};
ClosureParam *bsdf_westin_backscatter_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(WestinBackscatterClosure, m_N),
CLOSURE_FLOAT_PARAM(WestinBackscatterClosure, m_roughness),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(WestinBackscatterClosure)
};
return params;
}
ClosureParam bsdf_westin_sheen_params[] = {
CLOSURE_VECTOR_PARAM(WestinSheenClosure, m_N),
CLOSURE_FLOAT_PARAM(WestinSheenClosure, m_edginess),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(WestinSheenClosure)
};
ClosureParam *bsdf_westin_sheen_params()
{
static ClosureParam params[] = {
CLOSURE_VECTOR_PARAM(WestinSheenClosure, m_N),
CLOSURE_FLOAT_PARAM(WestinSheenClosure, m_edginess),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(WestinSheenClosure)
};
return params;
}
CLOSURE_PREPARE(bsdf_westin_backscatter_prepare, WestinBackscatterClosure)
CLOSURE_PREPARE(bsdf_westin_sheen_prepare, WestinSheenClosure)

View File

@@ -94,11 +94,15 @@ public:
ClosureParam closure_bssrdf_cubic_params[] = {
CLOSURE_COLOR_PARAM(BSSRDFCubicClosure, m_radius),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(BSSRDFCubicClosure)
};
ClosureParam *closure_bssrdf_cubic_params()
{
static ClosureParam params[] = {
CLOSURE_COLOR_PARAM(BSSRDFCubicClosure, m_radius),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(BSSRDFCubicClosure)
};
return params;
}
CLOSURE_PREPARE(closure_bssrdf_cubic_prepare, BSSRDFCubicClosure)

View File

@@ -69,11 +69,15 @@ public:
};
ClosureParam closure_debug_params[] = {
CLOSURE_STRING_PARAM(DebugClosure, m_tag),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(DebugClosure)
};
ClosureParam *closure_debug_params()
{
static ClosureParam params[] = {
CLOSURE_STRING_PARAM(DebugClosure, m_tag),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(DebugClosure)
};
return params;
}
CLOSURE_PREPARE(closure_debug_prepare, DebugClosure)

View File

@@ -97,10 +97,14 @@ public:
ClosureParam closure_emission_params[] = {
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(GenericEmissiveClosure)
};
ClosureParam *closure_emission_params()
{
static ClosureParam params[] = {
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(GenericEmissiveClosure)
};
return params;
}
CLOSURE_PREPARE(closure_emission_prepare, GenericEmissiveClosure)

View File

@@ -64,28 +64,28 @@ static void register_closure(OSL::ShadingSystem *ss, const char *name, int id, O
void OSLShader::register_closures(OSL::ShadingSystem *ss)
{
register_closure(ss, "diffuse", OSL_CLOSURE_BSDF_DIFFUSE_ID, bsdf_diffuse_params, bsdf_diffuse_prepare);
register_closure(ss, "oren_nayar", OSL_CLOSURE_BSDF_OREN_NAYAR_ID, bsdf_oren_nayar_params, bsdf_oren_nayar_prepare);
register_closure(ss, "translucent", OSL_CLOSURE_BSDF_TRANSLUCENT_ID, bsdf_translucent_params, bsdf_translucent_prepare);
register_closure(ss, "reflection", OSL_CLOSURE_BSDF_REFLECTION_ID, bsdf_reflection_params, bsdf_reflection_prepare);
register_closure(ss, "refraction", OSL_CLOSURE_BSDF_REFRACTION_ID, bsdf_refraction_params, bsdf_refraction_prepare);
register_closure(ss, "transparent", OSL_CLOSURE_BSDF_TRANSPARENT_ID, bsdf_transparent_params, bsdf_transparent_prepare);
register_closure(ss, "microfacet_ggx", OSL_CLOSURE_BSDF_MICROFACET_GGX_ID, bsdf_microfacet_ggx_params, bsdf_microfacet_ggx_prepare);
register_closure(ss, "microfacet_ggx_refraction", OSL_CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID, bsdf_microfacet_ggx_refraction_params, bsdf_microfacet_ggx_refraction_prepare);
register_closure(ss, "microfacet_beckmann", OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_ID, bsdf_microfacet_beckmann_params, bsdf_microfacet_beckmann_prepare);
register_closure(ss, "microfacet_beckmann_refraction", OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID, bsdf_microfacet_beckmann_refraction_params, bsdf_microfacet_beckmann_refraction_prepare);
register_closure(ss, "ward", OSL_CLOSURE_BSDF_WARD_ID, bsdf_ward_params, bsdf_ward_prepare);
register_closure(ss, "phong", OSL_CLOSURE_BSDF_PHONG_ID, bsdf_phong_params, bsdf_phong_prepare);
register_closure(ss, "phong_ramp", OSL_CLOSURE_BSDF_PHONG_RAMP_ID, bsdf_phong_ramp_params, bsdf_phong_ramp_prepare);
register_closure(ss, "ashikhmin_velvet", OSL_CLOSURE_BSDF_ASHIKHMIN_VELVET_ID, bsdf_ashikhmin_velvet_params, bsdf_ashikhmin_velvet_prepare);
register_closure(ss, "westin_backscatter", OSL_CLOSURE_BSDF_WESTIN_BACKSCATTER_ID, bsdf_westin_backscatter_params, bsdf_westin_backscatter_prepare);
register_closure(ss, "westin_sheen", OSL_CLOSURE_BSDF_WESTIN_SHEEN_ID, bsdf_westin_sheen_params, bsdf_westin_sheen_prepare);
register_closure(ss, "bssrdf_cubic", OSL_CLOSURE_BSSRDF_CUBIC_ID, closure_bssrdf_cubic_params, closure_bssrdf_cubic_prepare);
register_closure(ss, "emission", OSL_CLOSURE_EMISSION_ID, closure_emission_params, closure_emission_prepare);
register_closure(ss, "debug", OSL_CLOSURE_DEBUG_ID, closure_debug_params, closure_debug_prepare);
register_closure(ss, "background", OSL_CLOSURE_BACKGROUND_ID, closure_background_params, closure_background_prepare);
register_closure(ss, "holdout", OSL_CLOSURE_HOLDOUT_ID, closure_holdout_params, closure_holdout_prepare);
register_closure(ss, "subsurface", OSL_CLOSURE_SUBSURFACE_ID, closure_subsurface_params, closure_subsurface_prepare);
register_closure(ss, "diffuse", OSL_CLOSURE_BSDF_DIFFUSE_ID, bsdf_diffuse_params(), bsdf_diffuse_prepare);
register_closure(ss, "oren_nayar", OSL_CLOSURE_BSDF_OREN_NAYAR_ID, bsdf_oren_nayar_params(), bsdf_oren_nayar_prepare);
register_closure(ss, "translucent", OSL_CLOSURE_BSDF_TRANSLUCENT_ID, bsdf_translucent_params(), bsdf_translucent_prepare);
register_closure(ss, "reflection", OSL_CLOSURE_BSDF_REFLECTION_ID, bsdf_reflection_params(), bsdf_reflection_prepare);
register_closure(ss, "refraction", OSL_CLOSURE_BSDF_REFRACTION_ID, bsdf_refraction_params(), bsdf_refraction_prepare);
register_closure(ss, "transparent", OSL_CLOSURE_BSDF_TRANSPARENT_ID, bsdf_transparent_params(), bsdf_transparent_prepare);
register_closure(ss, "microfacet_ggx", OSL_CLOSURE_BSDF_MICROFACET_GGX_ID, bsdf_microfacet_ggx_params(), bsdf_microfacet_ggx_prepare);
register_closure(ss, "microfacet_ggx_refraction", OSL_CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID, bsdf_microfacet_ggx_refraction_params(), bsdf_microfacet_ggx_refraction_prepare);
register_closure(ss, "microfacet_beckmann", OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_ID, bsdf_microfacet_beckmann_params(), bsdf_microfacet_beckmann_prepare);
register_closure(ss, "microfacet_beckmann_refraction", OSL_CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID, bsdf_microfacet_beckmann_refraction_params(), bsdf_microfacet_beckmann_refraction_prepare);
register_closure(ss, "ward", OSL_CLOSURE_BSDF_WARD_ID, bsdf_ward_params(), bsdf_ward_prepare);
register_closure(ss, "phong", OSL_CLOSURE_BSDF_PHONG_ID, bsdf_phong_params(), bsdf_phong_prepare);
register_closure(ss, "phong_ramp", OSL_CLOSURE_BSDF_PHONG_RAMP_ID, bsdf_phong_ramp_params(), bsdf_phong_ramp_prepare);
register_closure(ss, "ashikhmin_velvet", OSL_CLOSURE_BSDF_ASHIKHMIN_VELVET_ID, bsdf_ashikhmin_velvet_params(), bsdf_ashikhmin_velvet_prepare);
register_closure(ss, "westin_backscatter", OSL_CLOSURE_BSDF_WESTIN_BACKSCATTER_ID, bsdf_westin_backscatter_params(), bsdf_westin_backscatter_prepare);
register_closure(ss, "westin_sheen", OSL_CLOSURE_BSDF_WESTIN_SHEEN_ID, bsdf_westin_sheen_params(), bsdf_westin_sheen_prepare);
register_closure(ss, "bssrdf_cubic", OSL_CLOSURE_BSSRDF_CUBIC_ID, closure_bssrdf_cubic_params(), closure_bssrdf_cubic_prepare);
register_closure(ss, "emission", OSL_CLOSURE_EMISSION_ID, closure_emission_params(), closure_emission_prepare);
register_closure(ss, "debug", OSL_CLOSURE_DEBUG_ID, closure_debug_params(), closure_debug_prepare);
register_closure(ss, "background", OSL_CLOSURE_BACKGROUND_ID, closure_background_params(), closure_background_prepare);
register_closure(ss, "holdout", OSL_CLOSURE_HOLDOUT_ID, closure_holdout_params(), closure_holdout_prepare);
register_closure(ss, "subsurface", OSL_CLOSURE_SUBSURFACE_ID, closure_subsurface_params(), closure_subsurface_prepare);
}
CCL_NAMESPACE_END

View File

@@ -64,28 +64,28 @@ enum {
OSL_CLOSURE_SUBSURFACE_ID
};
extern OSL::ClosureParam bsdf_diffuse_params[];
extern OSL::ClosureParam bsdf_oren_nayar_params[];
extern OSL::ClosureParam bsdf_translucent_params[];
extern OSL::ClosureParam bsdf_reflection_params[];
extern OSL::ClosureParam bsdf_refraction_params[];
extern OSL::ClosureParam bsdf_transparent_params[];
extern OSL::ClosureParam bsdf_microfacet_ggx_params[];
extern OSL::ClosureParam bsdf_microfacet_ggx_refraction_params[];
extern OSL::ClosureParam bsdf_microfacet_beckmann_params[];
extern OSL::ClosureParam bsdf_microfacet_beckmann_refraction_params[];
extern OSL::ClosureParam bsdf_ward_params[];
extern OSL::ClosureParam bsdf_phong_params[];
extern OSL::ClosureParam bsdf_phong_ramp_params[];
extern OSL::ClosureParam bsdf_ashikhmin_velvet_params[];
extern OSL::ClosureParam bsdf_westin_backscatter_params[];
extern OSL::ClosureParam bsdf_westin_sheen_params[];
extern OSL::ClosureParam closure_bssrdf_cubic_params[];
extern OSL::ClosureParam closure_emission_params[];
extern OSL::ClosureParam closure_debug_params[];
extern OSL::ClosureParam closure_background_params[];
extern OSL::ClosureParam closure_holdout_params[];
extern OSL::ClosureParam closure_subsurface_params[];
OSL::ClosureParam *bsdf_diffuse_params();
OSL::ClosureParam *bsdf_oren_nayar_params();
OSL::ClosureParam *bsdf_translucent_params();
OSL::ClosureParam *bsdf_reflection_params();
OSL::ClosureParam *bsdf_refraction_params();
OSL::ClosureParam *bsdf_transparent_params();
OSL::ClosureParam *bsdf_microfacet_ggx_params();
OSL::ClosureParam *bsdf_microfacet_ggx_refraction_params();
OSL::ClosureParam *bsdf_microfacet_beckmann_params();
OSL::ClosureParam *bsdf_microfacet_beckmann_refraction_params();
OSL::ClosureParam *bsdf_ward_params();
OSL::ClosureParam *bsdf_phong_params();
OSL::ClosureParam *bsdf_phong_ramp_params();
OSL::ClosureParam *bsdf_ashikhmin_velvet_params();
OSL::ClosureParam *bsdf_westin_backscatter_params();
OSL::ClosureParam *bsdf_westin_sheen_params();
OSL::ClosureParam *closure_bssrdf_cubic_params();
OSL::ClosureParam *closure_emission_params();
OSL::ClosureParam *closure_debug_params();
OSL::ClosureParam *closure_background_params();
OSL::ClosureParam *closure_holdout_params();
OSL::ClosureParam *closure_subsurface_params();
void bsdf_diffuse_prepare(OSL::RendererServices *, int id, void *data);
void bsdf_oren_nayar_prepare(OSL::RendererServices *, int id, void *data);

View File

@@ -139,15 +139,27 @@ static void flatten_surface_closure_tree(ShaderData *sd, bool no_glossy,
float sample_weight = fabsf(average(weight)) * albedo;
sc.sample_weight = sample_weight;
sc.type = CLOSURE_BSDF_ID;
/* scattering flags */
if (scattering == OSL::Labels::DIFFUSE)
if (scattering == OSL::Labels::DIFFUSE) {
sd->flag |= SD_BSDF | SD_BSDF_HAS_EVAL;
else if (scattering == OSL::Labels::GLOSSY)
sc.type = CLOSURE_BSDF_DIFFUSE_ID;
}
else if (scattering == OSL::Labels::GLOSSY) {
sd->flag |= SD_BSDF | SD_BSDF_HAS_EVAL | SD_BSDF_GLOSSY;
else
sc.type = CLOSURE_BSDF_GLOSSY_ID;
}
else if (scattering == OSL::Labels::STRAIGHT) {
sd->flag |= SD_BSDF;
sc.type = CLOSURE_BSDF_TRANSPARENT_ID;
}
else {
/* todo: we don't actually have a way to determine if
* this closure will reflect/transmit. could add our own
* own scattering flag that do give this info */
sd->flag |= SD_BSDF;
sc.type = CLOSURE_BSDF_GLOSSY_ID;
}
/* add */
sd->closure[sd->num_closure++] = sc;

View File

@@ -122,14 +122,18 @@ public:
ClosureParam closure_subsurface_params[] = {
CLOSURE_FLOAT_PARAM(SubsurfaceClosure, m_eta),
CLOSURE_FLOAT_PARAM(SubsurfaceClosure, m_g),
CLOSURE_COLOR_PARAM(SubsurfaceClosure, m_mfp),
CLOSURE_COLOR_PARAM(SubsurfaceClosure, m_albedo),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(SubsurfaceClosure)
};
ClosureParam *closure_subsurface_params()
{
static ClosureParam params[] = {
CLOSURE_FLOAT_PARAM(SubsurfaceClosure, m_eta),
CLOSURE_FLOAT_PARAM(SubsurfaceClosure, m_g),
CLOSURE_COLOR_PARAM(SubsurfaceClosure, m_mfp),
CLOSURE_COLOR_PARAM(SubsurfaceClosure, m_albedo),
CLOSURE_STRING_KEYPARAM("label"),
CLOSURE_FINISH_PARAM(SubsurfaceClosure)
};
return params;
}
CLOSURE_PREPARE(closure_subsurface_prepare, SubsurfaceClosure)

View File

@@ -287,16 +287,18 @@ typedef enum ClosureType {
CLOSURE_BSDF_DIFFUSE_ID,
CLOSURE_BSDF_OREN_NAYAR_ID,
CLOSURE_BSDF_GLOSSY_ID,
CLOSURE_BSDF_REFLECTION_ID,
CLOSURE_BSDF_MICROFACET_GGX_ID,
CLOSURE_BSDF_MICROFACET_BECKMANN_ID,
CLOSURE_BSDF_WARD_ID,
CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
CLOSURE_BSDF_WESTIN_SHEEN_ID,
CLOSURE_BSDF_TRANSMISSION_ID,
CLOSURE_BSDF_TRANSLUCENT_ID,
CLOSURE_BSDF_REFRACTION_ID,
CLOSURE_BSDF_WESTIN_BACKSCATTER_ID,
CLOSURE_BSDF_ASHIKHMIN_VELVET_ID,
CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID,
CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID,
CLOSURE_BSDF_GLASS_ID,
@@ -320,8 +322,8 @@ typedef enum ClosureType {
/* watch this, being lazy with memory usage */
#define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_TRANSPARENT_ID)
#define CLOSURE_IS_BSDF_DIFFUSE(type) (type >= CLOSURE_BSDF_DIFFUSE_ID && type <= CLOSURE_BSDF_OREN_NAYAR_ID)
#define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_REFLECTION_ID && type <= CLOSURE_BSDF_WESTIN_SHEEN_ID)
#define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSLUCENT_ID && type <= CLOSURE_BSDF_GLASS_ID)
#define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_GLOSSY_ID && type <= CLOSURE_BSDF_WESTIN_SHEEN_ID)
#define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSMISSION_ID && type <= CLOSURE_BSDF_GLASS_ID)
#define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_ISOTROPIC_ID)
#define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
#define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)

View File

@@ -193,6 +193,7 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
}
}
}
#ifdef __CAMERA_MOTION__
else if(need_motion == Scene::MOTION_BLUR) {
/* todo: exact camera position will not be hit this way */
if(use_motion) {
@@ -200,6 +201,7 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
kcam->have_motion = 1;
}
}
#endif
/* depth of field */
kcam->aperturesize = aperturesize;
@@ -208,7 +210,11 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
kcam->bladesrotation = bladesrotation;
/* motion blur */
#ifdef __CAMERA_MOTION__
kcam->shuttertime = (need_motion == Scene::MOTION_BLUR) ? shuttertime: 0.0f;
#else
kcam->shuttertime = 0.0f;
#endif
/* type */
kcam->type = type;

View File

@@ -68,20 +68,15 @@ static void dump_background_pixels(Device *device, DeviceScene *dscene, int res,
main_task.shader_w = width*height;
/* disabled splitting for now, there's an issue with multi-GPU mem_copy_from */
#if 0
list<DeviceTask> split_tasks;
main_task.split_max_size(split_tasks, 128*128);
foreach(DeviceTask& task, split_tasks) {
device->task_add(task);
device->task_wait();
device->mem_copy_from(d_output, task.shader_x, 1, task.shader_w, sizeof(float4));
}
#else
device->task_add(main_task);
device->task_wait();
#endif
device->mem_copy_from(d_output, 0, 1, d_output.size(), sizeof(float4));
device->mem_free(d_input);
device->mem_free(d_output);

View File

@@ -722,7 +722,11 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen
foreach(Shader *shader, scene->shaders)
shader->need_update_attributes = false;
#ifdef __OBJECT_MOTION__
bool motion_blur = scene->need_motion() == Scene::MOTION_BLUR;
#else
bool motion_blur = false;
#endif
foreach(Object *object, scene->objects)
object->compute_bounds(motion_blur);

View File

@@ -1644,14 +1644,18 @@ TextureCoordinateNode::TextureCoordinateNode()
add_output("Camera", SHADER_SOCKET_POINT);
add_output("Window", SHADER_SOCKET_POINT);
add_output("Reflection", SHADER_SOCKET_NORMAL);
from_dupli = false;
}
void TextureCoordinateNode::attributes(AttributeRequestSet *attributes)
{
if(!output("Generated")->links.empty())
attributes->add(ATTR_STD_GENERATED);
if(!output("UV")->links.empty())
attributes->add(ATTR_STD_UV);
if(!from_dupli) {
if(!output("Generated")->links.empty())
attributes->add(ATTR_STD_GENERATED);
if(!output("UV")->links.empty())
attributes->add(ATTR_STD_UV);
}
ShaderNode::attributes(attributes);
}
@@ -1702,14 +1706,14 @@ void TextureCoordinateNode::compile(SVMCompiler& compiler)
out = output("UV");
if(!out->links.empty()) {
if(from_dupli) {
compiler.stack_assign(out);
compiler.add_node(texco_node, NODE_TEXCO_DUPLI_UV, out->stack_offset);
}
else {
int attr = compiler.attribute(ATTR_STD_UV);
compiler.stack_assign(out);
compiler.add_node(attr_node, attr, out->stack_offset, NODE_ATTR_FLOAT3);
}
else {
compiler.stack_assign(out);
compiler.add_node(texco_node, NODE_TEXCO_DUPLI_UV, out->stack_offset);
}
}
out = output("Object");

View File

@@ -220,6 +220,7 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
memcpy(&objects[offset+8], &mtfm_pre, sizeof(float4)*4);
memcpy(&objects[offset+12], &mtfm_post, sizeof(float4)*4);
}
#ifdef __OBJECT_MOTION__
else if(need_motion == Scene::MOTION_BLUR) {
if(ob->use_motion) {
/* decompose transformations for interpolation */
@@ -234,6 +235,7 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
memcpy(&objects[offset+8], &no_motion, sizeof(float4));
}
}
#endif
/* dupli object coords */
objects[offset+16] = make_float4(ob->dupli_generated[0], ob->dupli_generated[1], ob->dupli_generated[2], 0.0f);
@@ -297,7 +299,11 @@ void ObjectManager::apply_static_transforms(Scene *scene, Progress& progress)
/* counter mesh users */
map<Mesh*, int> mesh_users;
#ifdef __OBJECT_MOTION__
bool motion_blur = scene->need_motion() == Scene::MOTION_BLUR;
#else
bool motion_blur = false;
#endif
foreach(Object *object, scene->objects) {
map<Mesh*, int>::iterator it = mesh_users.find(object->mesh);

View File

@@ -274,17 +274,6 @@ void SVMCompiler::stack_clear_users(ShaderNode *node, set<ShaderNode*>& done)
foreach(ShaderInput *in, output->links)
in->stack_offset = SVM_STACK_INVALID;
/* unmark any nodes that have no more valid outputs, see [#31806] */
if(done.find(output->parent) != done.end()) {
all_done = true;
foreach(ShaderOutput *pout, output->parent->outputs)
if(pout->stack_offset != SVM_STACK_INVALID)
all_done = false;
if(all_done)
done.erase(output->parent);
}
}
}
}

View File

@@ -60,6 +60,7 @@ public:
bool join()
{
joined = true;
return pthread_join(pthread_id, NULL) == 0;
}

View File

@@ -384,22 +384,22 @@ InternalNode *Octree::addTriangle(InternalNode *node, CubeTriangleIsect *p, int
/* Pruning using intersection test */
if (subp->isIntersecting()) {
if (!hasChild(node, i)) {
if (!node->has_child(i)) {
if (height == 1)
node = addLeafChild(node, i, count, createLeaf(0));
else
node = addInternalChild(node, i, count, createInternal(0));
}
Node *chd = getChild(node, count);
Node *chd = node->get_child(count);
if (node->is_child_leaf(i))
setChild(node, count, (Node *)updateCell(&chd->leaf, subp));
node->set_child(count, (Node *)updateCell(&chd->leaf, subp));
else
setChild(node, count, (Node *)addTriangle(&chd->internal, subp, height - 1));
node->set_child(count, (Node *)addTriangle(&chd->internal, subp, height - 1));
}
}
if (hasChild(node, i))
if (node->has_child(i))
count++;
}
@@ -450,11 +450,11 @@ void Octree::preparePrimalEdgesMask(InternalNode *node)
{
int count = 0;
for (int i = 0; i < 8; i++) {
if (hasChild(node, i)) {
if (node->has_child(i)) {
if (node->is_child_leaf(i))
createPrimalEdgesMask(&getChild(node, count)->leaf);
createPrimalEdgesMask(&node->get_child(count)->leaf);
else
preparePrimalEdgesMask(&getChild(node, count)->internal);
preparePrimalEdgesMask(&node->get_child(count)->internal);
count++;
}
@@ -487,7 +487,7 @@ Node *Octree::trace(Node *newnode, int *st, int len, int depth, PathList *& path
// Get children paths
int chdleaf[8];
fillChildren(&newnode->internal, chd, chdleaf);
newnode->internal.fill_children(chd, chdleaf);
// int count = 0;
for (i = 0; i < 8; i++) {
@@ -510,7 +510,7 @@ Node *Octree::trace(Node *newnode, int *st, int len, int depth, PathList *& path
int df[2] = {depth - 1, depth - 1};
int *nstf[2];
fillChildren(&newnode->internal, chd, chdleaf);
newnode->internal.fill_children(chd, chdleaf);
for (i = 0; i < 12; i++) {
int c[2] = {cellProcFaceMask[i][0], cellProcFaceMask[i][1]};
@@ -590,7 +590,7 @@ void Octree::findPaths(Node *node[2], int leaf[2], int depth[2], int *st[2], int
for (j = 0; j < 2; j++) {
if (!leaf[j]) {
fillChildren(&node[j]->internal, chd[j], chdleaf[j]);
node[j]->internal.fill_children(chd[j], chdleaf[j]);
int len = (dimen >> (maxDepth - depth[j] + 1));
for (i = 0; i < 8; i++) {
@@ -966,10 +966,10 @@ Node *Octree::patch(Node *newnode, int st[3], int len, PathList *rings)
st[1] + len * vertmap[i][1],
st[2] + len * vertmap[i][2]
};
patch(getChild(&newnode->internal, count), nori, len, zlists[i]);
patch(newnode->internal.get_child(count), nori, len, zlists[i]);
}
if (hasChild(&newnode->internal, i)) {
if (newnode->internal.has_child(i)) {
count++;
}
}
@@ -1408,16 +1408,16 @@ Node *Octree::locateCell(InternalNode *node, int st[3], int len, int ori[3], int
rst[1] = st[1] + vertmap[ind][1] * len;
rst[2] = st[2] + vertmap[ind][2] * len;
if (hasChild(node, ind)) {
int count = getChildCount(node, ind);
Node *chd = getChild(node, count);
if (node->has_child(ind)) {
int count = node->get_child_count(ind);
Node *chd = node->get_child(count);
if (node->is_child_leaf(ind)) {
rleaf = chd;
rlen = len;
}
else {
// Recur
setChild(node, count, locateCell(&chd->internal, rst, len, ori, dir, side, rleaf, rst, rlen));
node->set_child(count, locateCell(&chd->internal, rst, len, ori, dir, side, rleaf, rst, rlen));
}
}
else {
@@ -1724,7 +1724,7 @@ void Octree::buildSigns(unsigned char table[], Node *node, int isLeaf, int sg, i
// Internal node
Node *chd[8];
int leaf[8];
fillChildren(&node->internal, chd, leaf);
node->internal.fill_children(chd, leaf);
// Get the signs at the corners of the first cube
rvalue[0] = sg;
@@ -1784,8 +1784,8 @@ void Octree::clearProcessBits(Node *node, int height)
// Internal cell, recur
int count = 0;
for (i = 0; i < 8; i++) {
if (hasChild(&node->internal, i)) {
clearProcessBits(getChild(&node->internal, count), height - 1);
if (node->internal.has_child(i)) {
clearProcessBits(node->internal.get_child(count), height - 1);
count++;
}
}
@@ -2016,13 +2016,13 @@ int Octree::floodFill(Node *node, int st[3], int len, int height, int threshold)
int count = 0;
len >>= 1;
for (i = 0; i < 8; i++) {
if (hasChild((InternalNode *)node, i)) {
if (node->internal.has_child(i)) {
int nst[3];
nst[0] = st[0] + vertmap[i][0] * len;
nst[1] = st[1] + vertmap[i][1] * len;
nst[2] = st[2] + vertmap[i][2] * len;
int d = floodFill(getChild((InternalNode *)node, count), nst, len, height - 1, threshold);
int d = floodFill(node->internal.get_child(count), nst, len, height - 1, threshold);
if (d > maxtotal) {
maxtotal = d;
}
@@ -2062,9 +2062,9 @@ void Octree::writeOut()
void Octree::countIntersection(Node *node, int height, int& nedge, int& ncell, int& nface)
{
if (height > 0) {
int total = getNumChildren(&node->internal);
int total = node->internal.get_num_children();
for (int i = 0; i < total; i++) {
countIntersection(getChild(&node->internal, i), height - 1, nedge, ncell, nface);
countIntersection(node->internal.get_child(i), height - 1, nedge, ncell, nface);
}
}
else {
@@ -2128,8 +2128,32 @@ static void solve_least_squares(const float halfA[], const float b[],
rvalue[i] = result(i);
}
static void mass_point(float mp[3], const float pts[12][3], const int parity[12])
{
int ec = 0;
for (int i = 0; i < 12; i++) {
if (parity[i]) {
const float *p = pts[i];
mp[0] += p[0];
mp[1] += p[1];
mp[2] += p[2];
ec++;
}
}
if (ec == 0) {
return;
}
mp[0] /= ec;
mp[1] /= ec;
mp[2] /= ec;
}
static void minimize(float rvalue[3], float mp[3], const float pts[12][3],
const float norms[12][3], const int parity[12])
const float norms[12][3], const int parity[12])
{
float ata[6] = {0, 0, 0, 0, 0, 0};
float atb[3] = {0, 0, 0};
@@ -2175,34 +2199,51 @@ static void minimize(float rvalue[3], float mp[3], const float pts[12][3],
solve_least_squares(ata, atb, mp, rvalue);
}
void Octree::computeMinimizer(LeafNode *leaf, int st[3], int len, float rvalue[3])
void Octree::computeMinimizer(const LeafNode *leaf, int st[3], int len,
float rvalue[3]) const
{
// First, gather all edge intersections
float pts[12][3], norms[12][3];
int parity[12];
fillEdgeIntersections(leaf, st, len, pts, norms, parity);
// Next, construct QEF and minimizer
float mp[3] = {0, 0, 0};
minimize(rvalue, mp, pts, norms, parity);
/* Restraining the location of the minimizer */
float nh1 = hermite_num * len;
float nh2 = (1 + hermite_num) * len;
if ((mode == DUALCON_MASS_POINT || mode == DUALCON_CENTROID) ||
(rvalue[0] < st[0] - nh1 || rvalue[1] < st[1] - nh1 || rvalue[2] < st[2] - nh1 ||
rvalue[0] > st[0] + nh2 || rvalue[1] > st[1] + nh2 || rvalue[2] > st[2] + nh2)) {
if (mode == DUALCON_CENTROID) {
// Use centroids
switch (mode) {
case DUALCON_CENTROID:
rvalue[0] = (float) st[0] + len / 2;
rvalue[1] = (float) st[1] + len / 2;
rvalue[2] = (float) st[2] + len / 2;
}
else {
// Use mass point instead
rvalue[0] = mp[0];
rvalue[1] = mp[1];
rvalue[2] = mp[2];
break;
case DUALCON_MASS_POINT:
rvalue[0] = rvalue[1] = rvalue[2] = 0;
mass_point(rvalue, pts, parity);
break;
default: {
// Sharp features */
// construct QEF and minimizer
float mp[3] = {0, 0, 0};
minimize(rvalue, mp, pts, norms, parity);
/* Restraining the location of the minimizer */
float nh1 = hermite_num * len;
float nh2 = (1 + hermite_num) * len;
if (rvalue[0] < st[0] - nh1 ||
rvalue[1] < st[1] - nh1 ||
rvalue[2] < st[2] - nh1 ||
rvalue[0] > st[0] + nh2 ||
rvalue[1] > st[1] + nh2 ||
rvalue[2] > st[2] + nh2)
{
// Use mass point instead
rvalue[0] = mp[0];
rvalue[1] = mp[1];
rvalue[2] = mp[2];
}
break;
}
}
}
@@ -2253,13 +2294,13 @@ void Octree::generateMinimizer(Node *node, int st[3], int len, int height, int&
int count = 0;
len >>= 1;
for (i = 0; i < 8; i++) {
if (hasChild(&node->internal, i)) {
if (node->internal.has_child(i)) {
int nst[3];
nst[0] = st[0] + vertmap[i][0] * len;
nst[1] = st[1] + vertmap[i][1] * len;
nst[2] = st[2] + vertmap[i][2] * len;
generateMinimizer(getChild(&node->internal, count),
generateMinimizer(node->internal.get_child(count),
nst, len, height - 1, offset);
count++;
}
@@ -2344,9 +2385,9 @@ void Octree::edgeProcContour(Node *node[4], int leaf[4], int depth[4], int maxde
Node *chd[4][8];
for (j = 0; j < 4; j++) {
for (i = 0; i < 8; i++) {
chd[j][i] = ((!leaf[j]) && hasChild(&node[j]->internal, i)) ?
getChild(&node[j]->internal,
getChildCount(&node[j]->internal, i)) : NULL;
chd[j][i] = ((!leaf[j]) && node[j]->internal.has_child(i)) ?
node[j]->internal.get_child(
node[j]->internal.get_child_count(i)) : NULL;
}
}
@@ -2391,9 +2432,9 @@ void Octree::faceProcContour(Node *node[2], int leaf[2], int depth[2], int maxde
Node *chd[2][8];
for (j = 0; j < 2; j++) {
for (i = 0; i < 8; i++) {
chd[j][i] = ((!leaf[j]) && hasChild(&node[j]->internal, i)) ?
getChild(&node[j]->internal,
getChildCount(&node[j]->internal, i)) : NULL;
chd[j][i] = ((!leaf[j]) && node[j]->internal.has_child(i)) ?
node[j]->internal.get_child(
node[j]->internal.get_child_count(i)) : NULL;
}
}
@@ -2460,9 +2501,8 @@ void Octree::cellProcContour(Node *node, int leaf, int depth)
// Fill children nodes
Node *chd[8];
for (i = 0; i < 8; i++) {
chd[i] = ((!leaf) && hasChild(&node->internal, i)) ?
getChild(&node->internal,
getChildCount(&node->internal, i)) : NULL;
chd[i] = ((!leaf) && node->internal.has_child(i)) ?
node->internal.get_child(node->internal.get_child_count(i)) : NULL;
}
// 8 Cell calls
@@ -2539,8 +2579,8 @@ void Octree::edgeProcParity(Node *node[4], int leaf[4], int depth[4], int maxdep
Node *chd[4][8];
for (j = 0; j < 4; j++) {
for (i = 0; i < 8; i++) {
chd[j][i] = ((!leaf[j]) && hasChild(&node[j]->internal, i)) ?
getChild(&node[j]->internal, getChildCount(&node[j]->internal, i)) : NULL;
chd[j][i] = ((!leaf[j]) && node[j]->internal.has_child(i)) ?
node[j]->internal.get_child( node[j]->internal.get_child_count(i)) : NULL;
}
}
@@ -2589,9 +2629,9 @@ void Octree::faceProcParity(Node *node[2], int leaf[2], int depth[2], int maxdep
Node *chd[2][8];
for (j = 0; j < 2; j++) {
for (i = 0; i < 8; i++) {
chd[j][i] = ((!leaf[j]) && hasChild(&node[j]->internal, i)) ?
getChild(&node[j]->internal,
getChildCount(&node[j]->internal, i)) : NULL;
chd[j][i] = ((!leaf[j]) && node[j]->internal.has_child(i)) ?
node[j]->internal.get_child(
node[j]->internal.get_child_count(i)) : NULL;
}
}
@@ -2658,9 +2698,8 @@ void Octree::cellProcParity(Node *node, int leaf, int depth)
// Fill children nodes
Node *chd[8];
for (i = 0; i < 8; i++) {
chd[i] = ((!leaf) && hasChild((InternalNode *)node, i)) ?
getChild((InternalNode *)node,
getChildCount((InternalNode *)node, i)) : NULL;
chd[i] = ((!leaf) && node->internal.has_child(i)) ?
node->internal.get_child(node->internal.get_child_count(i)) : NULL;
}
// 8 Cell calls
@@ -2803,3 +2842,7 @@ const int dirEdge[3][4] = {
{7, 6, 5, 4},
{11, 10, 9, 8}
};
int InternalNode::numChildrenTable[256];
int InternalNode::childrenCountTable[256][8];
int InternalNode::childrenIndexTable[256][8];

View File

@@ -56,12 +56,18 @@
#define EDGE_FLOATS 4
union Node;
struct LeafNode;
struct InternalNode {
/* Treat as bitfield, bit N indicates whether child N exists or not */
unsigned char has_child;
/* Treat as bitfield, bit N indicates whether child N is a leaf or not */
unsigned char child_is_leaf;
/* Initialized in Octree::BuildTable */
static int numChildrenTable[256];
static int childrenCountTable[256][8];
static int childrenIndexTable[256][8];
/* Bit N indicates whether child N exists or not */
unsigned char has_child_bitfield;
/* Bit N indicates whether child N is a leaf or not */
unsigned char child_is_leaf_bitfield;
/* Can have up to eight children */
Node *children[0];
@@ -69,7 +75,78 @@ struct InternalNode {
/// Test if child is leaf
int is_child_leaf(int index) const
{
return (child_is_leaf >> index) & 1;
return (child_is_leaf_bitfield >> index) & 1;
}
/// If child index exists
int has_child(int index) const
{
return (has_child_bitfield >> index) & 1;
}
/// Get the pointer to child index
Node *get_child(int count)
{
return children[count];
}
const Node *get_child(int count) const
{
return children[count];
}
/// Get total number of children
int get_num_children() const
{
return numChildrenTable[has_child_bitfield];
}
/// Get the count of children
int get_child_count(int index) const
{
return childrenCountTable[has_child_bitfield][index];
}
int get_child_index(int count)
{
return childrenIndexTable[has_child_bitfield][count];
}
const int *get_child_counts() const
{
return childrenCountTable[has_child_bitfield];
}
/// Get all children
void fill_children(Node *children[8], int leaf[8])
{
int count = 0;
for (int i = 0; i < 8; i++) {
leaf[i] = is_child_leaf(i);
if (has_child(i)) {
children[i] = get_child(count);
count++;
}
else {
children[i] = NULL;
leaf[i] = 0;
}
}
}
/// Sets the child pointer
void set_child(int count, Node *chd)
{
children[count] = chd;
}
void set_internal_child(int index, int count, InternalNode *chd)
{
set_child(count, (Node *)chd);
has_child_bitfield |= (1 << index);
}
void set_leaf_child(int index, int count, LeafNode *chd)
{
set_child(count, (Node *)chd);
has_child_bitfield |= (1 << index);
child_is_leaf_bitfield |= (1 << index);
}
};
@@ -345,7 +422,8 @@ class Octree
void countIntersection(Node *node, int height, int& nedge, int& ncell, int& nface);
void generateMinimizer(Node * node, int st[3], int len, int height, int& offset);
void computeMinimizer(LeafNode * leaf, int st[3], int len, float rvalue[3]);
void computeMinimizer(const LeafNode * leaf, int st[3], int len,
float rvalue[3]) const;
/**
* Traversal functions to generate polygon model
* op: 0 for counting, 1 for writing OBJ, 2 for writing OFF, 3 for writing PLY
@@ -365,9 +443,6 @@ class Octree
/************ Operators for all nodes ************/
/// Lookup table
int numChildrenTable[256];
int childrenCountTable[256][8];
int childrenIndexTable[256][8];
int numEdgeTable[8];
int edgeCountTable[8][3];
@@ -375,12 +450,12 @@ class Octree
void buildTable()
{
for (int i = 0; i < 256; i++) {
numChildrenTable[i] = 0;
InternalNode::numChildrenTable[i] = 0;
int count = 0;
for (int j = 0; j < 8; j++) {
numChildrenTable[i] += ((i >> j) & 1);
childrenCountTable[i][j] = count;
childrenIndexTable[i][count] = j;
InternalNode::numChildrenTable[i] += ((i >> j) & 1);
InternalNode::childrenCountTable[i][j] = count;
InternalNode::childrenIndexTable[i][count] = j;
count += ((i >> j) & 1);
}
}
@@ -402,15 +477,15 @@ class Octree
return getSign(&node->leaf, index);
}
else {
if (hasChild(&node->internal, index)) {
return getSign(getChild(&node->internal, getChildCount(&node->internal, index)),
if (node->internal.has_child(index)) {
return getSign(node->internal.get_child(node->internal.get_child_count(index)),
height - 1,
index);
}
else {
return getSign(getChild(&node->internal, 0),
return getSign(node->internal.get_child(0),
height - 1,
7 - getChildIndex(&node->internal, 0));
7 - node->internal.get_child_index(0));
}
}
}
@@ -469,7 +544,7 @@ class Octree
leaf->signs |= ((sign & 1) << index);
}
int getSignMask(const LeafNode *leaf)
int getSignMask(const LeafNode *leaf) const
{
return leaf->signs;
}
@@ -536,7 +611,7 @@ class Octree
}
/// Get edge parity
int getEdgeParity(LeafNode *leaf, int index)
int getEdgeParity(const LeafNode *leaf, int index) const
{
assert(index >= 0 && index <= 11);
@@ -597,7 +672,8 @@ class Octree
leaf->primary_edge_intersections |= (1 << pindex);
}
int getStoredEdgesParity(LeafNode *leaf, int pindex)
int getStoredEdgesParity(const LeafNode *leaf, int pindex) const
{
assert(pindex <= 2 && pindex >= 0);
@@ -652,7 +728,7 @@ class Octree
InternalNode *parent = locateParent(node, len, st, count);
// Update
setChild(parent, count, (Node *)leaf);
parent->set_child(count, (Node *)leaf);
}
void updateParent(InternalNode *node, int len, int st[3])
@@ -667,14 +743,14 @@ class Octree
InternalNode *parent = locateParent(len, st, count);
// UPdate
setChild(parent, count, (Node *)node);
parent->set_child(count, (Node *)node);
}
/// Find edge intersection on a given edge
int getEdgeIntersectionByIndex(int st[3], int index, float pt[3], int check)
int getEdgeIntersectionByIndex(int st[3], int index, float pt[3], int check) const
{
// First, locat the leaf
LeafNode *leaf;
const LeafNode *leaf;
if (check) {
leaf = locateLeafCheck(st);
}
@@ -697,7 +773,7 @@ class Octree
}
/// Retrieve number of edges intersected
int getPrimalEdgesMask(LeafNode *leaf)
int getPrimalEdgesMask(const LeafNode *leaf) const
{
return leaf->primary_edge_intersections;
}
@@ -710,7 +786,7 @@ class Octree
}
/// Get the count for a primary edge
int getEdgeCount(LeafNode *leaf, int index)
int getEdgeCount(const LeafNode *leaf, int index) const
{
return edgeCountTable[getPrimalEdgesMask(leaf)][index];
}
@@ -744,7 +820,7 @@ class Octree
}
/// Retrieve edge intersection
float getEdgeOffset(LeafNode *leaf, int count)
float getEdgeOffset(const LeafNode *leaf, int count) const
{
return leaf->edge_intersections[4 * count];
}
@@ -834,10 +910,11 @@ class Octree
}
/// Retrieve complete edge intersection
void getEdgeIntersectionByIndex(LeafNode *leaf, int index, int st[3], int len, float pt[3], float nm[3])
void getEdgeIntersectionByIndex(const LeafNode *leaf, int index, int st[3],
int len, float pt[3], float nm[3]) const
{
int count = getEdgeCount(leaf, index);
float *pts = leaf->edge_intersections;
const float *pts = leaf->edge_intersections;
float off = pts[4 * count];
@@ -865,7 +942,8 @@ class Octree
return off;
}
void fillEdgeIntersections(LeafNode *leaf, int st[3], int len, float pts[12][3], float norms[12][3])
void fillEdgeIntersections(const LeafNode *leaf, int st[3], int len,
float pts[12][3], float norms[12][3]) const
{
int i;
// int stt[3] = {0, 0, 0};
@@ -890,7 +968,7 @@ class Octree
nst[i] += len;
// int nstt[3] = {0, 0, 0};
// nstt[i] += 1;
LeafNode *node = locateLeaf(nst);
const LeafNode *node = locateLeaf(nst);
if (e1) {
// getEdgeIntersectionByIndex(node, femask[i][0], nstt, 1, pts[fmask[i][0]], norms[fmask[i][0]]);
@@ -912,7 +990,7 @@ class Octree
nst[i] -= len;
// int nstt[3] = {1, 1, 1};
// nstt[i] -= 1;
LeafNode *node = locateLeaf(nst);
const LeafNode *node = locateLeaf(nst);
// getEdgeIntersectionByIndex(node, eemask[i], nstt, 1, pts[emask[i]], norms[emask[i]]);
getEdgeIntersectionByIndex(node, eemask[i], nst, len, pts[emask[i]], norms[emask[i]]);
@@ -921,7 +999,9 @@ class Octree
}
void fillEdgeIntersections(LeafNode *leaf, int st[3], int len, float pts[12][3], float norms[12][3], int parity[12])
void fillEdgeIntersections(const LeafNode *leaf, int st[3], int len,
float pts[12][3], float norms[12][3],
int parity[12]) const
{
int i;
for (i = 0; i < 12; i++) {
@@ -948,7 +1028,7 @@ class Octree
nst[i] += len;
// int nstt[3] = {0, 0, 0};
// nstt[i] += 1;
LeafNode *node = locateLeafCheck(nst);
const LeafNode *node = locateLeafCheck(nst);
if (node == NULL) {
continue;
}
@@ -979,7 +1059,7 @@ class Octree
nst[i] -= len;
// int nstt[3] = {1, 1, 1};
// nstt[i] -= 1;
LeafNode *node = locateLeafCheck(nst);
const LeafNode *node = locateLeafCheck(nst);
if (node == NULL) {
continue;
}
@@ -1088,7 +1168,20 @@ class Octree
int index = (((st[0] >> i) & 1) << 2) |
(((st[1] >> i) & 1) << 1) |
(((st[2] >> i) & 1));
node = getChild(&node->internal, getChildCount(&node->internal, index));
node = node->internal.get_child(node->internal.get_child_count(index));
}
return &node->leaf;
}
const LeafNode *locateLeaf(int st[3]) const
{
const Node *node = root;
for (int i = GRID_DIMENSION - 1; i > GRID_DIMENSION - maxDepth - 1; i--) {
int index = (((st[0] >> i) & 1) << 2) |
(((st[1] >> i) & 1) << 1) |
(((st[2] >> i) & 1));
node = node->internal.get_child(node->internal.get_child_count(index));
}
return &node->leaf;
@@ -1102,8 +1195,7 @@ class Octree
index = (((st[0] & i) ? 4 : 0) |
((st[1] & i) ? 2 : 0) |
((st[2] & i) ? 1 : 0));
node = getChild(&node->internal,
getChildCount(&node->internal, index));
node = node->internal.get_child(node->internal.get_child_count(index));
}
return &node->leaf;
@@ -1116,10 +1208,26 @@ class Octree
int index = (((st[0] >> i) & 1) << 2) |
(((st[1] >> i) & 1) << 1) |
(((st[2] >> i) & 1));
if (!hasChild(&node->internal, index)) {
if (!node->internal.has_child(index)) {
return NULL;
}
node = getChild(&node->internal, getChildCount(&node->internal, index));
node = node->internal.get_child(node->internal.get_child_count(index));
}
return &node->leaf;
}
const LeafNode *locateLeafCheck(int st[3]) const
{
const Node *node = root;
for (int i = GRID_DIMENSION - 1; i > GRID_DIMENSION - maxDepth - 1; i--) {
int index = (((st[0] >> i) & 1) << 2) |
(((st[1] >> i) & 1) << 1) |
(((st[2] >> i) & 1));
if (!node->internal.has_child(index)) {
return NULL;
}
node = node->internal.get_child(node->internal.get_child_count(index));
}
return &node->leaf;
@@ -1135,10 +1243,10 @@ class Octree
((st[1] & i) ? 2 : 0) |
((st[2] & i) ? 1 : 0));
pre = node;
node = &getChild(node, getChildCount(node, index))->internal;
node = &node->get_child(node->get_child_count(index))->internal;
}
count = getChildCount(pre, index);
count = pre->get_child_count(index);
return pre;
}
@@ -1152,88 +1260,21 @@ class Octree
((st[1] & i) ? 2 : 0) |
((st[2] & i) ? 1 : 0));
pre = node;
node = (InternalNode *)getChild(node, getChildCount(node, index));
node = &node->get_child(node->get_child_count(index))->internal;
}
count = getChildCount(pre, index);
count = pre->get_child_count(index);
return pre;
}
/************ Operators for internal nodes ************/
/// If child index exists
int hasChild(InternalNode *node, int index)
{
return (node->has_child >> index) & 1;
}
/// Get the pointer to child index
Node *getChild(InternalNode *node, int count)
{
return node->children[count];
};
/// Get total number of children
int getNumChildren(InternalNode *node)
{
return numChildrenTable[node->has_child];
}
/// Get the count of children
int getChildCount(InternalNode *node, int index)
{
return childrenCountTable[node->has_child][index];
}
int getChildIndex(InternalNode *node, int count)
{
return childrenIndexTable[node->has_child][count];
}
int *getChildCounts(InternalNode *node)
{
return childrenCountTable[node->has_child];
}
/// Get all children
void fillChildren(InternalNode *node, Node *children[8], int leaf[8])
{
int count = 0;
for (int i = 0; i < 8; i++) {
leaf[i] = node->is_child_leaf(i);
if (hasChild(node, i)) {
children[i] = getChild(node, count);
count++;
}
else {
children[i] = NULL;
leaf[i] = 0;
}
}
}
/// Sets the child pointer
void setChild(InternalNode *node, int count, Node *chd)
{
node->children[count] = chd;
}
void setInternalChild(InternalNode *node, int index, int count, InternalNode *chd)
{
setChild(node, count, (Node *)chd);
node->has_child |= (1 << index);
}
void setLeafChild(InternalNode *node, int index, int count, LeafNode *chd)
{
setChild(node, count, (Node *)chd);
node->has_child |= (1 << index);
node->child_is_leaf |= (1 << index);
}
/// Add a kid to an existing internal node
/// Fix me: can we do this without wasting memory ?
/// Fixed: using variable memory
InternalNode *addChild(InternalNode *node, int index, Node *child, int aLeaf)
{
// Create new internal node
int num = getNumChildren(node);
int num = node->get_num_children();
InternalNode *rnode = createInternal(num + 1);
// Establish children
@@ -1242,19 +1283,19 @@ class Octree
for (i = 0; i < 8; i++) {
if (i == index) {
if (aLeaf) {
setLeafChild(rnode, i, count2, &child->leaf);
rnode->set_leaf_child(i, count2, &child->leaf);
}
else {
setInternalChild(rnode, i, count2, &child->internal);
rnode->set_internal_child(i, count2, &child->internal);
}
count2++;
}
else if (hasChild(node, i)) {
else if (node->has_child(i)) {
if (node->is_child_leaf(i)) {
setLeafChild(rnode, i, count2, &getChild(node, count1)->leaf);
rnode->set_leaf_child(i, count2, &node->get_child(count1)->leaf);
}
else {
setInternalChild(rnode, i, count2, &getChild(node, count1)->internal);
rnode->set_internal_child(i, count2, &node->get_child(count1)->internal);
}
count1++;
count2++;
@@ -1269,8 +1310,8 @@ class Octree
InternalNode *createInternal(int length)
{
InternalNode *inode = (InternalNode *)alloc[length]->allocate();
inode->has_child = 0;
inode->child_is_leaf = 0;
inode->has_child_bitfield = 0;
inode->child_is_leaf_bitfield = 0;
return inode;
}
@@ -1301,21 +1342,21 @@ class Octree
InternalNode *addLeafChild(InternalNode *par, int index, int count,
LeafNode *leaf)
{
int num = getNumChildren(par) + 1;
int num = par->get_num_children() + 1;
InternalNode *npar = createInternal(num);
*npar = *par;
if (num == 1) {
setLeafChild(npar, index, 0, leaf);
npar->set_leaf_child(index, 0, leaf);
}
else {
int i;
for (i = 0; i < count; i++) {
setChild(npar, i, getChild(par, i));
npar->set_child(i, par->get_child(i));
}
setLeafChild(npar, index, count, leaf);
npar->set_leaf_child(index, count, leaf);
for (i = count + 1; i < num; i++) {
setChild(npar, i, getChild(par, i - 1));
npar->set_child(i, par->get_child(i - 1));
}
}
@@ -1326,21 +1367,21 @@ class Octree
InternalNode *addInternalChild(InternalNode *par, int index, int count,
InternalNode *node)
{
int num = getNumChildren(par) + 1;
int num = par->get_num_children() + 1;
InternalNode *npar = createInternal(num);
*npar = *par;
if (num == 1) {
setInternalChild(npar, index, 0, node);
npar->set_internal_child(index, 0, node);
}
else {
int i;
for (i = 0; i < count; i++) {
setChild(npar, i, getChild(par, i));
npar->set_child(i, par->get_child(i));
}
setInternalChild(npar, index, count, node);
npar->set_internal_child(index, count, node);
for (i = count + 1; i < num; i++) {
setChild(npar, i, getChild(par, i - 1));
npar->set_child(i, par->get_child(i - 1));
}
}

View File

@@ -51,7 +51,7 @@ int getElbeemState(void) {
return gElbeemState;
}
int isSimworldOk(void) {
return (getElbeemState>=0);
return (getElbeemState() >=0);
}
// last error as string, acces with get/setElbeemErrorString

View File

@@ -40,6 +40,7 @@ set(SRC
intern/FLUID_3D_SOLVERS.cpp
intern/FLUID_3D_STATIC.cpp
intern/LU_HELPER.cpp
intern/spectrum.cpp
intern/SPHERE.cpp
intern/WTURBULENCE.cpp
intern/smoke_API.cpp
@@ -53,6 +54,7 @@ set(SRC
intern/LU_HELPER.h
intern/MERSENNETWISTER.h
intern/OBSTACLE.h
intern/spectrum.h
intern/SPHERE.h
intern/VEC3.h
intern/WAVELET_NOISE.h

View File

@@ -37,17 +37,23 @@ extern "C" {
struct FLUID_3D;
// export
void smoke_export(struct FLUID_3D *fluid, float *dt, float *dx, float **dens, float **densold, float **heat, float **heatold, float **vx, float **vy, float **vz, float **vxold, float **vyold, float **vzold, unsigned char **obstacles);
// low res
struct FLUID_3D *smoke_init(int *res, float *p0, float dtdef);
struct FLUID_3D *smoke_init(int *res, float dx, float dtdef, int use_heat, int use_fire, int use_colors);
void smoke_free(struct FLUID_3D *fluid);
void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli);
void smoke_step(struct FLUID_3D *fluid, float dtSubdiv);
void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli, float *burning_rate,
float *flame_smoke, float *flame_smoke_color, float *flame_vorticity, float *flame_ignition_temp, float *flame_max_temp);
void smoke_step(struct FLUID_3D *fluid, float gravity[3], float dtSubdiv);
float *smoke_get_density(struct FLUID_3D *fluid);
float *smoke_get_flame(struct FLUID_3D *fluid);
float *smoke_get_fuel(struct FLUID_3D *fluid);
float *smoke_get_react(struct FLUID_3D *fluid);
float *smoke_get_color_r(struct FLUID_3D *fluid);
float *smoke_get_color_g(struct FLUID_3D *fluid);
float *smoke_get_color_b(struct FLUID_3D *fluid);
void smoke_get_rgba(struct FLUID_3D *fluid, float *data, int sequential);
void smoke_get_rgba_from_density(struct FLUID_3D *fluid, float color[3], float *data, int sequential);
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);
@@ -68,19 +74,44 @@ size_t smoke_get_index2d(int x, int max_x, int y);
void smoke_dissolve(struct FLUID_3D *fluid, int speed, int log);
// wavelet turbulence functions
struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype);
struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, int use_fire, int use_colors);
void smoke_turbulence_free(struct WTURBULENCE *wt);
void smoke_turbulence_step(struct WTURBULENCE *wt, struct FLUID_3D *fluid);
float *smoke_turbulence_get_density(struct WTURBULENCE *wt);
float *smoke_turbulence_get_color_r(struct WTURBULENCE *wt);
float *smoke_turbulence_get_color_g(struct WTURBULENCE *wt);
float *smoke_turbulence_get_color_b(struct WTURBULENCE *wt);
void smoke_turbulence_get_rgba(struct WTURBULENCE *wt, float *data, int sequential);
void smoke_turbulence_get_rgba_from_density(struct WTURBULENCE *wt, float color[3], float *data, int sequential);
float *smoke_turbulence_get_flame(struct WTURBULENCE *wt);
float *smoke_turbulence_get_fuel(struct WTURBULENCE *wt);
float *smoke_turbulence_get_react(struct WTURBULENCE *wt);
void smoke_turbulence_get_res(struct WTURBULENCE *wt, int *res);
int smoke_turbulence_get_cells(struct WTURBULENCE *wt);
void smoke_turbulence_set_noise(struct WTURBULENCE *wt, int type);
void smoke_initWaveletBlenderRNA(struct WTURBULENCE *wt, float *strength);
void smoke_dissolve_wavelet(struct WTURBULENCE *wt, int speed, int log);
// export
void smoke_turbulence_export(struct WTURBULENCE *wt, float **dens, float **densold, float **tcu, float **tcv, float **tcw);
/* export */
void smoke_export(struct FLUID_3D *fluid, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, float **heatold,
float **vx, float **vy, float **vz, float **r, float **g, float **b, unsigned char **obstacles);
void smoke_turbulence_export(struct WTURBULENCE *wt, float **dens, float **react, float **flame, float **fuel,
float **r, float **g, float **b, float **tcu, float **tcv, float **tcw);
/* flame spectrum */
void flame_get_spectrum(unsigned char *spec, int width, float t1, float t2);
/* data fields */
int smoke_has_heat(struct FLUID_3D *fluid);
int smoke_has_fuel(struct FLUID_3D *fluid);
int smoke_has_colors(struct FLUID_3D *fluid);
int smoke_turbulence_has_fuel(struct WTURBULENCE *wt);
int smoke_turbulence_has_colors(struct WTURBULENCE *wt);
void smoke_ensure_heat(struct FLUID_3D *fluid);
void smoke_ensure_fire(struct FLUID_3D *fluid, struct WTURBULENCE *wt);
void smoke_ensure_colors(struct FLUID_3D *fluid, struct WTURBULENCE *wt, float init_r, float init_g, float init_b);
#ifdef __cplusplus
}

View File

@@ -44,16 +44,11 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
FLUID_3D::FLUID_3D(int *res, float dx, float dtdef, int init_heat, int init_fire, int init_colors) :
_xRes(res[0]), _yRes(res[1]), _zRes(res[2]), _res(0.0f)
{
// set simulation consts
_dt = dtdef; // just in case. set in step from a RNA factor
// start point of array
_p0[0] = p0[0];
_p0[1] = p0[1];
_p0[2] = p0[2];
_iterations = 100;
_tempAmb = 0;
@@ -72,7 +67,10 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
*/
// scale the constants according to the refinement of the grid
_dx = 1.0f / (float)_maxRes;
if (!dx)
_dx = 1.0f / (float)_maxRes;
else
_dx = dx;
_constantScaling = 64.0f / _maxRes;
_constantScaling = (_constantScaling < 1.0f) ? 1.0f : _constantScaling;
_vorticityEps = 2.0f / _constantScaling; // Just in case set a default value
@@ -94,8 +92,6 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
_zForce = new float[_totalCells];
_density = new float[_totalCells];
_densityOld = new float[_totalCells];
_heat = new float[_totalCells];
_heatOld = new float[_totalCells];
_obstacles = new unsigned char[_totalCells]; // set 0 at end of step
// For threaded version:
@@ -103,7 +99,6 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
_yVelocityTemp = new float[_totalCells];
_zVelocityTemp = new float[_totalCells];
_densityTemp = new float[_totalCells];
_heatTemp = new float[_totalCells];
// DG TODO: check if alloc went fine
@@ -111,8 +106,6 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
{
_density[x] = 0.0f;
_densityOld[x] = 0.0f;
_heat[x] = 0.0f;
_heatOld[x] = 0.0f;
_xVelocity[x] = 0.0f;
_yVelocity[x] = 0.0f;
_zVelocity[x] = 0.0f;
@@ -128,6 +121,25 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
_obstacles[x] = false;
}
/* heat */
_heat = _heatOld = _heatTemp = NULL;
if (init_heat) {
initHeat();
}
// Fire simulation
_flame = _fuel = _fuelTemp = _fuelOld = NULL;
_react = _reactTemp = _reactOld = NULL;
if (init_fire) {
initFire();
}
// Smoke color
_color_r = _color_rOld = _color_rTemp = NULL;
_color_g = _color_gOld = _color_gTemp = NULL;
_color_b = _color_bOld = _color_bTemp = NULL;
if (init_colors) {
initColors(0.0f, 0.0f, 0.0f);
}
// boundary conditions of the fluid domain
// set default values -> vertically non-colliding
_domainBcFront = true;
@@ -138,9 +150,70 @@ FLUID_3D::FLUID_3D(int *res, float *p0, float dtdef) :
_domainBcRight = _domainBcLeft;
_colloPrev = 1; // default value
}
setBorderObstacles(); // walls
void FLUID_3D::initHeat()
{
if (!_heat) {
_heat = new float[_totalCells];
_heatOld = new float[_totalCells];
_heatTemp = new float[_totalCells];
for (int x = 0; x < _totalCells; x++)
{
_heat[x] = 0.0f;
_heatOld[x] = 0.0f;
}
}
}
void FLUID_3D::initFire()
{
if (!_flame) {
_flame = new float[_totalCells];
_fuel = new float[_totalCells];
_fuelTemp = new float[_totalCells];
_fuelOld = new float[_totalCells];
_react = new float[_totalCells];
_reactTemp = new float[_totalCells];
_reactOld = new float[_totalCells];
for (int x = 0; x < _totalCells; x++)
{
_flame[x] = 0.0f;
_fuel[x] = 0.0f;
_fuelTemp[x] = 0.0f;
_fuelOld[x] = 0.0f;
_react[x] = 0.0f;
_reactTemp[x] = 0.0f;
_reactOld[x] = 0.0f;
}
}
}
void FLUID_3D::initColors(float init_r, float init_g, float init_b)
{
if (!_color_r) {
_color_r = new float[_totalCells];
_color_rOld = new float[_totalCells];
_color_rTemp = new float[_totalCells];
_color_g = new float[_totalCells];
_color_gOld = new float[_totalCells];
_color_gTemp = new float[_totalCells];
_color_b = new float[_totalCells];
_color_bOld = new float[_totalCells];
_color_bTemp = new float[_totalCells];
for (int x = 0; x < _totalCells; x++)
{
_color_r[x] = _density[x] * init_r;
_color_rOld[x] = 0.0f;
_color_g[x] = _density[x] * init_g;
_color_gOld[x] = 0.0f;
_color_b[x] = _density[x] * init_b;
_color_bOld[x] = 0.0f;
}
}
}
void FLUID_3D::setBorderObstacles()
@@ -204,7 +277,6 @@ FLUID_3D::~FLUID_3D()
if (_heat) delete[] _heat;
if (_heatOld) delete[] _heatOld;
if (_obstacles) delete[] _obstacles;
// if (_wTurbulence) delete _wTurbulence;
if (_xVelocityTemp) delete[] _xVelocityTemp;
if (_yVelocityTemp) delete[] _yVelocityTemp;
@@ -212,23 +284,48 @@ FLUID_3D::~FLUID_3D()
if (_densityTemp) delete[] _densityTemp;
if (_heatTemp) delete[] _heatTemp;
if (_flame) delete[] _flame;
if (_fuel) delete[] _fuel;
if (_fuelTemp) delete[] _fuelTemp;
if (_fuelOld) delete[] _fuelOld;
if (_react) delete[] _react;
if (_reactTemp) delete[] _reactTemp;
if (_reactOld) delete[] _reactOld;
if (_color_r) delete[] _color_r;
if (_color_rOld) delete[] _color_rOld;
if (_color_rTemp) delete[] _color_rTemp;
if (_color_g) delete[] _color_g;
if (_color_gOld) delete[] _color_gOld;
if (_color_gTemp) delete[] _color_gTemp;
if (_color_b) delete[] _color_b;
if (_color_bOld) delete[] _color_bOld;
if (_color_bTemp) delete[] _color_bTemp;
// printf("deleted fluid\n");
}
// init direct access functions from blender
void FLUID_3D::initBlenderRNA(float *alpha, float *beta, float *dt_factor, float *vorticity, int *borderCollision)
void FLUID_3D::initBlenderRNA(float *alpha, float *beta, float *dt_factor, float *vorticity, int *borderCollision, float *burning_rate,
float *flame_smoke, float *flame_smoke_color, float *flame_vorticity, float *flame_ignition_temp, float *flame_max_temp)
{
_alpha = alpha;
_beta = beta;
_dtFactor = dt_factor;
_vorticityRNA = vorticity;
_borderColli = borderCollision;
_burning_rate = burning_rate;
_flame_smoke = flame_smoke;
_flame_smoke_color = flame_smoke_color;
_flame_vorticity = flame_vorticity;
_ignition_temp = flame_ignition_temp;
_max_temp = flame_max_temp;
}
//////////////////////////////////////////////////////////////////////
// step simulation once
//////////////////////////////////////////////////////////////////////
void FLUID_3D::step(float dt)
void FLUID_3D::step(float dt, float gravity[3])
{
#if 0
// If border rules have been changed
@@ -281,7 +378,7 @@ void FLUID_3D::step(float dt)
wipeBoundariesSL(zBegin, zEnd);
addVorticity(zBegin, zEnd);
addBuoyancy(_heat, _density, zBegin, zEnd);
addBuoyancy(_heat, _density, gravity, zBegin, zEnd);
addForce(zBegin, zEnd);
#if PARALLEL==1
@@ -312,13 +409,15 @@ void FLUID_3D::step(float dt)
if (i==0)
{
#endif
project();
project();
#if PARALLEL==1
}
else
else if (i==1)
{
#endif
diffuseHeat();
if (_heat) {
diffuseHeat();
}
#if PARALLEL==1
}
}
@@ -338,6 +437,13 @@ void FLUID_3D::step(float dt)
SWAP_POINTERS(_density, _densityOld);
SWAP_POINTERS(_heat, _heatOld);
SWAP_POINTERS(_fuel, _fuelOld);
SWAP_POINTERS(_react, _reactOld);
SWAP_POINTERS(_color_r, _color_rOld);
SWAP_POINTERS(_color_g, _color_gOld);
SWAP_POINTERS(_color_b, _color_bOld);
advectMacCormackBegin(0, _zRes);
#if PARALLEL==1
@@ -398,11 +504,8 @@ void FLUID_3D::step(float dt)
SWAP_POINTERS(_yVelocity, _yForce);
SWAP_POINTERS(_zVelocity, _zForce);
_totalTime += _dt;
_totalSteps++;
_totalSteps++;
for (int i = 0; i < _totalCells; i++)
{
@@ -643,6 +746,15 @@ void FLUID_3D::wipeBoundaries(int zBegin, int zEnd)
setZeroBorder(_yVelocity, _res, zBegin, zEnd);
setZeroBorder(_zVelocity, _res, zBegin, zEnd);
setZeroBorder(_density, _res, zBegin, zEnd);
if (_fuel) {
setZeroBorder(_fuel, _res, zBegin, zEnd);
setZeroBorder(_react, _res, zBegin, zEnd);
}
if (_color_r) {
setZeroBorder(_color_r, _res, zBegin, zEnd);
setZeroBorder(_color_g, _res, zBegin, zEnd);
setZeroBorder(_color_b, _res, zBegin, zEnd);
}
}
void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
@@ -668,6 +780,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
_yVelocity[index] = 0.0f;
_zVelocity[index] = 0.0f;
_density[index] = 0.0f;
if (_fuel) {
_fuel[index] = 0.0f;
_react[index] = 0.0f;
}
if (_color_r) {
_color_r[index] = 0.0f;
_color_g[index] = 0.0f;
_color_b[index] = 0.0f;
}
// right slab
index += _xRes - 1;
@@ -675,6 +796,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
_yVelocity[index] = 0.0f;
_zVelocity[index] = 0.0f;
_density[index] = 0.0f;
if (_fuel) {
_fuel[index] = 0.0f;
_react[index] = 0.0f;
}
if (_color_r) {
_color_r[index] = 0.0f;
_color_g[index] = 0.0f;
_color_b[index] = 0.0f;
}
}
/////////////////////////////////////
@@ -690,6 +820,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
_yVelocity[index] = 0.0f;
_zVelocity[index] = 0.0f;
_density[index] = 0.0f;
if (_fuel) {
_fuel[index] = 0.0f;
_react[index] = 0.0f;
}
if (_color_r) {
_color_r[index] = 0.0f;
_color_g[index] = 0.0f;
_color_b[index] = 0.0f;
}
// top slab
index += slabSize - _xRes;
@@ -697,6 +836,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
_yVelocity[index] = 0.0f;
_zVelocity[index] = 0.0f;
_density[index] = 0.0f;
if (_fuel) {
_fuel[index] = 0.0f;
_react[index] = 0.0f;
}
if (_color_r) {
_color_r[index] = 0.0f;
_color_g[index] = 0.0f;
_color_b[index] = 0.0f;
}
}
@@ -717,6 +865,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
_yVelocity[index] = 0.0f;
_zVelocity[index] = 0.0f;
_density[index] = 0.0f;
if (_fuel) {
_fuel[index] = 0.0f;
_react[index] = 0.0f;
}
if (_color_r) {
_color_r[index] = 0.0f;
_color_g[index] = 0.0f;
_color_b[index] = 0.0f;
}
}
if (zEnd == _zRes)
@@ -735,6 +892,15 @@ void FLUID_3D::wipeBoundariesSL(int zBegin, int zEnd)
_yVelocity[indexx] = 0.0f;
_zVelocity[indexx] = 0.0f;
_density[indexx] = 0.0f;
if (_fuel) {
_fuel[index] = 0.0f;
_react[index] = 0.0f;
}
if (_color_r) {
_color_r[index] = 0.0f;
_color_g[index] = 0.0f;
_color_b[index] = 0.0f;
}
}
}
@@ -781,35 +947,6 @@ void FLUID_3D::project()
if(!_domainBcTop) setNeumannZ(_zVelocity, _res, 0, _zRes);
else setZeroZ(_zVelocity, _res, 0, _zRes);
/*
{
float maxx = 0, maxy = 0, maxz = 0;
for(unsigned int i = 0; i < _xRes * _yRes * _zRes; i++)
{
if(_xVelocity[i] > maxx)
maxx = _xVelocity[i];
if(_yVelocity[i] > maxy)
maxy = _yVelocity[i];
if(_zVelocity[i] > maxz)
maxz = _zVelocity[i];
}
printf("Max velx: %f, vely: %f, velz: %f\n", maxx, maxy, maxz);
}
*/
/*
{
float maxvalue = 0;
for(unsigned int i = 0; i < _xRes * _yRes * _zRes; i++)
{
if(_heat[i] > maxvalue)
maxvalue = _heat[i];
}
printf("Max heat: %f\n", maxvalue);
}
*/
// calculate divergence
index = _slabSize + _xRes + 1;
for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
@@ -1007,7 +1144,6 @@ void FLUID_3D::diffuseHeat()
for (int x = 0; x < _totalCells; x++)
if (_obstacles[x])
_heat[x] = 0.0f;
}
//////////////////////////////////////////////////////////////////////
@@ -1175,7 +1311,7 @@ void FLUID_3D::setObstacleBoundaries(float *_pressure, int zBegin, int zEnd)
//////////////////////////////////////////////////////////////////////
// add buoyancy forces
//////////////////////////////////////////////////////////////////////
void FLUID_3D::addBuoyancy(float *heat, float *density, int zBegin, int zEnd)
void FLUID_3D::addBuoyancy(float *heat, float *density, float gravity[3], int zBegin, int zEnd)
{
int index = zBegin*_slabSize;
@@ -1183,7 +1319,10 @@ void FLUID_3D::addBuoyancy(float *heat, float *density, int zBegin, int zEnd)
for (int y = 0; y < _yRes; y++)
for (int x = 0; x < _xRes; x++, index++)
{
_zForce[index] += *_alpha * density[index] + (*_beta * (heat[index] - _tempAmb)); // DG: was _yForce, changed for Blender
float buoyancy = *_alpha * density[index] + (*_beta * (((heat) ? heat[index] : 0.0f) - _tempAmb));
_xForce[index] -= gravity[0] * buoyancy;
_yForce[index] -= gravity[1] * buoyancy;
_zForce[index] -= gravity[2] * buoyancy;
}
}
@@ -1192,8 +1331,10 @@ void FLUID_3D::addBuoyancy(float *heat, float *density, int zBegin, int zEnd)
//////////////////////////////////////////////////////////////////////
void FLUID_3D::addVorticity(int zBegin, int zEnd)
{
// set flame vorticity from RNA value
float flame_vorticity = (*_flame_vorticity)/_constantScaling;
//int x,y,z,index;
if(_vorticityEps<=0.) return;
if(_vorticityEps+flame_vorticity<=0.) return;
int _blockSize=zEnd-zBegin;
int _blockTotalCells = _slabSize * (_blockSize+2);
@@ -1300,14 +1441,15 @@ void FLUID_3D::addVorticity(int zBegin, int zEnd)
float magnitude = sqrtf(N[0] * N[0] + N[1] * N[1] + N[2] * N[2]);
if (magnitude > FLT_EPSILON)
{
float flame_vort = (_fuel) ? _fuel[index]*flame_vorticity : 0.0f;
magnitude = 1.0f / magnitude;
N[0] *= magnitude;
N[1] *= magnitude;
N[2] *= magnitude;
_xForce[index] += (N[1] * _zVorticity[vIndex] - N[2] * _yVorticity[vIndex]) * _dx * eps;
_yForce[index] += (N[2] * _xVorticity[vIndex] - N[0] * _zVorticity[vIndex]) * _dx * eps;
_zForce[index] += (N[0] * _yVorticity[vIndex] - N[1] * _xVorticity[vIndex]) * _dx * eps;
_xForce[index] += (N[1] * _zVorticity[vIndex] - N[2] * _yVorticity[vIndex]) * _dx * (eps + flame_vort);
_yForce[index] += (N[2] * _xVorticity[vIndex] - N[0] * _zVorticity[vIndex]) * _dx * (eps + flame_vort);
_zForce[index] += (N[0] * _yVorticity[vIndex] - N[1] * _xVorticity[vIndex]) * _dx * (eps + flame_vort);
}
} // if
vIndex++;
@@ -1328,14 +1470,9 @@ void FLUID_3D::advectMacCormackBegin(int zBegin, int zEnd)
{
Vec3Int res = Vec3Int(_xRes,_yRes,_zRes);
if(!_domainBcLeft) copyBorderX(_xVelocityOld, res, zBegin, zEnd);
else setZeroX(_xVelocityOld, res, zBegin, zEnd);
if(!_domainBcFront) copyBorderY(_yVelocityOld, res, zBegin, zEnd);
else setZeroY(_yVelocityOld, res, zBegin, zEnd);
if(!_domainBcTop) copyBorderZ(_zVelocityOld, res, zBegin, zEnd);
else setZeroZ(_zVelocityOld, res, zBegin, zEnd);
setZeroX(_xVelocityOld, res, zBegin, zEnd);
setZeroY(_yVelocityOld, res, zBegin, zEnd);
setZeroZ(_zVelocityOld, res, zBegin, zEnd);
}
//////////////////////////////////////////////////////////////////////
@@ -1355,7 +1492,18 @@ void FLUID_3D::advectMacCormackEnd1(int zBegin, int zEnd)
// advectFieldMacCormack1(dt, xVelocity, yVelocity, zVelocity, oldField, newField, res)
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _densityOld, _densityTemp, res, zBegin, zEnd);
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _heatOld, _heatTemp, res, zBegin, zEnd);
if (_heat) {
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _heatOld, _heatTemp, res, zBegin, zEnd);
}
if (_fuel) {
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _fuelOld, _fuelTemp, res, zBegin, zEnd);
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _reactOld, _reactTemp, res, zBegin, zEnd);
}
if (_color_r) {
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_rOld, _color_rTemp, res, zBegin, zEnd);
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_gOld, _color_gTemp, res, zBegin, zEnd);
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_bOld, _color_bTemp, res, zBegin, zEnd);
}
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _xVelocityOld, _xVelocity, res, zBegin, zEnd);
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _yVelocityOld, _yVelocity, res, zBegin, zEnd);
advectFieldMacCormack1(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _zVelocityOld, _zVelocity, res, zBegin, zEnd);
@@ -1371,17 +1519,30 @@ void FLUID_3D::advectMacCormackEnd2(int zBegin, int zEnd)
const float dt0 = _dt / _dx;
Vec3Int res = Vec3Int(_xRes,_yRes,_zRes);
// use force array as temp arrays
// use force array as temp array
float* t1 = _xForce;
// advectFieldMacCormack2(dt, xVelocity, yVelocity, zVelocity, oldField, newField, tempfield, temp, res, obstacles)
/* finish advection */
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _densityOld, _density, _densityTemp, t1, res, _obstacles, zBegin, zEnd);
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _heatOld, _heat, _heatTemp, t1, res, _obstacles, zBegin, zEnd);
if (_heat) {
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _heatOld, _heat, _heatTemp, t1, res, _obstacles, zBegin, zEnd);
}
if (_fuel) {
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _fuelOld, _fuel, _fuelTemp, t1, res, _obstacles, zBegin, zEnd);
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _reactOld, _react, _reactTemp, t1, res, _obstacles, zBegin, zEnd);
}
if (_color_r) {
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_rOld, _color_r, _color_rTemp, t1, res, _obstacles, zBegin, zEnd);
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_gOld, _color_g, _color_gTemp, t1, res, _obstacles, zBegin, zEnd);
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _color_bOld, _color_b, _color_bTemp, t1, res, _obstacles, zBegin, zEnd);
}
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _xVelocityOld, _xVelocityTemp, _xVelocity, t1, res, _obstacles, zBegin, zEnd);
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _yVelocityOld, _yVelocityTemp, _yVelocity, t1, res, _obstacles, zBegin, zEnd);
advectFieldMacCormack2(dt0, _xVelocityOld, _yVelocityOld, _zVelocityOld, _zVelocityOld, _zVelocityTemp, _zVelocity, t1, res, _obstacles, zBegin, zEnd);
/* set boundary conditions for velocity */
if(!_domainBcLeft) copyBorderX(_xVelocityTemp, res, zBegin, zEnd);
else setZeroX(_xVelocityTemp, res, zBegin, zEnd);
@@ -1391,40 +1552,71 @@ void FLUID_3D::advectMacCormackEnd2(int zBegin, int zEnd)
if(!_domainBcTop) copyBorderZ(_zVelocityTemp, res, zBegin, zEnd);
else setZeroZ(_zVelocityTemp, res, zBegin, zEnd);
/* clear data boundaries */
setZeroBorder(_density, res, zBegin, zEnd);
setZeroBorder(_heat, res, zBegin, zEnd);
#if 0
{
const size_t index_ = _slabSize + _xRes + 1;
int bb=0;
int bt=0;
if (_fuel) {
setZeroBorder(_fuel, res, zBegin, zEnd);
setZeroBorder(_react, res, zBegin, zEnd);
}
if (_color_r) {
setZeroBorder(_color_r, res, zBegin, zEnd);
setZeroBorder(_color_g, res, zBegin, zEnd);
setZeroBorder(_color_b, res, zBegin, zEnd);
}
}
if (zBegin == 0) {bb = 1;}
if (zEnd == _zRes) {bt = 1;}
for (int z = zBegin + bb; z < zEnd - bt; z++)
{
size_t index = index_ +(z-1)*_slabSize;
for (int y = 1; y < _yRes - 1; y++, index += 2)
{
for (int x = 1; x < _xRes - 1; x++, index++)
{
// clean custom velocities from moving obstacles again
if (_obstacles[index])
{
_xVelocity[index] =
_yVelocity[index] =
_zVelocity[index] = 0.0f;
}
}
void FLUID_3D::processBurn(float *fuel, float *smoke, float *react, float *flame, float *heat,
float *r, float *g, float *b, int total_cells, float dt)
{
float burning_rate = *_burning_rate;
float flame_smoke = *_flame_smoke;
float ignition_point = *_ignition_temp;
float temp_max = *_max_temp;
for (int index = 0; index < total_cells; index++)
{
float orig_fuel = fuel[index];
float orig_smoke = smoke[index];
float smoke_emit = 0.0f;
float react_coord = 0.0f;
/* process fuel */
fuel[index] -= burning_rate * dt;
if (fuel[index] < 0.0f) fuel[index] = 0.0f;
/* process reaction coordinate */
if (orig_fuel) {
react[index] *= fuel[index]/orig_fuel;
react_coord = react[index];
}
else {
react[index] = 0.0f;
}
/* emit smoke based on fuel burn rate and "flame_smoke" factor */
smoke_emit = (orig_fuel < 1.0f) ? (1.0f - orig_fuel)*0.5f : 0.0f;
smoke_emit = (smoke_emit + 0.5f) * (orig_fuel-fuel[index]) * 0.1f * flame_smoke;
smoke[index] += smoke_emit;
CLAMP(smoke[index], 0.0f, 1.0f);
/* model flame temperature curve from the reaction coordinate (fuel) */
if (react_coord>0.0f) {
/* do a smooth falloff for rest of the values */
flame[index] = pow(react_coord, 0.5f);
}
else
flame[index] = 0.0f;
/* set fluid temperature from the flame temperature profile */
if (heat && flame[index])
heat[index] = (1.0f-flame[index])*ignition_point + flame[index]*temp_max;
/* mix new color */
if (r && smoke_emit) {
float smoke_factor = smoke[index]/(orig_smoke+smoke_emit);
r[index] = (r[index] + _flame_smoke_color[0] * smoke_emit) * smoke_factor;
g[index] = (g[index] + _flame_smoke_color[1] * smoke_emit) * smoke_factor;
b[index] = (b[index] + _flame_smoke_color[2] * smoke_emit) * smoke_factor;
}
}
}
#endif
/*int begin=zBegin * _slabSize;
int end=begin + (zEnd - zBegin) * _slabSize;
for (int x = begin; x < end; x++)
_xForce[x] = _yForce[x] = 0.0f;*/
}

View File

@@ -46,11 +46,16 @@ class WTURBULENCE;
class FLUID_3D
{
public:
FLUID_3D(int *res, /* int amplify, */ float *p0, float dtdef);
FLUID_3D(int *res, float dx, float dtdef, int init_heat, int init_fire, int init_colors);
FLUID_3D() {};
virtual ~FLUID_3D();
void initBlenderRNA(float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli);
void initHeat();
void initFire();
void initColors(float init_r, float init_g, float init_b);
void initBlenderRNA(float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli, float *burning_rate,
float *flame_smoke, float *flame_smoke_color, float *flame_vorticity, float *ignition_temp, float *max_temp);
// create & allocate vector noise advection
void initVectorNoise(int amplify);
@@ -58,7 +63,7 @@ class FLUID_3D
void addSmokeColumn();
static void addSmokeTestCase(float* field, Vec3Int res);
void step(float dt);
void step(float dt, float gravity[3]);
void addObstacle(OBSTACLE* obstacle);
const float* xVelocity() { return _xVelocity; };
@@ -115,6 +120,27 @@ class FLUID_3D
float* _heatTemp;
float* _densityTemp;
// fire simulation
float *_flame;
float *_fuel;
float *_fuelTemp;
float *_fuelOld;
float *_react;
float *_reactTemp;
float *_reactOld;
// smoke color
float *_color_r;
float *_color_rOld;
float *_color_rTemp;
float *_color_g;
float *_color_gOld;
float *_color_gTemp;
float *_color_b;
float *_color_bOld;
float *_color_bTemp;
// CG fields
int _iterations;
@@ -153,14 +179,16 @@ class FLUID_3D
void wipeBoundariesSL(int zBegin, int zEnd);
void addForce(int zBegin, int zEnd);
void addVorticity(int zBegin, int zEnd);
void addBuoyancy(float *heat, float *density, int zBegin, int zEnd);
void addBuoyancy(float *heat, float *density, float gravity[3], int zBegin, int zEnd);
// solver stuff
void project();
void diffuseHeat();
void diffuseColor();
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);
void solveDiffusion(float* field, float* b, float* factor);
// handle obstacle boundaries
@@ -174,6 +202,16 @@ class FLUID_3D
void advectMacCormackEnd1(int zBegin, int zEnd);
void advectMacCormackEnd2(int zBegin, int zEnd);
/* burning */
float *_burning_rate; // RNA pointer
float *_flame_smoke; // RNA pointer
float *_flame_smoke_color; // RNA pointer
float *_flame_vorticity; // RNA pointer
float *_ignition_temp; // RNA pointer
float *_max_temp; // RNA pointer
void processBurn(float *fuel, float *smoke, float *react, float *flame, float *heat,
float *r, float *g, float *b, int total_cells, float dt);
// boundary setting functions
static void copyBorderX(float* field, Vec3Int res, int zBegin, int zEnd);
static void copyBorderY(float* field, Vec3Int res, int zBegin, int zEnd);

View File

@@ -165,7 +165,6 @@ void FLUID_3D::solveHeat(float* field, float* b, unsigned char* skip)
if (_Acenter) delete[] _Acenter;
}
void FLUID_3D::solvePressurePre(float* field, float* b, unsigned char* skip)
{
int x, y, z;

View File

@@ -92,18 +92,10 @@ void FLUID_3D::setNeumannX(float* field, Vec3Int res, int zBegin, int zEnd)
// left slab
index = y * res[0] + z * slabSize;
field[index] = field[index + 2];
/* only allow outwards flux */
if(field[index]>0.) field[index] = 0.;
index += 1;
if(field[index]>0.) field[index] = 0.;
// right slab
index = y * res[0] + z * slabSize + res[0] - 1;
field[index] = field[index - 2];
/* only allow outwards flux */
if(field[index]<0.) field[index] = 0.;
index -= 1;
if(field[index]<0.) field[index] = 0.;
}
}
@@ -120,18 +112,10 @@ void FLUID_3D::setNeumannY(float* field, Vec3Int res, int zBegin, int zEnd)
// front slab
index = x + z * slabSize;
field[index] = field[index + 2 * res[0]];
/* only allow outwards flux */
if(field[index]>0.) field[index] = 0.;
index += res[0];
if(field[index]>0.) field[index] = 0.;
// back slab
index = x + z * slabSize + slabSize - res[0];
field[index] = field[index - 2 * res[0]];
/* only allow outwards flux */
if(field[index]<0.) field[index] = 0.;
index -= res[0];
if(field[index]<0.) field[index] = 0.;
}
}
@@ -152,14 +136,6 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res, int zBegin, int zEnd)
// front slab
index = x + y * res[0];
field[index] = field[index + 2 * slabSize];
/* only allow outwards flux */
// DG: Disable this for z-axis.
// The problem is that smoke somehow gets sucked in again
// from the TOP slab when this is enabled
// if(field[index]>0.) field[index] = 0.;
// index += slabSize;
// if(field[index]>0.) field[index] = 0.;
}
}
@@ -170,10 +146,6 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res, int zBegin, int zEnd)
// back slab
index = x + y * res[0] + cellsslab;
field[index] = field[index - 2 * slabSize];
/* only allow outwards flux */
if(field[index]<0.) field[index] = 0.;
index -= slabSize;
if(field[index]<0.) field[index] = 0.;
}
}

View File

@@ -51,7 +51,7 @@ static const float persistence = 0.56123f;
//////////////////////////////////////////////////////////////////////
// constructor
//////////////////////////////////////////////////////////////////////
WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype)
WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype, int init_fire, int init_colors)
{
// if noise magnitude is below this threshold, its contribution
// is negilgible, so stop evaluating new octaves
@@ -87,12 +87,26 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int no
// allocate high resolution density field
_totalStepsBig = 0;
_densityBig = new float[_totalCellsBig];
_densityBigOld = new float[_totalCellsBig];
_densityBigOld = new float[_totalCellsBig];
for(int i = 0; i < _totalCellsBig; i++) {
_densityBig[i] =
_densityBigOld[i] = 0.;
}
/* fire */
_flameBig = _fuelBig = _fuelBigOld = NULL;
_reactBig = _reactBigOld = NULL;
if (init_fire) {
initFire();
}
/* colors */
_color_rBig = _color_rBigOld = NULL;
_color_gBig = _color_gBigOld = NULL;
_color_bBig = _color_bBigOld = NULL;
if (init_colors) {
initColors(0.0f, 0.0f, 0.0f);
}
// allocate & init texture coordinates
_tcU = new float[_totalCellsSm];
@@ -128,12 +142,64 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int no
*/
}
void WTURBULENCE::initFire()
{
if (!_fuelBig) {
_flameBig = new float[_totalCellsBig];
_fuelBig = new float[_totalCellsBig];
_fuelBigOld = new float[_totalCellsBig];
_reactBig = new float[_totalCellsBig];
_reactBigOld = new float[_totalCellsBig];
for(int i = 0; i < _totalCellsBig; i++) {
_flameBig[i] =
_fuelBig[i] =
_fuelBigOld[i] = 0.;
_reactBig[i] =
_reactBigOld[i] = 0.;
}
}
}
void WTURBULENCE::initColors(float init_r, float init_g, float init_b)
{
if (!_color_rBig) {
_color_rBig = new float[_totalCellsBig];
_color_rBigOld = new float[_totalCellsBig];
_color_gBig = new float[_totalCellsBig];
_color_gBigOld = new float[_totalCellsBig];
_color_bBig = new float[_totalCellsBig];
_color_bBigOld = new float[_totalCellsBig];
for(int i = 0; i < _totalCellsBig; i++) {
_color_rBig[i] = _densityBig[i] * init_r;
_color_rBigOld[i] = 0.0f;
_color_gBig[i] = _densityBig[i] * init_g;
_color_gBigOld[i] = 0.0f;
_color_bBig[i] = _densityBig[i] * init_b;
_color_bBigOld[i] = 0.0f;
}
}
}
//////////////////////////////////////////////////////////////////////
// destructor
//////////////////////////////////////////////////////////////////////
WTURBULENCE::~WTURBULENCE() {
delete[] _densityBig;
delete[] _densityBigOld;
if (_flameBig) delete[] _flameBig;
if (_fuelBig) delete[] _fuelBig;
if (_fuelBigOld) delete[] _fuelBigOld;
if (_reactBig) delete[] _reactBig;
if (_reactBigOld) delete[] _reactBigOld;
if (_color_rBig) delete[] _color_rBig;
if (_color_rBigOld) delete[] _color_rBigOld;
if (_color_gBig) delete[] _color_gBig;
if (_color_gBigOld) delete[] _color_gBigOld;
if (_color_bBig) delete[] _color_bBig;
if (_color_bBigOld) delete[] _color_bBigOld;
delete[] _tcU;
delete[] _tcV;
@@ -757,8 +823,10 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
// enlarge timestep to match grid
const float dt = dtOrg * _amplify;
const float invAmp = 1.0f / _amplify;
float *tempBig1 = (float *)calloc(_totalCellsBig, sizeof(float));
float *tempBig2 = (float *)calloc(_totalCellsBig, sizeof(float));
float *tempFuelBig = NULL, *tempReactBig = NULL;
float *tempColor_rBig = NULL, *tempColor_gBig = NULL, *tempColor_bBig = NULL;
float *tempDensityBig = (float *)calloc(_totalCellsBig, sizeof(float));
float *tempBig = (float *)calloc(_totalCellsBig, sizeof(float));
float *bigUx = (float *)calloc(_totalCellsBig, sizeof(float));
float *bigUy = (float *)calloc(_totalCellsBig, sizeof(float));
float *bigUz = (float *)calloc(_totalCellsBig, sizeof(float));
@@ -767,11 +835,21 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
float *eigMin = (float *)calloc(_totalCellsSm, sizeof(float));
float *eigMax = (float *)calloc(_totalCellsSm, sizeof(float));
if (_fuelBig) {
tempFuelBig = (float *)calloc(_totalCellsBig, sizeof(float));
tempReactBig = (float *)calloc(_totalCellsBig, sizeof(float));
}
if (_color_rBig) {
tempColor_rBig = (float *)calloc(_totalCellsBig, sizeof(float));
tempColor_gBig = (float *)calloc(_totalCellsBig, sizeof(float));
tempColor_bBig = (float *)calloc(_totalCellsBig, sizeof(float));
}
memset(_tcTemp, 0, sizeof(float)*_totalCellsSm);
// prepare textures
advectTextureCoordinates(dtOrg, xvel,yvel,zvel, tempBig1, tempBig2);
advectTextureCoordinates(dtOrg, xvel,yvel,zvel, tempDensityBig, tempBig);
// do wavelet decomposition of energy
computeEnergy(_energy, xvel, yvel, zvel, obstacles);
@@ -972,6 +1050,11 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
// prepare density for an advection
SWAP_POINTERS(_densityBig, _densityBigOld);
SWAP_POINTERS(_fuelBig, _fuelBigOld);
SWAP_POINTERS(_reactBig, _reactBigOld);
SWAP_POINTERS(_color_rBig, _color_rBigOld);
SWAP_POINTERS(_color_gBig, _color_gBigOld);
SWAP_POINTERS(_color_bBig, _color_bBigOld);
// based on the maximum velocity present, see if we need to substep,
// but cap the maximum number of substeps to 5
@@ -1017,7 +1100,21 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
int zEnd = (int)((float)(i+1)*partSize + 0.5f);
#endif
FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz,
_densityBigOld, tempBig1, _resBig, zBegin, zEnd);
_densityBigOld, tempDensityBig, _resBig, zBegin, zEnd);
if (_fuelBig) {
FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz,
_fuelBigOld, tempFuelBig, _resBig, zBegin, zEnd);
FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz,
_reactBigOld, tempReactBig, _resBig, zBegin, zEnd);
}
if (_color_rBig) {
FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz,
_color_rBigOld, tempColor_rBig, _resBig, zBegin, zEnd);
FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz,
_color_gBigOld, tempColor_gBig, _resBig, zBegin, zEnd);
FLUID_3D::advectFieldMacCormack1(dtSubdiv, bigUx, bigUy, bigUz,
_color_bBigOld, tempColor_bBig, _resBig, zBegin, zEnd);
}
#if PARALLEL==1
}
@@ -1030,18 +1127,43 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
int zEnd = (int)((float)(i+1)*partSize + 0.5f);
#endif
FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz,
_densityBigOld, _densityBig, tempBig1, tempBig2, _resBig, NULL, zBegin, zEnd);
_densityBigOld, _densityBig, tempDensityBig, tempBig, _resBig, NULL, zBegin, zEnd);
if (_fuelBig) {
FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz,
_fuelBigOld, _fuelBig, tempFuelBig, tempBig, _resBig, NULL, zBegin, zEnd);
FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz,
_reactBigOld, _reactBig, tempReactBig, tempBig, _resBig, NULL, zBegin, zEnd);
}
if (_color_rBig) {
FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz,
_color_rBigOld, _color_rBig, tempColor_rBig, tempBig, _resBig, NULL, zBegin, zEnd);
FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz,
_color_gBigOld, _color_gBig, tempColor_gBig, tempBig, _resBig, NULL, zBegin, zEnd);
FLUID_3D::advectFieldMacCormack2(dtSubdiv, bigUx, bigUy, bigUz,
_color_bBigOld, _color_bBig, tempColor_bBig, tempBig, _resBig, NULL, zBegin, zEnd);
}
#if PARALLEL==1
}
}
#endif
if (substep < totalSubsteps - 1)
if (substep < totalSubsteps - 1) {
SWAP_POINTERS(_densityBig, _densityBigOld);
SWAP_POINTERS(_fuelBig, _fuelBigOld);
SWAP_POINTERS(_reactBig, _reactBigOld);
SWAP_POINTERS(_color_rBig, _color_rBigOld);
SWAP_POINTERS(_color_gBig, _color_gBigOld);
SWAP_POINTERS(_color_bBig, _color_bBigOld);
}
} // substep
free(tempBig1);
free(tempBig2);
free(tempDensityBig);
if (tempFuelBig) free(tempFuelBig);
if (tempReactBig) free(tempReactBig);
if (tempColor_rBig) free(tempColor_rBig);
if (tempColor_gBig) free(tempColor_gBig);
if (tempColor_bBig) free(tempColor_bBig);
free(tempBig);
free(bigUx);
free(bigUy);
free(bigUz);
@@ -1050,6 +1172,15 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
// wipe the density borders
FLUID_3D::setZeroBorder(_densityBig, _resBig, 0 , _resBig[2]);
if (_fuelBig) {
FLUID_3D::setZeroBorder(_fuelBig, _resBig, 0 , _resBig[2]);
FLUID_3D::setZeroBorder(_reactBig, _resBig, 0 , _resBig[2]);
}
if (_color_rBig) {
FLUID_3D::setZeroBorder(_color_rBig, _resBig, 0 , _resBig[2]);
FLUID_3D::setZeroBorder(_color_gBig, _resBig, 0 , _resBig[2]);
FLUID_3D::setZeroBorder(_color_bBig, _resBig, 0 , _resBig[2]);
}
// reset texture coordinates now in preparation for next timestep
// Shouldn't do this before generating the noise because then the

View File

@@ -36,10 +36,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, int noisetype);
WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype, int init_fire, int init_colors);
/// destructor
virtual ~WTURBULENCE();
void initFire();
void initColors(float init_r, float init_g, float init_b);
void setNoise(int type);
void initBlenderRNA(float *strength);
@@ -63,6 +66,8 @@ class WTURBULENCE
// access functions
inline float* getDensityBig() { return _densityBig; }
inline float* getFlameBig() { return _flameBig; }
inline float* getFuelBig() { return _fuelBig; }
inline float* getArrayTcU() { return _tcU; }
inline float* getArrayTcV() { return _tcV; }
inline float* getArrayTcW() { return _tcW; }
@@ -111,6 +116,18 @@ class WTURBULENCE
float* _densityBig;
float* _densityBigOld;
float* _flameBig;
float* _fuelBig;
float* _fuelBigOld;
float* _reactBig;
float* _reactBigOld;
float* _color_rBig;
float* _color_rBigOld;
float* _color_gBig;
float* _color_gBigOld;
float* _color_bBig;
float* _color_bBigOld;
// texture coordinates for noise
float* _tcU;

View File

@@ -30,6 +30,7 @@
#include "FLUID_3D.h"
#include "WTURBULENCE.h"
#include "spectrum.h"
#include <stdio.h>
#include <stdlib.h>
@@ -37,22 +38,16 @@
#include "../extern/smoke_API.h" /* to ensure valid prototypes */
// y in smoke is z in blender
extern "C" FLUID_3D *smoke_init(int *res, float *p0, float dtdef)
extern "C" FLUID_3D *smoke_init(int *res, float dx, float dtdef, int use_heat, int use_fire, int use_colors)
{
// smoke lib uses y as top-bottom/vertical axis where blender uses z
FLUID_3D *fluid = new FLUID_3D(res, p0, dtdef);
// printf("xres: %d, yres: %d, zres: %d\n", res[0], res[1], res[2]);
FLUID_3D *fluid = new FLUID_3D(res, dx, dtdef, use_heat, use_fire, use_colors);
return fluid;
}
extern "C" WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype)
extern "C" WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, int use_fire, int use_colors)
{
// initialize wavelet turbulence
if(amplify)
return new WTURBULENCE(res[0],res[1],res[2], amplify, noisetype);
return new WTURBULENCE(res[0],res[1],res[2], amplify, noisetype, use_fire, use_colors);
else
return NULL;
}
@@ -71,7 +66,6 @@ extern "C" void smoke_turbulence_free(WTURBULENCE *wt)
extern "C" size_t smoke_get_index(int x, int max_x, int y, int max_y, int z /*, int max_z */)
{
// // const int index = x + y * smd->res[0] + z * smd->res[0]*smd->res[1];
return x + y * max_x + z * max_x*max_y;
}
@@ -80,100 +74,28 @@ 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_step(FLUID_3D *fluid, float dtSubdiv)
extern "C" void smoke_step(FLUID_3D *fluid, float gravity[3], float dtSubdiv)
{
fluid->step(dtSubdiv);
if (fluid->_fuel) {
fluid->processBurn(fluid->_fuel, fluid->_density, fluid->_react, fluid->_flame, fluid->_heat,
fluid->_color_r, fluid->_color_g, fluid->_color_b, fluid->_totalCells, (*fluid->_dtFactor)*dtSubdiv);
}
fluid->step(dtSubdiv, gravity);
}
extern "C" void smoke_turbulence_step(WTURBULENCE *wt, FLUID_3D *fluid)
{
if (wt->_fuelBig) {
fluid->processBurn(wt->_fuelBig, wt->_densityBig, wt->_reactBig, wt->_flameBig, 0,
wt->_color_rBig, wt->_color_gBig, wt->_color_bBig, wt->_totalCellsBig, fluid->_dt);
}
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, float *dt_factor, float *vorticity, int *border_colli)
extern "C" void smoke_initBlenderRNA(FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli, float *burning_rate,
float *flame_smoke, float *flame_smoke_color, float *flame_vorticity, float *flame_ignition_temp, float *flame_max_temp)
{
fluid->initBlenderRNA(alpha, beta, dt_factor, vorticity, border_colli);
}
extern "C" void smoke_dissolve(FLUID_3D *fluid, int speed, int log)
{
float *density = fluid->_density;
//float *densityOld = fluid->_densityOld;
float *heat = fluid->_heat;
if(log)
{
/* max density/speed = dydx */
float dydx = 1.0 / (float)speed;
size_t size= fluid->_xRes * fluid->_yRes * fluid->_zRes;
for(size_t i = 0; i < size; i++)
{
density[i] *= (1.0 - dydx);
if(density[i] < 0.0f)
density[i] = 0.0f;
heat[i] *= (1.0 - dydx);
/*if(heat[i] < 0.0f)
heat[i] = 0.0f;*/
}
}
else // linear falloff
{
/* max density/speed = dydx */
float dydx = 1.0 / (float)speed;
size_t size= fluid->_xRes * fluid->_yRes * fluid->_zRes;
for(size_t i = 0; i < size; i++)
{
density[i] -= dydx;
if(density[i] < 0.0f)
density[i] = 0.0f;
if(abs(heat[i]) < dydx) heat[i] = 0.0f;
else if (heat[i]>0.0f) heat[i] -= dydx;
else if (heat[i]<0.0f) heat[i] += dydx;
}
}
}
extern "C" void smoke_dissolve_wavelet(WTURBULENCE *wt, int speed, int log)
{
float *density = wt->getDensityBig();
Vec3Int r = wt->getResBig();
if(log)
{
/* max density/speed = dydx */
float dydx = 1.0 / (float)speed;
size_t size= r[0] * r[1] * r[2];
for(size_t i = 0; i < size; i++)
{
density[i] *= (1.0 - dydx);
if(density[i] < 0.0f)
density[i] = 0.0f;
}
}
else // linear falloff
{
/* max density/speed = dydx */
float dydx = 1.0 / (float)speed;
size_t size= r[0] * r[1] * r[2];
for(size_t i = 0; i < size; i++)
{
density[i] -= dydx;
if(density[i] < 0.0f)
density[i] = 0.0f;
}
}
fluid->initBlenderRNA(alpha, beta, dt_factor, vorticity, border_colli, burning_rate, flame_smoke, flame_smoke_color, flame_vorticity, flame_ignition_temp, flame_max_temp);
}
extern "C" void smoke_initWaveletBlenderRNA(WTURBULENCE *wt, float *strength)
@@ -181,36 +103,105 @@ extern "C" void smoke_initWaveletBlenderRNA(WTURBULENCE *wt, float *strength)
wt->initBlenderRNA(strength);
}
template < class T > inline T ABS( T a )
static void data_dissolve(float *density, float *heat, float *r, float *g, float *b, int total_cells, int speed, int log)
{
return (0 < a) ? a : -a ;
if(log)
{
/* max density/speed = dydx */
float fac = 1.0f - (1.0f / (float)speed);
for(size_t i = 0; i < total_cells; i++)
{
/* density */
density[i] *= fac;
/* heat */
if (heat) {
heat[i] *= fac;
}
/* color */
if (r) {
r[i] *= fac;
g[i] *= fac;
b[i] *= fac;
}
}
}
else // linear falloff
{
/* max density/speed = dydx */
float dydx = 1.0f / (float)speed;
for(size_t i = 0; i < total_cells; i++)
{
float d = density[i];
/* density */
density[i] -= dydx;
if(density[i] < 0.0f)
density[i] = 0.0f;
/* heat */
if (heat) {
if(abs(heat[i]) < dydx) heat[i] = 0.0f;
else if (heat[i]>0.0f) heat[i] -= dydx;
else if (heat[i]<0.0f) heat[i] += dydx;
}
/* color */
if (r && d) {
r[i] *= (density[i]/d);
g[i] *= (density[i]/d);
b[i] *= (density[i]/d);
}
}
}
}
extern "C" void smoke_export(FLUID_3D *fluid, float *dt, float *dx, float **dens, float **densold, float **heat, float **heatold, float **vx, float **vy, float **vz, float **vxold, float **vyold, float **vzold, unsigned char **obstacles)
extern "C" void smoke_dissolve(FLUID_3D *fluid, int speed, int log)
{
data_dissolve(fluid->_density, fluid->_heat, fluid->_color_r, fluid->_color_g, fluid->_color_b, fluid->_totalCells, speed, log);
}
extern "C" void smoke_dissolve_wavelet(WTURBULENCE *wt, int speed, int log)
{
data_dissolve(wt->_densityBig, 0, wt->_color_rBig, wt->_color_gBig, wt->_color_bBig, wt->_totalCellsBig, speed, log);
}
extern "C" void smoke_export(FLUID_3D *fluid, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat,
float **heatold, float **vx, float **vy, float **vz, float **r, float **g, float **b, unsigned char **obstacles)
{
*dens = fluid->_density;
*densold = fluid->_densityOld;
*fuel = fluid->_fuel;
*react = fluid->_react;
*flame = fluid->_flame;
*heat = fluid->_heat;
*heatold = fluid->_heatOld;
*vx = fluid->_xVelocity;
*vy = fluid->_yVelocity;
*vz = fluid->_zVelocity;
*vxold = fluid->_xVelocityOld;
*vyold = fluid->_yVelocityOld;
*vzold = fluid->_zVelocityOld;
*r = fluid->_color_r;
*g = fluid->_color_g;
*b = fluid->_color_b;
*obstacles = fluid->_obstacles;
*dt = fluid->_dt;
*dx = fluid->_dx;
}
extern "C" void smoke_turbulence_export(WTURBULENCE *wt, float **dens, float **densold, float **tcu, float **tcv, float **tcw)
extern "C" void smoke_turbulence_export(WTURBULENCE *wt, float **dens, float **react, float **flame, float **fuel,
float **r, float **g, float **b , float **tcu, float **tcv, float **tcw)
{
if(!wt)
return;
*dens = wt->_densityBig;
*densold = wt->_densityBigOld;
*fuel = wt->_fuelBig;
*react = wt->_reactBig;
*flame = wt->_flameBig;
*r = wt->_color_rBig;
*g = wt->_color_gBig;
*b = wt->_color_bBig;
*tcu = wt->_tcU;
*tcv = wt->_tcV;
*tcw = wt->_tcW;
@@ -221,6 +212,16 @@ extern "C" float *smoke_get_density(FLUID_3D *fluid)
return fluid->_density;
}
extern "C" float *smoke_get_fuel(FLUID_3D *fluid)
{
return fluid->_fuel;
}
extern "C" float *smoke_get_react(FLUID_3D *fluid)
{
return fluid->_react;
}
extern "C" float *smoke_get_heat(FLUID_3D *fluid)
{
return fluid->_heat;
@@ -256,15 +257,137 @@ extern "C" float *smoke_get_force_z(FLUID_3D *fluid)
return fluid->_zForce;
}
extern "C" float *smoke_get_flame(FLUID_3D *fluid)
{
return fluid->_flame;
}
extern "C" float *smoke_get_color_r(FLUID_3D *fluid)
{
return fluid->_color_r;
}
extern "C" float *smoke_get_color_g(FLUID_3D *fluid)
{
return fluid->_color_g;
}
extern "C" float *smoke_get_color_b(FLUID_3D *fluid)
{
return fluid->_color_b;
}
static void get_rgba(float *r, float *g, float *b, float *a, int total_cells, float *data, int sequential)
{
int i;
int m = 4, i_g = 1, i_b = 2, i_a = 3;
/* sequential data */
if (sequential) {
m = 1;
i_g *= total_cells;
i_b *= total_cells;
i_a *= total_cells;
}
for (i=0; i<total_cells; i++) {
float alpha = a[i];
if (alpha) {
data[i*m ] = r[i];
data[i*m+i_g] = g[i];
data[i*m+i_b] = b[i];
}
else {
data[i*m ] = data[i*m+i_g] = data[i*m+i_b] = 0.0f;
}
data[i*m+i_a] = alpha;
}
}
extern "C" void smoke_get_rgba(FLUID_3D *fluid, float *data, int sequential)
{
get_rgba(fluid->_color_r, fluid->_color_g, fluid->_color_b, fluid->_density, fluid->_totalCells, data, sequential);
}
extern "C" void smoke_turbulence_get_rgba(WTURBULENCE *wt, float *data, int sequential)
{
get_rgba(wt->_color_rBig, wt->_color_gBig, wt->_color_bBig, wt->_densityBig, wt->_totalCellsBig, data, sequential);
}
/* get a single color premultiplied voxel grid */
static void get_rgba_from_density(float color[3], float *a, int total_cells, float *data, int sequential)
{
int i;
int m = 4, i_g = 1, i_b = 2, i_a = 3;
/* sequential data */
if (sequential) {
m = 1;
i_g *= total_cells;
i_b *= total_cells;
i_a *= total_cells;
}
for (i=0; i<total_cells; i++) {
float alpha = a[i];
if (alpha) {
data[i*m ] = color[0] * alpha;
data[i*m+i_g] = color[1] * alpha;
data[i*m+i_b] = color[2] * alpha;
}
else {
data[i*m ] = data[i*m+i_g] = data[i*m+i_b] = 0.0f;
}
data[i*m+i_a] = alpha;
}
}
extern "C" void smoke_get_rgba_from_density(FLUID_3D *fluid, float color[3], float *data, int sequential)
{
get_rgba_from_density(color, fluid->_density, fluid->_totalCells, data, sequential);
}
extern "C" void smoke_turbulence_get_rgba_from_density(WTURBULENCE *wt, float color[3], float *data, int sequential)
{
get_rgba_from_density(color, wt->_densityBig, wt->_totalCellsBig, data, sequential);
}
extern "C" float *smoke_turbulence_get_density(WTURBULENCE *wt)
{
return wt ? wt->getDensityBig() : NULL;
}
extern "C" float *smoke_turbulence_get_fuel(WTURBULENCE *wt)
{
return wt ? wt->getFuelBig() : NULL;
}
extern "C" float *smoke_turbulence_get_react(WTURBULENCE *wt)
{
return wt ? wt->_reactBig : NULL;
}
extern "C" float *smoke_turbulence_get_color_r(WTURBULENCE *wt)
{
return wt ? wt->_color_rBig : NULL;
}
extern "C" float *smoke_turbulence_get_color_g(WTURBULENCE *wt)
{
return wt ? wt->_color_gBig : NULL;
}
extern "C" float *smoke_turbulence_get_color_b(WTURBULENCE *wt)
{
return wt ? wt->_color_bBig : NULL;
}
extern "C" float *smoke_turbulence_get_flame(WTURBULENCE *wt)
{
return wt ? wt->getFlameBig() : NULL;
}
extern "C" void smoke_turbulence_get_res(WTURBULENCE *wt, int *res)
{
if(wt)
{
if(wt) {
Vec3Int r = wt->getResBig();
res[0] = r[0];
res[1] = r[1];
@@ -272,6 +395,15 @@ extern "C" void smoke_turbulence_get_res(WTURBULENCE *wt, int *res)
}
}
extern "C" int smoke_turbulence_get_cells(WTURBULENCE *wt)
{
if(wt) {
Vec3Int r = wt->getResBig();
return r[0]*r[1]*r[2];
}
return 0;
}
extern "C" unsigned char *smoke_get_obstacle(FLUID_3D *fluid)
{
return fluid->_obstacles;
@@ -295,3 +427,61 @@ extern "C" void smoke_turbulence_set_noise(WTURBULENCE *wt, int type)
{
wt->setNoise(type);
}
extern "C" void flame_get_spectrum(unsigned char *spec, int width, float t1, float t2)
{
spectrum(t1, t2, width, spec);
}
extern "C" int smoke_has_heat(FLUID_3D *fluid)
{
return (fluid->_heat) ? 1 : 0;
}
extern "C" int smoke_has_fuel(FLUID_3D *fluid)
{
return (fluid->_fuel) ? 1 : 0;
}
extern "C" int smoke_has_colors(FLUID_3D *fluid)
{
return (fluid->_color_r && fluid->_color_g && fluid->_color_b) ? 1 : 0;
}
extern "C" int smoke_turbulence_has_fuel(WTURBULENCE *wt)
{
return (wt->_fuelBig) ? 1 : 0;
}
extern "C" int smoke_turbulence_has_colors(WTURBULENCE *wt)
{
return (wt->_color_rBig && wt->_color_gBig && wt->_color_bBig) ? 1 : 0;
}
/* additional field initialization */
extern "C" void smoke_ensure_heat(FLUID_3D *fluid)
{
if (fluid) {
fluid->initHeat();
}
}
extern "C" void smoke_ensure_fire(FLUID_3D *fluid, WTURBULENCE *wt)
{
if (fluid) {
fluid->initFire();
}
if (wt) {
wt->initFire();
}
}
extern "C" void smoke_ensure_colors(FLUID_3D *fluid, WTURBULENCE *wt, float init_r, float init_g, float init_b)
{
if (fluid) {
fluid->initColors(init_r, init_g, init_b);
}
if (wt) {
wt->initColors(init_r, init_g, init_b);
}
}

View File

@@ -0,0 +1,411 @@
/*
Colour Rendering of Spectra
by John Walker
http://www.fourmilab.ch/
Last updated: March 9, 2003
This program is in the public domain.
For complete information about the techniques employed in
this program, see the World-Wide Web document:
http://www.fourmilab.ch/documents/specrend/
The xyz_to_rgb() function, which was wrong in the original
version of this program, was corrected by:
Andrew J. S. Hamilton 21 May 1999
Andrew.Hamilton@Colorado.EDU
http://casa.colorado.edu/~ajsh/
who also added the gamma correction facilities and
modified constrain_rgb() to work by desaturating the
colour by adding white.
A program which uses these functions to plot CIE
"tongue" diagrams called "ppmcie" is included in
the Netpbm graphics toolkit:
http://netpbm.sourceforge.net/
(The program was called cietoppm in earlier
versions of Netpbm.)
*/
#include <stdio.h>
#include <math.h>
/* A colour system is defined by the CIE x and y coordinates of
its three primary illuminants and the x and y coordinates of
the white point. */
struct colourSystem {
char *name; /* Colour system name */
double xRed, yRed, /* Red x, y */
xGreen, yGreen, /* Green x, y */
xBlue, yBlue, /* Blue x, y */
xWhite, yWhite, /* White point x, y */
gamma; /* Gamma correction for system */
};
/* White point chromaticities. */
#define IlluminantC 0.3101, 0.3162 /* For NTSC television */
#define IlluminantD65 0.3127, 0.3291 /* For EBU and SMPTE */
#define IlluminantE 0.33333333, 0.33333333 /* CIE equal-energy illuminant */
/* Gamma of nonlinear correction.
See Charles Poynton's ColorFAQ Item 45 and GammaFAQ Item 6 at:
http://www.poynton.com/ColorFAQ.html
http://www.poynton.com/GammaFAQ.html
*/
#define GAMMA_REC709 0 /* Rec. 709 */
static struct colourSystem
/* Name xRed yRed xGreen yGreen xBlue yBlue White point Gamma */
NTSCsystem = { "NTSC", 0.67, 0.33, 0.21, 0.71, 0.14, 0.08, IlluminantC, GAMMA_REC709 },
EBUsystem = { "EBU (PAL/SECAM)", 0.64, 0.33, 0.29, 0.60, 0.15, 0.06, IlluminantD65, GAMMA_REC709 },
SMPTEsystem = { "SMPTE", 0.630, 0.340, 0.310, 0.595, 0.155, 0.070, IlluminantD65, GAMMA_REC709 },
HDTVsystem = { "HDTV", 0.670, 0.330, 0.210, 0.710, 0.150, 0.060, IlluminantD65, GAMMA_REC709 },
CIEsystem = { "CIE", 0.7355, 0.2645, 0.2658, 0.7243, 0.1669, 0.0085, IlluminantE, GAMMA_REC709 },
Rec709system = { "CIE REC 709", 0.64, 0.33, 0.30, 0.60, 0.15, 0.06, IlluminantD65, GAMMA_REC709 };
/* UPVP_TO_XY
Given 1976 coordinates u', v', determine 1931 chromaticities x, y
*/
void upvp_to_xy(double up, double vp, double *xc, double *yc)
{
*xc = (9 * up) / ((6 * up) - (16 * vp) + 12);
*yc = (4 * vp) / ((6 * up) - (16 * vp) + 12);
}
/* XY_TO_UPVP
Given 1931 chromaticities x, y, determine 1976 coordinates u', v'
*/
void xy_to_upvp(double xc, double yc, double *up, double *vp)
{
*up = (4 * xc) / ((-2 * xc) + (12 * yc) + 3);
*vp = (9 * yc) / ((-2 * xc) + (12 * yc) + 3);
}
/* XYZ_TO_RGB
Given an additive tricolour system CS, defined by the CIE x
and y chromaticities of its three primaries (z is derived
trivially as 1-(x+y)), and a desired chromaticity (XC, YC,
ZC) in CIE space, determine the contribution of each
primary in a linear combination which sums to the desired
chromaticity. If the requested chromaticity falls outside
the Maxwell triangle (colour gamut) formed by the three
primaries, one of the r, g, or b weights will be negative.
Caller can use constrain_rgb() to desaturate an
outside-gamut colour to the closest representation within
the available gamut and/or norm_rgb to normalise the RGB
components so the largest nonzero component has value 1.
*/
void xyz_to_rgb(struct colourSystem *cs,
double xc, double yc, double zc,
double *r, double *g, double *b)
{
double xr, yr, zr, xg, yg, zg, xb, yb, zb;
double xw, yw, zw;
double rx, ry, rz, gx, gy, gz, bx, by, bz;
double rw, gw, bw;
xr = cs->xRed; yr = cs->yRed; zr = 1 - (xr + yr);
xg = cs->xGreen; yg = cs->yGreen; zg = 1 - (xg + yg);
xb = cs->xBlue; yb = cs->yBlue; zb = 1 - (xb + yb);
xw = cs->xWhite; yw = cs->yWhite; zw = 1 - (xw + yw);
/* xyz -> rgb matrix, before scaling to white. */
rx = (yg * zb) - (yb * zg); ry = (xb * zg) - (xg * zb); rz = (xg * yb) - (xb * yg);
gx = (yb * zr) - (yr * zb); gy = (xr * zb) - (xb * zr); gz = (xb * yr) - (xr * yb);
bx = (yr * zg) - (yg * zr); by = (xg * zr) - (xr * zg); bz = (xr * yg) - (xg * yr);
/* White scaling factors.
Dividing by yw scales the white luminance to unity, as conventional. */
rw = ((rx * xw) + (ry * yw) + (rz * zw)) / yw;
gw = ((gx * xw) + (gy * yw) + (gz * zw)) / yw;
bw = ((bx * xw) + (by * yw) + (bz * zw)) / yw;
/* xyz -> rgb matrix, correctly scaled to white. */
rx = rx / rw; ry = ry / rw; rz = rz / rw;
gx = gx / gw; gy = gy / gw; gz = gz / gw;
bx = bx / bw; by = by / bw; bz = bz / bw;
/* rgb of the desired point */
*r = (rx * xc) + (ry * yc) + (rz * zc);
*g = (gx * xc) + (gy * yc) + (gz * zc);
*b = (bx * xc) + (by * yc) + (bz * zc);
}
/* INSIDE_GAMUT
Test whether a requested colour is within the gamut
achievable with the primaries of the current colour
system. This amounts simply to testing whether all the
primary weights are non-negative. */
int inside_gamut(double r, double g, double b)
{
return (r >= 0) && (g >= 0) && (b >= 0);
}
/* CONSTRAIN_RGB
If the requested RGB shade contains a negative weight for
one of the primaries, it lies outside the colour gamut
accessible from the given triple of primaries. Desaturate
it by adding white, equal quantities of R, G, and B, enough
to make RGB all positive. The function returns 1 if the
components were modified, zero otherwise.
*/
int constrain_rgb(double *r, double *g, double *b)
{
double w;
/* Amount of white needed is w = - min(0, *r, *g, *b) */
w = (0 < *r) ? 0 : *r;
w = (w < *g) ? w : *g;
w = (w < *b) ? w : *b;
w = -w;
/* Add just enough white to make r, g, b all positive. */
if (w > 0) {
*r += w; *g += w; *b += w;
return 1; /* Colour modified to fit RGB gamut */
}
return 0; /* Colour within RGB gamut */
}
/* GAMMA_CORRECT_RGB
Transform linear RGB values to nonlinear RGB values. Rec.
709 is ITU-R Recommendation BT. 709 (1990) ``Basic
Parameter Values for the HDTV Standard for the Studio and
for International Programme Exchange'', formerly CCIR Rec.
709. For details see
http://www.poynton.com/ColorFAQ.html
http://www.poynton.com/GammaFAQ.html
*/
void gamma_correct(const struct colourSystem *cs, double *c)
{
double gamma;
gamma = cs->gamma;
if (gamma == GAMMA_REC709) {
/* Rec. 709 gamma correction. */
double cc = 0.018;
if (*c < cc) {
*c *= ((1.099 * pow(cc, 0.45)) - 0.099) / cc;
} else {
*c = (1.099 * pow(*c, 0.45)) - 0.099;
}
} else {
/* Nonlinear colour = (Linear colour)^(1/gamma) */
*c = pow(*c, 1.0 / gamma);
}
}
void gamma_correct_rgb(const struct colourSystem *cs, double *r, double *g, double *b)
{
gamma_correct(cs, r);
gamma_correct(cs, g);
gamma_correct(cs, b);
}
/* NORM_RGB
Normalise RGB components so the most intense (unless all
are zero) has a value of 1.
*/
void norm_rgb(double *r, double *g, double *b)
{
#define Max(a, b) (((a) > (b)) ? (a) : (b))
double greatest = Max(*r, Max(*g, *b));
if (greatest > 0) {
*r /= greatest;
*g /= greatest;
*b /= greatest;
}
#undef Max
}
/* SPECTRUM_TO_XYZ
Calculate the CIE X, Y, and Z coordinates corresponding to
a light source with spectral distribution given by the
function SPEC_INTENS, which is called with a series of
wavelengths between 380 and 780 nm (the argument is
expressed in meters), which returns emittance at that
wavelength in arbitrary units. The chromaticity
coordinates of the spectrum are returned in the x, y, and z
arguments which respect the identity:
x + y + z = 1.
*/
void spectrum_to_xyz(double (*spec_intens)(double wavelength),
double *x, double *y, double *z)
{
int i;
double lambda, X = 0, Y = 0, Z = 0, XYZ;
/* CIE colour matching functions xBar, yBar, and zBar for
wavelengths from 380 through 780 nanometers, every 5
nanometers. For a wavelength lambda in this range:
cie_colour_match[(lambda - 380) / 5][0] = xBar
cie_colour_match[(lambda - 380) / 5][1] = yBar
cie_colour_match[(lambda - 380) / 5][2] = zBar
To save memory, this table can be declared as floats
rather than doubles; (IEEE) float has enough
significant bits to represent the values. It's declared
as a double here to avoid warnings about "conversion
between floating-point types" from certain persnickety
compilers. */
static double cie_colour_match[81][3] = {
{0.0014,0.0000,0.0065}, {0.0022,0.0001,0.0105}, {0.0042,0.0001,0.0201},
{0.0076,0.0002,0.0362}, {0.0143,0.0004,0.0679}, {0.0232,0.0006,0.1102},
{0.0435,0.0012,0.2074}, {0.0776,0.0022,0.3713}, {0.1344,0.0040,0.6456},
{0.2148,0.0073,1.0391}, {0.2839,0.0116,1.3856}, {0.3285,0.0168,1.6230},
{0.3483,0.0230,1.7471}, {0.3481,0.0298,1.7826}, {0.3362,0.0380,1.7721},
{0.3187,0.0480,1.7441}, {0.2908,0.0600,1.6692}, {0.2511,0.0739,1.5281},
{0.1954,0.0910,1.2876}, {0.1421,0.1126,1.0419}, {0.0956,0.1390,0.8130},
{0.0580,0.1693,0.6162}, {0.0320,0.2080,0.4652}, {0.0147,0.2586,0.3533},
{0.0049,0.3230,0.2720}, {0.0024,0.4073,0.2123}, {0.0093,0.5030,0.1582},
{0.0291,0.6082,0.1117}, {0.0633,0.7100,0.0782}, {0.1096,0.7932,0.0573},
{0.1655,0.8620,0.0422}, {0.2257,0.9149,0.0298}, {0.2904,0.9540,0.0203},
{0.3597,0.9803,0.0134}, {0.4334,0.9950,0.0087}, {0.5121,1.0000,0.0057},
{0.5945,0.9950,0.0039}, {0.6784,0.9786,0.0027}, {0.7621,0.9520,0.0021},
{0.8425,0.9154,0.0018}, {0.9163,0.8700,0.0017}, {0.9786,0.8163,0.0014},
{1.0263,0.7570,0.0011}, {1.0567,0.6949,0.0010}, {1.0622,0.6310,0.0008},
{1.0456,0.5668,0.0006}, {1.0026,0.5030,0.0003}, {0.9384,0.4412,0.0002},
{0.8544,0.3810,0.0002}, {0.7514,0.3210,0.0001}, {0.6424,0.2650,0.0000},
{0.5419,0.2170,0.0000}, {0.4479,0.1750,0.0000}, {0.3608,0.1382,0.0000},
{0.2835,0.1070,0.0000}, {0.2187,0.0816,0.0000}, {0.1649,0.0610,0.0000},
{0.1212,0.0446,0.0000}, {0.0874,0.0320,0.0000}, {0.0636,0.0232,0.0000},
{0.0468,0.0170,0.0000}, {0.0329,0.0119,0.0000}, {0.0227,0.0082,0.0000},
{0.0158,0.0057,0.0000}, {0.0114,0.0041,0.0000}, {0.0081,0.0029,0.0000},
{0.0058,0.0021,0.0000}, {0.0041,0.0015,0.0000}, {0.0029,0.0010,0.0000},
{0.0020,0.0007,0.0000}, {0.0014,0.0005,0.0000}, {0.0010,0.0004,0.0000},
{0.0007,0.0002,0.0000}, {0.0005,0.0002,0.0000}, {0.0003,0.0001,0.0000},
{0.0002,0.0001,0.0000}, {0.0002,0.0001,0.0000}, {0.0001,0.0000,0.0000},
{0.0001,0.0000,0.0000}, {0.0001,0.0000,0.0000}, {0.0000,0.0000,0.0000}
};
for (i = 0, lambda = 380; lambda < 780.1; i++, lambda += 5) {
double Me;
Me = (*spec_intens)(lambda);
X += Me * cie_colour_match[i][0];
Y += Me * cie_colour_match[i][1];
Z += Me * cie_colour_match[i][2];
}
XYZ = (X + Y + Z);
*x = X / XYZ;
*y = Y / XYZ;
*z = Z / XYZ;
}
/* BB_SPECTRUM
Calculate, by Planck's radiation law, the emittance of a black body
of temperature bbTemp at the given wavelength (in metres). */
double bbTemp = 5000; /* Hidden temperature argument
to BB_SPECTRUM. */
double bb_spectrum(double wavelength)
{
double wlm = wavelength * 1e-9; /* Wavelength in meters */
return (3.74183e-16 * pow(wlm, -5.0)) /
(exp(1.4388e-2 / (wlm * bbTemp)) - 1.0);
}
void xyz_to_lms(double x, double y, double z, double* l, double* m, double* s)
{
*l = 0.3897*x + 0.6890*y - 0.0787*z;
*m = -0.2298*x + 1.1834*y + 0.0464*z;
*s = z;
}
void lms_to_xyz(double l, double m, double s, double* x, double *y, double* z)
{
*x = 1.9102*l - 1.1121*m + 0.2019*s;
*y = 0.3709*l + 0.6290*m + 0.0000*s;
*z = s;
}
void spectrum(double t1, double t2, int N, unsigned char* d)
{
int i,j,dj;
double X,Y,Z,R,G,B,L,M,S, Lw, Mw, Sw;
struct colourSystem *cs = &CIEsystem;
j = 0; dj = 1;
if (t1<t2) {
double t = t1;
t1 = t2;
t2 = t;
j = N-1; dj=-1;
}
for (i=0; i<N; i++) {
bbTemp = t1 + (t2-t1)/N*i;
// integrate blackbody radiation spectrum to XYZ
spectrum_to_xyz(bb_spectrum, &X, &Y, &Z);
// normalize highest temperature to white (in LMS system)
xyz_to_lms(X,Y,Z,&L,&M,&S);
if (i==0) {
Lw=1/L; Mw=1/M; Sw=1/S;
}
L *= Lw; M *= Mw; S *= Sw;
lms_to_xyz(L,M,S,&X,&Y,&Z);
// convert to RGB
xyz_to_rgb(cs, X, Y, Z, &R, &G, &B);
constrain_rgb(&R, &G, &B);
norm_rgb(&R, &G, &B);
d[(j<<2)] = (unsigned char) ((double)R*255);
d[(j<<2)+1] = (unsigned char) ((double)G*255);
d[(j<<2)+2] = (unsigned char) ((double)B*255);
d[(j<<2)+3] = (B>0.1)? B*255 : 0;
j += dj;
}
}

View File

@@ -0,0 +1,6 @@
#ifndef __SPECTRUM_H
#define __SPECTRUM_H
void spectrum(double t1, double t2, int n, unsigned char* d);
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

View File

@@ -298,7 +298,7 @@ def dump_messages_pytext(messages, check_ctxt):
# check it has a 'text' argument
for (arg_pos, (arg_kw, arg)) in enumerate(func.parameters.items()):
if ((arg_kw in translate_kw) and
(arg.is_output == False) and
(arg.is_output is False) and
(arg.type == 'STRING')):
func_translate_args.setdefault(func_id, []).append((arg_kw,

View File

@@ -264,8 +264,8 @@ def module_names(path, recursive=False):
if recursive:
for mod_name, mod_path in module_names(directory, True):
modules.append(("%s.%s" % (filename, mod_name),
mod_path,
))
mod_path,
))
return modules

View File

@@ -232,7 +232,7 @@ def edge_loops_from_tessfaces(mesh, tessfaces=None, seams=()):
ed_adj = edges[context_loop[-1]]
if len(ed_adj) != 2:
# the original edge had 2 other edges
if other_dir and flipped == False:
if other_dir and flipped is False:
flipped = True # only flip the list once
context_loop.reverse()
ed_adj[:] = []

View File

@@ -689,10 +689,10 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
files = []
for directory in searchpaths:
files.extend([(f, os.path.join(directory, f))
for f in os.listdir(directory)
if (not f.startswith("."))
if ((filter_ext is None) or
(filter_ext(os.path.splitext(f)[1])))
for f in os.listdir(directory)
if (not f.startswith("."))
if ((filter_ext is None) or
(filter_ext(os.path.splitext(f)[1])))
])
files.sort()

View File

@@ -160,7 +160,7 @@ if __name__ == "__main__":
from bpyml_test import *
draw = [
ui()[
ui()[
split()[
column()[
prop(data='context.scene.render', property='use_stamp_time', text='Time'),

View File

@@ -30,7 +30,7 @@ _BPY_MAIN_OWN = True
def add_scrollback(text, text_type):
for l in text.split("\n"):
bpy.ops.console.scrollback_append(text=l.replace("\t", " "),
type=text_type)
type=text_type)
def replace_help(namespace):
@@ -195,7 +195,7 @@ def execute(context):
# insert a new blank line
bpy.ops.console.history_append(text="", current_character=0,
remove_duplicates=True)
remove_duplicates=True)
# Insert the output into the editor
# not quite correct because the order might have changed,

View File

@@ -26,7 +26,7 @@ language_id = "shell"
def add_scrollback(text, text_type):
for l in text.split("\n"):
bpy.ops.console.scrollback_append(text=l.replace("\t", " "),
type=text_type)
type=text_type)
def shell_run(text):
@@ -57,7 +57,7 @@ def execute(context):
# insert a new blank line
bpy.ops.console.history_append(text="", current_character=0,
remove_duplicates=True)
remove_duplicates=True)
sc.prompt = os.getcwd() + PROMPT
return {'FINISHED'}

View File

@@ -249,7 +249,7 @@ class InfoPropertyRNA:
def get_arg_default(self, force=True):
default = self.default_str
if default and (force or self.is_required == False):
if default and (force or self.is_required is False):
return "%s=%s" % (self.identifier, default)
return self.identifier
@@ -493,7 +493,7 @@ def BuildRNAInfo():
# Arrange so classes are always defined in the correct order
deps_ok = False
while deps_ok == False:
while deps_ok is False:
deps_ok = True
rna_done = set()

View File

@@ -250,7 +250,7 @@ def xml2rna(root_xml,
if value_xml.startswith("#"):
# read hexidecimal value as float array
value_xml_split = value_xml[1:]
value_xml_coerce = [int(value_xml_split[i:i + 2], 16) / 255 for i in range(0, len(value_xml_split), 2)]
value_xml_coerce = [int(value_xml_split[i:i + 2], 16) / 255 for i in range(0, len(value_xml_split), 2)]
del value_xml_split
else:
value_xml_split = value_xml.split()

View File

@@ -1,69 +1,69 @@
<bpy>
<Theme>
<view_3d>
<ThemeView3D object_active="#f58032"
<ThemeView3D object_active="#f47421"
editmesh_active="#ffffff80"
act_spline="#ee4000"
handle_align="#862074"
handle_sel_align="#f090a0"
handle_auto="#909000"
handle_sel_auto="#f0ff40"
handle_align="#93237f"
handle_sel_align="#f47421"
handle_auto="#00c59a"
handle_sel_auto="#f47421"
bone_pose="#50c8ff"
bone_pose_active="#8cffff"
bone_solid="#c8c8c8"
bundle_solid="#c8c8c8"
camera="#000000"
camera_path="#000000"
camera="#159dce"
camera_path="#7dbd00"
frame_current="#60c040"
edge_crease="#ce33b8"
extra_edge_len="#200000"
edge_seam="#db4100"
edge_select="#f68d46"
edge_select="#f47421"
edge_sharp="#ff4c00"
edge_facesel="#4b4b4b"
empty="#000000"
empty="#93237f"
face="#75757512"
extra_face_angle="#002000"
extra_face_area="#0059ee"
face_dot="#ff8500"
face_dot="#f47421"
facedot_size="3"
normal="#19b6ee"
face_select="#ff85003c"
handle_free="#000000"
handle_sel_free="#000000"
face_select="#f474213c"
handle_free="#a5ca00"
handle_sel_free="#f47421"
grid="#3c3b37"
lamp="#00000028"
lamp="#ffffff34"
lastsel_point="#ffffff"
nurb_uline="#909000"
nurb_vline="#862074"
nurb_sel_uline="#f0ff40"
nurb_sel_vline="#d15d85"
object_grouped="#083008"
object_grouped_active="#55bb55"
object_grouped="#117211"
object_grouped_active="#65d665"
object_selected="#f15800"
outline_width="1"
outline_width="2"
panel="#a5a5a57f"
skin_root="#000000"
speaker="#000000"
speaker="#93237f"
transform="#ffffff"
handle_vect="#409030"
handle_sel_vect="#82c036"
vertex="#c96cb8"
vertex_normal="#19b6ee"
vertex_select="#f15800"
vertex_select="#f47421"
vertex_size="2"
wire="#862074">
wire="#93237f">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#9c9c9c"
button_text_hi="#ffffff"
button_title="#9c9c9c"
text="#000000"
text="#9c9c9c"
text_hi="#ffffff"
title="#000000"
title="#9c9c9c"
back="#131311">
</ThemeSpaceGeneric>
</space>
@@ -71,7 +71,7 @@
</view_3d>
<clip_editor>
<ThemeClipEditor active_marker="#ffffff"
frame_current="#c07100"
frame_current="#f47421"
disabled_marker="#7f0000"
grid="#302e2c"
handle_vertex="#000000"
@@ -86,16 +86,16 @@
strips="#0c0a0a"
strips_selected="#ff8c00">
<space>
<ThemeSpaceGeneric header="#3c3b37"
header_text="#000000"
<ThemeSpaceGeneric header="#464541"
header_text="#9c9c9c"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#000000"
button_text="#ffffff"
button_text_hi="#ffffff"
button_title="#000000"
text="#000000"
button_title="#9c9c9c"
text="#9c9c9c"
text_hi="#ffffff"
title="#000000"
title="#9c9c9c"
back="#131311">
</ThemeSpaceGeneric>
</space>
@@ -109,14 +109,14 @@
</ThemeClipEditor>
</clip_editor>
<console>
<ThemeConsole cursor="#dc5a00"
line_error="#dc0000"
line_info="#85aa00"
line_input="#828282"
line_output="#f58032">
<ThemeConsole cursor="#f47421"
line_error="#ff0000"
line_info="#f47421"
line_input="#19b6ee"
line_output="#97f500">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#000000"
@@ -133,7 +133,7 @@
<dopesheet_editor>
<ThemeDopeSheet active_channels_group="#a2b15c"
channel_group="#4f6549"
channels="#74736e"
channels="#9c9c9c"
channels_selected="#6592f5"
frame_current="#f58032"
dopesheet_channel="#64486e"
@@ -143,26 +143,26 @@
long_key_selected="#f47421"
summary="#00000000"
value_sliders="#000000"
view_sliders="#969696">
view_sliders="#9c9c9c">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#cacaca"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#000000"
button_text="#9c9c9c"
button_text_hi="#ffffff"
button_title="#000000"
text="#000000"
button_title="#9c9c9c"
text="#e7e7e7"
text_hi="#ffffff"
title="#000000"
title="#9c9c9c"
back="#131311">
</ThemeSpaceGeneric>
</space>
<space_list>
<ThemeSpaceListGeneric list="#3c3b37"
list_text="#000000"
list_text_hi="#ffffff"
list_title="#dddddd">
list_text="#e2e2e2"
list_text_hi="#f47421"
list_title="#ffffff">
</ThemeSpaceListGeneric>
</space_list>
</ThemeDopeSheet>
@@ -175,8 +175,8 @@
selected_file="#6b395a"
tiles="#3c3b37">
<space>
<ThemeSpaceGeneric header="#3c3b37"
header_text="#000000"
<ThemeSpaceGeneric header="#464541"
header_text="#acacac"
header_text_hi="#ffffff"
button="#727272"
button_text="#000000"
@@ -199,50 +199,50 @@
</file_browser>
<graph_editor>
<ThemeGraphEditor active_channels_group="#87b17d"
handle_align="#803060"
handle_sel_align="#f090a0"
handle_auto="#909000"
handle_sel_auto="#f0ff40"
handle_auto_clamped="#994030"
handle_sel_auto_clamped="#f0af90"
handle_align="#93237f"
handle_sel_align="#f49600"
handle_auto="#00c59a"
handle_sel_auto="#f49600"
handle_auto_clamped="#03aa60"
handle_sel_auto_clamped="#f49600"
channel_group="#4f6549"
channels_region="#707070"
frame_current="#f58032"
dopesheet_channel="#695c6e"
dopesheet_subchannel="#7c8996"
handle_free="#000000"
handle_sel_free="#000000"
handle_free="#a5ca00"
handle_sel_free="#f49600"
grid="#3c3b37"
handle_vertex="#000000"
handle_vertex_select="#f47421"
handle_vertex_size="3"
lastsel_point="#000000"
handle_vertex="#bbbbbb"
handle_vertex_select="#f49600"
handle_vertex_size="4"
lastsel_point="#fafafa"
panel="#ffffff"
handle_vect="#409030"
handle_sel_vect="#40c030"
vertex="#000000"
vertex_select="#ff8500"
vertex_size="3"
vertex="#ffffff"
vertex_select="#f49600"
vertex_size="4"
window_sliders="#95948f">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#c3c2bc"
button_text="#9c9c9c"
button_text_hi="#ffffff"
button_title="#9e9d98"
text="#000000"
button_title="#9c9c9c"
text="#e9e9e9"
text_hi="#ffffff"
title="#000000"
title="#9c9c9c"
back="#131311">
</ThemeSpaceGeneric>
</space>
<space_list>
<ThemeSpaceListGeneric list="#3c3b37"
list_text="#000000"
list_text_hi="#ffffff"
list_title="#000000">
list_text="#e2e2e2"
list_text_hi="#f47421"
list_title="#ffffff">
</ThemeSpaceListGeneric>
</space_list>
</ThemeGraphEditor>
@@ -265,7 +265,7 @@
vertex_size="3">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#b9b9b9"
@@ -301,16 +301,16 @@
<ThemeLogicEditor panel="#acacac">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#131311"
button="#353430"
button_text="#acacac"
button_text_hi="#ffffff"
button_title="#7d7d7d"
text="#acacac"
text_hi="#ffffff"
title="#000000"
back="#131311">
back="#29001b">
</ThemeSpaceGeneric>
</space>
</ThemeLogicEditor>
@@ -333,7 +333,7 @@
view_sliders="#969696">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#000000"
@@ -369,7 +369,7 @@
wire="#f45b00">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#353430"
button_text="#acacac"
@@ -395,7 +395,7 @@
selected_highlight="#6a3859">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#000000"
@@ -413,7 +413,7 @@
<ThemeProperties panel="#3c3b37">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#000000"
@@ -444,32 +444,32 @@
window_sliders="#a0a0a0">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#000000"
button_text="#acacac"
button_text_hi="#ffffff"
button_title="#000000"
text="#000000"
button_title="#acacac"
text="#acacac"
text_hi="#ffffff"
title="#000000"
title="#acacac"
back="#191919">
</ThemeSpaceGeneric>
</space>
</ThemeSequenceEditor>
</sequence_editor>
<text_editor>
<ThemeTextEditor cursor="#df5106"
syntax_special="#8c8c28"
<ThemeTextEditor cursor="#f47421"
syntax_special="#33a500"
line_numbers_background="#3c3b37"
selected_text="#ffffff"
syntax_builtin="#df3ac2"
selected_text="#641f44"
syntax_builtin="#d6ff01"
syntax_comment="#249d60"
syntax_numbers="#3c68ff"
syntax_string="#aa2694">
syntax_numbers="#972144"
syntax_string="#6e00ff">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#191919"
button_text="#95948f"
@@ -488,13 +488,13 @@
grid="#272727">
<space>
<ThemeSpaceGeneric header="#464541"
header_text="#000000"
header_text="#acacac"
header_text_hi="#ffffff"
button="#3c3b37"
button_text="#000000"
button_text="#9c9c9c"
button_text_hi="#ffffff"
button_title="#000000"
text="#949494"
button_title="#9c9c9c"
text="#9c9c9c"
text_hi="#ffffff"
title="#000000"
back="#131311">
@@ -532,13 +532,13 @@
<wcol_menu_back>
<ThemeWidgetColors inner="#131312db"
inner_sel="#2d2d2de6"
item="#cbc3bbff"
item="#6a3859ff"
outline="#0d0d0d"
shadedown="-20"
shadetop="25"
show_shaded="FALSE"
text="#7a7a7a"
text_sel="#ffffff">
text="#dddddd"
text_sel="#dddddd">
</ThemeWidgetColors>
</wcol_menu_back>
<wcol_menu_item>
@@ -574,7 +574,7 @@
shadetop="20"
show_shaded="TRUE"
text="#dfdbcf"
text_sel="#fffbed">
text_sel="#f47421">
</ThemeWidgetColors>
</wcol_num>
<wcol_option>
@@ -615,7 +615,7 @@
shadetop="25"
show_shaded="FALSE"
text="#dddddd"
text_sel="#fff7fb">
text_sel="#ffffff">
</ThemeWidgetColors>
</wcol_pulldown>
<wcol_radio>
@@ -627,7 +627,7 @@
shadetop="5"
show_shaded="TRUE"
text="#dfdbcf"
text_sel="#ffffff">
text_sel="#dfdbcf">
</ThemeWidgetColors>
</wcol_radio>
<wcol_regular>
@@ -639,16 +639,16 @@
shadetop="21"
show_shaded="TRUE"
text="#dfdfdf"
text_sel="#ffffff">
text_sel="#dfdfdf">
</ThemeWidgetColors>
</wcol_regular>
<wcol_scroll>
<ThemeWidgetColors inner="#020202b4"
<ThemeWidgetColors inner="#000000b4"
inner_sel="#646464c6"
item="#2c2b28ff"
outline="#0d0d0d"
shadedown="-5"
shadetop="5"
item="#2e2d2aff"
outline="#000000"
shadedown="-10"
shadetop="10"
show_shaded="TRUE"
text="#cbc3bb"
text_sel="#ffffff">
@@ -685,7 +685,7 @@
shadetop="-10"
show_shaded="TRUE"
text="#dfdbcf"
text_sel="#fffaec">
text_sel="#ffffff">
</ThemeWidgetColors>
</wcol_text>
<wcol_toggle>
@@ -721,7 +721,7 @@
shadetop="25"
show_shaded="FALSE"
text="#ffffff"
text_sel="#ffffff">
text_sel="#ff5d0d">
</ThemeWidgetColors>
</wcol_tooltip>
</ThemeUserInterface>

View File

@@ -133,42 +133,42 @@ kmi = km.keymap_items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
kmi.properties.data_path = 'space_data.viewport_shade'
kmi.properties.value_1 = 'TEXTURED'
kmi.properties.value_2 = 'SOLID'
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS')
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE')
kmi.properties.extend = False
kmi.properties.center = False
kmi.properties.object = False
kmi.properties.enumerate = False
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True)
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True)
kmi.properties.extend = True
kmi.properties.center = False
kmi.properties.object = False
kmi.properties.enumerate = False
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', ctrl=True)
kmi.properties.extend = False
kmi.properties.center = True
kmi.properties.object = False
kmi.properties.enumerate = False
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', alt=True)
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', alt=True)
kmi.properties.extend = False
kmi.properties.center = False
kmi.properties.object = False
kmi.properties.enumerate = True
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True, ctrl=True)
kmi.properties.extend = True
kmi.properties.center = True
kmi.properties.object = False
kmi.properties.enumerate = False
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', ctrl=True, alt=True)
kmi.properties.extend = False
kmi.properties.center = True
kmi.properties.object = False
kmi.properties.enumerate = True
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True, alt=True)
kmi.properties.extend = True
kmi.properties.center = False
kmi.properties.object = False
kmi.properties.enumerate = True
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'RELEASE', shift=True, ctrl=True, alt=True)
kmi.properties.extend = True
kmi.properties.center = True
kmi.properties.object = False

View File

@@ -49,9 +49,9 @@ def add_torus(major_rad, minor_rad, major_seg, minor_seg):
angle = 2 * pi * minor_index / minor_seg
vec = quat * Vector((major_rad + (cos(angle) * minor_rad),
0.0,
(sin(angle) * minor_rad),
))
0.0,
(sin(angle) * minor_rad),
))
verts.extend(vec[:])
@@ -133,7 +133,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
)
def execute(self, context):
if self.use_abso == True:
if self.use_abso is True:
extra_helper = (self.abso_major_rad - self.abso_minor_rad) * 0.5
self.major_radius = self.abso_minor_rad + extra_helper
self.minor_radius = extra_helper

View File

@@ -214,7 +214,7 @@ class BakeAction(Operator):
'OBJECT' in self.bake_types,
self.clear_constraints,
True,
)
)
if action is None:
self.report({'INFO'}, "Nothing to bake")
@@ -252,8 +252,8 @@ class ClearUselessActions(Operator):
for action in bpy.data.actions:
# if only user is "fake" user...
if ((self.only_unused is False) or
(action.use_fake_user and action.users == 1)):
if ((self.only_unused is False) or
(action.use_fake_user and action.users == 1)):
# if it has F-Curves, then it's a "action library"
# (i.e. walk, wave, jump, etc.)

View File

@@ -57,7 +57,7 @@ def CLIP_set_viewport_background(context, all_screens, clip, clip_user):
space_v3d.show_background_images = True
CLIP_spaces_walk(context, all_screens, 'VIEW_3D', 'VIEW_3D',
set_background, clip, clip_user)
set_background, clip, clip_user)
def CLIP_camera_for_clip(context, clip):
@@ -329,7 +329,7 @@ object's movement caused by this constraint"""
if not con:
self.report({'ERROR'},
"Motion Tracking constraint to be converted not found")
"Motion Tracking constraint to be converted not found")
return {'CANCELLED'}
@@ -341,7 +341,7 @@ object's movement caused by this constraint"""
if not clip:
self.report({'ERROR'},
"Movie clip to use tracking data from isn't set")
"Movie clip to use tracking data from isn't set")
return {'CANCELLED'}
@@ -461,9 +461,9 @@ class CLIP_OT_setup_tracking_scene(Operator):
scene.camera = camob
camob.matrix_local = (Matrix.Translation((7.481, -6.508, 5.344)) *
Matrix.Rotation(0.815, 4, 'Z') *
Matrix.Rotation(0.011, 4, 'Y') *
Matrix.Rotation(1.109, 4, 'X'))
Matrix.Rotation(0.815, 4, 'Z') *
Matrix.Rotation(0.011, 4, 'Y') *
Matrix.Rotation(1.109, 4, 'X'))
return camob
@@ -629,7 +629,7 @@ class CLIP_OT_setup_tracking_scene(Operator):
if need_stabilization:
tree.links.new(distortion.outputs["Image"],
stabilize.inputs["Image"])
stabilize.inputs["Image"])
tree.links.new(stabilize.outputs["Image"], scale.inputs["Image"])
else:
tree.links.new(distortion.outputs["Image"], scale.inputs["Image"])

View File

@@ -129,6 +129,6 @@ class ConsoleLanguage(Operator):
# insert a new blank line
bpy.ops.console.history_append(text="", current_character=0,
remove_duplicates=True)
remove_duplicates=True)
return {'FINISHED'}

View File

@@ -92,7 +92,7 @@ class MeshMirrorUV(Operator):
puvs[i] = tuple(uv.uv for uv in uv_loops[lstart:lend])
puvs_cpy[i] = tuple(uv.copy() for uv in puvs[i])
puvsel[i] = (False not in
(uv.select for uv in uv_loops[lstart:lend]))
(uv.select for uv in uv_loops[lstart:lend]))
# Vert idx of the poly.
vidxs[i] = tuple(l.vertex_index for l in loops[lstart:lend])
# As we have no poly.center yet...

View File

@@ -408,13 +408,13 @@ class ShapeTransfer(Operator):
n2loc_to = v2_to + target_normals[i2] * edlen_to
pt = barycentric_transform(orig_shape_coords[i1],
v2, v1, n1loc,
v2_to, v1_to, n1loc_to)
v2, v1, n1loc,
v2_to, v1_to, n1loc_to)
median_coords[i1].append(pt)
pt = barycentric_transform(orig_shape_coords[i2],
v1, v2, n2loc,
v1_to, v2_to, n2loc_to)
v1, v2, n2loc,
v1_to, v2_to, n2loc_to)
median_coords[i2].append(pt)
# apply the offsets to the new shape
@@ -507,7 +507,7 @@ class JoinUVs(Operator):
if obj_other != obj and obj_other.type == 'MESH':
mesh_other = obj_other.data
if mesh_other != mesh:
if mesh_other.tag == False:
if mesh_other.tag is False:
mesh_other.tag = True
if len(mesh_other.loops) != nbr_loops:
@@ -520,7 +520,7 @@ class JoinUVs(Operator):
len(mesh_other.polygons),
nbr_loops,
),
)
)
else:
uv_other = mesh_other.uv_layers.active
if not uv_other:

View File

@@ -299,7 +299,6 @@ class QuickSmoke(Operator):
style = EnumProperty(
name="Smoke Style",
items=(('STREAM', "Stream", ""),
('PUFF', "Puff", ""),
('FIRE', "Fire", ""),
),
default='STREAM',
@@ -328,20 +327,9 @@ class QuickSmoke(Operator):
bpy.ops.object.modifier_add(fake_context, type='SMOKE')
obj.modifiers[-1].smoke_type = 'FLOW'
psys = obj.particle_systems[-1]
if self.style == 'PUFF':
psys.settings.frame_end = psys.settings.frame_start
psys.settings.emit_from = 'VOLUME'
psys.settings.distribution = 'RAND'
elif self.style == 'FIRE':
psys.settings.effector_weights.gravity = -1
psys.settings.lifetime = 5
psys.settings.count = 100000
if self.style == 'FIRE':
obj.modifiers[-1].flow_settings.smoke_flow_type = 'FIRE'
obj.modifiers[-2].flow_settings.initial_velocity = True
obj.modifiers[-2].flow_settings.temperature = 2
psys.settings.use_render_emitter = self.show_flows
if not self.show_flows:
obj.draw_type = 'WIRE'
@@ -361,8 +349,6 @@ class QuickSmoke(Operator):
bpy.ops.object.modifier_add(type='SMOKE')
obj.modifiers[-1].smoke_type = 'DOMAIN'
if self.style == 'FIRE':
obj.modifiers[-1].domain_settings.use_dissolve_smoke = True
obj.modifiers[-1].domain_settings.dissolve_speed = 20
obj.modifiers[-1].domain_settings.use_high_resolution = True
# create a volume material with a voxel data texture for the domain
@@ -373,6 +359,7 @@ class QuickSmoke(Operator):
mat.type = 'VOLUME'
mat.volume.density = 0
mat.volume.density_scale = 5
mat.volume.step_size = 0.1
tex = bpy.data.textures.new("Smoke Density", 'VOXEL_DATA')
tex.voxel_data.domain_object = obj
@@ -381,29 +368,35 @@ class QuickSmoke(Operator):
tex_slot.texture = tex
tex_slot.use_map_color_emission = False
tex_slot.use_map_density = True
tex_slot.use_map_color_reflection = True
# for fire add a second texture for emission and emission color
if self.style == 'FIRE':
mat.volume.emission = 5
tex = bpy.data.textures.new("Smoke Heat", 'VOXEL_DATA')
tex.voxel_data.domain_object = obj
tex.use_color_ramp = True
# for fire add a second texture for flame emission
mat.volume.emission_color = Vector((0.0, 0.0, 0.0))
tex = bpy.data.textures.new("Flame", 'VOXEL_DATA')
tex.voxel_data.domain_object = obj
tex.voxel_data.smoke_data_type = 'SMOKEFLAME'
tex.use_color_ramp = True
tex_slot = mat.texture_slots.add()
tex_slot.texture = tex
tex_slot = mat.texture_slots.add()
tex_slot.texture = tex
ramp = tex.color_ramp
# add color ramp for flame color
ramp = tex.color_ramp
# dark orange
elem = ramp.elements.new(0.333)
elem.color[0] = 0.2
elem.color[1] = 0.03
elem.color[2] = 0
elem.color[3] = 1
# yellow glow
elem = ramp.elements.new(0.666)
elem.color[0] = elem.color[3] = 1
elem.color[1] = 0.65
elem.color[2] = 0.25
elem = ramp.elements.new(0.333)
elem.color[0] = elem.color[3] = 1
elem.color[1] = elem.color[2] = 0
elem = ramp.elements.new(0.666)
elem.color[0] = elem.color[1] = elem.color[3] = 1
elem.color[2] = 0
mat.texture_slots[1].use_map_emission = True
mat.texture_slots[1].blend_type = 'MULTIPLY'
mat.texture_slots[1].use_map_density = True
mat.texture_slots[1].use_map_emission = True
mat.texture_slots[1].emission_factor = 5
return {'FINISHED'}

View File

@@ -436,19 +436,19 @@ class AddPresetTrackingSettings(AddPresetBase, Operator):
]
preset_values = [
"default_correlation_min",
"default_pattern_size",
"default_search_size",
"default_frames_limit",
"default_pattern_match",
"default_margin",
"default_motion_model",
"use_default_brute",
"use_default_normalization",
"use_default_mask",
"use_default_red_channel",
"use_default_green_channel",
"use_default_blue_channel"
"settings.default_correlation_min",
"settings.default_pattern_size",
"settings.default_search_size",
"settings.default_frames_limit",
"settings.default_pattern_match",
"settings.default_margin",
"settings.default_motion_model",
"settings.use_default_brute",
"settings.use_default_normalization",
"settings.use_default_mask",
"settings.use_default_red_channel",
"settings.use_default_green_channel",
"settings.use_default_blue_channel"
]
preset_subdir = "tracking_settings"

View File

@@ -89,7 +89,7 @@ class PlayRenderedAnim(Operator):
if player_path == "":
player_path = guess_player_path(preset)
if is_movie == False and preset in {'FRAMECYCLER', 'RV', 'MPLAYER'}:
if is_movie is False and preset in {'FRAMECYCLER', 'RV', 'MPLAYER'}:
# replace the number with '#'
file_a = rd.frame_path(frame=0)

View File

@@ -608,9 +608,9 @@ class WM_OT_context_collection_boolean_set(Operator):
except:
continue
if value_orig == True:
if value_orig is True:
is_set = True
elif value_orig == False:
elif value_orig is False:
pass
else:
self.report({'WARNING'}, "Non boolean value found: %s[ ].%s" %
@@ -1583,7 +1583,7 @@ class WM_OT_addon_enable(Operator):
"version %d.%d.%d and might not "
"function (correctly), "
"though it is enabled") %
info_ver)
info_ver)
return {'FINISHED'}
else:
return {'CANCELLED'}
@@ -1668,7 +1668,7 @@ class WM_OT_theme_install(Operator):
class WM_OT_addon_install(Operator):
"Install an addon"
bl_idname = "wm.addon_install"
bl_label = "Install Addon..."
bl_label = "Install from File..."
overwrite = BoolProperty(
name="Overwrite",

View File

@@ -95,7 +95,7 @@ def register():
items = [('All', "All", ""),
('Enabled', "Enabled", ""),
('Disabled', "Disabled", ""),
]
]
items_unique = set()
@@ -120,7 +120,7 @@ def register():
items=[('OFFICIAL', "Official", "Officially supported"),
('COMMUNITY', "Community", "Maintained by community developers"),
('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)"),
],
],
name="Support",
description="Display support level",
default={'OFFICIAL', 'COMMUNITY'},

View File

@@ -285,10 +285,9 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
row.prop(itasc, "damping_max", text="Damp", slider=True)
row.prop(itasc, "damping_epsilon", text="Eps", slider=True)
from bl_ui.properties_animviz import (
MotionPathButtonsPanel,
OnionSkinButtonsPanel,
)
from bl_ui.properties_animviz import (MotionPathButtonsPanel,
OnionSkinButtonsPanel,
)
class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):

View File

@@ -251,52 +251,52 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel):
split.active = pchan.is_in_ik_chain
row = split.row()
row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
row.active = pchan.lock_ik_x == False and pchan.is_in_ik_chain
row.active = pchan.lock_ik_x is False and pchan.is_in_ik_chain
split = layout.split(percentage=0.25)
sub = split.row()
sub.prop(pchan, "use_ik_limit_x", text="Limit")
sub.active = pchan.lock_ik_x == False and pchan.is_in_ik_chain
sub.active = pchan.lock_ik_x is False and pchan.is_in_ik_chain
sub = split.row(align=True)
sub.prop(pchan, "ik_min_x", text="")
sub.prop(pchan, "ik_max_x", text="")
sub.active = pchan.lock_ik_x == False and pchan.use_ik_limit_x and pchan.is_in_ik_chain
sub.active = pchan.lock_ik_x is False and pchan.use_ik_limit_x and pchan.is_in_ik_chain
split = layout.split(percentage=0.25)
split.prop(pchan, "lock_ik_y", icon='LOCKED' if pchan.lock_ik_y else 'UNLOCKED', text="Y")
split.active = pchan.is_in_ik_chain
row = split.row()
row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
row.active = pchan.lock_ik_y == False and pchan.is_in_ik_chain
row.active = pchan.lock_ik_y is False and pchan.is_in_ik_chain
split = layout.split(percentage=0.25)
sub = split.row()
sub.prop(pchan, "use_ik_limit_y", text="Limit")
sub.active = pchan.lock_ik_y == False and pchan.is_in_ik_chain
sub.active = pchan.lock_ik_y is False and pchan.is_in_ik_chain
sub = split.row(align=True)
sub.prop(pchan, "ik_min_y", text="")
sub.prop(pchan, "ik_max_y", text="")
sub.active = pchan.lock_ik_y == False and pchan.use_ik_limit_y and pchan.is_in_ik_chain
sub.active = pchan.lock_ik_y is False and pchan.use_ik_limit_y and pchan.is_in_ik_chain
split = layout.split(percentage=0.25)
split.prop(pchan, "lock_ik_z", icon='LOCKED' if pchan.lock_ik_z else 'UNLOCKED', text="Z")
split.active = pchan.is_in_ik_chain
sub = split.row()
sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
sub.active = pchan.lock_ik_z == False and pchan.is_in_ik_chain
sub.active = pchan.lock_ik_z is False and pchan.is_in_ik_chain
split = layout.split(percentage=0.25)
sub = split.row()
sub.prop(pchan, "use_ik_limit_z", text="Limit")
sub.active = pchan.lock_ik_z == False and pchan.is_in_ik_chain
sub.active = pchan.lock_ik_z is False and pchan.is_in_ik_chain
sub = split.row(align=True)
sub.prop(pchan, "ik_min_z", text="")
sub.prop(pchan, "ik_max_z", text="")
sub.active = pchan.lock_ik_z == False and pchan.use_ik_limit_z and pchan.is_in_ik_chain
sub.active = pchan.lock_ik_z is False and pchan.use_ik_limit_z and pchan.is_in_ik_chain
split = layout.split(percentage=0.25)
split.label(text="Stretch:")

View File

@@ -397,7 +397,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col = layout.column()
if md.use_mirror_merge == True:
if md.use_mirror_merge is True:
col.prop(md, "merge_threshold")
col.label(text="Mirror Object:")
col.prop(md, "mirror_object", text="")
@@ -559,7 +559,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col = split.column()
row = col.row()
row.active = (md.object is None or md.use_object_screw_offset == False)
row.active = (md.object is None or md.use_object_screw_offset is False)
row.prop(md, "screw_offset")
row = col.row()
row.active = (md.object is not None)

View File

@@ -290,10 +290,8 @@ class OBJECT_PT_relations_extras(ObjectButtonsPanel, Panel):
row.prop(ob, "slow_parent_offset", text="Offset")
from bl_ui.properties_animviz import (
MotionPathButtonsPanel,
OnionSkinButtonsPanel,
)
from bl_ui.properties_animviz import (MotionPathButtonsPanel,
OnionSkinButtonsPanel)
class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):

View File

@@ -212,6 +212,7 @@ class ConstraintButtonsPanel():
def FOLLOW_PATH(self, context, layout, con):
self.target_template(layout, con)
layout.operator("constraint.followpath_path_animate", text="Animate Path", icon='ANIM_DATA')
split = layout.split()

View File

@@ -21,12 +21,11 @@ import bpy
from bpy.types import Panel
from rna_prop_ui import PropertyPanel
from bl_ui.properties_physics_common import (
point_cache_ui,
effector_weights_ui,
basic_force_field_settings_ui,
basic_force_field_falloff_ui,
)
from bl_ui.properties_physics_common import (point_cache_ui,
effector_weights_ui,
basic_force_field_settings_ui,
basic_force_field_falloff_ui,
)
def particle_panel_enabled(context, psys):
@@ -52,7 +51,7 @@ def particle_panel_poll(cls, context):
if not settings:
return False
return settings.is_fluid == False and (engine in cls.COMPAT_ENGINES)
return settings.is_fluid is False and (engine in cls.COMPAT_ENGINES)
def particle_get_settings(context):
@@ -133,13 +132,13 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
split = layout.split(percentage=0.32)
col = split.column()
col.label(text="Name:")
if part.is_fluid == False:
if part.is_fluid is False:
col.label(text="Settings:")
col.label(text="Type:")
col = split.column()
col.prop(psys, "name", text="")
if part.is_fluid == False:
if part.is_fluid is False:
row = col.row()
row.enabled = particle_panel_enabled(context, psys)
row.template_ID(psys, "settings", new="particle.new")
@@ -279,7 +278,7 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
cloth = psys.cloth.settings
layout.enabled = psys.use_hair_dynamics and psys.point_cache.is_baked == False
layout.enabled = psys.use_hair_dynamics and psys.point_cache.is_baked is False
split = layout.split()
@@ -813,7 +812,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
sub.active = (part.use_strand_primitive is False)
sub.prop(part, "use_render_adaptive")
sub = col.column()
sub.active = part.use_render_adaptive or part.use_strand_primitive == True
sub.active = part.use_render_adaptive or part.use_strand_primitive is True
sub.prop(part, "adaptive_angle")
sub = col.column()
sub.active = (part.use_render_adaptive is True and part.use_strand_primitive is False)
@@ -831,9 +830,9 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
row = layout.row()
col = row.column()
if part.type == 'HAIR' and part.use_strand_primitive == True and part.child_type == 'INTERPOLATED':
if part.type == 'HAIR' and part.use_strand_primitive is True and part.child_type == 'INTERPOLATED':
layout.prop(part, "use_simplify")
if part.use_simplify == True:
if part.use_simplify is True:
row = layout.row()
row.prop(part, "simplify_refsize")
row.prop(part, "simplify_rate")
@@ -841,7 +840,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
row = layout.row()
row.prop(part, "use_simplify_viewport")
sub = row.row()
sub.active = part.use_simplify_viewport == True
sub.active = part.use_simplify_viewport is True
sub.prop(part, "simplify_viewport")
elif part.render_type == 'OBJECT':
@@ -988,11 +987,11 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, Panel):
if part.draw_percentage != 100 and psys is not None:
if part.type == 'HAIR':
if psys.use_hair_dynamics and psys.point_cache.is_baked == False:
if psys.use_hair_dynamics and psys.point_cache.is_baked is False:
layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
else:
phystype = part.physics_type
if phystype != 'NO' and phystype != 'KEYED' and psys.point_cache.is_baked == False:
if phystype != 'NO' and phystype != 'KEYED' and psys.point_cache.is_baked is False:
layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
row = layout.row()
@@ -1125,7 +1124,7 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, Panel):
def draw(self, context):
part = particle_get_settings(context)
effector_weights_ui(self, context, part.effector_weights)
effector_weights_ui(self, context, part.effector_weights, 'PSYS')
if part.type == 'HAIR':
row = self.layout.row()

Some files were not shown because too many files have changed in this diff Show More