1
1

Compare commits

...

2048 Commits

Author SHA1 Message Date
e96e4526dd Gooseberry: Fixes for buildbot ported from master
Cherry-picking the changes because at this point it becomes quite
tricky to merge master into gooseberry and it's maybe not something
we really want to keep this branch being able to fully re-render the
movie.
2015-07-27 14:41:46 +02:00
27f988167f Gooseberry: Correction for previous OpenVDB fix
Flag was set back to front.
2015-07-27 12:20:18 +02:00
5604d98852 Gooseberry: Disable OpenVDB for windows cmake
We don't have precompiled libraries for openvdb on windows so compilation
on buildbots was completely failing.
2015-07-27 10:47:31 +02:00
6444ed4493 Gooseberry: Fix for crash when object is used on multiple render layers
Not really ideal solution, but this system needs revisit anyway and will be
done a bit differnetly in the master branch. So no worries for now.
2015-07-24 17:00:43 +02:00
4b73139d27 Gooseberry: Disable CUDA kernels from buildbot compilation
OpenVDB kernel caused increase stress on the registers, which is now causing
compiler to crash for quite some time now.

Don't have time to look into details now and would prefer if the branch devs
will look into this.

Disabling CUDA for now, building without it is better than bot building at
all anyway.
2015-07-18 16:35:38 +02:00
bbed9b227c Gooseberry: Hopefully fix compilation of BGE stubs 2015-07-07 08:57:04 +02:00
31555c4cdb Gooseberry: Fix someone's bad merge conflict resolve in BGE stubs 2015-07-07 08:55:00 +02:00
5709b9951e Merge branch 'master' into gooseberry 2015-07-02 19:30:50 +02:00
1d930382e6 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/makesdna/DNA_object_types.h
2015-07-02 16:50:28 +02:00
67403e32af One more compile fix 2015-07-02 16:46:05 +02:00
c6e7e328c7 Fix compilation errors 2015-07-02 16:40:01 +02:00
bffcad6a81 Merge branch 'master' into gooseberry 2015-07-01 16:25:49 +02:00
ba1e23bf84 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenlib/intern/BLI_filelist.c
	source/blender/editors/transform/transform.h
	source/blender/editors/transform/transform_snap.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
2015-07-01 15:43:56 +02:00
6fb00f4667 Another fix for particle instance modifier.
Was using inconsistent particle indices, leading to invalid array
offsets.
2015-06-26 12:54:21 +02:00
1e73c400a7 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/cdderivedmesh.c
	source/blender/makesrna/intern/rna_nodetree.c
2015-06-25 20:23:16 +02:00
7f8df735ae Disable OpenVDB by default. 2015-06-25 18:27:12 +02:00
72d7709ae6 Fix for broken particle stuff when using particle instance modifier with
children.
2015-06-25 12:03:37 +02:00
32aa290824 Cycles: Respect duplicator's object motion blur settings
The idea is to make it possible to control linked duplicated objects motion
blur from the scene file without need to do overrides on the linked object
settings. Currently only supported for dupligroup duplication and all now
if duplicator object has motion blur disabled then it'll be inherited into
all the duplicated objects.

There should be no regressions/changes in look of existing files because
objects do have motion blur enabled by default.
2015-06-22 13:58:50 +02:00
b5edbec410 Gooseberry: Fix compilation error with Alembic disabled 2015-06-19 19:49:36 +02:00
6beab4951f Fix for shifted samples when slicing a cache archive at a later start
frame.

Sample 0 always has to be defined, or the later samples will become
shifted toward the beginning.
2015-06-18 15:25:33 +02:00
ae08f71386 Use '-' instead of '..' as a range separator for the cache slice
operator.
2015-06-18 14:47:58 +02:00
a2c99a495d Fix for invalid sample indices. 2015-06-18 14:47:31 +02:00
9a87051725 Extended frame selection for the cache slice operator to support
multiple frame ranges.

Caches can generally be constructed using an arbitrary subset of samples
from the original file. It's mostly a matter of operator UI how this
can be defined by users.
2015-06-18 14:19:31 +02:00
b9bccd5788 Merge branch 'master' into gooseberry 2015-06-17 17:05:27 +02:00
955d64cd2b Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/cdderivedmesh.c
	source/blender/gpu/GPU_buffers.h
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-06-17 13:59:04 +02:00
4925b5c9a9 Merge branch 'master' into gooseberry 2015-06-15 21:24:01 +02:00
a3b429083b Don't use number of frames for image collapse for now 2015-06-15 19:09:14 +02:00
5dcbc09df9 Strictly collapse images 2015-06-15 16:37:00 +02:00
013d65d38c Fix opengl matrix underflow with overdrop 2015-06-15 12:50:26 +02:00
f4a70e1ffd Gooseberry: Add missing include paths to GLEW 2015-06-14 17:53:32 +02:00
8083ca2b5c Gooseberry: Attempt to fix compilation with MSVS
M_PI macro requires BLI_math.h to be included.
2015-06-14 16:50:54 +02:00
53c33cb7cb Gooseberry: Attempt to fix compilation error on OSX
There's in fact a conflict bewteeb math.h's isfinite and STL's one
which wasn't an issue previously because stl was not really included
into kernel for until openvdb work.

This commit only works issue around, proper solution is still needed.

P.S. It's still a good idea to not include headers which are unused
by current configuration anyway.
2015-06-14 16:47:25 +02:00
302d8572ac Gooseberry: Fix compilation with OpenVDB disabled
It was giving an issues when building with SCons and disabled OpenVDB.

Likely need to be backported to openvdb branch.
2015-06-14 14:55:27 +02:00
fab834d351 Merge branch 'master' into gooseberry 2015-06-13 16:30:34 +02:00
7b7503a6ab Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_clip/clip_draw.c
	source/blender/imbuf/intern/anim_movie.c
	source/blender/windowmanager/intern/wm_playanim.c
2015-06-12 15:30:36 +02:00
e42b3a4abd Merge branch 'openvdb' into gooseberry 2015-06-12 12:05:25 +02:00
600a7cd2bf Fix for own commit: cycles volume slots are not the same as the index
in the openvdb grids array.
2015-06-12 12:04:19 +02:00
67a6d8a26f Merge branch 'openvdb' into gooseberry 2015-06-12 11:30:20 +02:00
a9158140f7 Fix for undefined density slot when using OpenVDB nodes without
connecting the density socket.

The density grid is used for the primary intersection tests, so it needs
to be identified among others. The slot index used before was not
initialized when the density node socket is not connected. Further and
invalid index (-1) is not recognized and leads to buffer underrun.
2015-06-12 11:27:05 +02:00
04f6f1d7f4 Merge branch 'master' into gooseberry 2015-06-12 11:20:54 +02:00
a9a42749d8 Merge branch 'openvdb' into gooseberry 2015-06-12 10:26:03 +02:00
aaa43e2b84 Fix for missing boost dependency when OpenVDB is disabled. 2015-06-12 10:25:32 +02:00
f3e2af333c Merge branch 'openvdb' into gooseberry 2015-06-11 17:52:04 +02:00
c5d0084606 Fix compilation error when WITH_OPENVDB is off (again). 2015-06-11 16:36:37 +02:00
c1ec3333f3 Merge branch 'openvdb' into gooseberry 2015-06-11 16:13:08 +02:00
1aeb676c2b OpenVDB has a dependency on boost-iostreams lib.
Blender needs to link this for static OpenVDB libraries.
2015-06-11 16:07:19 +02:00
72da543364 Merge branch 'openvdb' into gooseberry
Conflicts:
	source/blender/makesdna/DNA_smoke_types.h
2015-06-11 12:43:07 +02:00
24e3db2302 Fix for bad level function implementation.
Was declared in BKE, but implemented in editors, giving undefined
references in the player.
2015-06-11 12:40:40 +02:00
f743261bf2 Revert "Fix for undefined reference for a smoke function in the player."
This reverts commit 309f15b8f4.
2015-06-11 12:35:12 +02:00
309f15b8f4 Fix for undefined reference for a smoke function in the player. 2015-06-11 12:23:59 +02:00
e4126ec9c1 Gooseberry: Fix compilation error with OpenVDB disabled 2015-06-11 12:22:06 +02:00
5086decb80 Initial support for drawing the VDB tree in the viewport.
To make it possible an OpenVDBPrimitive onject is introduced which hides
a shared pointer to an openvdb::GridBase so it's a bit generic, but by
far not final.

The drawing code is a bit hackish on the side, but at least it works and
here's an example: http://www.pasteall.org/pic/show.php?id=89278

NOTE: This only works when the simulation is imported back in.
2015-06-11 12:19:19 +02:00
fbf4aebfda Move exported flag from SmokeDomainSettings to OpenVDBCache 2015-06-11 12:19:19 +02:00
f7ad058dc4 Gooseberry: Fix compilation error with OpenVDB disabled 2015-06-11 11:59:48 +02:00
f5767241c3 Disable OpenVDB on buildbots for OSX and Windows, until libraries for
these environments are available.
2015-06-11 11:14:13 +02:00
8731bf75bc Merge branch 'openvdb' into gooseberry
Conflicts:
	build_files/buildbot/config/user-config-player-glibc211-i686.py
	build_files/buildbot/config/user-config-player-glibc211-x86_64.py
	build_files/scons/tools/Blender.py
	intern/cycles/blender/blender_shader.cpp
	intern/cycles/kernel/svm/svm_types.h
	source/blender/blenkernel/BKE_node.h
	source/blender/blenkernel/intern/smoke.c
	source/blender/makesdna/DNA_smoke_types.h
	source/blender/makesrna/intern/rna_nodetree.c
	source/blender/makesrna/intern/rna_smoke.c
2015-06-11 11:11:27 +02:00
cdebd68ff9 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/idcode.c
	source/blender/editors/interface/interface_templates.c
2015-06-11 10:56:06 +02:00
6ecafc57f1 Merge branch 'master' into openvdb 2015-06-11 10:47:33 +02:00
9676642cc9 Super hacky hack (not for master for sure) to stop blender for crashing
with scene audio recursion in mattieu's gooseberry edit in sequencer.

Will probably cause something else to explode but let's just guard
against this in the audio lib for now.
2015-06-10 18:20:15 +02:00
a9e9e9cbc9 OpenVDB: Disable it for blenderplayer buildbot target 2015-06-10 16:55:03 +02:00
706a0e2139 OpenVDB: Tweaksfor scons and buildbot 2015-06-10 16:52:34 +02:00
09df0f0b77 Sequencer:
Add option to ommit strip name and info display.
2015-06-10 14:06:13 +02:00
d48e165edd Gooseberry: Use more proper flag for psys reconstruction after memory optimization 2015-06-09 19:04:53 +02:00
e73e5c9930 Gooseberry: Fix for flickering grass
The issue was caused by memory optimization marking particle system to recalc,
and because of the way how particle flags works it was possible that it'll
cause particle's re-distribution. Now this memory optimization will act the
same as loading the file.

Would need to review if this fix is to go to master/cycles_memory branches
but for now it'll be cool to figure out what to do with the farm.
2015-06-09 18:56:43 +02:00
313c958f43 More cosmetic stuff for the play button
Draw outer ring with quad strip instead of line
(line width would vary across the ring)
2015-06-09 18:15:32 +02:00
58f75e903a Small cheat for attract tool:
Draw overdrop on top of post-draw call back.
2015-06-09 16:38:48 +02:00
90dc21ce27 Fix typo in writefile.c resulting in undefined nodes. 2015-06-09 14:53:43 +02:00
23d0af5031 Particles: Avoid bad memory access when calculating child weight
Not sure it's totally correct solution, but it's better than giving
unpredictable results.
2015-06-09 14:50:28 +02:00
ab742d302e Center the play gisom triangle more correctly. 2015-06-09 14:37:50 +02:00
a7a87e4ade Reset frame when stopping playing. 2015-06-09 14:07:29 +02:00
010e2a2b36 Add play gismos to collapsed image sequences. When clicking repeatedly
on the sequence they are toggled between play-pause.
2015-06-09 13:51:54 +02:00
a4ee50f52e Disable file collapse when user cancels after an operator.
Now file open operator also sets a temporary flag for collapse. This
allows the user to configure the option to always collapse files and the
editor will remember the setting and not reset it back after finishing a
collapsed file open.
2015-06-09 12:29:16 +02:00
6ec3656e97 Generalized node function for mapping existing inputs/outputs on a
dynamically changing socket layout.

This is used for a couple of nodes which create a custom set of inputs
or outputs based on internal data (e.g. image or cache files with
arbitrary data layers). The task is to take existing connections to the
node and relink them to the new socket layout, usually based on socket
names. This keeps node trees working as much as possible even when the
user changes the node.

Multilayer image nodes were already doing this, now OpenVDB shader nodes
can share the same function. If it can be represented in the RNA, the
OSL script node might use the same method (currently not feasible due
to callbacks).
2015-06-09 12:03:52 +02:00
77246e2b93 More flexible feedback function for reading header and metadata from
OpenVDB files.

Instead of fixed-size arrays (risking overrun) the function now uses a
callback, which allows callers to store the info in their own data
structures as needed. Nodes use this to create a list of grid info
structs and adding node sockets accordingly.
2015-06-09 12:03:51 +02:00
99f79338d8 Handle grid name lookups from cycles nodes as weak references and
prevent exceptions.

The shader output names are not guaranteed to match the VDB grid names.
The grid info in nodes can get outdated, files can be manipulated
externally etc., so a failure of grid lookup from Cycles should be
handled gracefully.
2015-06-09 11:59:11 +02:00
0a689d3cae Fix compile error. 2015-06-09 07:36:23 +02:00
2560e49c4e Merge branch 'master' into openvdb 2015-06-09 02:02:41 +02:00
c2cdb38376 Cycles: use vdb ray intersectors for shadow rays as well. 2015-06-09 01:54:55 +02:00
442748dfcd Fix for crash on NULL pointer if using the high density grid for
rendering.
2015-06-08 22:22:10 +02:00
3c69a62f22 Store grids' informations in the node.
Patch by @lukastoenne, with minor edits.
2015-06-08 22:09:28 +02:00
1c580e3a73 Exporter: decrease tolerance yet again. 2015-06-08 22:08:40 +02:00
dd346c5591 Never collapse directories 2015-06-08 18:47:54 +02:00
c5fc9ebfcb Animation support for collapsed image sequences.
Selected animation sequences will play back their thumbnails now.

We'll probably need a way to scrub here, will investigate that next.
2015-06-08 16:55:51 +02:00
dbb3e8da3e Gooseberry: Previous commit broke compilation of debug builds 2015-06-08 16:31:07 +02:00
f3a434c321 Merge branch 'cycles_memory_experiments' into gooseberry
Conflicts:
	intern/cycles/blender/blender_object.cpp
	intern/cycles/blender/blender_sync.h
2015-06-08 16:10:34 +02:00
77e18b8122 Gooseberry: Fix compilation error with strict compiler flags 2015-06-08 16:06:06 +02:00
ed20f7bfb0 Yet another weekly issue squashed, player did not display indicator with
image sequences.

Simple matter of storing the frame for image sequences too.
2015-06-08 16:03:43 +02:00
566f3cfb0b Sort files in collapsed sequences by frame number.
Now getting an "animation" preview should be pretty easy.
2015-06-08 15:51:44 +02:00
afe8eb3b59 Cycles: Merge density and color volume attributes if they both requested
This way we store quite reasonable amount of memory (density is stored as RGBA
textures, which ends up in gigabytes of RAM for hires smoke sims).

It's not really pretty implementation and we'll really need to support textures
with 1 and 3 channels instead of doing such packing, but we need to be able to
render some files here.
2015-06-08 15:48:11 +02:00
2485aa340b Merge branch 'fcurves-simplify' into gooseberry 2015-06-08 15:41:36 +02:00
b3259d51b4 Cycles: Free hires smoke data from blender side after scene was fully synchronized
This happens if all object's smokes are backed to files and rendering is either
happening from command line of with locked interface.

The idea behind this change is to make as much memory available for path tracing
as possible, so after heavy swapping during synchronization period there's loads
of free memory to put important data back to RAM.
2015-06-08 15:34:07 +02:00
7fe46cdecb Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/key.c
	source/blender/blenlib/intern/path_util.c
	source/blender/editors/object/object_shapekey.c
2015-06-08 15:28:25 +02:00
1ecfffeced Initial fcurve simplification code.
Notes:
* This is own coocking, since it seems hard to find papers on simplifying already existing bezier curves,
  and we do not really need the 'generic' least-square fitting of bezier in a set of points, here.
* It takes advantage of specificities of FCurves (e.g. only difference that matters here is Y value at same X frame,
  no vertical overlapping, etc.).
* It gives reasonably good results, but could most likely be enhanced quite a bit still.
* Only 'hooked' to bake action operator right now (needs more work to add it to graph editor too).
* Ultimately should probably be redone in C. Would keep it in Python until we have a real good
  cleanup behavior though, much easier to experiment in later language.
2015-06-08 15:09:07 +02:00
c5ea1d47e8 Clear previous collapsed data if needed. 2015-06-08 14:40:53 +02:00
a5f6fcde2e Refactor: move all collapsed image variables into a struct. 2015-06-08 14:34:10 +02:00
f1cd1e6503 Merge branch 'master' into cycles_memory_experiments
Conflicts:
	intern/cycles/blender/blender_object.cpp
	intern/cycles/blender/blender_sync.h
	intern/cycles/render/graph.h
	intern/cycles/render/mesh.cpp
2015-06-08 14:20:07 +02:00
309c66d4c3 Fix issue with collapsed images during last weekly.
We need to clear the collapsed flag when it does not apply anymore, so
files get displayed properly.
2015-06-08 12:54:32 +02:00
3dcb158f05 Cycles: disable -Wfloat-conversion and -Wdouble-promotion for OpenVDB
for now, and quiet warning.
2015-06-07 20:14:59 +02:00
5cb2c01ca5 Cycles: de-duplicate ray march loops.
The main logic was split up in a separate function which has quite a
number of arguments, could be worth looking into that matter at some
point. Also it seems like dense volume are slower to render now.
2015-06-07 19:50:02 +02:00
3f941ab8f5 Somewhat improve behaviour of the vdb file reader:
- it now stores a pointer to an io::File to avoid deleting and
reallocating the reader itself for each frame when importing.
- if a file is inder 10 Mb a private copy of it should be made by VDB to
ensure it is not modified while reading. This could become a user
setting at some point.
2015-06-07 04:29:50 +02:00
0f6959d797 Correct UI names and tooltips. 2015-06-07 03:10:12 +02:00
c064bc2202 Add a dedicated poll function for the cache operators. 2015-06-07 02:40:01 +02:00
0267ae96a2 Cleanups:
- automatically add an underscore to the filename before the frame
number in the filename instead.
- rename "string" -> "r_filename" argument
- removed useless NULL check
2015-06-07 02:29:40 +02:00
a80ff6214e Ask user to overwrite files if they already exist.
Only checks for the frame though.
2015-06-07 02:02:51 +02:00
2214eae4d7 Fix for recent clip change: ensure fluid matrices are computed for the
export.
2015-06-07 01:33:24 +02:00
4e4e2940eb Ensure cache directory exists. 2015-06-07 01:27:22 +02:00
2d3d984be4 Clip some low res grids based on the high res density.
Rationale is that in some cases the high resolution density is larger
than the low resolution one, so here we ensure there's enough data for
lookup during rendering for instance.
2015-06-07 00:57:28 +02:00
13e49e487e Decrease tolerance for vector grids due to possible loss of data. 2015-06-07 00:52:18 +02:00
5406dfef8e Increase tolerance value used for copying a dense array to a sparse
grid.

This doesn't affect low resolution grids much but makes a real
difference for high res grids, as it only considers values real close to
the actual smoke or fire.

Although it might be a bit high of a value, it gives some nice file
sizes going from 106.6 Mb down to 37.7 Mb (pointcache: 264.3 Mb) in a
simple simulation with a base res of 128 and a high res of 2.
2015-06-06 14:59:47 +02:00
feb8e91665 Merge branch 'master' into openvdb 2015-06-05 22:24:55 +02:00
ba9800d1e3 Fix grid clipping resulting in empty trees.
Issue was that the grids didn't have a transform set when clipping was
happening. As the clip operator copies the transform (here an invalid
one) from the grid to the mask if their tranforms mismatch, the
operation resulted in an invalid/empty tree.

(Best explanation I can give so far.)

Also for some reason exporting the obstacles field doesn't work anymore,
so it is disabled for now, and so is clipping for it as it doesn't make
sense to clip the obstacles based on the density field.
2015-06-05 22:24:07 +02:00
bb62246eb7 Draw a voxel in the viewport along with the smoke domain.
This helps a bit choosing a good resolution. Might be for development/
debug only, but it wouldn't hurt leaving it to help users.
2015-06-05 22:24:07 +02:00
af2ae46fbb Use multithreading when doing an export. 2015-06-05 22:24:07 +02:00
75eea19d02 Cycles: first pass at using VDB ray intersectors for ray marching.
The idea behind them is to avoid unnecessary ray marching by frog
leaping empty space. The only requirement for it to work is to have a
grid whose voxels are uniform, otherwise Cycles' default ray marching is
used.

For now the code has a some issues and dark sides to it:
- it only works if there is a single object containing vdb volumes in
the scene
- for a given file, only the grid named "density" (case insensitive) is
used for intersection, it's not clear how to handle multiple grids in
this case (maybe we coiuld let the user set which one to use?)
- the ray march loop is a total duplicate of the default one, this will
be addressed later on
- some leaf nodes are missing when using large volumes, the issue might
be the early exit due to the check to see if light was totally absorbed
or not

Here's some render tests:
Dense volume: http://www.pasteall.org/pic/89090
VDB with intersection: http://www.pasteall.org/pic/89092
2015-06-05 22:24:07 +02:00
ae0612c2ac Do not show fps while scrubbing. 2015-06-05 16:47:01 +02:00
6ac3ebc052 Do not store frame change in undo stack (causes much waiting for
animators in heavy scenes)
2015-06-05 16:31:40 +02:00
06058c5feb Merge branch 'master' into gooseberry 2015-06-05 15:28:29 +02:00
83752e2b40 Fixed incorrect macro for testing build settings. 2015-06-05 14:50:03 +02:00
3a3317ff39 Indicator for the player (togglable with I key).
Draws a green line where the current frame is in the movie.
2015-06-05 14:45:26 +02:00
12a77b7ac7 Collapsed images:
* Icon of collapsed images is same as a movie
* Size displayed is cummulative size of all images
* Frame range is displayed in the filename
2015-06-05 14:01:40 +02:00
fbc95426b9 Small cleanup.
- Remove unnecessary forward declarations
- Use MEM_callocN to initialize memory for new caches, would assert due
to OpenVDBCache.filename not being initialized.
2015-06-05 13:52:24 +02:00
623b8bcc9b Exporter: clip grids based on the density field to save on file size.
Patch by @lukastoenne.
2015-06-05 13:47:59 +02:00
7575ecadff Merge branch 'alembic' into gooseberry 2015-06-05 13:02:34 +02:00
f19f6da7c2 Fix outdated stub factory class for pointcache when Alembic is disabled. 2015-06-05 13:01:07 +02:00
7592e5dbf5 Disable collapse images option after operator ends. 2015-06-05 11:26:25 +02:00
a2a970cbdd Collapse image sequence feature now uses BLI_path_* functions to detect
filenames.
2015-06-04 21:15:54 +02:00
62e8708232 Fix stupid recent mistake 2015-06-04 20:55:30 +02:00
4f64596916 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/makesdna/DNA_object_types.h
2015-06-04 20:51:17 +02:00
fa147804b8 Make clamping able to return to exact previous values. 2015-06-04 17:51:21 +02:00
d0effe8683 Add an 'is_color' metadata to set an rgba socket for color grids 2015-06-04 16:34:36 +02:00
468c96c0fa Load image sequence collapsing for sequencer
Very dirty feature that will have to be reimplemented when the new asset engine makes it into blender.

This commit tweaks the filebrowser to detect sequences of images that form parts of a movie. The
files need to be in the format <number>filelame.ext or <number>.filename.ext

There is a new option next to hidden file option that makes it so this collapsing takes place.

When collapsing is on, any movie files that have the same filename will be collapsed to the first
detected file in the sequence. Selecting that file will select all files in the sequence.

There is a shortcut in the sequence editor in the Add menu, "Image Sequence" that enables collapsing
by default. Unfortunately, selecting multiple movies will not add multiple sequences to the sequencer,
at least for now, but it should make it quite easier for people to quickly select the whole range of
images for a movie. Importing the image sequence into the sequencer will use placeholders, so any missing images
will display as black.
2015-06-04 12:47:25 +02:00
343c4fb54a Merge branch 'master' into gooseberry
Conflicts:
	intern/cycles/kernel/svm/svm.h
2015-06-04 12:05:11 +02:00
5ca5009e15 Merge branch 'master' into openvdb_smoke 2015-06-03 20:57:50 +02:00
e6517c1fd7 Various cleanup. 2015-06-03 20:34:28 +02:00
eeb5b5411f Quick fix for data corruption happening when changing scene frame in
separate threads.

Patch by @lukastoenne.
2015-06-03 19:53:14 +02:00
db695688e9 Quick fix for openvdb::ArithmeticError being thrown on frame 1.
Issue is that the smoke simulator stores a zero'd object matrix on frame
1 which makes OpenVDB throw because the matrix is then non-affine.

Patch by @lukastoenne.
2015-06-03 19:43:18 +02:00
ac22acaec3 Quiet compile warning when WITH_OPENVDB is off. 2015-06-03 19:38:54 +02:00
44276743cf Merge branch 'alembic' into gooseberry 2015-06-03 12:11:15 +02:00
d392367782 Only use string properties from the cachelib for metadata.
Using ints and floats would require prefixing the Alembic metadata
keys, which becomes messy and ambiguous. Encoding other data types as
strings can be done on the python side as well.
2015-06-03 10:54:14 +02:00
7dee53c6df Have to use IDP_ReplaceInGroup to overwrite ID properties that already
exist.
2015-06-03 10:44:48 +02:00
65a73d62d8 Python UI fix for displaying int and float properties as labels. 2015-06-02 18:29:51 +02:00
222ff8f4b7 Added missing break statements. 2015-06-02 18:29:30 +02:00
7e17e0189c Display extra metadata for the cache input archive. 2015-06-02 18:17:51 +02:00
3019eff71e Use ID property groups for storing and loading metadata associated to
Alembic archives.

Two separate property groups for metadata are used (so that reading
caches does not overwrite metadata for output caches).
2015-06-02 17:59:47 +02:00
08667e616f Merge branch 'alembic' into gooseberry 2015-06-02 15:27:18 +02:00
1ae3ffb6c9 Write metadata to caches (application name, date of creation, user
description).

Cache library output archives now have a description string next to them
that gets written into the archive.
2015-06-02 15:25:13 +02:00
33d6e6ed42 Display basic metadata of a cache archive in the cache library input
settings.
2015-06-02 13:05:11 +02:00
f9ec2e706e Silence compiler errors by returning a default value for vector
interpolation.
2015-06-02 12:29:37 +02:00
9e140a2c39 Support for an optional semantics argument when interpolating cached
properties.

This is necessary to distinguish e.g. vector semantics (linear vs. slerp
interpolation for positional/normal vectors). It would be simpler to
do this based purely on types, but the typing of common Alembic
properties is not sufficiently unique. Semantics arguments are enum
values, that can be omitted if the default interpolation should be used.
2015-06-01 19:14:34 +02:00
68ec6efa76 Fix memory leak when creating new sockets. 2015-06-01 15:10:51 +02:00
b82b176f9b Move node socket creation to the C-code. 2015-06-01 15:05:14 +02:00
ac131ea551 Relink outputs when opening a file after one was already open in the
node.
2015-06-01 13:55:21 +02:00
4ce8a1bf25 Ensure filename is absolute in the vdb node. 2015-06-01 13:26:56 +02:00
cdbca9c018 Small fix for previous commit.
We might have MOD_SMOKE_VIEW_SHOWBIG flag on without high resolution on.
2015-06-01 09:04:51 +02:00
bd30d25e40 Only load the array in memory when needed.
It doesn't account for cases when we reach a frame where nothing was
simulated, this will be handled later on.
2015-06-01 08:26:33 +02:00
4e9d5d1727 Merge branch 'master' into openvdb_smoke 2015-06-01 07:04:12 +02:00
e499f9d900 Interpolation code for reading Alembic cache samples on subframes.
This features is needed for motion blur. All properties with position
semantics (transform matrices, mesh and curve vertex locations, etc.)
need to be interpolated for fractions of full frames, in order to
reproduce the motion and deformation correctly.

Alternatively we could store subframe time sampling for this subset of
properties. However, this would increase the amount of data stored,
and it might actually show artifacts from subframe interpolation in
Blender which is not visible to animators otherwise and should be
ignored.
2015-05-30 15:57:19 +02:00
6d6db87ae7 Make use of the subframe value in Scene when reading from cache archives.
Subframes are necessary when interpolating values.
2015-05-30 13:28:21 +02:00
179acf028c Use the Alembic generic chrono_t type internally for reading from
archives, instead of Blender frame values.

This is easier to use for interpolation, the frame value is really only
required externally, before and after reading a sample.
2015-05-30 13:25:22 +02:00
f0d15a6798 Merge branch 'master' into gooseberry 2015-05-29 17:45:03 +02:00
1c66edc14d Gooseberry: Workaround stupidness of MSVC with strict flags 2015-05-29 13:53:02 +05:00
ca2f5cc466 Merge branch 'master' into openvdb_smoke 2015-05-29 05:06:15 +02:00
2beb654d69 Fix compile issue when WITH_OPENVDB 2015-05-29 05:02:39 +02:00
0d51aadbfe Cleanup: use madd_v3_v3fl to avoid unnecessary steps and local variable. 2015-05-28 23:38:39 +02:00
f456cc75f2 Fix grid not being in the proper place (transform).
Basically the smoke simulator uses the MAC grid approach meaning that
the fields (like density, heat...) are cell centered. On the other hand
VDB uses a node center storage; this implies that we have to offset the
position of the grid by half a voxel in each direction.
2015-05-28 15:40:43 +02:00
543ee7961b Cycles: fix typos (crashers) in vector grid allocation and sampling
code.
2015-05-28 15:37:17 +02:00
054a97698e Merge branch 'alembic' into gooseberry 2015-05-28 15:27:18 +02:00
f1bd802b11 Moved child strand deformation into the general cache processing
function.

Strands processing now has 3 main steps:
1) apply parent modifiers
2) deform child strands
3) apply child modifiers
2015-05-28 15:25:00 +02:00
7135e17df9 Cleanup: unnecessary includes. 2015-05-28 14:42:22 +02:00
e669eefae0 Fix check to see if a frame is out of range.
Was doing AND instead of OR...
2015-05-28 14:41:21 +02:00
7e03c74c53 Add OPENVDB_USE_BLOSC definition.
Due to a bug in OpenVDB we have to set this. Though this is fixed in the
current development version, and once the next stable release is out
those defines will be removed.
2015-05-28 14:40:35 +02:00
4905de28e5 Merge branch 'alembic' into gooseberry 2015-05-28 12:52:10 +02:00
e233e5f2a8 Allow external object targets for the cache shrinkwrap modifier. 2015-05-28 12:51:32 +02:00
edf73ab96b Simplify matrix computation. 2015-05-28 11:48:19 +02:00
a2e3b7d48a Remove dead code. 2015-05-28 08:21:34 +02:00
8c8b54b601 Import grids for playback now works.
It is still commented out due to the need of a good cache (reading)
system.
2015-05-28 02:41:10 +02:00
2a040825cb Fix typos in metadata reading. 2015-05-28 01:36:32 +02:00
e189fe46e1 Set vector type when converting a grid. 2015-05-27 22:22:20 +02:00
8d6e1f3139 Set caches' reader and writer to NULL when reading a file. 2015-05-27 22:21:56 +02:00
1fd5f9f004 Fix grids' names mismatch when reading a file. 2015-05-27 21:49:48 +02:00
383c52bff2 Merge branch 'alembic' into gooseberry 2015-05-27 20:23:29 +02:00
076b65e677 Presets for cached hair simulations.
This requires some modifications to the existing preset python class.
Serializing curve mappings can not be done with a simple property
assignment.

Also the fact that operator confirm popups drop all layout context
pointers means that we have to store the modifier name in the operator
in order to apply the preset to the correct modifier.
2015-05-27 20:20:30 +02:00
443890fefe Merge branch 'master' into gooseberry
Conflicts:
	source/blender/windowmanager/intern/wm_playanim.c
2015-05-27 20:05:06 +02:00
ae2f50268b Blenderplayer:
* Add space key to easily start-stop the player.
* Keep old behaviour of stopping when scrubbing.
* Sound scrubbing can be heard now even when scrubbing after pausing.
2015-05-27 18:21:31 +02:00
1aad1a7601 Merge branch 'alembic' into gooseberry 2015-05-27 17:56:34 +02:00
e8fb1b3ecf Fix for incorrect update callback in haircut cache modifier, leading
to unrelated property changes.
2015-05-27 17:55:13 +02:00
cd8baf871b Merge branch 'alembic' into gooseberry 2015-05-27 16:47:53 +02:00
9c87f0f2c8 Fix for the hair strands cutting modifier for caches.
The cutoff value was off by 1.0, due to an invalid increment for the
first vertex.
2015-05-27 16:46:23 +02:00
b98c3efaa4 Cleanup and fix for the cache backend factory, due to changed API
functions.
2015-05-27 15:55:40 +02:00
96e878b6cc Merge branch 'alembic' into gooseberry 2015-05-27 15:22:57 +02:00
2aa75bb106 Simplified render/preview settings for cache baking.
The previous way of selecting preview ("realtime") and render settings
on the cache library level was complicated and confusing. Now there are
just 2 buttons for baking either the preview or render level.
Technically the cache still works the same way, so a 3rd button could be
added for baking both passes into the same cache, should the need arise.

The preview cache now also uses the preview frame range, which should
help in quick testing of hair simulation settings. Render always uses
the scene frame range, like render buttons do.

For display in the viewport and rendering the cache will now use
whatever data is available in the archive. If the cache contains only
render data, the viewport will also draw full render data. Vice versa,
if the cache contains only preview data, this will also be used for
rendering.

Hair toggles for children and motion now are only used for the viewport
display. This simplifies the settings a lot and removes one potential
button to be overlooked.
2015-05-27 15:16:40 +02:00
62fd4395ac Merge branch 'master' into gooseberry 2015-05-27 14:44:40 +02:00
322380999e Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/object/object_ops.c
2015-05-26 14:56:36 +02:00
2e70a29f9e Merge branch 'master' into alembic 2015-05-26 09:34:31 +02:00
17fe79b228 Cleanup/fix: put 'using namespace' inside ifdef block. 2015-05-26 03:47:43 +02:00
d5551729bf Wrap volume sampling call in a macro. 2015-05-26 03:38:44 +02:00
fdc051b3ac Merge branch 'master' into openvdb_smoke 2015-05-25 04:03:48 +02:00
650fdcd74f Merge branch 'alembic' into gooseberry 2015-05-24 12:46:48 +02:00
48d0dd9b3a Fix for cycles rendering of shortened hair curves.
The strands data can now contain more vertices than are supposed to be
rendered (if cutoff < numverts).
2015-05-24 12:44:51 +02:00
6a0854e04a Get rid of FluidDomainDescription struct. 2015-05-23 12:02:26 +02:00
29fa4b9138 Move some files and functions around. 2015-05-23 11:36:08 +02:00
ce2b57ea91 VolumeManager: put OpenVDB related routines in their own functions. 2015-05-23 08:25:29 +02:00
788ecf29a7 Don't construct default samplers, rather just store pointers to
accessors and transforms.
2015-05-23 08:23:47 +02:00
2016c92ef1 Fix segault when closing Blender.
The cache was freed after the smoke domain...
2015-05-23 05:58:11 +02:00
76b5f3d1f7 Avoid recalculating the object's data when a new cache is added. 2015-05-23 05:19:45 +02:00
f01afd7e2e Fix for cache not being set as current when deleting the first in the
list.
2015-05-23 05:18:25 +02:00
74ecf0432b Merge branch 'master' into openvdb_smoke 2015-05-23 04:28:57 +02:00
a11e61a3c7 Cleanup: indent 2015-05-23 03:59:31 +02:00
46d4cb86b6 Move source/blender/openvdb folder to intern/openvdb 2015-05-23 03:36:36 +02:00
3e4d053a16 Cycles: style cleanup. 2015-05-23 02:39:57 +02:00
dabc9d1ee9 Cycles: rename OpenVDBManager -> VolumeManager, et simili. 2015-05-23 02:28:47 +02:00
e656d07cbc Implementation of VDB ray intersectors.
They are not used yet though.
2015-05-23 02:17:48 +02:00
f6fe6759d0 Cycles: subclass the grid samplers and make them thread-safe.
Thread-safety wasn't a requirement before but as they are now thread-
safe, they use ValueAccessors for faster sampling.
2015-05-22 21:23:58 +02:00
344de9ca95 Fix typos in smoke exporter. 2015-05-22 21:20:01 +02:00
09da26d720 Expose file compression types.
By default files are compressed based on their active values, with zip
compression optionnaly added to it. We can as an option, enable blosc
compression, through a build flags. This flag is only to be enbaled if
OpenVDB was built with blosc. Otherwise -> crash.
2015-05-22 20:09:23 +02:00
bac7573dc5 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_key.h
	source/blender/blenkernel/intern/key.c
	source/blender/bmesh/intern/bmesh_strands_conv.c
2015-05-22 18:04:44 +02:00
466d17cffd Support for cutoff parameters in Alembic files.
These are optional, so older alembic cache versions still work.
2015-05-22 17:52:56 +02:00
7125b76c9a Take transformation of the duplicator object into accound for hair
cutting.

When using a dupli object from the same group as a target it is
sufficient to calculate the relative transform in the shared duplicator
local space. When using an external object though we have to transform
into world space first.
2015-05-22 17:25:48 +02:00
bd027416c4 Fix for incorrect cutoff points with the haircut cache modifier. 2015-05-22 16:59:01 +02:00
7b66e7bdd1 Implemented hair cutting for cached strands, based on a cutoff parameter
for child hairs.

The algorithm works by finding the first intersection of each child
hair with the target mesh. The child hairs have to be deformed with
their parents first (this usually happens *after* modifiers).
2015-05-22 16:22:57 +02:00
0ee5fa7745 Clean keyframes:
Keep handles as they were (cleanup code could ever slightly tweak
animation handles, which was not so good)
2015-05-22 15:42:28 +02:00
434ae40d63 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/windowmanager/intern/wm_playanim.c
2015-05-22 12:49:26 +02:00
89f1778328 Option for the haircut cache modifier to either use a scene object or
an "internal" object from the group.
2015-05-22 12:30:55 +02:00
3b089c1b90 Initialize curve mappings once after creating, just to be sure. 2015-05-22 12:18:51 +02:00
29ed48cced New cache modifier "Haircut", for removing unwanted child hairs. 2015-05-22 12:18:51 +02:00
d8c1d2d843 Alembic: Update stubs file so building without alembic works fine 2015-05-22 12:56:51 +05:00
6c2727e08e Initialize the VDB writer when creating a new cache. 2015-05-22 05:49:43 +02:00
cd301995cc A new function to split a vector grid into three scalar grids. 2015-05-22 05:27:16 +02:00
e0504bf9bb Move fluid matrices to SmokeDomainSettings. 2015-05-22 04:41:08 +02:00
41f4ea4454 A new function to create a sparse vector grid from three scalar dense
grids.
2015-05-22 04:01:31 +02:00
1b1566af98 Redesign the VDB API a bit. 2015-05-22 02:44:33 +02:00
94e69a379e SCons: Hopefully fix for gooseberry branch compilation 2015-05-21 20:43:41 +05:00
02d6601657 Use a flag to explicitly apply shape keys to either the goal positions
or the motion state.
2015-05-21 17:35:40 +02:00
5b26c112d9 Use correct blending weights for hair shapekey references. 2015-05-21 16:15:29 +02:00
67c8eb148b Removed unused variable. 2015-05-21 15:21:50 +02:00
f4ea6b4424 Properly loop sound when reaching the end of a movie 2015-05-20 19:27:55 +02:00
e09464a26b Speed of sound would get reset when stopping and resuming. 2015-05-20 19:14:59 +02:00
ca69120326 Blenderplayer audio:
Start and pause support
2015-05-20 18:52:30 +02:00
1341109c70 Tackle some of the review points. 2015-05-20 18:40:26 +02:00
a5461ffa64 Blenderplayer sound:
Support speed of sound based on how fps is different from the movie fps.
For high fps the picture thread can lag behind the sound still, need
some way to framedrop.
2015-05-20 18:33:57 +02:00
53cbbcbb21 Keep interpolation type of keyframes when cleaning
Not sure how well that will work in practice, but there's a
whole studio of people ready to test.
2015-05-20 16:23:55 +02:00
b6b219996d Squeakycleanlinator tool for Hwoozeberry.
Basically it's a clean tool, but also removes a channel if the only
remaining keyframe has the default value only and is not used by
drivers or generative modifiers.

It's supposed to help with performance of the heavy scenes in
gooseberry.

Field test in gooseberry for now, masterification later.
2015-05-20 15:30:33 +02:00
efb4f87b75 Use dedicated versions of shapekey eval functions for strands.
Strand shapekeys will be interpreted as delta keys without a basis,
since the basis would be animated and therefore useless for static keys.
To avoid complexity in the already overburdened shapekey functions and
to skip old legacy code, the strands shapekeys now have their own
functions.
2015-05-20 14:30:39 +02:00
0c83b9c129 Removed some useless old code. 2015-05-20 12:56:43 +02:00
dc4d03c519 Removed the complicated optional refdata handling from the generic
shape key eval function.

This now goes to a dedicated strands function which can be cleaned up
properly, all the old code can function as before.
2015-05-20 12:48:28 +02:00
5f195acd1e Merge branch 'master' into gooseberry 2015-05-20 12:42:23 +02:00
b75a56dcc1 Fixed shape key reference data usage, for applying shape keys on top
of an animated base.

This is necessary for strand shape keys. The basis of the data comes
from the cached animation or simulation results, i.e. we can't use the
fixed basis key or the result would always become static.
2015-05-20 12:14:55 +02:00
cc220c34ad Various cleanups. 2015-05-20 00:15:55 +02:00
091ef60e48 Initial support for rendering vdb file sequences. 2015-05-19 20:41:41 +02:00
fe0025f2ab Merge branch 'master' into gooseberry 2015-05-19 18:34:43 +02:00
2496259714 Apply strand shape keys to both the base strand coordinates and the
motion state.

This means shape keys work on the goal positions for hair as well as
the simulation results (hair motion).

If the simulation is created before shape keys are applied, the
resulting sim will be mixed with the shape keys, becoming more rigid
with increased shape weights.

OTOH the shape keys can also be applied to the animation result, before
doing hair simulation. In that case the shape will only affect the goal
positions and the bending shape of the hair, but the hair is otherwise
free to move.
2015-05-19 17:31:31 +02:00
ebd7269a99 Set the 'from' pointer in Key directly in the init method, so it works
with NULL pointers too.
2015-05-19 15:42:11 +02:00
b2d5d53fc8 Added back the deprecated KeyFrom struct in Key, for backward
compatibility.
2015-05-19 15:19:06 +02:00
60cd118a46 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_key.h
	source/blender/blenkernel/intern/key.c
	source/blender/makesdna/DNA_key_types.h
2015-05-19 14:55:20 +02:00
fdd1dfb657 Unified code for identifying unconventional shapekey owners between
gooseberry and alembic branches.

The shapekey code has been modified in both branches, adding particle
shapekeys in gooseberry and cache library shapekeys in alembic. The
two approaches are slightly different, but based on the same idea of
extending the 'from' owner info in Key, so that keys can be used without
a 'from' ID and/or with an index for identification.

This patch unifies the approach in both branches to make it slightly
less messy and avoid merge conflicts.
2015-05-19 14:50:52 +02:00
9514191b0c Cycles: add support for transforming the grid (pos, rot, scale).
This makes it easier to incorporate external VDB files in the Cycles
scene (at least in Blender).
2015-05-19 14:29:48 +02:00
a91ccbc790 Ported key owner type code from gooseberry, to better sync both branches.
The shapekey code has been modified in both branches, adding particle
shapekeys in gooseberry and cache library shapekeys in alembic. The
two approaches are slightly different, but based on the same idea of
extending the 'from' owner info in Key, so that keys can be used without
a 'from' ID and/or with an index for identification.
2015-05-19 14:26:56 +02:00
3600b9f6bd Fix building without FFMPEG
Note - seems fps for movies are only calculated with ffmpeg?
2015-05-19 13:15:42 +02:00
a975f970ce Merge branch 'alembic' into gooseberry 2015-05-19 12:02:06 +02:00
5fd5d3c8b2 Improved relaxation code for strand lengths in hair edit mode. 2015-05-19 12:00:35 +02:00
f0e00033d1 Fix for incorrect vertex loops when calculating strands.
This was using vprev from previous strands, leading to spurious changes
on untouched strands when combing.
2015-05-19 11:56:44 +02:00
8357040667 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/windowmanager/intern/wm_playanim.c
2015-05-19 11:20:54 +02:00
66d39ad417 Merge branch 'master' into alembic 2015-05-19 08:48:46 +02:00
ddd36a24a9 Cleanup. 2015-05-18 22:17:00 +02:00
a1bb117dac Cycles, OpenVDBManager: split routines into separate functions. 2015-05-18 22:11:43 +02:00
5e82b837d9 Cycles: add OpenVDBManager::delete_sampler convenience function. 2015-05-18 21:43:55 +02:00
8366d1de70 Cycles: move routine to find an exiting grid slot to its own function. 2015-05-18 21:34:02 +02:00
c465f9f729 Cycles: add grid memory usage to logging. 2015-05-18 21:10:08 +02:00
8ef679b6fd Merge branch 'alembic' into gooseberry 2015-05-18 20:36:44 +02:00
6091d9afa0 Use the extended archive writer variant to set the correct start frame
for slices.

Also the time sampling for slice output properties must be passed down
from the output archive, since the input properties use the original
start frame and cycle times.
2015-05-18 20:34:34 +02:00
9e892c6035 Cycles: use ccl_fetch to get the shading point position. 2015-05-18 20:34:19 +02:00
a085b4c9f6 Use fps and start frame settings for cache archives internally, rather
than relying on values from Scene.

This gives more flexibility when creating archives. A default variant
for opening archives using the scene settings is still available.
2015-05-18 19:59:30 +02:00
8c21b0a943 New operator for 'splicing' Alembic data, i.e. writing part of the frame
range to a new archive.

This feature is useful when cache size becomes to big and unwieldy.
For sending shots to a render farm a large cache can now be split into
smaller parts, which are spliced off and can be sent individually.
2015-05-18 19:43:01 +02:00
27fa4d3301 Scrubbing after movie has finished playing works now 2015-05-18 19:13:35 +02:00
d266ed5819 Initial support of audio scrubbing in blenderplayer.
Still lots of corner cases to check:

* sound FPS not changing with speed settings of player
* picture and video still not 100% in synch
* Haven't checked what happens when audio is finished.

Some changes were made to make things nicer:

* Scrub now initiates on mouse click instead of mouse motion, makes
things more predictable.
* When scrubbing a movie with sound, don't pause playing after
scrubbing.
2015-05-18 18:49:50 +02:00
2cf7efff36 WIP patch for OpenVDB integration in Blender and Cycles
As requested by a handfull, here's some code :)

(NOTE:) you'll need to disable compilation with OSL and install OpenVDB separately.

Reviewers: dingto, lukastoenne, sergey

Subscribers: levon, #cycles

Differential Revision: https://developer.blender.org/D1308
2015-05-18 17:23:47 +02:00
997f2009c0 Export: take adaptive domain into account (still a bit off but seems to
work)
2015-05-18 14:06:27 +02:00
8374cf4fb6 Merge branch 'alembic' into gooseberry 2015-05-18 13:10:37 +02:00
aa91aa8b9b Optional arguments for the cache baking operator to chose a frame range.
If these properties are left undefined the operator will use the scene
frame range as before.
2015-05-18 13:09:19 +02:00
735408c4e4 Merge branch 'alembic' into gooseberry 2015-05-18 12:40:22 +02:00
258d927147 Very basic printing of cache bake info to have some feedback in
background mode.
2015-05-18 12:38:56 +02:00
bd65b12398 Support compilation with SCons (only tested on Linux). 2015-05-18 02:18:06 +02:00
96054b23ec Modification to the node's UI:
- avoid drawing properties' names
- give it a default size
- warn about OpenVDB not being available on the GPU
2015-05-17 23:50:57 +02:00
4634178396 Correction to some CMakeLists.txt (missed those in some previous commit) 2015-05-17 23:49:38 +02:00
579d88551c Improvements to compilation with CMake: set flags to be able to build
with or without OpenVDB.

Scons support should follow.
2015-05-17 21:04:26 +02:00
9d1bdd9647 Add OpenVDB version to the system info file 2015-05-17 19:17:45 +02:00
d5c17b2c92 Properly set the fluid transformation matrix.
This time for real, though we need to account for adaptive domain, but
that's for another commit I guess.
Also add metadata to the grid to mark it as in local space.
2015-05-17 18:53:49 +02:00
7b6deb2a46 Make OpenVDB cache properties its own struct/linked list, including some
operators to add caches to, move caches around and remove caches from
the list.
2015-05-17 15:33:18 +02:00
3b9b59a9db Quiet warning. 2015-05-17 15:17:22 +02:00
02f307baf6 Cleanup: unessecary use of Object in get_fluid_description, also make it
static.
2015-05-17 01:10:11 +02:00
4eb69ba90f Cycles: missing break in GridDescription loop. 2015-05-17 01:08:53 +02:00
fc49fc69d3 Correct update in RNA and send notifier. 2015-05-16 18:59:06 +02:00
bdaf887654 Cycles: remove grid name print. 2015-05-16 18:17:21 +02:00
2d5bd5638f Cycles: tag OpenVDBManager as needing an update when connecting node
sockets during preview rendering.
2015-05-16 18:12:55 +02:00
0cd3e5e72c Cycles: early exit add_volume if we already have a sampler allocated.
This is done by means of a vector of structs which stores the grids'
information, including the grid slot, which is returned if we have a
match.
2015-05-16 18:11:31 +02:00
fb71b93b43 Fix crash happening when exporting the simulation right after resetting
it (by enabling adaptive domain, high resolution or whatever).

The fluid description should be set after the simulation was
initialiazed as it contains information taken from fields which wouldn't
exist otherwise.
2015-05-16 17:10:27 +02:00
e810dabf73 Fix compile issue. 2015-05-16 13:29:55 +02:00
df9d4f4bff Add an operator to update the transformation matrices of the grids. 2015-05-16 11:20:29 +02:00
9a9b2f5b98 Cleanup: grid naming, use CFRA, quiet warning, unused include. 2015-05-16 11:15:55 +02:00
d758a73a74 Fluid transform cleanup (avoid reinventing the wheel). 2015-05-16 11:10:00 +02:00
7543035ffe Test support for audio in internal player to showcase in weekly :) 2015-05-15 17:33:09 +02:00
adf1b932f0 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/animation/anim_draw.c
2015-05-15 17:32:45 +02:00
e1c1b546b5 Merge branch 'alembic' into gooseberry 2015-05-15 13:00:59 +02:00
849ea4b818 Removed redundant particle matrix calculation when writing hair caches.
This could give a significant improvement in cache baking speed. The
particle matrix is particularly costly to calculate for highly
subdivided meshes.
2015-05-15 12:13:52 +02:00
51dceb32a8 Cycles: add some quick logging. 2015-05-14 19:45:24 +02:00
d6d7297b74 Fix missing object drawing update when done exporting. 2015-05-14 19:42:20 +02:00
b464dd4862 Fix fluid transformation matrix.
There's a little bit of float precision issue, but I'll call it a day
for now...
2015-05-14 17:09:29 +02:00
7629a78b2a Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/mesh.c
	source/blender/depsgraph/intern/depsgraph_build_relations.cc
2015-05-14 16:51:28 +02:00
1518fde97d Merge branch 'master' into alembic
Conflicts:
	build_files/scons/tools/Blender.py
	source/blender/blenkernel/intern/mesh.c
2015-05-14 16:35:33 +02:00
51325025ec Merge branch 'master' into gooseberry
Conflicts:
	build_files/scons/tools/Blender.py
	source/blender/blenkernel/intern/mesh.c
	source/blender/blenkernel/intern/object.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/editors/interface/interface_handlers.c
2015-05-14 19:25:15 +05:00
67dd6243f2 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-05-14 13:26:56 +02:00
4376dfbf21 Fix for Drag force fields: was using inverted velocity. 2015-05-14 12:17:14 +02:00
9d1652e843 Merge branch 'master' into openvdb_smoke 2015-05-14 08:01:14 +02:00
e9263a8ee3 Zoom to frame options, requested by the Hwoozeberry (dutch translation)
team.

There are 3 options here:

1) Keep range (previous behaviour)
2) Seconds - allows a specified offset in seconds around current frame
3) keyframes - zoom to include a number of keyframes around the cursor

Options 2 and 3 have their own properties to tweak the behaviour and all
options can be found in User Preferences->Interface under the 2D
viewports section.

Number 3 will probably need some refinement so commiting here for the
hwoozeberry team to test first.
2015-05-13 20:31:03 +02:00
c98fb76b4e Fix for previous commit: the "goal deflect" feature wasn't actually
filtering effectors by type.
2015-05-13 18:13:50 +02:00
bab4d495dd Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-05-13 16:50:06 +02:00
d99620f296 Optional feature "Goal Deflect" to disable goal forces when hitting a
deflector object.
2015-05-13 16:49:12 +02:00
28669b4e42 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-05-12 12:48:51 +02:00
7335d6675e Revert "Disabled the goal spring that is supposed to stabilize roots."
This reverts commit 1b32ac9779.

The goal spring is not working as intended, but is better than having
no bending force at the roots at all. Needs a better solution (virtual
root vertex).
2015-05-12 12:47:03 +02:00
99734166b0 Fix for incorrect sub-stepping in the strands hair sim solver.
The code was copied from the old cloth solver, which used a while loop.
Ended up using double step increments, which screwed up some
calculations ...
2015-05-12 12:44:24 +02:00
ab7e9340ca Fix for initialization of effector velocities. 2015-05-11 19:49:23 +02:00
1b32ac9779 Disabled the goal spring that is supposed to stabilize roots.
There are larger bugs still roaming free which need to be solved first.
Goal springs also are inherently unstable because the solver can not
properly estimate their Jacobian.
2015-05-11 19:46:41 +02:00
7391480b66 Merge branch 'alembic' into gooseberry 2015-05-11 15:23:20 +02:00
215b9ae288 Fix for crash when using cache file paths without slashes in them. 2015-05-11 15:22:39 +02:00
9fe8f6e291 Dynamically add sockets to the node based on the grids available in the
file.
2015-05-11 14:28:13 +02:00
9a6ea84acb Merge branch 'alembic' into gooseberry 2015-05-11 14:00:20 +02:00
aff1cfc013 Fix for potential NULL pointer access when looking up strands data from
caches.

The 'find' function was returning a bool value, but this does not
guarantee non-null pointers. Removed the return value to avoid
confusion, now callers should simply check the returned pointers.
2015-05-11 13:58:15 +02:00
bc4be56608 Change of cache filter group behavior to allow partial caching.
The filter group was used by omitting any object instances that were
not in the group. This reduces the cache size, but it also entirely
skips objects.

Now the filter group only prevents writing of the actual object data,
but still allows storing dupli instances and dummy entries in the cache.
Any objects from cached dupli lists that don't have cached data (mesh or
strands) will now use the original object data instead.
2015-05-11 13:51:22 +02:00
09ad591e1f Merge branch 'alembic' into gooseberry 2015-05-11 11:41:40 +02:00
a5392ad4aa Fix for running bake operator in background mode without a job.
The cache bake operator would always create a job in the window manager.
However, when running in background mode via a script, the operator can
not be modal and the script would return right after starting the job.
Then Blender is stopped and the baking job with it.

To prevent this the operator now only runs in a job when executed from
the invoke function (or when 'use_job' is set explicitly).
2015-05-11 11:37:31 +02:00
Kévin Dietrich
abaa8617d7 Move openvdb utilities into their own files/directory. 2015-05-11 08:19:21 +02:00
Kévin Dietrich
8066346267 Cycles: only store a single float for scalar outputs. 2015-05-11 01:31:53 +02:00
Kévin Dietrich
a75a5d3987 Cycles OpenVDB node: add output sockets based on Blender's node outputs.
In a later commit, the Blender ones will be dynamically added based on
the grids contained in the file so any grid can be accessible for
shading purposes.
2015-05-11 01:24:37 +02:00
Kévin Dietrich
bd96249455 Apply patch in a new branch, to clean the history a bit 2015-05-10 15:53:34 +02:00
d5228eb992 Drag type force field for keeping hairs "stuck" to a mesh surface. 2015-05-10 14:04:05 +02:00
28d4538215 Merge branch 'alembic' into gooseberry 2015-05-08 17:55:18 +02:00
f89385b17c Merge branch 'master' into gooseberry 2015-05-08 17:17:47 +02:00
70e768b095 Hide regular strands when the duplicator object is in hair edit mode. 2015-05-08 15:25:53 +02:00
1e3e6e2f18 Don't use the refkey for calculating shape deltas, but only for the base
shape.

Shape keys distinguish between the base shape (shape without any keys)
and the individual reference shapes for each shape key (which define
the delta offsets). For strand shapes, which have to work on top of
animation, the base shape must be the original cache result rather than
a static shape, but the delta for each keyblock is still calculated
wrt. an explicit shape.
2015-05-08 15:04:17 +02:00
def79482c2 Merge branch 'alembic' into gooseberry 2015-05-08 13:00:50 +02:00
96bbbbd5ea Follow up fix for bend stiffness curve map versioning.
The DNA lookup for pointers is a bit weird, it expects "CurveMapping" as
the type name, but then the variable field becomes
"*bend_stiffness_mapping".
2015-05-08 12:59:27 +02:00
cc588eb1e4 Merge branch 'master' into gooseberry 2015-05-08 12:36:20 +02:00
b032c86a12 Handle transformation difference between a cached duplicator object and
group objects when editing shape keys.

The edit data (including CD_SHAPEKEY layers) is in the active object's
space, i.e. the duplicator. The original data however is cached strands
data, which is in the dupli object's space. All geometry data needs to
be transformed properly when entering/exiting edit mode.
2015-05-08 12:19:27 +02:00
d4cdac35f8 Merge branch 'master' into alembic 2015-05-08 11:24:43 +02:00
ef88d436c3 Merge branch 'alembic' into gooseberry 2015-05-08 11:16:11 +02:00
548102fcb8 Version fix for bend stiffness curve mapping. 2015-05-08 11:13:04 +02:00
0335a0507c Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-05-08 10:48:53 +02:00
158568e347 Another curve mapping to control bending stiffness along hair strands.
This already exists for goal springs. Bending stiffness, however, is
preferable to global goal springs for physical realism. Controlling
stiffness in this way allows using bending forces to also simulate
unconventional hair, such as clumpy strands that are thicker and stiffer
at the base.

Note that hair interaction can also be simulated with this tool in some
way, although eventually better methods may be needed for such effects.
2015-05-08 10:45:08 +02:00
b120755c21 Merge branch 'alembic' into gooseberry 2015-05-07 20:21:05 +02:00
345f68f7b9 Fix for uninitialized values in strand children, leading to random
crashes.
2015-05-07 20:20:11 +02:00
a8293335ba Avoid crashes in pie menus now that strand edit mode forces us to have
more than 8 object modes. We will have to support auto pie expansion at
some point...
2015-05-07 19:31:34 +02:00
87aaa8ecfb Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/implicit_blender.c
2015-05-07 17:02:36 +02:00
d17a52109e Fix for NaN error when using zero-length springs in the mass-spring
solver.

This happens when using goal springs, which are now defined as linear
springs between actual vertices and virtual goal vertices. The Jacobian
was not accounting for the possibility of zero rest length.
2015-05-07 17:01:26 +02:00
ddd48cc788 Cleanup: warnings 2015-05-08 00:22:30 +10:00
f33286c48f Merge branch 'alembic' into gooseberry 2015-05-08 00:15:43 +10:00
9ba112eb89 Cleanup: quiet warnings 2015-05-08 00:06:09 +10:00
06226b28cd Merge branch 'master' into alembic 2015-05-07 23:49:36 +10:00
8e9c7f70c8 Merge branch 'master' into gooseberry 2015-05-07 23:38:03 +10:00
13f0ec29ce Extended RNA update for shape keys to trigger re-reading of dupli caches. 2015-05-07 15:25:45 +02:00
ac0b89f656 Merge branch 'alembic' into gooseberry 2015-05-07 14:45:16 +02:00
93944e5249 Fix for missing lib-link of effector weights group pointer. 2015-05-07 14:44:19 +02:00
d2421cee51 Merge branch 'alembic' into gooseberry 2015-05-07 14:17:59 +02:00
1326240006 Fix for cache simulation force fields, these were not added up. 2015-05-07 14:16:41 +02:00
249b3cca61 Merge branch 'master' into gooseberry 2015-05-07 14:10:00 +02:00
52117a07cc Conversion for shape keys back to strands data from edit mode. 2015-05-07 13:01:28 +02:00
d4249df4f7 Strands edit data conversion wants the raw shape key number (starting
at 1), converts to index internally.
2015-05-07 10:55:21 +02:00
429741ac19 Gooseberry: Attempt to fix compilation error with scons 2015-05-07 13:01:42 +05:00
409988e3c3 Fix for own error in merging alembic branch, breaking shape keys.
Both the gooseberry and alembic branches contain extensions of the Key
DNA structure, in order to make it work for particles and caches
respectively. This was giving badly resolved conflicts on merge.
2015-05-06 19:23:02 +02:00
2b415683fd Merge branch 'master' into alembic 2015-05-06 18:58:32 +02:00
83fc255bc8 Merge branch 'master' into gooseberry 2015-05-06 18:44:13 +02:00
f5ae2e1bbc Moved the child deformation for strands out of the core cache reading
function.

This is a feature for display in the viewport and rendering, which has
nothing to do with the core cache reading functionality. In the general
case you'd want the child data to remain unmodified.
2015-05-06 16:44:24 +02:00
79c17aaad8 Support metadata display in sequencer overdrop
Getting a consistent look here is difficult since editors apply their
own scaling. ideally, here we would have a consistent look with constant
font size but this is still to be realized in master and needs some
extra thought.
2015-05-06 16:06:57 +02:00
a0c83f1754 Merge branch 'alembic' into gooseberry 2015-05-06 15:39:17 +02:00
1938fcac8e Fix fo 'simple' particle hair matrix calculation.
The parent matrix is used for single-parent children ('simple'), in
which case the pa->num_dmcache has to be used to get the correct
position on subdivided meshes.
2015-05-06 15:36:46 +02:00
f26b373cb9 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/object/object_shapekey.c
2015-05-06 15:31:57 +02:00
ebcb8223bd Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_key.h
	source/blender/blenkernel/intern/customdata.c
	source/blender/blenkernel/intern/key.c
	source/blender/editors/object/object_shapekey.c
	source/blender/makesdna/DNA_customdata_types.h
	source/blender/makesrna/intern/rna_key.c
2015-05-06 14:02:29 +02:00
af7fe835ff Store MSurfaceSample data in hair strands for mapping to a mesh.
This data is not strictly necessary for the strands drawing or rendering
or even hair simulation, because the hair root offset and rotation is
already cached explicitly. However, the strand edit mode needs this
information to correctly apply length constraints.
2015-05-06 11:13:36 +02:00
6534a7b9ed Fix for threaded dupli cache generation from groups.
Strands require a valid DerivedMesh for calculating their root matrix
and surface mapping. The scheduler tasks were created such that strands
would be calculated while the DM task was not finished yet, leading to
missing DM data.
2015-05-06 10:12:46 +02:00
264e800965 Alembic: Quick fixes for strict compiler flags 2015-05-05 21:54:43 +05:00
c685b9f30b Alembic support for MSurfaceSample customdata. 2015-05-05 16:59:49 +02:00
39ab4dab66 Take transformation into account between the duplicator and strands
object.

The strand edit mode uses the local space of the active object, which
is the duplicator (and dupli cache owner). The strands data is in local
space of the original particle system object however, so have to
convert. This is a very hackish solution, using the first instance of
the strands data, which only works for single instance data.
2015-05-05 15:37:00 +02:00
e0a780d9a7 Strand edit functions for storing edit data in the Cache Shape Key
modifier and editing in hair edit mode.
2015-05-05 14:41:04 +02:00
46b9180a0a Merge branch 'strand_editmode' into alembic 2015-05-05 14:29:42 +02:00
38d9301674 Another fix for mirror editing of strand data.
Currently strand edit mode tool use the object data 'x mirror' flag.
This flag is only available on mesh objects, but the strand editing
can be used for dupli override caches etc. as well. Eventually strand
editing should get it's own independent flag to avoid this problem.
2015-05-05 14:27:44 +02:00
017d505cac Merge branch 'strand_editmode' into alembic 2015-05-05 14:05:03 +02:00
fbc70fa51c Fix for call to mirror functions when mirroring is not enabled, giving
warnings.
2015-05-05 14:03:59 +02:00
ccfea77463 Merge branch 'strand_editmode' into alembic 2015-05-04 18:39:27 +02:00
d52bdb6d3d Moved particle related functions of the strands edit mode into a
separate file.

This may seem a bit like overkill, but it helps ensure that no particle
depedencies messes up the strand editing code. The same will be done for
other use cases of the strand editing code in the future.
2015-05-04 18:37:45 +02:00
f7e8171264 Merge branch 'strand_editmode' into alembic 2015-05-04 17:53:00 +02:00
16b6d6c676 Added missing CD layer type name for MSurfaceSample. 2015-05-04 17:52:13 +02:00
ff5fa0df18 Merge branch 'strand_editmode' into alembic
Conflicts:
	source/blender/editors/space_view3d/drawstrands.c
	source/blender/editors/space_view3d/view3d_intern.h
2015-05-04 17:37:11 +02:00
b97214a0ba Forgot this last merge 2015-05-04 17:35:23 +02:00
dc7d07753f Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_sequencer/sequencer_draw.c
2015-05-04 17:34:32 +02:00
62b139385a Merge branch 'master' into alembic 2015-05-04 17:15:00 +02:00
bf7e8b42fa Merge branch 'master' into strand_editmode
Conflicts:
	source/blender/bmesh/bmesh_class.h
	source/blender/bmesh/intern/bmesh_mesh_conv.h
2015-05-04 17:14:25 +02:00
556c25f145 Extended shape key evaluation for cached strands blending.
Now shape keys don't replace the cached base data entirely with the
static Basis shape. Instead the current state as coming from the cache
is interpreted as the variable refkey instead of the Basis key.

The Basis key is in fact redundant, but removing it would require
changing a lot of shared shapekey code, so it's left in for now.
2015-05-04 16:54:26 +02:00
ed5de2ba08 Consider an empty keyblocks list to be a new key, so a Basis shape is
added automatically.
2015-05-04 13:05:06 +02:00
1ea8324a71 Actual shape key evaluation in the shape key modifier for caches. 2015-05-04 13:04:41 +02:00
de125950f5 Make strand shapes relative by default. 2015-05-04 13:01:30 +02:00
2df6da20aa Unused variables. 2015-05-04 13:01:08 +02:00
1e6e44fd24 New 'fromtype' variable in Key to allow handling type-dependent pointer
size and stride.

This is terribly messy due to the legacy code. At some point should be
cleaned up to get rid of the 'from' backpointer and simplify.
2015-05-04 12:59:34 +02:00
51260cbe71 Create a dummy weights array for strand keys, otherwise the eval
function will exit early.
2015-05-04 12:57:26 +02:00
809d5d92d3 Fix for lib_link of cache shape keys, avoid discarding this, they are
expected to stay alive.
2015-05-04 12:54:29 +02:00
247de3f9db Fix for incorrect/unnecessary storage of Key data in readfile.
The Key struct in the cache strands shape modifier is in fact "owned"
by the modifier, but linked in the Main blenddata, so it does not have
to be written explicitly.
2015-05-03 19:25:54 +02:00
699c280a3f Added a new "Modifiers" display mode for cache libraries, which reads
the source cache and then applies modifiers afterward.

This only performs non-iterative modifiers, which don't require the
passage of time to work (e.g. shrinkwrap).
2015-05-03 19:19:43 +02:00
ba878a0880 Main shape key implementation for cached strand data.
This includes storage of the shape keys in a `Key` instance in the
modifier data, and accompanying operators for adding, removing, moving,
etc. shape keys, as well as the necessary UI code.
2015-05-03 18:24:43 +02:00
ed81c38c97 Extended 'add' function for shape keys that allows passing a NULL
pointer for 'from'.

The Key DNA has some very old and largely deprecated legacy code that
needs initializing, which requires either explicit info or deduction
from an ID. The cache modifier creates keys in a new environment without
an existing known ID type to deduce the data element settings from.
2015-05-03 13:46:38 +02:00
958e6b1f20 Some NULL pointer checks in shape key code to ensure the Key struct can
be used without a 'from' pointer.
2015-05-03 12:47:54 +02:00
dbc4be381d New cache modifier type "Strands Key" for implementing shape keys on
cached strands data.

This modifier acts as a container for shape key data (i.e. as part of
the cache library). Such shape data can be applied to cached strands
data, which allows tweaking of animated hair shapes.

This could work both as a shape for the strand goals (adding dynamics
on top) or as a final modification after dynamics. Both methods have
their advantages (pre-sim allows control and sim at the same time,
post-sim gives accurate shapes but becomes rigid).
2015-05-03 12:13:03 +02:00
de5952c3d6 Removed optimization by applying cache shrinkwrap modifier only in the
realtime pass.

As with hair sim, this would be preferable, but is causing too many
problems with the current cache archive layout.
2015-05-03 12:07:17 +02:00
920aa5e7d2 Merge branch 'master' into gooseberry 2015-05-01 17:43:49 +02:00
e51b2ea0b9 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-05-01 16:11:27 +02:00
909134270a Fix for memory leak when reading cached strands data with UV or vertex
color layers.

The layer data is added to the strands after creation, but can be
existing already. It should only be reallocated when the number of
layers changes, and must be freed cleanly in that case.
2015-05-01 16:09:32 +02:00
cbd0d7a6b4 Alternative implementation for goal spring targets as vertices.
When using external forces to implement goal springs to explicit
positions in space, the system cannot calculate a stable solution based
on the goal velocities. The new approach implements goals as vertices
in the simulation, which are constrained to their animated locations.
This way they are treated like regular vertices, but the springs only
affect their non-constrained counterpart (the actual vertices).
2015-05-01 15:51:14 +02:00
38e54a7060 Rotation randomization feature for the particle instance modifier.
When using the hair path deformation feature of the modifier, each copy
of the mesh can now be rotated around the path, in addition to changing
length and offset. This includes a constant phase angle as well as a
randomization factor.
2015-05-01 13:07:46 +02:00
7e2fc0d78a Merge branch 'alembic' into gooseberry 2015-05-01 10:28:23 +02:00
50a8b15f47 Fix for shifted sample-to-frame mapping in Alembic files with hair
simulation.

The hair sim skips the first frame (velocities are undefined there), but
still has to create the motion state data in order to have it written
as a sample. Otherwise the strands motion state samples start one sample
short and frames get mapped to one sample in the past. This then leads
to incorrect movement of all hair vertices other than the roots (which
are always clamped to the animated positions).
2015-05-01 10:24:32 +02:00
3247955492 Graph editor uses own function for setting frame, use scrub flag there
as well.
2015-04-30 17:47:56 +02:00
83e83c6de7 Bring back audio scrub after last commit 2015-04-30 17:27:14 +02:00
dc25505aea Make Hjalti happier commit.
Treat scrubbing as animation. This takes care of too many updates from
our armature system.
2015-04-30 16:48:10 +02:00
02a76aa765 Merge branch 'master' into gooseberry 2015-04-30 15:18:02 +02:00
b063b2e265 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-30 14:45:53 +02:00
afc6142b91 Fix for deflector force fields in cache simulation.
Make sure forces always push outward when not using "double sided"
deflectors (default).
2015-04-30 12:14:51 +02:00
a8cdd9dda7 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-04-29 21:41:02 +02:00
20c4b0d4a2 Merge branch 'master' into gooseberry 2015-04-29 18:50:19 +02:00
1c9985e015 Gooseberry: Fix crash of backdrop widget in graph space
This fix should actually happen in wiggly-widgets branch but it's now
has some commits which are not in gooseberry and merging them night
be not really safe.
2015-04-29 19:33:06 +05:00
303e9b4032 Fix really stupid own mistake that caused leakage of timers. 2015-04-29 16:21:21 +02:00
8fdfca67a5 Merge branch 'master' into gooseberry 2015-04-29 18:55:16 +05:00
7e3e624298 Tentative fix for flickering particle duplis, when using "pick random"
with a dupligroup and distributed rendering.

The particle duplis were generated using the global RNG (BLI_rand). This
is unstable once scenes become a bit more complex and objects are
evaluated in multiple threads.

This patch is not in master, because it changes the look of existing
particle setups.
2015-04-29 15:21:43 +02:00
9b4912ba9e New shrinkwrap modifier for cached hair data.
This is experimental. It might work for simple collision-like features,
by keeping goal positions for hair above the mesh surface. However, the
nature of nearest-point lookup on meshes means that the goal position
can flip to the other side of a mesh rapidly, which would lead to
strong forces and unstable behavior.

This code should be seen as an experiment.
2015-04-29 14:16:18 +02:00
b6aaa73953 Merge branch 'master' into gooseberry 2015-04-29 12:38:26 +02:00
90b3832c4d Merge branch 'alembic' into gooseberry
Conflicts:
	intern/cycles/blender/blender_sync.h
2015-04-29 14:48:37 +05:00
2b833c7ae8 Alembic: Fix compilation error after recent task/threads changes
For some reason CMake worked just fine, but SCons was giving issues.
2015-04-29 14:41:32 +05:00
fe052ca1ff Merge branch 'master' into gooseberry 2015-04-29 14:19:15 +05:00
adf4d0e3e3 Merge branch 'master' into alembic
Conflicts:
	intern/cycles/blender/blender_sync.h
2015-04-29 14:00:07 +05:00
0a94fbbf23 Merge branch 'alembic' into gooseberry 2015-04-28 19:26:03 +02:00
b4e5161b02 Fix for own bug in rB6d1fecc15254381420fdb1290eb611ed14cddaae.
The UV and vertex color attribute export function expects the curve data
arrays to contain only a single attribute at a time. They must be
cleared before filling in data for each UV/vcol attribute.
2015-04-28 19:18:15 +02:00
b3bdb23088 Merge branch 'alembic' into gooseberry 2015-04-28 16:53:14 +02:00
bc2055e7b7 Merge branch 'master' into gooseberry
Conflicts:
	intern/cycles/blender/blender_object.cpp
	intern/cycles/blender/blender_sync.h
	source/blender/editors/interface/interface_utils.c
2015-04-28 16:44:17 +02:00
e4758d3dfb Use quaternions instead of 3x3 matrices to store rotation of strand
roots in Alembic caches.

This kind of data is a big chunk of massive hair systems. Test files
could be reduced this way by almost 30%.
2015-04-28 11:34:02 +02:00
55ad6a99f6 Merge branch 'alembic' into gooseberry 2015-04-28 10:04:27 +02:00
6465cc7ef9 Accidentally deleted a return statement in previous commit. 2015-04-28 10:03:20 +02:00
22b35d7217 Fixed minor memory leak when the bake operator exits early without
freeing allocated data.
2015-04-28 10:01:50 +02:00
b539039d19 Optional filter group pointer in Cache Library for limiting cache
content.

This group is only used for the baking operator (like the datatypes
filter), but has no effect when reading caches. The UI now uses a box
layout to reflect this.
2015-04-28 09:43:33 +02:00
e9ae916750 Removed unused function for constructing a list of objects used by a
cache library.

This was no longer how cache libraries are used anyway, they now cache
based on duplilists, which can be more than recursive groups.
2015-04-27 19:24:31 +02:00
6d1fecc152 Support for UV and vertex color attributes of cached strands data.
Unlike particles, the Strands data stores UV coordinates and vertex
colors explicitly as a per-strand (const) property. This means Cycles
does not have to know the details of how particles map themselves to
a changing mesh surfaces (which is very complicated and fraught with
broken use cases and bugs). The UVs and colors are stored once for each
strand, since they are not expected to change over time (strands being
fixed to the mesh surface).
2015-04-27 15:18:30 +02:00
211afbabc7 Alembic: Make group's write_sample() threaded
The idea is to evaluate derived meshes in multiple threads, which will
reduce overall write_sample() time. We can't make all routines threaded
in there because alembic's file IO can't be threaded.

In any case, this change gives 2x speedup of exporting render resolution
version of Franck here.
2015-04-27 17:58:13 +05:00
3c0d111267 Alembic: Add utilities for task pool and scoped lock
Currently unused, but handy for some further development.
2015-04-27 15:34:03 +05:00
970f7feed4 Alembic: Minor tweak to disabling hdf5 if alembic does not support it
Mainly just suppresses meaningless message if hdf5 is already disabled in cmake.
2015-04-27 14:51:16 +05:00
Julian Eisel
e4b1b17925 Merge branch 'master' into gooseberry 2015-04-25 14:07:18 +02:00
757b5249d4 Alembic: Solve compilation error with strict compiler flags 2015-04-25 14:12:33 +05:00
3c5476e7f2 Do the actual frame change on timer events, not mouse move - those can
be buffered and choke the operator.
2015-04-24 17:47:35 +02:00
53441b8027 Merge branch 'alembic' into gooseberry 2015-04-24 17:37:22 +02:00
544f6dd9b6 Animation scrubbing - optimization attempt
Experiment for animators to try - only do full notification of scene at
end of scrubbing, do only manual area update instead like we do for
animation. Also skip audio update unless we do audio scrubbing.
2015-04-24 16:58:59 +02:00
8dcffc0f05 Use a wrapper around alembic read_sample function calls, to catch
Alembic exceptions and prevent crashing.

Alembic can throw exceptions on relatively common and uncritical errors,
such as mismatching properties in files which don't fit the expected
schema. These cases should now be handled gracefully and simple reject
the cache file with an error message.
2015-04-24 14:30:21 +02:00
00c69c9171 Support CD_MTFACE as a dummy layer in Alembic exports.
Customdata layers also store some base information, such as "active"
layer for rendering. This information is needed currently for syncing
particle UV and MCol data in cycles, even though the MTFACE layer type
itself is pretty much deprecated.
2015-04-24 14:29:13 +02:00
8c5a9cc8df Fix compilation issue 2015-04-24 11:41:58 +02:00
5eea19da4f Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/view3d_edit.c
2015-04-24 11:38:40 +02:00
c9e22c6ea9 Support for Loop UV and vertex color customdata attributes.
The exclusion mask for meshes in Alembic caches now is a bit more
specific as well, to not bluntly exclude all bmesh attributes.
2015-04-24 11:02:45 +02:00
84cbaf6f77 Fixed missing increment of when writing out CD_ORIGSPACE_MLOOP data. 2015-04-24 10:51:28 +02:00
290188c7fb Merge branch 'alembic' into gooseberry 2015-04-23 18:46:04 +02:00
c836cbab11 Don't disable hair sim during the render pass.
This otherwise prevents hair simulation motion showing up in renders.

The Alembic structure will have to be redesigned anyway. The current
concept of storing two separate entire scenes for viewport/render will
be replaced by a per-object detail level system. This allows performing
hair simulation only once and still use different resolutions etc.
where appropriate.
2015-04-23 18:43:20 +02:00
0b0b350e21 Merge branch 'alembic' into gooseberry 2015-04-23 16:10:48 +02:00
80126d8cf8 Merge branch 'master' into gooseberry 2015-04-23 16:10:22 +02:00
bc4347a73c Merge branch 'master' into alembic 2015-04-23 16:09:34 +02:00
0b026fd6ef Alembic: Use task pool for calculating DM for dupli object data 2015-04-23 18:49:22 +05:00
55c2330aeb Alembic: Typo sneaked in last moment before previous commit 2015-04-23 18:48:34 +05:00
5982a57f02 Alembic: Limit frame update to only group which we're interested in
The idea is simple: make it so scene_update_for_newframe is only doing updates
of the stuff which is really needed for the currently baking group.

Implementation is a bit tricky since we don't have parent relations after the
DAG is built, so doing some graph traversal there.

This code is also now using simplified version of scene_update_for_newframe()
which means in theory we can try de-duplicating some pieces of code, but that
can be done later.

Additionally, the same approach can be used to optimize motion path calculation.
2015-04-23 17:04:21 +05:00
0293378aa4 Test to check accuracy of claims about openalsoft being fixable by a
better config.
2015-04-23 13:01:03 +02:00
14653ab241 Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-23 14:53:38 +05:00
8b9d1818a5 Smoke: Fix crash when auto-sim happens outside of the backed frame range
Apparently, even if the smoke is backed to an external files it still could be
tried to be simulated at the frames outside of the baked range.

Kinda weird feature which isn't really safe, but better not to crash here.

Not totally happy with the code yet, will check with Lukas or Daniel how it
could be improved further.
2015-04-23 14:51:21 +05:00
66f7253aae Merge branch 'master' into alembic 2015-04-23 09:14:35 +02:00
cd5ab215e3 Allow the dupli override simulation to specify layers of effector
influence explicitly.

The previous code would only allow using the layers of the given object.
This is not useful for dupli overrides, because even finding which
layers an object in a dupligroup is in is cumbersome. It makes more
sense to use the layers of the duplicator instead.

There is an '_ex' version of the pdInitEffectors function now, with
an explicit layers argument. The simple version now also skips the
'precalc' argument, because this was true in every case except the
depsgraph dependency building anyway.
2015-04-23 09:09:06 +02:00
e2eb097491 Merge branch 'alembic' into gooseberry 2015-04-23 08:42:17 +02:00
38a28ce636 Fix for potentially uninitialized variable. 2015-04-23 08:41:28 +02:00
8a168e24cc Merge branch 'alembic' into gooseberry 2015-04-23 08:39:19 +02:00
adc0300bb9 Fix for incorrect index in strands normal calculation. 2015-04-23 08:38:03 +02:00
9e9a3cb7b6 Git missed those last commit 2015-04-22 19:40:11 +02:00
a6167306a2 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/interface/interface_handlers.c
	source/blender/editors/space_sequencer/sequencer_draw.c
2015-04-22 19:34:37 +02:00
d794ce627f Merge branch 'alembic' into gooseberry 2015-04-22 15:58:55 +02:00
523ea570e7 Make size calculation in cache archive info operators an optional extra
step.

This calculate can take a bit of time (some seconds to a minute in
tests), due to having to loop through all array samples. In many cases
only the basic structure is wanted.
2015-04-22 15:50:19 +02:00
9cfff67158 Merge branch 'alembic' into gooseberry 2015-04-22 14:25:38 +02:00
dbbc7b465d Alembic: Fix wrong detection in Cycles whether cache is to be used for meshes 2015-04-22 17:06:02 +05:00
dada265e2f Alembic: Fix crash of viewport render with strands read from alembic cache
The issue was caused by RNA passing ownership from the cache data used by Blender
to Cycles. This lead to situations when all of a sudden blender looses data it
was expecting to have.

Now instead of passing ownership we're just copying strands from the data, so both
Blender and Cycles are having it's own local data.

Ideally this data will be shared between viewport and Cycles, but that's a bit
more tricky to do without modifying RNA API. Would happen eventually tho.
2015-04-22 16:07:27 +05:00
adb7299dea Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-22 12:11:47 +02:00
ffbb48b064 Enabled air drag forces in cached hair sim. 2015-04-22 12:10:52 +02:00
39990d8eec Use mass parameter for setting gravity forces in cached hair sim. 2015-04-22 12:10:52 +02:00
d0f8995129 Alembic: Fixes for strict compiler flags 2015-04-22 13:14:24 +05:00
d5ed706674 Alembic: Code cleanup, space around unused pointer function argument 2015-04-22 13:05:39 +05:00
456515b59d Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-22 12:18:35 +05:00
edb7a6819d Cycles: Typo in triangle storage tooltip 2015-04-22 12:17:31 +05:00
8bd84d8ec9 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/drawvolume.c
2015-04-21 17:31:55 +02:00
33e515671a Estimation for overall data size of Alembic components.
This is not accurate, but should give some indication about the most
expensive parts of a cache, so it can be optimized efficiently.
2015-04-21 17:26:33 +02:00
af12668c28 Improved Alembic archive examination tool for cache libraries.
A new panel is added for showing the structure and contents of archives
of a cache library (instead of simply dumping on the terminal). The
archive structure is stored in a lightweight tree structure, mirroring
the hierarchy of objects and properties in Alembic. These
object/property nodes can be expanded individually for easier navigation
through the archive.
2015-04-21 13:35:25 +02:00
6caba7bba2 Use a dedicated panel for cache library UI instead of appending to the
duplication UI.
2015-04-21 11:51:04 +02:00
d739889cb9 Alembic: Make alembic's HDF5 library optional
This way blender will be happy about alembic compiled without HDF5 support.
2015-04-21 13:39:52 +05:00
944ac62ad1 Fix alembic-cached dupli not updating in Render mode in 3DViews.
Probably a typo? Objects/parents sent to sync_mesh in case of dupli were meaningless...
2015-04-20 21:01:38 +02:00
72794d9e01 ShapeKey propagate operator for hair edit mode.
This implements roughly the same functionality as the equivalent mesh
shape propagate operator, with some tweaks specific to hair editing.

The operator copies selected points to all the shape keys. Unlike meshes
these points may be shifted afterward to achieve consistent segment
length (this can be avoided by selected entire strands before using the
operator).
2015-04-20 20:21:02 +02:00
734ee5a43a Merge branch 'master' into alembic 2015-04-20 19:34:26 +02:00
3e305dcaee Fix for particle shape key editing to prevent losing shape data
when switching the active key.

Particle shapes were always using the relative blending of keys when
evaluating hair data. This works ok for meshes, because their edit data
is entirely separate from the mesh data (using bmesh). For particles,
however, the edit mode is hardwired to the hair data, so when switching
keys in edit mode we must take care to replace everything with the
shape. Otherwise the hair data will be using blender shapes and the edit
data will overwrite any shape keys with that.
2015-04-20 18:58:07 +02:00
eb73721a23 Placeholder image strips feedback session changes no.2:
Change paths operator can also have the same placeholder logic now
2015-04-20 18:07:34 +02:00
a7880dd5c8 Fix 'Children' draw option showing nothing when no children in hairsim/cache
If number of children is zero, even if we do have "valid" children cache, do
not generate children strands from cache...
2015-04-20 17:56:35 +02:00
3a8958cb18 Placeholder image strips feedback session changes no.1:
Autodetect range of strips.
2015-04-20 17:35:09 +02:00
afcdb207c2 Placeholders for sequencer take one.
Placeholder images, means that the image sequence reserves a range for
images, displaying black while we wait for them to finish rendering.

This is meant as a feature to not break the layout of gooseberry
sequence edits while we wait for those frames to arrive.
2015-04-20 16:33:44 +02:00
8a9dc8451d Merge branch 'master' into alembic 2015-04-20 15:45:17 +02:00
4cecbf42cc Merge branch 'master' into gooseberry 2015-04-20 17:45:16 +05:00
227be153e9 Merge branch 'master' into alembic 2015-04-20 13:58:16 +02:00
2db121704b Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-20 16:38:31 +05:00
5edf8a8a5b Cycles: Fix threading issue caused by several nodes sharing the same image 2015-04-20 16:36:08 +05:00
dbd873380f Cycles: Replace name-based node matching with type-based
This commit replaces name-based node matching in the mesh device update
with check of special type. It is more robust approach for adding new
nodes which could use image slots for storage. it's also adds updates
of environment texture nodes used in bump shader (this was missing in
the original image sync reshuffle commit).
2015-04-20 16:27:20 +05:00
20e960215a Particle shapekey code is only in the gooseberry branch, disabled here. 2015-04-20 12:59:01 +02:00
9cafd3ae56 SimDebugData is now global, for easier usage and less intrusive code. 2015-04-20 12:58:16 +02:00
0dccffb7aa Fix for CustomDataType syntax error from merging. 2015-04-20 12:37:21 +02:00
7719a6365a Use the X mirror option in new strand edit stroke brush tools.
Note that currently this has virtually no effect, because the mirror
option relies on exact positions of vertices, which does not happen with
random hair placement (the add brush has no mirror option yet).

Eventually topological mirroring should help with this case, but is not
implemented for either old or new strand edit yet.
2015-04-20 12:25:18 +02:00
3a3327dcd5 Cleanup: rename function argument for consistency. 2015-04-20 12:25:18 +02:00
8ffcd1f434 Utility methods for mirrored strand editing.
These are a modified version of their BMEditMesh counterparts.

use_topology is not yet implemented for strands. Native strand topology
is not very useful for this. Instead, the topology of the scalp mesh
should be used for finding mirrored strand roots, then the arc- or
parametric length of a vertex from the root to find mirrored verts.

Conflicts:
	source/blender/blenkernel/BKE_editstrands.h
2015-04-20 12:25:15 +02:00
ed1dc43657 Fix for strands undo creating an invalid BMesh.
When copying mesh data to bmesh the MVERT and similar customdata types
have to be omitted. Otherwise the bmesh instance ends up with NULL
pointers in customdata layers, but entries in the typemap != -1. The
effect was that when storing new steps after one or more undo, the
resulting original data would be copied, and subsequent undo steps
are ignored.
2015-04-20 12:24:34 +02:00
5b9b779cab Minor code reshuffling. 2015-04-20 12:24:34 +02:00
4798464e8b Extended Mesh <-> BMesh copy function versions for specifying custom
data masks explicitly.

A dummy mesh is used for strand edit undo storage like in mesh edit
to prevent unnecessary code duplication. However, when copying from/to
BMesh only the mesh data layers are copied by default, omitting the new
data layers for strands (currently only MSurfaceSample hair root data).
2015-04-20 12:24:33 +02:00
299859e40b Sanity check: if there is no edited/active object for an undo step,
consider it invalid and clean up.
2015-04-20 12:24:33 +02:00
5e42aff397 Basic undo support in the new strand edit mode.
This uses the generalized undo stack system which is also used for
object data edit. An extension is necessary to tell the undo functions
which object is specifically used for generating undo data and
identifying the stack, since strand editing does not edit the obdata
itself.
2015-04-20 12:24:33 +02:00
3f539c987f Removed deprecated UI button for the hair debug flag. 2015-04-20 12:24:33 +02:00
6146b90312 Select Linked operator for hair edit mode (select all vertices of a
strand).
2015-04-20 12:24:03 +02:00
8b2ec99f57 Lasso Select operator for hair edit mode. 2015-04-20 12:24:03 +02:00
410998cdc6 Border Select operator for hair edit mode. 2015-04-20 12:24:03 +02:00
b6f4e0932d Mouse Select operator for hair edit mode. 2015-04-20 12:24:03 +02:00
62fa5c4a84 Select/Deselect All operator for hair edit mode. 2015-04-20 12:24:03 +02:00
2cddc3cda8 Disabled the partial IK strand relaxation for the time being.
First goal is to reproduce current particle edit tools in the strand
edit mode, then make improvements.
2015-04-20 12:24:03 +02:00
9120df6cb3 Missing bmesh include path in scons files. 2015-04-20 12:24:02 +02:00
48a86af388 IK solver for hair strands that provides a better solution for keeping
consistent segment lengths when transforming vertices.

Warning: The implementation is not correct yet, but all the steps should
be there.

The main idea is to treat strands as a sequence of joints that are
displaced out of their original locations by a transform or other tool.
The solver then tries to find a global per-strand solution that keeps
the segment lengths unmodified, with a minimum change in angles from
the original starting shape. Such a solution is much more usable and
efficient than the current O(n^2) attempt of "spreading the error"
across the strand.

The inverse kinematics method is very flexible. It can also include
stretching, which would be very welcome for features like the length
tool. Different parts of the strand could be weighted separately using
scaling factors for the angle/stretch parameters.

Conflicts:
	source/blender/physics/intern/implicit.h
2015-04-20 12:24:00 +02:00
eacc24ccf1 Ported over the relaxation method for hair vertices from particle edit
mode.

This method is simple, but not really very usable. It works by
successively relaxing segments that are too long or too short, moving
both vertices along the edge between them. This is repeated N^2 times
(N: number of vertices on the strand).

A true IK solver could give a lot better results, as well as providing
many opportunities to apply weighting for targets (e.g. preferring to
move non-selected over selected vertices). Many different methods for
simple IK solvers exist, so there should be one that works well for
large number of simple strands. See e.g.
http://www.math.ucsd.edu/~sbuss/ResearchWeb/ikmethods/iksurvey.pdf
2015-04-20 12:23:49 +02:00
ac54ded29b Primitive transform operator support for strand vertices.
This does not yet prevent root transforms and/or length changes.
2015-04-20 12:23:49 +02:00
f7511b3d01 Improved hair combing tool, adjusting edge directions instead of
vertex positions.

This works a lot better with strokes perpendicular to the general hair
strand direction. With the previous comb tool such strokes would only
make a small dent in the hair curve and then vertices would slip out
of the tool circle. The edge combing affects the local direction of
strands, which acts as a kind of grabbing functionality by moving
further vertices in front of the tool circle. The result is that
drawing a curvy hair shape with the comb becomes much easier.

In addition, the new tool also uses edge filtering and weighting rather
than vertices. This means that small brushes also work well, instead
of having no effect when hitting the edge segments between vertices.

Further improvement could be achieved later by using a global strand
solver, which adjusts vertex positions based on an error metric along
the whole of the strand.
2015-04-20 12:23:48 +02:00
208ddcde2c Use a simple low-pass filter to generate a smoother, more stable
direction vector for the hair stroke tool.

This is necessary for directional tools such as combing, where the
stroke direction can lead to unwanted results if it changes too
abruptly.
2015-04-20 12:23:48 +02:00
f3b22c5769 Support for sim_debug drawing in hair edit mode (dev feature). 2015-04-20 12:23:48 +02:00
b70c815ac2 Renamed the edithair files in BKE to editstrands.
The rationale behind this is that the BKE code could be used for
modeling hair and fur as well as a number of other features such as
grass. The primary addition to BMesh is the limitation to strand-like
topology (simple vertex chains, optionally rooted on a mesh surface).

The editor code OTOH is quite hair specific, since the result should
be suitable for hair simulation, and the workflow should mimick actual
hair grooming intuitively. Eventually the hair edit mode could become
a generalized strand edit mode with slightly different tool sets for
various purposes, but for now it is quite specifically built for hair.

Conflicts:
	source/blender/blenkernel/CMakeLists.txt
	source/blender/blenkernel/intern/particle.c
2015-04-20 12:23:46 +02:00
d0a1fc8bb0 Sanity check for strand root/tip checks, now supports single vertices. 2015-04-20 12:23:23 +02:00
2d1d909817 MSVC compiler cannot handle standard C code.
Conflicts:
	source/blender/editors/physics/particle_edit.c
2015-04-20 12:23:20 +02:00
e9737da5f2 Fix scons build files for new hair edit code parts. 2015-04-20 12:23:16 +02:00
1e047231c6 Fix for hair-to-particle export: need to set weight=1.0 for hair roots,
since the particle system uses this for pinning them to the mesh.
2015-04-20 12:23:16 +02:00
142ef0b2e9 Fixed lib-linking for hair edit settings brush and object pointers. 2015-04-20 12:23:15 +02:00
56a09434c5 Basic Add tool for creating new strands in hair edit mode. 2015-04-20 12:23:15 +02:00
8672304e30 Fix for uninitialized return value. 2015-04-20 12:23:15 +02:00
f95dde244e Better feedback about valid sample from mesh sampling methods.
Conflicts:
	source/blender/editors/object/object_shapekey.c
2015-04-20 12:23:15 +02:00
79e649a3bf New simple storage method for single sample values. 2015-04-20 12:23:15 +02:00
e5b25e3c07 Generic raycast method for generating mesh surface samples.
Conflicts:
	source/blender/blenkernel/intern/mesh_sample.c
2015-04-20 12:23:15 +02:00
a4664ef88d New mesh sample evaluation function for shape key data. 2015-04-20 12:23:15 +02:00
be312b1399 First selection operator implementation for hair edit: circle select. 2015-04-20 12:23:14 +02:00
3edc512888 Show selection state of hair vertices with the usual theme colors. 2015-04-20 12:23:14 +02:00
b2ea8c1022 Added back different selection modes (strands, verts, tips) for hair
editing.
2015-04-20 12:23:14 +02:00
339a8b7521 Fix for OpenlGL state restoration after strand drawing, disable color
material option.
2015-04-20 12:23:14 +02:00
77da317cb1 Apply the same weight profile in the comb tool as in particle edit mode.
The comb tool will likely get a complete overhaul, but until then it
should just behave like the old tool.
2015-04-20 12:23:14 +02:00
2c0616b034 Support for common operators, keymap entries and radial controls for
hair brush settings.
2015-04-20 12:23:14 +02:00
a9fbd3b23b Fix for brush radius, the Brush.size property is actually the radius and
not the diameter.
2015-04-20 12:23:14 +02:00
687b5a1ec0 Implemented basic cursor drawing for hair edit mode brushes. 2015-04-20 12:23:13 +02:00
59efe23830 Primitive hair lighting in OpenGL solid shading, cleanup of strands
drawing code for edit mode.

The lighting uses the same method as the particle hair, interpreting
strand direction as the normal. This is nowhere near realistic hair
shading, but doing this with line shading alone in the fixed-function
pipeline is probably not possible. A GLSL shader could be used instead
for a more realistic alternative as part of the viewport project. At
least this simple shading mode gives some orientation feedback while
editing hair.
2015-04-20 12:23:13 +02:00
d16599ea04 Display basic brush properties in the toolbar for hair edit mode. 2015-04-20 12:23:13 +02:00
37d3a3331e Use the "official" brush size calculated by blenkernel and subdivide
the stroke step to avoid tunneling.
2015-04-20 12:23:13 +02:00
5254df30ba Filter affected hair vertices in edit mode based on the brush size and
z depth.
2015-04-20 12:23:13 +02:00
2590231315 Constrain hair root vertices to their mesh location after applying tools.
Conflicts:
	source/blender/bmesh/intern/bmesh_interp.c
	source/blender/bmesh/intern/bmesh_interp.h
2015-04-20 12:23:11 +02:00
83b20c7ddf Enforce hair constraints (constant segment length) after applying a tool.
Currently uses the same approach as old particle edit mode (rescale
hair segments from the root on). A more sophisticated approach using
least-square error minimization of the displacement could yield better
results.
2015-04-20 12:22:10 +02:00
0e06a60168 Make sure tool input data is in object space. 2015-04-20 12:22:10 +02:00
121677d7c8 Nicer vector math for mouse coordinates. 2015-04-20 12:22:10 +02:00
1615da133f Simplified first version of the hair stroke combing functionality.
Stroke tools will be categorized by the hair elements they operate on:
vertices, segments or strands (roots). In addition to that a filter
function defines the influence of the brush. This should be defined by
the other brush settings and be largely independent of the main tool
mode.
2015-04-20 12:22:10 +02:00
7ae6492c85 Lots of small fixes for paint system quirks to make hair brushes work
in the UI.

Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
	source/blender/editors/transform/manipulator_widget.c
2015-04-20 12:21:58 +02:00
7779166313 Define hair edit settings and brush types in the RNA, similar to paint
and sculpt settings.

Conflicts:
	source/blender/makesdna/DNA_brush_types.h
2015-04-20 12:19:28 +02:00
833a11f891 New image file icons for hair brush tools and an according tool enum in
the Brush RNA.
2015-04-20 12:17:16 +02:00
79959152e6 Calculate some basic info about mouse strokes and context and pass it
on to a general hair tool function.
2015-04-20 12:17:16 +02:00
4fd6a7a696 Revert previous hair edit operator scaffolding and port over the old
operator for strokes instead.

The paint system is much too complicated and does not add any real
advantage at this point.
2015-04-20 12:17:16 +02:00
98b15d9a7c Copied high-level operator code from the paint/sculpt system as a basis
for brush-stroke operators in hair edit mode.

Hopefully this can help avoid some redundant code and ensure consistent
keymapping etc.
2015-04-20 12:17:16 +02:00
a889a1458c Missing bmesh include folder for hair editor in scons. 2015-04-20 12:17:16 +02:00
7b6332f634 Apply the hair matrices when converting from particle keys to bmesh,
so the edit data is consistently in object space.
2015-04-20 12:17:16 +02:00
0a27e97fb7 Fix for GL buffer size for edges, needs to 2x for two vertex indices. 2015-04-20 12:17:16 +02:00
eb5257002b New drawing code for hair edit mode.
Conflicts:
	source/blender/editors/space_view3d/drawobject.c
	source/blender/editors/space_view3d/view3d_intern.h
2015-04-20 12:17:14 +02:00
23b284348b Removed deprecated code. 2015-04-20 12:15:17 +02:00
2d79994e39 Free strand edit memory after use. 2015-04-20 12:15:17 +02:00
fd34e3efbc Fix for verts-of-strand iterator: This requires a second pointer in
addition to the edge, otherwise the last point is omitted.
2015-04-20 12:15:17 +02:00
dc43df89cd CustomData layer for storing hair root locations as MSurfaceSamples.
This requires converting the old messy particle num/num_dmcache/fuv/foffset
data into the new mesh samples, which can potentially introduce floating
point errors and inaccuracies due to lack of face index mapping in the
new system. However, in any well-constructed particle system the hair
roots should be nearest to their num face, so mapping would be accurate
enough. If necessary face index data could be added to samples as a
legacy code hack, but probably it's best to eventually replace the
hair system as a whole anyway.
2015-04-20 12:15:17 +02:00
4e47239de2 Store the hair key weight in edit mode.
Currently particles only have a single weight value, controlling
pinning in the simulation (for root and virtual root verts) and goal
force scaling. This will be replaced by a full vertex group weight
system eventually.
2015-04-20 12:15:17 +02:00
991ee8a570 First customdata layer for particle mass.
This is more for testing purposes, since currently there is only a
single mass property for the psys as a whole. This should change in the
future though, to allow variable mass per strand or vertex.

Conflicts:
	source/blender/bmesh/intern/bmesh_interp.c
2015-04-20 12:15:15 +02:00
e43ef55e7f Basic particle data reconstruction when exiting edit mode. 2015-04-20 12:14:34 +02:00
1afd5be044 Fix for verts-of-strand iterator: After last edge step has to set the
edge to NULL to avoid infinite looping over the same edge (1-elem disk).
2015-04-20 12:14:34 +02:00
d550a29558 Fix for particle-to-bmesh: only was looping over totvert instead of
pa->totkey.
2015-04-20 12:14:34 +02:00
5f44f4a2ff Intermediate commit: switching strand edit data to BMesh.
Hair/Strand editing will only use a subset of the bmesh topology and
expect a specific topology that needs to be verified and enforced.
However, this extra requirement is much less work than reimplementing a
whole edit data system with the same feature set as bmesh and avoids
much redundant code.

Conflicts:
	source/blender/blenkernel/intern/customdata.c
	source/blender/makesdna/DNA_customdata_types.h
2015-04-20 12:14:30 +02:00
b0a9e48a19 New customdata type for mesh surface samples.
Conflicts:
	source/blender/makesdna/DNA_customdata_types.h
2015-04-20 12:14:23 +02:00
afb947c00c Switched the hair edit data to a bmesh-like structure for consistency.
This means using mempools to store curve and vertex data, which allows
arbitrary addition and removal of data more easily. Also this includes
an iterator system similar to bmesh iterators (although the simpler
topology makes it a lot less complex).

Conflicts:
	source/blender/blenkernel/intern/customdata.c
	source/blender/makesdna/DNA_customdata_types.h
2015-04-20 12:13:35 +02:00
f1e4d35489 Reconstruct most basic particle data when applying the hair edit, so
particle hairs remain visible.

Note that currently the hair root location (num/num_dmcache, fuv, foffset)
is not stored from edit data, so all hairs end up in a default location.
2015-04-20 12:12:01 +02:00
1c7053f7a0 Store hair edit data in particle systems and manage it in the operator
for entering/exiting the edit mode.

Conflicts:
	source/blender/blenkernel/intern/particle.c
2015-04-20 12:11:59 +02:00
7bb90a06e1 Moved code for the hair edit data structures to blenkernel.
This makes it work more like editmesh, and avoid the awkward and
basically bad-level approach in particles, where the edit data is an
anonymous pointer in particle systems together with a callback for
freeing.

Conflicts:
	source/blender/blenkernel/CMakeLists.txt
2015-04-20 12:11:44 +02:00
a9001adbb4 New edit mode for hair.
Conflicts:
	source/blender/blenloader/intern/readfile.c
2015-04-20 12:11:05 +02:00
dd69a3dbcf Finished the particle-to-edit conversion function. 2015-04-20 12:10:33 +02:00
c65f1b2e15 More work on particle conversion methods for hair edit mode. 2015-04-20 12:10:33 +02:00
09a7dbc29a New editor library for hair edit mode. 2015-04-20 12:10:33 +02:00
6078e79cea Minor syntax fix. 2015-04-20 12:10:33 +02:00
6783b15453 Shifted the dispatch from the algorithm side to the storage side of the
sampling system to keep the code simple.

Now there is a MSurfaceSampleStorage struct that encodes the storage
details, which the algorithms don't have to care about.
2015-04-20 12:10:33 +02:00
82132fc5b0 Added generalized method for creating an array of mesh samples with
arbitrary stride.
2015-04-20 12:10:32 +02:00
4b4f24607e Changed mesh sample definition to use 3 vertex weights instead of a
face index. This is easier to sample uniformly and avoids the need for
tesselation for evaluating.
2015-04-20 12:10:32 +02:00
fe48c353f1 Normalize the normal vector after sample eval to account for
interpolation.
2015-04-20 12:10:32 +02:00
308af3bfb3 Added a bool return to the eval function to give feedback on invalid
samples.
2015-04-20 12:10:32 +02:00
3f7d66ece4 Added a basic RNA definition for the mesh sampling system. 2015-04-20 12:10:32 +02:00
a952800ffc Eval function to get a location and normal vector from mesh samples. 2015-04-20 12:10:32 +02:00
71e34dad2b Usable random distribution algorithm.
Does not include area weighting yet.
2015-04-20 12:10:32 +02:00
24b77359ae Skeleton code for sampling meshes.
Conflicts:
	source/blender/blenkernel/CMakeLists.txt
2015-04-20 12:10:29 +02:00
386e1a1c94 Merge branch 'master' into cycles_memory_experiments 2015-04-20 15:07:15 +05:00
c9c207f093 Merge branch 'master' into gooseberry 2015-04-20 15:06:26 +05:00
d516158bb3 Merge branch 'master' into alembic 2015-04-20 11:55:36 +02:00
a2d5380f62 Merge branch 'alembic' into gooseberry 2015-04-20 10:38:12 +02:00
bd5f946f39 Fix for stupid MSVC, does not allow const expression as array size. 2015-04-20 10:37:01 +02:00
10df745d21 Revert 0d3da1343c
Disabling group -> duplicator dependencies would in theory make caches
more attractive because the invisible objects don't have to be updated
just because of the group.

However, the viewport and render starts to behave unpredictably without
these updates, because the dupli cache relies in many ways on the
objects it is supposed to override.
2015-04-20 09:39:08 +02:00
77a5443c60 Merge branch 'master' into gooseberry 2015-04-18 15:03:13 +02:00
ee04d04c0c Some minor fixes needed to build alembic with install_deps.sh. 2015-04-18 13:06:43 +02:00
47baee761e Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-17 23:36:42 +05:00
638b979895 Cycles: Add debug option to disable pre-aligned triangles storage
This option makes it so BVH does not use pre-aligned storage for triangle vertex
coordinates which was originally needed for faster coordinate lookup when doing
triangle intersection test. This array gives up to 10% performance comparing to
fetching individual coordinates but it also used 12 floats per BVH primitive,
which might translate to quite huge array in a complex scene.

Intention of this option is to investigate if this is a right direction to make
gooseberry files being able to render on local farm which is not totally great
in memory.

Current approach is not totally cheap, meaning even the case with the storage
enabled might be slower, but currently it's within 1%.
2015-04-17 23:34:54 +05:00
84f7f3d4b8 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-17 17:47:49 +02:00
e3a0345d8d Merge branch 'master' into gooseberry 2015-04-17 19:11:42 +05:00
e229f431ed "Deflector" force modifier for cache simulation.
This works like the existing effectors when using "surface" mode: It
selects the closest point on the mesh surface and creates a force based
on distance and falloff.

Unlike the old effectors it also supports signed distance, based on
the surface normal, which gives more control over the allowable distance
of strands to the mesh surface.
2015-04-17 09:47:58 +02:00
0faee07971 New cache modifier type for creating force fields on duplis of the
cached group itself.

This allows using the dupli group objects themselves as force fields,
in particular for collision objects in strand simulation. Without this
feature only the original objects of are recognized by the effectors
system, and even if duplis worked properly their settings would not be
accessible due to linking and dupli group hiding. The cache modifier
circumvents this issue by providing a new force field system, separate
from the current effectors.
2015-04-16 21:16:49 +02:00
26d74de2cd Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-16 16:24:24 +02:00
c412e7aca0 Merge branch 'alembic' into gooseberry 2015-04-16 16:08:53 +02:00
bda3e21e95 Revert recent commits, no time to improve things now. 2015-04-16 15:50:06 +02:00
78f8c3eb31 Merge branch 'master' into cycles_memory_experiments 2015-04-16 17:42:11 +05:00
91161dc983 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/drawobject.c
2015-04-16 13:03:26 +02:00
ea189ce26e Don't write dupli instances to caches in the Render pass.
Duplilists are always generated for viewport/realtime settings, render
settings only affect the mesh geometry but not the duplis.
2015-04-16 12:52:42 +02:00
36aad476dc Cleanup: Removed unused writer/reader classes for Alembic.
These classes were used previously to write parts of the Blender DNA
directly to Alembic. Their code is shared with other classes that are
still in use, so none of the really substantial parts have been deleted.
2015-04-16 12:07:28 +02:00
3538ebf443 Cleanup: Removed unused parts of the C API for caching.
This only removes trivial C function wrappers for parts of the C++ code
that are not used directly any more from outside the bl_pointcache
library. Some internal parts may be removed later, this cleanup is
mostly to reduce code noise.
2015-04-16 11:57:16 +02:00
e39d9960fb Renamed passes for cache writing to reflect their origin with mesh
modifier evaluation.
2015-04-16 11:51:15 +02:00
f5d5ffd335 Smoke: Fix compilation error with smoke disabled 2015-04-16 14:32:37 +05:00
a7846047a1 Remove the dual "root" object at the top of Alembic archives.
Using two full scene nodes for render/realtime data creates a lot of
duplication in both storage and processing time. Instead storing
specific data types like meshes in different versions keeps duplication
to the necessary minimum and allows easier fallback where available.
2015-04-16 10:42:48 +02:00
4a868954c5 Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-16 00:12:30 +05:00
d5c40c704f Smoke: Fix another crash caused by recent changes
Didn't notice initFie and so are called from constructor for some reason..
2015-04-16 00:11:35 +05:00
461e9a25eb Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-15 23:11:46 +05:00
465e59ac7d Smoke: Fix wrong bit test in previous commit 2015-04-15 22:50:39 +05:00
551a1b7c28 Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-15 20:41:57 +05:00
a1c1b32e4e Merge branch 'master' into cycles_memory_experiments 2015-04-15 20:41:25 +05:00
650915595c Draw modifiers as inactive when channel modifiers are deactivated. 2015-04-15 17:39:39 +02:00
4b04fad0a9 Smoke: Don't allocate arrays needed for hi-res simulation if smoke is baked to file
There used to be quite huge 3D arrays stored in memory which are only needed for
simulation steps and not used at all if the smoke is baked to file. That memory
is unmanaged by blender and not visible in the info space header and in practice
they could easily be gigabytes for hires smoke.

This commit only addressed hires smoke since it's the more important at this
point, and non-hires smoke wouldn't have such noticeable benefit.

In the case of tornado file it gives around 20% memory saving (which is about
26GB vs. 33GB on later frames of 01.03.02.A3 shot.
2015-04-15 20:35:02 +05:00
ebc94798de Make icon use a dim version instead for modifier muting 2015-04-15 16:31:46 +02:00
62eec5ab8e Add toggle that disables modifiers on fcurves. Gooseberry request, not
sure how useful it would be on master + it misses an icon, so commiting
here first.
2015-04-15 16:00:17 +02:00
77cbc67328 Removed the unused particle writer/reader code from Alembic.
We only use particles to initialize strands export now.
2015-04-15 12:47:44 +02:00
a67658dddc Only process hair simulation in "realtime" mode.
This means no motion state data is generated for render mode, this
requires some larger changes to the way render/realtime data is stored
in the caches.
2015-04-15 12:29:17 +02:00
c634edf4b1 Merge branch 'alembic' into gooseberry 2015-04-15 11:04:12 +02:00
88387ffa59 Object and particle system selection in the cache hair sim modifier.
Before this the hair sim would be applied indiscriminately to all the
strands in the cache data. Now an object/psys combination from the dupli
cache must be selected. Note that this is not the actual target of the
hair simulation, which still operates on the cache overrides instead.
The Object/Psys only functions as a selectable key, if no matching data
is found in the cache no hairsim will be applied.
2015-04-15 11:00:17 +02:00
0b30c9db2a Merge branch 'alembic' into gooseberry 2015-04-14 16:09:06 +02:00
53b5099e27 Another fix for child deformation.
Needs the parent base shape in the rotated deformed root space, or the
child gets additional deformation from the root rotations.
2015-04-14 15:28:48 +02:00
638e159de2 Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-14 17:32:14 +05:00
5155c165b5 Cycles leaf nodes split: Fix crash when rendering scene without inner nodes 2015-04-14 17:26:53 +05:00
f0035cdbbf Merge branch 'cycles_memory_experiments' into gooseberry 2015-04-14 16:26:25 +05:00
cb69152ad5 Merge branch 'master' into cycles_memory_experiments 2015-04-14 16:19:13 +05:00
e0bbdd9704 Cycles: Split BVH nodes storage into inner and leaf nodes
This way we can get rid of inefficient memory usage caused by BVH boundbox
part being unused by leaf nodes but still being allocated for them. Doing
such split allows to save 6 of float4 values for QBVH per leaf node and 3
of float4 values for regular BVH per leaf node.

This translates into following memory save using 01.01.01.G rendered
without hair:

                   Device memory size   Device memory peak   Global memory peak
Before the patch:  4957                 5051                 7668
With the patch:    4467                 4562                 7332

The measurements are done against current master. Still need to run speed tests
and it's hard to predict if it's faster or not: on the one hand leaf nodes are
now much more coherent in cache, on the other hand they're not so much coherent
with regular nodes anymore.

Reviewers: brecht, juicyfruit

Subscribers: venomgfx, eyecandy

Differential Revision: https://developer.blender.org/D1236
2015-04-14 16:19:10 +05:00
ea8fb0953c AnimSys utility function was renamed in master. 2015-04-14 12:46:02 +02:00
4a3e22a34c Merge branch 'alembic' into gooseberry
Conflicts:
	source/blenderplayer/bad_level_call_stubs/stubs.c
2015-04-14 12:34:05 +02:00
12dd009356 Merge branch 'master' into alembic
Conflicts:
	source/blender/blenkernel/intern/object_dupli.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
2015-04-14 12:25:17 +02:00
280dc1163b Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/drawobject.c
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-14 12:24:21 +02:00
c4e0d09e2d Fix for missing child data when the pathcache is not calculated.
The child strand root matrix and position still need to be stored, so
the writer must not exit early based on existence of the pathcache.
2015-04-14 12:21:19 +02:00
a8487f7f62 Optimization for particle baking to caches, skip evaluation of pathcache
when not needed.

The pathcache data is only required in the first frame to construct the
child strand shapes. For subsequent frames the children are calculated
using the initial shape and parent deformation, so particles don't need
to recalculate all the time.

This gives a significant performance increase of the baking process when
using a lot of complicated child hairs.
2015-04-14 11:50:53 +02:00
24caf4f98f Major optimization for cache size when storing child strands.
The basis for this optimization is that child strands have a shape that
does not actually change over time: the particle code does not enforce
this formally, but in fact all the clump/kink/roughness algorithms take
great care to not introduce changes of shape over time.

The final look of child hairs is achieved only by following the parent
hair deformation, i.e. by applying the offset of the matching parametric
position on the parent strand.

This means that for caching child strands it is sufficient to store the
full vertex data only in the first sample, and then apply the parent
deformation on subsequent frames using only the animated root matrices.

In test cases this seems to reduce the cache size to something between
10-20 % of the original size (down to some hundred MB from some 10 GB).
Further optimizations could be achieved by using smaller data types,
such as quaternions instead of 3x3 or 4x4 matrices for the remaining
child data.
2015-04-14 11:06:14 +02:00
09701e0ccc Apply child strand deformation only when using the cache result for
viewport or render display.

This way the strands can be cleanly written to subsequent output caches
without accumulating deformations.
2015-04-14 11:06:14 +02:00
da2bf129a4 Ignore the display/render settings of the cachelibrary when doing
simulations.

Otherwise the child strands and/or motion state can be missing and lead
to incomplete output caches.
2015-04-14 11:06:14 +02:00
Julian Eisel
1bccbbc04c Merge branch 'master' into gooseberry 2015-04-13 20:36:07 +02:00
7c28ee9c4a Merge branch 'master' into gooseberry 2015-04-13 18:38:21 +02:00
4c4673ce7f Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-04-13 19:18:27 +05:00
1f75229237 Merge branch 'master' into gooseberry 2015-04-13 15:58:18 +02:00
04d9e28621 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-04-13 14:31:36 +02:00
eeb3ccad48 Merge branch 'alembic' into gooseberry 2015-04-13 15:49:45 +05:00
7de6ed780d Alembic: Fix compilation error with alembic disabled
Was a mismatch in stub factory methods, presumably after some recent
changes in hair/strands.
2015-04-13 15:48:47 +05:00
bfb8788b64 Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-12 14:41:34 +02:00
bf34249912 Fix for broken and messy particle time values to get consistent caches.
Particles use 0..100 range for parent particle "times" (curve parameter)
and 0..1 for children. For caches this is now uniformly calculated in
the 0..1 range to avoid breaking child interpolation.
2015-04-12 14:39:03 +02:00
8f6fd382a1 Used the mass parameter for hair simulation. 2015-04-11 21:51:44 +02:00
3ad7e5c1f2 Optional force and jacobian return values from angular bending springs,
for occasional debugging.
2015-04-11 21:50:03 +02:00
d0de201abd Merge branch 'alembic' into gooseberry 2015-04-11 17:32:38 +02:00
3c817d664e Fix for install_deps script: declare "skip-alembic" as a formal
parameter or it won't be parsed at all.
2015-04-11 17:31:20 +02:00
0ffe8be5e9 Fix for missing function argument commented out during cleanup. 2015-04-11 14:04:03 +02:00
9210f39112 Child strand deformation based on parent motion states when reading from
caches.

This allows child strands to follow the motion of parent strands as
calculated by the hair simulation. Unlike the particle system path
caching, this method does not regenerate all the children every frame.
Instead, it relies on an initial child setup that defines the base
shape, then applies the parent motion as a weighted linear deformation.

The result is in fact the same as with regular particle clumping, kink,
roughness etc.. Particles also take care to not change the child shape
when the parent moves, but this is not formalized anywhere (which makes
changing particle code quite difficult). So ignoring the particle code
is both permissible and efficient.
2015-04-11 12:44:01 +02:00
7d520f64a6 Fix for stupid particle times.
Normalize particle 'time' values to 0..1 range when writing to cache,
anything else is useless.
2015-04-11 12:38:23 +02:00
ac6038e991 Cycles: free mesh BVH after packing the scene BVH
The idea is to avoid having original BVH and BVH packed into scene BVH and hence
reduce memory footprint.

This change doesn't give any measurable differences on it's own, but together
with D1215 and D1217 it gives quite nice results.

Reviewers: campbellbarton, brecht, juicyfruit

Subscribers: eyecandy

Differential Revision: https://developer.blender.org/D1218
2015-04-10 23:20:34 +05:00
90c18b422d Cycles: Synchronize images after building mesh BVH
This way memory overhead caused by the BVH building is not so visible and peak
memory usage will be reduced.

Implementing this idea is not so straightforward actually, because we need to
synchronize images used for true displacement before meshes. Detecting whether
image is used for true displacement is not so striaghtforward, so for now all
all displacement types will synchronize images used for them.

Such change brings memory usage from 4.1G to 4.0G with the 01_01_01_D scene
from gooseberry. With 01_01_01_G scene it's 7.6G vs. 6.8G (before and after
the patch).

Reviewers: campbellbarton, juicyfruit, brecht

Subscribers: eyecandy

Differential Revision: https://developer.blender.org/D1217
2015-04-10 23:19:38 +05:00
a13952e84e Merge branch 'cycles_memory_experiments' into gooseberry
Conflicts:
	intern/cycles/blender/blender_sync.h
2015-04-10 20:56:44 +05:00
45ea4c8dbe Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-10 17:56:01 +02:00
bf2856c758 Cycles: Experiment with culling objects based on the camera frustum
The idea is to give artists a simplier way to control memory usage in such
scenes as grass fields by doing automatic object culling based on whether
they're visible in the frame or not.

This is controlled on per-object level. In order to use this option few
steps are required:

- Allow renderer to use camera culling (Performance panel of render settings)
- Set camera cull margin (measured in relative value to the render resolution)
- Enable Camera Cull for objects which are desired to be culled
  (object culling option could be found in Option panel in object buttons).

Interface decisions are not final for sure and to be refined if this
option is considered good enough for production.

Reviewers: juicyfruit, brecht, campbellbarton

Subscribers: venomgfx, eyecandy

Differential Revision: https://developer.blender.org/D1230
2015-04-10 20:55:44 +05:00
d0276014f9 Small fix for uninitialized variable (currently unused). 2015-04-10 13:53:20 +02:00
5ca4b182eb Implemented alembic archive info as a stream callback and disabled
popup and clipboard output.

For a production-size archive the info string can become really large,
and putting it into a buffer takes a long time. As a debugging tool the
stdout printing is sufficient for now and can be done as a stringstream.
2015-04-10 13:48:46 +02:00
0d2826d86b Merge branch 'master' into gooseberry 2015-04-10 13:06:00 +02:00
c2d6d6d824 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/drawvolume.c
2015-04-10 12:47:50 +02:00
a6b9fc6f22 Use depsgraph tagging and notifiers to enforce dupli cache updates
in the viewport.
2015-04-10 12:34:25 +02:00
b3faf5a4ea Explicit flags for toggling motion (from simulation) and child strands
in both display and render of caches.
2015-04-10 11:55:09 +02:00
702ae54436 External forces in strand hair simulation.
Arbitrary wind force "density" factor has been moved out of the force
function now, so cloth simulation can do this on it's own without
affecting the strand sim.
2015-04-10 10:03:48 +02:00
bb043dbef3 Goal springs for cached strand simulation.
In addition to the original particle hair sim settings the parameters
for strand sim have a curve to define the strength of goal springs along
strands. This useful because currently there is no way to override the
weights of strands. This would require a new particle edit mode that can
work with non-particle data in a sane way ...
2015-04-10 09:15:11 +02:00
59940c3b68 Disable the UI for drawing objects of cache libraries.
This takes an arbitrarily large amount of space in the UI and does
currently not have a good purpose.

Eventually this information could be displayed in a dedicated part of
the UI, with proper scrolling.
2015-04-09 21:10:00 +02:00
6abb0eaa8a Added visibility attribute for dupli objects in Alembic caches.
This combines the DupliObject.no_draw flag with the instanced object's
visibility.
2015-04-09 18:50:26 +02:00
ee110680fd Merge branch 'master' into gooseberry 2015-04-09 18:30:40 +02:00
8c34de9918 Fix for potential memory corruption in selection drawing code.
This code works much like the main object drawing code and has to take
the same precautions regarding replacing the derivedFinal pointer in
Objects. This pointer may be replaced during drawing calls, regardless
of the "ownership" indicated by needsFree.
2015-04-09 17:34:41 +02:00
3a38ba68c6 Check for empty schemas more consistently before trying to read.
Reading from an empty object in Alembic will throw an exception, which
is not easily handled yet. So rather avoid annoying crashes the clumsy
way for now.
2015-04-09 15:35:04 +02:00
871a29eeac Writer for child strand data.
Cache chains now support child strands too, instead of dropping
child data when writing out from strand data.
2015-04-09 14:45:16 +02:00
73796bb884 Merge branch 'alembic' into gooseberry 2015-04-09 13:06:47 +02:00
e6f41832c0 Extra changes to make strict flags happy 2015-04-09 15:51:02 +05:00
216a0993cd Merge branch 'master' into gooseberry 2015-04-09 12:49:45 +02:00
6ee460f299 Fix compilation with strict compiler flags 2015-04-09 15:47:13 +05:00
bfe9fc218d Extended Cycles to support both parent and child strands.
The code for syncing Strands and StrandsChildren data to Cycles curves
is almost identical, so to avoid code duplication a little templated
traits type has been defined, which provides the appropriate accessors
for both cases. This is very local and should not be too confusing.
2015-04-09 12:11:37 +02:00
cf1f78cc40 Cache reader for child strands.
This creates child strands along with the parents. These are not yet
deformed by parents or simulation, and are also not written back into
subsequent caches yet.
2015-04-09 10:44:32 +02:00
c8a7cd4266 Store child strand curves alongside the parent strands in dupli object
data.

Child strands have their own struct type for vertices and curves to
avoid unnecessary overhead (parent curves store a full 3x3 matrix after
all).

Child strands may be constructed from particle pathcaches, or read from
curves data in alembic files.
2015-04-09 09:57:20 +02:00
6142df649f Nominal support for UVs and Vcols with cached strand data.
These are dummy values currently. The UV and vcol values will be stored
in strands directly, unlike particles which evaluate them every time;
this is a much safer and more efficient approach that makes strand data
truely independent from the "emitter" mesh. Such data will be made
available later, primarily for child curves.
2015-04-09 09:03:54 +02:00
6564405d61 Merge branch 'alembic' into gooseberry 2015-04-08 22:36:41 +02:00
8699a0ba77 Fix for object matrix sampling with the default 1-second rate. 2015-04-08 22:35:38 +02:00
70c588bc3f Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-08 22:03:23 +02:00
d1c7efd73f Applying the inverse object transform for strand data is not necessary.
Particle pathcache data is in world space, but strands are stored in
object space already.
2015-04-08 20:02:42 +02:00
e0b9f82dcb Basic cache overrides for strand render data in Cycles.
Still buggy, but the basic workflow is there:
When a cache library is used in conjunction with a group duplicator and
it has strands that match the particle systems, Cycles will use the
new Strands structure to construct its internal curves.
2015-04-08 19:19:01 +02:00
d65c48e9a8 DNA file for strands types.
This is not strictly needed because the strands data is only created
at runtime at this point. However, it might be useful to later include
this in blend files.

Also the C++ RNA API has a bug that makes non-DNA collection properties
difficult (the length function is not implemented properly).
2015-04-08 18:49:18 +02:00
780d257e6e Merge branch 'master' into gooseberry 2015-04-08 20:21:02 +05:00
Julian Eisel
82a4d19a6b Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/ED_transform.h
	source/blender/windowmanager/intern/wm_operators.c
2015-04-08 16:32:22 +02:00
Julian Eisel
715c57f3b0 Merge branch 'master' into gooseberry 2015-04-08 16:27:31 +02:00
38269a93c2 Yet another writer class for storing child strand data generated by
particles.

This is currently the same as the ParticlePathcache writer class, but
will be modified somewhat later to store additional information such as
parent weights. The purpose of this cache object is not to populate the
particle child caches, but to store renderable data associated to dupli
cache strands.
2015-04-08 13:45:13 +02:00
aee5f39e10 Child strands structure for storing renderable child hairs efficiently.
This is a separate struct to avoid storing unnecessary data (this means
a bit of code duplication for iterators). The child strands can be used
as the actual render data, while the parent strands usually would be
used only for simulation/deformation purposes.
2015-04-08 13:43:01 +02:00
d4c002d537 Merge branch 'master' into gooseberry 2015-04-08 12:50:39 +02:00
079f1aa64a Bending forces in strand hair simulation. 2015-04-08 11:44:37 +02:00
bdeb9cd7ea Store root orientation matrix in strand curves as well as caches.
This matrix is needed to create a stable and smooth coordinate system
along the strands, for things such as bending forces and child hair
deformation. The base matrix is defined on the "scalp" mesh and should
be stable wrt. deformation and animation of the mesh. For any point on
the strand a matrix is then calculated using parallel transport, i.e.
by rotating the base matrix successively along each curve corner.
2015-04-07 19:16:30 +02:00
676f742a6c Yet another iterator for looping over strands, this time for triples
of consecutive vertices ("bends").

This will be useful for calculating bending forces, without making basic
iteration a big headache.
2015-04-07 18:17:21 +02:00
d5be72b05f Nicer iterator for looping over strand edges directly.
Avoids the ugly construct with vertex iterators that have to drag an
extra 'prev' iterator along.
2015-04-07 18:12:04 +02:00
41447d212b Use the dupli object's obmat for world space simulation.
The overall world space matrix for dupli sims has to be the combined
obmat of the cached object as well as the duplicator for the dupligroup
instance. The cached strand data is generally in object space, so the
matrix has to be applied to get all the forces and interactions right.
2015-04-07 17:45:09 +02:00
ce47924c7e World transform for simulation of caches.
This compensates the transformation of the dupli instance being cached,
so that forces such as gravity are in the correct reference frame.

Note that this does not yet generate fictitious forces resulting from
a moving and/or accelerated frame of reference. For this we would also
have to calculate linear/angular velocity and acceleration of the dupli
object.
2015-04-07 17:22:45 +02:00
1873771940 Make sure the frame values for cache modifier evaluation are initialized
correctly.

Also skip empty frames in hair simulation (this includes the first
frame).
2015-04-07 16:37:57 +02:00
c29d7a2c2b Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-04-07 16:17:16 +02:00
e4f37a50ca Small fix for smoke display thickness, setting was not initialized for
new smoke domains.
2015-04-07 16:14:09 +02:00
2ab422506b Thickness setting for smoke drawing in the OpenGL viewport.
This is the first actual drawing/display setting for smoke, so a new
panel "Display" has been added to give it a home in the UI.

The name "thickness" has been chosen deliberately to distinguish it from
density, since the parameter only affects OpenGL drawing but not the
actual physical density values.
2015-04-07 16:00:20 +02:00
c253ef851c Use matching defaults and ranges in RNA/BKE for hairsim parameters. 2015-04-07 14:51:31 +02:00
59d236c21d Unused line, the strand array offset is provided by the iterator now. 2015-04-07 14:46:08 +02:00
4fdda03150 Better defaults for stretch stiffness and damping.
The strong stretch forces lead to awkward lengthening of segments when
the damping factor is too high.

In fact, in a natural hair strand the stretching usually means the hair
itself is curly and stretches as a helical spring. In that case
the damping is quite small compared to the stiffness, and little energy
is lost to the stretching (the hair becomes "bouncy"). When the hair is
very stiff the damping should also be small in order to avoid extreme
forces resulting from the hair root location constraint.
2015-04-07 14:41:48 +02:00
e5a47562eb Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/image.c
	source/blender/blenkernel/intern/object_dupli.c
	source/blender/blenkernel/intern/sequencer.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/editors/space_view3d/view3d_ops.c
	source/blender/makesdna/DNA_sequence_types.h
	source/blender/makesdna/DNA_view3d_types.h
	source/blender/windowmanager/CMakeLists.txt
	source/blender/windowmanager/intern/wm_operators.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
2015-04-07 14:19:16 +02:00
648dbb23f9 Fix for stretch forces being defined wrt. the root vertex.
Was not advancing the iterator for the previous vertex correctly.
2015-04-07 12:56:36 +02:00
1ab8999f14 Moved root animation calculation into the solver code.
The solver can calculate the de-facto velocity of the root using the
difference of the already-updated vertex location and the state from the
previous step.
2015-04-07 12:26:52 +02:00
8b9d5fd1eb Fix for simdebug data cache reading.
Data pointers were not advanced, so only the first debug element would
show up properly.
2015-04-07 12:09:46 +02:00
dc6d51c555 Take strand bounds into account when calculating bounding boxes for
dupli overrides.
2015-04-07 11:17:19 +02:00
f24153bcbc Apply sim debug data from caches back to the global hash table.
Note that this is quite messy atm, it will override debug data if
different caches are used, and does not discriminate when writing to
caches either.
2015-04-05 17:10:14 +02:00
8c055802a2 Write out sim debug data along with dupli caches, if the global sim
debug flag is enabled.
2015-04-05 16:02:41 +02:00
7ffdbecdbf Merge branch 'cycles_point_density' into gooseberry 2015-04-05 15:04:31 +02:00
c324136028 Fix for undefined psmd field in when evaluating particle textures. 2015-04-05 15:03:56 +02:00
a4bc9cd0bd SimDebugData writer/reader for Alembic caches.
This will allow debug visualization data to be stored inside caches
along the actual simulation state.

While the regular simulation allows examining simulation data on-the-fly
by stepping through the regular timeline, the new baking mechanism used
for caches does not easily allow simulation data to be visualized frame
by frame. Caching this data will allow adding it to the global sim debug
data.

This would also still be very handy if the baking process itself becomes
more interactive again. Unlike the current simulation progression, the
cached data can be accessed randomly, so scrubbing throught the timeline
becomes possible.
2015-04-05 14:47:56 +02:00
04d604648a Fixed unused parameter warnings in Alembic customdata code. 2015-04-05 11:54:43 +02:00
2681b66c1d Merge branch 'cycles_point_density' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/particle.c
	source/blender/editors/space_view3d/drawobject.c
	source/blender/makesdna/DNA_particle_types.h
	source/blender/makesdna/DNA_texture_types.h
	source/blender/makesrna/intern/rna_particle.c
2015-04-04 14:30:54 +02:00
bd503353bb Support for particle texture color in point density textures.
This works for all pointdensity use cases, BI as well as Cycles.
2015-04-04 14:23:14 +02:00
aa43c13c3e Particle color influence option for particle textures.
This color is currently only displayed in the viewport (when enabling
"Texture" color mode in the Display settings). It will be used for
controlling the smoke color when using particles for smoke emission.

Conflicts:
	source/blender/blenkernel/intern/particle.c
	source/blender/editors/space_view3d/drawobject.c
	source/blender/makesdna/DNA_particle_types.h
	source/blender/makesdna/DNA_texture_types.h
	source/blender/makesrna/intern/rna_particle.c
2015-04-04 13:35:48 +02:00
11cb027ac4 Merge branch 'cycles_point_density' into gooseberry 2015-04-03 19:57:19 +02:00
f48e3cf6bf Color support for point density texture in Cycles.
This extends the point density evaluation to also store RGB color values
in the array provided by Cycles.

Since internally all Cycles textures are 4-float RGBA textures anyway,
it does not make a lot of sense to store density and color separately.
This could eventually be preferable to avoid unnecessary storage.
2015-04-03 19:49:02 +02:00
3c5be38c9f Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-04-03 17:32:46 +02:00
3cbdb31255 Added the major parameters for the hair simulation.
This is basically copied from existing cloth sim settings, with a good
deal of cleanup and sanitization.

Unlike cloth parameters, the damping values are described as relative
to their associated stiffness values for springs. This is much easier
to use in practice and less prone to lead to unstable simulations.
Damping simply works best when the force is in the same order of
magnitude as the stiffness, so having a relative factor requires much
less adjustment on the user side.
2015-04-03 15:18:52 +02:00
0ab2bb586e Added effector weights for cache hair simulation. 2015-04-03 14:20:33 +02:00
93c49605fd RNA for modifier struct subtypes.
Also renamed StrandSimParams to HairSimParams, since strands are only
the agnostic data structure, while these parameters are specifically
used to simulate hair-like behavior. Other simulations could use strands
but implement completely different kinds of physics (e.g. grass, ropes).
2015-04-03 14:18:46 +02:00
49890a8119 Smaller strips not working for files with sequencer 2015-04-03 14:13:41 +02:00
1550f092ba "Structural" spring forces for strands.
These connect strand points to ensure constant length and form the main
spring system in strand simulation.

Note that parameters are still hardcoded.
2015-04-03 12:32:50 +02:00
bff8ea5cd7 Fix unfreed motion state memory when freeing strand data. 2015-04-03 12:04:40 +02:00
f1234c6335 Scalp animation support: copy strand root locations from the rest pose
before performing a time step.
2015-04-03 12:00:36 +02:00
3509cb3c60 Pinning for strand roots.
Note that roots are currently not animated.
2015-04-03 11:38:34 +02:00
f0ea8a19c1 Use FPS value to sync the strand simulation time with the render time.
Additionally the time can be scaled using the timescale parameter.
2015-04-03 11:28:15 +02:00
f19a416b36 Correct progression handling of the strands motion state through cache
baking.

For now this simply applies gravity and applies the basic hair solver
for velocities and positions.
2015-04-03 11:21:40 +02:00
1e8b62476b Make mattieu happy - allow smaller strips vertically.
Allows mattieu's masterplan to keep overdrop at higher sequencer space
and all strips lower.

This won't align text so well though, but will leave it simple and he
can give feedback later.
2015-04-02 20:54:17 +02:00
38d8abb3c3 Cycles point density: Fix using double semicolon at the end of line 2015-04-02 22:35:36 +05:00
5156c283dd Fix for wrong pointer used in the modifier cache copy function. 2015-04-02 16:39:10 +02:00
a6998f132a Force calculation function for strands (only gravity atm). 2015-04-02 15:03:06 +02:00
6c832657cc Sanity check and nicer substep loop for strands simulation. 2015-04-02 13:57:34 +02:00
daca75d8e1 Fixed writing code for cache modifiers to include extra DNA fields of
subtypes.
2015-04-02 13:54:08 +02:00
366fc83f6d Fixed DupliCache writers/readers to support subsequent stages of
cache manipulation.

Strand data in caches is now stored in a named list, so we can avoid
adding strand data in every frame.
2015-04-02 13:36:50 +02:00
335b495196 Merge branch 'master' into gooseberry 2015-04-02 12:37:22 +02:00
274bb10a36 Merge branch 'master' into gooseberry 2015-04-02 21:30:10 +11:00
f0e8334d1a Merge branch 'master' into alembic 2015-04-02 21:24:57 +11:00
049dec083a cleanup: warning 2015-04-02 21:24:50 +11:00
ebf079c004 Disallow deleting of files by the point cache in the clear function.
This function is used in every part of the code, and has been causing
great pain when deleting 15 hours worth of baking in an instant.
The complexity of the code makes it unfeasible to fix this selectively,
so for now simply disallow the code from deleting any of the files.

For selected well-defined cases the deleting can be reenabled later,
e.g. when the user presses the `Bake` button and confirms deletion in
a popup.
2015-04-02 11:04:36 +02:00
9cfe6aae91 Removed unused BKE_ptcache_remove function, one less potential place
where cache files might get deleted.
2015-04-02 11:04:36 +02:00
615c57ec31 Clear duplilist instances when reading from a dupli cache, to avoid
generating a new dupli instance on every frame.
2015-04-01 20:31:28 +02:00
e0d90141b0 Made the duplicache clear function public.
It's a common operation that may be useful later, no reason to keep this
hidden.
2015-04-01 20:27:01 +02:00
644b68ac6e Basic strand processing in the hair sim cache modifier. 2015-04-01 20:03:46 +02:00
Julian Eisel
55280eecad Revert "Always display full data paths in tooltips"
Seems like there is currently now way to get the full data path
reliably. So instead of the old "..." this patch just displays
(null) which also isn't really useful.
2015-04-01 16:46:27 +02:00
83e8b3a51e Clean up vertex/normal client state after drawing strands.
This should hopefully prevent some random crashes.
2015-04-01 16:11:57 +02:00
Julian Eisel
30d72d682a Always display full data paths in tooltips
Another experiment for gooseberry. We should make Blender smarter
here in general, but it's a start.
2015-04-01 15:57:21 +02:00
Julian Eisel
5baff6246f Reorganized RMB menu and new entry "Copy Full Data Path"
D763 ready for testing from the sheepy people.
2015-04-01 13:41:38 +02:00
30ea4349c9 Merge branch 'alembic' into gooseberry 2015-04-01 13:08:30 +02:00
295b28c7b1 Clean up: Avoid unused variable warnings. 2015-04-01 13:07:38 +02:00
afddaf1188 Added missing stub function when Alembic is disabled. 2015-04-01 13:02:25 +02:00
aa9f8d32fd Merge branch 'alembic' into gooseberry 2015-04-01 12:32:29 +02:00
f428fcd23d Merge branch 'cycles_point_density' into gooseberry 2015-04-01 15:31:52 +05:00
99b10373db Cycles point density: Particle state coordinates are actually in the world space
Code was assuming they're in the object space which caused wrong
texture sampling and translation to the world location.
2015-04-01 15:30:56 +05:00
08e39a5bfb Override the init function for DupliObjectReader, so Cycles gets the
cache result when constructing render meshes.
2015-04-01 12:21:41 +02:00
6b4ea6da17 Merge branch 'cycles_point_density' into gooseberry 2015-04-01 14:38:39 +05:00
49a608aaec Cycles point density: Fix crash when source object is not set 2015-04-01 14:37:34 +05:00
9c269243db Added writers for DupliCache data to allow truely successive cache
modification.

The bake operator will now generate output based on the 'source_mode'
setting:
* When the source is SCENE it uses the basic object data as stored in
  the Object ID datablocks (DerivedMesh, particle hair strands etc.)
* When the source is CACHE it fills a temporary DupliCache with data
  from the cache archive (like it would for the display dupli_cache,
  but also supporting render data). This dupli cache is carried over
  between frames during baking, which allows modifiers to act as
  simulations and sequentially advance motion states.
2015-04-01 11:31:41 +02:00
23447ce3b9 Merge branch 'master' into gooseberry 2015-04-01 11:25:25 +02:00
dc172108f2 Merge branch 'master' into cycles_point_density 2015-04-01 14:23:02 +05:00
9e39cfe16d Merge branch 'alembic' into gooseberry 2015-04-01 10:01:25 +02:00
8ac00ec76a Merge branch 'cycles_point_density' into gooseberry 2015-03-31 22:36:50 +05:00
22fa9d3448 Fix compilation error of blender player 2015-03-31 22:36:12 +05:00
83620641d2 Merge branch 'master' into gooseberry 2015-03-31 22:23:10 +05:00
d391ab8d4a GHash iterator wrapper for DupliCache, so cache modifiers can access
all components in the cache.
2015-03-31 18:46:01 +02:00
f8e623e0b8 Removed unused "object cache" iterator code. 2015-03-31 18:12:10 +02:00
806a338090 Merge branch 'cycles_point_density' into gooseberry 2015-03-31 21:10:52 +05:00
1d32a23c78 Added transient DupliCache data baking modifiers/simulations and
writing into the output cache archive.
2015-03-31 18:06:48 +02:00
3c0e15c81a Merge branch 'alembic' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/view3d_intern.h
	source/blender/makesrna/intern/rna_modifier.c
2015-03-31 17:49:54 +02:00
866537d001 Removed the Cache modifier because it is unused now and causes some
merge conflicts with master.
2015-03-31 17:44:05 +02:00
3c6c33be98 Merge branch 'master' into alembic
Conflicts:
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/space_view3d/view3d_intern.h
	source/blender/makesdna/DNA_modifier_types.h
	source/blender/makesrna/intern/rna_modifier.c
	source/blender/modifiers/MOD_modifiertypes.h
	source/blender/modifiers/intern/MOD_util.c
2015-03-31 16:59:19 +02:00
c8b831d742 Cycles: Point density texture experiment
This commit implements point density texture for Cycles shading nodes.

It's done via creating voxel texture at shader compilation time, Not
totally memory efficient, but avoids adding sampling code to kernel
(which keeps render time as low as possible), In the future this will
be compensated by using OpenVDB for more efficient storage of sparse
volume data.

Sampling of the voxel texture is happening at blender side and the
same code is used as for Blender Internal's renderer.

This texture is controlled by only object, particle system and radius.
Linear falloff is used and there's no turbulence. This is because
falloff is expected to happen using Curve Mapping node. Turbulence
will be done as a distortion on the input coordinate. It's already
possible to fake it using nose textures and in the future we can add
more proper turbulence distortion node, which then could also be used
for 2D texture mapping.

OSL is not currently supported. There's no actual stoppers for support
it, but so far it's not really a priority at this point.

Reviewers: campbellbarton, juicyfruit, brecht

Subscribers: campbellbarton, dingto, eyecandy

Differential Revision: https://developer.blender.org/D1208
2015-03-31 19:52:48 +05:00
54c2e625e5 Removed the redundant cache exporter class from the pointcache lib.
Writing in C++ is a little bit more convenient, but this functionality
does not require the additional level of complexity.
2015-03-31 14:25:10 +02:00
6bcc28b8ab Support for shading "normals" in strand rendering.
Note that the fixed-function OpenGL pipeline does not support true
strand normals. The shading model used copies the method implemented for
particles, using the edge directions as normals. This is totally
unphysical but at least gives some indication of direction. Viewport
refactor and programmable shaders are needed to make this work nicer.
2015-03-31 12:21:49 +02:00
297563286e Store the overall result of cache reading in the DupliCache.
This is used to prevent empty dupli lists when reading the cache fails.
In that case the duplilist function will now revert to default scene
evaluation.
2015-03-31 11:49:41 +02:00
1700c4c6fb Extend the cache reading function to take the result archive into account. 2015-03-31 11:26:17 +02:00
fc1d50f1e7 Reorganization of file paths and input/output workflow in cache
libraries.

Having a cache archive output in each modifier is not really practical.

Now the cache library has at most 2 file paths. These are used based on
2 associated settings: source mode/path and display mode/path.

* The SOURCE mode determines whether the original scene data is used as
input or a cache archive. If the scene input is used the dupli group
objects will be evaluated as usual with Mesh data, modifiers, proxy
armatures, etc.. With cache input the data stored in a cache is used to
override the scene data instead.
* The DISPLAY mode is essentially a toggle for the whole cache modifier
stack. If it is set to 'source' the respective source data is used
without further modification. If set to 'result' the data from the
output cache archive is used, which can be generated using the bake
operator. During baking the data will be passed through the cache
modifiers to create a variation of the original source data.
2015-03-31 10:33:33 +02:00
1740fedb64 Merge branch 'master' into gooseberry 2015-03-31 00:27:22 +05:00
b1a8b9806b Simplification of the cache library filtering mechanism.
Now the filtering is simply based on the data types that should go into
the cache, instead of selecting each object and component individually.

This is slightly more limited and may need to be revisited again later,
but for the time being it is much less confusing and clumsy. Filtering
by objects can be accomplished by creating groups accordingly. Making
groups specifically for caching is totally acceptable.
2015-03-30 18:43:31 +02:00
6d0fe090c2 Merge branch 'alembic' into gooseberry 2015-03-30 18:36:17 +02:00
3a5cd5f4d4 Fix for crash on dupli drawing, due to check of ob.transflag after it
is already restored.
2015-03-30 18:34:10 +02:00
2a032a2f6e Merge branch 'alembic' into gooseberry 2015-03-30 14:16:03 +02:00
3b4d464d1a Fix for crashes when changing draw types that affect dupli objects.
The draw code was restoring the derivedFinal mesh unconditionally after
drawing duplis. However, the drawing code can in some cases replace the
derivedFinal pointer during drawing (bad!). This then leads to invalid
pointer access.

Fix is to only touch the derivedFinal when it's actually a dupli cache
mesh.
2015-03-30 14:11:58 +02:00
0255e37a3d Merge branch 'alembic' into gooseberry 2015-03-30 12:42:54 +02:00
e0cf04c6d4 cachelibrary.modifier_bake operator has been removed in favor of
`cachelibrary.bake`.
2015-03-30 12:41:29 +02:00
892644a44c Preliminary fix for bad level calls to WM job functions from BKE.
The job invocation should happen only in editors/. Also it makes sense
to modify the bake operator such that it supports both the basic cache
library and an optional modifier output.

The design for this area is in progress anyway, probably the cache
library archive paths will be changed so that there is always one input
and optionally an output path, with all the modifiers working in
sequence.
2015-03-30 12:39:06 +02:00
ccb51e6db4 Removed unused code for ill-defined "cache objects".
The cache libraries now work based on dupli objects instead of
recursive group content, so this concept is no longer needed.
2015-03-30 12:39:06 +02:00
297bbc316a Simplified functions for generating absolute file paths from the base
cache library and modifiers.
2015-03-30 12:39:06 +02:00
2a12013600 Sanity check: motion state data in curves is optional. 2015-03-30 12:39:06 +02:00
aff4e02df2 Write out the complete dupli group in cache modifiers.
Theoretically we could write a stitcher that writes only the parts of
the data affected by a modifier and simply copies the rest, but this
is much more involved and not necessary at this point.
2015-03-30 12:39:06 +02:00
d694058fcf Merge branch 'master' into gooseberry 2015-03-30 15:07:24 +05:00
df714d0144 Merge branch 'alembic' into gooseberry 2015-03-30 14:15:19 +05:00
66e6fe54ac Merge branch 'master' into gooseberry 2015-03-30 14:00:28 +05:00
d7ddffdcce Merge branch 'master' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/properties_physics_smoke.py
	source/blender/editors/include/ED_transform.h
	source/blender/editors/space_view3d/view3d_intern.h
2015-03-30 13:50:59 +05:00
f1f51c07f4 Alebic: Fix compilation error of blenderplayer target on buildbot 2015-03-30 13:43:14 +05:00
803ff1a2f9 Writer for strand data and extension for the new motion state data.
Unlike the particle hair writer this one does not work with the particle
system data but the new Strands data. This will allow successive
manipulations of cached hair data by first storing the initial particle
grooming data ("hair edit"), read this data from the cache into a
Strands instance, then apply hair simulation and write the result back
into a second Strands cache.
2015-03-29 20:25:40 +02:00
a54ce3d26a Added optional motion state data to Strands.
This implements the distinction between the strand goal position
(grooming data, shape keys) and the result of dynamics simulation.
2015-03-29 20:23:54 +02:00
cf7b4e3054 Baking API for cache modifiers.
Cache baking means the cache modifier should read input caches over the
given frame range and produce the correct output for writing into the
output cache file.

Cache modifiers can optionally implement a 'bake' function. This is used
through a bake operator from the cache modifier panel. Baking is
executed in a job, which will help with cancelling bakes and displaying
status info.
2015-03-29 18:23:11 +02:00
a5180abde0 Merge branch 'alembic' into gooseberry 2015-03-27 17:27:11 +01:00
5fb18b1e00 Avoid clearing the record of cached frames when doing particle trails.
This is implemented badly: when using disk caches i reads the *entire*
cache from the disk to create the trail. In the process it also clears
the cached_frames array, which makes it look like the cache was deleted.
2015-03-27 14:55:25 +01:00
a93d4da344 Merge branch 'master' into gooseberry 2015-03-27 11:39:53 +01:00
e9df0e53d1 Use the last valid cache modifier output file for reading into the
dupli cache.

This makes the cache modifier stack work more like actual modifiers:
Each will take the previous result and write it into its own output
file. The last output is the final result used for viewport display.
2015-03-27 11:20:55 +01:00
89ea3e73ee New modifier system for cache libraries.
This system imitates the modifier stack for mesh objects. It will be
used to handle simulations and similar processing of cached data.
2015-03-27 11:20:55 +01:00
49cf27d39e Smoke sim option for emitting color based on particle textures.
When using a particle inflow object, there is now an option "Set Color"
which uses particle texture color to override the uniform smoke emission
color.

Particles must have one or more textures with the "Color" influence
enabled (the resulting color can be visualized in the viewport using the
"Texture" display option). The color will then replace the default smoke
flow setting and allows variable color per particle.

Combined with "Strand/Particle" texture mapping this can also be used
to change the particle emission color over the lifetime of particles or
make variable colors for each particle in the system.

Note that this currently does not work with child particles.
2015-03-27 10:36:48 +01:00
db92aac478 Particle color influence option for particle textures.
This color is currently only displayed in the viewport (when enabling
"Texture" color mode in the Display settings). It will be used for
controlling the smoke color when using particles for smoke emission.
2015-03-27 10:36:48 +01:00
3dd78fc48f quiet warnings (increase int size for bitshift) 2015-03-27 04:32:08 +11:00
ef7755bacb Merge branch 'master' into gooseberry 2015-03-26 17:54:47 +01:00
8362dd7c36 Cleanup: style 2015-03-27 03:40:10 +11:00
207bccef45 Merge branch 'master' into alembic 2015-03-27 03:27:11 +11:00
a4a74ca143 Merge branch 'alembic' into gooseberry 2015-03-26 14:55:15 +01:00
7a9492db9f Merge branch 'master' into gooseberry 2015-03-26 14:50:50 +01:00
567b78944e Minor naming conflict fix. 2015-03-26 14:45:32 +01:00
06f1b66175 Alembic: correct last commit 2015-03-26 14:13:43 +01:00
0a9b21b76c Alembic: cleanup warnings 2015-03-26 14:13:43 +01:00
def2be6be5 Alembic: expose CMake var ALEMBIC_INCLUDE_DIR
The include path could be cached to a stale value, with no obvious way to reset.
2015-03-26 14:13:43 +01:00
fb2b9ea3b4 Customdata caching for CD_ORIGSPACE_MLOOP. 2015-03-26 14:13:43 +01:00
786af9d7d9 Customdata caching for CD_ORCO. 2015-03-26 14:13:43 +01:00
475a6bdb36 Basic drawing code for strands loaded from caches.
This is entirely separate from particle systems and their insane
drawing function.
2015-03-26 14:13:43 +01:00
ecc28ae46d Simplified data structure and reading code for strands in Alembic
caches.
2015-03-26 14:13:43 +01:00
ec4e32fdea Fix wrong time sampling in customdata array properties.
The time sampling should be specified explicitly when creating
properties.
2015-03-26 14:13:43 +01:00
a0697b9b0f Explicit CD type masks for each element.
Avoid storing redundant normals for vertices.
2015-03-26 14:13:43 +01:00
64f1532f55 Fix for crash when deleting an object that was used in a dupli cache.
Object-unlink was clearing the linked object's dupli cache instead of
the duplicator.
2015-03-26 14:13:43 +01:00
aa8c33e6ab Make sure normals are correct before writing mesh data to caches.
Normal data layers might not be updated during cache baking
automatically.
2015-03-26 14:13:43 +01:00
b8d7b55726 New data structure for restoring strand data originating from particles.
The rationale here is that we don't try to replace particle data
temporarily like we do with DerivedMesh. This would be needed for
drawing cached data overrides in the viewport and pass them to renderers
(unless these read Alembic directly) and later for performing dupli
simulation.
2015-03-26 14:13:43 +01:00
abcdb0f7e4 Renamed the cache_dm to simply dm.
The fact that this is used for caching is only apparent on the higher
levels of the Object struct.
2015-03-26 14:13:43 +01:00
4dc7114e43 Write basic hair curves to caches for dupli groups.
This data will be used for dupli simulations later on. Child path
generation could also be done based on this data without involvement of
particle systems.
2015-03-26 14:13:42 +01:00
44d1c19f82 More compact sample writing code for particle pathcache caching. 2015-03-26 14:13:42 +01:00
962739281e Make the nested DM writer in Object writers a pointer, instead of using
the do_mesh flag.

This will be more in line with how optional particle system writer will
be created.
2015-03-26 14:13:42 +01:00
2a10d77a22 Revert "Avoid conflicting unordered_map definition in cycles"
This seems to break windows builds and should not be necessary.

This reverts commit 12384d564f.
2015-03-26 14:13:42 +01:00
2eaf0fd723 Fix for use of non-portable function snprintf. 2015-03-26 14:13:42 +01:00
44b516fa6a Fix for use of unknown uint type instead of unsigned int. 2015-03-26 14:13:42 +01:00
b2a004ddaf Use a stub factory when Alembic is disabled to avoid invalid pointer
access.
2015-03-26 14:13:42 +01:00
590fa47360 Fix for linking order in scons preventing correct initialization of
the Alembic caching implementation.
2015-03-26 14:13:42 +01:00
e715de6394 Added Alembic dependency config to the linux x86_64 player buildbot file. 2015-03-26 14:13:42 +01:00
f354fa56b5 Fix for bf_pointcache lib missing in the blenderplayer and fix for link
order.
2015-03-26 14:13:42 +01:00
1e93189351 Missing include path for scons build files of the gameengine player. 2015-03-26 14:13:42 +01:00
66b25f72c4 Missing library linking in the blenderplayer. 2015-03-26 14:13:42 +01:00
b41ffbea51 Stub function for Alembic init when Alembic is not enabled. 2015-03-26 14:13:42 +01:00
22309a0be6 Use dupli overrides also for the selection drawing code.
Now clicking a cached dupli instance also selects the duplicator object
as expected.
2015-03-26 14:13:41 +01:00
b122777ce7 Use dupli cache in bounding box calculations involving duplis.
This feature is mostly useful for the "view selected" operator. It is
also used in the "set origin to geometry" operator, but since the
cache overrides the object geometry anyway the effect may not be what
users expect (which is acceptable).
2015-03-26 14:13:41 +01:00
d4f48ffc63 Simple mesh import from Alembic files in Cycles standalone.
Note that Cycles currently only supports tessellated triangle/quad
meshes. Alembic PolyMesh generally has ngons, so external tessellation
is required until cycles gets a proper tessellation implementation of
its own.
2015-03-26 14:13:41 +01:00
ad85c05ae2 More control over verbosity with Alembic archive info printing. 2015-03-26 14:13:41 +01:00
902a747f60 Simple inclusion of alembic files from inside xml files for cycles
standalone.

The cycles XML files now can refer to Alembic (.abc) files. This will
call the default alembic reader to read in scene data. Currently it
simply prints the Alembic file structure.

Eventually a proper schema needs to be defined for both xml and abc.
Also care has to be taken to handle potential conflicts between settings
both within xml/abc and between them.
2015-03-26 14:13:41 +01:00
0742817088 Basic Alembic integration in the Cycles standalone.
This adds Alembic to the standalone application version of cycles.
Files can be specified as XML or Alembic, or use automatic detection
based on the filename extension.

Currently the Alembic reader just dumps the file structure to stdout
as a test.
2015-03-26 14:13:41 +01:00
d1d98c23ee Fix for cycles cmake missing GLEW library variable when building without
the GUI.
2015-03-26 14:13:41 +01:00
64a7d76bd8 Avoid conflicting unordered_map definition in cycles by using a general
include path instead of the boost one.

For explanation see http://stackoverflow.com/questions/3973659/c-unordered-map-compiling-issue-with-g
2015-03-26 14:13:41 +01:00
fc5858b320 Fix for corruption of the item hash table in cache libraries on copy. 2015-03-26 14:13:41 +01:00
84ccc6a3c0 Take cache library items into account when baking caches.
This means we don't bluntly store all the data in a group, but use the
selection from the cache library. It also helps to avoid issues with
object visibility which is not yet stored in the cache.
2015-03-26 14:13:41 +01:00
bb2fd946ec Working implementation of cache reading for dupli data during renders. 2015-03-26 14:13:41 +01:00
fce1a01f7b Use the temporary 'is_dupli' flag to prevent objects from freeing
overriden data that is owned by the cache.

This is not at all nice ... Hopefully it doesn't get too complicated to
work around all these drawing code and depsgraph issues, so the code
can be understood and replaced at some point in the future.
2015-03-26 14:13:41 +01:00
da44371fdf Replacing boundbox temporarily during drawing is dangerous, since it
can be freed at any point.

Luckily we only need the boundbox locally for testing dupli visibility.
2015-03-26 14:13:40 +01:00
7a771a6c34 Fully reset the OB_FROM_DUPLI flag for each dupli instance, in case
later duplis can not be found in the cache.
2015-03-26 14:13:40 +01:00
dccc3e62e7 Distinguish realtime/render setting in the Object writer.
Now the derived_render mesh version is created locally when writing
render results.
2015-03-26 14:13:40 +01:00
1ad78297ca Combined storage of render and realtime data in caches.
Caches now create 2 new roots below the main 'top' object of Alembic:
root and root_render for realtime and render data respectively.
This makes it easy to switch the whole archive to either of the modes
during baking and for constructing dupli caches.

Alternatively individual objects could store hires versions of their
data. This would also be more efficient if the cache contains many
simple objects which don't have 2 different variants. However, such
design decisions are difficult to make at this point and the
implementation can be modifier later.
2015-03-26 14:13:40 +01:00
b8c29051f9 Make sure the cache baking job cancels properly when interrupted in the
first stage.
2015-03-26 14:13:40 +01:00
14d401ac12 Allow cache libraries to store both render and realtime (viewport) data.
This is the default now. It should make workflow a lot more foolproof
and convenient, since having only one of these modes active at a time
very easily leads to broken renders and confusing situations.

The problem is mostly due to the complicated way the depsgraph layer
feature is used to handle duplicator visibility. The duplicator is
declared as a child of its group's objects (even though no real
dependency exists!), so that a visible duplicator triggers updates of
invisible group objects, making instances of hidden groups possible.

However, dupli caches have to disable this dependency in order to avoid
unnecessary costly updates in hidden layers which are overridden by
cached data anyway. At the point where these dependencies are created
the evaluation context is unknown though, which means we cannot
distinguish between render and realtime evaluation for the purpose of
cache reading ...
2015-03-26 14:13:40 +01:00
17ccf6387c Removed deprecated code. 2015-03-26 14:13:40 +01:00
fe1ec0100d Make sure mesh data is really stored and reconstructed from the cache
entirely.

Also the code is much better structured now, moving toward a more
standardized sample/schema class definition.
2015-03-26 14:13:40 +01:00
e0f3d9250a CD_NORMAL support for mesh customdata caching. 2015-03-26 14:13:40 +01:00
640e3fd365 Fix for use of wrong CustomData for tessfaces. 2015-03-26 14:13:40 +01:00
b4f62f7866 Copy rgba components of MCol explicitly to the Alembic C4f type to avoid
potentially different ordering.
2015-03-26 14:13:40 +01:00
aeb4384d5a MCol customdata caching. 2015-03-26 14:13:40 +01:00
aef3dc4938 MTFACE customdata is not suitable or necessary for caching, so disable
it.
2015-03-26 14:13:40 +01:00
3a38ed914a Added customdata writers/readers for missing mesh edge, poly and loop
data.
2015-03-26 14:13:39 +01:00
f65b7c8377 UI cleanup and a bit nicer workflow by treating read/write mode like
an enum toggle.
2015-03-26 14:13:39 +01:00
84411eb190 Disable the bake operator if cache reading is enabled.
Re-baking cache results is not technically prohibited, but not useful
and allowing only read or write selectively gives a nicer workflow.
2015-03-26 14:13:39 +01:00
c5d1d174f2 Cycles support for dupli caches.
If a cache is read-enabled cycles will now use the cached mesh data
instead of dupli results.
2015-03-26 14:13:39 +01:00
aebc98e061 Skip drawing of particle systems (including hair) when using cache
duplis.

Particle systems can not be overridden from caches easily, there are too
many strings attached to the data and code to make this reliable.
Instead, a new simplified data structure for reading hair from caches
will be added, which replaces drawing and rendering of particle data.
The original particle data is not updated through duplis, so is usually
out of sync and should not be displayed.
2015-03-26 14:13:39 +01:00
cf5a4256a8 Main argument is no longer needed for cache reading, the cachelib is
now given explicitly.
2015-03-26 14:13:39 +01:00
ca8b8d9309 Removed unused variable. 2015-03-26 14:13:39 +01:00
b4295d1c8f Calculate bounding boxes for cached DMs to avoid visual popping when
using the original Object's bb.
2015-03-26 14:13:39 +01:00
850c47b5a8 Test for NULL archive pointer when writing as well.
This should not usually happen because the operator asks for permission
to delete the file prior to writing, but should be checked nevertheless.
2015-03-26 14:13:39 +01:00
0e70ddfe14 Safeguard against crashes from invalid Alembic file paths by returning
NULL archive pointers.

This allows writer/reader code to test against obvious archive errors
easily and is unmistakable.
2015-03-26 14:13:39 +01:00
f5b360b4da Fix for wrong ID code used in RNA->idcode mapping. 2015-03-26 14:13:39 +01:00
6589a564c9 Removed group pointer from cache libraries and use object->cachelib
pointer instead.

This change makes it possible to have group duplicators using different
versions of a cache.
2015-03-26 14:13:39 +01:00
790f8d935a Added a cache library pointer to objects as a replacement for CL->GR
pointers.

Relationship between CacheLibrary, duplicator Objects and Groups is
difficult. There are a number of somewhat conflicting goals:
- CacheLibraries write out data for objects and dupli groups. Multiple
  objects can be stored in the same cache: CL *->* GR
- Objects can override a dupli group with different caches: OB *->1 CL
- As before, each object can be the duplicator for one group: OB *->1 GR

To combine these requirements, the first relationship will be made
indirect. Only the Object -> Group/CacheLib relations are explicit
pointers in the DNA. For finding all objects contained in a cache
library the usual recursive DNA tagging system must then be used.
2015-03-26 14:13:38 +01:00
4950ea97dc Removed the now redundant "Read" toggle from cache libraries.
At this point the reading is toggled on the side of group duplicators.
2015-03-26 14:13:38 +01:00
4f91f81e02 Removed the explicit duplicache rebuild operator.
The cache is now updated on frame changes automatically, the operator
should no longer be needed.
2015-03-26 14:13:38 +01:00
ea5c140926 Removed unused deprecated functions for cache library. 2015-03-26 14:13:38 +01:00
869e11ef5a Sanity check for dupligroup caching functions. 2015-03-26 14:13:38 +01:00
0d3da1343c Use a new flag in duplicator objects to enable cache reading and avoid
unnecessary dependencies.

This flag will replace the current "read" mode on cache libraries.

Beside enabling cache reading, it also disables the current "fake"
dependencies between duplicators and their group objects. This is
exploiting the layer visibility mechanism in depsgraph to ensure that
animated group objects get evaluated when used by a visible duplicator,
even when they are not themselves visible. These dependencies cause
group object updates even if the duplicator is using cached results.
To avoid this unnecessary overhead and make caching worthwhile we
rebuild depsgraph without these relations when using the cache instead.
2015-03-26 14:13:38 +01:00
26b58bd151 Enable frame updates of duplicache through use of an invalidation flag. 2015-03-26 14:13:38 +01:00
124e00bf8a Disable additional depsgraph tagging through cache libraries.
This code is outdated due to changes in reading code and obscures some
genuine depsgraph behavior.
2015-03-26 14:13:38 +01:00
03ffed6fb1 Mesh overrides for duplis from cached Alembic data.
If a duplicator has cached data it will now replace the derivedFinal
mesh of objects with the cached version for drawing.

This is a compromise atm: It would be better to actually draw derived
meshes directly, so that we don't have to modify objects. Then we could
also have multiple different instances of the same orignal object
(in whatever way these might be defined). DNA Objects would then be
totally separate from duplis, but at this point the drawing and render
code makes this unfeasible.
2015-03-26 14:13:38 +01:00
9683f7aae1 Mesh storage and reading in child objects for dupligroups.
The layout of the Alembic files resembles the DNA structure in Blender:
- On the top level (under the top/root node) there are Abc::Objects for
  Blender ID datablocks (currently Object and Group)
- Objects store final data (DerivedMesh) and later simulation results
  etc.
- Groups store their full duplilists for instancing. Currently there is
  no recursive nesting of groups, since this would limit duplis to
  dupligroups and exclude e.g. duplifaces.

On reading the duplilist gets reconstructed and stored in the DupliCache
for a duplicator empty (the group instance). DerivedMesh data is stored
in a hash table for each instanciated object and can later replace
finalDM in drawing and rendering.
2015-03-26 14:13:38 +01:00
8db0e2b8c2 Simplification of the archive init functions in writers and readers.
Now the base types for readers/writers are not nominally forming the
interface any more (they may be removed entirely later). This makes
possible a cleaner init method directly in the Abc Writer/Reader
classes.

Further work may be required in this area.
2015-03-26 14:13:38 +01:00
ad2a8e7fd8 Moved the dupli cache reading code into a AbcDupligroupReader class.
This is more in line with how readers work in the Blender Alembic
implementation elsewhere.

Generally, readers are less persistent than writers: they are created
whenever cache results need to be updated (e.g. on frame changes) and
discarded afterward. Writers OTOH stay alive during the whole baking
job, since they keep the references to Alembic Writer instances and can
only be deleted once the writing for that part is done.
2015-03-26 14:13:37 +01:00
401b720531 Store and apply dupli object transforms in the Alembic cache.
Note that the cache stores dupli matrices without the final parent
transform, since it only knows about the group itself. The duplicator
obmat is applied to the duplis after reading the cache.
2015-03-26 14:13:37 +01:00
bdedd88d92 Handle dupli cache on object copy and freeing. 2015-03-26 14:13:37 +01:00
cc1ce64b02 Updated cache reading function for the new duplilist structure.
Now we store duplilists entirely inside a single alembic object for the
group. This allows using all the generated duplis, which would be
difficult if the alembic file had to define all the possible recursive
dupli relations that Blender allows, beside straightforward Group duplis.
2015-03-26 14:13:37 +01:00
e5940d0515 Use a nested Object writer to store the Object ID blocks used by dupli
lists.
2015-03-26 14:13:37 +01:00
75d83d954a Better dupligroup Alembic writer.
Uses the duplilist generated by Blender to define instances, instead of
recreating the group layout. This omits some information about actual
structure of the DNA, which might be useful later on. The main problem
is that the duplilist itself does not encode this, so it's a tradeoff
between either including the Group structure or omitting the other
dupli types, like face, vertex, particle duplis.
2015-03-26 14:13:37 +01:00
1a4f89029f Alternative dupli generator function for creating duplis in a group
without a specific parent.
2015-03-26 14:13:37 +01:00
b691dfdaa9 Some disabled code to enable automatic cache updates on every duplilist
creation call.

This is executed *a lot* (even for simple things such as viewport
panning), so the code is probably not suitable in this form. At least
it could do a frame comparison to avoid unnecessary updates.
2015-03-26 14:13:37 +01:00
31009f8919 Use a cached group only when a CacheLibrary is actually available.
Otherwise the regular duplilist generator is used.
2015-03-26 14:13:37 +01:00
da7a970e3b Replace usage of the procedural duplilist generation by cached duplilist. 2015-03-26 14:13:37 +01:00
4fd3943696 Store object pointers for the dupli objects we generate from caches.
This is necessary for the current viewport drawing and rendering code,
which expected each dupli instance to represent a copy of data in the
DNA.

The code maps base-level objects in the cache to DNA Objects inside the
dupligroup by name. Only objects that can be found in the blend data
will be allowed for DupliObjects.
2015-03-26 14:13:37 +01:00
607e0f0d52 Moved the DupliCache struct into DNA, it will be needed for drawing and
RNA access later.
2015-03-26 14:13:37 +01:00
b592669097 Simple operator to force rebuilding of a dupligroup cache.
This is a placeholder for proper depsgraph integration. Eventually frame
changes and some other updates should rebuild dupligroup caches
automatically using the depsgraph. Until then this operator is a quick
way to test the IO from caches and the further drawing and rendering
(TODO).
2015-03-26 14:13:37 +01:00
39af6d71cf Cache reading functions for constructing a nested dupligroup list based
on Alembic cache data.
2015-03-26 14:13:36 +01:00
c61c039f21 Include mesh writers in the cache writers list. 2015-03-26 14:13:36 +01:00
018f613c90 Removed unused code. 2015-03-26 14:13:36 +01:00
0fbad24bf2 Removed current implementation of cache reading from various parts of
BKE (DerivedMesh, particles, cloth).

The new cache implementation will be used for constructing dupli data
instead, bypassing the complexities of the modifier stack.

Conflicts:
	source/blender/blenkernel/intern/cloth.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_system.c

Conflicts:
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_system.c
2015-03-26 14:13:34 +01:00
ad65238df7 Initial code to support dupli group instancing and overrides through
Alembic caches.

This creates representations (Abc::Object) for Blender Object and Group
datablocks in the Alembic files and uses Alembic instancing to define
the dupligroup hierarchy. This leads to a relatively flat hierarchy in
Alembic files:

Top -> Object/Group -> DerivedMesh/Particles/Hair/Cloth/Smoke/...

The dupligroup structure can not be represented by a hierarchical
structure such as the Alembic object nesting, because of the
many-to-many relationship between objects and groups (a group can
contain multiple objects, multiple objects can instance the same group).
Instead we use the instancing feature of Alembic to represent
dupligroups. This is created in 2 stages to ensure all the main ID
blocks have been serialized before creating references.
2015-03-26 14:13:08 +01:00
b82bf93000 Nicer info printing support for instances in Alembic files.
This now avoids repetition of internal instance structure.
2015-03-26 14:13:08 +01:00
e7a9635ed3 Fix for invalid ob->data access in case non-mesh objects are in the
cached group.
2015-03-26 14:13:08 +01:00
3c733e8eda Improved edge attribute caching.
Now edges should be fully restored from cache, fixing edge display.
2015-03-26 14:13:08 +01:00
e92c7ea9bb Omit hair path lengths for anything but the first sample.
We can safely assume that paths don't change their lengths. This might
safe some cache space.
2015-03-26 14:13:08 +01:00
1930d4b364 Fix for particle pathcache caching: have to check the psys->renderdata
pointer to figure out if we are evaluating with render settings.
2015-03-26 14:13:08 +01:00
d76746acde Fix for some archive checks to make sure we don't access invalid data.
This can happen if the archive file cannot be opened for some reason.
2015-03-26 14:13:08 +01:00
a60b289809 Implementation of MDeformVert customdata layers in Alembic. 2015-03-26 14:13:08 +01:00
07fbb0e25e Fix for name collisions in compound properties when writing CustomData.
This is not clearly documented for Alembic, but apparently properties
inside compounds still need to be name uniquely for the whole object.
This is somewhat involved for Blender's CustomData, because we have
5 different customdata elements for meshes (vert, edge, face, poly,
loop) and each of these can have the same types and multiple layers of
the same type ...
2015-03-26 14:13:08 +01:00
e6e058289d Fix for Alembic info printer printing to std::cout instead of the
internal stringstream.
2015-03-26 14:13:08 +01:00
2d3261754a Fix for potential size issue: need 64 bits for CustomDataMask types. 2015-03-26 14:13:08 +01:00
b17fdec19c Nicer error handling for unimplemented CustomData layer types.
Instead of failing an assert, simply print an error message and return
gracefully. We don't want Blender crashing because of this.
2015-03-26 14:13:08 +01:00
5d044d62e2 Ugly hack for caching code to deal with quirky modifier stack behavior.
CustomData layers are pruned by the CDDM_copy function when they have
CD_FLAG_NOCOPY set. This is based on later modifiers in the stack, which
can specify that they require certain data layers - but the caching
modifier itself should store only what is needed by later modifiers.
It means we cannot easily keep a full copy of the DM in the cache
modifier to writing into caches later.

For now the hackish solution is to temporarily disable NOCOPY flags when
copying the DM. This is really not nice and needs a better solution.
2015-03-26 14:13:08 +01:00
80e541e581 Support CD_ORIGSPACE layer caching.
This is needed by particles for distributions on meshes with changed
topology (which is of course broken).
2015-03-26 14:13:07 +01:00
78d00e5eeb Tessface customdata for derived mesh caching. 2015-03-26 14:13:07 +01:00
c409adf4c8 Support for CustomData in Alembic caches.
This is a skeleton feature that provides a general way of storing
CustomData types. Currently only ORIGINDEX layers are implemented, the
code is designed to make extension easy.

Storing CustomData layers in Alembic is a bit involved because the
complex structs often used as customdata need to be de-interleaved for
Alembic into a set of POD (plain-old-datatype) array properties.

In addition the property names should be unique, so that mapping abc
properties back to customdata layers is safe. This works by using 2
levels of compound properties: the first level stored per CD type
properties, with a number of properties for each layer of this type,
using either a name or index (for unnamed layers). The internal
properties can then in turn be compounds, if structs need to be
serialized into PODs.

Abc property readers/writers are created dynamically for the CustomData
compounds. This is necessary because we don't know in advance what kind
of data layers a DerivedMesh or other CD user will have, and this can
change each frame in theory. Alembic is easier with state data schemes,
but using it this way is possible (if somewhat cumbersome).
2015-03-26 14:13:07 +01:00
4f326e5987 Fix for cache item filtering: items can be part of the cache library
but disabled, in that case hide them as well.
2015-03-26 14:13:07 +01:00
d49c83eebf Fixed test for "render" eval mode for hair dynamics.
This is totally weird and convoluted, no idea if correct.

Conflicts:
	source/blender/blenkernel/intern/particle_system.c

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
2015-03-26 14:13:04 +01:00
98e0de16ab Removed the DM writer/reader from hair dynamics again, this is part of
the particle stuff and does not work.
2015-03-26 14:12:49 +01:00
eed8674c17 Archive Info operator for Cache Library archives.
This creates a string with information about all the objects and
properties contained within a (Alembic) archive, used by a cache
library.

The operator has 3 modes of presenting the info string:
- stdout, ie. printing to the terminal
- popup window (not very useful usually due to size limits and lack of
  scrolling)
- clipboard copy
2015-03-26 14:12:48 +01:00
38b0940a54 Use a combined class for hair dynamics for cloth and mesh data.
Particles store a copy of the DM internally as the emitter.
2015-03-26 14:12:48 +01:00
15e3298d54 Alembic: Fixes for linux buildbot and scons 2015-03-26 14:12:48 +01:00
ce6a8188c0 Depsgraph tagging function for cached objects.
This is necessary to trigger object data updates for indirectly linked
objects, which would otherwise not be evaluated.
2015-03-26 14:12:48 +01:00
9787f4bbaa Convenience feature: When linking a cache library, always default it to
'read' mode locally.

Linking a cache library is meant to be used for getting existing cache
data into a file.
2015-03-26 14:12:48 +01:00
43093f141a Left a comment in DerivedMesh.c explaining why the caching system has
to use the cumbersome cachedm pointer instead of virtual modifiers.
2015-03-26 14:12:48 +01:00
75e146f8a2 Use a dedicated input_dm pointer in the cache modifier to provide a mesh
result read from the cache.

Mixing this with the output_dm used for writing leads to undefined
situations where the DM was released but should actually be passed on.
2015-03-26 14:12:48 +01:00
8b67c63274 Use correct flag enums for checking render/viewport eval mode when
writing derived mesh caches.
2015-03-26 14:12:48 +01:00
a8a5785cc2 Fix for meaningless build error (no return value, can never happen). 2015-03-26 14:12:48 +01:00
39c4c37599 Minor fix for UI code showing cache items. 2015-03-26 14:12:48 +01:00
91ec385a0d Render/Viewport evaluation mode for cache libraries.
This designates a cache library to be used either for the viewport or
for renders. A "Render" cache library will evaluate modifiers with
render settings and a "Viewport" cache library will use viewport
(realtime) settings.

When reading the cache, the library will only be
used for the assigned purpose, i.e. a Render cache does not work for
viewport caching and vice-versa (although a cache can be baked for one
setting and then switched afterward).

Note that render results will never be visible in the realtime viewport
due to the way object evaluation is handled in Blender at this point
(render settings are only evaluated explicitly during renderer sync).

Conflicts:
	source/blender/blenkernel/intern/particle_system.c

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
2015-03-26 14:12:45 +01:00
81c720f76e Allow the cache bake operator to overwrite existing files, using a
confirm dialog.
2015-03-26 14:12:39 +01:00
359b3f7011 Removed now-unused util_path files from the pointcache lib.
Paths are constructed outside this module now. A valid absolute path
should always be provided through the API calls.
2015-03-26 14:12:39 +01:00
e46cce7fe9 Record and display the last result of cache reading in the cache library
items.
2015-03-26 14:12:39 +01:00
920ff67dea Free readers properly after applying cached data. 2015-03-26 14:12:39 +01:00
c4fe4b71ef Set reader/writer archive as a separate step outside the constructors.
This allows nicer creation of readers/writers //before// actually
opening the archive. This in turns can simplify code quite a bit.
2015-03-26 14:12:39 +01:00
76b999949d Moved functions for constructing readers/writers based on cache library
out of pointcache into blenkernel.

This is quite simple and repetitive and there is not need to have this
in the main pointcache/Alembic API. The code is mostly concerned with
logic of DNA data, so pointcache shouldn't have to deal with it.
2015-03-26 14:12:39 +01:00
0db1e01089 Ported archive filename constructor from pointcache library to BKE.
The pointcache library is now pretty much independent from ID blocks and
should not be responsible for handling file paths. The path construction
is also fairly straightforward now compared to the old point cache
system, with only basic conversion of relative to absolute paths for
loading archive files.
2015-03-26 14:12:39 +01:00
730e38279a Cache read result enum in DNA mirroring the internal pointcache results.
This can be stored in cache library items as an indicator of cache
reading state.
2015-03-26 14:12:39 +01:00
70a5fccfb4 Use a uiTemplate function for showing cache library items instead of
python code to unify symbols.

This is necessary because the operator for adding new items (as opposed
to the enable/disable button) cannot be shown with the same checkbox
button. The UI template function can display a custom button for the
operator, so the look becomes less confusing.
2015-03-26 14:12:38 +01:00
3e4cf67ef4 Nicer default filename for cache library paths.
This now appends a default extension based on the cache backend used.
At this point this is always Alembic (.abc) but would allow other
backend formats in the future.
2015-03-26 14:12:38 +01:00
03ac4af650 Improved filtering for cache library content.
In addition to the object name filtering, items in cache library groups
can now be filtered by type as well.

Existing items in the cache are always displayed, so as to not hide
important information (what gets stored in the cache). The filtering
is primarily a utility to simplify searching inside the group for things
that should be added to the cache.
2015-03-26 14:12:38 +01:00
8eeb5382d9 Use a generator in the python code to iterate over all the potential
cache library items.

This should ideally happen on the RNA side, but making the equivalent of
python generators in the RNA is really difficult.
2015-03-26 14:12:38 +01:00
07e7cdad8d Don't show mesh cache items for non-mesh objects. 2015-03-26 14:12:38 +01:00
9848f404fb Disabled collection properties for 'virtual' cache items in RNA.
This requires a better design and is not so easy to implement properly
within the limits of RNA definition. These collections don't physically
exist in the DNA, they are mainly utilities for looping over
//potential// items in a cache library. For now the python code has to
be adapted to only show valid items, until the RNA provides a good
solution.
2015-03-26 14:12:38 +01:00
89e0abb3e6 Generic validation function to help ensure that we don't add meaningless
items to a cache library.
2015-03-26 14:12:38 +01:00
4302580af9 Replaced use of the HDF5 Alembic backend by Ogawa.
Ogawa is replacing HDF5 as the new de-facto standard. Selecting either
should be more formalized and a user option, for now it's just hardcoded.
2015-03-26 14:12:38 +01:00
e1a17cea89 Filter utility for finding objects in a cache group faster.
This is a preliminary feature and implemented purely in python, to be
replaced later.
2015-03-26 14:12:38 +01:00
303997ea71 New 'read' flag to toggle reading of the CacheLibrary as a whole.
This is also used during the bake process to avoid confusion: The read
flag gets disabled for the baking cachelib, so that objects don't try
to read cache data that is supposed to be generated.
2015-03-26 14:12:38 +01:00
aa36820fa2 Delete operator for cache library datablocks.
CacheLibrary datablock has a generic unlink function now, but currently
nothing actually links to cache libs themselves, so it's empty. Still
good to keep this in mind for the future.
2015-03-26 14:12:38 +01:00
26bb16c833 Reader/Writer API functions for basic particles.
Also slightly renamed pathcache functions for consistency (use plural
'particles' instead of 'particle').
2015-03-26 14:12:38 +01:00
d20d2d78ee Removed deprecated and unused alembic API functions.
These are now implemented as virtual functions in the Factor class.
2015-03-26 14:12:38 +01:00
a593d05733 Fixes for scons build files. 2015-03-26 14:12:37 +01:00
0a2d0fb667 Fix for circular linker dependency with cache code library.
The `bf_pointcache_alembic` code is a separate library, to avoid
muddling up core code with alembic includes and preprocessor defines.
Alembic stuff only belongs strictly into alembic code and can be
disabled cleanly.

The `bf_pointcache` and `bf_pointcache_alembic` libraries had a circular
dependency, because the alembic implementation functions were called
directly. Now there is a "Factory" class to abstract the creation of
concrete implementations for readers and writers.
`bf_pointcache_alembic` defines this factory and is registered
//outside// of the core `bf_pointcache` lib, so there is no linker
circularity.
2015-03-26 14:12:37 +01:00
d50aa3b019 Removed unused thread mutex file from pointcache lib. 2015-03-26 14:12:37 +01:00
188cc9b12c Removed deprecated rna_pointcache.c file.
Scons was still compilling this, since it's source files are not
explicit.
2015-03-26 14:12:37 +01:00
2abbfea29f Fix for indirectly linked object pointers in cache libraries.
These must be made "extern" to avoid losing links on loading.
2015-03-26 14:12:37 +01:00
4fa4f54e00 Removed remaining 1 frame difference in archive storage.
This was an artifact from the previous way of mapping non-0 start frame
to time 0.0. Now we start at times > 0.0 to match with the start frame.
Both ways are possible, can be changed later if needed.
2015-03-26 14:12:37 +01:00
7a84204449 Fixed start frame mapping in Alembic archives.
Writers were always starting at time 0.0, which means that for start
frames > 1 the readers would always be off. Now match the writer start
frame to the actual Blender start frame.
2015-03-26 14:12:37 +01:00
1168ec39c7 Added poll function for the cache manager panel to prevent hiding in
Cycles render engine.

The "compat_engines" thingy really gets in the way here ...
2015-03-26 14:12:37 +01:00
61d6e50444 Cache reading for particle paths.
Conflicts:
	source/blender/blenkernel/intern/particle.c

Conflicts:
	source/blender/blenkernel/intern/particle.c
2015-03-26 14:12:33 +01:00
49485305d1 Fix for cache modifier linking and handling of the default case (no
cachd modifier).
2015-03-26 14:11:17 +01:00
b61334cc84 Changed implementation of the Cache modifier to work in tandem with the
cache library system.

The Cache modifier is now an optional "break point" of the modifier
stack:
- Without a cache modifier the stack works as before. Baking will write
  the final stack result. After baking the cache replaces the whole
  stack.
- With a cache modifier the stack result at the modifier's position is
  stored. The cache is then applied as the output of that modifier,
  skipping preceding modifiers. That way additional modifiers can be
  applied on top of the cache.
- When using multiple cache modifiers, only the last (active) one will
  be used, since all previous cache results would be discarded anyway.
2015-03-26 14:11:17 +01:00
29bf328e41 Replaced point cache in cloth modifiers (also hair) with the new caching
system.

Conflicts:
	source/blender/blenkernel/intern/cloth.c

Conflicts:
	source/blender/blenkernel/intern/cloth.c
2015-03-26 14:11:12 +01:00
e1e8b6e57e 'expand' function for cache libraries, so link/append makes it load the
group and objects too.
2015-03-26 14:10:35 +01:00
a5e717f1d4 Make cache libraries a linkable data block. 2015-03-26 14:10:35 +01:00
dc655c4ee6 Take NULL object pointers in cache items into account.
This can happen if an object gets deleted or isn't loaded for some
reason. The item should just be ignored in that case and removed at the
next opportunity (cleanup function).
2015-03-26 14:10:35 +01:00
87bf9ee25e When using the "new cache library" operator, enable fake user by
default.

Nothing actually links to a cache library at this point (and probably
won't in the future), so fake user is necessary to avoid losing data.
2015-03-26 14:10:35 +01:00
083597eb69 Display cache library name and fake user button, imitating template_ID. 2015-03-26 14:10:35 +01:00
5ada4a5502 Importing of caches into Blender data.
Currently only implemented for DerivedMesh.
This replaces the `final_dm` calculation of the modifier stack with the
result from cache loading.
2015-03-26 14:10:35 +01:00
228a3fd4dc UI fixes, draw bake operator button only once at the top. 2015-03-26 14:10:35 +01:00
45a1bd8054 Hair path writer needs 2 different variants for parent/child hairs. 2015-03-26 14:10:35 +01:00
8dce165500 Added writers for derived mesh result and hair paths. 2015-03-26 14:10:35 +01:00
490a775fa7 Use explicit name strings for all readers/writers in the cache instead
of constructing names internally.

This helps prevent name collisions and guarantees a consistent naming
scheme for putting multiple items in the same cache.
2015-03-26 14:10:35 +01:00
46f15b3ea9 New reader/writer for DerivedMesh.
Used as a base for existing PointCacheModifier classes, but can be used
on its own.
2015-03-26 14:10:35 +01:00
0eaff16da8 General support for export to/import from Alembic files based on Cache
Libraries.
2015-03-26 14:10:34 +01:00
2146d7b9c9 Deleted unimplemented parts of the previous pointcache system, to make
refactoring simpler.

Since the new approach is not tied to the old set of point cache data
types there is really no need to carry their empty husks around. Once
the new caching system is defined in detail we can add back whatever
makes sense.
2015-03-26 14:10:34 +01:00
ae4f0c33c6 Disabled specialized Point Cache modifier handling in the modifier
stack, this will be replaced and is not correct anyway.
2015-03-26 14:10:34 +01:00
01a1c34d91 Refactoring of archive handling in readers/writers.
Now instead of each reader/writer creating its own archive, the archive
is created by the caller in advance and passed as a constructor
argument. This means that multiple items can be stored together in the
same archive.
2015-03-26 14:10:34 +01:00
6ca19d7aa9 Removed unused Scene pointer from the base Reader/Writer classes. 2015-03-26 14:10:34 +01:00
9bf48ec3cd Operator skeleton for a cache bake operator, using the job system. 2015-03-26 14:10:34 +01:00
3113f5cfe5 Fix for undefined return value. 2015-03-26 14:10:34 +01:00
babf2ca5d9 Removed unused line. 2015-03-26 14:10:34 +01:00
25d5856683 Unlink and cleanup functions when objects or the cached group get
unlinked or changed.
2015-03-26 14:10:34 +01:00
eb79cb0c84 Make sure cache item pointers are lib-linked correctly. 2015-03-26 14:10:34 +01:00
1c14dccb5e Name string construction for cache items, to use as a unique identifier
in the cache library.
2015-03-26 14:10:34 +01:00
efa3b04ddf Draw some UI buttons for all the current cache item types. 2015-03-26 14:10:33 +01:00
8393bb1f41 Updated hash table for lookup of enabled cache items and added basic
UI support.
2015-03-26 14:10:33 +01:00
8afec0b6d6 Improved collections in RNA for looping over potential caching items
in the object group.
2015-03-26 14:10:33 +01:00
bb86cdb738 Define a collection of "object_caches" in the CacheLibrary RNA for
iterating over all objects eligible for caching in the group.

This allows for nested dupligroup instances as well. All objects that
are instantiated at least once by any group can be included in the
respective cache, but get represented only once because the cached data
is the same anyway.
2015-03-26 14:10:33 +01:00
095403be92 Link main CacheLibrary pointers in readfile. 2015-03-26 14:10:33 +01:00
b2b8cbf2b6 Simplified cache item path description, based on plain ID blocks with
subtype/index.

This omits possible instancing and recursion by dupli groups, but since
the data of instances is always the same in Blender at this point, there
is little need to take them into account for caching.

At some point in the future it may become desirable to store full dupli
hierarchies in the cache, but it doesn't make sense to try to design a
fully-fledged path descriptor for this hypothetical case now.
2015-03-26 14:10:33 +01:00
6b3a64b81b BKE functions for managing cache content based on a group.
This uses a complete hierarchy of group instances, based on a path
hierarchy (object names).

Putting
2015-03-26 14:10:33 +01:00
4f13290574 Simple cache manager panel UI in the scene buttons.
This is mostly a simple and unintrusive placeholder to have some way of
making caches accessible, but needs some more thought.
2015-03-26 14:10:33 +01:00
f8612bccf3 Group pointer property for cache libraries to associate them with an
object group.

This is somewhat experimental, eventually we may want to link to Objects
instead, or allow multiple cache targets for the same cache, etc.
2015-03-26 14:10:33 +01:00
505fe4ff8c Missing include. 2015-03-26 14:10:33 +01:00
983ef57353 Removed meaningless comment. 2015-03-26 14:10:33 +01:00
e9efdae466 New operator for adding cache libraries.
Conflicts:
	release/scripts/startup/bl_ui/properties_physics_common.py
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/pointcache.c
	source/blender/editors/physics/physics_ops.c
	source/blender/editors/physics/physics_pointcache.c
2015-03-26 14:10:33 +01:00
51bd9beb1b New ID datablock 'CacheLibrary', for managing physical cache archives
and files.

At it's core this is just a file path, but many different cache users
may refer to this, so having a dedicated ID block helps. It can be
compared to Image datablocks, which also primarily are used for data
on storage, but can be packed with the blend file, and carry some
additional information that would be cumbersome to keep sync'ed
otherwise.

The name 'CacheLibrary' deliberately resembles the 'Library' datablock:
just as a Library stores ID blocks in a physical file, a CacheLibrary
stores cached data (in Alembic HDF5/Ogawa or other formats).

Conflicts:
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/pointcache.c
	source/blender/makesdna/DNA_pointcache_types.h

Conflicts:
	source/blender/makesrna/intern/rna_main_api.c
2015-03-26 14:10:33 +01:00
2483e50093 Fix for remaining PointCache references in the alembic code.
Now, for the time being, uses a simple relative "//blendcache/" folder
path again. This will be adressed later.
2015-03-26 14:10:32 +01:00
9e3c7ca085 PointCache modifier to act as a terminator in modifier stacks.
When writing DerivedMesh data, the modifier result at the point of the
modifier will be used for writing to the cache. If this modifier is not
used the derivedFinal mesh is used instead.
2015-03-26 14:10:32 +01:00
b91059f7a1 Cache API for export/import of Blender data to/from Alembic files.
The pointcache API is designed to keep the general concept of caching
separate from the concrete Alembic implementation. Other types of file
export/import would be possible, e.g. for OpenVDB data.
2015-03-26 14:10:32 +01:00
d402042a77 Initial Alembic library integration for Blender.
Adds Alembic as a dependency and build support in cmake and scons.

Also extends the install_deps.sh script with a temporary installation
procedure for the Alembic libraries. This is still very hackish and
needs to be improved.
2015-03-26 14:10:32 +01:00
71bd43a589 Merge branch 'master' into gooseberry 2015-03-26 14:01:43 +01:00
7c08e7fcdf Revert "Better fix for animation returning negative values when AVsynch is on,"
This reverts commit 459b1a907c.
2015-03-26 14:01:22 +01:00
7d035bcba1 Alembic: correct last commit 2015-03-26 21:06:40 +11:00
88218c4d44 Alembic: cleanup warnings 2015-03-26 21:04:52 +11:00
c34e4d57fd Alembic: expose CMake var ALEMBIC_INCLUDE_DIR
The include path could be cached to a stale value, with no obvious way to reset.
2015-03-26 21:00:24 +11:00
ad3e6ecfb4 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/render/render_opengl.c
2015-03-25 20:10:02 +01:00
465819af4f Customdata caching for CD_ORIGSPACE_MLOOP. 2015-03-25 18:57:52 +01:00
e1273f7d79 Customdata caching for CD_ORCO. 2015-03-25 18:44:56 +01:00
b690f220e2 Basic drawing code for strands loaded from caches.
This is entirely separate from particle systems and their insane
drawing function.
2015-03-25 18:07:03 +01:00
aebc04ec1f Smoke cache offset (start frame) feature.
This lets users set a start frame at which a cached smoke simulation
starts. This offset is simply subtracted from the current scene frame
for evaluating the cache.
2015-03-25 15:58:47 +01:00
be72ad615a Simplified data structure and reading code for strands in Alembic
caches.
2015-03-25 15:08:02 +01:00
d92b6cba67 Revert "Disable cuda binaries on the buildbot for the gooseberry branch."
This reverts commit 83da7b1edb.
2015-03-25 14:46:30 +01:00
83da7b1edb Disable cuda binaries on the buildbot for the gooseberry branch.
Doing this increases build times too much for fast updates.
2015-03-25 14:44:47 +01:00
2891298ad2 Fix wrong time sampling in customdata array properties.
The time sampling should be specified explicitly when creating
properties.
2015-03-25 13:35:52 +01:00
7f822bb4dd Merge branch 'master' into gooseberry
Conflicts:
	source/blender/gpu/intern/gpu_buffers.c
2015-03-25 12:39:38 +01:00
0561e18f81 Explicit CD type masks for each element.
Avoid storing redundant normals for vertices.
2015-03-25 10:32:57 +01:00
c86606eeba Fix for crash when deleting an object that was used in a dupli cache.
Object-unlink was clearing the linked object's dupli cache instead of
the duplicator.
2015-03-24 18:17:22 +01:00
0113a3c27c Make sure normals are correct before writing mesh data to caches.
Normal data layers might not be updated during cache baking
automatically.
2015-03-24 18:02:36 +01:00
53ac275ace New data structure for restoring strand data originating from particles.
The rationale here is that we don't try to replace particle data
temporarily like we do with DerivedMesh. This would be needed for
drawing cached data overrides in the viewport and pass them to renderers
(unless these read Alembic directly) and later for performing dupli
simulation.
2015-03-24 17:50:46 +01:00
4be32cf007 Renamed the cache_dm to simply dm.
The fact that this is used for caching is only apparent on the higher
levels of the Object struct.
2015-03-24 15:28:12 +01:00
bf047cb850 Write basic hair curves to caches for dupli groups.
This data will be used for dupli simulations later on. Child path
generation could also be done based on this data without involvement of
particle systems.
2015-03-24 12:57:30 +01:00
d82be1df11 More compact sample writing code for particle pathcache caching. 2015-03-24 12:19:08 +01:00
972e9fd23e Make the nested DM writer in Object writers a pointer, instead of using
the do_mesh flag.

This will be more in line with how optional particle system writer will
be created.
2015-03-24 11:26:07 +01:00
5f392bbad3 Revert "Avoid conflicting unordered_map definition in cycles"
This seems to break windows builds and should not be necessary.

This reverts commit 12384d564f.
2015-03-24 11:03:38 +01:00
fe457ddbee Fix for use of non-portable function snprintf. 2015-03-24 09:40:42 +01:00
dedc0c5d0f Fix for use of unknown uint type instead of unsigned int. 2015-03-24 09:29:53 +01:00
c4fe6fe945 Use a stub factory when Alembic is disabled to avoid invalid pointer
access.
2015-03-23 18:11:28 +01:00
876c8e2267 Fix for linking order in scons preventing correct initialization of
the Alembic caching implementation.
2015-03-23 18:04:19 +01:00
a06cb41772 Added Alembic dependency config to the linux x86_64 player buildbot file. 2015-03-23 16:01:56 +01:00
f8bde3c0a3 Fix for bf_pointcache lib missing in the blenderplayer and fix for link
order.
2015-03-23 16:00:57 +01:00
4d5e41280e Missing include path for scons build files of the gameengine player. 2015-03-23 15:04:47 +01:00
0febcc745a Missing library linking in the blenderplayer. 2015-03-23 14:09:05 +01:00
5f2e5ffd18 Merge branch 'master' into gooseberry 2015-03-23 13:59:50 +01:00
d54f93463f Stub function for Alembic init when Alembic is not enabled. 2015-03-23 13:31:16 +01:00
da89029856 Use dupli overrides also for the selection drawing code.
Now clicking a cached dupli instance also selects the duplicator object
as expected.
2015-03-23 12:46:34 +01:00
8d76a2f418 Use dupli cache in bounding box calculations involving duplis.
This feature is mostly useful for the "view selected" operator. It is
also used in the "set origin to geometry" operator, but since the
cache overrides the object geometry anyway the effect may not be what
users expect (which is acceptable).
2015-03-23 12:46:33 +01:00
379e54b818 Simple mesh import from Alembic files in Cycles standalone.
Note that Cycles currently only supports tessellated triangle/quad
meshes. Alembic PolyMesh generally has ngons, so external tessellation
is required until cycles gets a proper tessellation implementation of
its own.
2015-03-23 12:46:33 +01:00
c7c9fd5218 More control over verbosity with Alembic archive info printing. 2015-03-23 12:46:33 +01:00
4ef7ad13fa Simple inclusion of alembic files from inside xml files for cycles
standalone.

The cycles XML files now can refer to Alembic (.abc) files. This will
call the default alembic reader to read in scene data. Currently it
simply prints the Alembic file structure.

Eventually a proper schema needs to be defined for both xml and abc.
Also care has to be taken to handle potential conflicts between settings
both within xml/abc and between them.
2015-03-23 12:46:33 +01:00
351f1e1ebf Basic Alembic integration in the Cycles standalone.
This adds Alembic to the standalone application version of cycles.
Files can be specified as XML or Alembic, or use automatic detection
based on the filename extension.

Currently the Alembic reader just dumps the file structure to stdout
as a test.
2015-03-23 12:46:33 +01:00
8d68336344 Fix for cycles cmake missing GLEW library variable when building without
the GUI.
2015-03-23 12:46:33 +01:00
12384d564f Avoid conflicting unordered_map definition in cycles by using a general
include path instead of the boost one.

For explanation see http://stackoverflow.com/questions/3973659/c-unordered-map-compiling-issue-with-g
2015-03-23 12:46:33 +01:00
d91a144305 Fix for corruption of the item hash table in cache libraries on copy. 2015-03-23 12:46:33 +01:00
7335a20091 Take cache library items into account when baking caches.
This means we don't bluntly store all the data in a group, but use the
selection from the cache library. It also helps to avoid issues with
object visibility which is not yet stored in the cache.
2015-03-23 12:46:33 +01:00
40b817c7d4 Working implementation of cache reading for dupli data during renders. 2015-03-23 12:46:33 +01:00
129ab67f2e Use the temporary 'is_dupli' flag to prevent objects from freeing
overriden data that is owned by the cache.

This is not at all nice ... Hopefully it doesn't get too complicated to
work around all these drawing code and depsgraph issues, so the code
can be understood and replaced at some point in the future.
2015-03-23 12:46:33 +01:00
d3eb022b10 Replacing boundbox temporarily during drawing is dangerous, since it
can be freed at any point.

Luckily we only need the boundbox locally for testing dupli visibility.
2015-03-23 12:46:32 +01:00
26bd70ed8c Fully reset the OB_FROM_DUPLI flag for each dupli instance, in case
later duplis can not be found in the cache.
2015-03-23 12:46:32 +01:00
f092792284 Distinguish realtime/render setting in the Object writer.
Now the derived_render mesh version is created locally when writing
render results.
2015-03-23 12:46:32 +01:00
88718c7252 Combined storage of render and realtime data in caches.
Caches now create 2 new roots below the main 'top' object of Alembic:
root and root_render for realtime and render data respectively.
This makes it easy to switch the whole archive to either of the modes
during baking and for constructing dupli caches.

Alternatively individual objects could store hires versions of their
data. This would also be more efficient if the cache contains many
simple objects which don't have 2 different variants. However, such
design decisions are difficult to make at this point and the
implementation can be modifier later.
2015-03-23 12:46:32 +01:00
168867f3b0 Make sure the cache baking job cancels properly when interrupted in the
first stage.
2015-03-23 12:46:32 +01:00
4a6e331915 Allow cache libraries to store both render and realtime (viewport) data.
This is the default now. It should make workflow a lot more foolproof
and convenient, since having only one of these modes active at a time
very easily leads to broken renders and confusing situations.

The problem is mostly due to the complicated way the depsgraph layer
feature is used to handle duplicator visibility. The duplicator is
declared as a child of its group's objects (even though no real
dependency exists!), so that a visible duplicator triggers updates of
invisible group objects, making instances of hidden groups possible.

However, dupli caches have to disable this dependency in order to avoid
unnecessary costly updates in hidden layers which are overridden by
cached data anyway. At the point where these dependencies are created
the evaluation context is unknown though, which means we cannot
distinguish between render and realtime evaluation for the purpose of
cache reading ...
2015-03-23 12:46:32 +01:00
0dd01668b4 Removed deprecated code. 2015-03-23 12:46:32 +01:00
834ac256f4 Make sure mesh data is really stored and reconstructed from the cache
entirely.

Also the code is much better structured now, moving toward a more
standardized sample/schema class definition.
2015-03-23 12:46:32 +01:00
be72e44548 CD_NORMAL support for mesh customdata caching. 2015-03-23 12:46:32 +01:00
9adbeed82c Fix for use of wrong CustomData for tessfaces. 2015-03-23 12:46:32 +01:00
7343aa5e0e Copy rgba components of MCol explicitly to the Alembic C4f type to avoid
potentially different ordering.
2015-03-23 12:46:32 +01:00
a30be4c277 MCol customdata caching. 2015-03-23 12:46:32 +01:00
9baf925d2b MTFACE customdata is not suitable or necessary for caching, so disable
it.
2015-03-23 12:46:31 +01:00
266c99334d Added customdata writers/readers for missing mesh edge, poly and loop
data.
2015-03-23 12:46:31 +01:00
c053f0a53d UI cleanup and a bit nicer workflow by treating read/write mode like
an enum toggle.
2015-03-23 12:46:31 +01:00
19c5b3c61c Disable the bake operator if cache reading is enabled.
Re-baking cache results is not technically prohibited, but not useful
and allowing only read or write selectively gives a nicer workflow.
2015-03-23 12:46:31 +01:00
edf089a572 Cycles support for dupli caches.
If a cache is read-enabled cycles will now use the cached mesh data
instead of dupli results.
2015-03-23 12:46:31 +01:00
a86067888e Skip drawing of particle systems (including hair) when using cache
duplis.

Particle systems can not be overridden from caches easily, there are too
many strings attached to the data and code to make this reliable.
Instead, a new simplified data structure for reading hair from caches
will be added, which replaces drawing and rendering of particle data.
The original particle data is not updated through duplis, so is usually
out of sync and should not be displayed.
2015-03-23 12:46:31 +01:00
657cc3575a Main argument is no longer needed for cache reading, the cachelib is
now given explicitly.
2015-03-23 12:46:31 +01:00
ca0fcba43d Removed unused variable. 2015-03-23 12:46:31 +01:00
f161bb5912 Calculate bounding boxes for cached DMs to avoid visual popping when
using the original Object's bb.
2015-03-23 12:46:31 +01:00
542b40ae73 Test for NULL archive pointer when writing as well.
This should not usually happen because the operator asks for permission
to delete the file prior to writing, but should be checked nevertheless.
2015-03-23 12:46:31 +01:00
a85928466f Safeguard against crashes from invalid Alembic file paths by returning
NULL archive pointers.

This allows writer/reader code to test against obvious archive errors
easily and is unmistakable.
2015-03-23 12:46:31 +01:00
d0128f7c7c Fix for wrong ID code used in RNA->idcode mapping. 2015-03-23 12:46:30 +01:00
c9d7056f76 Removed group pointer from cache libraries and use object->cachelib
pointer instead.

This change makes it possible to have group duplicators using different
versions of a cache.
2015-03-23 12:46:30 +01:00
4959b2b30a Added a cache library pointer to objects as a replacement for CL->GR
pointers.

Relationship between CacheLibrary, duplicator Objects and Groups is
difficult. There are a number of somewhat conflicting goals:
- CacheLibraries write out data for objects and dupli groups. Multiple
  objects can be stored in the same cache: CL *->* GR
- Objects can override a dupli group with different caches: OB *->1 CL
- As before, each object can be the duplicator for one group: OB *->1 GR

To combine these requirements, the first relationship will be made
indirect. Only the Object -> Group/CacheLib relations are explicit
pointers in the DNA. For finding all objects contained in a cache
library the usual recursive DNA tagging system must then be used.
2015-03-23 12:46:30 +01:00
6f3e220d58 Removed the now redundant "Read" toggle from cache libraries.
At this point the reading is toggled on the side of group duplicators.
2015-03-23 12:46:30 +01:00
eb37ae59f2 Removed the explicit duplicache rebuild operator.
The cache is now updated on frame changes automatically, the operator
should no longer be needed.
2015-03-23 12:46:30 +01:00
f1b4f4900b Removed unused deprecated functions for cache library. 2015-03-23 12:46:30 +01:00
6860bfbe35 Sanity check for dupligroup caching functions. 2015-03-23 12:46:30 +01:00
0142bdb1ad Use a new flag in duplicator objects to enable cache reading and avoid
unnecessary dependencies.

This flag will replace the current "read" mode on cache libraries.

Beside enabling cache reading, it also disables the current "fake"
dependencies between duplicators and their group objects. This is
exploiting the layer visibility mechanism in depsgraph to ensure that
animated group objects get evaluated when used by a visible duplicator,
even when they are not themselves visible. These dependencies cause
group object updates even if the duplicator is using cached results.
To avoid this unnecessary overhead and make caching worthwhile we
rebuild depsgraph without these relations when using the cache instead.
2015-03-23 12:46:30 +01:00
c2012a68b8 Enable frame updates of duplicache through use of an invalidation flag. 2015-03-23 12:46:30 +01:00
78709abd10 Disable additional depsgraph tagging through cache libraries.
This code is outdated due to changes in reading code and obscures some
genuine depsgraph behavior.
2015-03-23 12:46:30 +01:00
667fcac696 Mesh overrides for duplis from cached Alembic data.
If a duplicator has cached data it will now replace the derivedFinal
mesh of objects with the cached version for drawing.

This is a compromise atm: It would be better to actually draw derived
meshes directly, so that we don't have to modify objects. Then we could
also have multiple different instances of the same orignal object
(in whatever way these might be defined). DNA Objects would then be
totally separate from duplis, but at this point the drawing and render
code makes this unfeasible.
2015-03-23 12:46:30 +01:00
bcca4e5676 Mesh storage and reading in child objects for dupligroups.
The layout of the Alembic files resembles the DNA structure in Blender:
- On the top level (under the top/root node) there are Abc::Objects for
  Blender ID datablocks (currently Object and Group)
- Objects store final data (DerivedMesh) and later simulation results
  etc.
- Groups store their full duplilists for instancing. Currently there is
  no recursive nesting of groups, since this would limit duplis to
  dupligroups and exclude e.g. duplifaces.

On reading the duplilist gets reconstructed and stored in the DupliCache
for a duplicator empty (the group instance). DerivedMesh data is stored
in a hash table for each instanciated object and can later replace
finalDM in drawing and rendering.
2015-03-23 12:46:30 +01:00
fe143aaeb3 Simplification of the archive init functions in writers and readers.
Now the base types for readers/writers are not nominally forming the
interface any more (they may be removed entirely later). This makes
possible a cleaner init method directly in the Abc Writer/Reader
classes.

Further work may be required in this area.
2015-03-23 12:46:29 +01:00
f3e5bd94db Moved the dupli cache reading code into a AbcDupligroupReader class.
This is more in line with how readers work in the Blender Alembic
implementation elsewhere.

Generally, readers are less persistent than writers: they are created
whenever cache results need to be updated (e.g. on frame changes) and
discarded afterward. Writers OTOH stay alive during the whole baking
job, since they keep the references to Alembic Writer instances and can
only be deleted once the writing for that part is done.
2015-03-23 12:46:29 +01:00
3b83c585e2 Store and apply dupli object transforms in the Alembic cache.
Note that the cache stores dupli matrices without the final parent
transform, since it only knows about the group itself. The duplicator
obmat is applied to the duplis after reading the cache.
2015-03-23 12:46:29 +01:00
da381bb948 Handle dupli cache on object copy and freeing. 2015-03-23 12:46:29 +01:00
ca2756dbc3 Updated cache reading function for the new duplilist structure.
Now we store duplilists entirely inside a single alembic object for the
group. This allows using all the generated duplis, which would be
difficult if the alembic file had to define all the possible recursive
dupli relations that Blender allows, beside straightforward Group duplis.
2015-03-23 12:46:29 +01:00
bdcf91615d Use a nested Object writer to store the Object ID blocks used by dupli
lists.
2015-03-23 12:46:29 +01:00
f1fde1f4fb Better dupligroup Alembic writer.
Uses the duplilist generated by Blender to define instances, instead of
recreating the group layout. This omits some information about actual
structure of the DNA, which might be useful later on. The main problem
is that the duplilist itself does not encode this, so it's a tradeoff
between either including the Group structure or omitting the other
dupli types, like face, vertex, particle duplis.
2015-03-23 12:46:29 +01:00
c71768d864 Alternative dupli generator function for creating duplis in a group
without a specific parent.
2015-03-23 12:46:29 +01:00
a40efb7810 Some disabled code to enable automatic cache updates on every duplilist
creation call.

This is executed *a lot* (even for simple things such as viewport
panning), so the code is probably not suitable in this form. At least
it could do a frame comparison to avoid unnecessary updates.
2015-03-23 12:46:29 +01:00
11828eb1e5 Use a cached group only when a CacheLibrary is actually available.
Otherwise the regular duplilist generator is used.
2015-03-23 12:46:29 +01:00
57bd99124d Replace usage of the procedural duplilist generation by cached duplilist. 2015-03-23 12:46:29 +01:00
64b6bf3a26 Store object pointers for the dupli objects we generate from caches.
This is necessary for the current viewport drawing and rendering code,
which expected each dupli instance to represent a copy of data in the
DNA.

The code maps base-level objects in the cache to DNA Objects inside the
dupligroup by name. Only objects that can be found in the blend data
will be allowed for DupliObjects.
2015-03-23 12:46:28 +01:00
caaf794642 Moved the DupliCache struct into DNA, it will be needed for drawing and
RNA access later.
2015-03-23 12:46:28 +01:00
5bc204d8f4 Simple operator to force rebuilding of a dupligroup cache.
This is a placeholder for proper depsgraph integration. Eventually frame
changes and some other updates should rebuild dupligroup caches
automatically using the depsgraph. Until then this operator is a quick
way to test the IO from caches and the further drawing and rendering
(TODO).
2015-03-23 12:46:28 +01:00
0ff8990e13 Cache reading functions for constructing a nested dupligroup list based
on Alembic cache data.
2015-03-23 12:46:28 +01:00
70b56ec378 Include mesh writers in the cache writers list. 2015-03-23 12:46:28 +01:00
2786cb8c13 Removed unused code. 2015-03-23 12:46:28 +01:00
6ff214d938 Removed current implementation of cache reading from various parts of
BKE (DerivedMesh, particles, cloth).

The new cache implementation will be used for constructing dupli data
instead, bypassing the complexities of the modifier stack.

Conflicts:
	source/blender/blenkernel/intern/cloth.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_system.c
2015-03-23 12:45:48 +01:00
9146dcfda7 Initial code to support dupli group instancing and overrides through
Alembic caches.

This creates representations (Abc::Object) for Blender Object and Group
datablocks in the Alembic files and uses Alembic instancing to define
the dupligroup hierarchy. This leads to a relatively flat hierarchy in
Alembic files:

Top -> Object/Group -> DerivedMesh/Particles/Hair/Cloth/Smoke/...

The dupligroup structure can not be represented by a hierarchical
structure such as the Alembic object nesting, because of the
many-to-many relationship between objects and groups (a group can
contain multiple objects, multiple objects can instance the same group).
Instead we use the instancing feature of Alembic to represent
dupligroups. This is created in 2 stages to ensure all the main ID
blocks have been serialized before creating references.
2015-03-23 12:23:38 +01:00
62ec8251e4 Nicer info printing support for instances in Alembic files.
This now avoids repetition of internal instance structure.
2015-03-23 12:23:38 +01:00
becc6432b5 Fix for invalid ob->data access in case non-mesh objects are in the
cached group.
2015-03-23 12:23:38 +01:00
a17db9b8c1 Improved edge attribute caching.
Now edges should be fully restored from cache, fixing edge display.
2015-03-23 12:23:38 +01:00
c761b512d4 Omit hair path lengths for anything but the first sample.
We can safely assume that paths don't change their lengths. This might
safe some cache space.
2015-03-23 12:23:38 +01:00
daef0f0d00 Fix for particle pathcache caching: have to check the psys->renderdata
pointer to figure out if we are evaluating with render settings.
2015-03-23 12:23:38 +01:00
467a19c6ef Fix for some archive checks to make sure we don't access invalid data.
This can happen if the archive file cannot be opened for some reason.
2015-03-23 12:23:37 +01:00
1b7ff83152 Implementation of MDeformVert customdata layers in Alembic. 2015-03-23 12:23:37 +01:00
fc22692394 Fix for name collisions in compound properties when writing CustomData.
This is not clearly documented for Alembic, but apparently properties
inside compounds still need to be name uniquely for the whole object.
This is somewhat involved for Blender's CustomData, because we have
5 different customdata elements for meshes (vert, edge, face, poly,
loop) and each of these can have the same types and multiple layers of
the same type ...
2015-03-23 12:23:37 +01:00
8519ec96d7 Fix for Alembic info printer printing to std::cout instead of the
internal stringstream.
2015-03-23 12:23:37 +01:00
12497e457c Fix for potential size issue: need 64 bits for CustomDataMask types. 2015-03-23 12:23:37 +01:00
d483a5b1db Nicer error handling for unimplemented CustomData layer types.
Instead of failing an assert, simply print an error message and return
gracefully. We don't want Blender crashing because of this.
2015-03-23 12:23:37 +01:00
e39af0806d Ugly hack for caching code to deal with quirky modifier stack behavior.
CustomData layers are pruned by the CDDM_copy function when they have
CD_FLAG_NOCOPY set. This is based on later modifiers in the stack, which
can specify that they require certain data layers - but the caching
modifier itself should store only what is needed by later modifiers.
It means we cannot easily keep a full copy of the DM in the cache
modifier to writing into caches later.

For now the hackish solution is to temporarily disable NOCOPY flags when
copying the DM. This is really not nice and needs a better solution.
2015-03-23 12:23:37 +01:00
43a09876e9 Support CD_ORIGSPACE layer caching.
This is needed by particles for distributions on meshes with changed
topology (which is of course broken).
2015-03-23 12:23:37 +01:00
f5de2c6693 Tessface customdata for derived mesh caching. 2015-03-23 12:23:37 +01:00
ec998c9cf5 Support for CustomData in Alembic caches.
This is a skeleton feature that provides a general way of storing
CustomData types. Currently only ORIGINDEX layers are implemented, the
code is designed to make extension easy.

Storing CustomData layers in Alembic is a bit involved because the
complex structs often used as customdata need to be de-interleaved for
Alembic into a set of POD (plain-old-datatype) array properties.

In addition the property names should be unique, so that mapping abc
properties back to customdata layers is safe. This works by using 2
levels of compound properties: the first level stored per CD type
properties, with a number of properties for each layer of this type,
using either a name or index (for unnamed layers). The internal
properties can then in turn be compounds, if structs need to be
serialized into PODs.

Abc property readers/writers are created dynamically for the CustomData
compounds. This is necessary because we don't know in advance what kind
of data layers a DerivedMesh or other CD user will have, and this can
change each frame in theory. Alembic is easier with state data schemes,
but using it this way is possible (if somewhat cumbersome).
2015-03-23 12:23:37 +01:00
00edf75a62 Fix for cache item filtering: items can be part of the cache library
but disabled, in that case hide them as well.
2015-03-23 12:23:37 +01:00
1d0b6c6e7c Fixed test for "render" eval mode for hair dynamics.
This is totally weird and convoluted, no idea if correct.

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
2015-03-23 12:23:33 +01:00
99231fb9c3 Removed the DM writer/reader from hair dynamics again, this is part of
the particle stuff and does not work.
2015-03-23 12:23:22 +01:00
01bf0f37a7 Archive Info operator for Cache Library archives.
This creates a string with information about all the objects and
properties contained within a (Alembic) archive, used by a cache
library.

The operator has 3 modes of presenting the info string:
- stdout, ie. printing to the terminal
- popup window (not very useful usually due to size limits and lack of
  scrolling)
- clipboard copy
2015-03-23 12:23:22 +01:00
03fddef28a Use a combined class for hair dynamics for cloth and mesh data.
Particles store a copy of the DM internally as the emitter.
2015-03-23 12:23:21 +01:00
a9e1e240f4 Alembic: Fixes for linux buildbot and scons 2015-03-23 12:23:21 +01:00
61ee7c96d1 Depsgraph tagging function for cached objects.
This is necessary to trigger object data updates for indirectly linked
objects, which would otherwise not be evaluated.
2015-03-23 12:23:21 +01:00
8794a167a6 Convenience feature: When linking a cache library, always default it to
'read' mode locally.

Linking a cache library is meant to be used for getting existing cache
data into a file.
2015-03-23 12:23:21 +01:00
4a399119f3 Left a comment in DerivedMesh.c explaining why the caching system has
to use the cumbersome cachedm pointer instead of virtual modifiers.
2015-03-23 12:23:21 +01:00
46cd930df7 Use a dedicated input_dm pointer in the cache modifier to provide a mesh
result read from the cache.

Mixing this with the output_dm used for writing leads to undefined
situations where the DM was released but should actually be passed on.
2015-03-23 12:23:21 +01:00
028085e856 Use correct flag enums for checking render/viewport eval mode when
writing derived mesh caches.
2015-03-23 12:23:21 +01:00
1bfcc2d0de Fix for meaningless build error (no return value, can never happen). 2015-03-23 12:23:21 +01:00
f7d04e0d6a Minor fix for UI code showing cache items. 2015-03-23 12:23:21 +01:00
f63a70c6b0 Render/Viewport evaluation mode for cache libraries.
This designates a cache library to be used either for the viewport or
for renders. A "Render" cache library will evaluate modifiers with
render settings and a "Viewport" cache library will use viewport
(realtime) settings.

When reading the cache, the library will only be
used for the assigned purpose, i.e. a Render cache does not work for
viewport caching and vice-versa (although a cache can be baked for one
setting and then switched afterward).

Note that render results will never be visible in the realtime viewport
due to the way object evaluation is handled in Blender at this point
(render settings are only evaluated explicitly during renderer sync).

Conflicts:
	source/blender/blenkernel/intern/particle_system.c
2015-03-23 12:23:18 +01:00
cc0cabaa95 Allow the cache bake operator to overwrite existing files, using a
confirm dialog.
2015-03-23 12:23:12 +01:00
d70519b284 Removed now-unused util_path files from the pointcache lib.
Paths are constructed outside this module now. A valid absolute path
should always be provided through the API calls.
2015-03-23 12:23:12 +01:00
90b97cfdc8 Record and display the last result of cache reading in the cache library
items.
2015-03-23 12:23:12 +01:00
92f6fb7650 Free readers properly after applying cached data. 2015-03-23 12:23:12 +01:00
f2a1508a86 Set reader/writer archive as a separate step outside the constructors.
This allows nicer creation of readers/writers //before// actually
opening the archive. This in turns can simplify code quite a bit.
2015-03-23 12:23:12 +01:00
2b9a4ca54e Moved functions for constructing readers/writers based on cache library
out of pointcache into blenkernel.

This is quite simple and repetitive and there is not need to have this
in the main pointcache/Alembic API. The code is mostly concerned with
logic of DNA data, so pointcache shouldn't have to deal with it.
2015-03-23 12:23:12 +01:00
7cb320ee61 Ported archive filename constructor from pointcache library to BKE.
The pointcache library is now pretty much independent from ID blocks and
should not be responsible for handling file paths. The path construction
is also fairly straightforward now compared to the old point cache
system, with only basic conversion of relative to absolute paths for
loading archive files.
2015-03-23 12:23:12 +01:00
d28353e9e2 Cache read result enum in DNA mirroring the internal pointcache results.
This can be stored in cache library items as an indicator of cache
reading state.
2015-03-23 12:23:12 +01:00
ee4c862926 Use a uiTemplate function for showing cache library items instead of
python code to unify symbols.

This is necessary because the operator for adding new items (as opposed
to the enable/disable button) cannot be shown with the same checkbox
button. The UI template function can display a custom button for the
operator, so the look becomes less confusing.
2015-03-23 12:23:12 +01:00
f000702532 Nicer default filename for cache library paths.
This now appends a default extension based on the cache backend used.
At this point this is always Alembic (.abc) but would allow other
backend formats in the future.
2015-03-23 12:23:12 +01:00
bc5cdd60d4 Improved filtering for cache library content.
In addition to the object name filtering, items in cache library groups
can now be filtered by type as well.

Existing items in the cache are always displayed, so as to not hide
important information (what gets stored in the cache). The filtering
is primarily a utility to simplify searching inside the group for things
that should be added to the cache.
2015-03-23 12:23:12 +01:00
f15e5d3e89 Use a generator in the python code to iterate over all the potential
cache library items.

This should ideally happen on the RNA side, but making the equivalent of
python generators in the RNA is really difficult.
2015-03-23 12:23:12 +01:00
bdc9a7d7f7 Don't show mesh cache items for non-mesh objects. 2015-03-23 12:23:11 +01:00
ad1fda1823 Disabled collection properties for 'virtual' cache items in RNA.
This requires a better design and is not so easy to implement properly
within the limits of RNA definition. These collections don't physically
exist in the DNA, they are mainly utilities for looping over
//potential// items in a cache library. For now the python code has to
be adapted to only show valid items, until the RNA provides a good
solution.
2015-03-23 12:23:11 +01:00
e9d947860a Generic validation function to help ensure that we don't add meaningless
items to a cache library.
2015-03-23 12:23:11 +01:00
15ce114a3b Replaced use of the HDF5 Alembic backend by Ogawa.
Ogawa is replacing HDF5 as the new de-facto standard. Selecting either
should be more formalized and a user option, for now it's just hardcoded.
2015-03-23 12:23:11 +01:00
b41c208e87 Filter utility for finding objects in a cache group faster.
This is a preliminary feature and implemented purely in python, to be
replaced later.
2015-03-23 12:23:11 +01:00
b94d8c93e7 New 'read' flag to toggle reading of the CacheLibrary as a whole.
This is also used during the bake process to avoid confusion: The read
flag gets disabled for the baking cachelib, so that objects don't try
to read cache data that is supposed to be generated.
2015-03-23 12:23:11 +01:00
8e76ac4744 Delete operator for cache library datablocks.
CacheLibrary datablock has a generic unlink function now, but currently
nothing actually links to cache libs themselves, so it's empty. Still
good to keep this in mind for the future.
2015-03-23 12:23:11 +01:00
4cec4d9d3c Reader/Writer API functions for basic particles.
Also slightly renamed pathcache functions for consistency (use plural
'particles' instead of 'particle').
2015-03-23 12:23:11 +01:00
4484761714 Removed deprecated and unused alembic API functions.
These are now implemented as virtual functions in the Factor class.
2015-03-23 12:23:11 +01:00
03f2e329bb Fixes for scons build files. 2015-03-23 12:23:11 +01:00
4f7bc3a7aa Fix for circular linker dependency with cache code library.
The `bf_pointcache_alembic` code is a separate library, to avoid
muddling up core code with alembic includes and preprocessor defines.
Alembic stuff only belongs strictly into alembic code and can be
disabled cleanly.

The `bf_pointcache` and `bf_pointcache_alembic` libraries had a circular
dependency, because the alembic implementation functions were called
directly. Now there is a "Factory" class to abstract the creation of
concrete implementations for readers and writers.
`bf_pointcache_alembic` defines this factory and is registered
//outside// of the core `bf_pointcache` lib, so there is no linker
circularity.
2015-03-23 12:23:11 +01:00
8618cd39d6 Removed unused thread mutex file from pointcache lib. 2015-03-23 12:23:10 +01:00
51d7c80a00 Removed deprecated rna_pointcache.c file.
Scons was still compilling this, since it's source files are not
explicit.
2015-03-23 12:23:10 +01:00
1106645500 Fix for indirectly linked object pointers in cache libraries.
These must be made "extern" to avoid losing links on loading.
2015-03-23 12:23:10 +01:00
a8a00074c1 Removed remaining 1 frame difference in archive storage.
This was an artifact from the previous way of mapping non-0 start frame
to time 0.0. Now we start at times > 0.0 to match with the start frame.
Both ways are possible, can be changed later if needed.
2015-03-23 12:23:10 +01:00
dc703cefbf Fixed start frame mapping in Alembic archives.
Writers were always starting at time 0.0, which means that for start
frames > 1 the readers would always be off. Now match the writer start
frame to the actual Blender start frame.
2015-03-23 12:23:10 +01:00
609ce89688 Added poll function for the cache manager panel to prevent hiding in
Cycles render engine.

The "compat_engines" thingy really gets in the way here ...
2015-03-23 12:23:10 +01:00
66f9cda5b3 Cache reading for particle paths.
Conflicts:
	source/blender/blenkernel/intern/particle.c
2015-03-23 12:23:07 +01:00
f0d8395191 Fix for cache modifier linking and handling of the default case (no
cachd modifier).
2015-03-23 12:22:59 +01:00
fccc665162 Changed implementation of the Cache modifier to work in tandem with the
cache library system.

The Cache modifier is now an optional "break point" of the modifier
stack:
- Without a cache modifier the stack works as before. Baking will write
  the final stack result. After baking the cache replaces the whole
  stack.
- With a cache modifier the stack result at the modifier's position is
  stored. The cache is then applied as the output of that modifier,
  skipping preceding modifiers. That way additional modifiers can be
  applied on top of the cache.
- When using multiple cache modifiers, only the last (active) one will
  be used, since all previous cache results would be discarded anyway.
2015-03-23 12:22:59 +01:00
b321526888 Replaced point cache in cloth modifiers (also hair) with the new caching
system.

Conflicts:
	source/blender/blenkernel/intern/cloth.c
2015-03-23 12:22:56 +01:00
267d37ce51 'expand' function for cache libraries, so link/append makes it load the
group and objects too.
2015-03-23 12:21:58 +01:00
ab6c48b935 Make cache libraries a linkable data block. 2015-03-23 12:21:58 +01:00
9e336362d8 Take NULL object pointers in cache items into account.
This can happen if an object gets deleted or isn't loaded for some
reason. The item should just be ignored in that case and removed at the
next opportunity (cleanup function).
2015-03-23 12:21:57 +01:00
c32587c103 When using the "new cache library" operator, enable fake user by
default.

Nothing actually links to a cache library at this point (and probably
won't in the future), so fake user is necessary to avoid losing data.
2015-03-23 12:21:57 +01:00
af671df3e1 Display cache library name and fake user button, imitating template_ID. 2015-03-23 12:21:57 +01:00
9bb0f55e3c Importing of caches into Blender data.
Currently only implemented for DerivedMesh.
This replaces the `final_dm` calculation of the modifier stack with the
result from cache loading.
2015-03-23 12:21:57 +01:00
982ea69660 UI fixes, draw bake operator button only once at the top. 2015-03-23 12:21:57 +01:00
173a104335 Hair path writer needs 2 different variants for parent/child hairs. 2015-03-23 12:21:57 +01:00
59db306770 Added writers for derived mesh result and hair paths. 2015-03-23 12:21:57 +01:00
8696000dd1 Use explicit name strings for all readers/writers in the cache instead
of constructing names internally.

This helps prevent name collisions and guarantees a consistent naming
scheme for putting multiple items in the same cache.
2015-03-23 12:21:57 +01:00
da1c8006f2 New reader/writer for DerivedMesh.
Used as a base for existing PointCacheModifier classes, but can be used
on its own.
2015-03-23 12:21:57 +01:00
df36ca1ff7 General support for export to/import from Alembic files based on Cache
Libraries.
2015-03-23 12:21:56 +01:00
3ddf2c232f Deleted unimplemented parts of the previous pointcache system, to make
refactoring simpler.

Since the new approach is not tied to the old set of point cache data
types there is really no need to carry their empty husks around. Once
the new caching system is defined in detail we can add back whatever
makes sense.
2015-03-23 12:21:56 +01:00
08e06cdaf7 Disabled specialized Point Cache modifier handling in the modifier
stack, this will be replaced and is not correct anyway.
2015-03-23 12:21:56 +01:00
a47ce4b04d Refactoring of archive handling in readers/writers.
Now instead of each reader/writer creating its own archive, the archive
is created by the caller in advance and passed as a constructor
argument. This means that multiple items can be stored together in the
same archive.
2015-03-23 12:21:56 +01:00
e0c8daa160 Removed unused Scene pointer from the base Reader/Writer classes. 2015-03-23 12:21:56 +01:00
091dc4ec7e Operator skeleton for a cache bake operator, using the job system. 2015-03-23 12:21:56 +01:00
ee550b2fc7 Fix for undefined return value. 2015-03-23 12:21:56 +01:00
e675d415d6 Removed unused line. 2015-03-23 12:21:29 +01:00
a73fa2e02c Unlink and cleanup functions when objects or the cached group get
unlinked or changed.
2015-03-23 12:21:29 +01:00
a12f53ab83 Make sure cache item pointers are lib-linked correctly. 2015-03-23 12:21:29 +01:00
eb6785112b Name string construction for cache items, to use as a unique identifier
in the cache library.
2015-03-23 12:21:29 +01:00
14f9a277ab Draw some UI buttons for all the current cache item types. 2015-03-23 12:21:29 +01:00
87dc360d7e Updated hash table for lookup of enabled cache items and added basic
UI support.
2015-03-23 12:21:28 +01:00
4683478db8 Improved collections in RNA for looping over potential caching items
in the object group.
2015-03-23 12:21:28 +01:00
6df11cdd3f Define a collection of "object_caches" in the CacheLibrary RNA for
iterating over all objects eligible for caching in the group.

This allows for nested dupligroup instances as well. All objects that
are instantiated at least once by any group can be included in the
respective cache, but get represented only once because the cached data
is the same anyway.
2015-03-23 12:21:28 +01:00
4e9d0af4af Link main CacheLibrary pointers in readfile. 2015-03-23 12:21:28 +01:00
c4d998ecad Simplified cache item path description, based on plain ID blocks with
subtype/index.

This omits possible instancing and recursion by dupli groups, but since
the data of instances is always the same in Blender at this point, there
is little need to take them into account for caching.

At some point in the future it may become desirable to store full dupli
hierarchies in the cache, but it doesn't make sense to try to design a
fully-fledged path descriptor for this hypothetical case now.
2015-03-23 12:21:28 +01:00
55b4652885 BKE functions for managing cache content based on a group.
This uses a complete hierarchy of group instances, based on a path
hierarchy (object names).

Putting
2015-03-23 12:21:28 +01:00
472d5b964a Simple cache manager panel UI in the scene buttons.
This is mostly a simple and unintrusive placeholder to have some way of
making caches accessible, but needs some more thought.
2015-03-23 12:21:28 +01:00
e6a6e5d17a Group pointer property for cache libraries to associate them with an
object group.

This is somewhat experimental, eventually we may want to link to Objects
instead, or allow multiple cache targets for the same cache, etc.
2015-03-23 12:21:28 +01:00
eec3e90cdb Missing include. 2015-03-23 12:21:28 +01:00
2fc6bdbd63 Removed meaningless comment. 2015-03-23 12:21:28 +01:00
ecd576e689 New operator for adding cache libraries.
Conflicts:
	release/scripts/startup/bl_ui/properties_physics_common.py
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/pointcache.c
	source/blender/editors/physics/physics_ops.c
	source/blender/editors/physics/physics_pointcache.c
2015-03-23 12:21:27 +01:00
03ecd1760a New ID datablock 'CacheLibrary', for managing physical cache archives
and files.

At it's core this is just a file path, but many different cache users
may refer to this, so having a dedicated ID block helps. It can be
compared to Image datablocks, which also primarily are used for data
on storage, but can be packed with the blend file, and carry some
additional information that would be cumbersome to keep sync'ed
otherwise.

The name 'CacheLibrary' deliberately resembles the 'Library' datablock:
just as a Library stores ID blocks in a physical file, a CacheLibrary
stores cached data (in Alembic HDF5/Ogawa or other formats).

Conflicts:
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/pointcache.c
	source/blender/makesdna/DNA_pointcache_types.h

Conflicts:
	source/blender/makesrna/intern/rna_main_api.c
2015-03-23 12:21:21 +01:00
bc56a3797e Fix for remaining PointCache references in the alembic code.
Now, for the time being, uses a simple relative "//blendcache/" folder
path again. This will be adressed later.
2015-03-23 12:20:22 +01:00
ab027c9a34 PointCache modifier to act as a terminator in modifier stacks.
When writing DerivedMesh data, the modifier result at the point of the
modifier will be used for writing to the cache. If this modifier is not
used the derivedFinal mesh is used instead.
2015-03-23 12:12:07 +01:00
6d94c2f57a Cache API for export/import of Blender data to/from Alembic files.
The pointcache API is designed to keep the general concept of caching
separate from the concrete Alembic implementation. Other types of file
export/import would be possible, e.g. for OpenVDB data.
2015-03-23 11:53:56 +01:00
0c6df47e7b Initial Alembic library integration for Blender.
Adds Alembic as a dependency and build support in cmake and scons.

Also extends the install_deps.sh script with a temporary installation
procedure for the Alembic libraries. This is still very hackish and
needs to be improved.
2015-03-23 11:53:05 +01:00
b999ed2efd Merge branch 'master' into gooseberry 2015-03-20 16:36:34 +01:00
7e79651a56 Get rid of old panel for GPU depth of field settings 2015-03-20 15:56:49 +01:00
a568de8a83 Merge branch 'master' into gooseberry 2015-03-20 15:45:11 +01:00
004429761d Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/ED_view3d.h
2015-03-17 11:07:03 +01:00
459b1a907c Better fix for animation returning negative values when AVsynch is on,
patch by Nexyon, thanks!
2015-03-16 11:50:17 +01:00
c3c2a3bbe8 Revert "Attempted fix for OpenAL synchronization."
This reverts commit d10e80fe79.
2015-03-16 11:45:59 +01:00
e1815ce69e Merge branch 'master' into gooseberry 2015-03-13 17:47:41 +05:00
d164634cc0 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-03-13 13:41:37 +01:00
07a29084a1 Cleanup: unused var 2015-03-13 02:04:03 +11:00
7a9428e110 Merge branch 'master' into gooseberry 2015-03-13 02:01:11 +11:00
09d0516b4d Revert "Fix blenderplayer not compiling after modifier d&d commit"
This reverts commit 1a0e6336d6.
2015-03-11 19:08:30 +01:00
3f5b1e7989 Revert "Modifier Drag&Drop"
This reverts commit 91d0f6f113.

Artists here seem to dislike the interface being stuck after a change to
modifiers, reverting until an interactive solution is coded.
2015-03-11 19:07:40 +01:00
6610bcb697 Don't push merge without building first fix. 2015-03-09 12:46:22 +01:00
3272c3a7a0 Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/ED_view3d.h
	source/blender/editors/space_sequencer/sequencer_draw.c
2015-03-09 12:44:04 +01:00
8cad3e3581 Transform widget: Don't highlight rectangle (cursor should be enough
indication)
2015-03-09 12:41:54 +01:00
02c142e582 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/include/ED_view3d.h
	source/blender/editors/space_sequencer/sequencer_draw.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/makesdna/DNA_view3d_types.h
2015-03-09 12:40:59 +01:00
Julian Eisel
1a0e6336d6 Fix blenderplayer not compiling after modifier d&d commit 2015-03-08 16:23:56 +01:00
Julian Eisel
91d0f6f113 Modifier Drag&Drop
**Warning: WIP!** Basic functionality works fine and there shouldn't be any crashes, however, if you occur issues, feel free to report them to me (not in the bug tracker!)

Some more effort is needed to get this ready for master, but I thought it would be nice as a little present for the Gooseberry-team (I heard some of you were requesting this?) and the ones using the Gooseberry-builds :)

Oh, and better not look at that code, it's ugly and a lot of changes are planned, I just wanted to get something working before getting into details.
2015-03-06 17:24:11 +01:00
7b426d2384 Fix issue reported on irc by Sebastian, crash when undoing and changing
screen.

Apparently the screen on the given file did not have a scene attached.

Not sure how this is possible exactly, but for now just guard against it
at load time by assigning default scene in that case.
2015-03-06 17:24:11 +01:00
d1794b897c Fix broken "force setting multisamples only once", introduced in b5b359b48f 2015-03-06 17:24:11 +01:00
a15b239adc Fix metaball->mesh removing all metas in the scene
Assumed the entire scene used the one motherball.
2015-03-06 17:24:11 +01:00
76c215249e Fix access freed memory when doing constraints ID counter on main free
Basically just made constraints free function aware of possible do_id_users
argument, same as we've got for objects, object data and so on.
2015-03-06 17:24:11 +01:00
77c70d4495 Fix T43905: Crash happens when press Create Plane Track
It was only happening on 32bit platforms because of alignment
differences when allocating class.

Now got rid of copy of eigen matricies stored by value in the
residual block which solves aligment issues and should also
give some unmeasurable speedup.
2015-03-06 17:24:11 +01:00
8be2775367 PyAPI: clarify fallback docstring 2015-03-06 17:24:10 +01:00
720599e7a8 Fix T43904: calc_vert_angle returns wrong value
This was mis-named, rename to `calc_edge_angle`
and allow a fallback value in the case when the vert doesn't have 2-edges.
2015-03-06 17:24:10 +01:00
c12ae10487 BMesh: Add extended BM_vert_calc_edge_angle that takes a fallback value 2015-03-06 17:24:10 +01:00
7acf48d2fe Cleanup: quiet minilzo warnings 2015-03-06 17:24:10 +01:00
f64ba6abfa Cleanup: unused warnings 2015-03-06 17:24:10 +01:00
b2d6443ed0 Cleanup: unused macro warning 2015-03-06 17:24:10 +01:00
14d30210eb Fix typo in "Add" and "Subtract" mode of Vector Math node.
Differential Revision: https://developer.blender.org/D1003
2015-03-06 17:24:10 +01:00
Julian Eisel
0d3ad6ef63 Correction to previous commit
Calling ensure_lookup_table for each face is stupid! :/
(Noted by Sergey - thx)
2015-03-06 17:24:10 +01:00
Julian Eisel
14298b2e7d Fix T43900: "Operator Mesh Add" template fails
Another script that was missing the lookup_table call.
2015-03-06 17:24:09 +01:00
7c61f548d6 Revert "COLLADA - support for shadeless material (SHADER_CONSTANT)"
This reverts commit 04b0a9f4b8.
2015-03-06 17:24:09 +01:00
d10e80fe79 Attempted fix for OpenAL synchronization.
This hit animators already, basically when using sound sync we can
hit negative frames. This happens because we always subtracted the full
range of the triple buffer size from the timing, even when buffers were
flushed.

Also, old code read the offset from the offset of the reader. The
problem here, is that due to threading there is a time offset between
the when this offset is set and when it is offloaded to the buffers,
which means that we could get quite some variance between time
reporting.

Now sounds keep a private byte offset which is incremented right before
invalidating old buffers. This should make the combination of OpenAL
time report + byte offset more accurate. For even more accuracy we might
spinlock while updating those values but for now left it as is for fear
of the lock interfering with frame update performance. We can try to be
smarter here, storing old value while update is happening, and use
trylock and the old values if it fails but for now commit the simple
version.
2015-03-06 17:22:54 +01:00
bd56eca825 Merge branch 'master' into gooseberry 2015-03-05 19:15:31 +01:00
6c317fbcb9 Don't re-typedef structure in wm_types.h
This makes strict compilers to give quite a few of warnings.
2015-03-04 18:13:58 +05:00
02685aca52 Fix T43878: Applying non-constructive modifiers crashing blender
The issue was caused by recent DM to mesh conversion which was taking ownership,
and it was failing if there are any referenced layers in the custom data.

Now disable passing ownership if there are any referenced layers.
2015-03-04 18:06:21 +05:00
3224749763 Merge branch 'master' into gooseberry 2015-03-03 23:09:31 +13:00
2cacb22422 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-03-01 15:41:10 +01:00
f5c9df75ad Merge branch 'master' into gooseberry
Conflicts:
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-03-01 12:42:35 +01:00
41d05dbf30 Merge branch 'cycles_memory' into gooseberry 2015-02-27 15:07:03 +01:00
d4386ee615 Fix blenderplayer 2015-02-27 15:06:45 +01:00
02acdead96 Merge branch 'cycles_memory' into gooseberry 2015-02-27 16:36:48 +05:00
136c8d1ae0 Add argument to DM_to_mesh() function to take ownership over the DM
The idea is pretty simple: instead of making temporary copy of all the
related custom data layers just pass the ownership from the DM to the
mesh.

This is really handy in cases when you've got DM which you need to
convert to Mesh datablock and wouldn't need that DM after conversion
anyway.

Foe example, render database conversion, exporters and even Modifier
Apply will benefit from this option.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1127
2015-02-27 16:27:56 +05:00
0ef8993fdc Merge branch 'cycles_memory' into gooseberry 2015-02-27 12:46:19 +05:00
30a324013a Merge branch 'master' into gooseberry 2015-02-27 12:00:48 +05:00
6320749361 Add an option to mesh.calc_tessface() to get rid of polygons and loops
The purpose of this change is to add extra possibility to render engines and
export scripts to reduce peak memory footprint during their operation.

This new argument should be used with care since it'll leave mesh in not really
compatible with blender format, but it's ok to be used on temp meshes.

Unfortunately, it's hard to get scene where it'll show huge benefit because
in my tests with cycles peak memory is reached in MEM_printmemlist_stats().

However, in the file with sintel dragon it gives around 1gig of memory benefit
after removing the polys which would allow other heavy to compute stuff such as
hair (or even pointiness calculation) to not be a peak memory usage.

In any case, this change is nice to have IMO, and only means more parts of
scene export code should be optimized memory-wise.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1125
2015-02-27 01:07:59 +05:00
79a5c97064 Cycles: Free caches used by the synchronized objects
Issue this commit is addressed to is that particle system and particle modifier
will contain caches once derived mesh was requested and this cached data will
never be freed.

This could easily lead to unwanted memory peaks during synchronization stage
of rendering.

The idea is to have RNA function in object which would free caches which can't
be freed otherwise. This function is not intended to deal with derived final
since it might be used by other objects (for example by object with boolean
modifier).

This cache freeing is only happening in the background rendering and locked
interface rendering.

From quick tests with victor file this change reduces peak memory usage by
command line rendering by around 6% (1780MB vs. 1883MB). For rendering from
the interface it's about 12% (1763MB vs. 1998MB).

Reviewers: campbellbarton, lukastoenne

Differential Revision: https://developer.blender.org/D1121
2015-02-27 01:01:07 +05:00
faf612f113 Fix for child particle clumping noise, using the orco parent location
for clumping instead of deformed location.

The orco location must be used for roughness to ensure a stable shape,
but for moving child keys toward the parent (clumping) the deformed
location must be used.
2015-02-26 12:40:14 +01:00
466c532ba6 RNA: correct limits 2015-02-26 15:53:28 +11:00
eb25547a84 Pointer property for selecting particle systems in the particle instance
modifier.

Internally the property is still an integer index, but using a pointer
with a dropdown is much more convenient.
2015-02-24 19:17:38 +01:00
d22699be69 Removed stupid limit of 10 on particle instance modifier psys index. 2015-02-24 18:49:48 +01:00
cfa92fcc6f Fix for clumping noise randomness being unstable under deformation.
This randomisation was using the deformed parent coordinates for
calculating noise vectors, which causes unwanted movement as the parent
hair deforms. Instead the `orco` coordinates must be used for all noise
vectors, since these are from the undeformed mesh.
2015-02-24 16:36:15 +01:00
5de381ce5b Merge branch 'master' into gooseberry 2015-02-23 18:50:10 +01:00
4887d4c52a Fix T43770, we were doing multiplication with object matrix and not
reverting the GL state.
2015-02-23 10:45:54 +01:00
e93ec66dd0 Experimental hair shape key control with textures.
Rationale for this feature goes like this:

In meshes the influence of shape keys can be limited to certain vertex
groups. This allows shapes to be applied selectively on parts of the
mesh and possibly even be animated by changing vertex group weights over
time.

With hair shape keys there is no equivalent feature to vertex groups
(defining a vertex group on hair keys would be rather tedious anyway).
It would be possible to use the emitter mesh vgroups to assign a
per-strand blending weight, but since hairs usually are much more dense
than mesh vertices this would sacrifice accuracy.

A better option is to allow textures to influence the hair shape key
blending. For this purpose there is now a new texture influence.
A shape key name needs to be assigned to the MTex in addition to a
factor. It will then act as a multiplier for the shape key weight,
i.e. the base shapekey value still works as an overall control.
2015-02-23 10:03:46 +01:00
bdf39274cd Disallow duplis when drawing motion paths, also make it so draw option
is on by default
2015-02-20 16:06:01 +01:00
bcf88bf242 Merge branch 'master' into gooseberry 2015-02-21 00:10:38 +11:00
a605d93128 Use new motionpath flag exlusively to draw motionpaths for objects 2015-02-19 19:00:51 +01:00
a44112a552 Don't draw motion paths for armatures in edit mode. Results in nice
crashes
2015-02-19 18:56:38 +01:00
bd1af1dc8e Hjalti's Motion Path commit series no 2.
Draw motionpaths after scene. They are not really XRays since they don't
require any depth info so add separate list for them. Feature could be a
little more polished to avoid too many state changes but for now just
commit something that works (tm)
2015-02-19 18:44:23 +01:00
78fb421f4b Merge branch 'master' into gooseberry 2015-02-19 22:20:12 +05:00
a9c3fb718f Hjalti's Motion Path commit series no 1.
Introduce global flag to draw motion paths. Always. Even in render only
mode :)
2015-02-19 18:09:45 +01:00
efe4f99a10 Projective painting: Only dither if factor is more than zero 2015-02-19 16:46:05 +01:00
1329843744 Fix T43735 painting on perpendicular to the screen polygons is
problematic (still!)

It seems due to floating point precision issues we have to account for
even more cases.

Added colinear check for one more triangle edge-vertex and assumed that
if no collision test is found then triangle is completely inside box.

Such cases are mostly from float precision not catching triangle just
outside bucket. Now tests are much better for simple tests (paint/flood
fill cube from ortho view, paint sphere), however there are still some
rare cases of stray pixels.
2015-02-19 16:38:56 +01:00
a199460495 Merge branch 'master' into gooseberry 2015-02-19 13:28:18 +01:00
3cb9ec1844 New option "use signed distance" for force fields with "surface" shape.
By default a surface-based force will push things away from the surface
in both directions, regardless of whether a point is "inside" or
"outside" (judging by the surface normal). The new option makes a force
field always push things away in the direction of the normal, so that
it becomes less likely to get points "trapped" inside a mesh object.
2015-02-18 12:22:59 +01:00
58ffd8beb3 Always make sure the surface modifier has tessfaces available for
building the BVH.

A long long time ago (rB3816554cbc1a40dc5199c8e56e45817ec09128d5) it
was coded such that edges would be used instead of faces for surface
distance calculation. This is pretty much never what you actually want.
2015-02-18 11:51:47 +01:00
17a4f326b0 Merge branch 'master' into gooseberry 2015-02-18 02:26:48 +05:00
fd0732b5fa Merge branch 'master' into gooseberry 2015-02-18 00:59:50 +05:00
d0da158ad5 Merge branch 'master' into gooseberry
Conflicts:
	intern/cycles/blender/blender_mesh.cpp
	source/blender/editors/space_view3d/view3d_draw.c
2015-02-17 15:24:23 +01:00
64e3661434 Store particle index and randomized value from particle instance
modifiers, for use in shaders.

The particle instance modifier can now store 2 custom data layers:
- Index: the integer index of the particle
- Value: a randomized floating point number for shader variation

These layers have user-defined names, so multiple particle instance
modifiers can be used without overwriting customdata layers. In Cycles
the data can be accessed using an Attribute node with the same names.
2015-02-16 14:30:07 +01:00
5a14dd7476 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_sequencer/sequencer_draw.c
2015-02-16 13:02:00 +01:00
84ea48d58b Painstakingly merge branch 'master' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/space_view3d.py
	source/blender/blenkernel/BKE_camera.h
	source/blender/blenkernel/BKE_screen.h
	source/blender/blenkernel/intern/camera.c
	source/blender/blenkernel/intern/screen.c
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/blenloader/intern/writefile.c
	source/blender/editors/include/ED_view3d.h
	source/blender/editors/render/render_opengl.c
	source/blender/editors/space_view3d/space_view3d.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/gpu/CMakeLists.txt
	source/blender/gpu/GPU_compositing.h
	source/blender/gpu/GPU_extensions.h
	source/blender/gpu/intern/gpu_compositing.c
	source/blender/gpu/intern/gpu_extensions.c
	source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
	source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
	source/blender/gpu/shaders/gpu_shader_fx_lib.glsl
	source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
	source/blender/gpu/shaders/gpu_shader_fx_vert.glsl
	source/blender/makesdna/DNA_camera_types.h
	source/blender/makesdna/DNA_gpu_types.h
	source/blender/makesdna/DNA_view3d_types.h
	source/blender/makesdna/intern/makesdna.c
	source/blender/makesrna/intern/rna_camera.c
	source/blender/makesrna/intern/rna_scene.c
	source/blender/makesrna/intern/rna_space.c
2015-02-13 12:48:36 +01:00
80ce3516cc Partial instancing feature for the ParticleInstance modifier.
This allows using the same particle system for multiple objects without
creating too much repetitiveness. Each instance object can select a
range of the particles to actually use for instancing (default 1.0 means
all particles are used). To further avoid overlap with multiple
instancing objects, the offset value can be used to make each system
use a specific range of particles.
2015-02-12 20:20:55 +01:00
ced2f75554 Merge branch 'master' into gooseberry 2015-02-11 20:01:51 +01:00
ab4eb7a714 Merge branch 'master' into gooseberry 2015-02-11 17:27:08 +01:00
ae7d197c93 Merge branch 'master' into gooseberry 2015-02-11 18:29:11 +05:00
9adb6daa8c Merge branch 'master' into gooseberry 2015-02-11 11:19:13 +01:00
81c56d15c7 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-02-11 11:07:08 +01:00
54a8e50dea Merge branch 'master' into gooseberry 2015-02-11 10:46:33 +11:00
88fc1a5c50 Minor optimization for mask modifier
- don't resize ghash buckets (reserve maximum size)
- get vert, edge arrays instead of DM getVert, getEdge
- calloc -> malloc
2015-02-11 10:46:17 +11:00
ca04eef4f2 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2015-02-11 00:29:31 +01:00
5cef36e6e2 Merge branch 'master' into gooseberry 2015-02-10 20:24:35 +01:00
fe610b7437 Merge branch 'master' into gooseberry 2015-02-10 17:40:46 +01:00
6f9982a13c Merge branch 'master' into gooseberry 2015-02-10 21:01:22 +05:00
1dba2cd025 Add second widget call in-scene 2015-02-10 16:12:26 +01:00
26a74c8e11 Fix error in last commit 2015-02-10 12:53:36 +01:00
748d9eca90 Separate widget drawing to update and draw phase to make in-scene widget
drawing possible (need to update once, draw twice).
2015-02-10 12:52:29 +01:00
1a33fb983b Support dupli transparency pass.
Only for gooseberry for now, since it's slightly hacky and adds extra
cost to duplis.
2015-02-10 10:57:39 +01:00
258c2286cd Merge branch 'master' into gooseberry 2015-02-10 13:19:17 +05:00
60927ae2e0 WIP code to use in scene drawing for widgets. 2015-02-09 17:52:39 +01:00
f1462c759f Fix warning in py code. 2015-02-09 14:47:45 +01:00
606de82218 Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/customdata.c
	source/blender/makesdna/DNA_customdata_types.h
2015-02-09 14:30:12 +01:00
59dd3735bf Merge branch 'GPU_subsurf' into wiggly-widgets
Conflicts:
	source/blender/blenkernel/intern/subsurf_ccg.c
	source/blender/gpu/GPU_buffers.h
	source/blender/gpu/intern/gpu_buffers.c
2015-02-09 14:28:07 +01:00
d67d29035a Fix some ordering issues, remove leftover glBegin/glEnd 2015-02-09 14:23:58 +01:00
f07ca03185 Initial VBO code for GPU subsurf.
This commit adds a few generalizations to the VBO
code so that modifiers can create and populate their own GPU objects.

The VBO code originally supported CDDerivedMesh only. The design moves slightly
towards the viewport refactor where the rendering system requests data from the
modifiers.

In this commit only basic support for vertices and normals is provided and
some features from blender's VBO system, suchs as mapping to original faces,
unique element indices for vertices and loose vertex/edge support are missing.
Also, the quick navigation feature of the subsurf modifier won't be supported
for now.

What we do have is full support for solid shading with multiple materials,
flat/smooth shading and a big performance boost.
2015-02-09 14:19:03 +01:00
5186062d58 Integration of particle shapekeys with the depsgraph and driver eval.
It's a bit messy, but that is to be expected: all of the areas involved
(particles, shapekeys, depsgraph, drivers) are badly designed and
supposed to get major refactoring ...
2015-02-09 13:58:24 +01:00
a8b00f679a Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/blenkernel/intern/customdata.c
	source/blender/makesdna/DNA_customdata_types.h
2015-02-09 11:57:34 +01:00
017e2fb284 Merge branch 'master' into gooseberry 2015-02-06 17:41:15 +01:00
56e2469030 Cleanup 2015-02-06 17:22:08 +01:00
93549d4225 Tabbing into (but not out of) scene strips is supported now 2015-02-06 17:08:51 +01:00
6794e4a8bf Bring back yet again no scaling for proxies (squashing to a merge commit is bad) 2015-02-06 16:45:03 +01:00
3de0722234 Merge branch 'master' into gooseberry 2015-02-06 16:44:03 +01:00
264e830a7d bring back no scaling for proxies 2015-02-06 16:43:05 +01:00
88e07b1397 Slip tool accepts numerical input. 2015-02-06 16:43:05 +01:00
0a02c15dbc Get rid of no scaling for proxies for master, it causes FX to crash,
will code another workaround for gooseberry.
2015-02-06 16:43:05 +01:00
julianeisel
840ec37b33 Graph Editor: Auto View
Auto View automatically adjusts the view based on selection, so that the view is
always focused on the current selection.
A checkbox in the header is used to access it and it works for the following
selection methods: Toggle All, Border, Circle, Lasso, Left, Right, More, Less,
Linked, Column (so all except of single selection, in which this can be a bit
annoying)

Reviewed by @Aligorith (thanks for that :) )
2015-02-06 16:43:05 +01:00
7263fbd7a6 Fix T43578: Beauty Triangulation would hang in infinite loop, due to float rpecision issue.
Only recompute if cost is below -FLT_EPSILON, we can get cases where both cases generate
very tiny negative costs (see 'Cylinder.004' mesh in .blend attached to report).
2015-02-06 16:43:04 +01:00
722894ee1b Speed hack for gooseberry:
Proxies get no effects for speed (since they haven't been scaled)
2015-02-06 16:01:09 +01:00
28587f9134 Merge branch 'master' into gooseberry 2015-02-06 14:31:20 +01:00
3efbb8777a Gooseberry: fix multires sculpting not updating normals
Looks like just a refactoring mistake in the Gooseberry branch.
2015-02-06 14:14:40 +01:00
12cb3a78f2 Merge branch 'master' into gooseberry 2015-02-06 12:57:04 +01:00
94e9742453 Print actual changed paths in the "make paths absolute" operator. 2015-02-06 12:18:32 +01:00
2fb86d80fc Add more info to the "make paths relative" operator to show which paths
where actually changed.
2015-02-06 12:09:22 +01:00
ef555380ba Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/customdata.c
	source/blender/makesdna/DNA_customdata_types.h
2015-02-05 15:32:36 +01:00
a9c3ddc617 Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/object/object_intern.h
	source/blender/editors/object/object_ops.c
	source/blender/editors/space_sequencer/sequencer_draw.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/makesrna/intern/rna_object.c
2015-02-05 12:38:50 +01:00
bffa829b40 Move priority of widget handler back for node editor. Still not very
clean but should allow gooseberrians to work a little better
2015-02-05 12:29:37 +01:00
97053e034a Initialize dropboxes and widgets together before opening the homefile,
makes sure areas get their proper handlers registered
2015-02-05 12:15:23 +01:00
7414464e23 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/object/object_intern.h
	source/blender/editors/object/object_ops.c
	source/blender/editors/space_sequencer/sequencer_draw.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/makesdna/DNA_customdata_types.h
	source/blender/makesrna/intern/rna_object.c
2015-02-05 12:08:55 +01:00
6a0e403a17 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_image.h
	source/blender/blenkernel/intern/sequencer.c
	source/blender/imbuf/intern/anim_movie.c
2015-02-04 20:46:03 +01:00
bdb372338b Sequencer: Implement priority queue based on frame number instead of
memory size (Thanks to sergey for suggestion)
2015-02-04 18:14:31 +01:00
8f51baff85 Possibly dangerous feature - don't scale images if they come from a
proxy.
2015-02-04 18:14:31 +01:00
c8d5206082 New space enum option for the particle instance modifier, to chose which
space the particle data should be interpreted in.

By default the space will now be `Local`, meaning that copies of the
mesh are made with the offset of the respective particle in the particle
object's local space, rather than using the world space offset of the
particle //inside the modified object space//. This behavior is much
more intuitive and consistent with true duplicators, such as face duplis.
Old files will still have `World` setting, so existing blend files are
not changed.
2015-02-04 17:41:15 +01:00
f27389cd01 Better implementation for cache disable - do not store or retrieve cache
ever if debug value is 314
2015-02-04 13:56:57 +01:00
1ec9604b70 Merge branch 'master' into gooseberry 2015-02-04 13:40:21 +01:00
48954596d1 Disable sequencer preprocess cache if 314 debug value is set 2015-02-04 13:35:56 +01:00
becce54286 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/image.c
2015-02-04 07:19:16 +11:00
322cf7cf4e More roughness options for offsetting child clumping.
This is obviously total madness, this feature is totally unusable when
the coder is not sitting next to you ... But so are the rest of particle
settings, the only solution is a future node system.
2015-02-03 18:33:22 +01:00
7e4e99c294 Merge branch 'master' into gooseberry 2015-02-02 14:48:13 +01:00
92fdd1efdf Merge branch 'master' into gooseberry 2015-02-02 14:23:35 +01:00
3637371c96 Fix for unfreed effector weights in hair dynamics.
The internal cloth modifier effector weights get replaced temporarily
to make the cloth sim use the particle weight settings instead. But
the particle sim was not putting back the original weights, which can be
non-NULL in case the cloth sim allocated these already. Messy design ...
2015-02-02 14:09:02 +01:00
5dac6e6129 Fix for unfreed memory due to unnecessary early exit in the free
function.
2015-02-02 13:37:35 +01:00
783b41a55d Fix for unfreed memory of internal hair cloth modifier pointcache. 2015-02-02 12:51:22 +01:00
253cb97862 Cleanup: Moved particle interpolation code into own file. 2015-02-01 18:25:46 +01:00
b0c5622a97 Merge branch 'master' into gooseberry 2015-01-30 16:03:39 +01:00
f095fbc6be New option for the particle Add brush: use_add_stroke to toggle
between stroke and single-add mode.

This was requested especially for use with tablets. With a pen it is
difficult to set a precise point and the tool ends up making multiple
hairs close together all the time. Disabling the stroke option helps
adding individual hairs.
2015-01-30 15:17:55 +01:00
2a3ced0308 Merge branch 'master' into gooseberry 2015-01-30 15:14:24 +01:00
cb6c0663e1 Merge branch 'master' into gooseberry 2015-01-30 14:30:57 +01:00
9c3e41b4f6 Ultra hacky fix for sequencer:
Avoid opening the file when doing uncached reading because ffmpeg takes
quite a long time to read the first frame. Instead, avi jpeg is almost
instantaneous here.
This will leave the anim struct without an Imbuf and that can cause
other unexpected issues elsewhere so commiting on gooseberry first
to try.
Speedup is quite impressive though.

Needless to say, code here quickly becomes a mess and the proxy system
should be made saner but for now just commit to keep things working at
the studio.
2015-01-30 12:25:22 +01:00
06aae6789f Added missing blenderplayer stubs for new particle edit shapekey
functions used in RNA.
2015-01-30 11:31:15 +01:00
b3ca0e21a5 Merge branch 'master' into gooseberry 2015-01-29 19:35:43 +01:00
eee7918c37 Disabled the child hair hull drawing feature.
This is incompatible with particle data structures in their current form.
Hull drawing requires sorting child particles based on the distance from
their primary parent. However, this changes the order of children, which
is the main method of generating random numbers for them. In the
viewport this is not a problem, but when rendering the children are
constantly recreated, using the respective deformed emitter mesh each
time. This leads to changing child orders when using the convex hull
sorting, and therefore different randomisation values.

To properly implement child hull drawing we would have to generate a
stable parent-child offset metric as well as avoiding any resorting in
the actual data arrays. This in turn requires terribly inefficient
drawing iteration, which could become a bottleneck by itself even before
taking cache coherence or OpenGL optimization requirements into account
(collecting child data into a dedicated buffer for drawing).
2015-01-29 17:00:51 +01:00
76e7528cb1 Comment out the proxy fix to test if it makes things better, 2015-01-29 14:40:49 +01:00
46024a14bb Merge branch 'master' into gooseberry 2015-01-29 16:58:49 +05:00
4f47a8b240 Quick test to figure out performance bottleneck in gooseberry.
Failed proxies will now attempt to fetch a smaller proxy first before
fetching the full resolution. This might allow us to see if we are
hitting a bandwidth issue (due to high res) or a file query issue (due
to more file queries)
2015-01-29 12:53:06 +01:00
bb4a0a9c05 Merge branch 'master' into gooseberry 2015-01-29 12:42:36 +01:00
c602fada48 Merge branch 'master' into gooseberry 2015-01-29 22:05:51 +11:00
3482b33f9b Wire-color was accidentally broken in a merge
Adding back changes to background needed for auto-contrast.
2015-01-29 14:16:46 +11:00
615330a16b Support for the (still experimental) parent coloring mode in regular
strand drawing.

Parent coloring is currently still entirely random, but can be improved
for all use-cases later.
2015-01-28 18:13:47 +01:00
b7abaf151f Apply shape keys directly to the hair key data, instead of only applying
to the hair dynamics input DM.

Also this calculation has to happen before caching paths, otherwise
there is a 1-update lag because parent paths still use old values.
2015-01-28 17:34:46 +01:00
d2219f871c After editing hair, apply the changes back to the active hair shape key.
This makes shape keys for hair actually usable by completing basic edit
mode integration.
2015-01-28 16:18:21 +01:00
d045fd79d6 Apply hair shape keys to the particle base data when entering edit mode
and when switching the active key during edit mode.

This is different from how shape key editing works on meshes: there the
edit data (BMEditMesh) stores customdata layers for shape keys, then
writes them back to the mesh. The hair edit mode is a lot more messy and
confusing, it has to update the base data immeditately (with potential
consequences for undo ...)
2015-01-28 15:44:31 +01:00
b2ca6a2d8e Merge branch 'master' into gooseberry 2015-01-28 15:34:37 +01:00
b52530f104 Merge branch 'master' into gooseberry 2015-01-28 14:44:12 +01:00
4ad69e11e8 Initialize new hair shape keys with data from the current particle keys. 2015-01-28 14:38:52 +01:00
307c7667e4 Merge branch 'master' into gooseberry 2015-01-28 17:33:00 +05:00
6dc4664efb Merge branch 'master' into gooseberry 2015-01-28 11:49:39 +01:00
420d381037 Requiring COMPAT_ENGINES for particle panels is stupid. 2015-01-28 11:09:56 +01:00
d92f5918b1 Merge branch 'master' into gooseberry 2015-01-27 18:19:51 +01:00
e4b7084bf6 Merge branch 'master' into gooseberry 2015-01-27 16:19:14 +05:00
3a6e8ec938 Merge branch 'master' into gooseberry 2015-01-27 13:47:15 +05:00
f202dab0f2 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/makesdna/DNA_customdata_types.h
2015-01-26 17:43:02 +01:00
f71847159d Experimental: random colors for child hulls. 2015-01-23 17:47:52 +01:00
b33c55ddee Fix for invalid cache index -1 in some cases, like virtual parents.
The code was assuming that child 0 is always valid, but in fact has to
be treated like all others that can be disable due to preview percentage,
virtual parents, etc.
2015-01-23 17:10:15 +01:00
d79197d9a8 Use the particle system material for OpenGL drawing.
This is probably not correct yet, the code is terribly confusing ...
2015-01-23 16:44:59 +01:00
b26825646b Implemented caps for the convex hair bundle hulls.
The current algorithm generates a triangle strip to fill the end of
each child bundle. This is not quite ideal, because even though the
base child groups are constructed to be convex, the resulting child
paths can become concave again by clumping, roughness, hair dynamics
etc.. This can create face inversion as well as ugly shading artifacts,
so a nicer algorithm may be desirable.
2015-01-23 16:10:32 +01:00
526edf8411 Only perform the inner loop over one group of connected paths in macros.
This allows more customized handling of path drawing in the outer loop
(needed for drawing end caps).
2015-01-23 12:06:31 +01:00
9b6f30e060 Nicer iterating over pairs of connected neighboring child paths. 2015-01-23 11:57:05 +01:00
892eb413f5 Removed parent path drawing code for hulls, this is never used anyway. 2015-01-23 09:47:28 +01:00
f919c5c700 Calculate normals and use smooth shading in the strand direction for
child hulls.

Note that the perpendicular direction around the hair bundles is not
smooth-shaded. Smooth shading doesn't make as much sense there because
large angles are common in this direction and give awkward shading
results.
2015-01-22 19:50:40 +01:00
07a49a9367 Disabled fallback path drawing for now, is currently nested inside the
OpenGL immediate mode calls.
2015-01-22 19:50:40 +01:00
46ab5bbb58 Don't draw 2-sided flat hulls, this just gives ugly Z fighting. 2015-01-22 19:50:40 +01:00
10bf7f6d3d Ignore paths with segments == -1, this is used to indicated hidden
children.
2015-01-22 19:50:40 +01:00
01ec68f457 Completed the convex hull calculation for child paths.
Parent index is only stored for hull children as a means of identifying
them in the drawing code.
2015-01-22 19:50:40 +01:00
1422f0d6cf Use line drawing as a fallback if only one child is assigned to a parent. 2015-01-22 19:50:40 +01:00
d64c5b0d30 Simple immediate-mode OpenGL drawing for convex child hair hulls. 2015-01-22 19:50:40 +01:00
2aaf1dc22a Fix for recent particle drawing commit, need to update the local draw
data variable after changing the buffer.
2015-01-22 19:50:40 +01:00
d57bd6e71b Sorting of child particles by primary parent and offset in hair space.
This is a prerequisite for constructing the convex hull of child paths
around a parent.
2015-01-22 19:50:40 +01:00
f143953ff1 More code cleanup to avoid crazy huge and messy particle functions. 2015-01-22 19:50:40 +01:00
68d80478af New draw mode 'HULL' for hair drawing.
Not implemented yet, currently uses just the child path drawing.
2015-01-22 19:50:39 +01:00
4478300c95 Cleanup: Make path update flag tests a little bit more understandable. 2015-01-22 19:50:39 +01:00
8142e13d1a quiet py exception 2015-01-22 22:14:04 +11:00
47618d0393 Merge branch 'master' into gooseberry 2015-01-22 00:53:29 +05:00
5662864e5b Merge branch 'master' into gooseberry 2015-01-21 14:05:35 +01:00
0f26b5d2f5 Removed the solver_index from cloth vertices.
This was used as part of the "sim preview" feature, where some amount of
vertices were tagged as disabled in the particle system. Due to the
mind twisting complexity of using the nested cloth modifier to simulate
hair strands indirectly it became necessary to still store all the
vertices, but then disable them again on the solver level ... If this
ever gets reimplemented it must be done in a sane way, avoiding the
cloth step altogether.
2015-01-21 10:38:54 +01:00
6681a6e838 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/physics/intern/BPH_mass_spring.cpp
	source/blender/physics/intern/implicit_blender.c
2015-01-21 10:13:47 +01:00
9a5f80e103 Merge branch 'master' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
	source/blender/physics/intern/BPH_mass_spring.cpp
2015-01-20 11:50:56 +01:00
00d4bf4ce8 Merge branch 'master' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
	source/blender/blenkernel/BKE_cloth.h
	source/blender/blenkernel/intern/cloth.c
	source/blender/blenkernel/intern/collision.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/editors/physics/particle_edit.c
	source/blender/makesdna/DNA_particle_types.h
	source/blender/physics/BPH_mass_spring.h
	source/blender/physics/intern/BPH_mass_spring.cpp
	source/blender/physics/intern/implicit_blender.c
2015-01-20 11:10:39 +01:00
6f7ef81bb4 Fix for incorrect DNA field name in versioning, causes constant
resetting of clump noise size on reload.
2015-01-19 15:09:44 +01:00
c55d20b301 Use separate flags to enable/disable clump and roughness curves for
child hairs.

This allows disabling the curves temporarily without losing the setup.
2015-01-19 13:32:53 +01:00
6e5b21f808 Merge branch 'master' into gooseberry 2015-01-18 18:51:08 +01:00
4dec17b48c Merge branch 'master' into gooseberry 2015-01-16 17:34:19 +01:00
e52f280f1f Fix for slow deformation-motionblur in Cycles using the new spiral kink
mode.

This was caused by variation of the number of keys on child hairs due
to shortening of hair curves based on euclidian distances. The other
kink modes also shorten hairs, but use the parametric distance instead,
which does not vary with deformation of hairs.
2015-01-16 16:04:10 +01:00
b60e52f7cc Merge branch 'master' into gooseberry 2015-01-16 16:41:56 +05:00
3c2e313ad2 Second variant of the copy-to-select operator for particles to only
copy the active particle system (and not remove existing in the process).
2015-01-16 11:42:13 +01:00
5a830bbb01 Make removal of existing particle systems on copying optional.
This will be most useful when copying individual particle systems
one-by-one (to be implemented).
2015-01-16 11:12:04 +01:00
fd2ac986c8 Merge branch 'master' into gooseberry 2015-01-16 15:06:10 +05:00
e5c1f28372 Merge branch 'master' into gooseberry 2015-01-16 02:29:32 +05:00
b48b8938c3 Merge branch 'master' into gooseberry 2015-01-16 01:45:20 +05:00
d926a25765 Added space selection option to the particle system copy operator.
By default this now copies from one object's local space to another
object's local space (instead of the previous world space). This is
more useful when transferring particles between objects, because it
doesn't require moving objects on top of each other, as long as they
have similar shapes.
2015-01-15 20:38:35 +01:00
8793d9dac5 Merge branch 'master' into gooseberry 2015-01-15 22:36:26 +05:00
d7c1798a23 Removed debugging code. 2015-01-15 18:18:03 +01:00
355b289625 Fix for particle system copy: This has to make sure the ORIGSPACE data
layer is available.

Otherwise particle mapping to the new mesh cannot work with subdivided
and constructively-modified meshes.
2015-01-15 18:15:52 +01:00
9bdefd5b01 Added a "specials" menu button next to the particle systems list for
accessing the copy operator.
2015-01-15 12:53:28 +01:00
57f69a5d8f Changed the workflow for the particle system copy operator to the common
active-to-selected pattern.
2015-01-15 12:35:19 +01:00
a3b8538e89 New operator for copying (hair) particle systems from one object to
another, including edit data (grooming).

This uses basically the same method as the existing connect/disconnect
feature. The main difference is that it allows working with multiple
objects and transferring the //particle/hair data// instead of the
//mesh// data (which is what connect/disconnect expects). This is a much
more realistic workflow when rigging, topology etc. changes and
groomed hair has to be transferred to the changed model.
2015-01-15 11:55:26 +01:00
f62b9d874a Removed unused particles pointer from particle edit data. 2015-01-15 11:55:26 +01:00
305af3ebbe Fix T43254: Camera required for rendering sequencer scene 2015-01-15 07:07:35 +11:00
7086e0fb50 warning: unused var 2015-01-15 07:06:02 +11:00
5fe11d4c40 Merge branch 'master' into gooseberry 2015-01-15 06:43:24 +11:00
1c8c53767d New texture influence option for particle kink amplitude (as opposed to
frequency).
2015-01-14 12:29:19 +01:00
6e5044867f Renaming "Kink" texture influence to "Kink Frequency" to be more
specific.
2015-01-14 12:03:55 +01:00
15490d4685 Spiral rotation axis was not always fully normalized, avoid an assert. 2015-01-14 11:48:51 +01:00
c84bd7fb0e Make random child length work again with the spiral kink mode. 2015-01-14 10:09:16 +01:00
e408277d13 Add missing stub to the player, so buildbot keeps delivering gooseberry builds 2015-01-14 13:05:13 +05:00
400bade662 Merge branch 'master' into gooseberry 2015-01-14 12:58:30 +05:00
4a8eb2a5c2 Allow clumping and roughness in Spiral kink mode as well.
This requires interpolating the parent key properties, because no single
parent key can be mapped to each key on the children any more.
2015-01-13 20:58:28 +01:00
9e95e65be8 Optional randomization factors for the spiral radius and axis orientation. 2015-01-13 19:41:25 +01:00
fa0a2d8127 Support in Cycles for the extra spiral keys in hair paths. 2015-01-13 19:18:46 +01:00
d79c6d8af3 Nicer calculation of the kink axis and result of the spiraling for
negative radius.
2015-01-13 18:37:24 +01:00
679c90a360 Removed unused old code. 2015-01-13 18:03:47 +01:00
00b7010b76 Disable the path length check for spiral kink mode.
This test is terribly expensive for some reason and not necessary for
for the spiral mode anyway.
2015-01-13 17:59:41 +01:00
e3325ad73e Fix for calculation of the key velocity on the last child hair segment. 2015-01-13 17:28:53 +01:00
99611fc38b Another crappy approach to spirals on hairs, crazy expensive though. 2015-01-13 17:24:20 +01:00
bdae59ac84 Spiral kink mode for particles.
This is BAD code, but the particle kinking does not make it easy to
write a non-local modifier that requires neighboring positions,
curvature, etc. The feature is needed for Gooseberry.
2015-01-12 20:24:50 +01:00
c0888fa7c1 Optional clumping noise feature for simulating twisted hair strands.
This adds another level of clumping on child hairs. When enabled, child
hairs chose a secondary clumping target using a Voronoi pattern. This
adds visual detail on a smaller scale, which is useful particularly when
the number of parents is relatively small.

Natural fibres behave in a similar way when they become sticky and
intertwined. Hairs close to each other form a first twisted strand, then
combine into larger strands. Similar features can be found in ropes:
http://en.wikipedia.org/wiki/Hair_twists
http://en.wikipedia.org/wiki/Rope
2015-01-12 16:03:12 +01:00
3b1186addd Disable scope updates in texture and image paint modes.
Scope update is very slow for high resolutions, and currently blocks
the UI thread(!). This is especially terrible in paint modes, where
each stroke causes a scope update and unacceptable freezing.

The scopes update method tries to avoid this somewhat by skipping if the
toolbar is disabled, but this doesn't help when painting where brush
tools etc. are frequently needed. It's also a bad-level poll, with the
core system accessing a UI element.

Eventually scope updates should become a low-priority background job,
as well as becoming threaded. Until then this polling provides a usable
workaround to the most outrageous cases.
2015-01-12 14:27:41 +01:00
5a535bb5b0 Merge branch 'master' into gooseberry 2015-01-11 18:51:01 +01:00
7bb53800ba Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/object/object_intern.h
	source/blender/editors/object/object_ops.c
	source/blender/makesrna/intern/rna_modifier.c
2015-01-10 10:26:11 +01:00
e61a707869 Merge branch 'master' into gooseberry 2015-01-09 18:08:20 +01:00
326d7fd5fd Curve-based control for "roughness" (noise displacement) of child hair. 2015-01-09 15:58:18 +01:00
62fae2b981 Merge branch 'hair_clumping' into gooseberry 2015-01-09 14:27:18 +01:00
9f835cc10e Curve-based control for child path tapering.
This is an alternative method to the current fixed function with a
clump factor and "shape" parameter. This function is quite limited and
does not give the desired result in many cases (e.g. long, parallel
rasta strands are problematic). So rather than trying to add more
parameters there is now a fully user-defined optional curve for setting
the tapering shape.
2015-01-09 14:24:19 +01:00
32acaf1bc5 Merge branch 'master' into gooseberry 2015-01-09 13:28:15 +01:00
8c99bf9ed9 Moved kink, clump and roughness functions into the dedicated source file. 2015-01-09 11:44:05 +01:00
ac4d90fda4 Reorganizing hair child code a little bit to make it not totally insane.
This contains a few pieces of code for a future "modifier" system that
would allow more flexible combination of effects. Eventually a node
system is the way to go, but the current code makes that impossible.
2015-01-09 11:31:00 +01:00
ba4e7d95db Paste flipped bones:
* Simplify logic for bone detection on copy (no need to do mirrored
naming then)
* Add shortcuts ctrl(cmd)-shift-V for copying flipped
2015-01-08 13:01:48 +01:00
b62c0315fa Merge branch 'master' into gooseberry 2015-01-08 12:48:18 +01:00
64d39b7378 Separate context freeing from task freeing in threaded particle updates
to prevent double-freeing/invalid mem access.

This can happen with the "virtual parents" feature, which generates both
parent and child paths. Each task free function also freed the shared
context, leading to double freeing.
2015-01-08 12:41:55 +01:00
4137ef10da Gooseberry animation request: Paste flipped pose in action
and graph editor.

This was a tricky commit that was not so straightforward to make work.
The information for bones is not easy to come by in the animation curves,
however we do have some string manipulation tricks to make it happen.
For now committing to gooseberry branch for testing, it will be ported
to master after most usual use cases have been confirmed as working.

(Current test with all rotation modes and translation seems to work, but
Not sure how well this will hold up with drivers etc)
2015-01-07 22:25:33 +01:00
70eee6a0ed Merge branch 'master' into gooseberry 2015-01-07 16:17:16 +01:00
4f338dfdea Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_key.h
	source/blender/blenkernel/intern/key.c
2015-01-07 14:52:08 +01:00
66d03f8405 Merge branch 'master' into gooseberry 2015-01-06 15:50:37 +01:00
ba0d452357 Merge branch 'master' into gooseberry 2015-01-06 23:11:54 +11:00
7c28022dc2 Merge branch 'master' into gooseberry 2015-01-06 12:17:47 +01:00
c5ede37a9e Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/makesrna/intern/rna_object.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
2015-01-05 12:24:47 +01:00
f902bbad83 Cleanup the file mess with facemaps, make correct BKE/ED files for all
functions. Blenderplayer compiles again
2015-01-05 12:16:44 +01:00
f929c03791 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/camera.c
	source/blender/editors/space_sequencer/sequencer_draw.c
2015-01-05 12:00:17 +01:00
df877cc991 Merge branch 'master' into gooseberry 2015-01-03 00:11:50 +05:00
b8c2f58f1c Gooseberry: Fix stubs for player, so buildbot can deliver builds again
Please note, that this commit doesn't fix issues with functions declared
in BKE header and implemented in editor/. This is to be fixed separately.
2014-12-31 14:02:22 +05:00
532a03c232 Properly register the mathutils.interpolate submodule. 2014-12-31 09:58:47 +01:00
cc67f8e492 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/makesrna/intern/rna_modifier.c
2014-12-30 12:29:34 +01:00
eca3250c89 Little experiment: hook up a transform operator to a bone facemap. For
now moves the mesh only, doesn't set the bone as selected.
2014-12-22 12:04:45 +01:00
d9b7655bbd Fix for invalid access to undefined hair data in edge-only cloth meshes.
Cloth data is used both for hair and actual cloth, which makes things
really difficult. The face number was used for distinguishing the two
types (no faces == hair mesh), but the extra hair data necessary for
hair sim is generated by particles and not available for edge-only cloth
meshes. This really needs to be sanitized ...
2014-12-22 11:54:24 +01:00
f9cedb4896 Facemap widgets:
* Only draw on mouse over
* Fix crash with highlighted widgets.
2014-12-22 11:28:41 +01:00
b68a951e91 Modify facemaps mapping to bones.
Now simply add a flag to the armature modifier to use facemaps. Facemaps
on the mesh object with the same name as the armature bones will get
displayed as widgets.
2014-12-19 16:11:04 +01:00
bffe48f12c Presets for hair dynamics.
This is necessary because the hair dynamics settings are not part of the
ParticleSettings datablock, but part of the convoluted cloth modifier
inside the particle system struct. In the future this will be recoded
properly, but in the meantime presets provide a simple an unobtrusive
way to have reusable dynamics settings for hair.
2014-12-19 14:56:02 +01:00
16478df500 Merge branch 'master' into wiggly-widgets 2014-12-19 14:44:35 +01:00
1fd375fd30 Merge branch 'master' into gooseberry 2014-12-19 13:37:38 +01:00
61bba5e66f Radical simplification of the wind effect on hair, since the previous
approach does not work very well.

Using a cross section estimate still causes large oscillations due to
varying hair force based on angles. It also requires a sensible hair
thickness value (particle radius) which is difficult to control and
visualize at this point.

The new model is based purely on per-vertex forces, which seems to be
much more stable. It's also somewhat justified by the fact that each
hair vertex represents a certain mass.
2014-12-18 13:52:31 +01:00
b0c0505624 Facemap bones now draw properly. It's not possible yet to select the
bones so use with caution.
2014-12-17 18:51:49 +01:00
018593b75a Fix more crashes when removing facemaps. Indices of leftover facemaps
above the deleted one could become invalid
2014-12-17 18:33:33 +01:00
a1e28859c7 More silly mistakes in widget move code. 2014-12-17 18:16:32 +01:00
380a32581f Stubs for new facemap widget, fixes for facemaps.
Move/remove facemap not working well (probably was never working but by
displaying them has actually made the issue apparent)
2014-12-17 18:08:30 +01:00
8ffd46d139 Fix crash with decimate modifier on zero. 2014-12-17 16:53:05 +01:00
4887f7b48c Fixes to facemaps:
* Test display code that displays the active facemap. Will not work on
subsurf modifier yet (crash)
* Fix loading of files with facemaps
* Facemap data now reside on polys instead of tessfaces.
2014-12-17 16:42:36 +01:00
ad23e225c9 Merge branch 'master' into wiggly-widgets 2014-12-17 12:00:00 +01:00
00fe49de83 Code that will draw a transparent overlay of a facemap over the mesh
(crashes atm).
2014-12-16 20:14:10 +01:00
3a7b5bdeb0 Improved force field effects on hair strands.
The previous calculation was modulated with the angle between the wind
direction and the segments, which leads to very oscillating behavior.

Now the formula includes an estimate for the geometric cross section
of a hair segment based on the incident angle and the hair thickness
(currently just the particle size). This gives a more stable behavior
and more realistic response to wind.
2014-12-16 19:40:29 +01:00
bc99082e45 Add code that copies sorted per facemap vertex indices to a VBO buffer 2014-12-16 19:35:57 +01:00
3d74e55dd7 Initial VBO code for GPU subsurf.
This commit adds a few generalizations to the VBO
code so that modifiers can create and populate their own GPU objects.

The VBO code originally supported CDDerivedMesh only. The design moves
slightly towards the viewport refactor where the rendering system
requests data from modifiers.

What we do have is support for solid shading with multiple
materials, flat/smooth shading and a big performance boost.
Performance could

In this commit only basic support for vertices and normals is provided
and some features from blender's VBO system, such as mapping to
original faces, unique element indices for vertices and loose vertex/
and can be added later. The one feature that is missing now is the quick
navigation feature of the multires modifier (which uses the same code).

- Why this commit is made on the widget branch -

Facemap widgets need to avoid drawing the whole mesh when we do
collision detection on them. For subsurf drawing we need to iterate
through the whole mesh every time. What we need instead is sort
indexed elemet drawing according to the facemap each face belongs to.
This screams VBOs but since I was going to add that, I thought that
I could push it a bit further and add proper solid shading support.
2014-12-16 18:26:14 +01:00
c32ac24d41 Revert "Initial VBO code for GPU subsurf."
This reverts commit 7163ddf53e.
2014-12-16 18:18:57 +01:00
7163ddf53e Initial VBO code for GPU subsurf.
This commit adds a few generalizations to the VBO
code so that modifiers can create and populate their own GPU objects.

The VBO code originally supported CDDerivedMesh only. The design moves
slightly towards the viewport refactor where the rendering system
requests data from modifiers.

In this commit only basic support for vertices and normals is provided
and some features from blender's VBO system, such as mapping to
original faces, unique element indices for vertices and loose vertex/
and can be added later. The one feature that is missing now is the quick
navigation feature of the multires modifier (which uses the same code).

What we do have is full support for solid shading with multiple
materials, flat/smooth shading and a big performance boost.
Performance could

- Why this commit is made on the widget branch -

Facemap widgets need to avoid drawing the whole mesh when we do
collision detection on them. For subsurf drawing we need to iterate
through the whole mesh every time. What we need instead is sort
indexed elemet drawing according to the facemap each face belongs to.
This screams VBOs but since I was going to add that, I thought that
I could push it a bit further and add proper solid shading support.
2014-12-16 17:05:11 +01:00
c2d22f79ad New python submodule mathutils.interpolate for various mesh interpolation and weighting methods.
This module will contain mirrored functions for calculating and applying
weights for points on a mesh. This includes barycentric and UV weighting
and possibly more advanced global weighting such as harmonic weights.

The naming should follow this scheme:
<type>_{2d,3d}_{calc,apply}

e.g.
poly_2d_calc
poly_2d_apply
uv_3d_calc
...

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D939
2014-12-15 20:05:17 +01:00
1740ee2d3d Merge branch 'master' into wiggly-widgets 2014-12-15 17:10:53 +01:00
91ed7c270c Placeholder GPU functions to get GPU facemap index buffer. API should
allow a widget to draw a specific facemap bound to a mesh quickly.
2014-12-15 17:08:10 +01:00
1a366cb02a Fix selection id not getting incremented in face-map bones 2014-12-15 14:01:53 +01:00
935fa0670e Merge branch 'wiggly-widgets' into gooseberry 2014-12-15 12:11:41 +01:00
bffde905b6 Deactivate irritating shapekey widget while it's still under
development.
2014-12-15 12:11:09 +01:00
6b8ebd6bd6 Hook up facemap property to bones.
A bone using a facemap will not be displayed at all, rather it will use
the facemap of the mesh as an interaction area. The facemap still does
nothing since it's not yet hooked up to the customdata and widget code.
That will come next.
2014-12-15 12:09:54 +01:00
8c069258df Merge branch 'master' into gooseberry 2014-12-12 16:32:47 +01:00
3ac798261f Merge branch 'wiggly-widgets' into gooseberry 2014-12-12 16:27:31 +01:00
74308df3f0 Support for custom cursors for widgets.
They are set when a highlighted widget intersection is detected and on
area level.

There's a discussion about using owners and a stack or array for cursors
but that needs some more thought and design.
2014-12-12 16:27:06 +01:00
9880af5779 More changes to overdrop transform operator.
* Calling key press confirms
* Change name of operator accordingly.
2014-12-12 14:17:38 +01:00
7b4fdfbfd9 Merge branch 'wiggly-widgets' into gooseberry 2014-12-12 13:04:06 +01:00
9a9347eb8d Gooseberry request draw sequencer backdrop on -top- of everything.
Due to this we -obviously- rename this to overdrop

I am not sure if others would agree here, but it's pretty safe to do
this on a branch first. Rationale is that it's much nicer to work on
full screen with this.
2014-12-12 13:02:23 +01:00
90bbe335fc Merge branch 'wiggly-widgets' into gooseberry 2014-12-12 12:35:03 +01:00
443ef39203 Minor adjustments to the cage transform widget and sequencer operator.
* Bigger scale handler for widget.
* Operator has description on area
* Cancelling resets position.
2014-12-12 12:34:31 +01:00
472abc4669 Merge branch 'master' into gooseberry 2014-12-11 14:43:37 +01:00
d445330c53 Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/intern/wm_event_system.c
2014-12-11 14:06:58 +01:00
58fedf3b67 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/makesrna/intern/rna_space.c
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/intern/wm_event_system.c
2014-12-11 14:00:23 +01:00
4380a92c05 Sequencer operator that uses widgets and controls the placement of the
backdrop is now functional.

The widget could communicate with the sequencer properties directly, but
here we set it to control the operator properties as a demonstration.

After some minor stress testing, time to give this to gooseberry team.
2014-12-10 21:00:59 +01:00
a6a6c49398 Fix some registration issues, also add scale property for sequencer
backdrop widget.
2014-12-10 19:24:28 +01:00
6da4973e8e Something draws now in sequencer when we register the widget for the
operator.
2014-12-10 18:55:03 +01:00
f64e323e2b Yet more refactoring:
Areas support more than one widgetmap - will be useful to partition area
in different transform regions like data, pixel, 3D (will be done in a
separate refactor).

Also get rid of the context widget hack in favour of adding the
widgetmap handler to the operator handler itself, so handling will
be unified when the widget controls a property or spawns an operator
2014-12-10 18:23:00 +01:00
dc0b8f291b Merge branch 'master' into gooseberry 2014-12-10 17:26:59 +01:00
fac8a0c4f9 Privatize registration function for individual widgets.
Handle events for widgetmap first when and pass to operator when
operator is active.

This is still a pretty confusing design, working on a simpler one now.
2014-12-10 15:57:27 +01:00
b8e88c1821 Sequencer: optionally use scenes nested strips (like meta strips)
This commit makes it possible to use scenes as a kind of
multi-user metastrip (with their own time).

Currently this supports rendering & drawing nested strips,
but no convenient way to tab-enter into a scene strip.
2014-12-10 15:26:41 +01:00
3347195ba1 Merge branch 'master' into gooseberry 2014-12-10 15:24:13 +01:00
182545c820 Create sequencer widget handlers 2014-12-10 12:57:09 +01:00
0fb37c710f Add back idnames to the widgetmaps, we could well need to define both
for different transform areas.
2014-12-10 12:46:15 +01:00
ef8a3d65f1 Big refactor commit.
* Minor cleanup - propname does not need to be stored anymore.
* Code to support modal widgetmap registration for operators - still
untested, but will be tested soon on sequencer cage widget
* Widgets take parameters to initialize property slots that are used for
feedback or control.
Cage now uses this to feed offset/scale to different properties.
* Initialize common properties during widget registration.
2014-12-09 21:01:51 +01:00
6496051251 Merge branch 'master' into gooseberry 2014-12-09 16:55:38 +01:00
04671df15f Code for runtime registration of widgets that should make it possible to
remove and add widgetgroup types from the system.

Start operator that will control sequencer backdrop. Architecture here
still needs a little work so good compatibility with Add-ons can be
ensured.
2014-12-08 15:48:09 +01:00
5d2f1a9466 Make resizer widgets smaller, express them in pixels. 2014-12-08 13:16:01 +01:00
ab46b5ed62 Clamp during rectangle interaction to make sure widget stays big enough
to interact with (also handles negative case). 15 pixels threshold was
chosen.
2014-12-08 12:48:26 +01:00
5feafed611 Correct backdrop fit operator for compositor. 2014-12-08 12:30:50 +01:00
09d18fb74d Scale handlers for the rectangle transform working 2014-12-08 12:25:30 +01:00
900e3eacd7 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/intern/wm_event_system.c
2014-12-08 11:14:23 +01:00
b51ee540ae Initial Python API for Widgets
Note this is only the initial Python API structure & isn't usable in its current state.

Work by Psy-fi & myself.
2014-12-06 20:55:57 +01:00
7d79196698 minor corrections to last commit 2014-12-06 15:37:46 +01:00
81e2e1be41 Widget API: remove unused identifier member
also comment some of the code.
2014-12-06 15:06:24 +01:00
d4c9ff8a21 Add facemaps panel to the supported cycles panels 2014-12-05 17:59:27 +01:00
787743b1ed Add back an extra paramater to the intersection function to determine
the highlighted part of the widget.
2014-12-05 16:42:59 +01:00
0a7eb30cee Cleanup leftover code. 2014-12-05 15:59:53 +01:00
b0f53133c1 Hook up the new DNA data to the node edtior. Now the backdrop supports
2D interaction (scale still pending)
2014-12-05 15:18:49 +01:00
8abeeafcb6 Rename Cage to RectTransform, add DNA for struct that will be used for
interaction with the widget.
2014-12-05 12:55:33 +01:00
cb2f1eb3eb Merge branch 'master' into wiggly-widgets 2014-12-05 11:45:40 +01:00
f2a7c2ffc1 Merge branch 'master' into gooseberry 2014-12-04 12:48:22 +01:00
aad164978c Get rid of operator, and use facemap name field on shapekey. 2014-12-03 17:15:21 +01:00
e01e074276 Face maps initial data structure, rna types and save/load
commit and operators to set faces in a group in edit mode.

Face maps are groupings of faces, similar to vertex groups, however,
each face can only belong to one face map.

They will be used for widget interaction, but there will possibly be
more uses for them in the future.

Code needs some cleanup still here, will apply as work is being done.

There is some code here for object mode interaction but it hasn't been
tested yet. This will probably be done with the widgets themselves.
2014-12-03 16:30:39 +01:00
de94752d8e Revert "Add space for facegroup storage"
This reverts commit 687cb3ab86.
2014-12-03 16:27:35 +01:00
a6adbc968f Left this in last merge 2014-12-03 16:23:25 +01:00
1138a296cb Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/blenkernel/BKE_context.h
	source/blender/editors/include/ED_transform.h
	source/blender/editors/transform/transform_ops.c
2014-12-03 16:20:40 +01:00
9720402fca Placeholder operator 2014-12-03 16:08:53 +01:00
e7d0c58bc9 Merge branch 'master' into gooseberry 2014-12-02 18:00:48 +01:00
c51ca1b7de Fix for missing library linking in blenderplayer. 2014-12-01 18:15:53 +01:00
8ccdf15ace Forgot this last merge 2014-12-01 14:59:18 +01:00
b57d67dfb9 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_context.h
	source/blender/editors/include/ED_transform.h
	source/blender/editors/transform/transform_ops.c
2014-12-01 14:54:28 +01:00
73efb36091 Shapekey widget is correctly bound to the shapekey property and controls
it.
2014-12-01 12:54:40 +01:00
1f501db162 More cleanup to the widget API.
Now with RNA pointer copy we don't need to allocate RNA pointers
anymore. The API is much more streamlined and is almost like the panel
API.
2014-12-01 12:28:39 +01:00
af74cba653 Widgets: Cleanup, no draw flag now, widgets are fully dynamic. Also
calculate scale always to make sure interaction happens correctly.
2014-12-01 11:57:52 +01:00
2b1bdb5412 Refactor widgets to always be recreated on redraw - like buttons.
This allows us to spawn a different number of widgets per frame, which
will be needed for shapekey doritos. Also added a widgetgroup for the
shapekeys
2014-11-28 23:02:42 +01:00
0b443c8a23 Merge branch 'master' into gooseberry 2014-11-28 22:21:00 +01:00
a99f5a7463 Add stub operator for widget operation so it is blocking and events do not get
lost when region changes.
2014-11-28 16:35:07 +01:00
6336b215a9 Merge branch 'master' into gooseberry 2014-11-28 16:26:44 +01:00
f74e4d9dfe Merge branch 'viewport_experiments' into gooseberry
Conflicts:
	source/blender/gpu/intern/gpu_buffers.c
2014-11-28 16:21:45 +01:00
5467064777 Merge branch 'master' into viewport_experiments
Conflicts:
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/gpu/GPU_buffers.h
	source/blender/gpu/intern/gpu_buffers.c
2014-11-28 16:15:13 +01:00
bd434b92b6 Revert "Hook up flags to request a specific sorting scheme from GPU buffer setup"
This reverts commit 827ad6075d.
2014-11-28 16:10:25 +01:00
7e9eb8b83b Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2014-11-28 11:47:16 +01:00
9768480a7b Merge branch 'master' into gooseberry 2014-11-27 21:40:41 +01:00
8ce8a4edb3 Merge branch 'master' into gooseberry 2014-11-27 19:12:40 +01:00
2a3d6efa96 Merge branch 'master' into wiggly-widgets 2014-11-26 19:28:24 +01:00
d898581b52 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/gpu/intern/gpu_extensions.c
2014-11-26 15:09:57 +01:00
5373b4a8b1 Merge branch 'master' into viewport_experiments
Conflicts:
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/gpu/intern/gpu_extensions.c
2014-11-25 16:31:55 +01:00
c0d8ed55e4 Merge branch 'master' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/space_sequencer.py
	source/blender/blenkernel/BKE_sequencer.h
	source/blender/blenkernel/intern/sequencer.c
	source/blender/blenkernel/intern/sound.c
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/animation/anim_ops.c
	source/blender/editors/space_sequencer/sequencer_draw.c
	source/blender/editors/space_sequencer/sequencer_edit.c
	source/blender/editors/space_sequencer/sequencer_intern.h
	source/blender/editors/space_sequencer/sequencer_preview.c
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/editors/space_view3d/view3d_edit.c
	source/blender/editors/space_view3d/view3d_ops.c
	source/blender/editors/transform/transform.c
	source/blender/editors/transform/transform_conversions.c
	source/blender/editors/transform/transform_snap.c
	source/blender/makesdna/DNA_space_types.h
	source/blender/makesdna/DNA_view3d_types.h
	source/blender/makesrna/intern/rna_space.c
2014-11-25 14:25:27 +01:00
aae1162945 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/editors/space_view3d/view3d_edit.c
	source/blender/editors/space_view3d/view3d_ops.c
2014-11-24 19:22:15 +01:00
8aed4bb1d6 Fix compilation error with SCons
The file wasn't being comiling by CMake, remove it from SCons compilation as well.
Not sure if the same is required in original branch, maybe it'll be redone anyway.

For now let's make it so gooseberry branch is compiling nicely on the buildbot.
2014-11-24 14:09:52 +05:00
dd43f9c056 Cage widget now does something useful (tm). Basically, we can now
transform the x direction of the backdrop in sequencer when a viewer
node is active.

There are still some issues with property transform not being a proper
operator, but we can fix that easily.

To make full 2D transform work we need positions stored in one property.
2014-11-21 18:05:39 +01:00
ff50cd9740 2D widgets Cleanup:
* Get rid of invalid flag (we avoid drawing widgets by dereferencing RNA
now so it should be OK)

* Add intersect function for 2D widgets (still needs correct mapping to
be any useful though)
2014-11-21 17:07:26 +01:00
44b4ced395 Correctly center the widget in node space 2014-11-21 16:48:33 +01:00
82401df4b2 Merge branch 'master' into gooseberry 2014-11-21 16:30:10 +01:00
261c0a5282 Merge branch 'wiggly-widgets' into gooseberry 2014-11-21 16:25:48 +01:00
bfa17440eb Cage actually now draws something, also change widget, will be modified
to control placement of backdrop.
2014-11-21 16:24:05 +01:00
3e8367037f Another fix for particle instance child lookups, was not subtracting
parent amount.
2014-11-21 16:01:21 +01:00
007eaf34dc Fix for invalid particle pointer access in mixed particle/child loop. 2014-11-21 16:01:21 +01:00
1068021523 Better update function for particle settings affecting nested cloth
modifier.
2014-11-21 16:01:21 +01:00
af8c0c84f6 Fix for applying the bending randomness factor.
A stupid hack is needed here, changing the way the factor is applied to
angular bending springs. In cloth sim the bending factor of individual
springs is applied as a mix value between the bending stiffness and a
max value, but this max value isn't even used in hair sim so that
approach becomes useless.
2014-11-21 16:01:20 +01:00
bc637d0e1a Randomness factor for hair bending stiffness.
This helps to create some variation in a hair system, which can
otherwise become very uniform and boring. It's yet another confusing
setting in a system that should have been nodified, but only option for
now (broken windows ...)
2014-11-21 16:01:20 +01:00
e8ddfb1fe2 Fix for particle instance initial frames.
These were not orthonormal and tended to flip with changing hair
direction, now use the particle hair matrix which is stable wrt. the
mesh surface.
2014-11-21 16:01:20 +01:00
eb3d1e3e4f Merge branch 'master' into wiggly-widgets 2014-11-21 11:24:52 +01:00
7c078f97df Fix T42639, editcurve flags not getting restored on undo.
Error here could be reproduced by tweaking curve properties such as
2d-3d or fill type and undoing.
2014-11-20 18:58:59 +01:00
bcd78c9311 Initialize the snaping aspect just once. 2014-11-20 18:39:26 +01:00
0853c0109c Merge branch 'master' into gooseberry 2014-11-20 18:21:39 +01:00
a014b8f1c1 Merge branch 'wiggly-widgets' into gooseberry 2014-11-20 18:19:31 +01:00
6279dde2f2 Fix crash with widgetgroup 2014-11-20 18:16:58 +01:00
3102ced864 Merge branch 'wiggly-widgets' into gooseberry
Conflicts:
	source/blender/editors/include/ED_view3d.h
	source/blender/editors/space_view3d/view3d_draw.c
	source/blender/editors/transform/transform_manipulator.c
2014-11-19 16:48:04 +01:00
ef310b2ae1 lost instance of transform manipulator 2014-11-19 16:13:15 +01:00
bfa6b80b8b Merge branch 'master' into wiggly-widgets 2014-11-19 16:08:05 +01:00
fee102e818 Bring back the old manipulator code, it works better with the transform
system for now. Backup the old code in a new file
2014-11-19 16:07:56 +01:00
896ee44ed6 Borrow transform system interaction: When arrow direction has direction
close to view direction, use up/down movement of mouse to calculate
offset.
2014-11-19 15:28:10 +01:00
ca65c70ce1 warnings 2014-11-19 15:27:56 +01:00
13b196f460 Merge branch 'master' into gooseberry 2014-11-19 15:23:38 +01:00
134d69582c More refinement to the widget system. Now camera widget should be
indistinguishable than the displayed widget (might probably be worth
deleting the original)
2014-11-19 14:48:02 +01:00
6ce5174301 Arrow Widget:
Create a cross style widget, with wireframe cross.

Allows setting a custom scale for the arrow widget also, an up
orientation.
2014-11-19 14:24:29 +01:00
58f7e89e39 Add flag so widgets only draw on mouse over.
Camera widget now uses this, also now they only draw if limits is on.
2014-11-19 13:03:30 +01:00
36f18cd35c Arrow widget interaction:
Fix interaction when pivot is beside the camera. basically we now do all
calculations in 3D space and we do not scale correct the offset in 3D -
this creates a nasty dependency loop between drawing and calculation for
widgets bound to properties - ie offset depends on scale but scale
depends on screen position - ie offset.

Also added an extra callback to get the final position of the widget in
3d space and use that to calculate the scale. This takes care of
bringing a close to the camera widget to the background and the widget
keeping its initial size. The final position can be different from the
initial position, especially when the widget is offset from the original
position.
2014-11-19 12:32:21 +01:00
681ea5d187 Merge branch 'viewport_experiments' into gooseberry 2014-11-18 17:48:13 +01:00
ec69df6147 Merge branch 'master' into viewport_experiments 2014-11-18 17:47:56 +01:00
40b1d29ec7 Merge branch 'master' into viewport_experiments
Conflicts:
	source/blender/gpu/intern/gpu_extensions.c
2014-11-18 13:49:57 +01:00
d7fa0fcaae More info for widget undo push string 2014-11-17 18:48:37 +01:00
275a26353e Add widget for focus of camera. There are some general issues with
widget scale that I'll fix later.
2014-11-17 17:27:45 +01:00
2dd9e41d93 Merge branch 'master' into wiggly-widgets
Conflicts:
	source/blender/editors/transform/transform_manipulator.c
2014-11-17 16:30:52 +01:00
195788a24a Add flag so offset is applied in world, not screen space. 2014-11-17 15:39:21 +01:00
9880574aaa Fixed overlooked function name change in game engine code. 2014-11-17 15:20:29 +01:00
7fe2e945bd Merge branch 'gooseberry' into hair_immediate_fixes 2014-11-17 14:54:51 +01:00
54ae1e90d7 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/BKE_key.h
	source/blender/editors/transform/transform_manipulator.c
2014-11-17 14:52:53 +01:00
def2bb7644 Fix for particle instance modifier: use a stable parallel-transport
framing method instead of the Frenet frame.

The Frenet frame is very succeptible to sudden twists along straight
sections of a curve where the second derivative (curvature) becomes 0.
2014-11-17 14:16:35 +01:00
141f2c1d5c Use better algorithm for arrow widget back transform.
We now use plane/line intersection which seems to work quite well and
agrees to great extent with the transform system as well. There still
some small discrepancy but may also be related to scaling.
2014-11-17 12:31:42 +01:00
2114f49750 WIP cage transform.
This also includes code for the node editor but probably
will try a different use case first.
2014-11-16 19:40:13 +01:00
d03ceb2a15 Nicer hashing functionality for sim debugging using a variadic macro
to support multiple hash identifiers.

Using explicit hashing functions for every sim debug call defeats the
purpose of having a quick feedback system. Now this can be done simply
by passing an arbitrary number of hash inputs (integers) at the end of
the function calls, which are then combined by a system of variadic
macros (based on the ELEM feature). Up to 8 identifiers are supported
currently, but more could be added easily if needed.
2014-11-16 14:59:33 +01:00
67e48a5b04 Merge branch 'master' into gooseberry 2014-11-15 20:52:11 +01:00
b30019fabe Merge branch 'hair_immediate_fixes' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/properties_particle.py
	source/blender/editors/physics/particle_edit.c
	source/blender/makesdna/DNA_modifier_types.h
	source/blender/physics/intern/BPH_mass_spring.cpp
	source/blender/physics/intern/hair_volume.cpp
	source/blender/physics/intern/implicit.h
	source/blender/physics/intern/implicit_blender.c
	source/blender/physics/intern/implicit_eigen.cpp
2014-11-15 15:07:06 +01:00
9f1ad068e9 Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenkernel/intern/implicit.c
2014-11-15 14:40:23 +01:00
95c5c39e5d Merge branch 'master' into gooseberry 2014-11-15 14:15:30 +01:00
5aaef09702 Some tweaking of value ranges for hair target density and removed
density factor (already included in grid velocity).
2014-11-15 12:40:34 +01:00
3021399869 Ensure View3D fx when using them, prevents some crashes with old files 2014-11-14 23:52:41 +01:00
ace38bdc82 Fix SSAO not being constant in camera view. 2014-11-14 19:55:30 +01:00
5a7f8f8ef8 Inverted effect of target density was unstable, the divergence term
needs to be substracted instead.
2014-11-14 17:11:33 +01:00
7289f36a59 Use dedicated debug values in cloth settings instead of abusing unused
other values.
2014-11-14 16:48:01 +01:00
f5e1be8532 Fixed wrong stride values used for offsetting the index of Eigen values.
The Eigen solver for hair grids uses an extra margin of 1, which means
greater stride values.
2014-11-14 15:51:23 +01:00
1103abdb86 Merge branch 'terrible_consequencer' into gooseberry
Conflicts:
	source/blender/editors/space_sequencer/sequencer_draw.c
2014-11-14 15:36:24 +01:00
e346911943 Gooseberry request, snap frame marker during frame setting by holding
ctrl key
2014-11-14 15:35:30 +01:00
f5c2b1c2f6 Merge branch 'master' into terrible_consequencer
Conflicts:
	source/blender/editors/space_sequencer/sequencer_draw.c
2014-11-14 15:07:10 +01:00
d1bfb48216 Hair grid code was using an invalid hair segment at each hair end with
zero vectors, leading to bad density values.
2014-11-14 14:55:56 +01:00
0655c4931c Merge branch 'viewport_experiments' into gooseberry 2014-11-14 14:46:02 +01:00
63663f00dc A bunch of debug drawing changes. 2014-11-14 14:45:46 +01:00
cb94f59f71 Fix T42596 crash with DOF on MacOS.
Compiler failed on last shader and failure was not detected. However
compiler error also revealed a blurring error as well :)
2014-11-14 14:45:20 +01:00
ee3b3f7669 Corrected the divergence and gradient calculation for the hair grid
solver input and output.

This uses the central difference method (instead of combined forward/
backward difference), which makes it easier to correctly account for
grid borders.
2014-11-14 14:41:55 +01:00
d7fcab7e25 Merge branch 'master' into gooseberry 2014-11-14 14:34:59 +01:00
63d7d8e1e5 Merge branch 'master' into viewport_experiments 2014-11-14 14:07:47 +01:00
f79cf18848 Fallback method for defining density in the hair grid using discrete
samples.

This is just an intermediate method to make sure the density is valid.
Eventually the closest-point method should be used, but for testing
the poisson solver this is easier to debug.
2014-11-14 11:10:45 +01:00
be9fbfd92f Added a margin to the number of cells used in the poisson grid solver,
to ensure we always have one layer of empty cells around the fluid.
2014-11-14 10:42:09 +01:00
3cf9c897ee Merge branch 'master' into gooseberry 2014-11-14 10:05:19 +01:00
c77eefb1f0 Merge branch 'master' into gooseberry 2014-11-13 17:44:10 +01:00
644848fab7 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/implicit.c
2014-11-13 17:40:06 +01:00
746b93497f fixes for last merge 2014-11-13 17:35:21 +01:00
024645d8e0 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/editors/space_sequencer/sequencer_draw.c
2014-11-13 17:23:19 +01:00
316a3e830c Merge branch 'master' into gooseberry 2014-11-13 17:15:24 +01:00
4dc9ca29de Merge branch 'master' into gooseberry 2014-11-13 17:14:35 +01:00
7a53563c98 Implementation of a target density feature for the hair simulation.
This allows setting a target density which the fluid simulation will
take into account as an additional term in the pressure Poisson
equation. Based on two papers
"Detail Preserving Continuum Simulation of Straight Hair" (McAdams et al. 2009)
and
"Two-way Coupled SPH and Particle Level Set Fluid Simulation" (Losasso et al. 2008)

Currently the target pressure is specified directly, but it will be
a lot more convenient to define this in terms of a geometric value such
as "number of hairs per area" (combined with hair "thickness").
2014-11-13 16:06:39 +01:00
debe72a243 Another fix for off-by-one hair grid resolution errors. 2014-11-13 16:05:17 +01:00
de30eddf82 Rewriting the grid rasterization function for hair segments. 2014-11-13 16:04:31 +01:00
120d78d6d5 Draw actual hair keys when the "Guide Hair" setting is enabled.
Without this certain debug tasks become very hard to visualize.
2014-11-13 15:15:02 +01:00
6e56dcdc79 Change widget interaction slightly so transform works immediately.
It may be better to use transform code for widgets but this will cause
nested operators for widget/operator and needs some consideration.

For transform e.g. we would have one transform operator taking care of
transformation of the widget, then feeding this back to regular object
transform.
2014-11-12 15:41:24 +01:00
01a37d8b03 Fix incorrect wrapping of lamp to RNA for widget. 2014-11-12 14:37:50 +01:00
f2db6b227c Remove magic numbers 2014-11-12 13:41:13 +01:00
aa22fa21f9 Widgets: inverted/constrained to property range working for properties
(not operators yet).

Now "umbrella" widget type works correctly.

Includes minor cleanup of view3d widgetgroup routines.
2014-11-12 12:00:12 +01:00
dfaddba86c correct offset for scaled widgets during interaction 2014-11-12 11:06:25 +01:00
4d3c1325d6 Merge branch 'terrible_consequencer' into gooseberry 2014-11-11 18:41:50 +01:00
500bac8225 Snap to left-right based on position of mouse relative to selection. 2014-11-11 18:41:09 +01:00
6101bdaf70 Support endpoint snapping correctly. 2014-11-11 18:13:00 +01:00
ec0c58823d First iteration of snapping based on strips - will be improved based on
imput from Mathieu.
2014-11-11 18:00:47 +01:00
b089332a4d WidgetMaps:
Now widgetmaps get created and destroyed with the area. Not sure if it's
the best design but it avoids too many creations and recreations.

arrow offset now calculated at property binding time - no RNA access
during interaction means no chance of crash during undo.
2014-11-10 15:48:02 +01:00
6968547b80 Bound properties/operators to widgets at draw time. This fits our design
much better (is the same as the way panels work) and will help avoiding
some crashes on undo.
2014-11-10 14:55:07 +01:00
5015864b68 Fix for grid drawing in 3D view, was using one less grid cell. 2014-11-10 11:34:36 +01:00
6c999f6ca4 Merge branch 'master' into wiggly-widgets 2014-11-10 11:10:45 +01:00
a659027d91 Merge branch 'hair_immediate_fixes' into gooseberry 2014-11-09 13:16:47 +01:00
7f7a63fb11 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/implicit.c
2014-11-09 17:10:15 +05:00
9f47e5d6eb Merge branch 'master' into hair_immediate_fixes 2014-11-09 12:13:43 +01:00
ca66f4444d Fix for color-wire auto-contrast 2014-11-09 01:01:26 +01:00
e6d6cbccc8 Merge branch 'master' into gooseberry 2014-11-08 22:31:28 +01:00
7f2f9f0acd Exposing customdata mask layer (CD_PAINT_MASK) to Python API
There are several more or less new customdata layers that currently cannot be accessed via Python (or some are exposed via BMesh API but not via Mesh API). This patch aims to expose one of those layers - CD_PAINT_MASK.
It'd be pretty useful for existing and future addons targeting sculpt workflow. Currently to get some access to the mask we employ a hackish approach via hiding/revealing masked vertices, this adds mode switches and doesn't allow to get actual mask values which could be useful if converted into vertex group weights for later use in e.g. modifiers. With this patch we'd be able to access mask data directly.

Reviewers: campbellbarton

Reviewed By: campbellbarton

Subscribers: radcapricorn

Projects: #bf_blender

Differential Revision: https://developer.blender.org/D782
2014-11-08 19:51:30 +01:00
3c0aed7dbc Implemented PIC and FLIP methods for combining the fluid grid simulation
with the Lagrangian hair model.
2014-11-08 19:34:16 +01:00
66f5f6770c Main solver step for generating a divergence-free hair velocity field
on the grid.

This uses the Eigen conjugate-gradient solver to solve the implicit
Poisson equation for the pressure Laplacian:

    div(grad(p)) = div(v)

As described in "Detail Preserving Continuum Simulation of Straight Hair"
(McAdams, Selle, 2009).
2014-11-08 18:45:28 +01:00
016168652f Allow separate widget data per editor.
To make this work, we need separate type/instance for the widgets. This
is a bit ugly but it is necessary if we want widgets on each editor to
depend of per editor-options or visibility state.
2014-11-07 18:12:32 +01:00
4e4c1a0ea0 Support undo. Scale stays same for non-3D widgets 2014-11-07 12:52:46 +01:00
70423fa275 Pampering the stupid MSVC compiler again, it fails to build valid C code. 2014-11-07 11:43:25 +01:00
c68eb204b5 Merge branch 'master' into gooseberry 2014-11-06 15:36:16 +01:00
b69314c620 Added new header for Eigen utility classes.
These make passing data between Eigen vector and matrix types and plain
C arrays more convenient.
2014-11-06 15:14:43 +01:00
68d835301e Updated a few comments. 2014-11-06 15:08:25 +01:00
a50706e07d Compile hair volumetrics code as C++, so we can use Eigen easier. 2014-11-06 15:05:42 +01:00
16bb70a1a4 Minor debug code fix. 2014-11-06 14:57:31 +01:00
29543afa4e Use a fixed, uniform cell size for hair continuum grids.
This is a bit more awkward for artists to use, but necessary for
a stable solution of the hair continuum calculation. The grid size is
defined by the user, the extent of the grid is then calculated based on
the hair geometry. A hard upper limit prevents bad memory allocation
in case too small values are entered.
2014-11-06 14:12:01 +01:00
08c477a6aa Removed unused voxel_filter_size DNA property.
This is an artifact of earlier attempts to implement velocity smoothing,
but doesn't work anyway.
2014-11-06 12:36:49 +01:00
cf28448364 Renamed HairVertexGrid to HairGrid, since it's not actually storing
hair vertex data.
2014-11-06 12:32:35 +01:00
439c7e089a Removed unused "collider grid" struct from hair volumetrics.
This is a leftover from previous approach of hair collisions (with
insufficient results). The hair volumetrics actually implements
"collision" with solid objects as well, but uses a Neumann boundary
condition on the main grid for this purpose.
2014-11-06 12:28:13 +01:00
7432efd9d7 Better grid rasterization method for hair volumetric grids.
This is based on the paper
"Detail Preserving Continuum Simulation of Straight Hair"
(McAdams, Selle, Ward, 2009)

The main difference is that hair line segments are used rather than only
rasterizing velocity at the vertices. This gives a much better coverage
of the hair volume grid, otherwise gaps can be produced at smaller grid
cell sizes and the distribution is uneven along the hair curve.

The algorithm for rasterizing is a variation of Bresenham's algorithm
extended onto 3D grids.
2014-11-06 12:17:09 +01:00
2a18501562 Add mapping to properties for widgets.
Still pretty much exploring the best way to move here but currently this
works by wrapping objects in RNA pointers, pretty much like buttons do.

Also modified the arrow widget for lamps to use the new code. The new
"unmbrella" widget works now as expected for lamps - of course fine
tuning is also needed.
2014-11-05 19:41:19 +01:00
04cb1b097a New debug element "circle" for simulations, which is quite useful for
visualizing scalar fields.
2014-11-05 19:17:39 +01:00
4b11cf171a Resurrection of 2.49 feature:
Ghosting of original arrow position while we are interacting with an
arrow widget.
2014-11-05 18:23:53 +01:00
71f1a3b1e2 Make projection code for arrow widget better. Also add some code to
allow tweaking of properties
2014-11-05 18:09:56 +01:00
49b972c43c Debug grid drawing for hair volume was drawing one subdivision too many. 2014-11-05 17:25:50 +01:00
e51d7a7a85 Merge branch 'master' into wiggly-widgets 2014-11-05 11:41:16 +01:00
5d42ab2ad0 Warnings 2014-11-04 17:58:50 +01:00
94d0fb0344 Merge branch 'master' into gooseberry 2014-11-04 17:10:33 +01:00
43d4a56d8d Support animation of camera dof properties.
Also minor cleanup
2014-11-04 17:02:08 +01:00
975e2580a8 Support animation of camera dof properties.
Also minor cleanup
2014-11-04 16:47:40 +01:00
5e8abc5afe Merge branch 'viewport_experiments' into gooseberry
Conflicts:
	release/scripts/startup/bl_ui/properties_data_camera.py
	release/scripts/startup/bl_ui/space_view3d.py
2014-11-04 15:29:46 +01:00
7b0031b187 Avoid freeing and reading/writing NULL pointers. Should not happen often
but better guard against it.
2014-11-04 15:26:25 +01:00
4322085f4f Only show properties if not in camera view, else direct user to camera
properties
2014-11-04 15:25:55 +01:00
9480cede0f Avoid freeing and reading/writing NULL pointers. Should not happen often
but better guard against it.
2014-11-04 14:48:33 +01:00
4aad147fe4 Support camera GPU parameters when looking/rendering through camera in
the viewport.
2014-11-04 14:30:19 +01:00
b550e788f2 Use own file for GPU option types.
* Add gpu options for depth of field to camera - still inactive.
* GPUFXOptions now passed to the compositing system startup
so users can swap options if they wish to

This commit changes read-write data again, people should reset their
values again (sorry for that but this is still WIP)
2014-11-04 14:30:19 +01:00
3a87fb5508 Support camera GPU parameters when looking/rendering through camera in
the viewport.
2014-11-04 14:28:25 +01:00
f89fab339e Use own file for GPU option types.
* Add gpu options for depth of field to camera - still inactive.
* GPUFXOptions now passed to the compositing system startup
so users can swap options if they wish to

This commit changes read-write data again, people should reset their
values again (sorry for that but this is still WIP)
2014-11-04 13:02:30 +01:00
ca0a0abf57 Merge branch 'terrible_consequencer' into gooseberry 2014-11-04 11:24:22 +01:00
46b787bd6e Merge branch 'viewport_experiments' into gooseberry
Conflicts:
	source/blender/makesdna/DNA_view3d_types.h
2014-11-04 11:12:08 +01:00
c73b7a6790 Merge branch 'master' into gooseberry 2014-11-04 09:23:23 +01:00
46cc844f43 Offscreen rendering for viewport FX.
This is working mostly from the 3D viewport currently, rendering from
the render buttons or the sequencer will not use the FX yet. Still it's
a solid step towards that direction. Also moved options out of the v3d
struct. Old options will be lost and people may get some warnings,
however simply enableing and disabling one of the compositing settings
will bring the controls back.
2014-11-03 20:20:32 +01:00
038c0d5466 fix some errors 2014-11-03 15:51:19 +01:00
4139deab00 Merge branch 'master' into terrible_consequencer
Conflicts:
	source/blender/editors/include/UI_view2d.h
	source/blender/editors/space_sequencer/sequencer_edit.c
2014-11-03 15:45:20 +01:00
7798ecd743 Add another level of small blur to bridge between no/medium blurring.
Algorithm used is now a full implementation of

"Practical Post-Process depth of field", presented here [1],
with a few modifications as to how circle of confusion is
applied at the final pass.

[1] http://http.developer.nvidia.com/GPUGems3/gpugems3_ch28.html
2014-11-03 14:06:47 +01:00
78d42f7885 Merge branch 'master' into viewport_experiments 2014-11-03 09:56:49 +01:00
fbb2c79618 Color Wire: improve method of tinting colors
also improve method to ensure contrast with background
2014-11-01 20:27:52 +01:00
eb8a09d567 DOF effect works :) 2014-10-31 21:23:57 +01:00
b455f80367 Unused leftover debug variable. 2014-10-31 21:20:38 +01:00
6a2ea7eb4e Reimplemented the voxel texture type for displaying hair continuum grids. 2014-10-31 20:29:51 +01:00
12657f7ef6 Expose hair grid info in the RNA (read-only); it can be useful for
debugging purposes.
2014-10-31 17:10:34 +01:00
adcdb4334b Debug visualization code of a slice of the hair velocity vector field. 2014-10-31 16:33:35 +01:00
2f1192d302 Removed arbitrary factor 2.0 on volumetric hair friction factor.
This was introducing energy into the system for any factor beyond 0.5
and caused major instability.
2014-10-31 16:30:54 +01:00
ff15a79cbd Fill the hair volume grid with the _new_ velocities from the first
solver step, instead of using the previous step's velocities.
2014-10-31 15:20:45 +01:00
2a5556b426 Merge branch 'master' into viewport_experiments 2014-10-31 14:45:00 +01:00
bcc5c1b4e1 Debug drawing feature to visualize the hair continuum grid. 2014-10-31 14:23:32 +01:00
53e624cd71 Perform grid-based velocity smoothing for hair outside of the implicit
solver step.

Calculating forces and jacobians from linearly interpolated grid values
is problematic due to discontinuities at the grid boundaries. The new
approach of modifying velocities after the backward euler solver step
was suggested in a newer paper

"Detail Preserving Continuum Simulation of Straight Hair"
(McAdams, Selle 2009)
2014-10-31 11:59:14 +01:00
a3b9dbf17c Merge branch 'master' into gooseberry 2014-10-30 22:34:08 +01:00
20ae92b352 Experimental color wire-frame (for testing in the studio) 2014-10-30 16:26:39 +01:00
82f30be425 Fix for warnings/errors 2014-10-30 16:17:30 +01:00
ad47b5a9d2 Merge branch 'master' into hair_immediate_fixes 2014-10-30 16:02:10 +01:00
1556753281 Reorganizing hair dynamics UI layout a bit to make settings slightly
more intuitive.

Also removed a couple of unused or useless features from the UI:
* collider friction is unused and replaced in favor of true collision
* spring damping refers to structural springs (stretch), which is
  not noticable in hair due to extreme stiffness atm.
* pressure factors are not sure since this feature is too unstable atm.
2014-10-30 15:59:13 +01:00
356ed34ba5 Disabled the hair preview feature in the code, due to limited usefulness.
Interpolating hairs in a meaningful way is a quite difficult problem.
It works ok-ish for child hairs as long as they don't move, but with
motion the direction of interpolated hairs can become quite nonsensical
quickly.

Probably a better way to create simulation previews is to limit
simulation to a particular well-defined area (like render preview
borders), but run it in full detail in that area. The error from
omitting some interaction should still be much less than orientation
errors from interpolation.
2014-10-30 15:59:13 +01:00
2f1631f747 Moved render simplification function for particle distribution into the
distribution code.
2014-10-30 15:59:13 +01:00
00151430fc Removed unused variable. 2014-10-30 15:59:13 +01:00
ec476a168b A little bit of code sanity by splitting particle distribution function
by type.

Instead of squashing totally unrelated code into the same monster
function.
2014-10-30 15:59:13 +01:00
d4823812fa Moved particle code for distributions into own file to make hacking
easier.

This code is badly broken and needs to be replaced, but at least having
a workable code structure might help with quick hacks to fix the worst
cases.
2014-10-30 15:59:13 +01:00
7a59a58990 Removed unused line. 2014-10-30 15:59:13 +01:00
bbddc2c033 New hair editing feature "Shape Cut", for cutting hair based on a mesh
shape instead of a brush tool.

The brush cutting tool for hair, while useful, is not very accurate and
often requires rotating the model constantly to get the right trimming
on every side. This makes adjustments to a hair shape a very tedious
process.

On the other hand, making proxy meshes for hair shapes is a common
workflow. The new operator allows using such rough meshes as boundaries
for hair. All hairs that are outside the shape mesh are removed, while
those cutting it at some length are shortened accordingly.

The operator can be accessed in the particle edit mode toolbar via the
"Shape Cut" button. The "Shape Object" must be set first and stays
selected as a tool setting for repeatedly applying the shape.
2014-10-30 15:59:13 +01:00
d1be54886e Switched back to blender implicit solver for merge. 2014-10-30 15:59:13 +01:00
2224220d20 Unified the main Eigen solver function a bit for constrained/unconstrained
solver variants.
2014-10-30 15:59:13 +01:00
e57d3af847 Ported the remaining implicit solver functions for Eigen.
Also added a couple of utility wrapper functions for Eigen types to make
interfacing with plain float arrays and blenlib math easier.
2014-10-30 15:59:13 +01:00
4e38d9df9e Updating Eigen implicit dynamics solver implementation to adhere to the
new mass-spring solver API.
2014-10-30 15:59:13 +01:00
4dd4145fee Merge branch 'master' into gooseberry 2014-10-30 15:31:47 +01:00
f63ce02a63 Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenlib/BLI_math_matrix.h
	source/blender/blenlib/intern/math_matrix.c
	source/blender/editors/object/object_bake_api.c
2014-10-30 15:24:40 +01:00
b6393da835 Reorganizing hair dynamics UI layout a bit to make settings slightly
more intuitive.

Also removed a couple of unused or useless features from the UI:
* collider friction is unused and replaced in favor of true collision
* spring damping refers to structural springs (stretch), which is
  not noticable in hair due to extreme stiffness atm.
* pressure factors are not sure since this feature is too unstable atm.
2014-10-30 15:10:34 +01:00
3e5627ec57 Disabled the hair preview feature in the code, due to limited usefulness.
Interpolating hairs in a meaningful way is a quite difficult problem.
It works ok-ish for child hairs as long as they don't move, but with
motion the direction of interpolated hairs can become quite nonsensical
quickly.

Probably a better way to create simulation previews is to limit
simulation to a particular well-defined area (like render preview
borders), but run it in full detail in that area. The error from
omitting some interaction should still be much less than orientation
errors from interpolation.
2014-10-30 14:41:14 +01:00
de27811177 Correctly downsample circles of confusion and use parallelism to do it
more efficient.
2014-10-29 19:41:12 +01:00
6484056cc1 Second pass, blurs the downsampled buffer once. 2014-10-29 18:31:15 +01:00
a4f35de026 Use the correct shaders and varyings 2014-10-29 18:08:22 +01:00
ba2f0ad779 Viewport DOF:
* Scons builds correctly
* Separate vertex shader file for DOF, will make handling main easier
* Downsample color buffer + blur it. Circle of confusion is calculated
from zplane instead of length of distance from camera.
2014-10-29 16:18:19 +01:00
e0cba973e7 First ping pong between low resolution buffers working. Nice landmark
for working code.

Also cleanup unused variables and do not bind the same texture to two slots
(blurred texture is going to be different anyway)
2014-10-29 12:46:25 +01:00
c6292918a3 Framebuffer compositing:
* Cleanup compositing buffers better when not needed.

* Support passes for the dof effect through defines in main - easy
solution to allow not having too many files for one shader effect.
2014-10-29 12:01:13 +01:00
518f794a6f SSAO and DOF work well together now. 2014-10-29 11:12:41 +01:00
dc22a50488 Code that enables simultaneous DOF-SSAO effect. There's some sort of
texture coordinate offset still.
2014-10-28 21:24:38 +01:00
d2d3bd35c1 Use optimized view space reconstruction for ortho case as well. 2014-10-28 19:44:05 +01:00
0782c680a6 Add a library file for projection shader code, should enable us to use
optimized position calculation again - relevant for both SSAO and DOF
2014-10-28 19:07:58 +01:00
8f25b6d6c8 More attempts to synchronize viewport and camera dof - probably will
need fixes in the rendering systems. Reserve textures for the dof
effect.
2014-10-28 18:28:58 +01:00
d86c686e41 Moved render simplification function for particle distribution into the
distribution code.
2014-10-28 17:16:59 +01:00
97caee6c46 Removed unused variable. 2014-10-28 17:09:45 +01:00
e43ecb1201 A little bit of code sanity by splitting particle distribution function
by type.

Instead of squashing totally unrelated code into the same monster
function.
2014-10-28 16:45:23 +01:00
d6e93d9dfe Moved particle code for distributions into own file to make hacking
easier.

This code is badly broken and needs to be replaced, but at least having
a workable code structure might help with quick hacks to fix the worst
cases.
2014-10-28 16:29:33 +01:00
6e8ba2f3f5 DOF calculation shader. 2014-10-27 20:45:51 +01:00
c48abbb090 Merge branch 'master' into viewport_experiments 2014-10-27 11:10:49 +01:00
5efa0e03b5 Add separate file for DOF effect and cleanup the parameter passing a little. 2014-10-27 10:06:56 +01:00
d54c249a7b Separate SSAO pass - it's unlikely we'll be able to reuse this with
depth of field in one pass, so better separate the shaders as well
2014-10-23 22:42:48 +02:00
3967f5659d Fix irritating issue with self shadowing.
Issue here was position reconstruction could use depths from pixels off
the initial position. Using linear filtering here eliminates the issue.

Usually this is not correct however given that for depth discontinuities
we will get different depths anyway, the cases where we get smooth
interpolation of depths helps a lot in image quality.
2014-10-23 20:12:39 +02:00
1082a2f125 Add some pedantic GLSL casts to make shader compile in OSX 2014-10-23 17:01:19 +02:00
ddb33a3181 SSAO introduce quality settings
Basically change the way SSAO samples the screen by using a circular
filter instead. This is inspired by HBAO though we still don't use this.

The quality settings change the number and density of samples. We can
definitely improve things here though.

We also jitter the sampling locations per pixel. Generally this adds a
kind of noise. Some banding is, unfortunately still apparent and small
distances will introduce noise. This can be fixed but I will have to see
if it can be done without much of a cost.
2014-10-22 19:27:43 +02:00
f19fcf7aad Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenkernel/intern/key.c
2014-10-22 18:12:42 +02:00
cfd13b6dd2 Removed unused line. 2014-10-22 18:11:12 +02:00
529c287260 New hair editing feature "Shape Cut", for cutting hair based on a mesh
shape instead of a brush tool.

The brush cutting tool for hair, while useful, is not very accurate and
often requires rotating the model constantly to get the right trimming
on every side. This makes adjustments to a hair shape a very tedious
process.

On the other hand, making proxy meshes for hair shapes is a common
workflow. The new operator allows using such rough meshes as boundaries
for hair. All hairs that are outside the shape mesh are removed, while
those cutting it at some length are shortened accordingly.

The operator can be accessed in the particle edit mode toolbar via the
"Shape Cut" button. The "Shape Object" must be set first and stays
selected as a tool setting for repeatedly applying the shape.
2014-10-22 16:42:32 +02:00
33e7e1ddb2 SSAO works again. Unfortunately it's unavoidable to have it work without
explicit attenuation control (by using just max distance).

Also it now supports orthographic cameras properly. The maximum distance is
now defined in world space units so it should be slightly easier to understand
and uniform across perspective and orthographic cameras.

The optimizations can be generalized for orthographic cameras but the code is
more complex and the runtime advantage is questionable in that case
(in the end a matrix transform is 4 dot products which are not that terrible)
so commented out the code there for now.
2014-10-22 16:33:33 +02:00
c7e85ca92c Merge branch 'master' into gooseberry
Conflicts:
	source/blender/blenkernel/intern/key.c
	source/blender/blenloader/intern/versioning_270.c
2014-10-22 11:20:43 +02:00
0c8469c440 Correct normal reconstruction with optimized formula.
This needed some adjustments from the formula I found on the article on
view space reconstruction, since OpenGL makes different assumptions about its
projection matrix.

SSAO does not work yet correctly under new model assumptions but we are going
to substitute with nice horizon based ambient occlusion.
2014-10-22 01:14:25 +02:00
30be0f0977 Refactoring of SSAO code. Uses some optimizations but result is different
still test file here to help with debugging.
2014-10-21 20:33:09 +02:00
e1755158c0 Merge branch 'master' into viewport_experiments 2014-10-21 16:54:24 +02:00
e963efcd19 Normalize the depth to the -1.0 to 1.0 range as well. 2014-10-20 21:46:29 +02:00
5b4b83d7e3 Add shader files to the source tree. It helps by displaying them in the
IDE
2014-10-20 20:38:50 +02:00
5c31594ab7 Merge branch 'master' into viewport_experiments 2014-10-20 18:56:00 +02:00
f7c5a231d5 Merge branch 'master' into terrible_consequencer
Conflicts:
	source/blender/editors/space_sequencer/sequencer_edit.c
	source/blender/editors/space_sequencer/sequencer_ops.c
2014-10-20 15:49:54 +02:00
18bc829e5e Trim tool:
Support metastrips and multiple strips at once.
2014-10-20 15:01:34 +02:00
c99b02b047 WIP support for meta trimming 2014-10-20 11:04:14 +02:00
09180f7ca8 Merge branch 'master' into terrible_consequencer 2014-10-20 10:55:34 +02:00
388dc24330 Hook widget event to the lamp operator. 2014-10-17 19:17:05 +02:00
97bb7d0a5b Hook calling widget to operator event system. Alpha alpha code still.
Transform/lamp still don't process those.
2014-10-17 17:11:14 +02:00
ffac46c30c Store the active widget in the context. This allows us to first call the
widget handler if needed.
2014-10-17 16:45:26 +02:00
1f9f58938d Arrow handler that does something useful (tm). However still not hooked
up to operators.
2014-10-17 16:11:23 +02:00
585204bd61 Dummy handler for arrows, take care of some allocation issues for
operators.
2014-10-17 15:09:51 +02:00
80c9a971f9 Add callbacks for operator initialization. Now a widget will directly
call an operator and have its own handlers for input.

No handlers implemented yet.
2014-10-17 14:48:58 +02:00
28599523fc Classic fix linking of the widget library. 2014-10-17 11:23:07 +02:00
057c7fd6cb Merge branch 'master' into wiggly-widgets 2014-10-17 10:45:48 +02:00
050bc3f3c4 More API reorganization 2014-10-15 19:49:21 +02:00
c56b812f76 WIP commit, basically introducing a few things here:
* highlighted vs active widget.

Active widget takes all input and basically highjacks drawing of all
other widgets in the widgetmap.

* operator names for widgets. Now widgets will spawn operators based on
names that are passed on them. They will also modify a named property of
the operator and pass it on, after which operator can process it.
2014-10-15 19:16:09 +02:00
814fb1e775 Manipulator:
* Fix error in plane manipulator handling.
* Don't show manipulator widgets on paint modes.
2014-10-15 16:56:31 +02:00
4581091fc4 Only detect active widget on mousemoves. Now handler operates on
mouseclick (bound to change)
2014-10-15 16:37:46 +02:00
a4bb56f9ba Merge branch 'master' into wiggly-widgets 2014-10-15 15:51:52 +02:00
8b90c081b0 Ring widgets:
Add a clipping style, just like manipulator
2014-10-15 15:45:17 +02:00
9a6719a314 Undo previous changes to sound.
The sound system really needs better design for the sequencer and
patching it up now won't really help us in the long run.

Also the sequencer kept leaking file descriptors when preserving
the audio handlles on undo making the branch unusable on mac and
windows.

It's almost certain patching over this will lead to more trouble, better
handle it separately and keep the system working for now.

Kept threaded loading of waveforms since we control the file input
directly there and leads to nice speedup, but we still clear the whole
sound + the waveform on undo, which is pretty bad.
2014-10-15 14:20:44 +02:00
d2fd772374 Merge branch 'master' into terrible_consequencer 2014-10-15 11:40:21 +02:00
687cb3ab86 Add space for facegroup storage 2014-10-15 10:49:58 +02:00
9c5e1a0ea5 Widgets:
* Move lamp operators to a proper place
* Store a list of widgets to avoid polling too many times
* Fix wrong indices when widgetgroup was not used.
* Lamp widget now uses an arrow widget. This will be refined to make a
nice prototype for operator/widget interaction.
2014-10-14 18:37:28 +02:00
ebfad36a22 Use a property to make the transform operator widget driven.
Design is still pending here, but for now just use to not remove widget
display.
2014-10-14 16:20:20 +02:00
1b936e8ce6 Change dial to something that resembles current rotation widget better. 2014-10-14 13:03:30 +02:00
20fc027690 Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2014-10-14 12:54:12 +02:00
e7da5a2d8f Merge branch 'master' into hair_immediate_fixes 2014-10-14 09:07:58 +02:00
35d504d136 Merge branch 'master' into gooseberry 2014-10-13 20:00:53 +02:00
c5a9add370 Dial widget, used in rotation manipulator code.
The widget can still change in the future, also widget styles can always
be used to create new widget visualizations.
2014-10-13 18:16:09 +02:00
14686a3677 Implement non-3D drawing per widget.
Basically, 3D widgets stay the same size whatever the zoom is in 3D
view. Ported over from manipulator code.
2014-10-13 16:43:35 +02:00
543dfc2a6a Merge branch 'master' into wiggly-widgets 2014-10-13 16:13:19 +02:00
41f1bb1096 Switched back to blender implicit solver for merge. 2014-10-12 17:13:08 +02:00
75ca718d8f Unified the main Eigen solver function a bit for constrained/unconstrained
solver variants.
2014-10-12 17:04:04 +02:00
5b1bfacfe2 Ported the remaining implicit solver functions for Eigen.
Also added a couple of utility wrapper functions for Eigen types to make
interfacing with plain float arrays and blenlib math easier.
2014-10-12 16:14:15 +02:00
dbe2f67ca5 Updating Eigen implicit dynamics solver implementation to adhere to the
new mass-spring solver API.
2014-10-12 12:45:07 +02:00
a0ac1c8b5c Merge branch 'hair_immediate_fixes' into gooseberry 2014-10-11 11:23:24 +02:00
afa23b3919 Compatibility fix for shape keys.
Avoid moving the 'from' pointer around in DNA. This way files stay back-
as well as forward-compatible. Only the additional type enum and
sub-index is stored in a new from_extra struct in shape keys now.
2014-10-11 11:21:31 +02:00
c2765bd99f Fix for invalid ID access during versioning.
For now is fixed by doing a versioning hack in the lib_link function,
but would be nicer to avoid this altogether for forward compatibility.
2014-10-10 14:55:20 +02:00
5739db16eb Merge branch 'hair_immediate_fixes' into gooseberry 2014-10-10 10:37:29 +02:00
ed19740751 Merge branch 'master' into hair_immediate_fixes 2014-10-10 10:33:09 +02:00
af0de1c646 Interpolation for non-simulated hairs in preview.
This generates a somewhat believable overall look for the hair system
by blending simulated hairs. For small number of hairs and small
preview ratios this can get quite inaccurate, but that's the tradeoff
for getting preview functionality ...
2014-10-10 10:29:02 +02:00
7cd6d9aada Calculate blending weights for preview hairs by constructing a kd-tree
of simulated hairs and using nearest neighbors.
2014-10-09 12:52:52 +02:00
06a854cddb Removed debug prints. 2014-10-09 12:18:04 +02:00
0d2dfcb212 Solved various update issues with the hair preview factor.
This is still terribly messy, especially because every change of the
particle system has to be piped through the dummy cloth modifier somehow.
The automatic caching system also tends to get in the way a lot; after
changing the preview factor one basically always has to start at frame 1
currently because the cloth modifier has to be reconstructed and forgets
about all caching.
2014-10-09 12:14:36 +02:00
face9721d8 Widgets:
* Add option for shaded/non shaded widgets
* Normalize arrow widget size to 1.0 so size is predictable. Probably
will use the same scheme for other widgets as well
2014-10-08 22:51:54 +02:00
e8d49c06c0 All translation axis now drawn and operated through the widget system. 2014-10-08 20:11:19 +02:00
334b25a226 * Manipulator Y 3D arrow moved and rotated correctly.
* Light manipulator doing undo now
* Scons should be fixed.
2014-10-08 19:34:16 +02:00
e15819daf3 Green widget handles y translation properly. 2014-10-08 18:32:06 +02:00
c1ffa9d0e0 ManipulatorGroup customdata.
Make WidgetGroup data private.
2014-10-08 18:13:12 +02:00
3a55705044 WidgetGroup now handles updating the manipulator properties.
Still not hooked new arrow widget to the system
2014-10-08 16:56:15 +02:00
02b81b3bca Add python exporter that exports a mesh in a C file in a renderer-ready
format (vertices + normals + triangle vertex indices)

This will allow us to create widgets in blender instead of defining them
programmatically.

May also support facegroups for different colors in the future though
they must be somehow tied to the UI colors.
2014-10-08 15:50:30 +02:00
671a508ae3 Enable depth testing for widgets.
Especially if we have many widgets on screen, sorting them will be
difficult and for mesh-armature widgets it will be unavoidable if we
want to avoid tweaking "back" surfaces.
2014-10-08 12:45:54 +02:00
e2c5839114 Merge branch 'master' into wiggly-widgets 2014-10-08 12:31:05 +02:00
237d7f3188 Complete shaded arrow widget code. It will need sorting if keep the
shading.
2014-10-07 20:29:40 +02:00
b9b0495de9 WIP redesign of the system. Nothing functional (not even manipulator).
There is first code for display of an arrow widget. The manipulator will
use those when they are ready.

Basically the manipulator is now a WidgetGroup. WidgetGroups are a new entity and
they manage a group of related widgets. They should be responsible for state update,
drawing and polling of their widgets and can be bound to specific rules.

There is a big design plan on a whiteboard beside me, it will take a few
big commits still to take shape though. One thing at a time, I am first making
reusable arrow widgets that will allow us replace the translate widgets properly.

There are a few reusable widgets planned, more to come later.
2014-10-07 19:09:45 +02:00
dd9f957ccb Preliminary commit for simulation preview. 2014-10-07 17:27:04 +02:00
6f0602ca17 Dragging the light handle will now point the lamp to the point in 3D
where user is dragging over.
2014-10-07 12:48:29 +02:00
2fa1dfacda Merge branch 'master' into wiggly-widgets 2014-10-07 11:14:47 +02:00
854db0f0ae enum instead of #define for cloth vertex flags. 2014-10-07 10:12:42 +02:00
635ce0e9ed Removed accidentally committed debug print. 2014-10-06 19:10:07 +02:00
860a27d00d Removed accidentally committed debug print. 2014-10-06 19:09:18 +02:00
cdca6e7be4 Merge branch 'hair_immediate_fixes' into gooseberry 2014-10-06 19:02:57 +02:00
2d09ebb5b6 Use the generic task scheduler for threaded particle tasks, i.e.
distribution and path caching for child particles.

This gives a significant improvement of viewport playback performance
with higher child particle counts. Particles previously used their own
threads and had a rather high limit for threading. Also threading
apparently was disabled because only 1 thread was being used ...
2014-10-06 18:58:41 +02:00
1383661488 Merge branch 'master' into hair_immediate_fixes 2014-10-06 11:48:19 +02:00
5731472612 Removed block matrix indices storage from ClothSpring struct.
This is not necessary: the implicit solver data can keep track instead
of how many off-diagonal matrix blocks are in use (provided the
allocation limit is calculated correctly). Every time a spring is
created it then simply increments this counter and uses the block index
locally - no need to store this persistently.
2014-10-04 16:14:40 +02:00
a44e944c99 Removed unused force arguments for angular bending springs and avoid
redundant calculation for counterforces.
2014-10-04 15:56:06 +02:00
5b52e4b1f6 Fix for brackets lost in merge. 2014-10-04 11:50:13 +02:00
2976eb598a Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2014-10-04 11:19:01 +02:00
f8b19d1d6e Logic for light position operator. 2014-10-03 19:51:26 +02:00
ce9603e382 WIP, operator to tweak the lamp "focus", driven through widgets. 2014-10-03 19:11:24 +02:00
8f86174ea5 Use the hair shape keys as goal positions (xconst) in the hair solver.
Note that this does not change the natural bending shape of the hair so
far, but only affects the global goal position for now.
2014-10-03 17:32:58 +02:00
37a7421e10 Lamp widget:
* Make a lamp widget design for the active lamp.
* Fix some handler errors for widgets + autoupdate for different widget
handles.
2014-10-03 17:11:01 +02:00
71dd6e2ada Guide hair drawing for hair particles.
Without this the particle system only shows the actual non-simulated
hairs ("guide hairs") during edit mode. These hairs are used for goals
as well, so showing them in the regular viewport is pretty important.

Also the usual hair curves are interpolated along the entire length,
which makes it very difficult to see exact vertex positions, unless
using exact powers of 2 for the segment number and match the display
steps.
2014-10-03 16:46:08 +02:00
98caf9331d Fixed RNA update callbacks to ensure the hair path cache is rebuilt. 2014-10-03 14:54:21 +02:00
1b8781b40e Fix for hair shape key ui script. 2014-10-03 14:19:32 +02:00
b69cf65893 Fixed some ui script errors. 2014-10-03 14:06:29 +02:00
6db28d51b6 Fixed some uses of ob->shapenr instead of psys->shapenr. 2014-10-03 14:05:59 +02:00
f208502fb3 Replaced the single ID *from pointer in shape keys with a more
detailed `owner` struct.

This allows distinction of classic ID block shape keys from particle
system keys.
2014-10-03 14:04:42 +02:00
639ff6e94d Evaluate shape keys when building the particle path cache. 2014-10-03 12:16:24 +02:00
007974899f Placeholder widget code for spotlamps 2014-10-03 12:15:57 +02:00
0b104fa5c5 Shape key "specials" menu for particle shape keys. 2014-10-03 09:49:10 +02:00
94512106f5 Renamed file to make it consistent with object shapekey operators. 2014-10-03 09:09:04 +02:00
8c92b530dd Fix for RNA using ptr->id.data instead of ptr->data for ParticleSystem. 2014-10-03 09:06:34 +02:00
88105788ac Merge branch 'master' into wiggly-widgets 2014-10-02 20:34:26 +02:00
6c09f016de Move widget drawing at a higher level - try drawing on top of rendering
too.

Rationale - widgets might be useful to have even on rendered scenes -
we'll have to see about how this will work

Also use area initialization code to register region specific widgets once.

lala
2014-10-02 20:33:59 +02:00
0b6e2aa6d2 Conversion functions from/to hair shape keys to particle data. 2014-10-02 19:20:16 +02:00
d9b7f7305a Shape key infrastructure for hair. 2014-10-02 19:04:59 +02:00
2ee254e1a8 Merge branch 'master' into wiggly-widgets 2014-10-01 19:18:15 +02:00
b1f3383eec Merge branch 'wiggly-widgets' into gooseberry 2014-10-01 19:02:54 +02:00
392e9e18f1 Fix release comfirm for central widget in transform operator 2014-10-01 19:01:18 +02:00
d928155df1 Fixes to highlight code, now widgetmaps remember last active widget and
reset accordingly.
2014-10-01 18:44:40 +02:00
43c2e17289 Merge branch 'hair_immediate_fixes' into gooseberry 2014-10-01 18:33:04 +02:00
7aee4e2997 Improved child hair curling for interpolated child particles.
The curl radius for children in interpolated mode was calculated using
the total offset from the parent particle. This leads to very large
radii when the distance is large due to sparse parents. Such behavior is
also very unrealistic because the curl radius is mostly constant and
defined by the material properties.

All the child hairs are roughly parallel by default. To simulate the
agglomeration of children into hair wisps the "flatness" parameter is
now used to clump them together.
2014-10-01 18:25:17 +02:00
7e2dd7d3e1 Highlighting for manipulator widget.
This should use an "active" system, similar to buttons to detect if last
widget has changed and act accordingly. Currently, when the active
widget changes, there is no change in highlights.
2014-10-01 17:43:33 +02:00
2b7f356442 Tidy up the widget API, only do 3d intersection on widgetmaps that
support it (determined during creation)
2014-10-01 15:37:45 +02:00
8e1208c974 Widget API:
Code that handles 3D object intersection via GPU selection. We might
want to use raycasting here, but leaving that for when we have it.

Manipulator code now uses this API to do intersection testing
2014-10-01 14:59:09 +02:00
4ce4f57acf Refactoring of manipulator code to use selection evaluation and codes
that can be shared with other widgets.
2014-10-01 12:44:17 +02:00
d2e148f2de Cloth solver data for edit mode is unused, removed it. 2014-10-01 11:25:45 +02:00
76dc35fcde Merge branch 'hair_immediate_fixes' into gooseberry 2014-10-01 11:16:04 +02:00
182535b296 Merge branch 'master' into hair_immediate_fixes 2014-10-01 10:06:00 +02:00
18cffd6fbf WIP code reshuffling for widgets 2014-09-30 18:33:23 +02:00
088ff210a9 Manipulator now uses the widget system (no operators used).
Widgets use a similar notification system as operators. It might be
worth using WM_BREAK messages like the rest of the handlers. For now
this should do.
2014-09-29 19:48:38 +02:00
10a3ca0189 Move manipulator handler to the widget system. 2014-09-29 18:51:00 +02:00
60e77c50ee Draw manipulator from widget callback (handling still done separately) 2014-09-29 16:36:08 +02:00
3982f9daf0 Merge branch 'master' into wiggly-widgets 2014-09-29 14:16:19 +02:00
c7ccbc9e75 Fix for scons files missing physics include folder. 2014-09-26 23:38:42 +02:00
07dac94618 Yet another attempt to solve OSX issues, restore sequence sounds too, or
sounds get added to two sequence and file descriptors leak
2014-09-26 19:47:21 +02:00
ebf005e32b Added separate damping for bending springs.
The bend damping factor was hardcoded to the same value as the stiffness.
Now it has its own factor in the settings and button in hair dynamics.
2014-09-26 17:25:21 +02:00
06871e6fbc Minor corrections to the types 2014-09-26 13:57:05 +02:00
ac97720734 New data types for sequencer.
Uses struct hierarchies to reduce the data used per strip.

Also changed sequence -> strip. Might be better to use NSequence for
editing as well.
2014-09-26 12:17:12 +02:00
56719625fc Merge branch 'master' into terrible_consequencer 2014-09-26 10:32:06 +02:00
e239912c06 Set the length threshold for hair simulation to 10% again (from 1%).
With the default 5 substeps the simulation can otherwise still become
unstable. This is just a preliminary measure anyway until the length
variance can be fixed properly.
2014-09-26 10:08:56 +02:00
b89a1a64c5 Fix for outdated root array size when changing the particle amount
during simulation.
2014-09-26 09:33:51 +02:00
408837ed1b Fix for hair chain testing in the cloth modifier.
Bending springs are en-bloc and not interleaved with other springs, so
this can't be used as a test for hair roots. Use consecutive indices
instead.
2014-09-26 09:26:08 +02:00
2682ea830a Completed the implementation of bent rest shapes for hair.
Basically follows the Pixar approach from "Artistic Simulation of Curly
Hair".
2014-09-25 23:19:20 +02:00
0717da3ac5 Gooseberry request: Backdrop for sequencer. 2014-09-25 23:09:38 +02:00
7c83650fb3 Add missing notification for trimming to stop showing the extensions 2014-09-25 18:10:39 +02:00
36607080bd Gooseberry request, hide the extensions except when trimming. 2014-09-25 18:00:00 +02:00
ca7219ddff Get rid of temporary flags when loading the sound. 2014-09-25 16:59:34 +02:00
d366d8e028 Attempt to fix OSX issues (again): cleanup the loading flag for files
that are loading when interrupted.
2014-09-25 16:26:52 +02:00
d0ac4e1c60 Target calculation for local non-straight rest shapes.
This is more involved than using simple straight bending targets
constructed from the neighboring segments, but necessary for restoring
groomed rest shapes.

The targets are defined by parallel-transporting a coordinate frame
along the hair, which smoothly rotates to avoid sudden twisting (Frenet
frame problem). The rest positions of hair vertices defines the target
vectors relative to the frame. In the deformed motion state the frame
is then recalculated and the targets constructed in world/root space.
2014-09-25 15:42:08 +02:00
26a906d53c Have to include BLI_utildefines before BKE_collision now to have bool
defined.
2014-09-25 11:03:31 +02:00
6dcc3f0b91 change widget code, area now just stores a pointer to the widget list
corresponidng to it.
2014-09-24 19:09:07 +02:00
5dfb07ab43 Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenkernel/intern/implicit.c
2014-09-24 19:02:58 +02:00
2bb6d18f41 Merge branch 'master' into wiggly-widgets 2014-09-24 18:30:56 +02:00
467da3ce16 Store the waveforms between undo steps when they exist. 2014-09-24 17:03:35 +02:00
0684d0fe9f Fix compilation in MacOSX 2014-09-24 16:28:50 +02:00
8e95eae192 More undo issue solving.
This commit moves sound loading out of library linking. The approach
chosen here is to do lazy initialization by basically validating the
sound before attaching to the scene.

Loading the sound buffer requires a valid Main pointer, which means we
have to pass this around in many places. We might also consider caching
the waveforms in this way too, but for now we're still using the
threaded update.

We'll have to test this somewhat to see if it behaves well..There are
corner cases which might not be covered. Sounds are muted if we undo
during an animation, but this bug existed in master as well.
2014-09-24 16:21:49 +02:00
aebcb6a860 Merge branch 'master' into terrible_consequencer 2014-09-24 10:23:37 +02:00
c95c25e29e Merge branch 'master' into hair_immediate_fixes
Conflicts:
	source/blender/blenloader/intern/versioning_270.c
2014-09-24 10:05:04 +02:00
f3f741b3a4 Clear forces and constraints together at the start of the time step,
easier to verify.
2014-09-24 08:55:29 +02:00
9aa7fcd588 Threaded sound strip display data loading.
Sound loading can take too much so move it to a job and continue. This makes
interaction much better. A similar system should be usable for movie previews.
2014-09-23 17:37:19 +02:00
2788b38e38 Fix for missing initialization of local cloth modifier inside particle
systems.
2014-09-22 21:20:22 +02:00
ee323fc61d Proper implementation of angular bending springs including jacobian
derivatives for stabilization.

The bending forces are based on a simplified torsion model where each
neighboring point of a vertex creates a force toward a local goal. This
can be extended later by defining the goals in a local curve frame, so
that natural hair shapes other than perfectly straight hair are
supported.

Calculating the jacobians for the bending forces analytically proved
quite difficult and doesn't work yet, so the fallback method for now
is a straightforward finite difference method. This works very well and
is not too costly. Even the original paper ("Artistic Simulation of
Curly Hair") suggests this approach.
2014-09-22 19:27:41 +02:00
bf996074bb Gooseberry request, option to turn all waveform display on/off. 2014-09-22 15:29:22 +02:00
c4b6d60af3 Attempt to fix shader compilation in OSX. strict compilation does not
allow dividing float by integer.
2014-09-22 14:20:30 +02:00
f0fb58afe3 Unused function declaration. 2014-09-21 11:48:27 +02:00
caf81de33c Basic solver result feedback from the mass-spring (cloth/hair) solver.
This returns a general status (success/no-convergence/other) along with
basic statistics (min/max/average) for the error value and the number
of iterations. It allows some general estimation of the simulation
quality and detection of critical settings that could become a problem.
Better visualization and extended feedback can follow later.
2014-09-20 21:05:46 +02:00
9b1f109c89 Hack to make undo/redo faster in sequencer when using strips with
waveform display.

Basically, we store the waveform. This is not really recommended but
until we have nice threaded creation for the strips that doesn't block
the interface it's a nice solution for gooseverry.

May be wise to limit the undo memory for people who use that because
basically each operation will store a copy of the waveform in the file.
2014-09-19 19:51:01 +02:00
0f62717edb Merge branch 'master' into terrible_consequencer 2014-09-19 19:15:35 +02:00
1760d7566a Calculate bending targets based on the direction of previous segments.
This makes the bending a truely local effect. Eventually target
directions should be based in a local coordinate frame that gets
parallel transported along the curve. This will allow non-straight
rest shapes for hairs as well as supporting twist forces. However,
calculating locally transformed spring forces is more complicated.
2014-09-19 16:53:35 +02:00
1cd9800f3c Simple debug drawing support inside the implicit solver. 2014-09-19 16:52:49 +02:00
f0cf10b3b9 Widgets API.
This commit has first WIP code for widgets API.
Generally widgets should be registered similar to dropboxes, that is,
any code can query for a widgetmap for a certain space and area type
and the window manager will take care of initializing the handlers
automatically.

The owner will be able remove and readd widgets to a certain widgetmap
dynamically. Generally owners should cleanup their widgets though initial code
cleans up leftover widgets automatically.

All this is the theory still, some parts are in that commit, more to come
later, but it's a solid base to build from for an initial commit.
2014-09-19 13:07:01 +02:00
eb38d27b33 Added a damping term for angular bending springs. 2014-09-19 11:51:35 +02:00
1e8f11c473 Simple initial implementation of angular bending springs.
These are much better suited for creating stiff hair. The previous
bending springs are based on "push" type spring along the hypothenuse
of 3 hair vertices. This sort of spring requires a very large force
in the direction of the spring for any angular effect, and is still
unstable in the equilibrium.

The new bending spring model is based on "target" vectors defined in a
local hair frame, which generates a force perpendicular to the hair
segment. For further details see
"Artistic Simulation of Curly Hair" (Pixar technical memo #12-03a)
or
"A Mass Spring Model for Hair Simulation" (Selle, Lentine, Fedkiw 2008)

Currently the implementation uses a single root frame that is not yet
propagated along the hair, so the resulting rest shape is not very
natural. Also damping and derivatives are still missing.
2014-09-19 11:15:16 +02:00
33cee269da Custom color for SSAO 2014-09-18 21:40:45 +02:00
ce9fb0e997 Do not calculate SSAO on the background. Saves cycles on pixel shaders
as well as solves issue with SSAO artifacts around grids.
2014-09-18 21:20:46 +02:00
0416edaa6a Replace the dynamic root transform in the implicit solver data with a
single transform matrix.

Dynamic properties of the transformation are only needed during the
setup phase when they should be read from external data (hair system
roots) and generate fictitious forces on each point.
2014-09-18 19:42:20 +02:00
6b94a91827 More scons fixes for physics lib. 2014-09-18 11:27:34 +02:00
af484ae58e Merge branch 'master' into hair_immediate_fixes 2014-09-18 11:04:05 +02:00
2ed8ff0f02 Fixed scons build files for new physics subfolder. 2014-09-18 10:35:26 +02:00
3b4dd79db9 Disabled the velocity filtering feature for now, since the weighting is
incorrect.

The voxel grid needs better tool support to make it usable, so fixing
the filtering is not high priority right now.
2014-09-18 09:24:31 +02:00
41a71918bb Added basic filtering feature for velocity smoothing.
This is part of the original method from "Volumetric Methods for
Simulation and Rendering of Hair". The current filter is a simple box
filter. Other energy-preserving filters such as gaussian filtering
can be implemented later.

The filter size is currently given as a cell count. This is not ideal,
rather it should use a geometrical length value, but this is too
abstract for proper artistical use. Eventually defining the whole grid
in terms of spatial size might work better (possibly using an external
object).
2014-09-18 09:06:25 +02:00
dc1e92f16d Made the voxel grid size for hair interaction configurable and increased
the default to 32.
2014-09-17 14:21:06 +02:00
7334e9de91 Reduced the length threshold for disabling short hairs from 0.1 to 0.01. 2014-09-17 13:49:10 +02:00
b963bddd01 Fix for rB71271bb, was replacing the force vectors entirely instead of
adding.
2014-09-17 11:34:39 +02:00
71271bb0c7 Fix for effector force fields on hair, using the world-to-root
transformation.
2014-09-17 11:01:23 +02:00
ea6c0355f6 Add weak repulsion forces to hair collision response to keep the hair
at a the margin distance ("outer" softbody margin).

This has to be clamped arbitrarily unfortunately, otherwise the
repulsion force can add too much energy into the system. A factor of
4 * restitution impulse seems to give good results for now, this can
be refined later on if necessary.
2014-09-17 10:11:03 +02:00
81a3a364b5 fix issue with scons 2014-09-16 23:56:45 +02:00
7d3ddcac28 Added back the velocity smoothing implementation.
This is now also decoupled from the internal solver data. The grid is
created as an opaque structure, filled with vertex or collider data
(todo), and then forces can be calculated by interpolating the grid at
random locations. These forces and derivatives are then fed into the
solver.
2014-09-16 20:44:25 +02:00
c56cf0b887 WIP, beginning of renderer system that should take care of sorting
materials properly for rendering.

-Need to check aspect system first before going too much into this-
2014-09-16 19:07:56 +02:00
827ad6075d Hook up flags to request a specific sorting scheme from GPU buffer setup
routines. (still inactive
)
2014-09-16 18:30:38 +02:00
1e65bf5824 Fix for Sintel hair bug.
The hair solver needs sane input to converge within reasonable time
steps. In particular the spring lengths must not be too difference
(factor 0.01..100 or so max, this is comparable to rigid body simulation
of vastly different masses, which is also unstable).

The basic hair system generate strands with equally spaced points, which
is good solver material. However, the hair edit operators, specifically
the cutting tool, can move points along the strands, creating tightly
packed hair points. This puts the solver under enormous stress and
causes the "explosions" observed already during the Sintel project.

The simple solution for now is to exclude very short hairs from the
simulation. Later the cutting tool should be modified such that it
keeps the segments roughly at the same length and throws away vertices
when the hair gets too short (same goes for the extension tool).

The hair system should have a general mechanism for making sure that
situations such as this don't occur. This will have to be a design
consideration for replacements in any future hair system.
2014-09-16 14:36:56 +02:00
d1ed35480e Fix issue with sculpting and SSAO.
We need to enable stenciling on the compositing FBO or we can clear
areas we don't want to clear and cause invalid depth values.
2014-09-16 14:09:21 +02:00
829addcff0 Restore texture coordinates properly 2014-09-16 11:25:05 +02:00
313b568f92 Merge branch 'master' into viewport_experiments 2014-09-16 10:26:34 +02:00
3a0d276c55 Fix for flickering, recreate the framebuffer textures in that case
(looks like it's the only way to have matching per pixel results too)
2014-09-15 20:32:49 +02:00
acdaf71bbe Move GPU compositing to its own file.
Also avoid recreating the framebuffers and gpu/color textures each
frame.

Happiness :)

There are still some glithes when scaling the areas, I'll look at those
next.
2014-09-15 20:06:34 +02:00
fd388925c7 Minor fix when gravity code is disabled. 2014-09-15 17:41:53 +02:00
21f43fb13c SSAO
* Expose attenuation value - allows to change influence of far objects
* Change influence of far objects to quadratic, eliminates some extreme
fringing from far occluding surfaces.
2014-09-15 16:55:05 +02:00
2632c1308f SSAO shader.
This works by using the calculated view space normal and accumulating
coverage of a certain area by nearby pixels. There are two sliders to
control the effect:

* Scale controls the area around each pixel that the shader "collides"
against
* Darkening scales the occlusion effect.

The effect works, but due to the way the normals are calculated, the
normals are never smooth shaded (that would require a separate render
target to store them) and the edges or polygons can be too apparent.
This is not really fixable at the moment unless we move to deferred
pipeline.

The FX system is stll not well optimized and rendering does not always
work correctly, but it's good to have this out for people to play with.
2014-09-15 16:12:01 +02:00
624c99523e Removed unused code. 2014-09-15 14:22:36 +02:00
28f173b3e7 Added a calculation function for the fictitious forces introduced by
moving hair root reference frames.

This calculates Euler, Coriolis and Centrifugal forces which result
from describing hair in a moving reference frame.
http://en.wikipedia.org/wiki/Fictitious_force
2014-09-15 14:18:40 +02:00
e2e49b9a11 Fix for own misconception of fictitious forces in the moving hair root
frames.

These forces don't have to be calculated for each individual
contribution. Rather they can be split off and be calculated on top of
the basic force vector rotation (todo).
2014-09-15 12:51:18 +02:00
68275a412d Added back spring force definitions outside the implicit solver.
There are currently 3 types of springs: basic linear springs, goal
springs toward a fixed global target (not recommended, but works) and
bending springs.

These are agnostic to the specific spring definition in the cloth system
so hair systems can use the same API without converting everything to
cloth first.
2014-09-15 12:10:49 +02:00
ffb8b18074 Main cloth force calculation function outside of implicit core code.
Still misses spring forces.
2014-09-14 19:36:33 +02:00
6288a2d928 Hair volume calculation is now in its own file.
Code is currently disabled until the other main forces are in place.
2014-09-14 18:08:14 +02:00
5f0436838f Moved the unused goal force calculation function to the main mass-spring
source file.
2014-09-14 17:47:22 +02:00
d0337e0098 Moved most of the main cloth solver function out of implicit code core.
Force calculation is disabled, will follow shortly.
2014-09-14 17:36:53 +02:00
c5cb46fb27 Moved init/free functions for solver data out of implicit core.
This also initializes spring matrix indices (off-diagonal 3x3 blocks),
which now uses a new API function.
2014-09-14 14:16:03 +02:00
4da2c8498f Moved "set_positions" for cloth out of core implicit solver.
API for the solver now has functions for setting of vertex motion state
and the associated root transform data.
2014-09-14 13:23:14 +02:00
fe135d3550 Renamed functions to make them explicitly refer to cloth, and split the
create/free functions for solver data off from the cloth solver.
2014-09-13 18:45:58 +02:00
6978d15595 Moved the cloth solver code into a new subfolder/library inside Blender
code.

The implicit solver itself should remain agnostic to the specifics of
the Blender data (cloth vs. hair). This way we could avoid the bloated
data conversion chain from particles/hair to derived mesh to cloth
modifier to implicit solver data and back. Every step in this chain adds
overhead as well as rounding errors and a possibility for bugs, not to
speak of making the code horribly complicated.

The new subfolder is named "physics" since it should be the start of a
somewhat "unified" physics systems combining all the various solvers in
the same place and managing things like synchronized time steps.
2014-09-13 14:36:46 +02:00
33722d4011 Greatly improved normal calculation using view space position
derivatives.
2014-09-12 19:56:56 +02:00
9e2efd68e1 Framebuffer FX.
This commit introduces offscreen rendering for the 3D viewport.
There is test code that calculates depth and normal data
in screen space.

Currently just DOF is supported with a few parameters to control the
effect

This code recreates the framebuffer and texture objects every frame
which will make it -slow-. Use at your own risk.
2014-09-12 18:04:55 +02:00
1ecdfe22a6 Desperate attempt to get stable collisions: Disable restitution and
handle only one collision contact at a time.

Collision still randomly explodes, even with differing results on the
same file. This could indicate a threading issue, possibly also related
to the dependency graph since multiple objects are involved in
collisions.
2014-09-12 16:46:47 +02:00
9bae16453c Revert "Ignore velocity changes when the cloth solver does not converge."
This reverts commit c52b8ae818.

Sadly, at this point solver convergence is an exception rather than the
rule... Individual hairs can "explode" easily and thus disable the whole
simulation, which isn't helpful either.
2014-09-12 15:48:59 +02:00
c52b8ae818 Ignore velocity changes when the cloth solver does not converge.
This helps keep the simulation stable as long as there are only a few
substeps that become too constrained for the solver.

Eventually we need better feedback about these solver results, so that
artists can tweak situations specifically to resolve bad solver results.
This is somewhat similar to the camera tracker, which also can run into
cases that cannot be resolved and have to be fixed manually.
2014-09-12 15:02:37 +02:00
73235b3c61 Moved collision response into the main cloth sim source file and fixed
some coordinate transform issues.

Collision response should be regarded as part of the dynamics system
instead of the basic collision detection.
2014-09-12 14:34:14 +02:00
fcdcb8c818 Correction for inverse constraint matrix rotation. 2014-09-12 12:37:49 +02:00
9959cce4b6 Transform the constraint matrix and target solver vector z according to
the root frame transforms as well.

This ensures the hair constraints are actually in root space and applied
correctly by the solver.
2014-09-12 12:30:13 +02:00
efd1414d90 Use identity transform in the solver data roots to avoid possible errors
when this data is used outside the transform functions.
2014-09-12 12:28:56 +02:00
4ef085fe99 Option for disabling the root frame transformation altogether, mostly
for testing.
2014-09-12 11:22:39 +02:00
7d21e08de6 Ported root frame transformation to the old cloth solver. 2014-09-12 10:26:43 +02:00
8808289236 Switched back to the old solver for the time being.
The Eigen solver is not quite stable currently (possibly due to
incorrect porting of force calculations). It also still lacks threading
support and optimized matrix construction, making it slower in
comparison. Eventually would still like to switch, but fixing these
issues takes time.
2014-09-12 10:21:31 +02:00
26e8ebf5e2 Implemented gradient transformation for forces in the root frame (dFdX,
dFdV).
2014-09-12 10:19:41 +02:00
5e35f07ad1 Removed unused variable. 2014-09-11 18:32:26 +02:00
5ba680aa4e First stage of implementing moving frames of reference for hair/cloth.
This adds transformations for each hair from world to "root space".
Currently positions and velocities are simply transformed for the solver
data and inverse-transformed when copying the results back to the cloth
data. This way the hair movement becomes independent from the movement
of the emitter object. Eventually the "fictitious" forces originating
from emitter movement can be added back in a controlled way.

http://en.wikipedia.org/wiki/Fictitious_force

Ignoring these fictitious forces or scaling their effect is physically
correct, because in the absence of external forces the hair will always
return to rest position in this root frame.

External forces currently are not yet transformed into the root space.
2014-09-11 17:53:25 +02:00
330f5f1395 Disable some debugging options in Eigen to make it more usable in Debug
mode.

Eigen can become very slow in debug mode, which is a bit of a problem.
It relies heavily on compiler optimizations to remove function calls
etc. More optimizations may be desirable, possibly putting the implicit
solver into its own little library and enabling optimizations in debug
mode there could help.
2014-09-11 17:49:26 +02:00
6cd7d8f0ec Added new data in the cloth modifier for hair root information.
This will allow us to implement moving reference frames for hair and
make "fictitious" forces optional, aiding in creating stable and
controllable hair systems.

Adding data in this place is a nasty hack, but it's too difficult to
encode as a DM data layer and the whole cloth modifier/DM intermediate
data copying for hair should be removed anyway.
2014-09-11 14:19:52 +02:00
f503262eef Cleanup, removed unused old code. 2014-09-11 14:15:00 +02:00
a56baae7ce Optimized matrix filling using the Eigen triplets method.
Otherwise the construction of matrices becomes very slow for larger
vertex counts because adding a new element is O(n), making it O(n^2) in
total.
2014-09-11 11:14:11 +02:00
1f383436c7 Added back external effector forces for the cloth solver. 2014-09-10 23:11:56 +02:00
cbe66e6d82 Reenabled goal springs and removed the arbitrary structural scaling
factor.
2014-09-10 21:06:01 +02:00
ccf98b9faa Fixed bending forces for cloth springs. 2014-09-10 19:14:38 +02:00
0066cd1671 Correctly implemented and verified gravity, drag, structural springs. 2014-09-10 18:55:15 +02:00
e308e99208 Minor fix in debug print, so solver prints can be diff'ed. 2014-09-10 17:10:14 +02:00
b6f3db98c0 A couple of defines to disable various influences on the cloth sim for
debugging.
2014-09-10 16:59:22 +02:00
f235da9b53 Debug printing code for large sparse vectors and matrices, to compare
solver input/output of the old and new methods.
2014-09-10 16:04:31 +02:00
3871ec3d59 Added a new internal header for implicit solver defines.
Should become its own intern wrapper library eventually.
2014-09-10 14:30:55 +02:00
0335d92d84 Reenabled air drag force for cloth sim. 2014-09-09 12:36:49 +02:00
dfba467861 Arbitrary scaling factor for the structural spring forces (stretching).
This is not nice at all, but for some reason (possibly time scale) the
old force values are much too high and cause the solver to become
unstable. These will be revisited later anyway, so for now such scaling
should be fine.
2014-09-09 12:01:10 +02:00
4b9771a7cb Switched to the modified CG method that supports constraints, and
added back structural stretch springs.
2014-09-08 19:03:39 +02:00
084c6de309 Implemented a modifier conjugate gradient algorithm to support stable
constraining.

The algorithm is described in the paper "Large Steps in Cloth Simulation"
(Baraff/Witkin 1998). The same method was (incorrectly) implemented in
the old cloth solver.

It is based on restricting the degrees of freedom (ndof) of vertices
using a block matrix and a vector of target velocity deltas.
See chapter 5 of the paper for details.
2014-09-08 12:31:53 +02:00
e189fc0eeb Reimplemented Goal springs for the Eigen CG solver method.
Note that goal springs currently are really bad ... They have a factor
on hairs that "fades" goal influence from the root to the tip. The last
point on the hair is completely free, which makes the goal springs
pretty much useless on their own without supporting bend stiffness.
Can only assume this was added to compensate unphysical behavior of
goal springs when using uniform weight, but it's a poor replacement for
true localized bending forces ...
2014-09-05 17:07:30 +02:00
4535a9d926 To make gravity a true force vector, multiply by the mass. 2014-09-05 13:02:20 +02:00
854600aeed Alternative new solver for cloth using the Eigen CG solver instead of
a custom built solver.

The old cloth solver is broken unfortunately. Eigen is a designated
linear algebra library and very likely their implementation is a lot
better (can't compare until it's implemented though).

Only basic gravity is active atm, spring forces, external force fields,
damping and volumetric friction have to be added back by converting
the data into the Eigen format.
2014-09-05 12:48:49 +02:00
f3be91c2d8 Don't try to enforce a velocity change for pinned vertices; their
velocity is defined externally by hair root motion.
2014-09-04 19:58:17 +02:00
c4e00b15c7 Use squareroot of the current epsilon error target for CG, since we
square this value anyway.
2014-09-04 19:57:21 +02:00
f5efcfd3a7 WIP for overlay under sequencer strip view. 2014-09-04 19:51:17 +02:00
21e141406f Fix cancelling trim not refreshing the view 2014-09-04 17:43:55 +02:00
603392e587 Allow trimming scenes as well. 2014-09-04 15:51:55 +02:00
b39b70a615 Trim tool
* Support slow trimming with shift
* Give feedback on how many frames the input was trimmed
2014-09-04 15:36:41 +02:00
d2ece0d29b Disabled collision culling on the inside of the collider faces for now,
this seems to remove too many contact points somehow ...
2014-09-04 15:06:15 +02:00
6346a50405 Fix for collision response, the impulse response was far too small. 2014-09-04 15:05:12 +02:00
9faf2408fb Use the S matrix of the modifier CG algorithm for implementing collision
responses.

The S matrix together with the z Vector encodes the degrees of freedom
of a colliding hair point and the target velocity change. In a collision
the hair vertex is restricted in the normal direction (when moving
toward the collider) and the collision dynamics define target velocity.
2014-09-04 14:22:22 +02:00
010a52ff3c Better contact point near-test for hair.
This simply uses the position above the triangle instead of the
intersection point of the vertex path. The other method was broken
anyway, but also has a problem catching all the contacts reliably. The
new method might have a few false positives but that is acceptable.
2014-09-04 14:19:05 +02:00
ecf25938d0 Force refresh when trimming. 2014-09-04 12:55:24 +02:00
3d64c3530b Trim operator, accessible through T key, also in Strip menu. It moves
the contents of the strip around.

Only tested with movie strips now, metastrips won't work. Also there
might be some lingering bugs. Sonetimes refresh is needed to get
contents showing up correctly.
2014-09-04 12:50:17 +02:00
43b115ff1a Fixed for hair collision detection, old/new positions were swapped. 2014-09-04 10:34:32 +02:00
dd4504e895 Reduced minimum for cloth solver substeps to 1.
This is not very useful for artists, but helps with debugging.
2014-09-04 09:45:45 +02:00
5efd4b5552 Removed own debug print. 2014-09-04 09:32:01 +02:00
302d912732 Added a comment and use the new CG solver as the "official" version now. 2014-09-04 09:26:40 +02:00
4599123f8f Fixed implementation of the Conjugate Gradient method for the cloth
solver that properly supports constraints with some degrees-of-freedom.

The previous solver implementation only used the S matrix (constraint
filter matrix) for pinning vertices, in which case all elements are
zero and the error doesn't show up. With partial constraints (useful for
collision contacts) the matrix has non-zero off-diagonal elements and
the algorithm easily diverges.

There are also initial steps for implementing collision prevention as
described in the Baraff/Witkin paper "Large Steps in Cloth Simulation"
(http://www.cs.cmu.edu/~baraff/papers/sig98.pdf).
2014-09-03 23:49:24 +02:00
92bda4dd6b Hair collision: Use the S matrix for enforcing contact constraints.
This is a first test, the contacts are very explosive atm because they
basically pin hair vertices globally on collision, which leads to
stretching of the springs which is then suddenly released in the next
frame.
2014-09-03 17:12:17 +02:00
458fcfd4c4 Minor corrections:
* Add some comments to better describe what some numbers mean
* Fix cuddliness and parent position of strips
2014-09-03 16:47:31 +02:00
0796c1005e Preparation for collision code fixing.
Instead of handling contact tests and collision response in the same
function in collision.c, first generate contact points and return them
as a list, then free at the end of the stepping function. This way the
contact response can be integrated into the conjugate gradient method
properly instead of using the hackish and unstable double evaluation
that is currently used.
2014-09-03 15:44:03 +02:00
cfea750197 Cleanup: added some comments to the members of Implicit_Data. 2014-09-03 13:43:37 +02:00
509d516517 Merge branch 'master' into terrible_consequencer 2014-09-03 12:27:53 +02:00
087727366c Cleanup: No point in passing all the implicit solver arguments
individually.
2014-09-03 11:45:20 +02:00
570eb7f69b Cleanup: removed the unused olddV vectors from implicit solver data. 2014-09-03 11:34:40 +02:00
e167f9c9aa Revert "Gooseberry feature request, allow select left-right strips
operator to select all"

This change has been in master all the time after all, exposed the
operation better in master.

This reverts commit 799f974668.
2014-09-03 11:21:20 +02:00
3eed8933bd Some more debug elements for hair collisions. 2014-09-03 11:20:32 +02:00
b3a28d8334 Extended line/face collision near-check, to allow for distance margins.
The original BLI method for line/triangle intersection returns false
in case the line does not actually intersect, but in order to generate
repulsion forces we need to also handle contacts inside the margin.
2014-09-03 11:17:24 +02:00
799f974668 Gooseberry feature request, allow select left-right strips operator to
select all strips independently of channel of the active strip.
2014-09-02 19:23:56 +02:00
60a17cca27 Fix crash when setting parent. 2014-09-02 18:20:10 +02:00
cb1730d180 Merge branch 'master' into terrible_consequencer 2014-09-02 18:03:39 +02:00
7c0be7b2b1 Fix bounce/repulse calculation. 2014-09-02 15:03:15 +02:00
b23828f37f Hair debugging: use "categories" (strings) for grouping debug elements
and support clearing for categories.
2014-09-02 14:10:28 +02:00
5c1d565170 Fix for hair collision detection: need to use the second point of the
timestep segment.

This ensures the distance for a collision pair is the one of the current
point position, and the response gets calculated accordingly.
2014-09-02 12:49:55 +02:00
268d356fe2 Use repulsion forces in combination with the one-time penalty forces
in collision.
2014-09-01 18:49:53 +02:00
54832f1a19 Fix for crash when going into particle edit mode with baked hair
simulation.

Note that this currently generates an extreme amount of points, by
making a edit pathcache curve for each hair in every frame! But at least
doesn't simply crash now.
2014-09-01 18:47:27 +02:00
22245d0e04 Clear debug_data pointer in local cloth modifier data of the particle
systems on blend file load.
2014-09-01 18:46:32 +02:00
3a77ea644e Partial response force for hair collisions.
This implements a penalty force as well as a repulsion force to avoid
further penetration, as suggested in
"Simulating Complex Hair with Robust Collision Handling"
(http://graphics.snu.ac.kr/publications/2005-choe-HairSim/Choe_2005_SCA.pdf)

Friction forces are still missing. More problematic is handling of
moving colliders, when face swap places with the hair vertex and a
collision is missed, putting the vertex inside the mesh volume. Larger
margins might help, but ultimately using Bullet collision detection is
probably more reliable and failsafe.
2014-09-01 17:46:17 +02:00
1cce769d9a Merge branch 'master' into terrible_consequencer 2014-09-01 15:51:49 +02:00
670ee4c105 Debug drawing for simulations, to aid in visualizing abstract data such
as forces, velocities, contact points etc.

This uses a hash table to store debug elements (dots, lines, vectors at
this point). The hash table allows continuous display of elements that
are generated only in certain time steps, e.g. contact points, while
avoiding massive memory allocation. In any case, this system is really
a development feature, but very helpful in finding issues with the
internal solver data.
2014-08-30 17:54:36 +02:00
881e2f879a Some initial collision code, without actual response forces still.
This is still using the old BVH tree collision methods to generate
contact points, similar to what cloth does. This should be replaced
by a Bullet collision check, but generating contacts in this way is
easier for now, and lets us test responses and stability (although in
more complex collision cases the BVH method fails utterly, beside being
terribly inefficient with many colliders).
2014-08-30 15:23:40 +02:00
69f6ca664e Merge branch 'master' into hair_immediate_fixes 2014-08-29 17:06:21 +02:00
42a02c61e8 Implemented internal hair pressure to prevent hair from collapsing in
on itself.

This uses the same voxel structure as the hair smoothing algorithm.
A slightly different method was suggested in the original paper
(Volumetric Methods for Simulation and Rendering of Hair), but this is
based on directing hair based on a target density, which is another
way of implementing global goals. Our own approach is to define a
pressure threshold above which the hair is repelled in the density
gradient direction to simulate internal pressure from collisions.
2014-08-28 14:55:55 +02:00
e7e21950e7 Fixed hair velocity smoothing.
This is an important hair interaction feature that simulates friction
between hairs in an efficient way. The method is based on the paper
"Volumetric Methods for Simulation and Rendering of Hair"
( http://graphics.pixar.com/library/Hair/paper.pdf )

It was partially implemented already, but didn't work in this simplified
version. The same voxel structure can be used for implemeting repelling
forces on hair based on density, which can help a hair system maintain
volume instead of collapsing in on itself.
2014-08-27 18:12:51 +02:00
bd1c73636e Support for various data properties of the hair grid in the voxel
texture.
2014-08-27 14:11:49 +02:00
93d8e94598 Fixed voxel grid initialization from hair points and colliders by using
the suggested tent function from the original paper.

Plain float->int conversion for the grid location otherwise leads to
skewed data and unnecessary loss of information.
2014-08-27 12:33:39 +02:00
5d87f52a7a New voxel texture mode "Hair", for displaying the internal hair volume
structure as a texture.

This is mostly a debugging feature that may be removed again later.
2014-08-27 12:33:39 +02:00
a5be383c69 Code cleanup: Use a variable-sized array for the hair volume velocity
smoothing and collision code, split into multiple functions.
2014-08-27 12:33:39 +02:00
ab4da07b76 Add simple code to add (ctrl-P) and display parents. (WIP)
This is not a serious attempt though and possibly a good solution should
go through a dependency graph. Also there are some crashes on undo.
2014-08-15 16:58:30 +02:00
cb5b088410 Merge branch 'master' into terrible_consequencer 2014-08-13 20:48:33 +02:00
8ecb39a555 Fix cuddly strips shading and drawing issues. Also now there are no
issues on big zooms (they behave really cuddly)
2014-08-05 16:32:21 +02:00
ff66e9f929 Cuddlification of strips complete. Still need to make corners shrink on big zoom 2014-08-05 12:34:36 +02:00
4af1346a80 Strip drawing : Remove handle square, triangle is enough indicator here.
Also add cuddly outline
2014-08-04 22:47:42 +02:00
526 changed files with 50967 additions and 3669 deletions

View File

@@ -222,6 +222,8 @@ option(WITH_GAMEENGINE "Enable Game Engine" ${_init_GAMEENGINE})
option(WITH_PLAYER "Build Player" OFF)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
option(WITH_OPENVDB "Enable features relying on OpenVDB" OFF)
option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enble if OpenVDB was built with blosc support" OFF)
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
@@ -275,6 +277,10 @@ option(WITH_MOD_REMESH "Enable Remesh Modifier" ON)
# mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
option(WITH_MOD_OCEANSIM "Enable Ocean Modifier" OFF)
# Alembic
option(WITH_ALEMBIC "Enable Alembic Support" OFF)
option(WITH_HDF5 "Enable HDF5 Support for Alembic" OFF)
# Image format support
option(WITH_OPENIMAGEIO "Enable OpenImageIO Support (http://www.openimageio.org)" ON)
option(WITH_IMAGE_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ${_init_IMAGE_OPENEXR})
@@ -639,17 +645,23 @@ if(NOT WITH_BOOST)
set_and_warn(WITH_CYCLES OFF)
set_and_warn(WITH_AUDASPACE OFF)
set_and_warn(WITH_ALEMBIC OFF)
set_and_warn(WITH_INTERNATIONAL OFF)
set_and_warn(WITH_OPENAL OFF) # depends on AUDASPACE
set_and_warn(WITH_GAMEENGINE OFF) # depends on AUDASPACE
elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL)
elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_ALEMBIC OR WITH_INTERNATIONAL)
# Keep enabled
else()
# Enabled but we don't need it
set(WITH_BOOST OFF)
endif()
# disable hdf5 if Alembic is disabled
if(NOT WITH_ALEMBIC)
set(WITH_HDF5 OFF)
endif()
# auto enable openimageio for cycles
if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
@@ -982,6 +994,24 @@ if(UNIX AND NOT APPLE)
endif()
endif()
if(WITH_OPENVDB)
find_package_wrapper(OpenVDB)
set(TBB ${LIBDIR}/tbb)
set(TBB_LIBRARIES tbb)
set(TBB_LIBPATH ${TBB}/lib)
set(OPENVDB_LIBRARIES ${OPENVDB_LIBRARIES} ${BOOST_LIBRARIES} ${ZLIB_LIBRARIES} ${TBB_LIBRARIES})
set(OPENVDB_LIBPATH) # TODO, remove and reference the absolute path everywhere
set(OPENVDB_DEFINITIONS)
if(NOT OPENVDB_FOUND)
set(WITH_OPENVDB OFF)
set(WITH_OPENVDB_BLOSC OFF)
message(STATUS "OpenVDB not found")
endif()
endif()
if(WITH_BOOST)
# uses in build instructions to override include and library variables
if(NOT BOOST_CUSTOM)
@@ -1002,6 +1032,9 @@ if(UNIX AND NOT APPLE)
if(WITH_CYCLES_NETWORK)
list(APPEND __boost_packages serialization)
endif()
if(WITH_OPENVDB)
list(APPEND __boost_packages iostreams)
endif()
find_package(Boost 1.48 COMPONENTS ${__boost_packages})
if(NOT Boost_FOUND)
# try to find non-multithreaded if -mt not found, this flag
@@ -1076,6 +1109,19 @@ if(UNIX AND NOT APPLE)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--version-script='${CMAKE_SOURCE_DIR}/source/creator/blender.map'")
endif()
if(WITH_ALEMBIC)
find_package_wrapper(Alembic)
set(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARIES} ${BOOST_LIBRARIES})
if(NOT ALEMBIC_HDF5_FOUND AND WITH_HDF5)
message(STATUS "Alembic is compiled without HDF5 support, disabling HDF5 options")
set(WITH_HDF5 OFF)
endif()
endif()
if(WITH_HDF5)
find_package_wrapper(HDF5)
endif()
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm)
@@ -1483,7 +1529,15 @@ elseif(WIN32)
set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib)
set(OPENCOLORIO_DEFINITIONS)
endif()
if(WITH_OPENVDB)
set(OPENVDB ${LIBDIR}/openvdb)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
set(OPENVDB_DEFINITIONS)
add_definitions(-DOPENVDB_USE_BLOSC)
endif()
if(WITH_MOD_CLOTH_ELTOPO)
set(LAPACK ${LIBDIR}/lapack)
@@ -1739,6 +1793,14 @@ elseif(WIN32)
set(SDL_LIBPATH ${SDL}/lib)
endif()
if(WITH_OPENVDB)
set(OPENVDB ${LIBDIR}/openvdb)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
set(OPENVDB_DEFINITIONS)
endif()
set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
## DISABLE - causes linking errors
@@ -2033,6 +2095,14 @@ elseif(APPLE)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
endif()
if(WITH_OPENVDB)
set(OPENVDB ${LIBDIR}/openvdb)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
set(OPENVDB_DEFINITIONS)
endif()
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
set(LLVM_VERSION "3.4" CACHE STRING "Version of LLVM to use")
@@ -2162,6 +2232,12 @@ if(WITH_CYCLES)
endif()
endif()
if(WITH_ALEMBIC)
if(NOT WITH_BOOST)
message(FATAL_ERROR "Alembic requires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_ALEMBIC")
endif()
endif()
if(WITH_INTERNATIONAL)
if(NOT WITH_BOOST)
message(FATAL_ERROR "Internationalization requires WITH_BOOST, the library may not have been found. Configure BOOST or disable WITH_INTERNATIONAL")
@@ -2795,6 +2871,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_OPENCOLORIO)
info_cfg_option(WITH_OPENVDB)
info_cfg_text("Compiler Options:")
info_cfg_option(WITH_BUILDINFO)

View File

@@ -270,6 +270,7 @@ if 'blenderlite' in B.targets:
target_env_defs['WITH_BF_3DMOUSE'] = False
target_env_defs['WITH_BF_LIBMV'] = False
target_env_defs['WITH_BF_FREESTYLE'] = False
target_env_defs['WITH_BF_OPENVDB'] = False
# Merge blenderlite, let command line to override
for k,v in target_env_defs.iteritems():
@@ -817,6 +818,13 @@ if B.targets != ['cudakernels']:
data_to_c_simple("release/datafiles/brushicons/fill.png")
data_to_c_simple("release/datafiles/brushicons/flatten.png")
data_to_c_simple("release/datafiles/brushicons/grab.png")
data_to_c_simple("release/datafiles/brushicons/hairadd.png")
data_to_c_simple("release/datafiles/brushicons/haircomb.png")
data_to_c_simple("release/datafiles/brushicons/haircut.png")
data_to_c_simple("release/datafiles/brushicons/hairlength.png")
data_to_c_simple("release/datafiles/brushicons/hairpuff.png")
data_to_c_simple("release/datafiles/brushicons/hairsmooth.png")
data_to_c_simple("release/datafiles/brushicons/hairweight.png")
data_to_c_simple("release/datafiles/brushicons/inflate.png")
data_to_c_simple("release/datafiles/brushicons/layer.png")
data_to_c_simple("release/datafiles/brushicons/lighten.png")

View File

@@ -28,8 +28,8 @@ getopt \
--long source:,install:,tmp:,info:,threads:,help,no-sudo,with-all,with-opencollada,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,\
force-all,force-python,force-numpy,force-boost,force-ocio,force-oiio,force-llvm,force-osl,force-opencollada,\
force-ffmpeg,\
skip-python,skip-numpy,skip-boost,skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg,skip-opencollada,\
force-ffmpeg,force-alembic,\
skip-python,skip-numpy,skip-boost,skip-ocio,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-ffmpeg,skip-opencollada,skip-alembic,\
required-numpy: \
-- "$@" \
)
@@ -95,6 +95,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--with-opencollada
Build and install the OpenCOLLADA libraries.
--with-alembic
Build and install the Alembic library.
--ver-ocio=<ver>
Force version of OCIO library.
@@ -144,6 +147,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--force-ffmpeg
Force the rebuild of FFMpeg.
--force-alembic
Force the rebuild of Alembic.
Note about the --force-foo options:
* They obviously only have an effect if those libraries are built by this script
(i.e. if there is no available and satisfactory package)!
@@ -180,6 +186,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--skip-ffmpeg
Unconditionally skip FFMpeg installation/building.
--skip-alembic
Unconditionally skip Alembic installation/building.
--required-numpy
Use this in case your distro features a valid python package, but no matching Numpy one.
It will force compilation of both python and numpy\""
@@ -264,6 +273,11 @@ MP3LAME_DEV=""
OPENJPEG_USE=false
OPENJPEG_DEV=""
ALEMBIC_VERSION="1.5.5"
ALEMBIC_VERSION_MIN="1.5.5"
ALEMBIC_FORCE_REBUILD=false
ALEMBIC_SKIP=false
# Switch to english language, else some things (like check_package_DEB()) won't work!
LANG_BACK=$LANG
LANG=""
@@ -423,6 +437,9 @@ while true; do
--force-ffmpeg)
FFMPEG_FORCE_REBUILD=true; shift; continue
;;
--force-alembic)
ALEMBIC_FORCE_REBUILD=true; shift; continue
;;
--skip-python)
PYTHON_SKIP=true; shift; continue
;;
@@ -453,6 +470,9 @@ while true; do
--skip-ffmpeg)
FFMPEG_SKIP=true; shift; continue
;;
--skip-alembic)
ALEMBIC_SKIP=true; shift; continue
;;
--required-numpy)
NUMPY_REQUIRED=true; shift; continue
;;
@@ -513,6 +533,9 @@ OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
OPENCOLLADA_REPO_UID="3335ac164e68b2512a40914b14c74db260e6ff7d"
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
ALEMBIC_SOURCE=( "https://code.google.com/p/alembic/" )
ALEMBIC_REPO_UID=( "1_05_05" )
##### Generic Helpers #####
@@ -839,6 +862,7 @@ compile_Boost() {
# Rebuild dependecies as well!
OIIO_FORCE_REBUILD=true
OSL_FORCE_REBUILD=true
ALEMBIC_FORCE_REBUILD=true
prepare_opt
@@ -1706,6 +1730,165 @@ compile_FFmpeg() {
fi
}
#### Build ALEMBIC ####
_init_alembic() {
_src=$SRC/Alembic-$ALEMBIC_VERSION
_hg=false
_inst=$INST/alembic-$ALEMBIC_VERSION
_inst_shortcut=$INST/alembic
}
clean_alembic() {
_init_alembic
_clean
}
compile_alembic() {
# To be changed each time we make edits that would modify the compiled result!
alembic_magic=1
_init_alembic
# Clean install if needed!
magic_compile_check alembic-$ALEMBIC_VERSION $alembic_magic
if [ $? -eq 1 -o $ALEMBIC_FORCE_REBUILD == true ]; then
clean_alembic
fi
if [ ! -d $_inst ]; then
INFO "Building Alembic-$ALEMBIC_VERSION"
prepare_opt
if [ ! -d $_src ]; then
mkdir -p $SRC
hg clone -u $ALEMBIC_REPO_UID $ALEMBIC_SOURCE $_src
fi
cd $_src
# XXX Ugly patching hack!
# Alembice cmake files are erratic, to say the least
# have to manually disable a bunch of crap here
cat << EOF | patch -p1
--- a/CMakeLists.txt Mon Jul 28 10:09:21 2014 -0700
+++ b/CMakeLists.txt Thu Oct 16 15:03:27 2014 +0200
@@ -57,9 +57,9 @@
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} )
SET( VERSION ${PROJECT_VERSION} )
-SET( ALEMBIC_NO_TESTS FALSE )
-SET( ALEMBIC_NO_BOOTSTRAP FALSE )
-SET( ALEMBIC_NO_OPENGL FALSE )
+SET( ALEMBIC_NO_TESTS TRUE )
+SET( ALEMBIC_NO_BOOTSTRAP TRUE )
+SET( ALEMBIC_NO_OPENGL TRUE )
MESSAGE(STATUS "CMAKE SYSTEM NAME = ${CMAKE_SYSTEM_NAME}" )
@@ -306,15 +306,15 @@
ENDIF()
# Include PyAlembic stuff
-IF(DEFINED USE_PYALEMBIC AND NOT USE_PYALEMBIC)
- MESSAGE(STATUS "Skipping Alembic Python bindings")
-ELSE()
- MESSAGE(STATUS "About to include Python cmake files")
- ADD_SUBDIRECTORY( python )
-ENDIF()
+#IF(DEFINED USE_PYALEMBIC AND NOT USE_PYALEMBIC)
+# MESSAGE(STATUS "Skipping Alembic Python bindings")
+#ELSE()
+# MESSAGE(STATUS "About to include Python cmake files")
+# ADD_SUBDIRECTORY( python )
+#ENDIF()
# Example code not supported
-ADD_SUBDIRECTORY( examples )
+#ADD_SUBDIRECTORY( examples )
# Uncomment to build python docs Makefile (requires Sphinx)
# Run `make docs` from build root
EOF
cat << EOF | patch -p1
--- a/lib/Alembic/Util/CMakeLists.txt Mon Jul 28 10:09:21 2014 -0700
+++ b/lib/Alembic/Util/CMakeLists.txt Thu Oct 16 15:03:27 2014 +0200
@@ -65,7 +65,7 @@
DESTINATION include/Alembic/Util
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ )
-IF( NOT ALEMBIC_NO_TESTS )
- ADD_SUBDIRECTORY( Tests )
-ENDIF()
+#IF( NOT ALEMBIC_NO_TESTS )
+# ADD_SUBDIRECTORY( Tests )
+#ENDIF()
EOF
cat << EOF | patch -p1
--- a/python/CMakeLists.txt Mon Jul 28 10:09:21 2014 -0700
+++ b/python/CMakeLists.txt Thu Oct 16 14:20:25 2014 +0200
@@ -35,4 +35,4 @@
ADD_SUBDIRECTORY( PyAlembic )
ADD_SUBDIRECTORY( PyAbcOpenGL )
-ADD_SUBDIRECTORY( examples )
+#ADD_SUBDIRECTORY( examples )
EOF
# Always refresh the whole build!
# XXX 'build' directory is included in Alembic sources, don't touch that
if [ -d blender_build ]; then
rm -rf blender_build
fi
mkdir blender_build
cd blender_build
# XXX Alembic cmake doesn't take these as options
# XXX Alembic creates a subfolder itself ... rather than fix their
# stupid build files, just expect this here by using $INST as prefix
export ALEMBIC_INSTALL_PREFIX=$INST
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$INST"
cmake_d="$cmake_d -D BUILD_SHARED_LIBS=ON"
cmake_d="$cmake_d -D BUILD_STATIC_LIBS=ON"
cmake_d="$cmake_d -D USE_PYTHON=OFF"
cmake_d="$cmake_d -D USE_PYALEMBIC=OFF"
cmake_d="$cmakd_d -D ALEMBIC_PYTHON_INCLUDE_DIR=/use/include/python2.7" # XXX BAD
cmake_d="$cmakd_d -D ALEMBIC_PYTHON_LIBRARY=/use/lib/python2.7" # XXX BAD
cmake_d="$cmake_d -D USE_PYILMBASE=OFF"
cmake_d="$cmake_d -D ILMBASE_ROOT=$INST/openexr"
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_HALF_LIB=$INST/openexr/lib/libHalf.la"
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_IEX_LIB=$INST/openexr/lib/libIex-2_1.la"
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_ILMTHREAD_LIB=$INST/openexr/lib/libIlmThread-2_1.la"
cmake_d="$cmake_d -D ALEMBIC_ILMBASE_IMATH_LIB=$INST/openexr/lib/libImath-2_1.la"
cmake $cmake_d ../
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set alembic-$ALEMBIC_VERSION $alembic_magic
cd $CWD
INFO "Done compiling Alembic-$ALEMBIC_VERSION!"
else
INFO "Own Alembic-$ALEMBIC_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-alembic option."
fi
}
#### Install on DEB-like ####
get_package_version_DEB() {
@@ -1812,7 +1995,7 @@ install_DEB() {
OGG_DEV="libogg-dev"
THEORA_DEV="libtheora-dev"
_packages="gawk cmake cmake-curses-gui scons build-essential libjpeg-dev libpng-dev \
_packages="gawk cmake cmake-curses-gui scons mercurial build-essential libjpeg-dev libpng-dev \
libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \
libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
libopenal-dev libglew-dev libglewmx-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
@@ -1992,7 +2175,8 @@ install_DEB() {
if [ $? -eq 0 ]; then
install_packages_DEB libboost-locale$boost_version-dev libboost-filesystem$boost_version-dev \
libboost-regex$boost_version-dev libboost-system$boost_version-dev \
libboost-thread$boost_version-dev libboost-wave$boost_version-dev
libboost-thread$boost_version-dev libboost-python$boost_version-dev \
libboost-program-options$boost_version-dev libboost-wave$boost_version-dev
clean_Boost
else
compile_Boost
@@ -2125,6 +2309,14 @@ install_DEB() {
# fi
compile_FFmpeg
fi
if $ALEMBIC_SKIP; then
WARNING "Skipping Alembic installation, as requested..."
else
install_packages_DEB libhdf5-dev
install_packages_DEB libpython2.7-dev # XXX nasty hack, should be done better ...
compile_alembic
fi
}
@@ -3030,6 +3222,12 @@ print_info() {
fi
fi
if [ -d $INST/alembic ]; then
_1="-D ALEMBIC_ROOT_DIR=$INST/alembic"
PRINT " $_1"
_buildargs="$_buildargs $_1"
fi
PRINT ""
PRINT "Or even simpler, just run (in your blender-source dir):"
PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
@@ -3099,6 +3297,13 @@ print_info() {
PRINT "BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice `print_info_ffmpeglink`'"
fi
if [ "$ALEMBIC_SKIP" = false ]; then
PRINT "WITH_BF_ALEMBIC = True"
if [ -d $INST/alembic ]; then
PRINT "BF_ALEMBIC = '$INST/alembic'"
fi
fi
if [ "$WITH_ALL" = false ]; then
PRINT "WITH_BF_3DMOUSE = False"
# No libspacenav in official arch repos...

View File

@@ -2,4 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-i686'
BF_INSTALLDIR = '../blender-install/linux-glibc211-i686'
BF_NUMJOBS = 1
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
BF_CYCLES_CUDA_BINARIES_ARCH = []

View File

@@ -2,4 +2,4 @@ BF_BUILDDIR = '../blender-build/linux-glibc211-x86_64'
BF_INSTALLDIR = '../blender-install/linux-glibc211-x86_64'
BF_NUMJOBS = 1
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
BF_CYCLES_CUDA_BINARIES_ARCH = []

View File

@@ -157,15 +157,36 @@ WITH_BF_STATICBOOST = True
BF_BOOST = '/opt/lib/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
${BF_BOOST_LIBPATH}/libboost_thread.a'
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ' + \
'${BF_BOOST_LIBPATH}/libboost_thread.a'
if BF_IS_NEW_OSL:
BF_BOOST_LIB_STATIC += ' ${BF_BOOST_LIBPATH}/libboost_wave.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# OpenVDB
WITH_BF_OPENVDB = True
WITH_BF_STATICOPENVDB = True
BF_OPENVDB = '/opt/lib/openvdb'
BF_OPENVDB_INC = '${BF_OPENVDB}/include'
BF_OPENVDB_LIB_PATH = '${BF_OPENVDB}/lib'
BF_OPENVDB_LIB_STATIC = '${BF_OPENVDB}/lib/libopenvdb.a ${BF_BOOST_LIBPATH}/libboost_iostreams.a /opt/lib/tbb/lib/libtbb.a'
# Ocean Simulation
WITH_BF_OCEANSIM = True
# Alembic
WITH_BF_HDF5 = False
WITH_BF_ALEMBIC = True
WITH_BF_STATICALEMBIC = True
BF_ALEMBIC = '/opt/lib/alembic'
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
BF_ALEMBIC_LIBPATH = '${BF_ALEMBIC}/lib/static'
BF_ALEMBIC_LIB_STATIC = '${BF_ALEMBIC_LIBPATH}/libAlembicAbcGeom.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbc.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCollection.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreFactory.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcMaterial.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreAbstract.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicUtil.a'
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++

View File

@@ -157,15 +157,36 @@ WITH_BF_STATICBOOST = True
BF_BOOST = '/opt/lib/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBPATH}/libboost_date_time.a ' + \
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a \
${BF_BOOST_LIBPATH}/libboost_thread.a'
'${BF_BOOST_LIBPATH}/libboost_regex.a ${BF_BOOST_LIBPATH}/libboost_locale.a ${BF_BOOST_LIBPATH}/libboost_system.a ' + \
'${BF_BOOST_LIBPATH}/libboost_thread.a'
if BF_IS_NEW_OSL:
BF_BOOST_LIB_STATIC += ' ${BF_BOOST_LIBPATH}/libboost_wave.a'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
# OpenVDB
WITH_BF_OPENVDB = True
WITH_BF_STATICOPENVDB = True
BF_OPENVDB = '/opt/lib/openvdb'
BF_OPENVDB_INC = '${BF_OPENVDB}/include'
BF_OPENVDB_LIB_PATH = '${BF_OPENVDB}/lib'
BF_OPENVDB_LIB_STATIC = '${BF_OPENVDB}/lib/libopenvdb.a ${BF_BOOST_LIBPATH}/libboost_iostreams.a /opt/lib/tbb/lib/libtbb.a'
# Ocean Simulation
WITH_BF_OCEANSIM = True
# Alembic
WITH_BF_HDF5 = False
WITH_BF_ALEMBIC = True
WITH_BF_STATICALEMBIC = True
BF_ALEMBIC = '/opt/lib/alembic'
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
BF_ALEMBIC_LIBPATH = '${BF_ALEMBIC}/lib/static'
BF_ALEMBIC_LIB_STATIC = '${BF_ALEMBIC_LIBPATH}/libAlembicAbcGeom.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbc.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCollection.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreFactory.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcMaterial.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreAbstract.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicUtil.a'
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++

View File

@@ -120,6 +120,22 @@ WITH_BF_FFTW3 = True
WITH_BF_STATICFFTW3 = True
WITH_BF_OCEANSIM = True
# Alembic
WITH_BF_HDF5 = False
WITH_BF_ALEMBIC = True
WITH_BF_STATICALEMBIC = True
BF_ALEMBIC = '/opt/lib/alembic'
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
BF_ALEMBIC_LIBPATH = '${BF_ALEMBIC}/lib/static'
BF_ALEMBIC_LIB_STATIC = '${BF_ALEMBIC_LIBPATH}/libAlembicAbcGeom.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbc.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCollection.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreFactory.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcMaterial.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreAbstract.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicUtil.a'
# OpenVDB
WITH_BF_OPENVDB = False
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++

View File

@@ -120,6 +120,22 @@ WITH_BF_FFTW3 = True
WITH_BF_STATICFFTW3 = True
WITH_BF_OCEANSIM = True
# Alembic
WITH_BF_HDF5 = False
WITH_BF_ALEMBIC = True
WITH_BF_STATICALEMBIC = True
BF_ALEMBIC = '/opt/lib/alembic'
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
BF_ALEMBIC_LIBPATH = '${BF_ALEMBIC}/lib/static'
BF_ALEMBIC_LIB_STATIC = '${BF_ALEMBIC_LIBPATH}/libAlembicAbcGeom.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbc.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCollection.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreFactory.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcMaterial.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicOgawa.a ${BF_ALEMBIC_LIBPATH}/libAlembicAbcCoreAbstract.a ' + \
'${BF_ALEMBIC_LIBPATH}/libAlembicUtil.a'
# OpenVDB
WITH_BF_OPENVDB = False
# Compilation and optimization
BF_DEBUG = False
REL_CCFLAGS = ['-DNDEBUG', '-O2', '-msse', '-msse2'] # C & C++

View File

@@ -123,14 +123,26 @@ else:
os.remove(f)
retcode = subprocess.call(['cpack', '-G', 'ZIP'])
result_file = [f for f in os.listdir('.') if os.path.isfile(f) and f.endswith('.zip')][0]
os.rename(result_file, "{}.zip".format(builder))
# TODO(sergey): Such magic usually happens in SCon's packaging bu we don't have it
# in the CMake yet. For until then we do some magic here.
tokens = result_file.split('-')
blender_version = tokens[1].split('.')
blender_full_version = '.'.join(blender_version[0:2])
git_hash = tokens[2].split('.')[1]
platform = builder.split('_')[0]
builderified_name = 'blender-{}-{}-{}'.format(blender_full_version, git_hash, platform)
if branch != '':
builderified_name = branch + "-" + builderified_name
os.rename(result_file, "{}.zip".format(builderified_name))
# create zip file
try:
upload_zip = "buildbot_upload.zip"
if os.path.exists(upload_zip):
os.remove(upload_zip)
z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED)
z.write("{}.zip".format(builder))
z.write("{}.zip".format(builderified_name))
z.close()
sys.exit(retcode)
except Exception as ex:

View File

@@ -0,0 +1,103 @@
# - Find Alembic library
# Find the native Alembic includes and library
# This module defines
# ALEMBIC_INCLUDE_DIRS, where to find Alembic headers.
# ALEMBIC_LIBRARIES, libraries to link against to use Alembic.
# ALEMBIC_ROOT_DIR, The base directory to search for Alembic.
# This can also be an environment variable.
# ALEMBIC_FOUND, If false, do not try to use Alembic.
# ALEMBIC_HDF5_FOUND, indicates whether Alembic supports HDF5
#=============================================================================
# Copyright 2013 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If ALEMBIC_ROOT_DIR was defined in the environment, use it.
IF(NOT ALEMBIC_ROOT_DIR AND NOT $ENV{ALEMBIC_ROOT_DIR} STREQUAL "")
SET(ALEMBIC_ROOT_DIR $ENV{ALEMBIC_ROOT_DIR})
ENDIF()
SET(_alembic_SEARCH_DIRS
${ALEMBIC_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/alembic
)
SET(_alembic_FIND_COMPONENTS
AlembicAbc
AlembicAbcCoreAbstract
AlembicAbcGeom
AlembicAbcCoreOgawa
AlembicOgawa
AlembicUtil
)
FIND_PATH(ALEMBIC_INCLUDE_DIR
NAMES
Alembic/Abc/All.h
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
include
)
SET(_alembic_LIBRARIES)
FOREACH(COMPONENT ${_alembic_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
FIND_LIBRARY(ALEMBIC_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
lib
lib/static
)
MARK_AS_ADVANCED(ALEMBIC_${UPPERCOMPONENT}_LIBRARY)
LIST(APPEND _alembic_LIBRARIES "${ALEMBIC_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()
# Sepcial handling of optional libraries
FIND_LIBRARY(ALEMBIC_ALEMBICABCCOREHDF5_LIBRARY
NAMES
AlembicAbcCoreHDF5
HINTS
${_alembic_SEARCH_DIRS}
PATH_SUFFIXES
lib
lib/static
)
MARK_AS_ADVANCED(ALEMBIC_ALEMBICABCCOREHDF5_LIBRARY)
IF(ALEMBIC_ALEMBICABCCOREHDF5_LIBRARY)
LIST(APPEND _alembic_LIBRARIES "${ALEMBIC_ALEMBICABCCOREHDF5_LIBRARY}")
SET(ALEMBIC_HDF5_FOUND TRUE)
ELSE()
SET(ALEMBIC_HDF5_FOUND FALSE)
ENDIF()
# handle the QUIETLY and REQUIRED arguments and set ALEMBIC_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Alembic DEFAULT_MSG
_alembic_LIBRARIES ALEMBIC_INCLUDE_DIR)
IF(ALEMBIC_FOUND)
SET(ALEMBIC_LIBRARIES ${_alembic_LIBRARIES})
SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
ENDIF(ALEMBIC_FOUND)
MARK_AS_ADVANCED(
ALEMBIC_INCLUDE_DIR
ALEMBIC_LIBRARIES
)

View File

@@ -0,0 +1,75 @@
# - Find HDF5 library
# Find the native hdf5 includes and library
# This module defines
# HDF5_INCLUDE_DIRS, where to find hdf5 headers.
# HDF5_LIBRARIES, libraries to link against to use hdf5.
# HDF5_ROOT_DIR, The base directory to search for hdf5.
# This can also be an environment variable.
# HDF5_FOUND, If false, do not try to use hdf5.
#=============================================================================
# Copyright 2013 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If HDF5_ROOT_DIR was defined in the environment, use it.
IF(NOT HDF5_ROOT_DIR AND NOT $ENV{HDF5_ROOT_DIR} STREQUAL "")
SET(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR})
ENDIF()
SET(_hdf5_SEARCH_DIRS
${HDF5_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/hdf5
)
SET(_hdf5_FIND_COMPONENTS
hdf5
hdf5_hl
)
FIND_PATH(_hdf5_INCLUDE_DIRS
NAMES
hdf5.h
HINTS
${_hdf5_SEARCH_DIRS}
)
SET(_hdf5_LIBRARIES)
FOREACH(COMPONENT ${_hdf5_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
FIND_LIBRARY(HDF5_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_hdf5_SEARCH_DIRS}
)
MARK_AS_ADVANCED(HDF5_${UPPERCOMPONENT}_LIBRARY)
LIST(APPEND _hdf5_LIBRARIES "${HDF5_${UPPERCOMPONENT}_LIBRARY}")
ENDFOREACH()
# handle the QUIETLY and REQUIRED arguments and set HDF5_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(hdf5 DEFAULT_MSG
_hdf5_LIBRARIES _hdf5_INCLUDE_DIRS)
IF(HDF5_FOUND)
SET(HDF5_LIBRARIES ${_hdf5_LIBRARIES})
SET(HDF5_INCLUDE_DIRS ${_hdf5_INCLUDE_DIRS})
ENDIF(HDF5_FOUND)
MARK_AS_ADVANCED(
HDF5_INCLUDE_DIRS
HDF5_LIBRARIES
)

View File

@@ -0,0 +1,74 @@
# - Find OPENVDB library
# Find the native OPENVDB includes and library
# This module defines
# OPENVDB_INCLUDE_DIRS, where to find openvdb.h, Set when
# OPENVDB_INCLUDE_DIR is found.
# OPENVDB_LIBRARIES, libraries to link against to use OPENVDB.
# OPENVDB_ROOT_DIR, The base directory to search for OPENVDB.
# This can also be an environment variable.
# OPENVDB_FOUND, If false, do not try to use OPENVDB.
#
# also defined, but not for general use are
# OPENVDB_LIBRARY, where to find the OPENVDB library.
#=============================================================================
# Copyright 2015 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If OPENVDB_ROOT_DIR was defined in the environment, use it.
IF(NOT OPENVDB_ROOT_DIR AND NOT $ENV{OPENVDB_ROOT_DIR} STREQUAL "")
SET(OPENVDB_ROOT_DIR $ENV{OPENVDB_ROOT_DIR})
ENDIF()
SET(_openvdb_SEARCH_DIRS
${OPENVDB_ROOT_DIR}
/usr/local
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt/lib/openvdb
)
FIND_PATH(OPENVDB_INCLUDE_DIR
NAMES
openvdb/openvdb.h
HINTS
${_openvdb_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(OPENVDB_LIBRARY
NAMES
openvdb
HINTS
${_openvdb_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set OPENVDB_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENVDB DEFAULT_MSG
OPENVDB_LIBRARY
OPENVDB_INCLUDE_DIR)
IF(OPENVDB_FOUND)
SET(OPENVDB_LIBRARIES ${OPENVDB_LIBRARY})
SET(OPENVDB_INCLUDE_DIRS ${OPENVDB_INCLUDE_DIR})
ENDIF(OPENVDB_FOUND)
MARK_AS_ADVANCED(
OPENVDB_INCLUDE_DIR
OPENVDB_LIBRARY
)
UNSET(_openvdb_SEARCH_DIRS)

View File

@@ -60,3 +60,8 @@ if(APPLE)
set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
endif()
if(WIN32)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
else()
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
endif()

View File

@@ -48,6 +48,7 @@ set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENNL OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL OFF CACHE BOOL "" FORCE)
set(WITH_RAYOPTIMIZATION OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)

View File

@@ -31,3 +31,4 @@ set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
set(WITH_BULLET OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)

View File

@@ -265,6 +265,9 @@ function(SETUP_LIBDIRS)
if(WITH_OPENCOLORIO)
link_directories(${OPENCOLORIO_LIBPATH})
endif()
if(WITH_OPENVDB)
link_directories(${OPENVDB_LIBPATH})
endif()
if(WITH_IMAGE_OPENJPEG AND WITH_SYSTEM_OPENJPEG)
link_directories(${OPENJPEG_LIBPATH})
endif()
@@ -370,6 +373,9 @@ function(setup_liblinks
if(WITH_OPENCOLORIO)
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
endif()
if(WITH_OPENVDB)
target_link_libraries(${target} ${OPENVDB_LIBRARIES})
endif()
if(WITH_CYCLES_OSL)
target_link_libraries(${target} ${OSL_LIBRARIES})
endif()
@@ -436,6 +442,12 @@ function(setup_liblinks
if(WITH_LLVM)
target_link_libraries(${target} ${LLVM_LIBRARY})
endif()
if(WITH_ALEMBIC)
target_link_libraries(${target} ${ALEMBIC_LIBRARIES})
endif()
if(WITH_HDF5)
target_link_libraries(${target} ${HDF5_LIBRARIES})
endif()
if(WIN32 AND NOT UNIX)
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
endif()
@@ -515,6 +527,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
bf_editor_object
bf_editor_armature
bf_editor_physics
bf_editor_hair
bf_editor_render
bf_editor_screen
bf_editor_sculpt_paint
@@ -578,6 +591,8 @@ function(SETUP_BLENDER_SORTED_LIBS)
ge_videotex
bf_dna
bf_blenfont
bf_pointcache_alembic
bf_pointcache
bf_intern_audaspace
bf_intern_mikktspace
bf_intern_dualcon
@@ -673,6 +688,10 @@ function(SETUP_BLENDER_SORTED_LIBS)
list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet")
endif()
if(WITH_OPENVDB)
list(APPEND BLENDER_SORTED_LIBS bf_intern_openvdb)
endif()
foreach(SORTLIB ${BLENDER_SORTED_LIBS})
set(REMLIB ${SORTLIB})
foreach(SEARCHLIB ${BLENDER_LINK_LIBS})

View File

@@ -24,7 +24,7 @@ if(EXISTS ${CMAKE_SOURCE_DIR}/.git/)
include(FindGit)
if(GIT_FOUND)
message(STATUS "-- Found Git: ${GIT_EXECUTABLE}")
execute_process(COMMAND git rev-parse --short @{u}
execute_process(COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE MY_WC_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE

View File

@@ -203,6 +203,12 @@ BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_syst
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mt'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_OPENVDB = True
BF_OPENVDB = '/openvdb'
BF_OPENVDB_INC = '${BF_OPENVDB}/include'
BF_OPENVDB_LIB = 'openvdb tbb'
BF_OPENVDB_LIB_PATH = '${BF_OPENVDB}/lib'
WITH_BF_CYCLES_CUDA_BINARIES = False
BF_CYCLES_CUDA_NVCC = '/usr/local/cuda/bin/nvcc'
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50', 'sm_52']
@@ -220,6 +226,9 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = []
# SpaceNavigator and related 3D mice, driver must be 3DxWare 10 Beta 4 (Mac OS X) or later !
WITH_BF_3DMOUSE = True
# Disable OpenVDB, until libraries are available
WITH_BF_OPENVDB = False
#############################################################################
################### various compile settings and flags ##################
#############################################################################

View File

@@ -52,9 +52,9 @@ BF_OPENEXR = '/usr'
# BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR ${BF_OPENEXR}/include'
BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
BF_OPENEXR_LIB = 'Half IlmImf-2_1 Iex-2_1 Imath-2_1 '
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
WITH_BF_DDS = True
@@ -202,6 +202,13 @@ BF_BOOST_LIB_STATIC = '${BF_BOOST_LIBPATH}/libboost_filesystem.a ${BF_BOOST_LIBP
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_OPENVDB = True
BF_OPENVDB = '/usr'
BF_OPENVDB_INC = '${BF_OPENVDB}/include'
BF_OPENVDB_LIB = 'openvdb tbb'
BF_OPENVDB_LIB_PATH = '${BF_OPENVDB}/lib'
BF_OPENVDB_LIB_STATIC = '${BF_OPENVDB}/lib/libopenvdb.so'
WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
WITH_BF_CYCLES_CUDA_BINARIES = False
@@ -226,6 +233,19 @@ BF_3DMOUSE_LIB_STATIC = '${BF_3DMOUSE_LIBPATH}/libspnav.a'
#Freestyle
WITH_BF_FREESTYLE = True
# HDF5
WITH_BF_HDF5 = True
BF_HDF5 = '/usr'
BF_HDF5_LIB = 'hdf5 hdf5_hl'
BF_HDF5_LIBPATH='${BF_HDF5}/lib'
# Alembic
WITH_BF_ALEMBIC = True
BF_ALEMBIC = '/opt/lib/alembic'
BF_ALEMBIC_LIB = 'AlembicAbcGeom AlembicAbc AlembicAbcCollection AlembicAbcCoreFactory AlembicAbcCoreHDF5 AlembicAbcCoreAbstract AlembicAbcCoreOgawa AlembicAbcMaterial AlembicOgawa AlembicUtil'
BF_ALEMBIC_INC = '${BF_ALEMBIC}/include'
BF_ALEMBIC_LIBPATH='${BF_ALEMBIC}/lib/static'
##
CC = 'gcc'
CXX = 'g++'

View File

@@ -166,6 +166,12 @@ BF_BOOST_LIB = 'boost_date_time-mgw46-mt-s-1_49 boost_filesystem-mgw46-mt-s-1_49
BF_BOOST_LIB_INTERNATIONAL = 'boost_locale-mgw46-mt-s-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_OPENVDB = True
BF_OPENVDB = LIBDIR + '/openvdb'
BF_OPENVDB_INC = '${BF_OPENVDB}/include'
BF_OPENVDB_LIB = 'openvdb tbb'
BF_OPENVDB_LIB_PATH = '${BF_OPENVDB}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
@@ -182,6 +188,9 @@ BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21', 'sm_30', 'sm_35', 'sm_50']
#Freestyle
WITH_BF_FREESTYLE = True
# Disable OpenVDB, until libraries are available
WITH_BF_OPENVDB = False
##
CC = 'gcc'
CXX = 'g++'

View File

@@ -196,6 +196,12 @@ BF_BOOST_LIB = 'libboost_date_time-vc120-mt-s-1_55 libboost_filesystem-vc120-mt-
BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc120-mt-s-1_55'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_OPENVDB = True
BF_OPENVDB = '${LIBDIR}/openvdb'
BF_OPENVDB_INC = '${BF_OPENVDB}/include'
BF_OPENVDB_LIB = 'openvdb tbb'
BF_OPENVDB_LIB_PATH = '${BF_OPENVDB}/lib'
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
@@ -208,6 +214,9 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE']
#Freestyle
WITH_BF_FREESTYLE = True
# Disable OpenVDB, until libraries are available
WITH_BF_OPENVDB = False
WITH_BF_STATICOPENGL = False
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'

View File

@@ -165,6 +165,12 @@ BF_BOOST_LIB = 'boost_date_time-mgw47-mt-s-1_49 boost_date_time-mgw47-mt-sd-1_49
BF_BOOST_LIB_INTERNATIONAL = ' boost_locale-mgw47-mt-s-1_49 boost_locale-mgw47-mt-sd-1_49'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_OPENVDB = True
BF_OPENVDB = LIBDIR + '/openvdb'
BF_OPENVDB_INC = '${BF_OPENVDB}/include'
BF_OPENVDB_LIB = 'openvdb tbb'
BF_OPENVDB_LIB_PATH = '${BF_OPENVDB}/lib'
#Ray trace optimization
WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2']
@@ -176,6 +182,9 @@ WITH_BF_OPENMP = True
#Freestyle
WITH_BF_FREESTYLE = True
# Disable OpenVDB, until libraries are available
WITH_BF_OPENVDB = False
##
CC = 'gcc'
CXX = 'g++'

View File

@@ -199,6 +199,12 @@ BF_BOOST_LIB = 'libboost_date_time-vc120-mt-s-1_55 libboost_filesystem-vc120-mt-
BF_BOOST_LIB_INTERNATIONAL = ' libboost_locale-vc120-mt-s-1_55'
BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
WITH_BF_OPENVDB = True
BF_OPENVDB = '${LIBDIR}/openvdb'
BF_OPENVDB_INC = '${BF_OPENVDB}/include'
BF_OPENVDB_LIB = 'openvdb tbb'
BF_OPENVDB_LIB_PATH = '${BF_OPENVDB}/lib'
#CUDA
WITH_BF_CYCLES_CUDA_BINARIES = False
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
@@ -212,6 +218,9 @@ BF_RAYOPTIMIZATION_SSE_FLAGS = ['']
#Freestyle
WITH_BF_FREESTYLE = True
# Disable OpenVDB, until libraries are available
WITH_BF_OPENVDB = False
WITH_BF_STATICOPENGL = False
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'

View File

@@ -204,10 +204,20 @@ def setup_staticlibs(lenv):
libincs += Split(lenv['BF_OIIO_LIBPATH'])
if lenv['WITH_BF_STATICOIIO']:
statlibs += Split(lenv['BF_OIIO_LIB_STATIC'])
if lenv['WITH_BF_HDF5']:
libincs += Split(lenv['BF_HDF5_LIBPATH'])
if lenv['WITH_BF_ALEMBIC']:
libincs += Split(lenv['BF_ALEMBIC_LIBPATH'])
if lenv['WITH_BF_STATICALEMBIC']:
statlibs += Split(lenv['BF_ALEMBIC_LIB_STATIC'])
if lenv['WITH_BF_OPENEXR']:
libincs += Split(lenv['BF_OPENEXR_LIBPATH'])
if lenv['WITH_BF_STATICOPENEXR']:
statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC'])
if lenv['WITH_BF_ZLIB'] and lenv['WITH_BF_STATICZLIB']:
statlibs += Split(lenv['BF_ZLIB_LIB_STATIC'])
@@ -216,6 +226,11 @@ def setup_staticlibs(lenv):
if lenv['WITH_BF_STATICOCIO']:
statlibs += Split(lenv['BF_OCIO_LIB_STATIC'])
if lenv['WITH_BF_OPENVDB']:
libincs += Split(lenv['BF_OPENVDB_LIB_PATH'])
if lenv['WITH_BF_STATICOPENVDB']:
statlibs += Split(lenv['BF_OPENVDB_LIB_STATIC'])
if lenv['WITH_BF_CYCLES_OSL']:
libincs += Split(lenv['BF_OSL_LIBPATH'])
if lenv['WITH_BF_STATICOSL']:
@@ -283,8 +298,19 @@ def setup_syslibs(lenv):
if not lenv['WITH_BF_STATICOCIO']:
syslibs += Split(lenv['BF_OCIO_LIB'])
if lenv['WITH_BF_HDF5']:
syslibs += Split(lenv['BF_HDF5_LIB'])
if lenv['WITH_BF_ALEMBIC']:
if not lenv['WITH_BF_STATICALEMBIC']:
syslibs += Split(lenv['BF_ALEMBIC_LIB'])
if lenv['WITH_BF_OPENVDB'] and not lenv ['WITH_BF_STATICOPENVDB']:
syslibs += Split(lenv['BF_OPENVDB_LIB'])
if lenv['WITH_BF_OPENEXR'] and not lenv['WITH_BF_STATICOPENEXR']:
syslibs += Split(lenv['BF_OPENEXR_LIB'])
if lenv['WITH_BF_ZLIB'] and not lenv['WITH_BF_STATICZLIB']:
syslibs += Split(lenv['BF_ZLIB_LIB'])
if lenv['WITH_BF_TIFF'] and not lenv['WITH_BF_STATICTIFF']:
@@ -372,7 +398,23 @@ def propose_priorities():
def creator(env):
sources = ['creator.c']# + Blender.buildinfo(env, "dynamic") + Blender.resources
incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/depsgraph', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']]
incs = ['#/intern/guardedalloc',
'#/source/blender/blenlib',
'#/source/blender/blenkernel',
'#/source/blender/depsgraph',
'#/source/blender/editors/include',
'#/source/blender/blenloader',
'#/source/blender/imbuf',
'#/source/blender/renderconverter',
'#/source/blender/render/extern/include',
'#/source/blender/windowmanager',
'#/source/blender/makesdna',
'#/source/blender/makesrna',
'#/source/blender/pointcache',
'#/source/gameengine/BlenderRoutines',
'#/extern/glew/include',
'#/source/blender/gpu',
env['BF_OPENGL_INC']]
defs = []

View File

@@ -180,9 +180,11 @@ def validate_arguments(args, bc):
'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
'WITH_BF_OCIO', 'WITH_BF_STATICOCIO', 'BF_OCIO', 'BF_OCIO_INC', 'BF_OCIO_LIB', 'BF_OCIO_LIB_STATIC', 'BF_OCIO_LIBPATH',
'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_INTERNATIONAL', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
'WITH_BF_OPENVDB', 'WITH_BF_STATICOPENVDB', 'BF_OPENVDB', 'BF_OPENVDB_INC', 'BF_OPENVDB_LIB', 'BF_OPENVDB_LIB_STATIC', 'BF_OPENVDB_LIB_PATH',
'WITH_BF_LIBMV', 'WITH_BF_LIBMV_SCHUR_SPECIALIZATIONS',
'WITH_BF_CYCLES_OSL', 'WITH_BF_STATICOSL', 'BF_OSL', 'BF_OSL_INC', 'BF_OSL_LIB', 'BF_OSL_LIBPATH', 'BF_OSL_LIB_STATIC', 'BF_OSL_COMPILER',
'WITH_BF_LLVM', 'WITH_BF_STATICLLVM', 'BF_LLVM', 'BF_LLVM_LIB', 'BF_LLVM_LIBPATH', 'BF_LLVM_LIB_STATIC', 'BF_PROGRAM_LINKFLAGS'
'WITH_BF_LLVM', 'WITH_BF_STATICLLVM', 'BF_LLVM', 'BF_LLVM_LIB', 'BF_LLVM_LIBPATH', 'BF_LLVM_LIB_STATIC', 'BF_PROGRAM_LINKFLAGS',
'WITH_BF_ALEMBIC', 'BF_ALEMBIC', 'BF_ALEMBIC_INC', 'BF_ALEMBIC_LIB', 'BF_ALEMBIC_LIBPATH',
]
# Have options here that scons expects to be lists
@@ -581,6 +583,19 @@ def read_opts(env, cfg, args):
(BoolVariable('WITH_BF_LIBMV_SCHUR_SPECIALIZATIONS', 'Enable fixed-size schur specializations', True)),
(BoolVariable('WITH_BF_COMPOSITOR', 'Enable the tile based nodal compositor', True)),
(BoolVariable('WITH_BF_HDF5', 'Use HDF5 if true', False)),
('BF_HDF5', 'HDF5 base path', ''),
('BF_HDF5_LIB', 'HDF5 library', ''),
('BF_HDF5_LIBPATH', 'HDF5 library path', ''),
(BoolVariable('WITH_BF_ALEMBIC', 'Use Alembic if true', False)),
(BoolVariable('WITH_BF_STATICALEMBIC', 'Staticly link to Alembic', False)),
('BF_ALEMBIC', 'Alembic base path', ''),
('BF_ALEMBIC_INC', 'Alembic include path', ''),
('BF_ALEMBIC_LIB', 'Alembic library', ''),
('BF_ALEMBIC_LIB_STATIC', 'Alembic static libraries', ''),
('BF_ALEMBIC_LIBPATH', 'Alembic library path', ''),
) # end of opts.AddOptions()
localopts.AddVariables(
@@ -627,6 +642,14 @@ def read_opts(env, cfg, args):
('BF_OCIO_LIBPATH', 'OCIO library path', ''),
('BF_OCIO_LIB_STATIC', 'OCIO static library', ''),
(BoolVariable('WITH_BF_OPENVDB', 'Build with OpenVDB', False)),
(BoolVariable('WITH_BF_STATICOPENVDB', 'Staticly link to OpenVDB', False)),
('BF_OPENVDB', 'OpenVDB root path', ''),
('BF_OPENVDB_INC', 'OpenVDB include path', ''),
('BF_OPENVDB_LIB', 'OpenVDB library', ''),
('BF_OPENVDB_LIB_PATH', 'OpenVDB library path', ''),
('BF_OPENVDB_LIB_STATIC', 'OpenVDB static library', ''),
(BoolVariable('WITH_BF_BOOST', 'Build with Boost', False)),
(BoolVariable('WITH_BF_STATICBOOST', 'Staticly link to boost', False)),
('BF_BOOST', 'Boost root path', ''),

View File

@@ -82,3 +82,7 @@ if(WIN32)
add_subdirectory(utfconv)
endif()
if(WITH_OPENVDB)
add_subdirectory(openvdb)
endif()

View File

@@ -63,3 +63,5 @@ if env['WITH_BF_BULLET']:
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
SConscript(['utfconv/SConscript'])
if env['WITH_BF_OPENVDB']:
SConscript (['openvdb/SConscript'])

View File

@@ -44,7 +44,8 @@ AUD_Sequencer::AUD_Sequencer(AUD_Specs specs, float fps, bool muted) :
m_distance_model(AUD_DISTANCE_MODEL_INVERSE_CLAMPED),
m_volume(1, 1.0f),
m_location(3),
m_orientation(4)
m_orientation(4),
m_recursive(false)
{
AUD_Quaternion q;
m_orientation.write(q.get());

View File

@@ -201,6 +201,8 @@ public:
* \param entry The entry to remove.
*/
void remove(boost::shared_ptr<AUD_SequencerEntry> entry);
bool m_recursive;
};
#endif //__AUD_SEQUENCER_H__

View File

@@ -78,6 +78,9 @@ AUD_Specs AUD_SequencerReader::getSpecs() const
void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
{
if (m_sequence->m_recursive)
return;
AUD_MutexLock lock(*m_sequence);
if(m_sequence->m_status != m_status)
@@ -192,7 +195,9 @@ void AUD_SequencerReader::read(int& length, bool& eos, sample_t* buffer)
v2 -= v;
m_device.setListenerVelocity(v2 * m_sequence->m_fps);
m_sequence->m_recursive = true;
m_device.read(reinterpret_cast<data_t*>(buffer + specs.channels * pos), len);
m_sequence->m_recursive = false;
pos += len;
time += float(len) / float(specs.rate);

View File

@@ -146,6 +146,15 @@ if(WITH_CYCLES_OSL)
)
endif()
if(WITH_OPENVDB)
add_definitions(-DWITH_OPENVDB)
add_definitions(-DOPENVDB_USE_BLOSC)
add_definitions(-DDWREAL_IS_DOUBLE=0)
include_directories(
${OPENVDB_INCLUDE_DIRS}
)
endif()
add_definitions(
-DWITH_OPENCL
-DWITH_CUDA

View File

@@ -67,6 +67,10 @@ if env['WITH_BF_CYCLES_OSL']:
defs.append('OSL_STATIC_LIBRARY')
incs.append(cycles['BF_OSL_INC'])
if env['WITH_BF_OPENVDB']:
defs.append('WITH_OPENVDB')
incs.append(env['BF_OPENVDB_INC'])
if env['WITH_BF_CYCLES_DEBUG']:
defs.append('WITH_CYCLES_DEBUG')

View File

@@ -96,6 +96,12 @@ macro(cycles_target_link_libraries target)
${CMAKE_DL_LIBS}
${PLATFORM_LINKLIBS}
)
if(WITH_ALEMBIC)
target_link_libraries(
${target}
${ALEMBIC_LIBRARIES}
)
endif()
endmacro()
# Application build targets
@@ -106,6 +112,23 @@ if(WITH_CYCLES_STANDALONE)
cycles_xml.cpp
cycles_xml.h
)
if(WITH_ALEMBIC)
list(APPEND SRC
cycles_alembic.cpp
cycles_alembic.h
)
add_definitions(-DWITH_ALEMBIC)
include_directories(
SYSTEM
${ALEMBIC_INCLUDE_DIRS}
)
endif()
if(WITH_HDF5)
add_definitions(-DWITH_HDF5)
endif()
add_executable(cycles ${SRC})
cycles_target_link_libraries(cycles)

View File

@@ -0,0 +1,426 @@
/*
* Copyright 2015 Blender Foundation
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <Alembic/AbcCoreOgawa/ReadWrite.h>
#ifdef WITH_HDF5
#include <Alembic/AbcCoreHDF5/ReadWrite.h>
#endif
#include <Alembic/Abc/IArchive.h>
#include <Alembic/Abc/IObject.h>
#include <Alembic/Abc/ISampleSelector.h>
#include <Alembic/Abc/ICompoundProperty.h>
#include <Alembic/Abc/IScalarProperty.h>
#include <Alembic/Abc/IArrayProperty.h>
#include <Alembic/Abc/ArchiveInfo.h>
#include <Alembic/AbcGeom/IPolyMesh.h>
#include "camera.h"
#include "film.h"
#include "graph.h"
#include "integrator.h"
#include "light.h"
#include "mesh.h"
#include "nodes.h"
#include "object.h"
#include "shader.h"
#include "scene.h"
#include "subd_mesh.h"
#include "subd_patch.h"
#include "subd_split.h"
#include "util_debug.h"
#include "util_foreach.h"
#include "util_path.h"
#include "util_transform.h"
#include "util_xml.h"
#include "cycles_alembic.h"
CCL_NAMESPACE_BEGIN
using namespace Alembic;
using namespace Abc;
using namespace AbcGeom;
#define ABC_SAFE_CALL_BEGIN \
try {
#define ABC_SAFE_CALL_END \
} \
catch (Alembic::Util::Exception e) { \
printf("%s", e.what()); \
}
/* File */
static const std::string g_sep(";");
static void visitProperties(std::stringstream &ss, ICompoundProperty, std::string &);
template <class PROP>
static void visitSimpleArrayProperty(std::stringstream &ss, PROP iProp, const std::string &iIndent)
{
std::string ptype = "ArrayProperty ";
size_t asize = 0;
AbcA::ArraySamplePtr samp;
index_t maxSamples = iProp.getNumSamples();
for (index_t i = 0 ; i < maxSamples; ++i) {
iProp.get(samp, ISampleSelector( i ));
asize = samp->size();
};
std::string mdstring = "interpretation=";
mdstring += iProp.getMetaData().get("interpretation");
std::stringstream dtype;
dtype << "datatype=";
dtype << iProp.getDataType();
std::stringstream asizestr;
asizestr << ";arraysize=";
asizestr << asize;
mdstring += g_sep;
mdstring += dtype.str();
mdstring += asizestr.str();
ss << iIndent << " " << ptype << "name=" << iProp.getName()
<< g_sep << mdstring << g_sep << "numsamps="
<< iProp.getNumSamples() << std::endl;
}
template <class PROP>
static void visitSimpleScalarProperty(std::stringstream &ss, PROP iProp, const std::string &iIndent)
{
std::string ptype = "ScalarProperty ";
size_t asize = 0;
const AbcA::DataType &dt = iProp.getDataType();
const Alembic::Util ::uint8_t extent = dt.getExtent();
Alembic::Util::Dimensions dims(extent);
AbcA::ArraySamplePtr samp = AbcA::AllocateArraySample( dt, dims );
index_t maxSamples = iProp.getNumSamples();
for (index_t i = 0 ; i < maxSamples; ++i) {
iProp.get(const_cast<void*>(samp->getData()), ISampleSelector( i ));
asize = samp->size();
};
std::string mdstring = "interpretation=";
mdstring += iProp.getMetaData().get("interpretation");
std::stringstream dtype;
dtype << "datatype=";
dtype << dt;
std::stringstream asizestr;
asizestr << ";arraysize=";
asizestr << asize;
mdstring += g_sep;
mdstring += dtype.str();
mdstring += asizestr.str();
ss << iIndent << " " << ptype << "name=" << iProp.getName()
<< g_sep << mdstring << g_sep << "numsamps="
<< iProp.getNumSamples() << std::endl;
}
static void visitCompoundProperty(std::stringstream &ss, ICompoundProperty iProp, std::string &ioIndent)
{
std::string oldIndent = ioIndent;
ioIndent += " ";
std::string interp = "schema=";
interp += iProp.getMetaData().get("schema");
ss << ioIndent << "CompoundProperty " << "name=" << iProp.getName()
<< g_sep << interp << std::endl;
visitProperties(ss, iProp, ioIndent);
ioIndent = oldIndent;
}
static void visitProperties(std::stringstream &ss, ICompoundProperty iParent, std::string &ioIndent )
{
std::string oldIndent = ioIndent;
for (size_t i = 0 ; i < iParent.getNumProperties() ; i++) {
PropertyHeader header = iParent.getPropertyHeader(i);
if (header.isCompound()) {
visitCompoundProperty(ss, ICompoundProperty(iParent, header.getName()), ioIndent);
}
else if (header.isScalar()) {
visitSimpleScalarProperty(ss, IScalarProperty(iParent, header.getName()), ioIndent);
}
else {
assert(header.isArray());
visitSimpleArrayProperty(ss, IArrayProperty(iParent, header.getName()), ioIndent);
}
}
ioIndent = oldIndent;
}
static void visitObject(std::stringstream &ss, IObject iObj, std::string iIndent, AbcArchiveInfoLevel info_level)
{
// Object has a name, a full name, some meta data,
// and then it has a compound property full of properties.
std::string path = iObj.getFullName();
if (iObj.isInstanceRoot()) {
if (path != "/") {
ss << "Object " << "name=" << path
<< " [Instance " << iObj.instanceSourcePath() << "]"
<< std::endl;
}
}
else if (iObj.isInstanceDescendant()) {
/* skip non-root instances to avoid repetition */
return;
}
else {
if (path != "/") {
ss << "Object " << "name=" << path << std::endl;
}
if (info_level >= ABC_INFO_PROPERTIES) {
// Get the properties.
ICompoundProperty props = iObj.getProperties();
visitProperties(ss, props, iIndent);
}
// now the child objects
for (size_t i = 0 ; i < iObj.getNumChildren() ; i++) {
visitObject(ss, IObject(iObj, iObj.getChildHeader(i).getName()), iIndent, info_level);
}
}
}
static std::string abc_archive_info(IArchive &archive, AbcArchiveInfoLevel info_level)
{
std::stringstream ss;
ss << "Alembic Archive Info for "
<< Alembic::AbcCoreAbstract::GetLibraryVersion()
<< std::endl;;
std::string appName;
std::string libraryVersionString;
Alembic::Util::uint32_t libraryVersion;
std::string whenWritten;
std::string userDescription;
GetArchiveInfo(archive,
appName,
libraryVersionString,
libraryVersion,
whenWritten,
userDescription);
if (appName != "") {
ss << " file written by: " << appName << std::endl;
ss << " using Alembic : " << libraryVersionString << std::endl;
ss << " written on : " << whenWritten << std::endl;
ss << " user description : " << userDescription << std::endl;
ss << std::endl;
}
else {
// ss << argv[1] << std::endl;
ss << " (file doesn't have any ArchiveInfo)"
<< std::endl;
ss << std::endl;
}
if (info_level >= ABC_INFO_OBJECTS)
visitObject(ss, archive.getTop(), "", info_level);
return ss.str();
}
/* ========================================================================= */
struct AbcReadState {
Scene *scene; /* scene pointer */
float time;
Transform tfm; /* current transform state */
bool smooth; /* smooth normal state */
int shader; /* current shader */
string base; /* base path to current file*/
float dicing_rate; /* current dicing rate */
Mesh::DisplacementMethod displacement_method;
};
static ISampleSelector get_sample_selector(const AbcReadState &state)
{
return ISampleSelector(state.time, ISampleSelector::kFloorIndex);
}
static Mesh *add_mesh(Scene *scene, const Transform& tfm)
{
/* create mesh */
Mesh *mesh = new Mesh();
scene->meshes.push_back(mesh);
/* create object*/
Object *object = new Object();
object->mesh = mesh;
object->tfm = tfm;
scene->objects.push_back(object);
return mesh;
}
static void read_mesh(const AbcReadState &state, IPolyMesh object)
{
/* add mesh */
Mesh *mesh = add_mesh(state.scene, state.tfm);
mesh->used_shaders.push_back(state.shader);
/* read state */
int shader = state.shader;
bool smooth = state.smooth;
mesh->displacement_method = state.displacement_method;
ISampleSelector ss = get_sample_selector(state);
IPolyMeshSchema schema = object.getSchema();
IPolyMeshSchema::Sample sample;
schema.get(sample, ss);
int totverts = sample.getPositions()->size();
int totfaces = sample.getFaceCounts()->size();
const V3f *P = sample.getPositions()->get();
const int32_t *verts = sample.getFaceIndices()->get();
const int32_t *nverts = sample.getFaceCounts()->get();
/* create vertices */
mesh->verts.reserve(totverts);
for(int i = 0; i < totverts; i++) {
mesh->verts.push_back(make_float3(P[i].x, P[i].y, P[i].z));
}
/* create triangles */
int index_offset = 0;
for(int i = 0; i < totfaces; i++) {
int n = nverts[i];
/* XXX TODO only supports tris and quads atm,
* need a proper tessellation algorithm in cycles.
*/
if (n > 4) {
printf("%d-sided face found, only triangles and quads are supported currently", n);
n = 4;
}
for(int j = 0; j < n-2; j++) {
int v0 = verts[index_offset];
int v1 = verts[index_offset + j + 1];
int v2 = verts[index_offset + j + 2];
assert(v0 < (int)totverts);
assert(v1 < (int)totverts);
assert(v2 < (int)totverts);
mesh->add_triangle(v0, v1, v2, shader, smooth);
}
index_offset += n;
}
/* temporary for test compatibility */
mesh->attributes.remove(ATTR_STD_VERTEX_NORMAL);
}
static void read_object(const AbcReadState &state, IObject object)
{
for (int i = 0; i < object.getNumChildren(); ++i) {
IObject child = object.getChild(i);
const MetaData &metadata = child.getMetaData();
if (IPolyMeshSchema::matches(metadata)) {
read_mesh(state, IPolyMesh(child, kWrapExisting));
}
else {
read_object(state, child);
}
}
}
static void read_archive(Scene *scene, IArchive archive, const char *filepath)
{
AbcReadState state;
state.scene = scene;
state.time = 0.0f; // TODO
state.tfm = transform_identity();
state.shader = scene->default_surface;
state.smooth = false;
state.dicing_rate = 0.1f;
state.base = path_dirname(filepath);
read_object(state, archive.getTop());
scene->params.bvh_type = SceneParams::BVH_STATIC;
}
void abc_read_ogawa_file(Scene *scene, const char *filepath, AbcArchiveInfoLevel info_level)
{
IArchive archive;
ABC_SAFE_CALL_BEGIN
archive = IArchive(AbcCoreOgawa::ReadArchive(), filepath, ErrorHandler::kThrowPolicy);
ABC_SAFE_CALL_END
if (archive) {
if (info_level >= ABC_INFO_BASIC)
printf("%s", abc_archive_info(archive, info_level).c_str());
read_archive(scene, archive, filepath);
}
}
void abc_read_hdf5_file(Scene *scene, const char *filepath, AbcArchiveInfoLevel info_level)
{
#ifdef WITH_HDF5
IArchive archive;
ABC_SAFE_CALL_BEGIN
archive = IArchive(AbcCoreHDF5::ReadArchive(), filepath, ErrorHandler::kThrowPolicy);
ABC_SAFE_CALL_END
if (archive) {
if (info_level >= ABC_INFO_BASIC)
printf("%s", abc_archive_info(archive, info_level).c_str());
read_archive(scene, archive, filepath);
}
#endif
}
CCL_NAMESPACE_END

View File

@@ -0,0 +1,36 @@
/*
* Copyright 2015 Blender Foundation
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __CYCLES_ALEMBIC_H__
#define __CYCLES_ALEMBIC_H__
CCL_NAMESPACE_BEGIN
class Scene;
enum AbcArchiveInfoLevel {
ABC_INFO_NONE = 0,
ABC_INFO_BASIC,
ABC_INFO_OBJECTS,
ABC_INFO_PROPERTIES,
};
void abc_read_ogawa_file(Scene *scene, const char *filepath, AbcArchiveInfoLevel info_level = ABC_INFO_NONE);
void abc_read_hdf5_file(Scene *scene, const char *filepath, AbcArchiveInfoLevel info_level = ABC_INFO_NONE);
CCL_NAMESPACE_END
#endif /* __CYCLES_XML_H__ */

View File

@@ -38,13 +38,23 @@
#endif
#include "cycles_xml.h"
#ifdef WITH_ALEMBIC
#include "cycles_alembic.h"
#endif
CCL_NAMESPACE_BEGIN
enum FileType {
FILETYPE_XML = 0,
FILETYPE_ABC_HDF5,
FILETYPE_ABC_OGAWA,
};
struct Options {
Session *session;
Scene *scene;
string filepath;
FileType filetype;
int width, height;
SceneParams scene_params;
SessionParams session_params;
@@ -121,8 +131,22 @@ static void scene_init()
{
options.scene = new Scene(options.scene_params, options.session_params.device);
/* Read XML */
xml_read_file(options.scene, options.filepath.c_str());
/* Read file */
switch (options.filetype) {
case FILETYPE_XML:
xml_read_file(options.scene, options.filepath.c_str());
break;
#ifdef WITH_ALEMBIC
case FILETYPE_ABC_OGAWA:
abc_read_ogawa_file(options.scene, options.filepath.c_str());
break;
case FILETYPE_ABC_HDF5:
abc_read_hdf5_file(options.scene, options.filepath.c_str());
break;
#endif
default:
return;
}
/* Camera width/height override? */
if(!(options.width == 0 || options.height == 0)) {
@@ -356,6 +380,16 @@ static void options_parse(int argc, const char **argv)
/* shading system */
string ssname = "svm";
/* input file type */
string filetypes = "auto, xml";
#ifdef WITH_ALEMBIC
filetypes += ", alembic_ogawa";
#ifdef WITH_HDF5
filetypes += ", alembic_hdf5";
#endif
#endif
string filetype = "auto";
/* parse options */
ArgParse ap;
bool help = false, debug = false;
@@ -371,6 +405,7 @@ static void options_parse(int argc, const char **argv)
"--quiet", &options.quiet, "In background mode, don't print progress messages",
"--samples %d", &options.session_params.samples, "Number of samples to render",
"--output %s", &options.session_params.output_path, "File path to write output image",
"--filetype %s", &filetype, ("File type: " + filetypes).c_str(),
"--threads %d", &options.session_params.threads, "CPU Rendering Threads",
"--width %d", &options.width, "Window width in pixel",
"--height %d", &options.height, "Window height in pixel",
@@ -416,6 +451,21 @@ static void options_parse(int argc, const char **argv)
else if(ssname == "svm")
options.scene_params.shadingsystem = SHADINGSYSTEM_SVM;
if(filetype == "auto") {
string extension = options.filepath.substr(options.filepath.find_last_of(".") + 1);
if (extension == "xml")
options.filetype = FILETYPE_XML;
else if (extension == "abc")
options.filetype = FILETYPE_ABC_OGAWA;
}
else if(filetype == "xml")
options.filetype = FILETYPE_XML;
else if(filetype == "alembic_ogawa")
options.filetype = FILETYPE_ABC_OGAWA;
else if(filetype == "alembic_hdf5")
options.filetype = FILETYPE_ABC_HDF5;
#ifndef WITH_CYCLES_STANDALONE_GUI
options.session_params.background = true;
#endif

View File

@@ -43,6 +43,9 @@
#include "util_xml.h"
#include "cycles_xml.h"
#ifdef WITH_ALEMBIC
#include "cycles_alembic.h"
#endif
CCL_NAMESPACE_BEGIN
@@ -735,6 +738,13 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
xml_read_enum(&vtransform->convert_to, VectorTransformNode::convert_space_enum, node, "convert_to");
snode = vtransform;
}
else if(string_iequals(node.name(), "openvdb")) {
OpenVDBNode *vdbnode = new OpenVDBNode();
xml_read_string(&vdbnode->filename, node, "src");
vdbnode->filename = path_join(state.base, vdbnode->filename);
snode = vdbnode;
}
else if(string_iequals(node.name(), "connect")) {
/* connect nodes */
vector<string> from_tokens, to_tokens;
@@ -1188,6 +1198,25 @@ static void xml_read_state(XMLReadState& state, pugi::xml_node node)
state.displacement_method = Mesh::DISPLACE_BOTH;
}
/* Alembic */
static void xml_read_alembic(const XMLReadState& state, pugi::xml_node node)
{
#ifdef WITH_ALEMBIC
string filepath;
if(xml_read_string(&filepath, node, "file")) {
filepath = path_join(state.base, filepath);
if(xml_equal_string(node, "type", "hdf5"))
abc_read_hdf5_file(state.scene, filepath.c_str(), ABC_INFO_BASIC);
else if(xml_equal_string(node, "type", "ogawa"))
abc_read_ogawa_file(state.scene, filepath.c_str(), ABC_INFO_BASIC);
else
abc_read_ogawa_file(state.scene, filepath.c_str(), ABC_INFO_BASIC); /* default */
}
#endif
}
/* Scene */
static void xml_read_include(const XMLReadState& state, const string& src);
@@ -1237,6 +1266,9 @@ static void xml_read_scene(const XMLReadState& state, pugi::xml_node scene_node)
if(xml_read_string(&src, node, "src"))
xml_read_include(state, src);
}
else if(string_iequals(node.name(), "alembic")) {
xml_read_alembic(state, node);
}
else
fprintf(stderr, "Unknown node \"%s\".\n", node.name());
}

View File

@@ -31,10 +31,12 @@ set(SRC
blender_session.cpp
blender_shader.cpp
blender_sync.cpp
blender_texture.cpp
CCL_api.h
blender_sync.h
blender_session.h
blender_texture.h
blender_util.h
)

View File

@@ -463,6 +463,12 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
description="Use BVH spatial splits: longer builder time, faster render",
default=False,
)
cls.debug_use_triangle_storage = BoolProperty(
name="Use Triangle Storage",
description="use special storage with aligned triangle coordinates for faster "
"intesection check in expense of higher memory usage",
default=True,
)
cls.use_cache = BoolProperty(
name="Cache BVH",
description="Cache last built BVH to disk for faster re-render if no geometry changed",
@@ -511,6 +517,19 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
),
)
cls.use_camera_cull = BoolProperty(
name="Use Camera Cull",
description="Allow objects to be culled based on the camera frustum",
default=False,
)
cls.camera_cull_margin = FloatProperty(
name="Camera Cull Margin",
description="Margin for the camera space culling",
default=0.1,
min=0.0, max=5.0
)
@classmethod
def unregister(cls):
del bpy.types.Scene.cycles
@@ -890,6 +909,12 @@ class CyclesObjectBlurSettings(bpy.types.PropertyGroup):
default=1,
)
cls.use_camera_cull = BoolProperty(
name="Use Camera Cull",
description="Allow this object and it's duplicators to be culled by camera space culling",
default=False,
)
@classmethod
def unregister(cls):
del bpy.types.Object.cycles

View File

@@ -322,6 +322,11 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
subsub.enabled = not rd.use_border
subsub.prop(rd, "use_save_buffers")
sub.prop(cscene, "use_camera_cull")
subsub = col.column()
subsub.active = cscene.use_camera_cull
subsub.prop(cscene, "camera_cull_margin")
col = split.column(align=True)
col.label(text="Viewport:")
@@ -339,6 +344,7 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
col.label(text="Acceleration structure:")
col.prop(cscene, "debug_use_spatial_splits")
col.prop(cscene, "debug_use_triangle_storage")
class CyclesRender_PT_layer_options(CyclesButtonsPanel, Panel):
@@ -687,8 +693,8 @@ class CyclesObject_PT_motion_blur(CyclesButtonsPanel, Panel):
sub.prop(cob, "motion_steps", text="Steps")
class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
bl_label = "Ray Visibility"
class CyclesObject_PT_cycles_settings(CyclesButtonsPanel, Panel):
bl_label = "Cycles Settings"
bl_context = "object"
bl_options = {'DEFAULT_CLOSED'}
@@ -703,8 +709,10 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
layout = self.layout
ob = context.object
cob = ob.cycles
visibility = ob.cycles_visibility
layout.label(text="Ray Visibility:")
flow = layout.column_flow()
flow.prop(visibility, "camera")
@@ -716,6 +724,9 @@ class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
if ob.type != 'LAMP':
flow.prop(visibility, "shadow")
layout.label(text="Performance:")
layout.prop(cob, "use_camera_cull")
class CYCLES_OT_use_shading_nodes(Operator):
"""Enable nodes on a material, world or lamp"""
@@ -1225,7 +1236,8 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
node = context.texture_node
return node and CyclesButtonsPanel.poll(context)
# TODO(sergey): perform a faster/nicer check?
return node and hasattr(node, 'texture_mapping') and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
@@ -1449,7 +1461,8 @@ class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
rd = context.scene.render
scene = context.scene
rd = scene.render
layout.active = rd.use_simplify
split = layout.split()
@@ -1529,6 +1542,7 @@ def get_panels():
"DATA_PT_curve_texture_space",
"DATA_PT_mball_texture_space",
"DATA_PT_vertex_groups",
"DATA_PT_face_maps",
"DATA_PT_shape_keys",
"DATA_PT_uv_texture",
"DATA_PT_vertex_colors",

View File

@@ -37,15 +37,14 @@ void curveinterp_v3_v3v3v3v3(float3 *p, float3 *v1, float3 *v2, float3 *v3, floa
void interp_weights(float t, float data[4]);
float shaperadius(float shape, float root, float tip, float time);
void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyloc, float *time, ParticleCurveData *CData);
bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background, int uv_num);
bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background, int vcol_num);
bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background);
void ExportCurveSegments(Scene *scene, Mesh *mesh, ParticleCurveData *CData);
void ExportCurveTrianglePlanes(Mesh *mesh, ParticleCurveData *CData,
float3 RotCam, bool is_ortho);
void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int resolution);
void ExportCurveTriangleUV(ParticleCurveData *CData, int vert_offset, int resol, float3 *uvdata);
void ExportCurveUV(Mesh *mesh, ParticleCurveData *CData, ustring name, bool active_render, int primitive, int vert_offset, int resol);
void ExportCurveTriangleVcol(ParticleCurveData *CData, int vert_offset, int resol, uchar4 *cdata);
void ExportCurveVcol(Mesh *mesh, ParticleCurveData *CData, ustring name, int primitive, int vert_offset, int resol);
ParticleCurveData::ParticleCurveData()
{
@@ -119,206 +118,330 @@ void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyl
curveinterp_v3_v3v3v3v3(keyloc, &ckey_loc1, &ckey_loc2, &ckey_loc3, &ckey_loc4, t);
}
bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background)
static void ObtainCacheParticleData(Mesh *mesh, BL::Object b_ob, BL::ParticleSystem b_psys, const Transform &itfm,
ParticleCurveData *CData, bool background)
{
int curvenum = 0;
int keyno = 0;
if(!(mesh && b_mesh && b_ob && CData))
return false;
Transform tfm = get_transform(b_ob->matrix_world());
Transform itfm = transform_quick_inverse(tfm);
BL::Object::modifiers_iterator b_mod;
for(b_ob->modifiers.begin(b_mod); b_mod != b_ob->modifiers.end(); ++b_mod) {
if((b_mod->type() == b_mod->type_PARTICLE_SYSTEM) && (background ? b_mod->show_render() : b_mod->show_viewport())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod->ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
if((b_part.render_type() == BL::ParticleSettings::render_type_PATH) && (b_part.type() == BL::ParticleSettings::type_HAIR)) {
int mi = clamp(b_part.material()-1, 0, mesh->used_shaders.size()-1);
int shader = mesh->used_shaders[mi];
int draw_step = background ? b_part.render_step() : b_part.draw_step();
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0)
totcurves += totparts;
if(totcurves == 0)
continue;
int ren_step = (1 << draw_step) + 1;
if(b_part.kink() == BL::ParticleSettings::kink_SPIRAL)
ren_step += b_part.kink_extra_steps();
PointerRNA cpsys = RNA_pointer_get(&b_part.ptr, "cycles");
CData->psys_firstcurve.push_back(curvenum);
CData->psys_curvenum.push_back(totcurves);
CData->psys_shader.push_back(shader);
float radius = get_float(cpsys, "radius_scale") * 0.5f;
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
int mi = clamp(b_part.material()-1, 0, mesh->used_shaders.size()-1);
int shader = mesh->used_shaders[mi];
int draw_step = background ? b_part.render_step() : b_part.draw_step();
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
CData->psys_rootradius.push_back(radius * get_float(cpsys, "root_width"));
CData->psys_tipradius.push_back(radius * get_float(cpsys, "tip_width"));
CData->psys_shape.push_back(get_float(cpsys, "shape"));
CData->psys_closetip.push_back(get_boolean(cpsys, "use_closetip"));
if(b_part.child_type() == 0)
totcurves += totparts;
int pa_no = 0;
if(!(b_part.child_type() == 0))
pa_no = totparts;
if(totcurves == 0)
return;
int num_add = (totparts+totchild - pa_no);
CData->curve_firstkey.reserve(CData->curve_firstkey.size() + num_add);
CData->curve_keynum.reserve(CData->curve_keynum.size() + num_add);
CData->curve_length.reserve(CData->curve_length.size() + num_add);
CData->curvekey_co.reserve(CData->curvekey_co.size() + num_add*ren_step);
CData->curvekey_time.reserve(CData->curvekey_time.size() + num_add*ren_step);
int ren_step = (1 << draw_step) + 1;
if(b_part.kink() == BL::ParticleSettings::kink_SPIRAL)
ren_step += b_part.kink_extra_steps();
for(; pa_no < totparts+totchild; pa_no++) {
int keynum = 0;
CData->curve_firstkey.push_back(keyno);
float curve_length = 0.0f;
float3 pcKey;
for(int step_no = 0; step_no < ren_step; step_no++) {
float nco[3];
b_psys.co_hair(*b_ob, pa_no, step_no, nco);
float3 cKey = make_float3(nco[0], nco[1], nco[2]);
cKey = transform_point(&itfm, cKey);
if(step_no > 0) {
float step_length = len(cKey - pcKey);
if(step_length == 0.0f)
continue;
curve_length += step_length;
}
CData->curvekey_co.push_back(cKey);
CData->curvekey_time.push_back(curve_length);
pcKey = cKey;
keynum++;
}
keyno += keynum;
PointerRNA cpsys = RNA_pointer_get(&b_part.ptr, "cycles");
int keyno = CData->curvekey_co.size();
int curvenum = CData->curve_keynum.size();
CData->curve_keynum.push_back(keynum);
CData->curve_length.push_back(curve_length);
curvenum++;
}
CData->psys_firstcurve.push_back(curvenum);
CData->psys_curvenum.push_back(totcurves);
CData->psys_shader.push_back(shader);
float radius = get_float(cpsys, "radius_scale") * 0.5f;
CData->psys_rootradius.push_back(radius * get_float(cpsys, "root_width"));
CData->psys_tipradius.push_back(radius * get_float(cpsys, "tip_width"));
CData->psys_shape.push_back(get_float(cpsys, "shape"));
CData->psys_closetip.push_back(get_boolean(cpsys, "use_closetip"));
int pa_no = 0;
if(!(b_part.child_type() == 0))
pa_no = totparts;
int num_add = (totparts+totchild - pa_no);
CData->curve_firstkey.reserve(CData->curve_firstkey.size() + num_add);
CData->curve_keynum.reserve(CData->curve_keynum.size() + num_add);
CData->curve_length.reserve(CData->curve_length.size() + num_add);
CData->curvekey_co.reserve(CData->curvekey_co.size() + num_add*ren_step);
CData->curvekey_time.reserve(CData->curvekey_time.size() + num_add*ren_step);
for(; pa_no < totparts+totchild; pa_no++) {
int keynum = 0;
CData->curve_firstkey.push_back(keyno);
float curve_length = 0.0f;
float3 pcKey;
for(int step_no = 0; step_no < ren_step; step_no++) {
float nco[3];
b_psys.co_hair(b_ob, pa_no, step_no, nco);
float3 cKey = make_float3(nco[0], nco[1], nco[2]);
cKey = transform_point(&itfm, cKey);
if(step_no > 0) {
float step_length = len(cKey - pcKey);
if(step_length == 0.0f)
continue;
curve_length += step_length;
}
CData->curvekey_co.push_back(cKey);
CData->curvekey_time.push_back(curve_length);
pcKey = cKey;
keynum++;
}
}
keyno += keynum;
CData->curve_keynum.push_back(keynum);
CData->curve_length.push_back(curve_length);
curvenum++;
}
}
static void ObtainCacheParticleUV(Mesh * /*mesh*/, BL::Object /*b_ob*/, BL::Mesh b_mesh, BL::ParticleSystem b_psys, BL::ParticleSystemModifier b_psmd,
ParticleCurveData *CData, bool background, int uv_num)
{
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0)
totcurves += totparts;
if(totcurves == 0)
return;
int pa_no = 0;
if(!(b_part.child_type() == 0))
pa_no = totparts;
int num_add = (totparts+totchild - pa_no);
CData->curve_uv.reserve(CData->curve_uv.size() + num_add);
BL::ParticleSystem::particles_iterator b_pa;
b_psys.particles.begin(b_pa);
for(; pa_no < totparts+totchild; pa_no++) {
/* Add UVs */
BL::Mesh::tessface_uv_textures_iterator l;
b_mesh.tessface_uv_textures.begin(l);
float3 uv = make_float3(0.0f, 0.0f, 0.0f);
if(b_mesh.tessface_uv_textures.length())
b_psys.uv_on_emitter(b_psmd, *b_pa, pa_no, uv_num, &uv.x);
CData->curve_uv.push_back(uv);
if(pa_no < totparts && b_pa != b_psys.particles.end())
++b_pa;
}
}
static void ObtainCacheParticleVcol(Mesh * /*mesh*/, BL::Object /*b_ob*/, BL::Mesh b_mesh, BL::ParticleSystem b_psys, BL::ParticleSystemModifier b_psmd,
ParticleCurveData *CData, bool background, int vcol_num)
{
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0)
totcurves += totparts;
if(totcurves == 0)
return;
int pa_no = 0;
if(!(b_part.child_type() == 0))
pa_no = totparts;
int num_add = (totparts+totchild - pa_no);
CData->curve_vcol.reserve(CData->curve_vcol.size() + num_add);
BL::ParticleSystem::particles_iterator b_pa;
b_psys.particles.begin(b_pa);
for(; pa_no < totparts+totchild; pa_no++) {
/* Add vertex colors */
BL::Mesh::tessface_vertex_colors_iterator l;
b_mesh.tessface_vertex_colors.begin(l);
float3 vcol = make_float3(0.0f, 0.0f, 0.0f);
if(b_mesh.tessface_vertex_colors.length())
b_psys.mcol_on_emitter(b_psmd, *b_pa, pa_no, vcol_num, &vcol.x);
CData->curve_vcol.push_back(vcol);
if(pa_no < totparts && b_pa != b_psys.particles.end())
++b_pa;
}
}
/* A little bit of templated code here to avoid much duplication for parent/child strands:
* Most attributes are the same for both types, but some are handled slightly differently.
* These attributes are handled by templated utility functions that automatically get selected by type.
*/
template <typename StrandsT>
struct StrandsTraits;
template<>
struct StrandsTraits<BL::Strands>
{
typedef BL::StrandsCurve curve_t;
typedef BL::StrandsVertex vertex_t;
static float3 get_location(BL::Strands b_strands, int index)
{
float *co = (b_strands.has_motion_state())? b_strands.motion_state[index].location() : b_strands.vertices[index].location();
return make_float3(co[0], co[1], co[2]);
}
static float3 get_uv(BL::Strands /*b_strands*/, int /*index*/, int /*uv_num*/)
{
return make_float3(0.0f, 0.0f, 0.0f);
}
static float3 get_vcol(BL::Strands /*b_strands*/, int /*index*/, int /*vcol_num*/)
{
return make_float3(0.0f, 0.0f, 0.0f);
}
};
template<>
struct StrandsTraits<BL::StrandsChildren>
{
typedef BL::StrandsChildCurve curve_t;
typedef BL::StrandsChildVertex vertex_t;
static float3 get_location(BL::StrandsChildren b_strands, int index)
{
float *co = b_strands.vertices[index].location();
return make_float3(co[0], co[1], co[2]);
}
static float3 get_uv(BL::StrandsChildren b_strands, int index, int uv_num)
{
if (uv_num < b_strands.num_curve_uv_layers()) {
size_t offset = uv_num * b_strands.curves.length();
float *uv = b_strands.curve_uvs[offset + index].uv();
return make_float3(uv[0], uv[1], 0.0f);
}
else
return make_float3(0.0f, 0.0f, 0.0f);
}
static float3 get_vcol(BL::StrandsChildren b_strands, int index, int vcol_num)
{
if (vcol_num < b_strands.num_curve_vcol_layers()) {
size_t offset = vcol_num * b_strands.curves.length();
float *vcol = b_strands.curve_vcols[offset + index].vcol();
return make_float3(vcol[0], vcol[1], vcol[2]);
}
else
return make_float3(0.0f, 0.0f, 0.0f);
}
};
template <typename StrandsT>
static bool ObtainCacheStrandsData(Mesh *mesh, BL::Scene /*b_scene*/, BL::Object /*b_parent*/, BL::DupliObject /*b_dupli_ob*/, BL::ParticleSystem b_psys, StrandsT b_strands, const Transform &/*itfm*/,
ParticleCurveData *CData, bool /*background*/)
{
typedef StrandsTraits<StrandsT> traits;
typedef typename traits::curve_t CurveT;
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
PointerRNA cpsys = RNA_pointer_get(&b_part.ptr, "cycles");
int mi = clamp(b_part.material()-1, 0, mesh->used_shaders.size()-1);
int shader = mesh->used_shaders[mi];
int totcurves = b_strands.curves.length();
int totvert = b_strands.vertices.length();
int keyno = CData->curvekey_co.size();
int curvenum = CData->curve_keynum.size();
CData->psys_firstcurve.push_back(curvenum);
CData->psys_curvenum.push_back(totcurves);
CData->psys_shader.push_back(shader);
float radius = get_float(cpsys, "radius_scale") * 0.5f;
CData->psys_rootradius.push_back(radius * get_float(cpsys, "root_width"));
CData->psys_tipradius.push_back(radius * get_float(cpsys, "tip_width"));
CData->psys_shape.push_back(get_float(cpsys, "shape"));
CData->psys_closetip.push_back(get_boolean(cpsys, "use_closetip"));
CData->curve_firstkey.reserve(CData->curve_firstkey.size() + totcurves);
CData->curve_keynum.reserve(CData->curve_keynum.size() + totcurves);
CData->curve_length.reserve(CData->curve_length.size() + totcurves);
CData->curvekey_co.reserve(CData->curvekey_co.size() + totvert);
CData->curvekey_time.reserve(CData->curvekey_time.size() + totvert);
int icurve = 0;
int ivert = 0;
for(; icurve < totcurves; ++icurve) {
CurveT b_curve = b_strands.curves[icurve];
int numverts = b_curve.size();
int showverts = b_curve.render_size();
int usedverts = 0;
CData->curve_firstkey.push_back(keyno);
float curve_length = 0.0f;
float3 pcKey;
for(int cvert = 0; cvert < showverts; ++cvert) {
float3 cKey = traits::get_location(b_strands, ivert + cvert);
if(cvert > 0) {
float step_length = len(cKey - pcKey);
if(step_length == 0.0f)
continue;
curve_length += step_length;
}
CData->curvekey_co.push_back(cKey);
CData->curvekey_time.push_back(curve_length);
pcKey = cKey;
usedverts++;
}
keyno += usedverts;
ivert += numverts;
CData->curve_keynum.push_back(usedverts);
CData->curve_length.push_back(curve_length);
curvenum++;
}
return true;
}
bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background, int uv_num)
template <typename StrandsT>
static bool ObtainCacheStrandsUV(Mesh * /*mesh*/, BL::Scene /*b_scene*/, BL::Object /*b_parent*/, BL::DupliObject /*b_dupli_ob*/, BL::ParticleSystem /*b_psys*/, StrandsT b_strands,
ParticleCurveData *CData, bool /*background*/, int uv_num)
{
if(!(mesh && b_mesh && b_ob && CData))
return false;
typedef StrandsTraits<StrandsT> traits;
// BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
CData->curve_uv.clear();
int totcurves = b_strands.curves.length();
BL::Object::modifiers_iterator b_mod;
for(b_ob->modifiers.begin(b_mod); b_mod != b_ob->modifiers.end(); ++b_mod) {
if((b_mod->type() == b_mod->type_PARTICLE_SYSTEM) && (background ? b_mod->show_render() : b_mod->show_viewport())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod->ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
CData->curve_uv.reserve(CData->curve_uv.size() + totcurves);
if((b_part.render_type() == BL::ParticleSettings::render_type_PATH) && (b_part.type() == BL::ParticleSettings::type_HAIR)) {
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0)
totcurves += totparts;
if(totcurves == 0)
continue;
int pa_no = 0;
if(!(b_part.child_type() == 0))
pa_no = totparts;
int num_add = (totparts+totchild - pa_no);
CData->curve_uv.reserve(CData->curve_uv.size() + num_add);
BL::ParticleSystem::particles_iterator b_pa;
b_psys.particles.begin(b_pa);
for(; pa_no < totparts+totchild; pa_no++) {
/* Add UVs */
BL::Mesh::tessface_uv_textures_iterator l;
b_mesh->tessface_uv_textures.begin(l);
float3 uv = make_float3(0.0f, 0.0f, 0.0f);
if(b_mesh->tessface_uv_textures.length())
b_psys.uv_on_emitter(psmd, *b_pa, pa_no, uv_num, &uv.x);
CData->curve_uv.push_back(uv);
if(pa_no < totparts && b_pa != b_psys.particles.end())
++b_pa;
}
}
}
int icurve = 0;
for(; icurve < totcurves; ++icurve) {
CData->curve_uv.push_back(traits::get_uv(b_strands, icurve, uv_num));
}
return true;
}
bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background, int vcol_num)
template <typename StrandsT>
static bool ObtainCacheStrandsVcol(Mesh * /*mesh*/, BL::Scene /*b_scene*/, BL::Object /*b_parent*/, BL::DupliObject /*b_dupli_ob*/, BL::ParticleSystem /*b_psys*/, StrandsT b_strands,
ParticleCurveData *CData, bool /*background*/, int vcol_num)
{
if(!(mesh && b_mesh && b_ob && CData))
return false;
CData->curve_vcol.clear();
BL::Object::modifiers_iterator b_mod;
for(b_ob->modifiers.begin(b_mod); b_mod != b_ob->modifiers.end(); ++b_mod) {
if((b_mod->type() == b_mod->type_PARTICLE_SYSTEM) && (background ? b_mod->show_render() : b_mod->show_viewport())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod->ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
if((b_part.render_type() == BL::ParticleSettings::render_type_PATH) && (b_part.type() == BL::ParticleSettings::type_HAIR)) {
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() : (int)((float)b_psys.child_particles.length() * (float)b_part.draw_percentage() / 100.0f);
int totcurves = totchild;
if(b_part.child_type() == 0)
totcurves += totparts;
if(totcurves == 0)
continue;
int pa_no = 0;
if(!(b_part.child_type() == 0))
pa_no = totparts;
int num_add = (totparts+totchild - pa_no);
CData->curve_vcol.reserve(CData->curve_vcol.size() + num_add);
BL::ParticleSystem::particles_iterator b_pa;
b_psys.particles.begin(b_pa);
for(; pa_no < totparts+totchild; pa_no++) {
/* Add vertex colors */
BL::Mesh::tessface_vertex_colors_iterator l;
b_mesh->tessface_vertex_colors.begin(l);
float3 vcol = make_float3(0.0f, 0.0f, 0.0f);
if(b_mesh->tessface_vertex_colors.length())
b_psys.mcol_on_emitter(psmd, *b_pa, pa_no, vcol_num, &vcol.x);
CData->curve_vcol.push_back(vcol);
if(pa_no < totparts && b_pa != b_psys.particles.end())
++b_pa;
}
}
}
typedef StrandsTraits<StrandsT> traits;
// BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
int totcurves = b_strands.curves.length();
CData->curve_vcol.reserve(CData->curve_vcol.size() + totcurves);
int icurve = 0;
for(; icurve < totcurves; ++icurve) {
CData->curve_vcol.push_back(traits::get_vcol(b_strands, icurve, vcol_num));
}
return true;
}
@@ -750,6 +873,39 @@ void ExportCurveTriangleUV(ParticleCurveData *CData, int vert_offset, int resol,
}
}
void ExportCurveUV(Mesh *mesh, ParticleCurveData *CData, ustring name, bool active_render, int primitive, int vert_offset, int resol)
{
AttributeStandard std = (active_render)? ATTR_STD_UV: ATTR_STD_NONE;
Attribute *attr_uv;
if(primitive == CURVE_TRIANGLES) {
if(active_render)
attr_uv = mesh->attributes.add(std, name);
else
attr_uv = mesh->attributes.add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CORNER);
float3 *uv = attr_uv->data_float3();
ExportCurveTriangleUV(CData, vert_offset, resol, uv);
}
else {
if(active_render)
attr_uv = mesh->curve_attributes.add(std, name);
else
attr_uv = mesh->curve_attributes.add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
float3 *uv = attr_uv->data_float3();
if(uv) {
size_t i = 0;
for(size_t curve = 0; curve < CData->curve_uv.size(); curve++)
if(!(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f))
uv[i++] = CData->curve_uv[curve];
}
}
}
void ExportCurveTriangleVcol(ParticleCurveData *CData, int vert_offset, int resol, uchar4 *cdata)
{
if(cdata == NULL)
@@ -782,6 +938,31 @@ void ExportCurveTriangleVcol(ParticleCurveData *CData, int vert_offset, int reso
}
}
void ExportCurveVcol(Mesh *mesh, ParticleCurveData *CData, ustring name, int primitive, int vert_offset, int resol)
{
if(primitive == CURVE_TRIANGLES) {
Attribute *attr_vcol = mesh->attributes.add(name, TypeDesc::TypeColor, ATTR_ELEMENT_CORNER_BYTE);
uchar4 *cdata = attr_vcol->data_uchar4();
ExportCurveTriangleVcol(CData, vert_offset, resol, cdata);
}
else {
Attribute *attr_vcol = mesh->curve_attributes.add(name, TypeDesc::TypeColor, ATTR_ELEMENT_CURVE);
float3 *fdata = attr_vcol->data_float3();
if(fdata) {
size_t i = 0;
for(size_t curve = 0; curve < CData->curve_vcol.size(); curve++)
if(!(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f))
fdata[i++] = color_srgb_to_scene_linear(CData->curve_vcol[curve]);
}
}
}
/* Hair Curve Sync */
void BlenderSync::sync_curve_settings()
@@ -856,8 +1037,61 @@ void BlenderSync::sync_curve_settings()
curve_system_manager->tag_update(scene);
}
void BlenderSync::sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool motion, int time_index)
struct CurvesPSysData {
CurvesPSysData(BL::ParticleSystemModifier b_psmd=PointerRNA_NULL, BL::ParticleSystem b_psys=PointerRNA_NULL,
BL::Strands b_strands=PointerRNA_NULL, BL::StrandsChildren b_strands_children=PointerRNA_NULL) :
b_psmd(b_psmd), b_psys(b_psys), b_strands(b_strands), b_strands_children(b_strands_children)
{}
BL::ParticleSystemModifier b_psmd;
BL::ParticleSystem b_psys;
BL::Strands b_strands;
BL::StrandsChildren b_strands_children;
};
static void curves_get_psys_data(std::vector<CurvesPSysData> &b_psys_list, BL::Scene b_scene, BL::Object b_ob, BL::Object b_parent, BL::DupliObject b_dupli_ob, bool preview)
{
BL::Object::modifiers_iterator b_mod;
for(b_ob.modifiers.begin(b_mod); b_mod != b_ob.modifiers.end(); ++b_mod) {
if((b_mod->type() == b_mod->type_PARTICLE_SYSTEM) && (preview ? b_mod->show_viewport() : b_mod->show_render())) {
BL::ParticleSystemModifier b_psmd((const PointerRNA)b_mod->ptr);
BL::ParticleSystem b_psys((const PointerRNA)b_psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
if((b_part.render_type() == BL::ParticleSettings::render_type_PATH) && (b_part.type() == BL::ParticleSettings::type_HAIR)) {
int settings = preview ? 1 : 2;
BL::StrandsChildren b_strands_children = PointerRNA_NULL;
BL::Strands b_strands = PointerRNA_NULL;
if (b_dupli_ob && b_parent) {
b_strands_children = b_dupli_ob.strands_children_new(b_scene, b_parent, b_psys, settings);
if (!b_strands_children)
b_strands = b_dupli_ob.strands_new(b_scene, b_parent, b_psys, settings);
}
b_psys_list.push_back(CurvesPSysData(b_psmd, b_psys, b_strands, b_strands_children));
}
}
}
}
static void curves_free_psys_data(std::vector<CurvesPSysData> &b_psys_list, BL::DupliObject b_dupli_ob)
{
/* free temporary strands data */
for (int i = 0; i < b_psys_list.size(); ++i) {
CurvesPSysData &psys_data = b_psys_list[i];
if (psys_data.b_strands)
b_dupli_ob.strands_free(psys_data.b_strands);
if (psys_data.b_strands_children)
b_dupli_ob.strands_children_free(psys_data.b_strands_children);
}
}
void BlenderSync::sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_parent, bool motion, int time_index, BL::DupliObject b_dupli_ob)
{
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
if(!motion) {
/* Clear stored curve data */
mesh->curve_keys.clear();
@@ -888,27 +1122,46 @@ void BlenderSync::sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool
if(!preview)
set_resolution(&b_ob, &b_scene, true);
ObtainCacheParticleData(mesh, &b_mesh, &b_ob, &CData, !preview);
Transform tfm = get_transform(b_ob.matrix_world());
Transform itfm = transform_quick_inverse(tfm);
/* obtain camera parameters */
float3 RotCam;
Camera *camera = scene->camera;
if(camera->type == CAMERA_ORTHOGRAPHIC) {
Transform &ctfm = camera->matrix;
RotCam = -make_float3(ctfm.x.z, ctfm.y.z, ctfm.z.z);
}
else {
Transform &ctfm = camera->matrix;
RotCam = transform_point(&itfm, make_float3(ctfm.x.w, ctfm.y.w, ctfm.z.w));
}
bool is_ortho_camera = camera->type == CAMERA_ORTHOGRAPHIC;
std::vector<CurvesPSysData> b_psys_list;
curves_get_psys_data(b_psys_list, b_scene, b_ob, b_parent, b_dupli_ob, preview);
for (int i = 0; i < b_psys_list.size(); ++i) {
CurvesPSysData &psys_data = b_psys_list[i];
if (psys_data.b_strands_children)
/* use child strands cache */
ObtainCacheStrandsData(mesh, b_scene, b_parent, b_dupli_ob, psys_data.b_psys, psys_data.b_strands_children,
itfm, &CData, !preview);
else if (psys_data.b_strands)
/* use parent strands cache */
ObtainCacheStrandsData(mesh, b_scene, b_parent, b_dupli_ob, psys_data.b_psys, psys_data.b_strands,
itfm, &CData, !preview);
else {
/* use object data */
ObtainCacheParticleData(mesh, b_ob, psys_data.b_psys,
itfm, &CData, !preview);
}
}
/* add hair geometry to mesh */
if(primitive == CURVE_TRIANGLES) {
if(triangle_method == CURVE_CAMERA_TRIANGLES) {
/* obtain camera parameters */
float3 RotCam;
Camera *camera = scene->camera;
Transform &ctfm = camera->matrix;
if(camera->type == CAMERA_ORTHOGRAPHIC) {
RotCam = -make_float3(ctfm.x.z, ctfm.y.z, ctfm.z.z);
}
else {
Transform tfm = get_transform(b_ob.matrix_world());
Transform itfm = transform_quick_inverse(tfm);
RotCam = transform_point(&itfm, make_float3(ctfm.x.w,
ctfm.y.w,
ctfm.z.w));
}
bool is_ortho = camera->type == CAMERA_ORTHOGRAPHIC;
ExportCurveTrianglePlanes(mesh, &CData, RotCam, is_ortho);
ExportCurveTrianglePlanes(mesh, &CData, RotCam, is_ortho_camera);
}
else {
ExportCurveTriangleGeometry(mesh, &CData, resolution);
@@ -955,33 +1208,31 @@ void BlenderSync::sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool
int vcol_num = 0;
for(b_mesh.tessface_vertex_colors.begin(l); l != b_mesh.tessface_vertex_colors.end(); ++l, vcol_num++) {
ustring name = ustring(l->name().c_str());
if(!mesh->need_attribute(scene, ustring(l->name().c_str())))
continue;
ObtainCacheParticleVcol(mesh, &b_mesh, &b_ob, &CData, !preview, vcol_num);
CData.curve_vcol.clear();
if(primitive == CURVE_TRIANGLES) {
Attribute *attr_vcol = mesh->attributes.add(
ustring(l->name().c_str()), TypeDesc::TypeColor, ATTR_ELEMENT_CORNER_BYTE);
uchar4 *cdata = attr_vcol->data_uchar4();
ExportCurveTriangleVcol(&CData, tri_num * 3, used_res, cdata);
}
else {
Attribute *attr_vcol = mesh->curve_attributes.add(
ustring(l->name().c_str()), TypeDesc::TypeColor, ATTR_ELEMENT_CURVE);
float3 *fdata = attr_vcol->data_float3();
if(fdata) {
size_t i = 0;
for(size_t curve = 0; curve < CData.curve_vcol.size(); curve++)
if(!(CData.curve_keynum[curve] <= 1 || CData.curve_length[curve] == 0.0f))
fdata[i++] = color_srgb_to_scene_linear(CData.curve_vcol[curve]);
for (int i = 0; i < b_psys_list.size(); ++i) {
CurvesPSysData &psys_data = b_psys_list[i];
if (psys_data.b_strands_children)
/* use child strands cache */
ObtainCacheStrandsVcol(mesh, b_scene, b_parent, b_dupli_ob, psys_data.b_psys, psys_data.b_strands_children,
&CData, !preview, vcol_num);
else if (psys_data.b_strands)
/* use parent strands cache */
ObtainCacheStrandsVcol(mesh, b_scene, b_parent, b_dupli_ob, psys_data.b_psys, psys_data.b_strands,
&CData, !preview, vcol_num);
else {
/* use object data */
ObtainCacheParticleVcol(mesh, b_ob, b_mesh, psys_data.b_psys, psys_data.b_psmd,
&CData, !preview, vcol_num);
}
}
ExportCurveVcol(mesh, &CData, name, primitive, tri_num * 3, used_res);
}
}
@@ -992,45 +1243,37 @@ void BlenderSync::sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool
for(b_mesh.tessface_uv_textures.begin(l); l != b_mesh.tessface_uv_textures.end(); ++l, uv_num++) {
bool active_render = l->active_render();
AttributeStandard std = (active_render)? ATTR_STD_UV: ATTR_STD_NONE;
ustring name = ustring(l->name().c_str());
/* UV map */
if(mesh->need_attribute(scene, name) || mesh->need_attribute(scene, std)) {
Attribute *attr_uv;
ObtainCacheParticleUV(mesh, &b_mesh, &b_ob, &CData, !preview, uv_num);
if(primitive == CURVE_TRIANGLES) {
if(active_render)
attr_uv = mesh->attributes.add(std, name);
else
attr_uv = mesh->attributes.add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CORNER);
float3 *uv = attr_uv->data_float3();
ExportCurveTriangleUV(&CData, tri_num * 3, used_res, uv);
}
if(!(mesh->need_attribute(scene, name) || (active_render && mesh->need_attribute(scene, ATTR_STD_UV))))
continue;
CData.curve_uv.clear();
for (int i = 0; i < b_psys_list.size(); ++i) {
CurvesPSysData &psys_data = b_psys_list[i];
if (psys_data.b_strands_children)
/* use child strands cache */
ObtainCacheStrandsUV(mesh, b_scene, b_parent, b_dupli_ob, psys_data.b_psys, psys_data.b_strands_children,
&CData, !preview, uv_num);
else if (psys_data.b_strands)
/* use parent strands cache */
ObtainCacheStrandsUV(mesh, b_scene, b_parent, b_dupli_ob, psys_data.b_psys, psys_data.b_strands,
&CData, !preview, uv_num);
else {
if(active_render)
attr_uv = mesh->curve_attributes.add(std, name);
else
attr_uv = mesh->curve_attributes.add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
float3 *uv = attr_uv->data_float3();
if(uv) {
size_t i = 0;
for(size_t curve = 0; curve < CData.curve_uv.size(); curve++)
if(!(CData.curve_keynum[curve] <= 1 || CData.curve_length[curve] == 0.0f))
uv[i++] = CData.curve_uv[curve];
}
/* use object data */
ObtainCacheParticleUV(mesh, b_ob, b_mesh, psys_data.b_psys, psys_data.b_psmd,
&CData, !preview, uv_num);
}
}
ExportCurveUV(mesh, &CData, name, active_render, primitive, tri_num * 3, used_res);
}
}
curves_free_psys_data(b_psys_list, b_dupli_ob);
if(!preview)
set_resolution(&b_ob, &b_scene, false);

View File

@@ -229,7 +229,13 @@ static void mikk_compute_tangents(BL::Mesh b_mesh, BL::MeshTextureFaceLayer *b_l
/* Create Volume Attribute */
static void create_mesh_volume_attribute(BL::Object b_ob, Mesh *mesh, ImageManager *image_manager, AttributeStandard std, float frame)
static void create_mesh_volume_attribute(BL::Object b_ob,
Mesh *mesh,
ImageManager *image_manager,
AttributeStandard std,
float frame,
AttributeStandard special_std = ATTR_STD_NONE,
bool from_alpha = false)
{
BL::SmokeDomainSettings b_domain = object_smoke_domain_find(b_ob);
@@ -240,17 +246,35 @@ static void create_mesh_volume_attribute(BL::Object b_ob, Mesh *mesh, ImageManag
VoxelAttribute *volume_data = attr->data_voxel();
bool is_float, is_linear;
bool animated = false;
AttributeStandard data_attr = (special_std == ATTR_STD_NONE) ? std : special_std;
volume_data->manager = image_manager;
volume_data->slot = image_manager->add_image(Attribute::standard_name(std),
volume_data->slot = image_manager->add_image(Attribute::standard_name(data_attr),
b_ob.ptr.data, animated, frame, is_float, is_linear, INTERPOLATION_LINEAR, true);
volume_data->from_alpha = from_alpha;
}
static void create_mesh_volume_attributes(Scene *scene, BL::Object b_ob, Mesh *mesh, float frame)
{
/* for smoke volume rendering */
if(mesh->need_attribute(scene, ATTR_STD_VOLUME_DENSITY))
create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_DENSITY, frame);
if(mesh->need_attribute(scene, ATTR_STD_VOLUME_DENSITY)) {
/* Special case: we re-map density to A channel of Color texture
* if both attributes are requested.
*/
AttributeStandard special_std = ATTR_STD_VOLUME_DENSITY;
bool from_alpha = false;
if(mesh->need_attribute(scene, ATTR_STD_VOLUME_COLOR)) {
special_std = ATTR_STD_VOLUME_COLOR;
from_alpha = true;
}
create_mesh_volume_attribute(b_ob,
mesh,
scene->image_manager,
ATTR_STD_VOLUME_DENSITY,
frame,
special_std,
from_alpha);
}
if(mesh->need_attribute(scene, ATTR_STD_VOLUME_COLOR))
create_mesh_volume_attribute(b_ob, mesh, scene->image_manager, ATTR_STD_VOLUME_COLOR, frame);
if(mesh->need_attribute(scene, ATTR_STD_VOLUME_FLAME))
@@ -422,6 +446,52 @@ static void attr_create_pointiness(Scene *scene,
}
}
/* Create vertex custom attributes. */
static void attr_create_vertex_properties(Scene *scene,
Mesh *mesh,
BL::Mesh b_mesh)
{
{
BL::Mesh::vertex_layers_float_iterator l;
for(b_mesh.vertex_layers_float.begin(l); l != b_mesh.vertex_layers_float.end(); ++l) {
if(!mesh->need_attribute(scene, ustring(l->name().c_str())))
continue;
Attribute *attr = mesh->attributes.add(
ustring(l->name().c_str()), TypeDesc::TypeFloat, ATTR_ELEMENT_VERTEX);
BL::MeshVertexFloatPropertyLayer::data_iterator d;
float *data = attr->data_float();
size_t i = 0;
for(l->data.begin(d); d != l->data.end(); ++d, ++i) {
*data = d->value();
data += 1;
}
}
}
{
BL::Mesh::vertex_layers_int_iterator l;
for(b_mesh.vertex_layers_int.begin(l); l != b_mesh.vertex_layers_int.end(); ++l) {
if(!mesh->need_attribute(scene, ustring(l->name().c_str())))
continue;
Attribute *attr = mesh->attributes.add(
ustring(l->name().c_str()), TypeDesc::TypeFloat, ATTR_ELEMENT_VERTEX);
BL::MeshVertexIntPropertyLayer::data_iterator d;
float *data = attr->data_float();
size_t i = 0;
for(l->data.begin(d); d != l->data.end(); ++d, ++i) {
*data = (float)d->value();
data += 1;
}
}
}
}
/* Create Mesh */
static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<uint>& used_shaders)
@@ -528,6 +598,7 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
*/
attr_create_vertex_color(scene, mesh, b_mesh, nverts);
attr_create_uv_map(scene, mesh, b_mesh, nverts);
attr_create_vertex_properties(scene, mesh, b_mesh);
/* for volume objects, create a matrix to transform from object space to
* mesh texture space. this does not work with deformations but that can
@@ -587,8 +658,10 @@ static void create_subd_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, PointerR
/* Sync */
Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris)
Mesh *BlenderSync::sync_mesh(BL::Object b_parent, bool object_updated, bool hide_tris, BL::DupliObject b_dupli_ob)
{
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
/* When viewport display is not needed during render we can force some
* caches to be releases from blender side in order to reduce peak memory
* footprint during synchronization process.
@@ -599,7 +672,6 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
/* test if we can instance or if the object is modified */
BL::ID b_ob_data = b_ob.data();
BL::ID key = (BKE_object_is_modified(b_ob))? b_ob: b_ob_data;
BL::Material material_override = render_layer.material_override;
/* find shader indices */
@@ -630,7 +702,24 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
}
Mesh *mesh;
if(!mesh_map.sync(&mesh, key)) {
bool need_update;
BL::CacheLibrary b_cachelib = b_parent.cache_library();
bool use_dupli_override = b_dupli_ob && b_cachelib &&
(b_cachelib.source_mode() == BL::CacheLibrary::source_mode_CACHE ||
b_cachelib.display_mode() == BL::CacheLibrary::display_mode_RESULT);
if (use_dupli_override) {
/* if a dupli override (cached data) is used, identify the mesh by object and parent together,
* so that individual per-dupli overrides are possible.
*/
MeshKey key = MeshKey(b_parent, b_ob);
need_update = mesh_map.sync(&mesh, b_ob, b_parent, key);
}
else {
BL::ID key = (BKE_object_is_modified(b_ob))? b_ob: b_ob_data;
need_update = mesh_map.sync(&mesh, key);
}
if(!need_update) {
/* if transform was applied to mesh, need full update */
if(object_updated && mesh->transform_applied);
/* test if shaders changed, these can be object level so mesh
@@ -681,7 +770,9 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
b_ob.update_from_editmode();
bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED);
BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, need_undeformed);
BL::Mesh b_mesh = (use_dupli_override)?
dupli_to_mesh(b_data, b_scene, b_parent, b_dupli_ob, !preview, need_undeformed):
object_to_mesh(b_data, b_ob, b_scene, true, !preview, need_undeformed);
if(b_mesh) {
if(render_layer.use_surfaces && !hide_tris) {
@@ -694,10 +785,10 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
}
if(render_layer.use_hair)
sync_curves(mesh, b_mesh, b_ob, false);
sync_curves(mesh, b_mesh, b_parent, false, 0, b_dupli_ob);
if(can_free_caches) {
b_ob.cache_release();
b_ob.cache_release(false);
}
/* free derived mesh */
@@ -740,8 +831,9 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri
return mesh;
}
void BlenderSync::sync_mesh_motion(BL::Object b_ob, Object *object, float motion_time)
void BlenderSync::sync_mesh_motion(BL::Object b_parent, Object *object, float motion_time, BL::DupliObject b_dupli_ob)
{
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
/* ensure we only sync instanced meshes once */
Mesh *mesh = object->mesh;
@@ -800,7 +892,9 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Object *object, float motion
if(ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
/* get derived mesh */
b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, false);
b_mesh = (b_dupli_ob && b_parent)?
dupli_to_mesh(b_data, b_scene, b_parent, b_dupli_ob, !preview, false):
object_to_mesh(b_data, b_ob, b_scene, true, !preview, false);
}
if(!b_mesh) {
@@ -890,7 +984,7 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Object *object, float motion
/* hair motion */
if(numkeys)
sync_curves(mesh, b_mesh, b_ob, true, time_index);
sync_curves(mesh, b_mesh, b_parent, true, time_index, b_dupli_ob);
/* free derived mesh */
b_data.meshes.remove(b_mesh);

View File

@@ -234,8 +234,53 @@ void BlenderSync::sync_background_light(bool use_portal)
/* Object */
Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
Transform& tfm, uint layer_flag, float motion_time, bool hide_tris, bool *use_portal)
static bool object_boundbox_clip(Scene *scene,
BL::Object b_ob,
Transform& tfm,
float margin)
{
Camera *cam = scene->camera;
Transform& worldtondc = cam->worldtondc;
BL::Array<float, 24> boundbox = b_ob.bound_box();
float3 bb_min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX),
bb_max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
bool all_behind = true;
for(int i = 0; i < 8; ++i) {
float3 p = make_float3(boundbox[3 * i + 0],
boundbox[3 * i + 1],
boundbox[3 * i + 2]);
p = transform_point(&tfm, p);
p = transform_point(&worldtondc, p);
if(p.z >= -margin) {
all_behind = false;
}
p /= p.z;
bb_min = min(bb_min, p);
bb_max = max(bb_max, p);
}
if(!all_behind) {
if(bb_min.x >= 1.0f + margin ||
bb_min.y >= 1.0f + margin ||
bb_max.x <= -margin ||
bb_max.y <= -margin)
{
return true;
}
return false;
}
return true;
}
Object *BlenderSync::sync_object(BL::Object b_parent,
int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
BL::DupliObject b_dupli_ob,
Transform& tfm,
uint layer_flag,
float motion_time,
bool hide_tris,
bool use_camera_cull,
float camera_cull_margin,
bool *use_portal)
{
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
bool motion = motion_time != 0.0f;
@@ -253,6 +298,11 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P
if(!object_is_mesh(b_ob))
return NULL;
/* Perform camera space culling. */
if(use_camera_cull && object_boundbox_clip(scene, b_ob, tfm, camera_cull_margin)) {
return NULL;
}
/* key to lookup object */
ObjectKey key(b_parent, persistent_id, b_ob);
Object *object;
@@ -279,7 +329,7 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P
/* mesh deformation */
if(object->mesh)
sync_mesh_motion(b_ob, object, motion_time);
sync_mesh_motion(b_parent, object, motion_time, b_dupli_ob);
}
return object;
@@ -294,7 +344,10 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P
bool use_holdout = (layer_flag & render_layer.holdout_layer) != 0;
/* mesh sync */
object->mesh = sync_mesh(b_ob, object_updated, hide_tris);
if (b_dupli_ob)
object->mesh = sync_mesh(b_parent, object_updated, hide_tris, b_dupli_ob);
else
object->mesh = sync_mesh(b_ob, object_updated, hide_tris);
/* special case not tracked by object update flags */
@@ -480,6 +533,15 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
mesh_motion_synced.clear();
}
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
bool allow_camera_cull = scene->camera->type != CAMERA_PANORAMA &&
!b_scene.render().use_multiview() &&
get_boolean(cscene, "use_camera_cull");
float camera_cull_margin = 0.0f;
if(allow_camera_cull) {
camera_cull_margin = get_float(cscene, "camera_cull_margin");
}
/* object loop */
BL::Scene::object_bases_iterator b_base;
BL::Scene b_sce = b_scene;
@@ -502,6 +564,12 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
if(!hide) {
progress.set_sync_status("Synchronizing object", b_ob.name());
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
bool use_camera_cull = allow_camera_cull && get_boolean(cobject, "use_camera_cull");
if(use_camera_cull) {
/* Need to have proper projection matrix. */
scene->camera->update();
}
if(b_ob.is_duplicator() && !object_render_hide_duplis(b_ob)) {
/* dupli objects */
b_ob.dupli_list_create(b_scene, dupli_settings);
@@ -521,7 +589,16 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup->persistent_id();
/* sync object and mesh or light data */
Object *object = sync_object(b_ob, persistent_id.data, *b_dup, tfm, ob_layer, motion_time, hide_tris, &use_portal);
Object *object = sync_object(b_ob,
persistent_id.data,
*b_dup,
tfm,
ob_layer,
motion_time,
hide_tris,
use_camera_cull,
camera_cull_margin,
&use_portal);
/* sync possible particle data, note particle_id
* starts counting at 1, first is dummy particle */
@@ -541,7 +618,16 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, float motion_time)
if(!object_render_hide(b_ob, true, true, hide_tris)) {
/* object itself */
Transform tfm = get_transform(b_ob.matrix_world());
sync_object(b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, motion_time, hide_tris, &use_portal);
sync_object(b_ob,
NULL,
PointerRNA_NULL,
tfm,
ob_layer,
motion_time,
hide_tris,
use_camera_cull,
camera_cull_margin,
&use_portal);
}
}

View File

@@ -101,7 +101,8 @@ void BlenderSession::create_session()
start_resize_time = 0.0;
/* create scene */
scene = new Scene(scene_params, session_params.device);
bool free_data_after_update = background && !scene_params.persistent_data;
scene = new Scene(scene_params, session_params.device, free_data_after_update);
/* setup callbacks for builtin image support */
scene->image_manager->builtin_image_info_cb = function_bind(&BlenderSession::builtin_image_info, this, _1, _2, _3, _4, _5, _6, _7);
@@ -413,6 +414,7 @@ void BlenderSession::render()
/* set callback to write out render results */
session->write_render_tile_cb = function_bind(&BlenderSession::write_render_tile, this, _1);
session->update_render_tile_cb = function_bind(&BlenderSession::update_render_tile, this, _1);
session->clear_database_cb = function_bind(&BlenderSession::clear_blender_database, this);
/* get buffer parameters */
SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, background);
@@ -511,6 +513,7 @@ void BlenderSession::render()
/* clear callback */
session->write_render_tile_cb = function_null;
session->update_render_tile_cb = function_null;
session->clear_database_cb = function_null;
/* free all memory used (host and device), so we wouldn't leave render
* engine with extra memory allocated
@@ -1012,6 +1015,18 @@ void BlenderSession::builtin_image_info(const string &builtin_name, void *builti
is_float = true;
}
else {
/* TODO(sergey): Check we're indeed in shader node tree. */
PointerRNA ptr;
RNA_pointer_create(NULL, &RNA_Node, builtin_data, &ptr);
BL::Node b_node(ptr);
if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
channels = 4;
width = height = depth = b_point_density_node.resolution();
is_float = true;
}
}
}
bool BlenderSession::builtin_image_pixels(const string &builtin_name, void *builtin_data, unsigned char *pixels)
@@ -1154,9 +1169,41 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void
fprintf(stderr, "Cycles error: unexpected smoke volume resolution, skipping\n");
}
else {
/* TODO(sergey): Check we're indeed in shader node tree. */
PointerRNA ptr;
RNA_pointer_create(NULL, &RNA_Node, builtin_data, &ptr);
BL::Node b_node(ptr);
if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
int length;
b_point_density_node.calc_point_density(b_scene, &length, &pixels);
}
}
return false;
}
void BlenderSession::clear_blender_database()
{
const bool is_interface_locked = b_engine.render() &&
b_engine.render().use_lock_interface();
const bool can_free_database = BlenderSession::headless || is_interface_locked;
if(!can_free_database) {
/* Database might be used by the interface, can not free it at all. */
return;
}
for(BL::Scene b_sce = b_scene; b_sce; b_sce = b_sce.background_set()) {
BL::Scene::object_bases_iterator b_base;
for(b_sce.object_bases.begin(b_base);
b_base != b_sce.object_bases.end();
++b_base)
{
BL::Object b_ob = b_base->object();
b_ob.cache_release(true);
}
}
}
CCL_NAMESPACE_END

View File

@@ -109,6 +109,8 @@ protected:
void builtin_image_info(const string &builtin_name, void *builtin_data, bool &is_float, int &width, int &height, int &depth, int &channels);
bool builtin_image_pixels(const string &builtin_name, void *builtin_data, unsigned char *pixels);
bool builtin_image_float_pixels(const string &builtin_name, void *builtin_data, float *pixels);
void clear_blender_database();
};
CCL_NAMESPACE_END

View File

@@ -22,6 +22,7 @@
#include "scene.h"
#include "shader.h"
#include "blender_texture.h"
#include "blender_sync.h"
#include "blender_util.h"
@@ -736,6 +737,62 @@ static ShaderNode *add_node(Scene *scene,
uvm->from_dupli = b_uvmap_node.from_dupli();
node = uvm;
}
else if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
PointDensityTextureNode *point_density = new PointDensityTextureNode();
point_density->filename = b_point_density_node.name();
point_density->space =
PointDensityTextureNode::space_enum[(int)b_point_density_node.space()];
point_density->interpolation =
(InterpolationType)b_point_density_node.interpolation();
point_density->builtin_data = b_point_density_node.ptr.data;
/* Transformation form world space to texture space. */
BL::Object b_ob(b_point_density_node.object());
if(b_ob) {
float3 loc, size;
point_density_texture_space(b_point_density_node, loc, size);
point_density->tfm =
transform_translate(-loc) * transform_scale(size) *
transform_inverse(get_transform(b_ob.matrix_world()));
}
/* TODO(sergey): Use more proper update flag. */
if(true) {
scene->image_manager->tag_reload_image(point_density->filename,
point_density->builtin_data,
point_density->interpolation);
}
node = point_density;
}
else if(b_node.is_a(&RNA_ShaderNodeOpenVDB)) {
BL::ShaderNodeOpenVDB b_vdb_node(b_node);
OpenVDBNode *vdb_node = new OpenVDBNode();
vdb_node->filename = b_vdb_node.filename();
vdb_node->sampling = b_vdb_node.sampling();
/* TODO(kevin) */
if(b_vdb_node.source() == 1) {
string filename = b_vdb_node.filename();
string basename = filename.substr(0, filename.size() - 8);
stringstream ss;
ss << b_scene.frame_current();
string frame = ss.str();
frame.insert(frame.begin(), 4 - frame.size(), '0');
vdb_node->filename = ustring::format("%s%s.vdb", basename, frame);
}
BL::Node::outputs_iterator b_output;
for(b_vdb_node.outputs.begin(b_output); b_output != b_vdb_node.outputs.end(); ++b_output) {
vdb_node->output_names.push_back(ustring(b_output->name()));
vdb_node->add_output(vdb_node->output_names.back().c_str(),
convert_socket_type(*b_output));
}
node = vdb_node;
}
if(node)
graph->add(node);

View File

@@ -435,6 +435,8 @@ SceneParams BlenderSync::get_scene_params(BL::Scene b_scene, bool background, bo
params.use_qbvh = false;
}
params.use_bvh_triangle_storage = RNA_boolean_get(&cscene, "debug_use_triangle_storage");
return params;
}

View File

@@ -83,13 +83,22 @@ private:
void sync_curve_settings();
void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris);
void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool motion, int time_index = 0);
Object *sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob,
Transform& tfm, uint layer_flag, float motion_time, bool hide_tris, bool *use_portal);
Mesh *sync_mesh(BL::Object b_parent, bool object_updated, bool hide_tris, BL::DupliObject b_dupli_ob = PointerRNA_NULL);
void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_parent, bool motion, int time_index = 0, BL::DupliObject b_dupli_ob = PointerRNA_NULL);
Object *sync_object(BL::Object b_parent,
int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
BL::DupliObject b_dupli_ob,
Transform& tfm,
uint layer_flag,
float motion_time,
bool hide_tris,
bool use_camera_cull,
float camera_cull_margin,
bool *use_portal);
void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm, bool *use_portal);
void sync_background_light(bool use_portal);
void sync_mesh_motion(BL::Object b_ob, Object *object, float motion_time);
void sync_mesh_motion(BL::Object b_parent, Object *object, float motion_time, BL::DupliObject b_dupli_ob = PointerRNA_NULL);
void sync_camera_motion(BL::Object b_ob, float motion_time);
/* particles */
@@ -111,7 +120,7 @@ private:
id_map<void*, Shader> shader_map;
id_map<ObjectKey, Object> object_map;
id_map<void*, Mesh> mesh_map;
id_map<MeshKey, Mesh> mesh_map;
id_map<ObjectKey, Light> light_map;
id_map<ParticleSystemKey, ParticleSystem> particle_system_map;
set<Mesh*> mesh_synced;

View File

@@ -0,0 +1,116 @@
/*
* Copyright 2011-2015 Blender Foundation
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "blender_texture.h"
CCL_NAMESPACE_BEGIN
namespace {
/* Point density helpers. */
static void density_texture_space_invert(float3& loc,
float3& size)
{
if(size.x != 0.0f) size.x = 0.5f/size.x;
if(size.y != 0.0f) size.y = 0.5f/size.y;
if(size.z != 0.0f) size.z = 0.5f/size.z;
loc = loc*size - make_float3(0.5f, 0.5f, 0.5f);
}
static void density_object_texture_space(BL::Object b_ob,
float radius,
float3& loc,
float3& size)
{
if(b_ob.type() == BL::Object::type_MESH) {
BL::Mesh b_mesh(b_ob.data());
loc = get_float3(b_mesh.texspace_location());
size = get_float3(b_mesh.texspace_size());
}
else {
/* TODO(sergey): Not supported currently. */
}
/* Adjust texture space to include density points on the boundaries. */
size = size + make_float3(radius, radius, radius);
density_texture_space_invert(loc, size);
}
static void density_particle_system_texture_space(
BL::Object b_ob,
BL::ParticleSystem b_particle_system,
float radius,
float3& loc,
float3& size)
{
if(b_particle_system.settings().type() == BL::ParticleSettings::type_HAIR) {
/* TODO(sergey): Not supported currently. */
return;
}
Transform tfm = get_transform(b_ob.matrix_world());
Transform itfm = transform_inverse(tfm);
float3 min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX),
max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);
float3 particle_size = make_float3(radius, radius, radius);
for(int i = 0; i < b_particle_system.particles.length(); ++i) {
BL::Particle particle = b_particle_system.particles[i];
float3 location = get_float3(particle.location());
location = transform_point(&itfm, location);
min = ccl::min(min, location - particle_size);
max = ccl::max(max, location + particle_size);
}
/* Calculate texture space from the particle bounds. */
loc = (min + max) * 0.5f;
size = (max - min) * 0.5f;
density_texture_space_invert(loc, size);
}
} /* namespace */
void point_density_texture_space(BL::ShaderNodeTexPointDensity b_point_density_node,
float3& loc,
float3& size)
{
/* Fallback values. */
loc = make_float3(0.0f, 0.0f, 0.0f);
size = make_float3(0.0f, 0.0f, 0.0f);
BL::Object b_ob(b_point_density_node.object());
if(!b_ob) {
return;
}
if(b_point_density_node.point_source() ==
BL::ShaderNodeTexPointDensity::point_source_PARTICLE_SYSTEM)
{
BL::ParticleSystem b_particle_system(
b_point_density_node.particle_system());
if(b_particle_system) {
density_particle_system_texture_space(b_ob,
b_particle_system,
b_point_density_node.radius(),
loc,
size);
}
}
else {
density_object_texture_space(b_ob,
b_point_density_node.radius(),
loc,
size);
}
}
CCL_NAMESPACE_END

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2011-2015 Blender Foundation
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __BLENDER_TEXTURE_H__
#define __BLENDER_TEXTURE_H__
#include <stdlib.h>
#include "blender_sync.h"
CCL_NAMESPACE_BEGIN
void point_density_texture_space(BL::ShaderNodeTexPointDensity b_point_density_node,
float3& loc,
float3& size);
CCL_NAMESPACE_END
#endif /* __BLENDER_TEXTURE_H__ */

View File

@@ -52,6 +52,18 @@ static inline BL::Mesh object_to_mesh(BL::BlendData data, BL::Object object, BL:
return me;
}
static inline BL::Mesh dupli_to_mesh(BL::BlendData data, BL::Scene scene, BL::Object parent, BL::DupliObject dob, bool render, bool calc_undeformed)
{
BL::Mesh me = data.meshes.new_from_dupli(scene, parent, dob, (render)? 2: 1, false, calc_undeformed);
if ((bool)me) {
if (me.use_auto_smooth()) {
me.calc_normals_split();
}
me.calc_tessface(true);
}
return me;
}
static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)
{
for(int i = 0; i < size; i++) {
@@ -586,6 +598,36 @@ struct ObjectKey {
}
};
/* Mesh Key */
struct MeshKey {
void *parent;
void *mesh;
MeshKey(void *mesh_)
: parent(NULL), mesh(mesh_)
{
}
MeshKey(void *parent_, void *mesh_)
: parent(parent_), mesh(mesh_)
{
}
bool operator<(const MeshKey& k) const
{
if(mesh < k.mesh) {
return true;
}
else if(mesh == k.mesh) {
return parent < k.parent;
return true;
}
return false;
}
};
/* Particle System Key */
struct ParticleSystemKey {

View File

@@ -278,27 +278,33 @@ void BVH::pack_triangle(int idx, float4 woop[3])
void BVH::pack_primitives()
{
int nsize = TRI_NODE_SIZE;
const int nsize = TRI_NODE_SIZE;
const bool use_triangle_storage = params.use_triangle_storage;
size_t tidx_size = pack.prim_index.size();
pack.tri_woop.clear();
pack.tri_woop.resize(tidx_size * nsize);
if (use_triangle_storage) {
pack.tri_woop.resize(tidx_size * nsize);
}
else {
pack.tri_woop.resize(0);
}
pack.prim_visibility.clear();
pack.prim_visibility.resize(tidx_size);
for(unsigned int i = 0; i < tidx_size; i++) {
if(pack.prim_index[i] != -1) {
float4 woop[3];
if(pack.prim_type[i] & PRIMITIVE_TRIANGLE) {
pack_triangle(i, woop);
if(use_triangle_storage) {
float4 woop[3];
if(pack.prim_type[i] & PRIMITIVE_TRIANGLE) {
pack_triangle(i, woop);
}
else {
/* Avoid use of uninitialized memory. */
memset(&woop, 0, sizeof(woop));
}
memcpy(&pack.tri_woop[i * nsize], woop, sizeof(float4)*3);
}
else {
/* Avoid use of uninitialized memory. */
memset(&woop, 0, sizeof(woop));
}
memcpy(&pack.tri_woop[i * nsize], woop, sizeof(float4)*3);
int tob = pack.prim_object[i];
Object *ob = objects[tob];
@@ -308,7 +314,9 @@ void BVH::pack_primitives()
pack.prim_visibility[i] |= PATH_RAY_CURVE;
}
else {
memset(&pack.tri_woop[i * nsize], 0, sizeof(float4)*3);
if(use_triangle_storage) {
memset(&pack.tri_woop[i * nsize], 0, sizeof(float4)*3);
}
pack.prim_visibility[i] = 0;
}
}

View File

@@ -49,6 +49,9 @@ public:
/* QBVH */
bool use_qbvh;
/* Use pre-aligned tringle storage for faster lookup. */
bool use_triangle_storage;
/* fixed parameters */
enum {
MAX_DEPTH = 64,
@@ -73,6 +76,7 @@ public:
top_level = false;
use_cache = false;
use_qbvh = false;
use_triangle_storage = true;
}
/* SAH costs */

View File

@@ -30,7 +30,7 @@ if(NOT CYCLES_STANDALONE_REPOSITORY)
set(GLEW_INCLUDE_DIR "${GLEW_INCLUDE_PATH}")
endif()
if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
if(WITH_CYCLES_STANDALONE)
set(CYCLES_APP_GLEW_LIBRARY ${BLENDER_GLEW_LIBRARIES})
endif()

View File

@@ -115,6 +115,7 @@ set(SRC_SVM_HEADERS
svm/svm_noise.h
svm/svm_noisetex.h
svm/svm_normal.h
svm/svm_openvdb.h
svm/svm_ramp.h
svm/svm_sepcomb_hsv.h
svm/svm_sepcomb_vector.h
@@ -125,6 +126,7 @@ set(SRC_SVM_HEADERS
svm/svm_value.h
svm/svm_vector_transform.h
svm/svm_voronoi.h
svm/svm_voxel.h
svm/svm_wave.h
)

View File

@@ -119,9 +119,19 @@ ccl_device_inline bool triangle_intersect(KernelGlobals *kg,
const float Sz = isect_precalc->Sz;
/* Calculate vertices relative to ray origin. */
const float4 tri_a = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+0),
tri_b = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+1),
tri_c = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+2);
float4 tri_a, tri_b, tri_c;
if (kernel_data.bvh.use_tri_storage) {
tri_a = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+0);
tri_b = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+1);
tri_c = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+2);
}
else {
const int prim = kernel_tex_fetch(__prim_index, triAddr);
const float4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
tri_a = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x));
tri_b = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y));
tri_c = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.z));
}
const float3 A = make_float3(tri_a.x - P.x, tri_a.y - P.y, tri_a.z - P.z);
const float3 B = make_float3(tri_b.x - P.x, tri_b.y - P.y, tri_b.z - P.z);
const float3 C = make_float3(tri_c.x - P.x, tri_c.y - P.y, tri_c.z - P.z);
@@ -212,9 +222,19 @@ ccl_device_inline void triangle_intersect_subsurface(
const float Sz = isect_precalc->Sz;
/* Calculate vertices relative to ray origin. */
const float4 tri_a = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+0),
tri_b = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+1),
tri_c = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+2);
float4 tri_a, tri_b, tri_c;
if (kernel_data.bvh.use_tri_storage) {
tri_a = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+0);
tri_b = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+1);
tri_c = kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+2);
}
else {
const int prim = kernel_tex_fetch(__prim_index, triAddr);
const float4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
tri_a = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x));
tri_b = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y));
tri_c = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.z));
}
const float3 A = make_float3(tri_a.x - P.x, tri_a.y - P.y, tri_a.z - P.z);
const float3 B = make_float3(tri_b.x - P.x, tri_b.y - P.y, tri_b.z - P.z);
const float3 C = make_float3(tri_c.x - P.x, tri_c.y - P.y, tri_c.z - P.z);
@@ -327,9 +347,19 @@ ccl_device_inline float3 triangle_refine(KernelGlobals *kg,
P = P + D*t;
const float4 tri_a = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+0),
tri_b = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+1),
tri_c = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+2);
float4 tri_a, tri_b, tri_c;
if (kernel_data.bvh.use_tri_storage) {
tri_a = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+0);
tri_b = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+1);
tri_c = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+2);
}
else {
const int prim = kernel_tex_fetch(__prim_index, isect->prim);
const float4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
tri_a = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x));
tri_b = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y));
tri_c = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.z));
}
float3 edge1 = make_float3(tri_a.x - tri_c.x, tri_a.y - tri_c.y, tri_a.z - tri_c.z);
float3 edge2 = make_float3(tri_b.x - tri_c.x, tri_b.y - tri_c.y, tri_b.z - tri_c.z);
float3 tvec = make_float3(P.x - tri_c.x, P.y - tri_c.y, P.z - tri_c.z);
@@ -384,9 +414,19 @@ ccl_device_inline float3 triangle_refine_subsurface(KernelGlobals *kg,
P = P + D*t;
const float4 tri_a = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+0),
tri_b = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+1),
tri_c = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+2);
float4 tri_a, tri_b, tri_c;
if (kernel_data.bvh.use_tri_storage) {
tri_a = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+0);
tri_b = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+1);
tri_c = kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+2);
}
else {
const int prim = kernel_tex_fetch(__prim_index, isect->prim);
const float4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
tri_a = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x));
tri_b = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y));
tri_c = kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.z));
}
float3 edge1 = make_float3(tri_a.x - tri_c.x, tri_a.y - tri_c.y, tri_a.z - tri_c.z);
float3 edge2 = make_float3(tri_b.x - tri_c.x, tri_b.y - tri_c.y, tri_b.z - tri_c.z);
float3 tvec = make_float3(P.x - tri_c.x, P.y - tri_c.y, P.z - tri_c.z);

View File

@@ -53,17 +53,21 @@ ccl_device float volume_attribute_float(KernelGlobals *kg, const ShaderData *sd,
float4 r = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
#else
float4 r;
int slot = id >> 1;
if(sd->flag & SD_VOLUME_CUBIC)
r = kernel_tex_image_interp_3d_ex(id, P.x, P.y, P.z, INTERPOLATION_CUBIC);
r = kernel_tex_image_interp_3d_ex(slot, P.x, P.y, P.z, INTERPOLATION_CUBIC);
else
r = kernel_tex_image_interp_3d(id, P.x, P.y, P.z);
r = kernel_tex_image_interp_3d(slot, P.x, P.y, P.z);
#endif
if(dx) *dx = 0.0f;
if(dy) *dy = 0.0f;
/* todo: support float textures to lower memory usage for single floats */
return average(float4_to_float3(r));
if(id & 1)
return r.w;
else
return average(float4_to_float3(r));
}
ccl_device float3 volume_attribute_float3(KernelGlobals *kg, const ShaderData *sd, AttributeElement elem, int id, float3 *dx, float3 *dy)
@@ -73,16 +77,20 @@ ccl_device float3 volume_attribute_float3(KernelGlobals *kg, const ShaderData *s
float4 r = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
#else
float4 r;
int slot = id >> 1;
if(sd->flag & SD_VOLUME_CUBIC)
r = kernel_tex_image_interp_3d_ex(id, P.x, P.y, P.z, INTERPOLATION_CUBIC);
r = kernel_tex_image_interp_3d_ex(slot, P.x, P.y, P.z, INTERPOLATION_CUBIC);
else
r = kernel_tex_image_interp_3d(id, P.x, P.y, P.z);
r = kernel_tex_image_interp_3d(slot, P.x, P.y, P.z);
#endif
if(dx) *dx = make_float3(0.0f, 0.0f, 0.0f);
if(dy) *dy = make_float3(0.0f, 0.0f, 0.0f);
return float4_to_float3(r);
if(id & 1)
return make_float3(r.w, r.w, r.w);
else
return float4_to_float3(r);
}
#endif

View File

@@ -40,6 +40,8 @@
#include "util_simd.h"
#include "util_half.h"
#include "util_types.h"
#include "util_openvdb.h"
#include "util_vector.h"
#define ccl_addr_space
@@ -416,6 +418,8 @@ typedef texture_image<uchar4> texture_image_uchar4;
#define kernel_tex_image_interp(tex, x, y) ((tex < MAX_FLOAT_IMAGES) ? kg->texture_float_images[tex].interp(x, y) : kg->texture_byte_images[tex - MAX_FLOAT_IMAGES].interp(x, y))
#define kernel_tex_image_interp_3d(tex, x, y, z) ((tex < MAX_FLOAT_IMAGES) ? kg->texture_float_images[tex].interp_3d(x, y, z) : kg->texture_byte_images[tex - MAX_FLOAT_IMAGES].interp_3d(x, y, z))
#define kernel_tex_image_interp_3d_ex(tex, x, y, z, interpolation) ((tex < MAX_FLOAT_IMAGES) ? kg->texture_float_images[tex].interp_3d_ex(x, y, z, interpolation) : kg->texture_byte_images[tex - MAX_FLOAT_IMAGES].interp_3d_ex(x, y, z, interpolation))
#define kernel_tex_voxel_float(tex, x, y, z, sampling) (kg->float_volumes[tex]->sample(x, y, z, sampling))
#define kernel_tex_voxel_float3(tex, x, y, z, sampling) (kg->float3_volumes[tex]->sample(x, y, z, sampling))
#define kernel_data (kg->__data)

View File

@@ -33,11 +33,15 @@ struct OSLShadingSystem;
#define MAX_BYTE_IMAGES 1024
#define MAX_FLOAT_IMAGES 1024
#define MAX_VOLUME 1024
typedef struct KernelGlobals {
texture_image_uchar4 texture_byte_images[MAX_BYTE_IMAGES];
texture_image_float4 texture_float_images[MAX_FLOAT_IMAGES];
float_volume *float_volumes[MAX_VOLUME];
float3_volume *float3_volumes[MAX_VOLUME];
#define KERNEL_TEX(type, ttype, name) ttype name;
#define KERNEL_IMAGE_TEX(type, ttype, name)
#include "kernel_textures.h"

View File

@@ -67,6 +67,9 @@ CCL_NAMESPACE_BEGIN
#ifdef WITH_OSL
#define __OSL__
#endif
#ifdef WITH_OPENVDB
#define __OPENVDB__
#endif
#define __SUBSURFACE__
#define __CMJ__
#define __VOLUME__
@@ -952,7 +955,8 @@ typedef struct KernelBVH {
int have_curves;
int have_instancing;
int use_qbvh;
int pad1, pad2;
int use_tri_storage;
int pad1;
} KernelBVH;
typedef enum CurveFlag {
@@ -976,7 +980,8 @@ typedef struct KernelCurves {
typedef struct KernelTables {
int beckmann_offset;
int pad1, pad2, pad3;
int num_volumes;
int density_index, pad2;
} KernelTables;
typedef struct KernelData {

View File

@@ -21,7 +21,8 @@ CCL_NAMESPACE_BEGIN
typedef enum VolumeIntegrateResult {
VOLUME_PATH_SCATTERED = 0,
VOLUME_PATH_ATTENUATED = 1,
VOLUME_PATH_MISSED = 2
VOLUME_PATH_MISSED = 2,
VOLUME_PATH_CONTINUE = 3,
} VolumeIntegrateResult;
/* Volume shader properties
@@ -161,6 +162,38 @@ ccl_device void kernel_volume_shadow_homogeneous(KernelGlobals *kg, PathState *s
*throughput *= volume_color_transmittance(sigma_t, ray->t);
}
ccl_device_inline bool kernel_volume_integrate_shadow_ray(
KernelGlobals *kg, PathState *state, Ray *ray, ShaderData *sd,
float3 *tp, float t, float new_t, float random_jitter_offset,
float3 *sum, float tp_eps, int i)
{
float dt = new_t - t;
/* use random position inside this segment to sample shader */
if(new_t == ray->t)
random_jitter_offset = lcg_step_float(&state->rng_congruential) * dt;
float3 new_P = ray->P + ray->D * (t + random_jitter_offset);
float3 sigma_t;
/* compute attenuation over segment */
if(volume_shader_extinction_sample(kg, sd, state, new_P, &sigma_t)) {
/* Compute expf() only for every Nth step, to save some calculations
* because exp(a)*exp(b) = exp(a+b), also do a quick tp_eps check then. */
*sum += (-sigma_t * (new_t - t));
if((i & 0x07) == 0) { /* ToDo: Other interval? */
*tp = *tp * make_float3(expf(sum->x), expf(sum->y), expf(sum->z));
/* stop if nearly all light is blocked */
if(tp->x < tp_eps && tp->y < tp_eps && tp->z < tp_eps)
return true;
}
}
return false;
}
/* heterogeneous volume: integrate stepping through the volume until we
* reach the end, get absorbed entirely, or run out of iterations */
ccl_device void kernel_volume_shadow_heterogeneous(KernelGlobals *kg, PathState *state, Ray *ray, ShaderData *sd, float3 *throughput)
@@ -178,42 +211,66 @@ ccl_device void kernel_volume_shadow_heterogeneous(KernelGlobals *kg, PathState
float3 sum = make_float3(0.0f, 0.0f, 0.0f);
for(int i = 0; i < max_steps; i++) {
/* advance to new position */
float new_t = min(ray->t, (i+1) * step);
float dt = new_t - t;
#ifdef __OPENVDB__
int vdb_index = kernel_data.tables.density_index;
bool has_vdb_volume = kernel_data.tables.num_volumes > 0;
float t1 = 0.0f;
/* use random position inside this segment to sample shader */
if(new_t == ray->t)
random_jitter_offset = lcg_step_float(&state->rng_congruential) * dt;
if(has_vdb_volume && vdb_index >= 0 && kg->float_volumes[vdb_index]->has_uniform_voxels()) {
/* TODO(kevin): this call should be moved out of here, all it does is
* checking if we have an intersection with the boundbox of the volumue
* which in most cases corresponds to the boundbox of the object that has
* this volume. Also it initializes the rays for the ray marching. */
if(!kg->float_volumes[vdb_index]->intersect(ray, NULL)) {
return;
}
float3 new_P = ray->P + ray->D * (t + random_jitter_offset);
float3 sigma_t;
/* t and t1 represent the entry and exit points for each leaf node or tile
* containing active voxels. If we don't have any active node in the current
* ray path (i.e. empty space) the ray march loop is not executed,
* otherwise we loop through all leaves until the end of the volume. */
while(kg->float_volumes[vdb_index]->march(&t, &t1)) {
int i = 0;
/* compute attenuation over segment */
if(volume_shader_extinction_sample(kg, sd, state, new_P, &sigma_t)) {
/* Compute expf() only for every Nth step, to save some calculations
* because exp(a)*exp(b) = exp(a+b), also do a quick tp_eps check then. */
/* Perform small steps through the current leaf or tile. */
for(float new_t = step * ceilf(t / step); new_t <= t1; new_t += step) {
bool ok = kernel_volume_integrate_shadow_ray(
kg, state, ray, sd, &tp, t, new_t, random_jitter_offset,
&sum, tp_eps, i);
sum += (-sigma_t * (new_t - t));
if((i & 0x07) == 0) { /* ToDo: Other interval? */
tp = *throughput * make_float3(expf(sum.x), expf(sum.y), expf(sum.z));
if (ok) {
*throughput = tp;
return;
}
/* stop if nearly all light is blocked */
if(tp.x < tp_eps && tp.y < tp_eps && tp.z < tp_eps)
break;
/* stop if at the end of the volume */
t = new_t;
i++;
}
}
}
else
#endif
{
for(int i = 0; i < max_steps; i++) {
/* advance to new position */
float new_t = min(ray->t, (i+1) * step);
/* stop if at the end of the volume */
t = new_t;
if(t == ray->t) {
/* Update throughput in case we haven't done it above */
tp = *throughput * make_float3(expf(sum.x), expf(sum.y), expf(sum.z));
break;
bool ok = kernel_volume_integrate_shadow_ray(
kg, state, ray, sd, &tp, t, new_t, random_jitter_offset,
&sum, tp_eps, i);
/* stop if at the end of the volume */
t = new_t;
if(ok || t == ray->t) {
break;
}
}
}
/* Update throughput in case we haven't done it above */
tp = *throughput * make_float3(expf(sum.x), expf(sum.y), expf(sum.z));
*throughput = tp;
}
@@ -420,90 +477,67 @@ ccl_device VolumeIntegrateResult kernel_volume_integrate_homogeneous(KernelGloba
return VOLUME_PATH_ATTENUATED;
}
/* heterogeneous volume distance sampling: integrate stepping through the
* volume until we reach the end, get absorbed entirely, or run out of
* iterations. this does probalistically scatter or get transmitted through
* for path tracing where we don't want to branch. */
ccl_device VolumeIntegrateResult kernel_volume_integrate_heterogeneous_distance(KernelGlobals *kg,
PathState *state, Ray *ray, ShaderData *sd, PathRadiance *L, float3 *throughput, RNG *rng)
ccl_device_inline VolumeIntegrateResult kernel_volume_integrate_ray(
KernelGlobals *kg, PathState *state, Ray *ray, ShaderData *sd,
PathRadiance *L, float3 *throughput, float t, float new_t,
float random_jitter_offset, bool has_scatter, float3 *accum_transmittance,
int channel, const float tp_eps, float *xi)
{
float dt = new_t - t;
float3 tp = *throughput;
const float tp_eps = 1e-6f; /* todo: this is likely not the right value */
/* prepare for stepping */
int max_steps = kernel_data.integrator.volume_max_steps;
float step_size = kernel_data.integrator.volume_step_size;
float random_jitter_offset = lcg_step_float(&state->rng_congruential) * step_size;
/* use random position inside this segment to sample shader */
if(new_t == ray->t)
random_jitter_offset = lcg_step_float(&state->rng_congruential) * dt;
/* compute coefficients at the start */
float t = 0.0f;
float3 accum_transmittance = make_float3(1.0f, 1.0f, 1.0f);
float3 new_P = ray->P + ray->D * (t + random_jitter_offset);
VolumeShaderCoefficients coeff;
/* pick random color channel, we use the Veach one-sample
* model with balance heuristic for the channels */
float xi = path_state_rng_1D_for_decision(kg, rng, state, PRNG_SCATTER_DISTANCE);
float rphase = path_state_rng_1D_for_decision(kg, rng, state, PRNG_PHASE);
int channel = (int)(rphase*3.0f);
sd->randb_closure = rphase*3.0f - channel;
bool has_scatter = false;
/* compute segment */
if(volume_shader_sample(kg, sd, state, new_P, &coeff)) {
int closure_flag = sd->flag;
float3 new_tp;
float3 transmittance;
bool scatter = false;
for(int i = 0; i < max_steps; i++) {
/* advance to new position */
float new_t = min(ray->t, (i+1) * step_size);
float dt = new_t - t;
/* use random position inside this segment to sample shader */
if(new_t == ray->t)
random_jitter_offset = lcg_step_float(&state->rng_congruential) * dt;
float3 new_P = ray->P + ray->D * (t + random_jitter_offset);
VolumeShaderCoefficients coeff;
/* compute segment */
if(volume_shader_sample(kg, sd, state, new_P, &coeff)) {
int closure_flag = sd->flag;
float3 new_tp;
float3 transmittance;
bool scatter = false;
/* distance sampling */
/* distance sampling */
#ifdef __VOLUME_SCATTER__
if((closure_flag & SD_SCATTER) || (has_scatter && (closure_flag & SD_ABSORPTION))) {
has_scatter = true;
if((closure_flag & SD_SCATTER) || (has_scatter && (closure_flag & SD_ABSORPTION))) {
has_scatter = true;
float3 sigma_t = coeff.sigma_a + coeff.sigma_s;
float3 sigma_s = coeff.sigma_s;
float3 sigma_t = coeff.sigma_a + coeff.sigma_s;
float3 sigma_s = coeff.sigma_s;
/* compute transmittance over full step */
transmittance = volume_color_transmittance(sigma_t, dt);
/* compute transmittance over full step */
transmittance = volume_color_transmittance(sigma_t, dt);
/* decide if we will scatter or continue */
float sample_transmittance = kernel_volume_channel_get(transmittance, channel);
/* decide if we will scatter or continue */
float sample_transmittance = kernel_volume_channel_get(transmittance, channel);
if(1.0f - xi >= sample_transmittance) {
/* compute sampling distance */
float sample_sigma_t = kernel_volume_channel_get(sigma_t, channel);
float new_dt = -logf(1.0f - xi)/sample_sigma_t;
new_t = t + new_dt;
if(1.0f - *xi >= sample_transmittance) {
/* compute sampling distance */
float sample_sigma_t = kernel_volume_channel_get(sigma_t, channel);
float new_dt = -logf(1.0f - *xi)/sample_sigma_t;
new_t = t + new_dt;
/* transmittance and pdf */
float3 new_transmittance = volume_color_transmittance(sigma_t, new_dt);
float3 pdf = sigma_t * new_transmittance;
/* transmittance and pdf */
float3 new_transmittance = volume_color_transmittance(sigma_t, new_dt);
float3 pdf = sigma_t * new_transmittance;
/* throughput */
new_tp = tp * sigma_s * new_transmittance / average(pdf);
scatter = true;
}
else {
/* throughput */
float pdf = average(transmittance);
new_tp = tp * transmittance / pdf;
/* remap xi so we can reuse it and keep thing stratified */
xi = 1.0f - (1.0f - xi)/sample_transmittance;
}
/* throughput */
new_tp = tp * sigma_s * new_transmittance / average(pdf);
scatter = true;
}
else
else {
/* throughput */
float pdf = average(transmittance);
new_tp = tp * transmittance / pdf;
/* remap xi so we can reuse it and keep thing stratified */
*xi = 1.0f - (1.0f - *xi)/sample_transmittance;
}
}
else
#endif
if(closure_flag & SD_ABSORPTION) {
/* absorption only, no sampling needed */
@@ -513,46 +547,127 @@ ccl_device VolumeIntegrateResult kernel_volume_integrate_heterogeneous_distance(
new_tp = tp * transmittance;
}
/* integrate emission attenuated by absorption */
if(L && (closure_flag & SD_EMISSION)) {
float3 emission = kernel_volume_emission_integrate(&coeff, closure_flag, transmittance, dt);
path_radiance_accum_emission(L, tp, emission, state->bounce);
}
/* integrate emission attenuated by absorption */
if(L && (closure_flag & SD_EMISSION)) {
float3 emission = kernel_volume_emission_integrate(&coeff, closure_flag, transmittance, dt);
path_radiance_accum_emission(L, tp, emission, state->bounce);
}
/* modify throughput */
if(closure_flag & (SD_ABSORPTION|SD_SCATTER)) {
tp = new_tp;
/* modify throughput */
if(closure_flag & (SD_ABSORPTION|SD_SCATTER)) {
tp = new_tp;
/* stop if nearly all light blocked */
if(tp.x < tp_eps && tp.y < tp_eps && tp.z < tp_eps) {
tp = make_float3(0.0f, 0.0f, 0.0f);
break;
}
}
/* prepare to scatter to new direction */
if(scatter) {
/* adjust throughput and move to new location */
sd->P = ray->P + new_t*ray->D;
/* stop if nearly all light blocked */
if(tp.x < tp_eps && tp.y < tp_eps && tp.z < tp_eps) {
tp = make_float3(0.0f, 0.0f, 0.0f);
*throughput = tp;
return VOLUME_PATH_SCATTERED;
}
else {
/* accumulate transmittance */
accum_transmittance *= transmittance;
return VOLUME_PATH_ATTENUATED;
}
}
/* stop if at the end of the volume */
t = new_t;
if(t == ray->t)
break;
/* prepare to scatter to new direction */
if(scatter) {
/* adjust throughput and move to new location */
sd->P = ray->P + new_t*ray->D;
*throughput = tp;
return VOLUME_PATH_SCATTERED;
}
else {
/* accumulate transmittance */
*accum_transmittance *= transmittance;
}
}
*throughput = tp;
return VOLUME_PATH_CONTINUE;
}
return VOLUME_PATH_ATTENUATED;
/* heterogeneous volume distance sampling: integrate stepping through the
* volume until we reach the end, get absorbed entirely, or run out of
* iterations. this does probalistically scatter or get transmitted through
* for path tracing where we don't want to branch. */
ccl_device VolumeIntegrateResult kernel_volume_integrate_heterogeneous_distance(KernelGlobals *kg,
PathState *state, Ray *ray, ShaderData *sd, PathRadiance *L, float3 *throughput, RNG *rng)
{
VolumeIntegrateResult result = VOLUME_PATH_MISSED;
const float tp_eps = 1e-6f; /* todo: this is likely not the right value */
/* prepare for stepping */
int max_steps = kernel_data.integrator.volume_max_steps;
float step_size = kernel_data.integrator.volume_step_size;
float random_jitter_offset = lcg_step_float(&state->rng_congruential) * step_size;
/* compute coefficients at the start */
float t = 0.0f, t1 = 0.0f;
float3 accum_transmittance = make_float3(1.0f, 1.0f, 1.0f);
/* pick random color channel, we use the Veach one-sample
* model with balance heuristic for the channels */
float xi = path_state_rng_1D_for_decision(kg, rng, state, PRNG_SCATTER_DISTANCE);
float rphase = path_state_rng_1D_for_decision(kg, rng, state, PRNG_PHASE);
int channel = (int)(rphase*3.0f);
sd->randb_closure = rphase*3.0f - channel;
bool has_scatter = false;
bool path_missed = true;
#ifdef __OPENVDB__
int vdb_index = kernel_data.tables.density_index;
bool has_vdb_volume = kernel_data.tables.num_volumes > 0;
if(has_vdb_volume && vdb_index >= 0 && kg->float_volumes[vdb_index]->has_uniform_voxels()) {
/* TODO(kevin): this call should be moved out of here, all it does is
* checking if we have an intersection with the boundbox of the volumue
* which in most cases corresponds to the boundbox of the object that has
* this volume. Also it initializes the rays for the ray marching. */
if(!kg->float_volumes[vdb_index]->intersect(ray, NULL)) {
return VOLUME_PATH_MISSED;
}
/* t and t1 represent the entry and exit points for each leaf node or tile
* containing active voxels. If we don't have any active node in the current
* ray path (i.e. empty space) the ray march loop is not executed,
* otherwise we loop through all leaves until the end of the volume. */
while(kg->float_volumes[vdb_index]->march(&t, &t1)) {
path_missed = false;
/* Perform small steps through the current leaf or tile. */
for(float new_t = step_size * ceilf(t / step_size); new_t <= t1; new_t += step_size) {
result = kernel_volume_integrate_ray(kg, state, ray, sd, L, throughput, t, new_t,
random_jitter_offset, has_scatter,
&accum_transmittance, channel, tp_eps, &xi);
if(result != VOLUME_PATH_CONTINUE)
return result;
t = new_t;
}
}
}
else
#endif
{
path_missed = false;
for(int i = 0; i < max_steps; i++) {
/* advance to new position */
float new_t = min(ray->t, (i+1) * step_size);
result = kernel_volume_integrate_ray(kg, state, ray, sd, L, throughput, t, new_t,
random_jitter_offset, has_scatter,
&accum_transmittance, channel, tp_eps, &xi);
if(result != VOLUME_PATH_CONTINUE)
return result;
/* stop if at the end of the volume */
t = new_t;
if(t == ray->t)
break;
}
}
return (path_missed) ? VOLUME_PATH_MISSED : VOLUME_PATH_ATTENUATED;
}
/* get the volume attenuation and emission over line segment defined by

View File

@@ -34,6 +34,10 @@ void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t s
{
if(strcmp(name, "__data") == 0)
memcpy(&kg->__data, host, size);
else if(strcmp(name, "__float_volume") == 0)
kg->float_volumes[size] = (float_volume *)host;
else if(strcmp(name, "__float3_volume") == 0)
kg->float3_volumes[size] = (float3_volume *)host;
else
assert(0);
}

View File

@@ -168,6 +168,7 @@ CCL_NAMESPACE_END
#include "svm_wave.h"
#include "svm_math.h"
#include "svm_mix.h"
#include "svm_openvdb.h"
#include "svm_ramp.h"
#include "svm_sepcomb_hsv.h"
#include "svm_sepcomb_vector.h"
@@ -179,6 +180,7 @@ CCL_NAMESPACE_END
#include "svm_checker.h"
#include "svm_brick.h"
#include "svm_vector_transform.h"
#include "svm_voxel.h"
CCL_NAMESPACE_BEGIN
@@ -390,6 +392,9 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, Shade
case NODE_TEX_BRICK:
svm_node_tex_brick(kg, sd, stack, node, &offset);
break;
case NODE_TEX_VOXEL:
svm_node_tex_voxel(kg, sd, stack, node, &offset);
break;
# endif /* __TEXTURES__ */
# ifdef __EXTRA_NODES__
case NODE_NORMAL:
@@ -447,6 +452,11 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, Shade
break;
# endif /* __EXTRA_NODES__ */
#endif /* NODES_GROUP(NODE_GROUP_LEVEL_3) */
#ifdef __OPENVDB__
case NODE_OPENVDB:
svm_node_openvdb(kg, sd, stack, node, &offset);
break;
#endif
case NODE_END:
return;
default:

View File

@@ -0,0 +1,55 @@
/*
* Copyright 2015 Blender Foundation
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
CCL_NAMESPACE_BEGIN
#ifdef __OPENVDB__
ccl_device void svm_node_openvdb(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
{
uint slot = node.y;
uint type, out_offset, sampling, co_offset;
decode_node_uchar4(node.z, &type, &co_offset, &out_offset, &sampling);
float3 co = stack_load_float3(stack, co_offset);
Transform tfm;
tfm.x = read_node_float(kg, offset);
tfm.y = read_node_float(kg, offset);
tfm.z = read_node_float(kg, offset);
tfm.w = read_node_float(kg, offset);
co = transform_point(&tfm, co);
if(type == NODE_VDB_FLOAT) {
float out = kernel_tex_voxel_float(slot, co.x, co.y, co.z, sampling);
if(stack_valid(out_offset)) {
stack_store_float(stack, out_offset, out);
}
}
else if(type == NODE_VDB_FLOAT3) {
float3 out = kernel_tex_voxel_float3(slot, co.x, co.y, co.z, sampling);
if(stack_valid(out_offset)) {
stack_store_float3(stack, out_offset, out);
}
}
}
#endif
CCL_NAMESPACE_END

View File

@@ -125,7 +125,9 @@ typedef enum NodeType {
NODE_TANGENT,
NODE_NORMAL_MAP,
NODE_HAIR_INFO,
NODE_UVMAP
NODE_UVMAP,
NODE_TEX_VOXEL,
NODE_OPENVDB,
} NodeType;
typedef enum NodeAttributeType {
@@ -349,6 +351,16 @@ typedef enum NodeBumpOffset {
NODE_BUMP_OFFSET_DY,
} NodeBumpOffset;
typedef enum NodeTexVoxelSpace {
NODE_TEX_VOXEL_SPACE_OBJECT = 0,
NODE_TEX_VOXEL_SPACE_WORLD = 1,
} NodeTexVoxelSpace;
typedef enum NodeOpenVDBType {
NODE_VDB_FLOAT = 0,
NODE_VDB_FLOAT3 = 1,
} NodeOpenVDBType;
typedef enum ShaderType {
SHADER_TYPE_SURFACE,
SHADER_TYPE_VOLUME,

View File

@@ -0,0 +1,61 @@
/*
* Copyright 2011-2015 Blender Foundation
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
CCL_NAMESPACE_BEGIN
ccl_device void svm_node_tex_voxel(KernelGlobals *kg,
ShaderData *sd,
float *stack,
uint4 node,
int *offset)
{
int id = node.y;
uint co_offset, density_out_offset, color_out_offset, space;
decode_node_uchar4(node.z, &co_offset, &density_out_offset, &color_out_offset, &space);
float3 co = stack_load_float3(stack, co_offset);
if(space == NODE_TEX_VOXEL_SPACE_OBJECT) {
co = volume_normalized_position(kg, sd, co);
}
else {
kernel_assert(space == NODE_TEX_VOXEL_SPACE_WORLD);
Transform tfm;
tfm.x = read_node_float(kg, offset);
tfm.y = read_node_float(kg, offset);
tfm.z = read_node_float(kg, offset);
tfm.w = read_node_float(kg, offset);
co = transform_point(&tfm, co);
}
if(co.x < 0.0f || co.y < 0.0f || co.z < 0.0f ||
co.x > 1.0f || co.y > 1.0f || co.z > 1.0f)
{
if (stack_valid(density_out_offset))
stack_store_float(stack, density_out_offset, 0.0f);
if (stack_valid(color_out_offset))
stack_store_float3(stack, color_out_offset, make_float3(0.0f, 0.0f, 0.0f));
return;
}
#ifdef __KERNEL_GPU__
float4 r = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
#else
float4 r = kernel_tex_image_interp_3d(id, co.x, co.y, co.z);
#endif
if (stack_valid(density_out_offset))
stack_store_float(stack, density_out_offset, r.w);
if (stack_valid(color_out_offset))
stack_store_float3(stack, color_out_offset, make_float3(r.x, r.y, r.z));
}
CCL_NAMESPACE_END

View File

@@ -14,6 +14,12 @@ set(INC_SYS
${GLEW_INCLUDE_DIR}
)
if(WITH_OPENVDB)
list(APPEND INC_SYS
${OPENVDB_INCLUDE_DIRS}
)
endif()
set(SRC
attribute.cpp
background.cpp
@@ -29,6 +35,7 @@ set(SRC
mesh_displace.cpp
nodes.cpp
object.cpp
openvdb.cpp
osl.cpp
particles.cpp
curves.cpp
@@ -56,6 +63,7 @@ set(SRC_HEADERS
mesh.h
nodes.h
object.h
openvdb.h
osl.h
particles.h
curves.h

View File

@@ -39,6 +39,7 @@ struct Transform;
struct VoxelAttribute {
ImageManager *manager;
int slot;
int from_alpha;
};
/* Attribute

View File

@@ -515,6 +515,7 @@ void Mesh::compute_bvh(SceneParams *params, Progress *progress, int n, int total
BVHParams bparams;
bparams.use_cache = params->use_bvh_cache;
bparams.use_spatial_split = params->use_bvh_spatial_split;
bparams.use_triangle_storage = params->use_bvh_triangle_storage;
bparams.use_qbvh = params->use_qbvh;
delete bvh;
@@ -554,9 +555,10 @@ bool Mesh::has_motion_blur() const
/* Mesh Manager */
MeshManager::MeshManager()
MeshManager::MeshManager(const bool free_data_after_update_)
{
bvh = NULL;
free_data_after_update = free_data_after_update_;
need_update = true;
need_flags_update = true;
}
@@ -816,7 +818,10 @@ static void update_attribute_element_offset(Mesh *mesh,
if(mattr->element == ATTR_ELEMENT_VOXEL) {
/* store slot in offset value */
VoxelAttribute *voxel_data = mattr->data_voxel();
offset = voxel_data->slot;
offset = voxel_data->slot << 1;
if(voxel_data->from_alpha) {
++offset;
}
}
else if(mattr->element == ATTR_ELEMENT_CORNER_BYTE) {
uchar4 *data = mattr->data_uchar4();
@@ -1085,6 +1090,7 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene *
bparams.use_qbvh = scene->params.use_qbvh;
bparams.use_spatial_split = scene->params.use_bvh_spatial_split;
bparams.use_cache = scene->params.use_bvh_cache;
bparams.use_triangle_storage = scene->params.use_bvh_triangle_storage;
delete bvh;
bvh = BVH::create(bparams, scene->objects);
@@ -1132,6 +1138,7 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene *
dscene->data.bvh.root = pack.root_index;
dscene->data.bvh.use_qbvh = scene->params.use_qbvh;
dscene->data.bvh.use_tri_storage = scene->params.use_bvh_triangle_storage? 1: 0;
}
void MeshManager::device_update_flags(Device * /*device*/,
@@ -1320,6 +1327,16 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen
device_update_bvh(device, dscene, scene, progress);
if(free_data_after_update) {
foreach(Object *object, scene->objects) {
if(object->mesh->bvh != NULL) {
delete object->mesh->bvh;
object->mesh->bvh = NULL;
object->mesh->tag_update(scene, true);
}
}
}
need_update = false;
if(need_displacement_images) {

View File

@@ -152,7 +152,10 @@ public:
bool need_update;
bool need_flags_update;
MeshManager();
/* Free memory used by BVH after device update. */
bool free_data_after_update;
MeshManager(const bool free_data_after_update);
~MeshManager();
bool displace(Device *device, DeviceScene *dscene, Scene *scene, Mesh *mesh, Progress& progress);

View File

@@ -16,6 +16,7 @@
#include "image.h"
#include "nodes.h"
#include "openvdb.h"
#include "svm.h"
#include "svm_math_util.h"
#include "osl.h"
@@ -1297,6 +1298,118 @@ void BrickTextureNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_brick_texture");
}
/* Point Density Texture */
static ShaderEnum point_density_space_init()
{
ShaderEnum enm;
enm.insert("Object", NODE_TEX_VOXEL_SPACE_OBJECT);
enm.insert("World", NODE_TEX_VOXEL_SPACE_WORLD);
return enm;
}
ShaderEnum PointDensityTextureNode::space_enum = point_density_space_init();
PointDensityTextureNode::PointDensityTextureNode()
: ShaderNode("point_density")
{
image_manager = NULL;
slot = -1;
filename = "";
space = ustring("Object");
builtin_data = NULL;
interpolation = INTERPOLATION_LINEAR;
tfm = transform_identity();
add_input("Vector", SHADER_SOCKET_POINT, ShaderInput::POSITION);
add_output("Density", SHADER_SOCKET_FLOAT);
add_output("Color", SHADER_SOCKET_COLOR);
}
PointDensityTextureNode::~PointDensityTextureNode()
{
if(image_manager)
image_manager->remove_image(filename, builtin_data, interpolation);
}
ShaderNode *PointDensityTextureNode::clone() const
{
PointDensityTextureNode *node = new PointDensityTextureNode(*this);
node->image_manager = NULL;
node->slot = -1;
return node;
}
void PointDensityTextureNode::attributes(Shader *shader,
AttributeRequestSet *attributes)
{
if(shader->has_volume)
attributes->add(ATTR_STD_GENERATED_TRANSFORM);
ShaderNode::attributes(shader, attributes);
}
void PointDensityTextureNode::compile(SVMCompiler& compiler)
{
ShaderInput *vector_in = input("Vector");
ShaderOutput *density_out = output("Density");
ShaderOutput *color_out = output("Color");
bool use_density = !density_out->links.empty();
bool use_color = !color_out->links.empty();
image_manager = compiler.image_manager;
if (use_density || use_color) {
if (use_density)
compiler.stack_assign(density_out);
if (use_color)
compiler.stack_assign(color_out);
if(slot == -1) {
bool is_float, is_linear;
slot = image_manager->add_image(filename, builtin_data,
false, 0,
is_float, is_linear,
interpolation,
true);
}
if(slot != -1) {
compiler.stack_assign(vector_in);
compiler.add_node(NODE_TEX_VOXEL,
slot,
compiler.encode_uchar4(vector_in->stack_offset,
density_out->stack_offset,
color_out->stack_offset,
space_enum[space]));
if(space == "World") {
compiler.add_node(tfm.x);
compiler.add_node(tfm.y);
compiler.add_node(tfm.z);
compiler.add_node(tfm.w);
}
}
else {
compiler.add_node(NODE_VALUE_F,
__float_as_int(0.0f),
density_out->stack_offset);
compiler.add_node(NODE_VALUE_V, color_out->stack_offset);
compiler.add_node(NODE_VALUE_V, make_float3(TEX_IMAGE_MISSING_R,
TEX_IMAGE_MISSING_G,
TEX_IMAGE_MISSING_B));
}
}
}
void PointDensityTextureNode::compile(OSLCompiler& /*compiler*/)
{
/* TODO(sergey): To be supported. */
}
/* Normal */
NormalNode::NormalNode()
@@ -4367,4 +4480,71 @@ void TangentNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_tangent");
}
OpenVDBNode::OpenVDBNode()
: ShaderNode("openvdb")
{
filename = "";
volume_manager = NULL;
sampling = OPENVDB_SAMPLE_POINT;
tfm = transform_identity();
add_input("Vector", SHADER_SOCKET_POINT, ShaderInput::POSITION);
}
void OpenVDBNode::attributes(Shader *shader, AttributeRequestSet *attributes)
{
if(shader->has_volume)
attributes->add(ATTR_STD_GENERATED_TRANSFORM);
ShaderNode::attributes(shader, attributes);
}
void OpenVDBNode::compile(SVMCompiler& compiler)
{
ShaderInput *vector_in = input("Vector");
volume_manager = compiler.volume_manager;
compiler.stack_assign(vector_in);
for(size_t i = 0; i < outputs.size(); ++i) {
ShaderOutput *out = outputs[i];
if(out->links.empty()) {
continue;
}
int type = NODE_VDB_FLOAT;
if(out->type == SHADER_SOCKET_VECTOR || out->type == SHADER_SOCKET_COLOR) {
type = NODE_VDB_FLOAT3;
}
grid_slot = volume_manager->add_volume(filename.string(),
output_names[i].string(),
sampling, type);
if(grid_slot == -1) {
continue;
}
compiler.stack_assign(out);
compiler.add_node(NODE_OPENVDB,
grid_slot,
compiler.encode_uchar4(type,
vector_in->stack_offset,
out->stack_offset,
sampling));
compiler.add_node(tfm.x);
compiler.add_node(tfm.y);
compiler.add_node(tfm.z);
compiler.add_node(tfm.w);
}
}
void OpenVDBNode::compile(OSLCompiler& /*compiler*/)
{
}
CCL_NAMESPACE_END

View File

@@ -25,6 +25,7 @@ CCL_NAMESPACE_BEGIN
class ImageManager;
class Shader;
class VolumeManager;
/* Texture Mapping */
@@ -213,6 +214,29 @@ public:
virtual int get_group() { return NODE_GROUP_LEVEL_2; }
};
class PointDensityTextureNode : public ShaderNode {
public:
SHADER_NODE_NO_CLONE_CLASS(PointDensityTextureNode)
~PointDensityTextureNode();
ShaderNode *clone() const;
void attributes(Shader *shader, AttributeRequestSet *attributes);
bool has_spatial_varying() { return true; }
bool has_object_dependency() { return true; }
ImageManager *image_manager;
int slot;
string filename;
ustring space;
void *builtin_data;
InterpolationType interpolation;
Transform tfm;
static ShaderEnum space_enum;
};
class MappingNode : public ShaderNode {
public:
SHADER_NODE_CLASS(MappingNode)
@@ -734,6 +758,22 @@ public:
ustring attribute;
};
class OpenVDBNode : public ShaderNode {
public:
SHADER_NODE_CLASS(OpenVDBNode)
void attributes(Shader *shader, AttributeRequestSet *attributes);
bool has_spatial_varying() { return true; }
ustring filename;
VolumeManager *volume_manager;
int grid_slot;
int sampling;
vector<ustring> output_names;
Transform tfm;
};
CCL_NAMESPACE_END
#endif /* __NODES_H__ */

View File

@@ -0,0 +1,276 @@
/*
* Copyright 2015 Blender Foundation
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "openvdb.h"
#include "scene.h"
#include "util_logging.h"
#include "util_progress.h"
CCL_NAMESPACE_BEGIN
#define MAX_VOLUME 1024
VolumeManager::VolumeManager()
{
#ifdef WITH_OPENVDB
openvdb::initialize();
scalar_grids.reserve(64);
vector_grids.reserve(64);
current_grids.reserve(64);
float_volumes.reserve(64);
float3_volumes.reserve(64);
#endif
need_update = true;
}
VolumeManager::~VolumeManager()
{
#ifdef WITH_OPENVDB
scalar_grids.clear();
vector_grids.clear();
current_grids.clear();
float_volumes.clear();
float3_volumes.clear();
#endif
}
static inline void catch_exceptions()
{
#ifdef WITH_OPENVDB
try {
throw;
}
catch (const openvdb::IoError& e) {
std::cerr << e.what() << "\n";
}
#endif
}
int VolumeManager::add_volume(const string& filename, const string& name, int sampling, int grid_type)
{
size_t slot = -1;
if((slot = find_existing_slot(filename, name, sampling, grid_type)) != -1) {
return slot;
}
try {
if(is_openvdb_file(filename)) {
slot = add_openvdb_volume(filename, name, sampling, grid_type);
}
add_grid_description(filename, name, sampling, slot);
need_update = true;
}
catch (...) {
catch_exceptions();
need_update = false;
slot = -1;
}
return slot;
}
int VolumeManager::find_existing_slot(const string& filename, const string& name, int sampling, int grid_type)
{
for(size_t i = 0; i < current_grids.size(); ++i) {
GridDescription grid = current_grids[i];
if(grid.filename == filename && grid.name == name) {
if(grid.sampling == sampling) {
return grid.slot;
}
else {
/* sampling was changed, remove the sampler */
if(grid_type == NODE_VDB_FLOAT) {
delete float_volumes[grid.slot];
float_volumes[grid.slot] = NULL;
}
else {
delete float3_volumes[grid.slot];
float3_volumes[grid.slot] = NULL;
}
/* remove the grid description too */
std::swap(current_grids[i], current_grids.back());
current_grids.pop_back();
break;
}
}
}
return -1;
}
int VolumeManager::find_density_slot()
{
/* first try finding a matching grid name */
for (size_t i = 0; i < current_grids.size(); ++i) {
GridDescription grid = current_grids[i];
if (string_iequals(grid.name, "density") || string_iequals(grid.name, "density high"))
return grid.slot;
}
/* try using the first scalar float grid instead */
if (!float_volumes.empty()) {
return 0;
}
return -1;
}
bool VolumeManager::is_openvdb_file(const string& filename) const
{
return string_endswith(filename, ".vdb");
}
template <typename Container>
size_t find_empty_slot(Container container)
{
size_t slot = 0;
for(; slot < container.size(); ++slot) {
if(!container[slot]) {
break;
}
}
if(slot == container.size()) {
if(slot == MAX_VOLUME) {
printf("VolumeManager::add_volume: volume sampler limit reached %d!\n",
MAX_VOLUME);
return -1;
}
container.resize(slot + 1);
}
return slot;
}
size_t VolumeManager::add_openvdb_volume(const std::string& filename, const std::string& name, int /*sampling*/, int grid_type)
{
size_t slot = -1;
#ifdef WITH_OPENVDB
using namespace openvdb;
io::File file(filename);
file.open();
if (!file.hasGrid(name)) return -1;
if(grid_type == NODE_VDB_FLOAT) {
slot = find_empty_slot(float_volumes);
if(slot == -1) return -1;
if (!file.hasGrid(name)) return -1;
FloatGrid::Ptr grid = gridPtrCast<FloatGrid>(file.readGrid(name));
vdb_float_volume *sampler = new vdb_float_volume(grid);
float_volumes.insert(float_volumes.begin() + slot, sampler);
scalar_grids.push_back(grid);
}
else if(grid_type == NODE_VDB_FLOAT3) {
slot = find_empty_slot(float3_volumes);
if(slot == -1) return -1;
if (!file.hasGrid(name)) return -1;
Vec3SGrid::Ptr grid = gridPtrCast<Vec3SGrid>(file.readGrid(name));
vdb_float3_volume *sampler = new vdb_float3_volume(grid);
float3_volumes.insert(float3_volumes.begin() + slot, sampler);
vector_grids.push_back(grid);
}
#else
(void)filename;
(void)name;
(void)grid_type;
#endif
return slot;
}
void VolumeManager::add_grid_description(const string& filename, const string& name, int sampling, int slot)
{
GridDescription descr;
descr.filename = filename;
descr.name = name;
descr.sampling = sampling;
descr.slot = slot;
current_grids.push_back(descr);
}
void VolumeManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
{
(void)scene;
if(!need_update) {
return;
}
device_free(device, dscene);
progress.set_status("Updating OpenVDB volumes", "Sending samplers to device.");
for(size_t i = 0; i < float_volumes.size(); ++i) {
if(!float_volumes[i]) {
continue;
}
device->const_copy_to("__float_volume", float_volumes[i], i);
}
for(size_t i = 0; i < float3_volumes.size(); ++i) {
if(!float3_volumes[i]) {
continue;
}
device->const_copy_to("__float3_volume", float3_volumes[i], i);
}
if(progress.get_cancel()) {
return;
}
dscene->data.tables.num_volumes = float_volumes.size() + float3_volumes.size();
dscene->data.tables.density_index = find_density_slot();
VLOG(1) << "Volume samplers allocate: __float_volume, " << float_volumes.size() * sizeof(float_volume) << " bytes";
VLOG(1) << "Volume samplers allocate: __float3_volume, " << float3_volumes.size() * sizeof(float3_volume) << " bytes";
#ifdef WITH_OPENVDB
for(size_t i = 0; i < scalar_grids.size(); ++i) {
VLOG(1) << scalar_grids[i]->getName() << " memory usage: " << scalar_grids[i]->memUsage() / 1024.0f << " kilobytes.\n";
}
for(size_t i = 0; i < vector_grids.size(); ++i) {
VLOG(1) << vector_grids[i]->getName() << " memory usage: " << vector_grids[i]->memUsage() / 1024.0f << " kilobytes.\n";
}
#endif
need_update = false;
}
void VolumeManager::device_free(Device */*device*/, DeviceScene */*dscene*/)
{
}
CCL_NAMESPACE_END

View File

@@ -0,0 +1,72 @@
/*
* Copyright 2015 Blender Foundation
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __VOLUMEMANAGER_H__
#define __VOLUMEMANAGER_H__
#include "util_openvdb.h"
#include "util_string.h"
#include "util_types.h"
CCL_NAMESPACE_BEGIN
class Device;
class DeviceScene;
class Progress;
class Scene;
class VolumeManager {
struct GridDescription {
string filename;
string name;
int sampling;
int slot;
};
vector<GridDescription> current_grids;
#ifdef WITH_OPENVDB
vector<openvdb::FloatGrid::Ptr> scalar_grids;
vector<openvdb::Vec3SGrid::Ptr> vector_grids;
#endif
void delete_volume(int grid_type, int sampling, size_t slot);
void add_grid_description(const string& filename, const string& name, int sampling, int slot);
int find_existing_slot(const string& filename, const string& name, int sampling, int grid_type);
bool is_openvdb_file(const string& filename) const;
size_t add_openvdb_volume(const string& filename, const string& name, int sampling, int grid_type);
public:
VolumeManager();
~VolumeManager();
int add_volume(const string& filename, const string& name, int sampling, int grid_type);
int find_density_slot();
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
void device_free(Device *device, DeviceScene *dscene);
bool need_update;
vector<float_volume*> float_volumes;
vector<float3_volume*> float3_volumes;
};
CCL_NAMESPACE_END
#endif /* __VOLUMEMANAGER_H__ */

View File

@@ -26,6 +26,7 @@
#include "light.h"
#include "mesh.h"
#include "object.h"
#include "openvdb.h"
#include "osl.h"
#include "particles.h"
#include "scene.h"
@@ -43,7 +44,9 @@
CCL_NAMESPACE_BEGIN
Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_)
Scene::Scene(const SceneParams& params_,
const DeviceInfo& device_info_,
const bool free_data_after_update)
: params(params_)
{
device = NULL;
@@ -54,13 +57,14 @@ Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_)
film = new Film();
background = new Background();
light_manager = new LightManager();
mesh_manager = new MeshManager();
mesh_manager = new MeshManager(free_data_after_update);
object_manager = new ObjectManager();
integrator = new Integrator();
image_manager = new ImageManager();
particle_system_manager = new ParticleSystemManager();
curve_system_manager = new CurveSystemManager();
bake_manager = new BakeManager();
volume_manager = new VolumeManager();
/* OSL only works on the CPU */
if(device_info_.type == DEVICE_CPU)
@@ -118,6 +122,7 @@ void Scene::free_memory(bool final)
image_manager->device_free_builtin(device, &dscene);
lookup_tables->device_free(device, &dscene);
volume_manager->device_free(device, &dscene);
}
if(final) {
@@ -134,6 +139,7 @@ void Scene::free_memory(bool final)
delete curve_system_manager;
delete image_manager;
delete bake_manager;
delete volume_manager;
}
}
@@ -240,6 +246,11 @@ void Scene::device_update(Device *device_, Progress& progress)
if(progress.get_cancel() || device->have_error()) return;
progress.set_status("Updating OpenVDB Volumes");
volume_manager->device_update(device, &dscene, this, progress);
if(progress.get_cancel() || device->have_error()) return;
if(device->have_error() == false) {
progress.set_status("Updating Device", "Writing constant memory");
device->const_copy_to("__data", &dscene.data, sizeof(dscene.data));
@@ -300,6 +311,7 @@ bool Scene::need_reset()
|| particle_system_manager->need_update
|| curve_system_manager->need_update
|| bake_manager->need_update
|| volume_manager->need_update
|| film->need_update);
}

View File

@@ -24,6 +24,7 @@
#include "kernel_types.h"
#include "util_openvdb.h"
#include "util_param.h"
#include "util_string.h"
#include "util_system.h"
@@ -55,6 +56,7 @@ class ShaderManager;
class Progress;
class BakeManager;
class BakeData;
class VolumeManager;
/* Scene Device Data */
@@ -128,6 +130,7 @@ public:
enum BVHType { BVH_DYNAMIC, BVH_STATIC } bvh_type;
bool use_bvh_cache;
bool use_bvh_spatial_split;
bool use_bvh_triangle_storage;
bool use_qbvh;
bool persistent_data;
@@ -137,6 +140,7 @@ public:
bvh_type = BVH_DYNAMIC;
use_bvh_cache = false;
use_bvh_spatial_split = false;
use_bvh_triangle_storage = true;
use_qbvh = false;
persistent_data = false;
}
@@ -146,6 +150,7 @@ public:
&& bvh_type == params.bvh_type
&& use_bvh_cache == params.use_bvh_cache
&& use_bvh_spatial_split == params.use_bvh_spatial_split
&& use_bvh_triangle_storage == params.use_bvh_triangle_storage
&& use_qbvh == params.use_qbvh
&& persistent_data == params.persistent_data); }
};
@@ -177,6 +182,7 @@ public:
ParticleSystemManager *particle_system_manager;
CurveSystemManager *curve_system_manager;
BakeManager *bake_manager;
VolumeManager *volume_manager;
/* default shaders */
int default_surface;
@@ -194,7 +200,9 @@ public:
/* mutex must be locked manually by callers */
thread_mutex mutex;
Scene(const SceneParams& params, const DeviceInfo& device_info);
Scene(const SceneParams& params,
const DeviceInfo& device_info,
const bool free_data_after_update = false);
~Scene();
void device_update(Device *device, Progress& progress);

View File

@@ -812,6 +812,10 @@ void Session::update_scene()
progress.set_status("Updating Scene");
scene->device_update(device, progress);
}
if(clear_database_cb) {
clear_database_cb();
}
}
void Session::update_status_time(bool show_pause, bool show_done)

View File

@@ -128,6 +128,7 @@ public:
function<void(RenderTile&)> write_render_tile_cb;
function<void(RenderTile&)> update_render_tile_cb;
function<void(void)> clear_database_cb;
Session(const SessionParams& params);
~Session();

View File

@@ -76,7 +76,7 @@ void SVMShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
if(shader->use_mis && shader->has_surface_emission)
scene->light_manager->need_update = true;
SVMCompiler compiler(scene->shader_manager, scene->image_manager);
SVMCompiler compiler(scene->shader_manager, scene->image_manager, scene->volume_manager);
compiler.background = ((int)i == scene->default_background);
compiler.compile(shader, svm_nodes, i);
}
@@ -104,10 +104,11 @@ void SVMShaderManager::device_free(Device *device, DeviceScene *dscene, Scene *s
/* Graph Compiler */
SVMCompiler::SVMCompiler(ShaderManager *shader_manager_, ImageManager *image_manager_)
SVMCompiler::SVMCompiler(ShaderManager *shader_manager_, ImageManager *image_manager_, VolumeManager *volume_manager_)
{
shader_manager = shader_manager_;
image_manager = image_manager_;
volume_manager = volume_manager_;
max_stack_use = 0;
current_type = SHADER_TYPE_SURFACE;
current_shader = NULL;

View File

@@ -34,6 +34,7 @@ class ShaderGraph;
class ShaderInput;
class ShaderNode;
class ShaderOutput;
class VolumeManager;
/* Shader Manager */
@@ -52,7 +53,7 @@ public:
class SVMCompiler {
public:
SVMCompiler(ShaderManager *shader_manager, ImageManager *image_manager);
SVMCompiler(ShaderManager *shader_manager, ImageManager *image_manager, VolumeManager *volume_manager_);
void compile(Shader *shader, vector<int4>& svm_nodes, int index);
void stack_assign(ShaderOutput *output);
@@ -74,6 +75,7 @@ public:
ShaderType output_type() { return current_type; }
ImageManager *image_manager;
VolumeManager *volume_manager;
ShaderManager *shader_manager;
bool background;

View File

@@ -52,6 +52,7 @@ set(SRC_HEADERS
util_math_fast.h
util_md5.h
util_opengl.h
util_openvdb.h
util_optimization.h
util_param.h
util_path.h
@@ -83,6 +84,12 @@ if(WITH_CYCLES_DEBUG)
)
endif()
if(WITH_OPENVDB)
add_definitions(
-DWITH_OPENVDB
)
endif()
include_directories(${INC})
include_directories(SYSTEM ${INC_SYS})

View File

@@ -0,0 +1,415 @@
#ifndef __UTIL_OPENVDB_H__
#define __UTIL_OPENVDB_H__
#ifdef WITH_OPENVDB
# include "util_map.h"
#endif
#include "util_types.h"
#include "kernel_types.h"
CCL_NAMESPACE_BEGIN
struct Ray;
struct Intersection;
enum {
OPENVDB_SAMPLE_POINT = 0,
OPENVDB_SAMPLE_BOX = 1,
};
class float_volume {
public:
virtual ~float_volume() {}
virtual float sample(float x, float y, float z, int sampling) = 0;
virtual bool intersect(const Ray *ray, Intersection *isect) = 0;
virtual bool march(float *t0, float *t1) = 0;
virtual bool has_uniform_voxels() = 0;
};
class float3_volume {
public:
virtual ~float3_volume() {}
virtual float3 sample(float x, float y, float z, int sampling) = 0;
virtual bool intersect(const Ray *ray, Intersection *isect) = 0;
virtual bool march(float *t0, float *t1) = 0;
virtual bool has_uniform_voxels() = 0;
};
CCL_NAMESPACE_END
#ifdef WITH_OPENVDB
/* They are too many implicit float conversions happening in OpenVDB, disabling
* errors for now (kevin) */
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wfloat-conversion"
# pragma GCC diagnostic ignored "-Wdouble-promotion"
#endif
#include <openvdb/openvdb.h>
#include <openvdb/tools/Interpolation.h>
#include <openvdb/tools/RayIntersector.h>
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
CCL_NAMESPACE_BEGIN
#if defined(HAS_CPP11_FEATURES)
using std::isfinite;
#else
using boost::math::isfinite;
#endif
class vdb_float_volume : public float_volume {
typedef openvdb::tools::GridSampler<openvdb::FloatGrid::ConstAccessor, openvdb::tools::PointSampler> point_sampler_t;
typedef openvdb::tools::GridSampler<openvdb::FloatGrid::ConstAccessor, openvdb::tools::BoxSampler> box_sampler_t;
typedef openvdb::tools::VolumeRayIntersector<openvdb::FloatGrid> isector_t;
typedef isector_t::RayType vdb_ray_t;
/* mainly used to ensure thread safety for the accessors */
typedef unordered_map<pthread_t, isector_t *> isect_map;
typedef unordered_map<pthread_t, point_sampler_t *> point_map;
typedef unordered_map<pthread_t, box_sampler_t *> box_map;
isect_map isectors;
point_map point_samplers;
box_map box_samplers;
openvdb::FloatGrid::ConstAccessor *accessor;
openvdb::math::Transform *transfrom;
/* Main intersector, its purpose is to initialize the voxels' bounding box
* so the ones for the various threads do not do this, rather they are
* generated from a copy of it */
isector_t *main_isector;
bool uniform_voxels;
public:
vdb_float_volume(openvdb::FloatGrid::Ptr grid)
: transfrom(&grid->transform())
{
accessor = new openvdb::FloatGrid::ConstAccessor(grid->getConstAccessor());
/* only grids with uniform voxels can be used with VolumeRayIntersector */
if(grid->hasUniformVoxels()) {
uniform_voxels = true;
main_isector = new isector_t(*grid);
}
else {
uniform_voxels = false;
main_isector = NULL;
}
}
~vdb_float_volume()
{
for(point_map::iterator iter = point_samplers.begin();
iter != point_samplers.end();
++iter)
{
delete iter->second;
}
for(box_map::iterator iter = box_samplers.begin();
iter != box_samplers.end();
++iter)
{
delete iter->second;
}
if(uniform_voxels) {
delete main_isector;
for(isect_map::iterator iter = isectors.begin();
iter != isectors.end();
++iter)
{
delete iter->second;
}
}
}
ccl_always_inline float sample(float x, float y, float z, int sampling)
{
pthread_t thread = pthread_self();
if(sampling == OPENVDB_SAMPLE_POINT) {
point_map::iterator iter = point_samplers.find(thread);
point_sampler_t *sampler;
if(iter == point_samplers.end()) {
openvdb::FloatGrid::ConstAccessor *acc = new openvdb::FloatGrid::ConstAccessor(*accessor);
sampler = new point_sampler_t(*acc, *transfrom);
pair<pthread_t, point_sampler_t *> sampl(thread, sampler);
point_samplers.insert(sampl);
}
else {
sampler = iter->second;
}
return sampler->wsSample(openvdb::Vec3d(x, y, z));
}
else {
box_map::iterator iter = box_samplers.find(thread);
box_sampler_t *sampler;
if(iter == box_samplers.end()) {
openvdb::FloatGrid::ConstAccessor *acc = new openvdb::FloatGrid::ConstAccessor(*accessor);
sampler = new box_sampler_t(*acc, *transfrom);
pair<pthread_t, box_sampler_t *> sampl(thread, sampler);
box_samplers.insert(sampl);
}
else {
sampler = iter->second;
}
return sampler->wsSample(openvdb::Vec3d(x, y, z));
}
}
ccl_always_inline bool intersect(const Ray *ray, Intersection */*isect*/)
{
pthread_t thread = pthread_self();
isect_map::iterator iter = isectors.find(thread);
isector_t *vdb_isect;
if(iter == isectors.end()) {
vdb_isect = new isector_t(*main_isector);
pair<pthread_t, isector_t *> inter(thread, vdb_isect);
isectors.insert(inter);
}
else {
vdb_isect = iter->second;
}
vdb_ray_t::Vec3Type P(ray->P.x, ray->P.y, ray->P.z);
vdb_ray_t::Vec3Type D(ray->D.x, ray->D.y, ray->D.z);
D.normalize();
vdb_ray_t vdb_ray(P, D, 1e-5f, ray->t);
if(vdb_isect->setWorldRay(vdb_ray)) {
// TODO
// isect->t = vdb_ray.t1(); // (kevin) is this correct?
// isect->u = isect->v = 1.0f;
// isect->type = ;
// isect->shad = shader;
// isect->norm = ;
// isect->prim = 0;
// isect->object = 0;
return true;
}
return false;
}
ccl_always_inline bool march(float *t0, float *t1)
{
pthread_t thread = pthread_self();
isect_map::iterator iter = isectors.find(thread);
isector_t *vdb_isect = iter->second;
openvdb::Real vdb_t0(*t0), vdb_t1(*t1);
if(vdb_isect->march(vdb_t0, vdb_t1)) {
*t0 = (float)vdb_isect->getWorldTime(vdb_t0);
*t1 = (float)vdb_isect->getWorldTime(vdb_t1);
return true;
}
return false;
}
ccl_always_inline bool has_uniform_voxels()
{
return uniform_voxels;
}
};
/* Same as above, except for vector grids */
/* TODO(kevin): staggered velocity grid sampling */
class vdb_float3_volume : public float3_volume {
typedef openvdb::tools::GridSampler<openvdb::Vec3SGrid::ConstAccessor, openvdb::tools::PointSampler> point_sampler_t;
typedef openvdb::tools::GridSampler<openvdb::Vec3SGrid::ConstAccessor, openvdb::tools::BoxSampler> box_sampler_t;
typedef openvdb::tools::VolumeRayIntersector<openvdb::Vec3SGrid> isector_t;
typedef isector_t::RayType vdb_ray_t;
/* mainly used to ensure thread safety for the accessors */
typedef unordered_map<pthread_t, isector_t *> isect_map;
typedef unordered_map<pthread_t, point_sampler_t *> point_map;
typedef unordered_map<pthread_t, box_sampler_t *> box_map;
isect_map isectors;
point_map point_samplers;
box_map box_samplers;
openvdb::Vec3SGrid::ConstAccessor *accessor;
openvdb::math::Transform *transfrom;
/* Main intersector, its purpose is to initialize the voxels' bounding box
* so the ones for the various threads do not do this, rather they are
* generated from a copy of it. */
isector_t *main_isector;
bool uniform_voxels;
public:
vdb_float3_volume(openvdb::Vec3SGrid::Ptr grid)
: transfrom(&grid->transform())
{
accessor = new openvdb::Vec3SGrid::ConstAccessor(grid->getConstAccessor());
/* only grids with uniform voxels can be used with VolumeRayIntersector */
if(grid->hasUniformVoxels()) {
uniform_voxels = true;
main_isector = new isector_t(*grid);
}
else {
uniform_voxels = false;
main_isector = NULL;
}
}
~vdb_float3_volume()
{
for(point_map::iterator iter = point_samplers.begin();
iter != point_samplers.end();
++iter)
{
delete iter->second;
}
for(box_map::iterator iter = box_samplers.begin();
iter != box_samplers.end();
++iter)
{
delete iter->second;
}
if(uniform_voxels) {
delete main_isector;
for(isect_map::iterator iter = isectors.begin();
iter != isectors.end();
++iter)
{
delete iter->second;
}
}
}
ccl_always_inline float3 sample(float x, float y, float z, int sampling)
{
openvdb::Vec3s r;
pthread_t thread = pthread_self();
if(sampling == OPENVDB_SAMPLE_POINT) {
point_map::iterator iter = point_samplers.find(thread);
point_sampler_t *sampler;
if(iter == point_samplers.end()) {
openvdb::Vec3SGrid::ConstAccessor *acc = new openvdb::Vec3SGrid::ConstAccessor(*accessor);
sampler = new point_sampler_t(*acc, *transfrom);
pair<pthread_t, point_sampler_t *> sampl(thread, sampler);
point_samplers.insert(sampl);
}
else {
sampler = iter->second;
}
r = sampler->wsSample(openvdb::Vec3d(x, y, z));
}
else {
box_map::iterator iter = box_samplers.find(thread);
box_sampler_t *sampler;
if(iter == box_samplers.end()) {
openvdb::Vec3SGrid::ConstAccessor *acc = new openvdb::Vec3SGrid::ConstAccessor(*accessor);
sampler = new box_sampler_t(*acc, *transfrom);
pair<pthread_t, box_sampler_t *> sampl(thread, sampler);
box_samplers.insert(sampl);
}
else {
sampler = iter->second;
}
r = sampler->wsSample(openvdb::Vec3d(x, y, z));
}
return make_float3(r.x(), r.y(), r.z());
}
ccl_always_inline bool intersect(const Ray *ray, Intersection */*isect*/)
{
pthread_t thread = pthread_self();
isect_map::iterator iter = isectors.find(thread);
isector_t *vdb_isect;
if(iter == isectors.end()) {
vdb_isect = new isector_t(*main_isector);
pair<pthread_t, isector_t *> inter(thread, vdb_isect);
isectors.insert(inter);
}
else {
vdb_isect = iter->second;
}
vdb_ray_t::Vec3Type P(ray->P.x, ray->P.y, ray->P.z);
vdb_ray_t::Vec3Type D(ray->D.x, ray->D.y, ray->D.z);
D.normalize();
vdb_ray_t vdb_ray(P, D, 1e-5f, ray->t);
if(vdb_isect->setWorldRay(vdb_ray)) {
// TODO
// isect->t = vdb_ray.t1(); // (kevin) is this correct?
// isect->u = isect->v = 1.0f;
// isect->type = ;
// isect->shad = shader;
// isect->norm = ;
// isect->prim = 0;
// isect->object = 0;
return true;
}
return false;
}
ccl_always_inline bool march(float *t0, float *t1)
{
pthread_t thread = pthread_self();
isect_map::iterator iter = isectors.find(thread);
isector_t *vdb_isect = iter->second;
openvdb::Real vdb_t0(*t0), vdb_t1(*t1);
if(vdb_isect->march(vdb_t0, vdb_t1)) {
*t0 = (float)vdb_isect->getWorldTime(vdb_t0);
*t1 = (float)vdb_isect->getWorldTime(vdb_t1);
return true;
}
return false;
}
ccl_always_inline bool has_uniform_voxels()
{
return uniform_voxels;
}
};
CCL_NAMESPACE_END
#endif /* WITH_OPENVDB */
#endif /* __UTIL_OPENVDB_H__ */

View File

@@ -0,0 +1,61 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2015, Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): Kevin Dietrich.
#
# ***** END GPL LICENSE BLOCK *****
set(INC
.
intern
)
set(INC_SYS
${GLEW_INCLUDE_PATH}
)
set(SRC
openvdb_capi.h
)
if(WITH_OPENVDB)
add_definitions(
-DWITH_OPENVDB
-DOPENVDB_USE_BLOSC
)
list(APPEND INC_SYS
${OPENEXR_INCLUDE_DIRS}
${OPENVDB_INCLUDE_DIRS}
)
list(APPEND SRC
intern/openvdb_dense_convert.cpp
intern/openvdb_primitive.cpp
intern/openvdb_reader.cpp
intern/openvdb_render.cpp
intern/openvdb_writer.cpp
openvdb_capi.cpp
openvdb_util.cpp
)
endif()
blender_add_lib(bf_intern_openvdb "${SRC}" "${INC}" "${INC_SYS}")

53
intern/openvdb/SConscript Normal file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/env python
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2015, Blender Foundation
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): Kevin Dietrich
#
# ***** END GPL LICENSE BLOCK *****
Import ('env')
sources = []
defs = []
incs = [
'.',
'intern',
'../guardedalloc',
'../../source/blender/blenkernel',
'../../source/blender/blenlib',
'../../source/blender/makesdna',
'../../source/blender/makesrna',
env['BF_OPENVDB_INC'],
env['BF_BOOST_INC'],
env['BF_GLEW_INC']
]
incs.append(env['BF_OPENEXR_INC'].split())
if env['WITH_BF_OPENVDB']:
defs.append('WITH_OPENVDB')
defs.append('DDF_DEBUG=0')
sources = env.Glob('*.cpp') + env.Glob('intern/*.cpp')
env.BlenderLib ( libname = 'bf_intern_openvdb', sources = sources, includes = Split(incs), defines = defs, libtype=['core'], priority = [364] )

View File

@@ -0,0 +1,263 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <openvdb/tools/ValueTransformer.h>
#include "openvdb_capi.h"
#include "openvdb_dense_convert.h"
#include "openvdb_writer.h"
using namespace openvdb;
namespace internal {
class MergeScalarGrids {
tree::ValueAccessor<const FloatTree> m_acc_x, m_acc_y, m_acc_z;
public:
MergeScalarGrids(const FloatTree *x_tree, const FloatTree *y_tree, const FloatTree *z_tree)
: m_acc_x(*x_tree)
, m_acc_y(*y_tree)
, m_acc_z(*z_tree)
{}
MergeScalarGrids(const MergeScalarGrids &other)
: m_acc_x(other.m_acc_x)
, m_acc_y(other.m_acc_y)
, m_acc_z(other.m_acc_z)
{}
void operator()(const Vec3STree::ValueOnIter &it) const
{
const math::Coord xyz = it.getCoord();
float x = m_acc_x.getValue(xyz);
float y = m_acc_y.getValue(xyz);
float z = m_acc_z.getValue(xyz);
it.setValue(Vec3s(x, y, z));
}
};
GridBase *OpenVDB_export_vector_grid(OpenVDBWriter *writer,
const std::string &name,
const float *data_x, const float *data_y, const float *data_z,
const int res[3],
float fluid_mat[4][4],
VecType vec_type,
const bool is_color,
const FloatGrid *mask)
{
math::CoordBBox bbox(Coord(0), Coord(res[0] - 1, res[1] - 1, res[2] - 1));
Mat4R mat = Mat4R(
fluid_mat[0][0], fluid_mat[0][1], fluid_mat[0][2], fluid_mat[0][3],
fluid_mat[1][0], fluid_mat[1][1], fluid_mat[1][2], fluid_mat[1][3],
fluid_mat[2][0], fluid_mat[2][1], fluid_mat[2][2], fluid_mat[2][3],
fluid_mat[3][0], fluid_mat[3][1], fluid_mat[3][2], fluid_mat[3][3]);
math::Transform::Ptr transform = math::Transform::createLinearTransform(mat);
FloatGrid::Ptr grid[3];
grid[0] = FloatGrid::create(0.0f);
tools::Dense<const float, tools::LayoutXYZ> dense_grid_x(bbox, data_x);
tools::copyFromDense(dense_grid_x, grid[0]->tree(), TOLERANCE);
grid[1] = FloatGrid::create(0.0f);
tools::Dense<const float, tools::LayoutXYZ> dense_grid_y(bbox, data_y);
tools::copyFromDense(dense_grid_y, grid[1]->tree(), TOLERANCE);
grid[2] = FloatGrid::create(0.0f);
tools::Dense<const float, tools::LayoutXYZ> dense_grid_z(bbox, data_z);
tools::copyFromDense(dense_grid_z, grid[2]->tree(), TOLERANCE);
Vec3SGrid::Ptr vecgrid = Vec3SGrid::create(Vec3s(0.0f));
/* Activate voxels in the vector grid based on the scalar grids to ensure
* thread safety later on */
for (int i = 0; i < 3; ++i) {
vecgrid->tree().topologyUnion(grid[i]->tree());
}
MergeScalarGrids op(&(grid[0]->tree()), &(grid[1]->tree()), &(grid[2]->tree()));
tools::foreach(vecgrid->beginValueOn(), op, true, false);
vecgrid->setTransform(transform);
if (mask) {
vecgrid = tools::clip(*vecgrid, *mask);
}
vecgrid->setName(name);
vecgrid->setIsInWorldSpace(false);
vecgrid->setVectorType(vec_type);
vecgrid->insertMeta("is_color", BoolMetadata(is_color));
writer->insert(vecgrid);
return vecgrid.get();
}
class SplitVectorGrid {
FloatGrid::Ptr m_grid_x, m_grid_y, m_grid_z;
public:
SplitVectorGrid()
{}
void operator()(const Vec3SGrid::Ptr &vecgrid)
{
Vec3s bg = vecgrid->background();
m_grid_x = FloatGrid::create(bg.x());
m_grid_y = FloatGrid::create(bg.y());
m_grid_z = FloatGrid::create(bg.z());
if (math::Transform::Ptr xform = vecgrid->transform().copy()) {
m_grid_x->setTransform(xform);
m_grid_y->setTransform(xform);
m_grid_z->setTransform(xform);
}
FloatGrid::Accessor acc_x = m_grid_x->getAccessor(),
acc_y = m_grid_y->getAccessor(),
acc_z = m_grid_z->getAccessor();
CoordBBox bbox;
for (Vec3SGrid::ValueOnCIter it = vecgrid->cbeginValueOn(); it; ++it) {
if (!it.getBoundingBox(bbox)) continue;
const Vec3s &val = it.getValue();
if (it.isTileValue()) {
m_grid_x->fill(bbox, val.x());
m_grid_y->fill(bbox, val.y());
m_grid_z->fill(bbox, val.z());
}
else {
acc_x.setValueOn(bbox.min(), val.x());
acc_y.setValueOn(bbox.min(), val.y());
acc_z.setValueOn(bbox.min(), val.z());
}
}
}
const FloatGrid::Ptr &grid_x() { return m_grid_x; }
const FloatGrid::Ptr &grid_y() { return m_grid_y; }
const FloatGrid::Ptr &grid_z() { return m_grid_z; }
};
void OpenVDB_import_grid_vector(OpenVDBReader *reader,
const std::string &name,
float **data_x, float **data_y, float **data_z,
const int res[3])
{
Vec3SGrid::Ptr vgrid = gridPtrCast<Vec3SGrid>(reader->getGrid(name));
#if 0
SplitVectorGrid vector_split;
vector_split(vgrid);
FloatGrid::Ptr grid[3];
math::CoordBBox bbox(Coord(0), Coord(res[0] - 1, res[1] - 1, res[2] - 1));
grid[0] = vector_split.grid_x();
tools::Dense<float, tools::LayoutXYZ> dense_grid_x(bbox);
tools::copyToDense(*grid[0], dense_grid_x);
*data_x = dense_grid_x.data();
grid[1] = vector_split.grid_y();
tools::Dense<float, tools::LayoutXYZ> dense_grid_y(bbox);
tools::copyToDense(*grid[1], dense_grid_y);
*data_y = dense_grid_y.data();
grid[2] = vector_split.grid_z();
tools::Dense<float, tools::LayoutXYZ> dense_grid_z(bbox);
tools::copyToDense(*grid[2], dense_grid_z);
*data_z = dense_grid_z.data();
#else
Vec3SGrid::Accessor acc = vgrid->getAccessor();
math::Coord xyz;
int &x = xyz[0], &y = xyz[1], &z = xyz[2];
int index = 0;
for (z = 0; z < res[2]; ++z) {
for (y = 0; y < res[1]; ++y) {
for (x = 0; x < res[0]; ++x, ++index) {
math::Vec3s value = acc.getValue(xyz);
(*data_x)[index] = value.x();
(*data_y)[index] = value.y();
(*data_z)[index] = value.z();
}
}
}
#endif
}
void OpenVDB_update_fluid_transform(const char *filename, float matrix[4][4], float matrix_high[4][4])
{
/* TODO(kevin): deduplicate this call */
initialize();
Mat4R fluid_mat = Mat4R(
matrix[0][0], matrix[0][1], matrix[0][2], matrix[0][3],
matrix[1][0], matrix[1][1], matrix[1][2], matrix[1][3],
matrix[2][0], matrix[2][1], matrix[2][2], matrix[2][3],
matrix[3][0], matrix[3][1], matrix[3][2], matrix[3][3]);
Mat4R fluid_matBig = Mat4R(
matrix_high[0][0], matrix_high[0][1], matrix_high[0][2], matrix_high[0][3],
matrix_high[1][0], matrix_high[1][1], matrix_high[1][2], matrix_high[1][3],
matrix_high[2][0], matrix_high[2][1], matrix_high[2][2], matrix_high[2][3],
matrix_high[3][0], matrix_high[3][1], matrix_high[3][2], matrix_high[3][3]);
math::Transform::Ptr transform = math::Transform::createLinearTransform(fluid_mat);
math::Transform::Ptr transformBig = math::Transform::createLinearTransform(fluid_matBig);
io::File file(filename);
file.open();
GridPtrVecPtr grids = file.getGrids();
GridBase::Ptr grid;
for (size_t i = 0; i < grids->size(); ++i) {
grid = (*grids)[i];
const std::string name = grid->getName();
size_t found = name.find("High");
if (found != std::string::npos) {
grid->setTransform(transformBig);
}
else {
grid->setTransform(transform);
}
}
file.close();
}
} // namespace internal

View File

@@ -0,0 +1,140 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __OPENVDB_DENSE_CONVERT_H__
#define __OPENVDB_DENSE_CONVERT_H__
#include <openvdb/openvdb.h>
#include <openvdb/tools/Dense.h>
#include <openvdb/tools/Clip.h>
#include "openvdb_primitive.h"
#include "openvdb_reader.h"
#include "openvdb_writer.h"
#define TOLERANCE 1e-3f
namespace internal {
template <typename GridType, typename T>
GridType *OpenVDB_export_grid(OpenVDBWriter *writer,
const std::string &name,
const T *data,
const int res[3],
float fluid_mat[4][4],
const openvdb::FloatGrid *mask)
{
using namespace openvdb;
math::CoordBBox bbox(Coord(0), Coord(res[0] - 1, res[1] - 1, res[2] - 1));
Mat4R mat = Mat4R(
fluid_mat[0][0], fluid_mat[0][1], fluid_mat[0][2], fluid_mat[0][3],
fluid_mat[1][0], fluid_mat[1][1], fluid_mat[1][2], fluid_mat[1][3],
fluid_mat[2][0], fluid_mat[2][1], fluid_mat[2][2], fluid_mat[2][3],
fluid_mat[3][0], fluid_mat[3][1], fluid_mat[3][2], fluid_mat[3][3]);
math::Transform::Ptr transform = math::Transform::createLinearTransform(mat);
typename GridType::Ptr grid = GridType::create(T(0));
tools::Dense<const T, openvdb::tools::LayoutXYZ> dense_grid(bbox, data);
tools::copyFromDense(dense_grid, grid->tree(), TOLERANCE);
grid->setTransform(transform);
if (mask) {
grid = tools::clip(*grid, *mask);
}
grid->setName(name);
grid->setIsInWorldSpace(false);
writer->insert(grid);
return grid.get();
}
template <typename GridType, typename T>
OpenVDBPrimitive *OpenVDB_import_grid(OpenVDBReader *reader,
const std::string &name,
T **data,
const int res[3])
{
using namespace openvdb;
typename GridType::Ptr grid_tmp = gridPtrCast<GridType>(reader->getGrid(name));
#if 0
math::CoordBBox bbox(Coord(0), Coord(res[0] - 1, res[1] - 1, res[2] - 1));
tools::Dense<T, tools::LayoutXYZ> dense_grid(bbox);
tools::copyToDense(*grid_tmp, dense_grid);
memcpy(*data, dense_grid.data(), sizeof(T) * res[0] * res[1] * res[2]);
#else
typename GridType::Accessor acc = grid_tmp->getAccessor();
math::Coord xyz;
int &x = xyz[0], &y = xyz[1], &z = xyz[2];
int index = 0;
for (z = 0; z < res[2]; ++z) {
for (y = 0; y < res[1]; ++y) {
for (x = 0; x < res[0]; ++x, ++index) {
(*data)[index] = acc.getValue(xyz);
}
}
}
#endif
OpenVDBPrimitive *vdb_prim = new OpenVDBPrimitive();
vdb_prim->setGrid(grid_tmp);
return vdb_prim;
}
openvdb::GridBase *OpenVDB_export_vector_grid(OpenVDBWriter *writer,
const std::string &name,
const float *data_x, const float *data_y, const float *data_z,
const int res[3],
float fluid_mat[4][4],
openvdb::VecType vec_type,
const bool is_color,
const openvdb::FloatGrid *mask);
void OpenVDB_import_grid_vector(OpenVDBReader *reader,
const std::string &name,
float **data_x, float **data_y, float **data_z,
const int res[3]);
void OpenVDB_update_fluid_transform(const char *filename,
float matrix[4][4],
float matrix_high[4][4]);
}
#endif /* __OPENVDB_DENSE_CONVERT_H__ */

View File

@@ -0,0 +1,92 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "openvdb_primitive.h"
OpenVDBPrimitive::OpenVDBPrimitive()
{}
OpenVDBPrimitive::~OpenVDBPrimitive()
{}
openvdb::GridBase &OpenVDBPrimitive::getGrid()
{
return *m_grid;
}
const openvdb::GridBase &OpenVDBPrimitive::getConstGrid() const
{
return *m_grid;
}
openvdb::GridBase::Ptr OpenVDBPrimitive::getGridPtr()
{
return m_grid;
}
openvdb::GridBase::ConstPtr OpenVDBPrimitive::getConstGridPtr() const
{
return m_grid;
}
void OpenVDBPrimitive::setGrid(openvdb::GridBase::Ptr grid)
{
m_grid = grid->copyGrid();
}
static openvdb::Mat4R convertMatrix(const float mat[4][4])
{
return openvdb::Mat4R(
mat[0][0], mat[0][1], mat[0][2], mat[0][3],
mat[1][0], mat[1][1], mat[1][2], mat[1][3],
mat[2][0], mat[2][1], mat[2][2], mat[2][3],
mat[3][0], mat[3][1], mat[3][2], mat[3][3]);
}
/* A simple protection to avoid crashes for cases when something goes wrong for
* some reason in the matrix creation. */
static openvdb::math::MapBase::Ptr createAffineMap(const float mat[4][4])
{
using namespace openvdb::math;
MapBase::Ptr transform;
try {
transform.reset(new AffineMap(convertMatrix(mat)));
}
catch (const openvdb::ArithmeticError &e) {
std::cerr << e.what() << "\n";
transform.reset(new AffineMap());
}
return transform;
}
void OpenVDBPrimitive::setTransform(const float mat[4][4])
{
using namespace openvdb::math;
Transform::Ptr transform = Transform::Ptr(new Transform(createAffineMap(mat)));
m_grid->setTransform(transform);
}

View File

@@ -0,0 +1,47 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __OPENVDB_PRIMITIVE_H__
#define __OPENVDB_PRIMITIVE_H__
#include <openvdb/openvdb.h>
class OpenVDBPrimitive {
openvdb::GridBase::Ptr m_grid;
public:
OpenVDBPrimitive();
~OpenVDBPrimitive();
openvdb::GridBase &getGrid();
const openvdb::GridBase &getConstGrid() const;
openvdb::GridBase::Ptr getGridPtr();
openvdb::GridBase::ConstPtr getConstGridPtr() const;
void setGrid(openvdb::GridBase::Ptr grid);
void setTransform(const float mat[4][4]);
};
#endif /* __OPENVDB_PRIMITIVE_H__ */

View File

@@ -0,0 +1,107 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "openvdb_reader.h"
#define COPY_MAX_BYTES 10485760 /* 10 Mb */
OpenVDBReader::OpenVDBReader()
: m_meta_map(new openvdb::MetaMap)
{
/* Although it is safe, it may not be good to have this here... */
openvdb::initialize();
m_file = NULL;
}
OpenVDBReader::~OpenVDBReader()
{
if (m_file) {
m_file->close();
delete m_file;
}
}
void OpenVDBReader::open(const std::string &filename)
{
if (m_file) {
m_file->close();
delete m_file;
}
m_file = new openvdb::io::File(filename);
m_file->setCopyMaxBytes(COPY_MAX_BYTES);
m_file->open();
m_meta_map = m_file->getMetadata();
}
void OpenVDBReader::floatMeta(const std::string &name, float &value)
{
value = m_meta_map->metaValue<float>(name);
}
void OpenVDBReader::intMeta(const std::string &name, int &value)
{
value = m_meta_map->metaValue<int>(name);
}
void OpenVDBReader::vec3sMeta(const std::string &name, float value[3])
{
openvdb::Vec3s meta_val = m_meta_map->metaValue<openvdb::Vec3s>(name);
value[0] = meta_val.x();
value[1] = meta_val.y();
value[2] = meta_val.z();
}
void OpenVDBReader::vec3IMeta(const std::string &name, int value[3])
{
openvdb::Vec3i meta_val = m_meta_map->metaValue<openvdb::Vec3i>(name);
value[0] = meta_val.x();
value[1] = meta_val.y();
value[2] = meta_val.z();
}
void OpenVDBReader::mat4sMeta(const std::string &name, float value[4][4])
{
openvdb::Mat4s meta_val = m_meta_map->metaValue<openvdb::Mat4s>(name);
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
value[i][j] = meta_val[i][j];
}
}
}
openvdb::GridBase::Ptr OpenVDBReader::getGrid(const std::string &name)
{
return m_file->readGrid(name);
}
size_t OpenVDBReader::numGrids() const
{
return m_file->getGrids()->size();
}

View File

@@ -0,0 +1,51 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __OPENVDB_READER_H__
#define __OPENVDB_READER_H__
#include <openvdb/openvdb.h>
class OpenVDBReader {
openvdb::MetaMap::Ptr m_meta_map;
openvdb::io::File *m_file;
public:
OpenVDBReader();
~OpenVDBReader();
void open(const std::string &filename);
void floatMeta(const std::string &name, float &value);
void intMeta(const std::string &name, int &value);
void vec3sMeta(const std::string &name, float value[3]);
void vec3IMeta(const std::string &name, int value[3]);
void mat4sMeta(const std::string &name, float value[4][4]);
openvdb::GridBase::Ptr getGrid(const std::string &name);
size_t numGrids() const;
};
#endif /* __OPENVDB_READER_H__ */

View File

@@ -0,0 +1,136 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <GL/glew.h>
#include <openvdb/openvdb.h>
#include "openvdb_primitive.h"
#include "openvdb_render.h"
namespace internal {
void OpenVDBPrimitive_draw_tree(OpenVDBPrimitive *vdb_prim, const bool draw_root, const bool draw_level_1, const bool draw_level_2, const bool draw_leaves)
{
using namespace openvdb;
using namespace openvdb::math;
FloatGrid::Ptr grid = gridPtrCast<FloatGrid>(vdb_prim->getGridPtr());
math::Vec3d wmin, wmax;
math::Vec3s color(0.0f);
math::Vec3s node_color[4] = {
math::Vec3s(0.0060f, 0.2790f, 0.6250f), // leaf nodes
math::Vec3s(0.8710f, 0.3940f, 0.0191f), // intermediate internal node levels
math::Vec3s(0.0432f, 0.3300f, 0.0411f), // first internal node level
math::Vec3s(0.0450f, 0.0450f, 0.0450f) // root
};
math::CoordBBox bbox;
glBegin(GL_LINES);
for (FloatTree::NodeCIter node_iter = grid->tree().cbeginNode(); node_iter; ++node_iter) {
node_iter.getBoundingBox(bbox);
const Vec3d min(bbox.min().x() - 0.5, bbox.min().y() - 0.5, bbox.min().z() - 0.5);
const Vec3d max(bbox.max().x() + 0.5, bbox.max().y() + 0.5, bbox.max().z() + 0.5);
wmin = grid->indexToWorld(min);
wmax = grid->indexToWorld(max);
const int level = node_iter.getLevel();
if (level == 0) {
if (!draw_leaves) {
continue;
}
color = node_color[0];
}
if (level == 1) {
if (!draw_level_2) {
continue;
}
color = node_color[1];
}
if (level == 2) {
if (!draw_level_1) {
continue;
}
color = node_color[2];
}
if (level == 3) {
if (!draw_root) {
continue;
}
color = node_color[3];
}
glColor3f(color[0], color[1], color[2]);
glVertex3f(wmin.x(), wmax.y(), wmax.z());
glVertex3f(wmax.x(), wmax.y(), wmax.z());
glVertex3f(wmin.x(), wmax.y(), wmin.z());
glVertex3f(wmax.x(), wmax.y(), wmin.z());
glVertex3f(wmin.x(), wmin.y(), wmax.z());
glVertex3f(wmax.x(), wmin.y(), wmax.z());
glVertex3f(wmin.x(), wmin.y(), wmin.z());
glVertex3f(wmax.x(), wmin.y(), wmin.z());
glVertex3f(wmin.x(), wmin.y(), wmin.z());
glVertex3f(wmin.x(), wmin.y(), wmax.z());
glVertex3f(wmin.x(), wmax.y(), wmin.z());
glVertex3f(wmin.x(), wmax.y(), wmax.z());
glVertex3f(wmax.x(), wmin.y(), wmin.z());
glVertex3f(wmax.x(), wmin.y(), wmax.z());
glVertex3f(wmax.x(), wmax.y(), wmin.z());
glVertex3f(wmax.x(), wmax.y(), wmax.z());
glVertex3f(wmin.x(), wmin.y(), wmin.z());
glVertex3f(wmin.x(), wmax.y(), wmin.z());
glVertex3f(wmax.x(), wmin.y(), wmin.z());
glVertex3f(wmax.x(), wmax.y(), wmin.z());
glVertex3f(wmax.x(), wmin.y(), wmax.z());
glVertex3f(wmax.x(), wmax.y(), wmax.z());
glVertex3f(wmin.x(), wmin.y(), wmax.z());
glVertex3f(wmin.x(), wmax.y(), wmax.z());
}
glEnd();
}
}

View File

@@ -0,0 +1,15 @@
#ifndef __OPENVDB_RENDER_H__
#define __OPENVDB_RENDER_H__
struct OpenVDBPrimitive;
namespace internal {
void OpenVDBPrimitive_draw_tree(OpenVDBPrimitive *vdb_prim, const bool draw_root,
const bool draw_level_1, const bool draw_level_2,
const bool draw_leaves);
}
#endif /* __OPENVDB_RENDER_H__ */

View File

@@ -0,0 +1,93 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "openvdb_writer.h"
OpenVDBWriter::OpenVDBWriter()
: m_grids(new openvdb::GridPtrVec())
, m_meta_map(new openvdb::MetaMap())
{
m_meta_map->insertMeta("creator", openvdb::StringMetadata("Blender/OpenVDBWriter"));
}
OpenVDBWriter::~OpenVDBWriter()
{}
void OpenVDBWriter::insert(const openvdb::GridBase::Ptr &grid)
{
m_grids->push_back(grid);
}
void OpenVDBWriter::insert(const openvdb::GridBase &grid)
{
m_grids->push_back(grid.copyGrid());
}
void OpenVDBWriter::insertFloatMeta(const std::string &name, const float value)
{
m_meta_map->insertMeta(name, openvdb::FloatMetadata(value));
}
void OpenVDBWriter::insertIntMeta(const std::string &name, const int value)
{
m_meta_map->insertMeta(name, openvdb::Int32Metadata(value));
}
void OpenVDBWriter::insertVec3sMeta(const std::string &name, const openvdb::Vec3s value)
{
m_meta_map->insertMeta(name, openvdb::Vec3SMetadata(value));
}
void OpenVDBWriter::insertVec3IMeta(const std::string &name, const openvdb::Vec3I value)
{
m_meta_map->insertMeta(name, openvdb::Vec3IMetadata(value));
}
void OpenVDBWriter::insertMat4sMeta(const std::string &name, const float value[4][4])
{
openvdb::Mat4s mat = openvdb::Mat4s(
value[0][0], value[0][1], value[0][2], value[0][3],
value[1][0], value[1][1], value[1][2], value[1][3],
value[2][0], value[2][1], value[2][2], value[2][3],
value[3][0], value[3][1], value[3][2], value[3][3]);
m_meta_map->insertMeta(name, openvdb::Mat4SMetadata(mat));
}
void OpenVDBWriter::setFileCompression(const int flags)
{
m_flags = flags;
}
void OpenVDBWriter::write(const std::string &filename) const
{
openvdb::io::File file(filename);
file.setCompression(m_flags);
file.write(*m_grids, *m_meta_map);
file.close();
/* Should perhaps be an option at some point */
m_grids->clear();
}

View File

@@ -0,0 +1,55 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __OPENVDB_WRITER_H__
#define __OPENVDB_WRITER_H__
#include <openvdb/openvdb.h>
class OpenVDBWriter {
openvdb::GridPtrVecPtr m_grids;
openvdb::MetaMap::Ptr m_meta_map;
int m_flags;
public:
OpenVDBWriter();
~OpenVDBWriter();
void insert(const openvdb::GridBase::Ptr &grid);
void insert(const openvdb::GridBase &grid);
void insertFloatMeta(const std::string &name, const float value);
void insertIntMeta(const std::string &name, const int value);
void insertVec3sMeta(const std::string &name, const openvdb::Vec3s value);
void insertVec3IMeta(const std::string &name, const openvdb::Vec3I value);
void insertMat4sMeta(const std::string &name, const float value[4][4]);
void setFileCompression(const int flags);
void write(const std::string &filename) const;
};
#endif /* __OPENVDB_WRITER_H__ */

View File

@@ -0,0 +1,248 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "openvdb_capi.h"
#include "openvdb_dense_convert.h"
#include "openvdb_primitive.h"
#include "openvdb_render.h"
#include "openvdb_util.h"
using namespace openvdb;
struct OpenVDBFloatGrid { int unused; };
struct OpenVDBIntGrid { int unused; };
struct OpenVDBVectorGrid { int unused; };
int OpenVDB_getVersionHex()
{
return OPENVDB_LIBRARY_VERSION;
}
void OpenVDB_get_grid_info(const char *filename, OpenVDBGridInfoCallback cb, void *userdata)
{
int ret = OPENVDB_NO_ERROR;
initialize();
try {
io::File file(filename);
file.open();
GridPtrVecPtr grids = file.getGrids();
int grid_num = grids->size();
for (size_t i = 0; i < grid_num; ++i) {
GridBase::ConstPtr grid = (*grids)[i];
std::string name = grid->getName();
std::string value_type = grid->valueType();
bool is_color = false;
if (grid->getMetadata< TypedMetadata<bool> >("is_color"))
is_color = grid->metaValue<bool>("is_color");
cb(userdata, name.c_str(), value_type.c_str(), is_color);
}
}
catch (...) {
catch_exception(ret);
}
}
void OpenVDB_update_fluid_transform(const char *filename,
float matrix[4][4],
float matrix_high[4][4])
{
int ret = OPENVDB_NO_ERROR;
try {
internal::OpenVDB_update_fluid_transform(filename, matrix, matrix_high);
}
catch (...) {
catch_exception(ret);
}
}
OpenVDBFloatGrid *OpenVDB_export_grid_fl(OpenVDBWriter *writer,
const char *name, float *data,
const int res[3], float matrix[4][4],
OpenVDBFloatGrid *mask)
{
OpenVDBFloatGrid *grid =
(OpenVDBFloatGrid *)internal::OpenVDB_export_grid<FloatGrid>(writer, name, data, res, matrix, (FloatGrid *)mask);
return grid;
}
OpenVDBIntGrid *OpenVDB_export_grid_ch(OpenVDBWriter *writer,
const char *name, unsigned char *data,
const int res[3], float matrix[4][4],
OpenVDBFloatGrid *mask)
{
OpenVDBIntGrid *grid =
(OpenVDBIntGrid *)internal::OpenVDB_export_grid<Int32Grid>(writer, name, data, res, matrix, (FloatGrid *)mask);
return grid;
}
OpenVDBVectorGrid *OpenVDB_export_grid_vec(struct OpenVDBWriter *writer,
const char *name,
const float *data_x, const float *data_y, const float *data_z,
const int res[3], float matrix[4][4], short vec_type,
const bool is_color, OpenVDBFloatGrid *mask)
{
OpenVDBVectorGrid *grid =
(OpenVDBVectorGrid *)internal::OpenVDB_export_vector_grid(writer, name,
data_x, data_y, data_z, res, matrix,
static_cast<openvdb::VecType>(vec_type),
is_color, (FloatGrid *)mask);
return grid;
}
OpenVDBPrimitive *OpenVDB_import_grid_fl(OpenVDBReader *reader,
const char *name, float **data,
const int res[3])
{
return internal::OpenVDB_import_grid<FloatGrid>(reader, name, data, res);
}
void OpenVDB_import_grid_ch(OpenVDBReader *reader,
const char *name, unsigned char **data,
const int res[3])
{
internal::OpenVDB_import_grid<Int32Grid>(reader, name, data, res);
}
void OpenVDB_import_grid_vec(struct OpenVDBReader *reader,
const char *name,
float **data_x, float **data_y, float **data_z,
const int res[3])
{
internal::OpenVDB_import_grid_vector(reader, name, data_x, data_y, data_z, res);
}
OpenVDBWriter *OpenVDBWriter_create()
{
return new OpenVDBWriter();
}
void OpenVDBWriter_free(OpenVDBWriter *writer)
{
delete writer;
writer = NULL;
}
void OpenVDBWriter_set_compression(OpenVDBWriter *writer, const int flag)
{
int compression_flags = io::COMPRESS_ACTIVE_MASK;
if (flag == 0) {
compression_flags |= io::COMPRESS_ZIP;
}
else if (flag == 1) {
compression_flags |= io::COMPRESS_BLOSC;
}
else {
compression_flags = io::COMPRESS_NONE;
}
writer->setFileCompression(compression_flags);
}
void OpenVDBWriter_add_meta_fl(OpenVDBWriter *writer, const char *name, const float value)
{
writer->insertFloatMeta(name, value);
}
void OpenVDBWriter_add_meta_int(OpenVDBWriter *writer, const char *name, const int value)
{
writer->insertIntMeta(name, value);
}
void OpenVDBWriter_add_meta_v3(OpenVDBWriter *writer, const char *name, const float value[3])
{
writer->insertVec3sMeta(name, value);
}
void OpenVDBWriter_add_meta_v3_int(OpenVDBWriter *writer, const char *name, const int value[3])
{
writer->insertVec3IMeta(name, value);
}
void OpenVDBWriter_add_meta_mat4(OpenVDBWriter *writer, const char *name, float value[4][4])
{
writer->insertMat4sMeta(name, value);
}
void OpenVDBWriter_write(OpenVDBWriter *writer, const char *filename)
{
writer->write(filename);
}
OpenVDBReader *OpenVDBReader_create()
{
return new OpenVDBReader();
}
void OpenVDBReader_free(OpenVDBReader *reader)
{
delete reader;
reader = NULL;
}
void OpenVDBReader_open(OpenVDBReader *reader, const char *filename)
{
reader->open(filename);
}
void OpenVDBReader_get_meta_fl(OpenVDBReader *reader, const char *name, float *value)
{
reader->floatMeta(name, *value);
}
void OpenVDBReader_get_meta_int(OpenVDBReader *reader, const char *name, int *value)
{
reader->intMeta(name, *value);
}
void OpenVDBReader_get_meta_v3(OpenVDBReader *reader, const char *name, float value[3])
{
reader->vec3sMeta(name, value);
}
void OpenVDBReader_get_meta_v3_int(OpenVDBReader *reader, const char *name, int value[3])
{
reader->vec3IMeta(name, value);
}
void OpenVDBReader_get_meta_mat4(OpenVDBReader *reader, const char *name, float value[4][4])
{
reader->mat4sMeta(name, value);
}
void OpenVDB_draw_primitive(OpenVDBPrimitive *vdb_prim,
const bool draw_root,
const bool draw_level_1,
const bool draw_level_2,
const bool draw_leaves)
{
internal::OpenVDBPrimitive_draw_tree(vdb_prim, draw_root, draw_level_1, draw_level_2, draw_leaves);
}

View File

@@ -0,0 +1,131 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __OPENVDB_CAPI_H__
#define __OPENVDB_CAPI_H__
#ifdef __cplusplus
extern "C" {
#endif
struct OpenVDBReader;
struct OpenVDBWriter;
struct OpenVDBFloatGrid;
struct OpenVDBIntGrid;
struct OpenVDBPrimitive;
struct OpenVDBVectorGrid;
int OpenVDB_getVersionHex(void);
typedef void (*OpenVDBGridInfoCallback)(void *userdata, const char *name, const char *value_type, bool is_color);
void OpenVDB_get_grid_info(const char *filename, OpenVDBGridInfoCallback cb, void *userdata);
enum {
OPENVDB_NO_ERROR = 0,
OPENVDB_ARITHM_ERROR = 1,
OPENVDB_ILLEGAL_ERROR = 2,
OPENVDB_INDEX_ERROR = 3,
OPENVDB_IO_ERROR = 4,
OPENVDB_KEY_ERROR = 5,
OPENVDB_LOOKUP_ERROR = 6,
OPENVDB_IMPL_ERROR = 7,
OPENVDB_REF_ERROR = 8,
OPENVDB_TYPE_ERROR = 9,
OPENVDB_VALUE_ERROR = 10,
OPENVDB_UNKNOWN_ERROR = 11,
};
enum {
VEC_INVARIANT = 0,
VEC_COVARIANT = 1,
VEC_COVARIANT_NORMALIZE = 2,
VEC_CONTRAVARIANT_RELATIVE = 3,
VEC_CONTRAVARIANT_ABSOLUTE = 4,
};
void OpenVDB_update_fluid_transform(const char *filename,
float matrix[4][4],
float matrix_high[4][4]);
struct OpenVDBFloatGrid *OpenVDB_export_grid_fl(struct OpenVDBWriter *writer,
const char *name, float *data,
const int res[3], float matrix[4][4],
struct OpenVDBFloatGrid *mask);
struct OpenVDBIntGrid *OpenVDB_export_grid_ch(struct OpenVDBWriter *writer,
const char *name, unsigned char *data,
const int res[3], float matrix[4][4],
struct OpenVDBFloatGrid *mask);
struct OpenVDBVectorGrid *OpenVDB_export_grid_vec(struct OpenVDBWriter *writer,
const char *name,
const float *data_x, const float *data_y, const float *data_z,
const int res[3], float matrix[4][4], short vec_type,
const bool is_color,
struct OpenVDBFloatGrid *mask);
struct OpenVDBPrimitive *OpenVDB_import_grid_fl(struct OpenVDBReader *reader,
const char *name, float **data,
const int res[3]);
void OpenVDB_import_grid_ch(struct OpenVDBReader *reader,
const char *name, unsigned char **data,
const int res[3]);
void OpenVDB_import_grid_vec(struct OpenVDBReader *reader,
const char *name,
float **data_x, float **data_y, float **data_z,
const int res[3]);
struct OpenVDBWriter *OpenVDBWriter_create(void);
void OpenVDBWriter_free(struct OpenVDBWriter *writer);
void OpenVDBWriter_set_compression(struct OpenVDBWriter *writer, const int flag);
void OpenVDBWriter_add_meta_fl(struct OpenVDBWriter *writer, const char *name, const float value);
void OpenVDBWriter_add_meta_int(struct OpenVDBWriter *writer, const char *name, const int value);
void OpenVDBWriter_add_meta_v3(struct OpenVDBWriter *writer, const char *name, const float value[3]);
void OpenVDBWriter_add_meta_v3_int(struct OpenVDBWriter *writer, const char *name, const int value[3]);
void OpenVDBWriter_add_meta_mat4(struct OpenVDBWriter *writer, const char *name, float value[4][4]);
void OpenVDBWriter_write(struct OpenVDBWriter *writer, const char *filename);
struct OpenVDBReader *OpenVDBReader_create(void);
void OpenVDBReader_free(struct OpenVDBReader *reader);
void OpenVDBReader_open(struct OpenVDBReader *reader, const char *filename);
void OpenVDBReader_get_meta_fl(struct OpenVDBReader *reader, const char *name, float *value);
void OpenVDBReader_get_meta_int(struct OpenVDBReader *reader, const char *name, int *value);
void OpenVDBReader_get_meta_v3(struct OpenVDBReader *reader, const char *name, float value[3]);
void OpenVDBReader_get_meta_v3_int(struct OpenVDBReader *reader, const char *name, int value[3]);
void OpenVDBReader_get_meta_mat4(struct OpenVDBReader *reader, const char *name, float value[4][4]);
void OpenVDB_draw_primitive(struct OpenVDBPrimitive *vdb_prim,
const bool draw_root,
const bool draw_level_1,
const bool draw_level_2,
const bool draw_leaves);
#ifdef __cplusplus
}
#endif
#endif /* __OPENVDB_CAPI_H__ */

View File

@@ -0,0 +1,80 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <openvdb/Exceptions.h>
#include "openvdb_capi.h"
#include "openvdb_util.h"
void catch_exception(int &ret)
{
try {
throw;
}
catch (const openvdb::ArithmeticError &e) {
std::cerr << e.what() << std::endl;
ret = OPENVDB_ARITHM_ERROR;
}
catch (const openvdb::IllegalValueException &e) {
std::cerr << e.what() << std::endl;
ret = OPENVDB_ILLEGAL_ERROR;
}
catch (const openvdb::IndexError &e) {
std::cerr << e.what() << std::endl;
ret = OPENVDB_INDEX_ERROR;
}
catch (const openvdb::IoError &e) {
std::cerr << e.what() << std::endl;
ret = OPENVDB_IO_ERROR;
}
catch (const openvdb::KeyError &e) {
std::cerr << e.what() << std::endl;
ret = OPENVDB_KEY_ERROR;
}
catch (const openvdb::LookupError &e) {
std::cerr << e.what() << std::endl;
ret = OPENVDB_LOOKUP_ERROR;
}
catch (const openvdb::NotImplementedError &e) {
std::cerr << e.what() << std::endl;
ret = OPENVDB_IMPL_ERROR;
}
catch (const openvdb::ReferenceError &e) {
std::cerr << e.what() << std::endl;
ret = OPENVDB_REF_ERROR;
}
catch (const openvdb::TypeError &e) {
std::cerr << e.what() << std::endl;
ret = OPENVDB_TYPE_ERROR;
}
catch (const openvdb::ValueError &e) {
std::cerr << e.what() << std::endl;
ret = OPENVDB_VALUE_ERROR;
}
catch (...) {
std::cerr << "Unknown error in OpenVDB library..." << std::endl;
ret = OPENVDB_UNKNOWN_ERROR;
}
}

View File

@@ -0,0 +1,31 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*
* Contributor(s): Kevin Dietrich
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef __OPENVDB_UTIL_H__
#define __OPENVDB_UTIL_H__
void catch_exception(int &ret);
#endif /* __OPENVDB_UTIL_H__ */

View File

@@ -74,7 +74,7 @@ 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, const char *noisefile_path, int use_fire, int use_colors);
struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, const char *noisefile_path, int use_fire, int use_colors, int use_sim);
void smoke_turbulence_free(struct WTURBULENCE *wt);
void smoke_turbulence_step(struct WTURBULENCE *wt, struct FLUID_3D *fluid);
@@ -109,6 +109,7 @@ 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_simulation(struct FLUID_3D *fluid, 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);

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