1
1

Compare commits

...

2565 Commits

Author SHA1 Message Date
3d9ab0904d do not set edges of selected faces to sharp in external mode
because in most cases only existing objects are packed into the FM mesh, and no fracturing happens,
where you want to set fracture edges to sharp.
2018-06-25 16:52:44 +02:00
34534660bc enabled angular limits/stiffness/damping for plastic constraints (uncomment only) 2018-06-23 16:25:43 +02:00
fc4fc38b22 added comments to most functions 2018-06-13 12:48:39 +02:00
b9128e0610 Merge branch 'master' into fm_master 2018-05-27 12:38:20 +02:00
c6a4615285 compile and link errors fixed 2018-05-27 12:33:27 +02:00
7ceb28ee7b compile fixes done, need to fix linking now 2018-05-26 13:38:06 +02:00
ef07153a94 compile fixes part1 2018-05-26 11:26:23 +02:00
e4c470efc6 Merge branch 'fracture_modifier' into fm_master 2018-05-26 03:32:49 +02:00
9a21afd18d fix for cmake failing to detect VS 2017 properly 2018-05-24 23:55:19 +02:00
d3b52a6cbc added ghost stop triggers
stopped shards also will get their constraints disabled and still attached partners will be stopped too
2018-05-24 14:45:27 +02:00
da4854a8b8 missed in last commit: rise BM_OMPLIMIT to avoid overheads with small datasets 2018-05-02 20:45:37 +02:00
f3ce2881c3 fix a clang warning, fix an improper initialisation for gcc, remove nonfunctional omp, rise BM_OMPLIMIT to avoid overheads with small datasets 2018-05-02 20:41:56 +02:00
dac9244425 crash fix for changing shardcount and refracture when doing automerge
forgot to refresh the merge data before merging, after refracturing
2018-04-25 22:09:25 +02:00
192ae864f4 added isIntact() query to regular rigidbody constraints, too 2018-04-25 14:17:26 +02:00
18ba072f17 immediately take constraint limit changes into account during rigidbody simulation 2018-04-17 14:55:27 +02:00
d451c4e831 fix for setting lower x linear limit 2018-04-15 12:57:56 +02:00
16ccab4748 Merge remote-tracking branch 'refs/remotes/origin/blender-v2.79b-release' into fracture_modifier 2018-04-14 20:53:09 +02:00
f4dc9f9d68 Fix T54360: FFMPEG bitrate not editable for all codecs
The bitrate selection was hidden when a CRF mode was chosen and then
switched to a codec that doesn't support CRF.
2018-03-22 15:10:42 +01:00
6f07673ce4 Fix compilation error
Recent fix was assuming some cleanup is done.
2018-03-22 09:56:06 +01:00
150dee260e Update addons submodule hash 2018-03-22 09:51:05 +01:00
55872de560 Fix T54234, add BLENDER_VERSION_CHAR to .plist 2018-03-22 09:48:31 +01:00
6bf458dfff Fixed: cache clearing when using multiple Alembic files. 2018-03-22 09:44:12 +01:00
61c3317688 Cleanup: Use more python way of checking boolean 2018-03-22 09:41:22 +01:00
0253b16180 Tracking: Make object created form tracks active and selected 2018-03-22 09:41:18 +01:00
3ed28ccb93 Tracking: Warn when no tracks are selected when creating mesh
Makes it more clear why mesh was not created this way.

Fixes T54368: 3D markers to mesh In MovieClipEditor Not working.
2018-03-22 09:41:10 +01:00
d791f3522e Fix T54348: Bone dissolve gives invalid hierarchy
Disconnected bones weren't handled correctly.
2018-03-22 09:39:11 +01:00
557e1b02de Fix bone dissolve using wrong envelope radius
Also correctly copy bone tip selection when dissolving.
2018-03-22 09:38:47 +01:00
5da3aecefd Fix T53478, T53430: Sequencer cut edge case fails
Previous fix for T53430 caused T54200.

The edge case for soft & hard cuts weren't working,
where the strip used start/end-still & the frame was placed exactly on
the start/end of of the sequence content.

T54200 fixed the end-still case but broke hard-cuts for all other cases.

This fixes the case for soft/hard cuts with/without start/end-still.
2018-03-19 11:36:25 +01:00
241c142248 Revert "Fix T53430: Cut at the strip end fails w/ endstill"
This reverts commit 855799ecc1.

Caused T54200
2018-03-19 11:36:18 +01:00
c5db594b92 Error passing context arg to marker menu
own mistake in 6981861fcf
2018-03-19 11:36:11 +01:00
e57a1bb86b API generating script: give better version for releases builds.
Was giving '2.62.1 <sha1>' even for releases, now rather giving nicer
'2.62a <sha1>' in that case.
2018-03-19 11:36:02 +01:00
4697e491b4 Fix T54206: bevel and inset operations repeat did not remember offset.
Now repeating the operator will use the previously chosen offset, either with
the modal operator or typed in. The modal operator will still start at zero.
2018-03-19 11:35:55 +01:00
852d63b835 Fix T54204: Wrong selection on Clean Tracks (Motion Tracking)
A mistake in a fix for T53612.

Regression in 2.79a, candidate for 2.79b :S
2018-03-19 11:35:46 +01:00
8ec398d401 Fix T54003: Particles - Size and random size not present in "physics" tab in Advanced mode
The check to see if `use_advanced_hair` was enabled was actually in two places
(render panel `draw` function and physics panel `poll` function). As these
properties are only in one place now the check in `draw` isn't needed anymore.

Related: T53513, a6c69ca57f
2018-03-19 11:35:20 +01:00
9accd8852b Bl;ender 2.79b: Begin 2.79b release cycle 2018-03-19 11:33:15 +01:00
c381b3fadc added vertexgroup to influence metaball radii
note, the weight (0...1) is normed to a size factor -0.5 ... 0.5 to also allow negative mball elements.
2018-02-28 17:54:10 +01:00
3cc1faf118 when sorting objects, keep mi->object_index aligned 2018-02-25 19:48:05 +01:00
d39fb8ffbb activate by constraint impulse and regular ghost triggers 2018-02-25 15:46:40 +01:00
930b6a0540 rna build fix (error when building debug) 2018-02-25 00:02:38 +01:00
882cf08e5e only calc FM mblur velocity layer at render time
this costs some performance
2018-02-24 17:32:50 +01:00
fb8acd8b33 optionally restore old activation behavior with broken constraints
this allows easier breaking / collapsing of objects
2018-02-24 11:20:44 +01:00
e88359152a compile fixes after merge 2018-02-22 13:03:08 +01:00
fb4fcd6e01 Merge remote-tracking branch 'refs/remotes/origin/blender-v2.79a-release' into fracture_modifier
Conflicts:
	source/blender/modifiers/intern/MOD_boolean.c
2018-02-22 13:02:34 +01:00
8928d99270 VSE: skip non image/movie w/ proxy dir storage
This would use uninitialized filename variable,
looked into supporting this however generating proxies currently only
works for movies.
2018-02-21 21:41:31 +11:00
9e707802c2 Depsgraph: Fix crash using --debug-depsgraph and --debug-depsgraph-no-threads
Was accessing past the array boundaries.

Should be safe for 2.79a.
2018-02-21 10:53:05 +01:00
ae358f92e6 fix, anim bind rotation was calculated incorrectly 2018-02-20 13:45:53 +01:00
db0f53ae3c fix for bind ngon problems (jumping rotations) 2018-02-19 18:46:30 +01:00
09aaee5640 Fix T53032: Image sequence works bad with Displace modifier
We shouldn't mix image pool acuisition with and without user provided,
the fact that internally image.c uses last frame from Image datablock
confuses the logic.
2018-02-19 14:38:25 +01:00
dc5aaac3a2 Blender 2.79a: Update submodules hash for addons 2018-02-19 11:33:45 +01:00
a4dbff33c9 Blender 2.79a: Prepare for release
Enter release state and make spacing to "a" more sane.

There is still at least one fix we want to get in, before declaring we are
ready for release.
2018-02-19 10:49:46 +01:00
750798a777 crash fix for deleting connected objects before its connectors 2018-02-18 11:20:39 +01:00
76dfe5f0b4 crash fix for FM objects being copied after connect 2018-02-18 02:31:37 +01:00
446ed1c516 rigidbody sort fix for external constraints 2018-02-18 00:51:05 +01:00
4e1c31ca7b crash fix for external constraints
ensure refresh of "parent" FM object on every refresh of connected objects, also ensure evaluation order in rigidbody.c / bullet (parent always after children)
2018-02-17 13:42:26 +01:00
59cc0bfef5 Fix T54075: Align Objects fails w/ empty mesh 2018-02-15 15:49:03 +11:00
9268ff4b21 Cleanup: Python context access
Avoid access from bpy when it's already declared.
2018-02-15 15:49:03 +11:00
7ae9b96ac6 Fix T54072: Crash splitting edges 2018-02-15 15:49:03 +11:00
bc891ad124 Fix T53958: Sequencer zoom 1:1 fails 2018-02-15 15:49:03 +11:00
3982a36c10 Minor change to last commit
Keep mode checks simple, nest other checks in their body.
2018-02-15 15:49:03 +11:00
f5c0df3601 Fix T53986: Crash saving during sculpt stroke
Also remove unused struct member.
2018-02-15 15:49:02 +11:00
81697c772c Fix: msvc build error with bli_fileops.h
bli_fileops.h was using uint64_t without including the proper header.

issue triggered by rBb0af44fa4d7a2e134b315c49a4fbdf573f781004
2018-02-15 15:49:02 +11:00
6f45c9d6c6 Fix T50630: Fluid fails on win32 w/ unicode paths
Allow overriding gzip open w/ elbeem.
2018-02-15 15:49:02 +11:00
d1281bf993 Fix navmesh creation w/ multiple objects
D2976 by @dertom
2018-02-15 15:49:02 +11:00
c40e9a1ad2 Docs: invoke_search_popup uses bl_property
Also add code example in docs.
2018-02-15 15:49:02 +11:00
748ada90b5 further constraint related crash fixes 2018-02-14 21:04:00 +01:00
6868e0a7d9 crash fix attempts
can still crash if you refracture a child object while its attached to others (constraints become invalid)
2018-02-14 20:26:07 +01:00
6249febf45 re-implementation of external constraints 2018-02-14 18:41:30 +01:00
d16510425f external constraints load / refresh fix 2018-02-13 19:17:52 +01:00
c491b50139 fix potential memory leak 2018-02-13 18:19:18 +01:00
4eb44b8610 another implementation attempt for external constraints 2018-02-13 18:07:41 +01:00
97a677e788 first attempt of brickify fracture 2018-02-12 22:19:07 +01:00
21f19224f3 Fix part of T53080: don't use current scene world for icon previews.
This can be very slow if it contains a big texture, and it's not
necessarily setup in a useful way anyway, and materials can be used
in multiple scenes.
2018-02-12 20:37:41 +01:00
c3d5668516 fix for "double rotation" in bind
if both objects were rotated, rotations were added up unnecessarily.
2018-02-11 10:58:44 +01:00
032b14a951 fractal boolean with regular alignment, animation bind tweaks 2018-02-10 23:50:25 +01:00
f29a691fb4 inner material is part of presets now 2018-02-09 17:40:31 +01:00
f6abf9d0ba Fix (unreported) crash when duplicating a FileBrowser window in preview draw mode.
We did not clear preview or smoothscroll timers pointers in copy code...
2018-02-09 16:25:08 +01:00
e5917d624e Fix missing group duplicated by hair in render
Was happening when viewport visibility on the particle system is disabled.
This became an issue after c45afcf, but the actual issue goes a bit deeper
and the following aspects were involved:

- Relations builder for particle system was ignoring particle system if
  it's visibility is not enabled for viewport. This is something what
  shouldn't have been done -- depsgraph relations are supposed to be the
  same no matter if it's viewport or render.

- Relation builder was only dealing with duplication set to object, but
  was ignoring group duplication.

This is NOT a regression since 2.79, but a regression since 2.79a-rc1.
2018-02-06 15:37:24 +01:00
ea82f4ce4e fix an ffmpeg qtrle crasher 2018-02-04 22:21:20 +01:00
bac2541ffa Fix T53686: VSE Render crash when zooming timeline.
Epic fail from recent 'security' fixes (rBe04d7c49dca9). ;)

To be backported to 2.79a!
2018-02-01 15:56:37 +01:00
3e2909cf9d Fix T53962: Cycles OpenCL compile error in some scenes.
This part of 212a8d9e needed to be ported over for 2ca933f to work.
2018-01-31 15:28:19 +01:00
1052497aad Fix possible concurency issue in mesh normals computation.
Failure in own code from last December, thanks @sergey for finding it.

To be backported to 2.79a.
2018-01-31 12:46:06 +01:00
567b4fa794 Fix T52634: EditMesh Remove doubles could hang
A single diagonal axis was used for sorting coordinates,
the algorithm relied on users not having vertices axis aligned.

Use BLI_kdtree to remove doubles instead.

Overall speed varies, it's more predictable than the previous method.
Some typical tests gave speedup of ~1.4x - 1.7x.
2018-01-31 09:56:53 +11:00
d7c7ce2a7b BLI_kdtree: utility function to remove doubles 2018-01-31 09:56:53 +11:00
f5ef3a7d81 animation bind rotation fix, some dynamic mode fixes 2018-01-29 20:51:25 +01:00
de563552da IMB: Add asserts that returned fps and fps base are strictly positives.
Forgot to add that in previous commit, also related to T53003.
2018-01-26 15:18:30 +01:00
3ee1a7978f Related to T53003: tweak scene fps range.
Move restricted 'reasonable' range to ui_range, and allow wider values
for manual settings.
2018-01-26 15:18:30 +01:00
a73b390f48 Fix T53003: IMB: Invalid framerate handling due to short integer overflow.
FFMPEG uses int for the numerator, while Blender uses a short. So in
cases people gave weird exotic framerate values and we cannot reduce
enough the numerator, we'd get totally weird values (even negative frame
rates sometimes!)

Now we add checks for short overflow and approximate as best as possible
in that case (error should not matter unless you have shots of at least
several hundreds of hours ;) ).
2018-01-26 15:18:30 +01:00
0e37c98257 Fix part of T53080: all material previews re-rendering after undo.
This reverts commit dc2617130b, which disabled
writing of previews for undo. While this uses some memory, re-rendering all
previews is very expensive, especially if for example you have lots of materials
using high-res image textures.
2018-01-26 08:45:37 +01:00
8fedf97883 improved rotation calculation in bind animated mesh 2018-01-26 00:08:41 +01:00
0859c99bf2 fix for loading crash with dynamic fracture
forgot to copy the fracmesh, but this now might increase mem usage
2018-01-25 16:08:25 +01:00
4c1bed0a12 Fix T53593: sculpt brush rake spacing bug after recent bugfix. 2018-01-24 16:06:13 +01:00
95a31c8a3a fix attempt for split shard to island crashes
customdata was incorrectly freed and corrupted the memory
2018-01-24 14:28:36 +01:00
d68f53a3f3 added a limit / searchradius for animated mesh binding
bind operator now clears the simulation cache too
2018-01-23 18:05:14 +01:00
2f5a027b94 Cycles: Fix bug in user preferences with factory startup
Namely, the issue would happen when CPU device was never used before.
Issue with wrong merge conflict resolution.
2018-01-23 16:16:09 +01:00
da98a2c5ff forgot to include workaround for changing vertex counts 2018-01-22 22:42:41 +01:00
3691bf1a20 fix attempt for bind animated mesh 2018-01-22 21:33:31 +01:00
61335d853d Blender 2.79a: Use latest dev-tools
This way release checker used by Linux release environment is corrected.
2018-01-22 15:48:41 +01:00
43d1bfea40 Blender 2.79a: Show both version char and rc text on splash 2018-01-22 14:41:22 +01:00
4cda3e2d87 Blender 2.79a: Use proper version char 2018-01-22 14:38:57 +01:00
dc4afef1da Blender 2.79a: Point submodules to updated hash 2018-01-22 14:32:20 +01:00
8553449cf2 Task scheduler: Start with suspended pool to avoid threading overhead on push
The idea is to avoid any threading overhead when we start pushing tasks in a
loop. Similarly to how we do it from the new dependency graph. Gives couple of
percent of speedup here, but also improves scalability.
2018-01-22 12:57:08 +01:00
af83535dd0 Task scheduler: Clarify why do we need an atomic add of 0 2018-01-22 12:56:35 +01:00
a3616980c6 Cycles: Fix crash opening user preferences after adding extra GPU
We can not store pointers to elements of collection property in the
case we modify that collection. This is like storing pointers to
elements of array before calling realloc().
2018-01-22 12:54:00 +01:00
2f6d7946a4 Cycles tests: Add extra image tests 2018-01-22 12:39:11 +01:00
c3237cdc13 Fix T53012: Shadow catcher creates artifacts on contact area
The issue was caused by light sample being evaluated to nan at some point.
This is root of the cause which is to be fixed, but is very hard to trace down
especially via ssh (the issue only happens on AVX2 release build). Will give it
a closer look when back to my AVX2 machine.

For until then this is a good check to have anyway, it corresponds to what's
happening in regular radiance sum.
2018-01-22 12:39:11 +01:00
417170159a Fix retro-futuristical atempt to include some keymaps for non-backported feature from master.
Was making unittests unhappy.
2018-01-22 12:32:08 +01:00
6036bf7497 Revert "Node selection: Stop operator when mouse selection selected a node"
This reverts commit bf58ec9265.
2018-01-22 12:22:44 +01:00
a50c381fac Cycles: Fix difference in image Clip extension method between CPU and GPU
Our own implementation was behaving different comparing to OSL and GPU,
namely on the border pixels OSL and CUDA was doing interpolation with
black, but we were clamping coordinate.

This partially fixes issue reported in T53452.

Similar change should also be done for 3D interpolation perhaps, but this
is to be investigated separately.
2018-01-22 12:20:51 +01:00
b90f3928a3 Fix T53850: Lock to Cursor breaks 3D manipulators 2018-01-22 20:34:44 +11:00
cae8c68ca6 Fix manual lookups (data is now lowercase) 2018-01-22 10:14:20 +11:00
79563d2a33 Fix old files with changed node socket type not loading correctly.
This would lead to sock.default_value pointing to the wrong data type,
possibly causing crashes. Unfortunately, this bug will still exist for
older Blender versions that try to load newer files, which makes
changing the type of a node socket problematic.
2018-01-20 23:35:10 +01:00
82f7726549 crash fix at fracturing, customdata layer index handlng was incorrect 2018-01-19 21:30:23 +01:00
b6481cbbe5 Fix T53823: Particle weight brush crash
Entering particle edit mode w/ the weight brush enabled crashed
on non-hair particle systems.
2018-01-19 15:06:19 +11:00
5b3538e02a Fix T53832: Particle weight paint crash
Drawing hair weights read before the hair array start.
This code could be improved since it currently copy-pastes,
from do_particle_interpolation, but this would need larger changes.

For now just correct existing logic.
2018-01-19 15:06:19 +11:00
c3873a5156 Fix memory leak in recent curve refactor
5b25605761fb7
2018-01-18 19:24:49 +01:00
8dbd5ea4c8 Fix buffer overflow vulnerability in curve, font, particles code.
Solves these security issues from T52924:
CVE-2017-12102
CVE-2017-12103
CVE-2017-12104

While the specific overflow issue may be fixed, loading the repro .blend
files may still crash because they are incomplete and corrupt. The way
they crash may be impossible to exploit, but this is difficult to prove.

Differential Revision: https://developer.blender.org/D3002
2018-01-18 19:24:43 +01:00
9287434fa1 Fix buffer overflow vulnerabilities in mesh code.
Solves these security issues from T52924:
CVE-2017-12081
CVE-2017-12082
CVE-2017-12086
CVE-2017-12099
CVE-2017-12100
CVE-2017-12101
CVE-2017-12105

While the specific overflow issue may be fixed, loading the repro .blend
files may still crash because they are incomplete and corrupt. The way
they crash may be impossible to exploit, but this is difficult to prove.

Differential Revision: https://developer.blender.org/D3002
2018-01-18 19:24:32 +01:00
2ae9d757b3 Fix Linux/GCC compiler warning in recent fixes. 2018-01-18 19:23:45 +01:00
04c5131281 Fix buffer overflow vulernability in thumbnail file reading.
Fixes CVE-2017-2908 from T52924.

Differential Revision: https://developer.blender.org/D3001
2018-01-18 19:23:40 +01:00
16718fe4ea Fix buffer overflows in TIFF, PNG, IRIS, DPX, HDR and AVI loading.
Solves these security issues from T52924:
CVE-2017-2899
CVE-2017-2900
CVE-2017-2901
CVE-2017-2902
CVE-2017-2903
CVE-2017-2904
CVE-2017-2905
CVE-2017-2906
CVE-2017-2907
CVE-2017-2918

Differential Revision: https://developer.blender.org/D2999
2018-01-18 19:23:33 +01:00
a972729895 Memory: add MEM_malloc_arrayN() function to protect against overflow.
Differential Revision: https://developer.blender.org/D3002
2018-01-18 19:23:27 +01:00
5ddcad4377 Fix T53810: Crash removing a scene used in render
Header drawing accesses the scene too.
2018-01-17 14:06:54 +11:00
8fd65dc0e9 corrected some more special constraint breaking activation behavior (was activating too much) 2018-01-17 00:12:49 +01:00
f72e6fcdfa Revert "Fix T53752: Draw curve fails w/ stylus"
This reverts commit d0e0f33f57.

Requested by author, since it raised new issues, better not have it in
bugfix release!
2018-01-16 17:19:17 +01:00
022d64008e small transform fix for animated mesh binding 2018-01-15 16:55:29 +01:00
7ef50296e0 some corrective changes in special breaking activation behavior 2018-01-14 20:13:53 +01:00
80671518eb put animated mesh settings to new panel, some fixes 2018-01-14 20:12:53 +01:00
91ce295796 Fix T53772: Presets don't support colons 2018-01-14 14:51:59 +11:00
db72a8a6e0 fix for binding, should leave no shards behind now 2018-01-14 01:34:12 +01:00
13973a5bbf Fix T47212: Luminance Key not working with HDR and out-of-gamut ranges.
Differential Revision: https://developer.blender.org/D2981
2018-01-13 02:50:52 +01:00
824c039230 Fix T53567: Negative pixel values causing artifacts with denoising
Now negative color values are clamped to zero before the actual denoising.
2018-01-13 02:42:39 +01:00
Stefan Werner
a623c02569 Cycles: Fixed compilation of CUDA kernels. Follow-up fix for my last commit. 2018-01-13 02:41:57 +01:00
Stefan Werner
b3adce7766 Cycles: Workaround for performance loss with the CUDA 9.0 SDK.
CUDA 9.0.176 apparently caused some slow down on high-end Pascal cards that can be mitigated by increasing the number of registers. See https://developer.blender.org/F1142667 for a detailed comparison.
2018-01-13 02:41:25 +01:00
30a0459f2c Fix T53692: OpenCL multi GPU rendering not using all GPUs.
Ensure each OpenCL device has a unique ID even if the hardware ID is not
unique for some reason.
2018-01-13 02:40:09 +01:00
2ca933f457 Fix T53755: Cycles OpenCL lamp shaders have incorrect normal. 2018-01-13 02:38:08 +01:00
758d7350d6 fixes for bind animated mesh: transform and jump issues 2018-01-13 00:39:18 +01:00
2a41da1d91 experimental bind of animated vertices (other object) to shards
this transfers vertex motion during simulation and allows some kind of "deformation" of the fractured mesh, without
refracturing it
2018-01-12 13:15:22 +01:00
f12ab4e196 Cleanup: SGI format, remove unused struct members 2018-01-12 21:20:52 +11:00
7b8b621c1d Fix SGI foramt reader CVE-2017-2901
Integer Overflow Code Execution Vulnerability.

Reader no longer crashes on corrupt images (from own fuzz testing).
2018-01-12 21:20:52 +11:00
6a86a1f082 Cleanup: SGI format, avoid overflow
Harmless but causes warnings
2018-01-12 21:20:52 +11:00
e9548a6184 Cleanup: SGI format, use uint/short/char types 2018-01-12 21:20:52 +11:00
20cccb1561 Fix bmesh.utils.face_join arg parsing 2018-01-12 15:56:53 +11:00
57b11d8b4e Fix T53311: transform edge/normal orientation
When the edge is aligned with it's own normals,
transform orientation wasn't aligned with the edge.
2018-01-12 15:56:53 +11:00
38357cd004 Fix background_job template
Update attribute and use empty file operator
2018-01-12 15:55:30 +11:00
d0e0f33f57 Fix T53752: Draw curve fails w/ stylus 2018-01-11 11:22:37 +11:00
ee7042173c fixed a crasher when moving an object in dynamic fracture and when attempting to undo/redo FM removal 2018-01-10 22:00:45 +01:00
91ea5336a5 removed some performance-deadly reallocs in remesher
remesher now atleast responds again to user input and runs with 0.6fps with 60^3 particles
2018-01-10 04:09:54 +01:00
db74c06dd6 Additional fix after cherry-picking rB870840e8b7dd (in rB72151f3e36b). 2018-01-09 14:31:20 +01:00
e4e2e3a15d Add an 'atomic cas' wrapper for pointers.
Avoids having to repeat obfuscating castings everywhere...
2018-01-09 14:27:32 +01:00
71e0894e0d Fix scalability issue in threaded code of Mesh normals computation.
We tried to do as much as possible in a single threaded callback, which
lead to using some nasty tricks like fake atomic-based spinlocks to
perform some operations (like float addition, which has no atomic
intrinsics).

While OK with 'standard' low number of working threads (8-16), because
collision were rather rare and implied memory barrier not *that* much
overhead, this performed poorly with more powerful systems reaching the
100 of threads and beyond (like workstations or render farm hardware).

There, both memory barrier overhead and more frequent collisions would
have significant impact on performances.

This was addressed by splitting further the process, we now have three
loops, one over polys, loops and vertices, and we added an intermediate
storage for weighted loop normals. This allows to avoid completely any
atomic operation in body of threaded loops, which should fix scalability
issues. This costs us slightly higher temp memory usage (something like
50Mb per million of polygons on average), but looks like acceptable
tradeoff.

Further more, tests showed that we could gain an additional ~7% of speed
in computing normals of heavy meshes, by also parallelizing the last two
loops (might be 1 or 2% on overall mesh update at best...).

Note that further tweaking in this code should be possible once Sergey
adds the 'minimum batch size' option to threaded foreach API, since very
light loops like the one on loops (mere v3 addition) require much bigger
batches than heavier code (like the one on polys) to keep optimal
performances.
2018-01-09 14:14:59 +01:00
72151f3e36 Subsurf: Avoid possible use of partially initialized edge hash 2018-01-09 14:12:17 +01:00
83b0603061 Subsurf: Avoid global lock for loops and orig index layers
This is a bit annoying to have per-DM locking, but it's way better (as in, up to
4 times better) for playback speed when having lots of subsurf objects,
2018-01-09 14:11:58 +01:00
b01fe3bf01 install_deps: Fix OCIO always re-cloning its whole git repository. 2018-01-08 17:23:33 +01:00
4c8aa61be2 No groping in Blender's Tracker!
This a small cleanup of something which I think is just a typo anyway.

With all the recent talks of harrassment and groping, I think we better avoid
that within our source code! :)

Reviewers: sergey

Reviewed By: sergey

Tags: #motion_tracking

Differential Revision: https://developer.blender.org/D2979
2018-01-08 17:23:22 +01:00
a1d05ac2a1 Fix T53612: Blender crashes on CleanTracks with 'DELETE_SEGMENTS' and a disabled marker
Simple fix, which is totally safe for 2.79a!
2018-01-08 17:23:09 +01:00
0c365472b6 Fix T53509: Datablock ID Properties attached to bpy.types.Material are not loaded.
Stupid mistake in material reading code, thanks to Simon Wendsche (@BYOB) for the investigation and fix!

To be backported to 2.79a.
2018-01-08 17:23:02 +01:00
010cf35e7e (Nodes) Display image name if any in the Image and Texture Image node title 2018-01-08 17:21:45 +01:00
2a9abc0f5e Fix T53650: remove hard limits on force field size and max distance.
Differential Revision: https://developer.blender.org/D2987
2018-01-08 17:21:34 +01:00
Dalai Felinto
e4dce3b3d7 Fix leak when rendering OpenGL animations
We were duplicating rectf twice :/

Patch by Clément Foucault.
2018-01-08 17:21:16 +01:00
243b961c29 Fix T52953: Crash removing material 2018-01-08 17:21:04 +01:00
42e207b599 Fix T53678: Smart Project UV margin ignores units 2018-01-08 17:19:15 +01:00
32fb50179f nstall_deps: llvm downloads new website location
Patch by Lucas Walter (@lucasw), thanks.

Reviewers: mont29

Reviewed By: mont29

Subscribers: mont29

Differential Revision: https://developer.blender.org/D2983
2018-01-08 17:18:52 +01:00
Dalai Felinto
c70a45027d Fix T53513: Particle size showing in multiple places
Technically this was introduced in 01b547f993 when
exposing size and randomness for particles.

This "fixes" makes sure particle size and size randomness is always in the
Render panel when it affects the particle system (i.e., always unless using
advanced hair or hair that is not rendering groups/objects).
2018-01-08 17:17:01 +01:00
8f7030e5f3 Fix T53639: text sequence strips no stamped into render.
Differential Revision: https://developer.blender.org/D2977
2018-01-08 17:16:46 +01:00
405874bd79 Fix MSVSC2017 error
The last compiler version needs this include
2018-01-08 17:16:05 +01:00
6afe655be0 bpy_extras: add missing colorband keymap to keyconfig_utils.py
fixes failing ctest script_load_keymap
2018-01-08 17:15:44 +01:00
c721f93958 Fix missing SpinLock typedef on macOS 2018-01-08 16:49:31 +01:00
dfed7c48ac Fix T53068: AMD Threadripper not working well with Blender
The issue was caused by SpinLock implementation in old pthreads we ar eusing on
Windows. Using newer one (2.10-rc) demonstrates same exact behavior. But likely
using own atomics and memory barrier based implementation solves the issue.

A bit annoying that we need to change such a core part of Blender just to make
specific CPU happy, but it's better to have artists happy on all computers.

There is no expected downsides of this change, but it is so called "works for
me" category. Let's see how it all goes.
2018-01-08 16:49:27 +01:00
391f7cc406 Cycles: Fix compilation error of standalone application 2018-01-08 16:49:22 +01:00
b6f3fec259 Cycles: Fix compilation error with OIIO compiled against system PugiXML 2018-01-08 16:49:16 +01:00
49f57e5346 Cycles: Fix compilation error with latest OIIO
There was some changes about namespaces, which causes ambiguities.

Replaces using namespace with an explicit symbols we need. Is good idea to NOT
pull in the whole namespace anyway!
2018-01-08 16:49:11 +01:00
9a5320aea3 Fix T52818: Tangent space calculation is really slow for high-density mesh with degenerated topology
Now we replace O(N^2) computational complexity with O(N) extra memory penalty.
Memory is much cheaper than CPU time. Keep in mind, memory penalty is like
4 megabytes per 1M vertices.
2018-01-08 16:47:08 +01:00
85dc915413 Mikkspace: Cleanup, reduce indentation level 2018-01-08 16:47:01 +01:00
4c46f69376 Fix T53398: Surface deform modifier says that convex polygons are concave for big faces
Dot-product for angle check need either to be divided by vectors magnitude or be
calculated for normalized vectors.
2018-01-08 16:46:50 +01:00
b8bdca8c0a Fix T53499: Cannot load DPX files
The issue was caused by unspecified color transfer. New behavior gives same
result as other viewers here, so likely is fine :)
2018-01-08 16:46:37 +01:00
ba40d8f331 Fix T53007: OpenSubdiv + transparency = artefact/crashes 2018-01-08 16:46:08 +01:00
3ad84309df Fix T52940: VSE Glow Effect Strip on transparent images has no blur 2018-01-08 16:45:57 +01:00
09c387269a Fix T52982: Join operator with context override crashes Blender 2.79 2018-01-08 16:45:45 +01:00
259e9ad00d Fix T52927: Compositor wrong scale when scale size input is connected to complex node
The issue here is that we can not read scale from socket when determining
dependent area of interest. This area will depend on current pixel. Now fall
back to more stupid but reliable thing: if scale size input is connected to some
nodes, we use the whole frame as area of interest.
2018-01-08 16:45:33 +01:00
d305c10104 Fix T52920: Saving Tiff Files type Blender crashes
Was only happening for 3 and 1 channel sources.
2018-01-08 16:45:07 +01:00
9f916baa70 Fix T52086: Graph editor "normalize" drag errors for integers 2018-01-08 16:44:42 +01:00
754630cee4 Fix T52823: New Depsgraph - Shrinkwrap crashes blender
The issue was caused by threading conflict around looptris: it was possible
that DM will return non-NULL but non-initialized array of looptris.

Thanks Campbell for second pair of eyes!
2018-01-08 16:42:36 +01:00
00d8097510 Fix T52763: Boolean problem with vertex group 2018-01-08 16:42:27 +01:00
7377b36660 Fix copy-paste error in recent particles fix
Was intersecting same triangle twice.
2018-01-08 16:42:16 +01:00
17c00d222f Fix T52732: Particle system volume grid particles out of volume
Use more watertight and robust intersection test.

It uses now ray to triangle intersection, but it's all fine because segment was
covering the whole bounding box anyway.
2018-01-08 16:42:09 +01:00
1b8e8326b4 Fix T52537: Dyntopo "detail flood fill" doesn't work in some cases
Mainly when object origin is not at the geometry bounding box center.

Seems to be straightforward to fix, hopefully it doesn't break some obscure case
where this was a desired behavior.
2018-01-08 16:41:39 +01:00
3ffb0f6983 Cycles: Tweaks to avoid compilation error of megakernel
Also moved code out of deep-inside ifdef block, otherwise it was quite confusing.
2018-01-08 16:38:36 +01:00
6f19787e52 Fix T53552: Unneeded particle cache reset on frame change
There shouldn't be a time dependency to cache reset operation.
2018-01-08 15:26:51 +01:00
0596d208a0 Depsgraph: Add missing checks from previous commit 2018-01-08 15:24:12 +01:00
76032b133c Depsgraph: Don't make non-dynamic hair dependent on time
This way hair system used for static forest does not make playblack slow.

A bit dangerous, but let's see how far we can go!
2018-01-08 15:21:21 +01:00
8cdda3d2ad Fix T53547: Metaballs as dupli objects are not updated with the new Depsgraph
Follow relations from old dependency graph.
2018-01-08 15:14:05 +01:00
7103c6ef3b Depsgraph: Fix relations for metaballs
Initially spotted and investigated by Dalai and Germano.
2018-01-08 15:12:31 +01:00
075950ad66 Cycles: Fix wrong shading when some mesh triangle has non-finite coordinate
This is fully unpredictable for artists when one damaged object makes the whole
scene to render incorrectly. This involves two main changes:

- It is not enough to check triangle bounds to be valid when building BVH.
  This is because triangle might have some finite vertices and some non-finite.

- We shouldn't add non-finite triangle area to the overall area for MIS.
2018-01-08 15:09:01 +01:00
93d711ce55 Cycles: Fix possible race condition when initializing devices list 2018-01-08 15:06:56 +01:00
d91b6099a6 Depsgraph: Fix wrong flag being assigned 2018-01-08 15:05:53 +01:00
d5dbe0c566 Fix T52741: Follow track with depth object crashes Blender with new depsgraph 2018-01-08 15:01:32 +01:00
c8f95c7829 Fix T53419: Masking "Add" menu is not present in Image editor, but shortcut is 2018-01-08 14:52:51 +01:00
26ffade5c1 Fix T53713: User remap failed w/ texface images 2018-01-08 17:00:36 +11:00
1611177ac9 Fix T53586: Surfaces collapse when joined 2018-01-08 14:50:30 +11:00
1c32d67f46 Cleanup: --help text
Sync with manual
2018-01-08 09:50:57 +11:00
c63e08863d Fix T53054: Parentless bone + IK crashes 2018-01-08 09:44:42 +11:00
528e00dae0 Fix T53696: Compositor HSV limits changed 2018-01-08 09:30:12 +11:00
a123dafdc0 fix T52831 removed enforcement of matrix decomposition when animations are exported 2018-01-06 16:38:19 +01:00
Mathieu Menuet
1f50f0676a Fix T53017: Cycles not detecting AMD GPU when there is an NVidia GPU too.
Best guess is that cuInit() somehow interferes with the AMD graphics driver
on Windows, and switching the initialization order to do OpenCL first seems
to solve the issue.
2018-01-06 16:34:50 +01:00
4f247ed07a Fix T53143: Knife Crash after Grid Fill
BM_ELEM_INTERNAL_TAG flag wasn't ensured to be cleared.
2018-01-05 10:48:39 +11:00
868bde5920 BLI_utildefines_iter: Use for iteration helpers 2018-01-05 10:48:39 +11:00
02b206780e BMesh: move bridge tools stepping logic into macro
Also use floor division since regular division was giving a bias
on negative error values.
2018-01-05 10:48:39 +11:00
8ca11b7084 Math Lib: add divide_floor_i
Integer division that floors on negative output (like Python's).
2018-01-05 10:48:39 +11:00
8c484d0bda Fix T53637: Keymap from app-template ignored
Addon's were also ignored
2018-01-05 10:20:16 +11:00
3815c3a324 Revert "BLI_utildefines: Support SWAP macro with two args"
This reverts commit d749320e3b.

It's possible the container struct is larger,
we could do sizeof checks that falls back to memmove
but rather avoid complicating things.
2018-01-05 10:20:16 +11:00
36971ea276 Use custom SWAP macro for swapping userdef data
Avoids complicating the common case
2018-01-05 10:20:16 +11:00
38fdfe757d Fix T53274: Saving template prefs overwrites default prefs 2018-01-05 10:20:15 +11:00
6cba84edf2 BLI_utildefines: Support SWAP macro with two args 2018-01-05 10:20:15 +11:00
9f0ebb0941 WM: load UI for new file, even when pref disabled
Loading startup file always loads the UI now.
2018-01-05 10:20:15 +11:00
571e801b27 WM: don't load preferences on 'File -> New'
User preferences are now only loaded on...

- Initial startup.
- Factory-settings.
- Setting app-templates.
2018-01-05 10:20:15 +11:00
7622563ae3 mblur for fm use centroids / use vertices was missing on remesher, some crash fixes 2018-01-05 00:00:01 +01:00
facc7658db crash fixes, was accessing non-existing layers 2018-01-04 20:44:02 +01:00
054d6d7ac3 deform motionblur support for FM and remesher with variable topology
furthermore some tweaks to final solid mesh generation and trigger stuff
option to only output particles as vertexcloud in remesher
2018-01-04 19:32:13 +01:00
71ffddfa0f fixed some crashers 2018-01-04 02:38:18 +01:00
ad2e6534cc first attempt of deform mblur with remeshed particles, but it still has issues 2018-01-04 02:08:44 +01:00
08cd50dcde crash fix in updateAccelerationMap, forgot to check for dm being null 2018-01-03 17:24:32 +01:00
d88b0ac261 fix for transformation issue with particle remeshing 2018-01-03 16:26:44 +01:00
7735128993 fix for presets, forgot some commas 2018-01-03 16:07:12 +01:00
942b6e933b BLI_heap: minor changes to the API
Recent addition of 'reinsert' didn't match logic for ghash API.

Rename to BLI_heap_node_value_update,
also add BLI_heap_insert_or_update since it's a common operation.
2018-01-03 22:49:51 +11:00
eaeb0a002e Use BLI_heap_reinsert for decimate and beautify
Improves performance for high poly meshes,
~70% faster for decimate, only ~10% for beautify.
2018-01-03 22:49:51 +11:00
71d79e6ea2 BLI_hash: add BLI_heap_reinsert
Allows avoiding remove/insert calls.
2018-01-03 22:49:51 +11:00
a68cc528dd GTest: initial BLI_heap test 2018-01-03 22:49:51 +11:00
e79e0c7483 Correct gtest error in recent beautify change 2018-01-03 22:49:50 +11:00
4a457d4f1e Polyfill Beautify: half-edge optimization
Was using an edge hash for triangle -> edge lookups,
updating triangle indices for each edge-rotation.

Replace this with half-edge which can rotate edges much more simply,
writing triangles back once the solution has been calculated.

Gives ~33% speedup in own tests.
2018-01-03 22:49:50 +11:00
1b6130533f Beauty fill was skipping small faces 2018-01-03 22:49:50 +11:00
9d501d23cb Fix T52871: beauty fill error
Only lock tri's facing different directions.
Needed because scanfill creates zero area faces.
2018-01-03 22:49:50 +11:00
39fc93208a Revert "Fix T52871: BLI_polyfill_beautify_quad_rotate_calc_ex was mistakenly considering the state as degenerated"
This reverts commit a8f11f5422.

Result is no longer symmetrical, will investigate a different fix.
2018-01-03 22:49:50 +11:00
9298d99b77 Fix T52871: BLI_polyfill_beautify_quad_rotate_calc_ex was mistakenly considering the state as degenerated 2018-01-03 22:49:50 +11:00
9e18fcbb36 BLI_polyfill2d_test: script to generate test data 2018-01-03 22:49:50 +11:00
ef5b7d34a1 Cleanup: redundant casts 2018-01-03 22:49:49 +11:00
426616da43 Correct test ifdef in polyfill 2018-01-03 22:49:49 +11:00
9be59fa752 BLI_polyfill2d_test: add test for T52834
Commented since it currently fails.
2018-01-03 22:49:49 +11:00
93d3015e61 BLI_polyfill2d_test: Try flipped x/y axis
In T52834 this makes a difference.
2018-01-03 22:49:49 +11:00
fe3f504902 Missing from last commit 2018-01-03 22:49:49 +11:00
9299936726 Cleanup: use stubs for eigen gtest 2018-01-03 22:49:49 +11:00
8131eda51e Boolean Modifier: add debug options
Only show & use when running in debug mode.
2018-01-03 22:49:48 +11:00
569d2df634 Avoid bias when calculating quad split direction
Some error checks weren't being done in both directions
when calculating the best split direction for a quad.
2018-01-03 22:49:48 +11:00
6e133ad8b1 Correct recent error in boolean quad split check 2018-01-03 22:49:48 +11:00
58ab62ed6d BMesh: use less involved check for edge rotation
Was using function for edge rotation which was doing unnecessary checks
Use the face normal and BLI_polyfill_beautify_quad_rotate_calc directly.
2018-01-03 22:49:48 +11:00
0834eefae0 Polyfill Beautify: option to rotate out of degenerate state
Needed for 3D iterative edge-rotation to avoid flipping when projected
from different angles,
but could keep zero area faces in 2D polygons.
2018-01-03 22:49:48 +11:00
34857b2032 Fix error in recent boolean changes w/ quad split 2018-01-03 22:49:48 +11:00
78cc3c828f Fix T52291: Boolean fails w/ co-linear edged ngons
This means boolean tessellation wont match viewport tessellation
however it's needed to avoid zero area triangles causing problems.
2018-01-03 22:49:48 +11:00
04125d8a9c Math Lib: clamped rounding utility functions 2018-01-03 22:49:48 +11:00
659dc34823 BLI_utildefines: sync w/ 2.8 2018-01-03 22:49:47 +11:00
eaf14b1ebf fix T53230: avoid Nullpointer problems in Collada Exporter 2018-01-02 14:55:53 +01:00
866be3423c Fix incorrect MIS with principled BSDF and specular roughness 0. 2018-01-01 17:46:44 +01:00
440d647cc1 Fix part of T53038: principled BSDF clearcoat weight has no effect with 0 roughness. 2018-01-01 17:29:47 +01:00
cd9c68f0c5 CMake: support CUDA 9 toolkit, and automatically disable sm_2x binaries.
Fermi cards (GTX 4xx and 5xx) are no longer supported with this version, so
we can keep supporting both CUDA 8 and 9 for a while.
2018-01-01 17:29:26 +01:00
f1ee24a284 Fix T52801: reload scripts causes Cycles viewport render crash. 2018-01-01 17:28:45 +01:00
df1af9b349 Fix Cycles bug in RR termination, probability should never be > 1.0.
This causes render differences in some scenes, for example fishy_cat
and pabellon scenes render brighter in a few spots. This is an old
bug, not due to recent RR changes.
2018-01-01 17:27:16 +01:00
836a1ccf72 Fix T53600: Cycles shader mixing issue with principled BSDF and zero weights.
SVM nodes need to read all data to get the right offset for the following node.
This is quite weak, a more generic solution would be good in the future.
2018-01-01 17:13:04 +01:00
c4f8d924e1 Fix T53309: Remove default 'Clear loc/rot/scale delta transform' shortcuts.
The loc one (shift-alt-G) was same as 'remove selected from active group'
action... Clear delta transform is not a common operation, so we can
live without a default shortcut for it.

Note that using same key (G) in same space for two completely different
kind of operations is probably a rather bad thing, nice topic for future
keymap work. ;)

Probably nice to have in 2.79a.
2018-01-01 16:13:53 +01:00
08e16e0bd1 Fix: Undo pushes were missing for Add/Remove Driver Variable buttons, and Remove Driver button 2018-01-01 16:03:30 +01:00
969196069a Fix T53300: Bone Extrude via Ctrl + Click is not done from active bone tail 2018-01-01 16:03:25 +01:00
6cfc5edb86 Fix T53185: After rendering an animation (Ctrl-F12), pressing F12 no longer renders single frames only 2018-01-01 16:03:20 +01:00
99e4c819f7 Fix: When transforming GP strokes in "Local" mode, the strokes would get obscured
by the transform constraint lines

Ported over e7395c75d5 from the
greasepencil-object branch. I should've fixed this ages ago, but
couldn't figure out why at the time.
2018-01-01 16:03:14 +01:00
ca236408f3 Fix T52861: Keymap editor filter doesn't show shortcuts using "+" 2018-01-01 16:03:09 +01:00
f887b8b230 T50354: Action length calculation added unnecessary padding if some F-Curves
only contained a single key (on the last real frame of the action).
2018-01-01 16:03:03 +01:00
48079e1f11 Fix T52733 Percent mode for Bevel sometimes had nans.
Forgot some initialization.
2018-01-01 16:02:21 +01:00
bae796f0d5 Alembic import: fixed mesh corruption when changing topology
When the mesh changed topology but kept the vertex count the same, it would
result in a corrupt mesh. By checking the face & loop counts too, this has
become less likely.

I've checked IPolyMeshSchema::isConstant(), but it returns true even when
we see that the mesh changed topology.
2018-01-01 16:01:36 +01:00
Stefan Werner
02bac54fa9 Compositor: Ensured 16 byte alignment for variables accessed by SSE instructions.
Before this patch, the XBlur/YBlur compositor nodes would crash for me when run in a MSVC 2015 debug build (test scene: BMW27_cpu). I added the compiler instructions to explicitly align the local variables that the SSE instructions are accessing.
2018-01-01 16:01:29 +01:00
Dalai Felinto
8f9d9ba14e Fix logic for pinning textures users from context
This was wrong since it's concenption in 28ee0f9218.
The if statement was returning true when pinid was NULL, and false otherwise.

However when scene is pinned we also want to run this code.
Code snippet by Brecht Van Lommel.
2018-01-01 15:58:23 +01:00
José Luis Oliveira Cunha
576899b90a Fix T53116: default texture coordinates for volume materials are blank.
Differential Revision: https://developer.blender.org/D2935
2018-01-01 15:57:51 +01:00
0f841e24b0 Fix T53572: Alembic imports UV maps incorrectly
Since in Alembic the loop order seems to be reversed when exporting and
importing, and this was the only place where it was not, I was thinking
to match this to the convention of reversing the loop order as well.

Reviewers: sybren, kevindietrich

Tags: #alembic

Differential Revision: https://developer.blender.org/D2968
2018-01-01 15:57:23 +01:00
Daniel Silva
ce35151f38 Proposed fix for T53263 -- Blender crashes when rendering with Stabilizer 2D node without movie selected
The program won't crash anymore, but a warning won't be displayed. Anyway, this gives the user the chance to save the project.

https://developer.blender.org/T53263

Reviewers: lukastoenne

Differential Revision: https://developer.blender.org/D2934
2018-01-01 15:56:50 +01:00
3659620b47 Fix compilation error with clang-5 2018-01-01 15:56:18 +01:00
f3002ab43b Space clip: Make it more clear that filter track does not use any settings from tool shelf 2018-01-01 15:55:46 +01:00
3a1ade22e5 GPU: Fix memory corruption in GPU_debug on GTX1080
Number of texture formats is 51, which is greater than allowed size of 32.
2018-01-01 15:54:54 +01:00
b5c629e604 Cycles: Fix possible race condition when generating Beckmann table
Two issues here:

- Checking table size to be non-zero is not a proper way to go here. This is
  because we first resize the table and then fill it in. So it was possible that
  non-initialized table was used.

  Trickery with using temporary memory and then doing table.swap() might work,
  but we can not guarantee that table size will be set after the data pointer.

- Mutex guard was useless, because every thread was using own mutex. Need to
  make mutex guard static so all threads are using same mutex.
2018-01-01 15:54:02 +01:00
89de073ea5 Fix T52835: When driven IK influence change, ik animation have 1 frame delay 2018-01-01 15:53:54 +01:00
0cdfe887b4 OpenVDB: Fix compilation error against OpenVDB 4
One crucial thing here: OpenVDB shoudl be compiled WITHOUT
OPENVDB_ENABLE_3_ABI_COMPATIBLE flag. This is how OpenVDB's Makefile is
configured and it's not really possible to detect this for a compiled library.

If we ever want to support that option, we need to add extra CMake argument and
use old version 3 API everywhere.
2018-01-01 15:53:48 +01:00
7de7e47a97 CMake: Add extra requests dependencies
Apparently, we already had some code to deal with this. So for now just
added some extra dependencies needed for latest requests.
2018-01-01 15:53:41 +01:00
2213153c27 Fix T52432: Blender crashes while using Ghost (new depsgraph) 2018-01-01 15:53:35 +01:00
ef04aa4a43 Transform: Enable recursion dependency check for new depsgraph 2018-01-01 15:53:28 +01:00
538182511a Fix T52749: New Depsgraph - Render View Mask is not initialized correctly 2018-01-01 15:53:22 +01:00
3532fe2b8b Masks: Split layer evaluation into separate function
This way we can easily re-use bits of code for new dependency graph.

Currently should be no functional changes.
2018-01-01 15:53:15 +01:00
3182336666 Fix T52113: Compositor doesnt mix unrendered render layers well
Compositor was always defaulting to all-zero s output for missing passes.

This was broken in 4cf7fc3.
2018-01-01 15:53:09 +01:00
5efc8e16e6 Compositor: Cleanup, get rid of nested ternary operators
Having single switch statement is much more readable.
2018-01-01 15:53:03 +01:00
7947eead71 Compositor: Cleanup, de-duplicate some code 2018-01-01 15:52:56 +01:00
8cd3bd99f7 Compositor: Cleanup, reduce indentation level in render layer node
There is absolute no reason to have such an indentation level, it only causes
readability and maintainability issues. It is really simple to make code more
"streamlined".
2018-01-01 15:52:49 +01:00
e7aad8fd0e Fix T53559: Auto texture space for text and font is wrong in Cycles
The issue actually goes a bit deeper, converting curve to mesh will
change texture space just because font and bezier curves are using CV
to calculate texture space.

So now when those objects are converted to mesh, we disable auto
texture space and copy evaluated space over.
2018-01-01 15:45:56 +01:00
bf58ec9265 Node selection: Stop operator when mouse selection selected a node
Previously, hitting Shift-LMB will first invoke selection operator, which
then later on is transformed to mouse tweak used for reroute operator.

This was causing problems extending selection with Shift-LMB when clicking
fast or from a tablet.
2018-01-01 15:45:07 +01:00
1c7657befb Fix T53371: Keying Node fails with values above 1
This was expected behavior for over-exposured lamps when the mode was originally
created for Tears of Steel. Turns out, there could be really bad green screen in
real production which will only have green (or rather screen) channel over
exposured.

Tweaked condition now so we use least bright channel to see if the area has
proper exposure or not.

Seems to work fine in tests, but further tweaks are possible.
2018-01-01 15:45:01 +01:00
333ef6e6f7 Tracking: Create mesh from selected tracks only
Patch by Sebastian Koenig. thanks!
2018-01-01 15:44:56 +01:00
ad7385422e Fix T53048: OSL Volume is broken in Blender 2.79
Was a mistake in optimization commit which was disconnecting closures and nodes
which does not make sense for volume output.

OSL script we can't ignore and can't currently know in advance if it's a proper
volume shader or not. So we never disconnect OSL nodes from volume output.

This is a good candidate for corrective release.
2018-01-01 15:44:50 +01:00
ad834085b7 Fix T52932: Driver with target of custom property from scene fails to update
Note that this is only supported in new depsgraph.
2018-01-01 15:44:45 +01:00
2edc2b4912 Curves: Fix wrong bitset being checked against CYCLIC bit flag
Based on report from Talos Security Advisory.
2018-01-01 15:44:39 +01:00
d87bf29399 Tracking: Followup to previous fix, need to remap frame number for sequence tracking 2018-01-01 15:44:33 +01:00
990ce0c4f0 Tracking: Cleanup, reuse existing variable 2018-01-01 15:44:27 +01:00
f0743b56ec Fix T52851: Per-frame traking is broken when sequence doesn't start at frame 1 2018-01-01 15:44:21 +01:00
350f5c6894 Tracking: Fix crash when tracking failed
Was a dangling pointer to a freed memory left behind.
2018-01-01 15:44:15 +01:00
69062cdd8d Fix T52840: New Depsgraph - Mask editor not working correctly 2018-01-01 15:44:09 +01:00
3163d0e205 Fix T52811: At any framerate selected, video exported with 1000fps 2018-01-01 15:43:31 +01:00
aafe528c7d Fix T51416: Blender Crashes while moving Sliders
The issue here was that removing datablock from main database will poke editors
update, which includes buttons context to free users of texture. Since Cycles
will free datablocks from job thread, it might crash Blender since main thread
might be in the middle of drawing.

Solved by exposing extra arguments to bpy.data.foo.remove() which indicates
whether we want to perform ID user count and interface updates. While scripts
shouldn't be using those normally, this is the only way to allow Cycles to skip
interface update when removing datablock.

Reviewers: mont29

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D2840
2018-01-01 15:43:25 +01:00
9c39f021ad Fix T52739: Crash loading corrupted video files
Affects both "normal" open as a video file and thumbnail generation.
2018-01-01 15:43:19 +01:00
cdc35e63bd Fix T52299: X resolution of 4 causes nodes to collapse
Was caused by numeric overflow when calculating preview dimensions.
Now we try to avoid really insance preview resolutions by fitting
aspect into square.
2018-01-01 15:42:39 +01:00
3a0f199aa7 Fix T52140: Align objects centers using origin for text
The issue was caused by operator redo which frees all object's evaluated data,
including bounding box. This bounding box can not be reconstructed properly
without full curve evaluation (need to at least convert font to nurbs, which is
not cheap already).
2018-01-01 15:42:32 +01:00
b0c55d5c94 Fix T52573: Cycles baking artifacts
Synchronize condition for faces split between Cycles itself and baking API.
2018-01-01 15:42:25 +01:00
759af7f1ee Fix T52679: Hole in bake normal
In fact, any type of baking might have caused holes in mesh.

The issue was caused by zspan_scanconvert() attempting to get order of traversal
'a-priori', which might have failed if check happens at the "tip" of span where
`zspan->span1[sn1] == zspan->span2[sn1]`.

Didn't see anything bad on making it a check when iterating over scanlines and
pick minimal span based on current scanline. It's slower, but unlikely to cause
measurable difference. Quality should stay the same unless i'm missing something.

Reviewers: brecht, dfelinto

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2837
2018-01-01 15:42:16 +01:00
c616dd58c6 minor fix for collision problem with mesh 2017-12-31 01:57:54 +01:00
4bc89d815c Fix T53630: Effect strips not displaying Input data.
Fix T52977: Parent bone name disappeared in the UI in pose mode.

Regression caused by own rBc57636f060018. So instead of changing widget
type, just flag it as disabled.

Note that core of the issue is elsewhere though - there is absolutely no
reasons to have a search widget for pointers we cannot change nor
search! But fixing this is not really top priority, one of the many
glitches of our UI code, so think we can live with current code.

To be backported to 2.79a.
2017-12-30 17:52:33 +01:00
8a9d64b578 Fix T53463: Rotation numerical input shows instable behaviour.
Inverting a number in radians when user is in degrees gives rather
unexpected results. ;)
2017-12-30 17:52:28 +01:00
50ca70b275 Fix T53420: Vertex Groups: The "-" button gets a hidden function
Guess 'remove all unlocked' is new-ish feature...

To be backported to 2.79a (I think).
2017-12-30 17:52:21 +01:00
ff8c9c5931 Fix T53343: Custom Normal Data Transfer Crashes when some vertexes have no faces.
Odd nobody noticed this earlier, was obvious bug in code logic here... :/

To be backported to 2.79a.
2017-12-30 17:52:16 +01:00
06df30a415 Fix T53250: Crash when linking/appending a scene to a blend when another linked scene in this blend is currently open/active.
Inner DAG code would not check against NULL pointer, and in case of an
active linked scene, scene pointer will be NULL here, so we have to
check it ourself. ;)
2017-12-30 17:51:30 +01:00
5f2307d1a7 Fix T53191: Python API Reference link wrong in splash screen.
Forgot to update splashscreen links when we switched API doc naming
scheme...
2017-12-30 17:51:25 +01:00
3193045c59 Fix bad 'poll' prop callback API doc.
This was added to all prop types, when it is only available for Pointer ones.
2017-12-30 17:51:12 +01:00
2895cb22a7 3D View: use shortest angle between quaternions
Gave incorrect smoothview speed changing between some axis and
axis locking.
2017-12-30 17:45:40 +01:00
01ff07af56 Math Lib: signed versions of quaternion angle
There was no simple way to get the shortest quaternion angle.
2017-12-30 17:45:33 +01:00
6d640504e8 bl_app_override: support empty UI layout items
Returning None from ui_ignore functions creates empty labels,
allows removing items without breaking layout in some cases.
2017-12-30 17:45:27 +01:00
5ab1897de7 Fix T53430: Cut at the strip end fails w/ endstill 2017-12-30 17:45:21 +01:00
75aec5eeaa WM: minor correction to user-pref writing
When saving templates had wrong return value.
2017-12-30 17:44:44 +01:00
0c456eb90a Docs: clarify return value for BVH API 2017-12-30 17:44:38 +01:00
6639350f92 Fix BMesh PyAPI internal flag clearing logic
Would leave the flag set on raising an exception.
2017-12-30 17:43:53 +01:00
ce6e30b3dc Fix edge-split bmesh operator giving empty result 2017-12-30 17:43:47 +01:00
69f6ab98e7 Docs: correct descriptions 2017-12-30 17:43:39 +01:00
3e3a27d089 Edit Mesh: click extrude, ensure inverse matrix
Relied on this being set elsewhere which isn't assured.
2017-12-30 17:43:33 +01:00
a253b1b7bc Docs: add note for bmesh face_split_edgenet 2017-12-30 17:43:24 +01:00
6058b651c4 Fix sculpt secondary color missing some brushes
D2841 by @uvwxyz w/ edits
2017-12-30 17:43:17 +01:00
98dc9072e5 Fix brush reset (missing notifier)
D2843 by @uvwxyz
2017-12-30 17:43:06 +01:00
6b2d1f63db Fix incorrect allocation size 2017-12-30 15:48:49 +01:00
275002106c makesdna/makesrna: silence output by default
No need to print status for basic & reliable operations,
build systems can output operations they run if needed,
or debug output changed in the source if developers are debugging.

Nice for ninja, so any printed text hints at a problem to fix.
2017-12-30 15:48:43 +01:00
413817a3d2 Fix T53577: Rake sculpt/paint wrong on first step 2017-12-30 15:48:33 +01:00
869e4a3420 Fix T53322: Collada export crash w/ shape keys
D2958 by @cmbasnett
2017-12-30 15:48:28 +01:00
84361a0709 Fix missing update for particles w/ fluids
D2955 by @GonVas
2017-12-30 15:48:22 +01:00
52a5daa404 Fix T53529: Rip crashes w/ wire edge 2017-12-30 15:48:16 +01:00
db3e3f9c24 Fix for inset when accessed from spacebar search 2017-12-30 15:48:10 +01:00
19b27d84ab Fix T53441: Inset doesn't start at zero 2017-12-30 15:48:05 +01:00
480b0b5dfc Fix T53410: 3D Text always recalculated 2017-12-30 15:47:58 +01:00
7153cee305 Fix T53342: Outliner 'select hierarchy' broken
Was using cursor position from within menu,
clicking on the same position for every selected item (toggling).

Now operate on each selected outliner element, without toggling.
2017-12-30 15:47:52 +01:00
d2d207773e Fix BGE sound actuator property access 2017-12-30 15:47:46 +01:00
8ea3f6438d Fix T53294: bpy.ops.image.open crash 2017-12-30 15:47:41 +01:00
60e8d86fb1 Fix T53131: Incorrect vert-edge angle calculation
Vertex w/ a single edge wasn't detected
2017-12-30 15:47:34 +01:00
1ab828d4bb Fix T53004: XWayland ignores cursor-warp calls
There is currently a limitation in XWayland,
the cursor needs to be hidden during warp calls.
2017-12-30 15:47:28 +01:00
7f6e9c595b Fix T52959: Local view looses clip range on exit 2017-12-30 15:47:21 +01:00
b0fbe95a1b Fix ruler access from search pop-up
D2831 by @1xundoredo
2017-12-30 15:46:26 +01:00
8c9bebfe28 Fix setting the operator name in Py operator API 2017-12-30 15:46:20 +01:00
9f032c3867 Fix error copying smoke modifier uv layer 2017-12-30 15:46:13 +01:00
eaba111bd5 Fix T52890: Crash unlinking sequencer sound 2017-12-30 15:46:07 +01:00
b969f7eb55 Fix T52860: 3D Text crashes w/ Ctrl Backspace 2017-12-30 15:46:01 +01:00
4c3e2518c8 UI: fullstop at end of tooltips
Allows for multiple sentences not to look strange.
Convention not to include in RNA remains.
2017-12-30 15:45:55 +01:00
a437b9bbbe UI: avoid int cast before clamping number input
Values outside int range would overflow.
2017-12-30 15:45:02 +01:00
d07011da71 Fix T51074: Boolean modifier inverts operation
Support for negative scaled objects.
2017-12-30 15:44:55 +01:00
acae901a10 Fix writing Iris images w/ invalid header
Regression in e142ae77ca
2017-12-30 15:44:49 +01:00
495aa77b53 Fix T52384: Bridge pair result depends on other loops
When 2x loops have different number of vertices,
the distribution for vertices fan-fill depended on the loop order
and was often lop-sided.

This caused noticeable inconstancies depending on the input
since edge-loops are flipped to match each others winding order.
2017-12-30 15:44:43 +01:00
e627620efd Docs: only show versions in changelog side-bar 2017-12-30 15:44:38 +01:00
7d872629c4 Correct error in last commit 2017-12-30 15:43:36 +01:00
60bfa969e2 Fix T52748: Select shortest face path fails 2017-12-30 15:43:29 +01:00
d89353159f Fix T52442: bl_app_templates_system not working
Portable builds LOCAL files need to be
treated as system instead of using as a fallback to USER templates.
2017-12-30 15:43:23 +01:00
21ecdacdf1 Fix bpy.utils.resource_path('SYSTEM') output
Would return the test path for developer builds:
{blender-dirname/release}

Now return an empty string when no path is found.
2017-12-30 15:43:16 +01:00
0641069778 Fix T52723: Reset UV layers failed 2017-12-30 15:43:09 +01:00
5b2d5f9077 Fix T53171: lamp specials strength tweak fails with renamed emission nodes. 2017-12-30 15:32:59 +01:00
f901bf6f47 Fix T53092: errors reading EXR files with different data/display window.
Multilayer/multiview OpenEXRs did not read the full data window like single
layer, now it should be consistent.
2017-12-30 15:32:52 +01:00
198fd0be43 Fix T53348: Cycles difference between gradient texture on CPU and GPU. 2017-12-30 15:32:45 +01:00
f968268c1e Fix build with OSL 1.9.x, automatically aligns to 16 bytes now. 2017-12-30 15:32:40 +01:00
2bc667ec79 Fix T52368: Cycles OSL trace() failing on Windows 32 bit. 2017-12-30 15:32:34 +01:00
d564beda44 Fix T53217: GLSL principled BSDF black with zero clearcoat roughness. 2017-12-30 15:32:28 +01:00
f1a4e130b3 Fix T53145: bevel tool does not start with amount at zero. 2017-12-30 15:32:18 +01:00
36f324fc55 Fix T53145: bevel tool fails when used a second time.
Pixel size was not initial early enough. For first time this was not a problem
because the bevel amount starts at 0 then, and after the mouse moves the pixel
size is initialized. For the second time the bevel amount starts at a non-zero
value, and it failed then.
2017-12-30 15:32:13 +01:00
bb89759624 Fix T53360: crash with GLSL bump mapping and missing group output node. 2017-12-30 15:32:06 +01:00
825aecaee3 Fix T53273: render bake settings properties not showing correct Python path. 2017-12-30 15:32:00 +01:00
1dbdcfe9a9 Fix incorrect color management when saving JPG previews for EXR. 2017-12-30 15:31:53 +01:00
a6e5558194 Fix T53129: Cycles missing update when changing image auto refresh.
Previously auto refresh worked, but only if it was already enabled before
starting the viewport render.
2017-12-30 15:31:46 +01:00
6bd1189e5c Fix compositor node links getting lost on file load for custom render passes. 2017-12-30 15:31:13 +01:00
625b2f5dab Fix T52514: don't clear filename when dropping directory path in file browser. 2017-12-30 15:31:06 +01:00
20c96cce86 Fix T52998: disabled menu entries responding to key shortcuts. 2017-12-30 15:30:57 +01:00
c85a305c09 Fix T52800: fix UI flickering with Mesa on Linux.
Use triple buffer by default now on all platforms, remaing ones where:
* Mesa: seems to have been working well for a long time now, and not using
  it gives issues with the latest Mesa 17.2.0.
* Windows software OpenGL: no longer supported since OpenGL 2.1 requirement
  was introduced.
* OS X with thousands of colors: this option was removed in OS X 10.6, and
  that's our minimum requirement.
2017-12-30 15:30:43 +01:00
30f53d56b6 Fix potential string buffer overruns.
Note that our library path handling is still rather dodgy on this
regards, shall take some time at some point to seriously sanitize it...
2017-12-30 15:25:04 +01:00
47a388b2a9 Fix T53002: Batch-Generate Previews generate empty or none image for large objects.
Camera clipping was left to default values, which won't work well for
very large (or small) objects. Now recompute valid clipping start/end
based on boundingbox of rendered data, and final location of camera.
2017-12-30 15:24:54 +01:00
9f6d5d679e Fix missing ID remapping in Action editor callback.
Spotted by Joshua Leung (@aligorith), thanks!

Should probably be backported to 2.79a should we do it.
2017-12-30 15:24:45 +01:00
a4116673c7 Fix T52816: regression can't open file in 2.79 (crash).
Tentative fix, since I cannot reproduce thenissue for some reason here
on linux.

Core of the problem is pretty clear though, thanks to Germano Cavalcante
(@mano-wii): another thread could try to use looptris data after worker
one had allocated it, but before it had actually computed looptris.

So now, we use a temp 'wip' pointer to store looptris being computed
(since this is protected by a mutex, other threads will have to wait on
it, no possibility for them to double-compute the looptris here).

This should probably be backported to 2.79a if done.
2017-12-30 15:05:28 +01:00
7e4be7d348 Add some security checks against future bad float UIprecision values.
This commit and previous one should be backported to 2.79a should we
release it.
2017-12-30 15:05:20 +01:00
8e43a9e9cc Fix (irc-reported by @sergey) invalid precision value in a float RNA property.
Maximum allowed UI float precision value is 6 (which means 7 digits).

Will change code checking on that in next commit.
2017-12-30 15:05:10 +01:00
5384b2a6e2 Fix T52729: Decimals not showing over 100m or 100 feet
Use same 5 digits precision as we already use for e.g. Object's
location, for Object's dimensions too.

To be backported to 2.79a, should we do it.
2017-12-30 15:04:56 +01:00
e8e40b171b Fix failure in our UI code that could allow search button without search callbacks, leading to crash.
Related to (exposed by) T52735, fixes the reported crash but not the
underlying issue.

To be backported to 2.79a should we do one.
2017-12-30 15:04:44 +01:00
882fe36f0d Fix T52984. Trackpad rotation to natural direction 2017-12-30 15:04:26 +01:00
ce058207fc acceleration maps are kinda hard to get right... another attempt 2017-12-30 11:37:31 +01:00
1dbaf88150 fix, possibly return an empty mesh and default psys index is 1 now 2017-12-30 02:14:52 +01:00
1151442204 fix for randomized particle sizes
was accessing wrong indexes after particles died
2017-12-30 01:28:43 +01:00
d165b13ee4 added override with particle size option to mball remesher 2017-12-29 21:54:02 +01:00
4945003ffd remesh modifier can now remesh particle systems as well 2017-12-29 20:38:53 +01:00
23a9504df1 small fixes for acceleration map 2017-12-29 02:07:29 +01:00
026b847bd9 refactored acceleration map, but might still have issues
also attempted to improve triggering (make exacter, but slow and error prone)
2017-12-29 01:46:36 +01:00
e8c6f05eba fix attempt for acceleration map... still issues 2017-12-28 00:17:45 +01:00
656ab1cf6a reworked the bake correction method, some smaller fixes
shuffling happens now across all individual rigidbodies
2017-12-27 19:47:47 +01:00
1da64c2540 fixes for acceleration map 2017-12-26 23:07:21 +01:00
24f93213f2 invalidate rigidbody cache/bake if rigidbody objects are duplicated or deleted as well 2017-12-26 21:15:01 +01:00
c77878abab added final solid mesh source for mesh, some sphere margin fixes 2017-12-26 17:40:40 +01:00
16f161e5f6 added acceleration maps which should be also be usable in playback 2017-12-25 23:30:15 +01:00
9bf8ba16c2 added an acceleration map (vgroup), some remesher fixes 2017-12-25 16:45:27 +01:00
01a589c0af tweak of value display in FM UI 2017-12-25 14:13:16 +01:00
3d3ece2c67 fix for collision condition, it failed for regular case 2017-12-25 14:12:45 +01:00
df7d0e5423 extended the remesh modifier by a metaball mode 2017-12-25 01:12:23 +01:00
dbd1212dfb rearranged some FM Properties in UI 2017-12-24 20:50:31 +01:00
a96832cd21 fixes for cluster constraint island detection and a couple of minor fixes in fracture RNA 2017-12-24 20:49:25 +01:00
7babce3052 added "self collision" option for constraint islands, and randomize option for sphere shape radius and margin 2017-12-24 16:05:08 +01:00
95ae90cab0 sphere shape now takes its margin into account too, allow also negative margin now (optionally) 2017-12-23 15:15:45 +01:00
93bf8fc8e1 now fixing shard order problems directly after loading and jumping to another frame as well 2017-12-23 01:25:00 +01:00
1010cdf421 added option to only output verts, meta threshold max is 100 now 2017-12-21 17:12:17 +01:00
fc58dbc186 do not invalidate cache when enabling / disabling centroid output 2017-12-21 15:14:44 +01:00
e8958954ba added option to only output centroids as vertices
might be useful in conjunction with duplicated metaballs to have simple fluid-like behavior
2017-12-21 12:59:03 +01:00
fa7a666e2b added grid fracture option, removed rigidbody shape drawing with fm, alembic importer fix 2017-12-19 23:09:01 +01:00
4bc10e6a81 allow rigidbody being a forcefield effector too
this was disabled intentionally for some unknown reason
2017-12-16 16:09:37 +01:00
aacada54f8 fix, threshold and cluster threshold application was swapped 2017-12-15 22:23:38 +01:00
d99e1dc283 exposed meshisland constraints and modifier vertex groups to python
this was done to enable a new feature in the addon, the cluster editor.
2017-12-15 16:34:48 +01:00
c5e7265b1e fix for infinite recursion with cluster percentage activation
also remove kinematic state of stopped shards (if object is triggered and not kinematic) at start frame now
2017-11-16 20:28:39 +01:00
57d70b3c87 fix for autogenerating inner material, just append at the end of the stack instead taking always the 2nd one 2017-10-08 21:42:48 +02:00
d13f6ae2bf fix: separated comparison angle/distance for break/deform, propagate weakened threshold now 2017-10-07 19:59:44 +02:00
855d2955c4 Docs: update API changelog to 2.79 2017-10-03 19:58:21 +02:00
28f2865cfa added some previously missing tooltips 2017-09-26 14:01:20 +02:00
993c98779c increased UI digits precision to 5 for almost all FM float RNA properties
exception are properties which had higher precision even
2017-09-17 17:39:30 +02:00
3955fb3dcc compile fixes after merge 2017-09-12 13:26:30 +02:00
8c97b99daf Merge remote-tracking branch 'refs/remotes/origin/blender-v2.79-release' into fracture_modifier
Conflicts:
	source/blender/blenkernel/intern/rigidbody.c
2017-09-12 13:25:40 +02:00
fa859b0d72 only break constraints with threshold >= 0 2017-09-12 12:36:00 +02:00
8ef39d5c88 Update submodules to 2.79 release commits.
Should have been done before ahoy, sorry about that. Means 2.79 tag will
be one (no functionnal changes) commit ahead from our 2.79 builds, think
we can live with that.
2017-09-12 10:47:15 +02:00
5bd8ac9abf Update release cycle to 'release'. 2017-09-11 12:43:47 +02:00
9a9e9b1c4d Fix T52696: Sculpt - Brush spacing pressure artifacts
Was caused by divide-by-zero in paint_stroke_integrate_overlap()
in paint_stroke.c, as identified by Bob Smith (uvwxyz).

Thanks for the report!
2017-09-11 09:37:00 +02:00
904831e62e Fix T52701: Mesh shortest path fails at boundaries 2017-09-11 09:36:25 +02:00
1a7dda046b PyAPI: Fix mathutils freeze allowing owned data 2017-09-10 20:18:42 +02:00
82466852fe Fix T52531: Blender 2D stabilisation node issue when autoscale is selected
Threading conflict, should be safe for 2.79.
2017-09-10 20:18:04 +02:00
fbb4be061c Cycles: Safer fix for infinite recursion
Previous fix wasn't working correct for certain compiler and CPU intrinsics
mode, causing quite some crashes.

This should be a safer fix, which is closer in behavior to previous release
but which should still fix issues with robust curve intersection.
2017-09-08 14:47:32 +02:00
87cc8550e2 Fix T52650:Grease pencil selection its not automatically updating in Clip Editor 2017-09-08 12:33:00 +02:00
ccf1bb11b6 Math Lib: normalized vector project functions 2017-09-08 12:00:52 +02:00
9ae35fafb6 Fix T52149: LoopTriArray computation was not correctly protected against concurrency.
Note: this commit seems to work as expected (also with transform
snapping etc.). However, it is rather unsafe - not enough for 2.79 at
least, unless we get much more testing on it. It also depends on three
previous ones.

Note that using a global lock here is far from ideal, we should rather
have a lock per DM, but that will do for now, whole DM thing is doomed
to oblivion anyway in 2.8.

Also, we may need a `DM_DIRTY_LOOPTRIS` dirty flag at some point. Looks
like we can survive without it for now though... Probably because cached
looptris are never copied accross DM's?
2017-09-08 11:53:05 +02:00
7c3b435c3a Cleanup: remove useless DM_ensure_looptri().
That one was doing exactly same thing as `dm->getLoopTriArray()`, no
point in having twice the same code here...
2017-09-08 11:52:59 +02:00
9cc7e32f39 Fix transform snap code using 'allocated' flags to get verts/edges/etc. arrays again from DM.
This was... horribly wrong, CDDM will often *not* need to allocate
anything to return arrays of mesh items! Just check whether array
pointer is NULL.

Also, remove `DM_get_looptri_array`, that one is useless currently,
`dm->getLoopTriArray` will always return cached array (computing it if
needed).
2017-09-08 11:52:50 +02:00
9f0acc2c9e Cleanup: deduplicate DM's getLoopTriArray() callback.
All three functions were doing exactly the same thing, simpler to only
have one in that case!
2017-09-08 11:52:45 +02:00
300abf241e Fix T52639: Weight paint smooth tool crash 2017-09-08 11:52:30 +02:00
9da098536d UI: fix memory leak when copy-to-selected failed 2017-09-08 11:52:24 +02:00
3aaf908719 Fix T52678: Crash editing gpencil w/ frame-lock 2017-09-08 11:52:17 +02:00
a67aae98fe Screw Modifier: remove doubles option
Vertices on the axis can be optionally merged,
nice for creating objects which close at the end-points.
2017-09-08 11:52:10 +02:00
163a196f29 View3D Remap: skip defmaterial
This isn't library data.
2017-09-08 11:52:00 +02:00
b895c7337e Fix T52663: Remap used invalid local-view data
Only the camera from View3D.localvd is used,
other pointers may be invalid.

Longer term we should probably clear these to ensure no accidents.
For now just follow the rest of Blender's code and don't access.
2017-09-08 11:51:52 +02:00
a8bd08ffdd Fix T52522: VSE renders with alpha transparent PNG image incorrectly
Need some extra checks and should be probably end up in 2.79 since that's a regression.
2017-09-08 11:51:19 +02:00
e91f9f664d Rigidbody: Fix regression introduced in ee3fadd
Baking rigid body cache was broken if some cached frames already
existed.

This is just a band aid for release, the logic need to be looked into
further.
2017-09-06 09:32:46 +02:00
d84f559555 Fix T52374: Changes of rigid body related settings during simulation will break the simulation
Revert 9cd6b03, 3edc8c1, b87d10d and do a better fix for T50230.
2017-09-06 09:32:38 +02:00
ec50734106 Buildbot: Fix paths to sndfile and flac
Need this in 2.79 branch as well, since build rules are based on this files.
2017-09-06 09:32:14 +02:00
a8c7f1329b Fix T52251: Knife cur displaces surface 2017-09-06 09:31:44 +02:00
9b7d506779 T52534: Compositor artifacts when scaling
Increased the maxx and maxy area of interest when scaling in this case.
2017-09-04 15:45:27 +02:00
2deeec9e28 This copyright text (copied to binary distros) had a confusing statement about
scripts being "Artwork" which is your sole property and free to license.

I've removed the reference to scripts in this text.

This was from 2002! With our Python scripts becoming part of how Blender runs,
such scripts now are officially required to be compliant with GNU GPL.

For more information; check the FAQ or consult foundation@blender.org
https://www.blender.org/support/faq/
2017-09-04 15:43:20 +02:00
Dalai Felinto
9ca3d4cbbd Cycles Bake: Fix overflow when using hundreds of images
We have a hardcored limit of 1000 images to be baked.
However anything anove 100 would be leading to overflow in the code.

Caught by warning from builder bot (my compiler doesn't even complain
about this, but it should).
2017-09-04 15:43:12 +02:00
0bee126977 Fix T52209: New Depsgraph - animated follow curve constraint sometimes freaks out when the curve has a parent 2017-09-04 14:12:42 +02:00
c9d653e560 Fix T52533: Blender shuts down when rendering duplicated smoke domain 2017-09-04 14:06:08 +02:00
1ae3056261 Cycles: Fix compilation warning 2017-09-04 14:06:02 +02:00
5f17d47629 Cycles: Correct logging of sued CPU intrisics 2017-09-04 14:04:35 +02:00
edded659c6 Fix T51907: New Depsgraph - Camera constraint is not evaluated properly
This is more a workaround for until we've got proper visibility flush, which
will likely happen in blender2.8 branch.
2017-09-04 14:04:28 +02:00
95d871c1a2 Cycles: FIx issue with -0 being considered a non-finite value 2017-09-04 14:04:22 +02:00
4b90830cac Alembic: Fix T52579: crash when replacing slightly different alembic files
Apparently with Maya in a certain configuration, it's possible to have an
Alembic object without schema in the Alembic file. This is now handled
properly, instead of crashing on a null pointer.
2017-09-04 14:04:13 +02:00
a1e8ef264f Fix: Deleting GPencil keyframes in DopeSheet didn't redraw the view 2017-09-04 13:03:09 +02:00
f5d02f055f Fix: Border select for GPencil keyframes was including those in the "datablock" channels even though those weren't visible
This meant that it was easy to accidentally select too many keyframes
2017-09-04 13:03:01 +02:00
ed0429e7e6 Fix: GPencil Sequence Interpolation for thickness/strength was inverted
For example, if you have two keyframes:
  k1 = 1px, k2 = 10px

it was doing:
  1px, 9px, 8px, ..., 3px, 2px, 10px
instead of:
  1px, 2px, 3px, ..., 8px, 9px, 10px
2017-09-04 13:02:53 +02:00
27c42e05c4 Fix T52483: Fill is incorrect for interpolated strokes
The recalc flag must be enabled for new interpolated strokes.
2017-09-04 13:02:41 +02:00
374ddd022c BMesh: use predictable order for remove-doubles
Each qsort implementation may give different results when values match.

Now fallback to sorting by index.
2017-09-04 12:59:40 +02:00
8a254b6271 Docs: BMesh.from_mesh behavior w/ multiple calls 2017-09-04 12:59:33 +02:00
8193e50fd3 Fix T51400: Pasting hex code fails
The # prefix is supported,
the button didn't give enough space to paste it.

D2812 by @candreacchio
2017-09-04 12:59:27 +02:00
8c4b4fdd14 Missed last commit 2017-09-04 12:59:20 +02:00
5fd4eca8c0 Fix T52515: Crash on BMesh.to_mesh() 2017-09-04 12:59:13 +02:00
6fec06926e Fix minor Mesh -> BMesh conversion issues
- Vertex only meshes never restored their selection history.
- Select history was cleared on the source instead of the target.

Simple Optimizations:
- Avoid O(n^2) linked list looping that checked the entire list before
  adding elements (NULL values in the source array to prevent dupes).
- Re-use vert & edge lookup tables instead of allocating new ones.
2017-09-04 12:59:06 +02:00
bb92bb5329 Docs: rename var and comment how it's used
switch_from_camera wasn't right since it was used for auto-perspective.
2017-09-04 12:59:00 +02:00
7997646c2d Correction to last fix 2017-09-04 12:58:54 +02:00
0ed5605bd5 Fix T52490: NDOF orbit doesn't lock in ortho view
Regression in af3f7db caused by own fix for T51324
2017-09-04 12:58:47 +02:00
76e8dcafa3 Fix T52396: Crash loading template w/o config dir 2017-09-04 12:58:41 +02:00
73cdf00ea8 Fix T52227: Time Slide tool doesn't take NLA mapping into account
To be backported to 2.79
2017-09-04 12:57:16 +02:00
Dalai Felinto
ecdb16d1d8 Increase max/min frame range to over a million
For some specific pipelines (e.g., holographic rendering) you can easily
need over a million frames (1k * 1k view angles).

It seems a corner case, but there is no real reason not to allow users
doing that.

That said we do loose subframe precision in the highest frame range. Which can
affect motionblur. The current maximum sub-frame precision we have is 16.
While the previous limit of 500k frames has a precision of 32.

Thanks to Campbell Barton for the help here.

To be backported to 2.79
2017-09-04 12:57:10 +02:00
022b9676b0 Fix T52472: VSE Audio Volume not set immediately
Audio mixing is done with volume interpolation. A new handle started at
volume 1, now starting at volume 0 for a smooth fade in.
2017-09-04 12:57:03 +02:00
e9ca9dd5d7 Fix T52588: Shape key value driver variables of duplicated object sets refer to old objects.
Regression since 2.78, to be backported to 2.79.
2017-09-04 12:56:57 +02:00
82a6889d83 Fix T52498: Deleting force field doesn't remove "Surface" from modifier stack.
Logic in `ED_object_check_force_modifiers` was inconsistent between add
and remove modifier cases.

Should be safe enough for 2.79.
2017-09-04 12:56:50 +02:00
a5213924a8 Fix T52478: Error report "Shrinkwrap: out of memory" on invisible target.
Shrinkwrap must check it does have valid target data.

Safe for 2.79 release.
2017-09-04 12:56:43 +02:00
42760d922e Fix T52538: Outliner crash when displaying groups and using Show Active on editmode bone not in any groups
There's no guaranty that given ID is found in current outliner tree...

Safe for 2.79, though not a regression.
2017-09-04 12:56:36 +02:00
6f4a0c23cc Cycles: Mark pixels with negative values as outliers
If a pixel has negative components, something already went wrong, so the best option is to just ignore it.

Should be good for 2.79.
2017-09-04 12:56:29 +02:00
fc26280bcb Fix T52481: After making all local, local proxies of linked data get broken after file save and reload.
Issue was nasty hidden one, the dual status (mix of local and linked)
of proxies striking again.

Here, remapping process was considering obdata pointer of proxies as
indirect usage, hence clearing the 'LIB_TAG_EXTERN' of obdata pointer.
That would make savetoblend code not store any 'lib placeholder' for
obdata data-block, which was hence lost on next file read.

Another (probably better) solution here would be to actually consider
obdata of proxies are fully indirect usage, and simply reassign proxies
from their linked object's obdata on file read...

However, that change shall be safer for now, probably good for 2.79 too.
2017-09-04 12:56:22 +02:00
75e392ae9f Cycles: Fix stack overflow during traversal caused by floating overflow
Would be nice to be able to catch this with assert as well, will see what would
be the best way to do this/.\

Need to verify with Mai that this solves crash for her and maybe consider
porting this to 2.79.
2017-09-04 12:56:15 +02:00
6825439b36 Fix T51805: Overlapping volumes renders incorrect on AMD GPU
We need to make sure we can store all volume closures for all objects in volume
stack. This is a bit tricky to detect what would be the "nestness" level of
volumes so for now use maximum possible stack depth. Might cause some slowdown,
but better to give reliable render output than to fail quickly.

Should be safe for 2.79 after extra eyes.
2017-09-04 12:56:08 +02:00
f2aa9bec9d Fix T52218: Missing update when reconnecting node
If node was connected to output, we tag tree for update no matter where
the node was re-plugged to.

Should be safe for 2.79.
2017-09-04 12:56:01 +02:00
8cb217069e Fix T52466: Silence search for button_context menu type.
We were showing "search for unknown menutype WM_MT_button_context" messages in terminal which were not helpful for users, so now they are disabled.

To be backported to 2.79
2017-09-04 12:55:54 +02:00
9997f5ca91 Fix threading conflict when doing Cycles background render
It is possible to have same image used multiple times at different frames,
which means we can not free it's buffers without any guard. From quick tests
this seems to be doing what it is supposed to.

Need more testing and port this to 2.79.
2017-09-04 12:55:47 +02:00
63e21e7218 Fix T52454: Crash in DEG_graph_on_visible_update when activating scene layer
Most likely needs in 2.79 final release.
2017-09-04 12:55:40 +02:00
dd84324485 Fix T52473: blender internal Fresnel and Layer Weight only work with linked normal.
Please backport this to 2.79.
2017-09-04 12:55:30 +02:00
d2f20aed04 Fix T52439: Crash after adjusting lenght of hair particles.
Regression from rBfed853ea78221, calling this inside thread worker was
not really good idea anyway, and we already have all the code we need in
pre-threading init function, was just disabled for vertex particles
before.

To be backported to 2.79.
2017-09-04 12:55:22 +02:00
c0a9fdd93f Cleanup: remove space from filenames 2017-09-04 12:53:48 +02:00
e00f3a6565 Tests: fix incorrect check for hidden dir
Copy-pasted mistake in tests and tools.
2017-09-04 12:53:39 +02:00
6692af3997 Fix error in PointerProperty argument list
Regression in a7b3047
2017-09-04 12:53:28 +02:00
058a358e98 Modify menu from last commit
Also correct tool-tip.
2017-09-04 12:48:17 +02:00
ba600ff7fa Fix T52434: Restore mesh center of mass calculation
The new method while improved for solid objects
doesn't work for non-manifold meshes, keep both.
2017-09-04 12:48:04 +02:00
fd0fbf2564 Fix bpy library load: invalid function signature 2017-09-04 12:47:55 +02:00
beea9421bd PyAPI: avoid redundant PyLong_AsLong call
Assigning to an RNA array converted from Python to C twice.
2017-09-04 12:47:41 +02:00
c79f216066 fix for angle calculation due to usage of initially rotated rigidbodies in external mode 2017-08-28 16:27:48 +02:00
be7ef0060f fix for initial rotation in convert to object and convert to keyframes 2017-08-24 11:39:09 +02:00
e6341b5107 fix for rotated box shapes in external mode + print -1 for unbreakable threshold in phys viz 2017-08-24 10:30:28 +02:00
b25b4c550e use areabased centroid calculation again for shards + small fix in loading routine
new volumebased method gave incorrect results with nonmanifolds
2017-08-22 14:48:24 +02:00
d273e2002c added an automerge distortion cache 2017-08-22 12:37:53 +02:00
612030983d Merge remote-tracking branch 'refs/remotes/origin/blender-v2.79-release' into fracture_modifier 2017-08-21 15:21:13 +02:00
d7b094a807 fix attempt for "merge cache" 2017-08-18 18:45:25 +02:00
7b397cdfc8 Fix T52401: "Export Keying Set" operator generated incorrect ID's for shapekeys
To be backported.
2017-08-18 14:53:52 +02:00
d48f4b61c9 Blender 2.79: Point subodules to updated hash 2017-08-18 14:12:04 +02:00
9bc5549222 PyAPI: Fix memory leak w/ empty, allocated enums 2017-08-18 14:04:07 +02:00
48da381e37 another fix attempt to get the masses right 2017-08-17 22:50:13 +02:00
afa33574de fixes for centroid and volume calculation for non-manifolds, fix attempt for storage of merge info 2017-08-17 17:34:37 +02:00
6bc962d7bc Fix T46329: scene_update_{pre,post} doc needs clarification
The documentation for the bpy.app.handlers.scene_update_{pre,post}
handlers states that they're called "on updating the scenes data".
However, they're called even when the data hasn't changed. Of course
such handlers are useful, but the documentation should reflect the
current behaviour.

Reviewers: mont29, sergey

Subscribers: Blendify

Maniphest Tasks: T46329

Differential Revision: https://developer.blender.org/D1535
2017-08-17 16:30:01 +02:00
e6830167e2 Fixed Alembic unit test
Commit b6d7cdd3ce changed how the mesh data
is deformed, which wasn't taken into account yet in this unit test.

Instead of directly reading the mesh vertices (which aren't animated any
more), we convert the modified mesh to a new one, and inspect those
vertices instead.
2017-08-17 15:41:27 +02:00
f21020f45f Fix T52240: Alembic Not Transferring Materials Per Frame
When a mesh changes its number of vertices during the animation,
Blender rebuilds the DerivedMesh, after which the materials weren't
applied any more (causing the default to the first material slot).
2017-08-17 15:40:49 +02:00
455c016ba6 Alembic: Renamed variable assigned_name → assigned_mat
The variable is a pointer to a Material, not to a name/string.
2017-08-17 15:40:44 +02:00
6e7d962118 Fix OSX duplicate path in Python's sys.path
The '..' in the path caused simple comparisons to fail.

D2780 by @akitula
2017-08-17 14:29:19 +02:00
210f839e93 Blender 2.79: We are entering RC2 stage 2017-08-17 14:20:30 +02:00
b1d998ec5d Fix T52255: New Depsgraph - Constraint and Drivers not working together when the driver references itself 2017-08-17 14:13:01 +02:00
78c288d377 Alembic import: report object name in face color index out of bounds error 2017-08-17 14:07:20 +02:00
2307ea88b5 Alembic import: fix crash when face color index is out of bounds.
This can happen with Alembic files exported from Maya. I'm unsure as to the
root cause, but at least this fixes the crash itself.

Thanks to @looch for reporting this with a test file. The test file has to
remain confidential, though, so it's on my workstation only.
2017-08-17 14:07:20 +02:00
8138082ab8 Fix T51701: Alembic cache screws up mesh.
Use same trick as in DataTransfer modifier e.g. to avoid modifying
existing mesh's data.
2017-08-17 14:07:20 +02:00
265d620179 Forgot to change magicnumber of OIIO built lib in previous commit... 2017-08-17 14:07:20 +02:00
2ff041b7a5 install_deps: disable PTex in our OIIO building for now, broken on newest systems. 2017-08-17 14:07:20 +02:00
edd0dbd23b Fix compilation error when building without Blender
Simply disabled python tests, they can't be run anyway (since blender target is
not enabled) and we don't have any player-related tests in that folder.
2017-08-17 14:07:20 +02:00
8604557b75 CMake: test build configuration support
D2765 by @akitula
2017-08-17 14:07:20 +02:00
a52ec5308f Fix T52278: 'Default' application template fails
Own error in 7398b3b7
2017-08-17 14:07:20 +02:00
0cb38b2875 Fix T52329: Boolean with aligned shapes failed
Creating ngons with multiple axis aligned shapes in the middle of a
single face would fail in some cases.

This exposed multiple problems in BM_face_split_edgenet_connect_islands

- Islands needed to be sorted on Y axis when X was aligned.
- Checking edge intersections needed increased endpoint bias.
- BVH epsilon needed to be increased.
2017-08-17 14:07:19 +02:00
6f935dbb38 Math Lib: add isect_seg_seg_v2_point_ex
This exposes end-point bias argument, needed in rare cases.
2017-08-17 14:07:19 +02:00
Stefan Werner
10764d31d4 Cycles: Fixed broken camera motion blur when motion was not set to center on frame
Reviewers: #cycles, sergey

Reviewed By: #cycles, sergey

Subscribers: sergey

Differential Revision: https://developer.blender.org/D2787
2017-08-17 14:07:19 +02:00
69c389fd63 Cycles: Guard memcpy to potentially re-allocating memory with lock
Basically, make re-alloc and memcpy from the same lock, otherwise one
thread might be re-allocating thread while another one is trying to
copy data there.

Reported by Mohamed Sakr in IRC, thanks!
2017-08-17 14:07:19 +02:00
686b8e8fed Fix width estimation for buttons with short labels in pie menus
Differential Revision: https://developer.blender.org/D2781

To be backported to 2.79 branch
2017-08-17 14:07:19 +02:00
0aae208749 iFix T52050: Empty VSE preview for scene strips with OpenGL preview + Rendered settings.
'OpenGL Preview' checkbox was redundant now, just use seq_prev_type
value only.

Might be OK for 2.79, but should be double-checked first...
2017-08-17 14:07:19 +02:00
3689be736b Fix T52327: Entering/Exiting NLA Tweakmode disables Scene -> Only Keyframes from Selected Channels
The tweakmode flag and the selected-channels flag accidentally
used the same value, due to confusion over where these flags were
supposed to be set. The selected-channels flag has now been moved
to use a different value, so that there shouldn't be any further
conflicts.

To be ported to 2.79.
2017-08-17 14:07:19 +02:00
9a239eea68 Fix T52344: Softbody on Text.
Own previous fix (rBd5d626df236b) was not valid, curves are actually
supported by SoftBodies. It was rather a mere UI bug, which was not
including Surfaces and Font obect types in those valid for softbody UI.

Thanks to @brecht for the head up!

Also, fix safe for 2.79, btw.
2017-08-17 14:07:19 +02:00
28451a9cec Pie menu's sub-rows ignore 'EXPAND' flag
Regression, to be backported in 2.79.
2017-08-17 14:07:19 +02:00
efa840f99f Fix T52344: Softbody on Text.
For some reasons (c) softbody modifier was marked as compatible with
curves... Would need much more work though, so for now just removing
that flag!
2017-08-17 14:07:18 +02:00
518d690628 DPI: add back option to control line width, tweak default width.
Adds thin/default/thick modes to add -1/0/1 to the auto detected line width,
while leaving the overall UI scale unchanged.

Also tweaks the default line width threshold, so thicker lines start from
slightly high UI scales.

Differential Revision: https://developer.blender.org/D2778
2017-08-17 14:07:18 +02:00
35f5d80f3a Fix T52334: images with non-color data should not change color space on save. 2017-08-17 14:07:18 +02:00
0d86bc9f98 Tweak and extend POV syntax hilghting.
*Changed categories of some keywords
*reordered some longer keywords that didn't appear
*Activated another color (reserved builtins) by Leonid
*added some HGPOV and UberPOV missing keywords

Patch by Maurice Raybaud (@mauriceraybaud). Thanks to Leonid for additions, feedback and Linux testing.
Related diffs: D2754 and D2755.

While not a regression, this is new feature and would be nice to have it
backported to final 2.79.
2017-08-17 14:07:18 +02:00
ff47118c73 Fix T52324: Metaball disappears when deleting first metaball object.
Lost specific MBall 'need update' case here in last year's refactor.

While technically not a regression, nice to have in 2.79.
2017-08-17 14:07:18 +02:00
0146ab2fd5 Fix T52315: Crash on duplicating Scene without world.
Regression from rBa7b3047cefcbf, to be backported to 2.79.

Like... seriously... :|
2017-08-17 14:07:18 +02:00
e54df78c82 Fix T52280: The Image node in Compositing can't read Z buffer of openEXR in 2.79
As part of the fix for T51587, I removed the Depth output for non-Multilayer
images since it seemed weird that PNGs etc. that don't have a Z pass still get
a socket for it.
However, I forgot about non-multilayer EXRs, which are a special case that can
actually have a Z pass.

Therefore, this commit brings back the Depth output for non-multilayer images
just like it was in 2.78.
2017-08-17 14:07:17 +02:00
909320e3ff Fix fixed width box layouts
Regression, to be backported in 2.79.
2017-08-17 14:07:17 +02:00
fa34f864a2 Fix T52260: Blender 2.79 Objects made duplicates real still refer armature proxy.
New code was handling correctly ID's internal references to self, but
not references between 'made real' different objects...

Regression, to be backported in 2.79.
2017-08-17 14:07:17 +02:00
205202361c Fix width estimation for empty layouts in pie menus 2017-08-17 14:07:17 +02:00
fb73cee1ec Fix T52263: Crash When Splitting and Merging Areas with Header Text Set.
Not a regression, but safe enough to be included in 2.79.
2017-08-17 14:07:17 +02:00
8ae6e35923 Fix broken API doc generation: Partially revert rBa372638a76e0
Making those arrays static remove them from exported symbols, which
breaks API doc generation script.

To be backported to 2.79 branch.
2017-08-17 14:07:17 +02:00
ade9fc9245 Fix T52250: Glitch in UI in the addon panel regression 2017-08-17 14:07:17 +02:00
78b3061c32 fix attempt for avoiding incorrect inner collisions between constrained objects 2017-08-16 01:20:11 +02:00
f233ecd511 use exact volume calculation for convexhull and mesh when calculating masses of initial objects only 2017-08-15 03:26:44 +02:00
63ad55f295 fixes for FM mesh island rigidbody path problem and volume calculation
scaling was ignored and only half of the dimensions for the volume were used, thus the calculated mass was 1/8th of the
correct mass.
2017-08-15 02:52:59 +02:00
e3e6270241 fix, forgot to set angular spring stiffness and damping when converting to objects 2017-08-14 15:47:29 +02:00
155f2a4a52 fix for break of rigidbody behavior after 2.78c and stoptriggers are speed-dependent now 2017-08-13 13:20:08 +02:00
8af66d6088 versioning fixes for angular spring stiffness / damping and exposed those to FM python api 2017-08-13 01:39:10 +02:00
f68da08a05 fix for initial kinematic state after triggering and jumping back to startframe 2017-08-13 01:00:45 +02:00
97dd7b540f compile fixes after merge 2017-08-12 22:48:47 +02:00
86da0f4749 Merge remote-tracking branch 'refs/remotes/origin/blender-v2.79-release' into fracture_modifier
Conflicts:
	build_files/buildbot/slave_compile.py
	build_files/cmake/buildinfo.cmake
	build_files/cmake/config/blender_release.cmake
	build_files/cmake/macros.cmake
	build_files/cmake/packaging.cmake
	build_files/cmake/platform/platform_win32_msvc.cmake
	doc/python_api/sphinx_doc_gen.py
	doc/python_api/sphinx_doc_update.py
	intern/atomic/atomic_ops.h
	intern/atomic/intern/atomic_ops_ext.h
	intern/atomic/intern/atomic_ops_unix.h
	intern/cycles/CMakeLists.txt
	intern/cycles/blender/addon/properties.py
	intern/cycles/blender/addon/ui.py
	intern/cycles/blender/blender_mesh.cpp
	intern/cycles/blender/blender_object.cpp
	intern/cycles/blender/blender_object_cull.cpp
	intern/cycles/blender/blender_object_cull.h
	intern/cycles/blender/blender_python.cpp
	intern/cycles/blender/blender_session.cpp
	intern/cycles/blender/blender_session.h
	intern/cycles/blender/blender_shader.cpp
	intern/cycles/blender/blender_util.h
	intern/cycles/bvh/bvh.cpp
	intern/cycles/bvh/bvh.h
	intern/cycles/bvh/bvh_build.cpp
	intern/cycles/bvh/bvh_node.h
	intern/cycles/device/device.cpp
	intern/cycles/device/device.h
	intern/cycles/device/device_cpu.cpp
	intern/cycles/device/device_cuda.cpp
	intern/cycles/device/device_opencl.cpp
	intern/cycles/device/device_task.cpp
	intern/cycles/device/opencl/opencl.h
	intern/cycles/device/opencl/opencl_base.cpp
	intern/cycles/device/opencl/opencl_mega.cpp
	intern/cycles/device/opencl/opencl_split.cpp
	intern/cycles/device/opencl/opencl_util.cpp
	intern/cycles/kernel/bvh/bvh.h
	intern/cycles/kernel/bvh/bvh_nodes.h
	intern/cycles/kernel/bvh/bvh_shadow_all.h
	intern/cycles/kernel/bvh/bvh_volume_all.h
	intern/cycles/kernel/bvh/qbvh_shadow_all.h
	intern/cycles/kernel/bvh/qbvh_subsurface.h
	intern/cycles/kernel/bvh/qbvh_traversal.h
	intern/cycles/kernel/bvh/qbvh_volume.h
	intern/cycles/kernel/bvh/qbvh_volume_all.h
	intern/cycles/kernel/closure/bsdf.h
	intern/cycles/kernel/closure/bsdf_microfacet.h
	intern/cycles/kernel/closure/bsdf_microfacet_multi.h
	intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
	intern/cycles/kernel/geom/geom.h
	intern/cycles/kernel/geom/geom_curve.h
	intern/cycles/kernel/geom/geom_motion_curve.h
	intern/cycles/kernel/geom/geom_motion_triangle_intersect.h
	intern/cycles/kernel/geom/geom_motion_triangle_shader.h
	intern/cycles/kernel/geom/geom_object.h
	intern/cycles/kernel/geom/geom_triangle.h
	intern/cycles/kernel/geom/geom_triangle_intersect.h
	intern/cycles/kernel/geom/geom_volume.h
	intern/cycles/kernel/kernel_accumulate.h
	intern/cycles/kernel/kernel_bake.h
	intern/cycles/kernel/kernel_compat_cpu.h
	intern/cycles/kernel/kernel_compat_cuda.h
	intern/cycles/kernel/kernel_emission.h
	intern/cycles/kernel/kernel_image_opencl.h
	intern/cycles/kernel/kernel_light.h
	intern/cycles/kernel/kernel_passes.h
	intern/cycles/kernel/kernel_path.h
	intern/cycles/kernel/kernel_path_branched.h
	intern/cycles/kernel/kernel_path_common.h
	intern/cycles/kernel/kernel_path_surface.h
	intern/cycles/kernel/kernel_path_volume.h
	intern/cycles/kernel/kernel_random.h
	intern/cycles/kernel/kernel_shader.h
	intern/cycles/kernel/kernel_shadow.h
	intern/cycles/kernel/kernel_subsurface.h
	intern/cycles/kernel/kernel_textures.h
	intern/cycles/kernel/kernel_types.h
	intern/cycles/kernel/kernel_volume.h
	intern/cycles/kernel/kernels/cpu/kernel_avx.cpp
	intern/cycles/kernel/kernels/cpu/kernel_avx2.cpp
	intern/cycles/kernel/kernels/opencl/kernel.cl
	intern/cycles/kernel/split/kernel_background_buffer_update.h
	intern/cycles/kernel/split/kernel_data_init.h
	intern/cycles/kernel/split/kernel_direct_lighting.h
	intern/cycles/kernel/split/kernel_holdout_emission_blurring_pathtermination_ao.h
	intern/cycles/kernel/split/kernel_next_iteration_setup.h
	intern/cycles/kernel/split/kernel_scene_intersect.h
	intern/cycles/kernel/split/kernel_split_common.h
	intern/cycles/kernel/svm/svm_displace.h
	intern/cycles/kernel/svm/svm_image.h
	intern/cycles/kernel/svm/svm_tex_coord.h
	intern/cycles/render/buffers.cpp
	intern/cycles/render/graph.cpp
	intern/cycles/render/graph.h
	intern/cycles/render/image.cpp
	intern/cycles/render/image.h
	intern/cycles/render/mesh_subdivision.cpp
	intern/cycles/render/osl.cpp
	intern/cycles/render/session.cpp
	intern/cycles/render/session.h
	intern/cycles/render/svm.cpp
	intern/cycles/render/svm.h
	intern/cycles/render/tile.cpp
	intern/cycles/render/tile.h
	intern/cycles/util/util_atomic.h
	intern/cycles/util/util_boundbox.h
	intern/cycles/util/util_half.h
	intern/cycles/util/util_image.h
	intern/cycles/util/util_image_impl.h
	intern/cycles/util/util_math.h
	intern/cycles/util/util_path.cpp
	intern/cycles/util/util_progress.h
	intern/cycles/util/util_simd.h
	intern/cycles/util/util_task.cpp
	intern/cycles/util/util_types.h
	intern/ghost/intern/GHOST_SystemCocoa.mm
	make.bat
	release/datafiles/locale
	release/scripts/addons
	release/scripts/presets/interface_theme/24x_blues.xml
	release/scripts/presets/interface_theme/flatty_light.xml
	release/scripts/startup/bl_operators/wm.py
	release/scripts/startup/bl_ui/space_userpref.py
	source/blender/blenkernel/BKE_library_query.h
	source/blender/blenkernel/BKE_sca.h
	source/blender/blenkernel/intern/DerivedMesh.c
	source/blender/blenkernel/intern/armature.c
	source/blender/blenkernel/intern/library.c
	source/blender/blenkernel/intern/library_query.c
	source/blender/blenkernel/intern/mesh.c
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/blenkernel/intern/sca.c
	source/blender/blenkernel/intern/subsurf_ccg.c
	source/blender/blenlib/intern/task.c
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/blenloader/intern/writefile.c
	source/blender/collada/ArmatureImporter.cpp
	source/blender/depsgraph/DEG_depsgraph_build.h
	source/blender/depsgraph/intern/builder/deg_builder.cc
	source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
	source/blender/depsgraph/intern/builder/deg_builder_nodes.h
	source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
	source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc
	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
	source/blender/depsgraph/intern/builder/deg_builder_relations.h
	source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
	source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
	source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc
	source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
	source/blender/depsgraph/intern/depsgraph.h
	source/blender/depsgraph/intern/depsgraph_build.cc
	source/blender/depsgraph/intern/depsgraph_eval.cc
	source/blender/depsgraph/intern/eval/deg_eval.cc
	source/blender/depsgraph/intern/eval/deg_eval_debug.cc
	source/blender/depsgraph/intern/nodes/deg_node.cc
	source/blender/depsgraph/intern/nodes/deg_node.h
	source/blender/depsgraph/intern/nodes/deg_node_component.cc
	source/blender/depsgraph/intern/nodes/deg_node_component.h
	source/blender/depsgraph/intern/nodes/deg_node_operation.cc
	source/blender/depsgraph/util/deg_util_foreach.h
	source/blender/editors/animation/anim_channels_defines.c
	source/blender/editors/animation/anim_draw.c
	source/blender/editors/armature/pose_transform.c
	source/blender/editors/interface/interface_layout.c
	source/blender/editors/object/object_modifier.c
	source/blender/editors/space_outliner/outliner_edit.c
	source/blender/editors/transform/transform_snap_object.c
	source/blender/gpu/shaders/gpu_shader_material.glsl
	source/blender/makesdna/DNA_ID.h
	source/blender/makesdna/DNA_modifier_types.h
	source/blender/makesdna/DNA_rigidbody_types.h
	source/blender/makesdna/DNA_userdef_types.h
	source/blender/makesrna/intern/rna_ID.c
	source/blender/makesrna/intern/rna_main.c
	source/blender/makesrna/intern/rna_main_api.c
	source/blender/makesrna/intern/rna_mesh_api.c
	source/blender/makesrna/intern/rna_modifier.c
	source/blender/makesrna/intern/rna_render.c
	source/blender/makesrna/intern/rna_rigidbody.c
	source/blender/makesrna/intern/rna_userdef.c
	source/blender/makesrna/intern/rna_wm_api.c
	source/blender/modifiers/MOD_modifiertypes.h
	source/blender/modifiers/intern/MOD_boolean.c
	source/blender/modifiers/intern/MOD_normal_edit.c
	source/blender/modifiers/intern/MOD_util.c
	source/blender/nodes/shader/nodes/node_shader_tex_brick.c
	source/blender/python/intern/bpy_rna_id_collection.c
	source/blender/render/extern/include/RE_pipeline.h
	source/blender/render/intern/source/render_result.c
	source/creator/CMakeLists.txt
	tests/gtests/CMakeLists.txt
	tests/gtests/blenlib/BLI_string_test.cc
	tests/python/CMakeLists.txt
2017-08-12 22:48:17 +02:00
5c9626721b reordered all FM related functions to the end of file 2017-08-12 16:28:18 +02:00
474ae3e5f9 renamed "Anti-Trigger" to "Stop Trigger" in python and UI now 2017-08-10 19:21:35 +02:00
3bdb65f5ed performance regression fix which reduces some static-static collision checking 2017-08-10 18:55:07 +02:00
39330a3e62 reworked the trigger system to work in narrowphase of bullet (more exact shapes) 2017-08-09 22:18:03 +02:00
0e7fb6d0bd support for "anti-triggers" which stop movement of active rigidbody shards 2017-08-09 15:30:00 +02:00
1d57779c20 using quaternions and correction of quaternion sign flips for convert to keyframes now 2017-08-08 01:26:25 +02:00
a4c953bf04 attempt to reduce memory usage with dynamic fracture
but somewhere a memory leak is still present there
2017-08-07 17:58:04 +02:00
be6e39da29 minor fix: forgot to update frame in display when converting to keyframes 2017-08-05 20:05:36 +02:00
91f02a80f5 fix for wrong centroid calculation when re-using existing mesh-islands
this affected the physics mesh and the convert to keyframes function, which created incorrect results.
2017-08-05 19:22:13 +02:00
5e9132b3b7 2.79 release: point submodules to correct branches and versions. 2017-08-01 19:31:37 +02:00
8e21378e05 take position for constraint between both rigidbodies for fixed constraints now, too 2017-06-21 14:48:34 +02:00
04896acd69 skip exceeded verts in average coord calculation in keep distort mode now too 2017-06-20 22:24:33 +02:00
5909d32aec allow a bit "cleaner" cut edges when keep distort is not set, else they keep jaggy 2017-06-20 16:59:01 +02:00
a8510408b9 added deform weakening factor
the threshold is multiplied with 1.0-fac per deform iteration, so it can automatically break at some point.
2017-06-18 19:25:57 +02:00
256aeb213a added additional distances and angles settings in order to control plastic deform better 2017-06-18 17:20:38 +02:00
e3cdc36429 refinement for plastic deformation 2017-06-18 13:41:38 +02:00
3294959446 attempt to have "plastic" constraint deform by re-constraining via angle, distance
deformation mode happens when breakable is set to false, but angle or distance is set
2017-06-18 11:08:21 +02:00
dfbcbaf7eb fix attempt for memory leak after loading FM blends in prefractured mode
note: works only with newly saved FM files, older still have unnecessary data in them which wont be automatically cleaned
2017-06-17 21:08:54 +02:00
00054e28a4 do not check constraint islands in case constraint collision is activated (allow self collision) 2017-06-16 23:00:05 +02:00
b025e3b36a check for availability of "constraint_type" in DNA struct, if not there set default value "fixed" 2017-06-16 22:00:37 +02:00
e1ea9a4afd added constraint type setting for FM constraints
previously there was only a cluster constraint setting
2017-06-16 18:43:15 +02:00
64ada2985f added Dissolve plastic constraints option, only relevant for external mode 2017-06-16 12:21:02 +02:00
c802ddb2a4 allow triggering in external mode too 2017-06-15 17:05:37 +02:00
8dc440e900 fix for distortion, should avoid snapping back of geometry 2017-06-14 22:51:13 +02:00
5caefc95a7 refactor of automerge shared vertex handling function 2017-06-14 20:55:26 +02:00
55aa21bb16 fix attempt for uncontrolled "snapping" when using keep distort 2017-06-14 19:33:30 +02:00
dce6a36932 crash fix for linking FM scene as background scene with automerge 2017-06-14 12:48:27 +02:00
afa2287ea3 fix, do not recalculate autohide when only changing automerge dist 2017-06-14 12:23:56 +02:00
d5213d70b7 performance improvement for packing many islands, avoided unnecessary listbase findlink 2017-06-14 00:02:15 +02:00
a99e840151 crash fix and minor tweaks for external mode (setting expected defaults) 2017-06-13 23:28:24 +02:00
4b560f14d7 further fixes for external mode 2017-06-13 22:37:36 +02:00
c3c488e475 fix for handling of uvs when packing objects into fracture modifier 2017-06-13 19:26:03 +02:00
2df9e4909c reset automerge (distortion, exceeded) in external mode now too on startframe 2017-06-12 12:16:55 +02:00
1941be005d more tweaks for automerge 2017-06-12 11:29:27 +02:00
2b63854ec1 allow autohide / automerge for external mode too, and some tweaks for shared vert group optimization 2017-06-12 01:40:00 +02:00
9ae6823841 disabled "optimization attempt" for automerge again, did not bring much performance and caused visual errors 2017-06-11 18:43:36 +02:00
b8cb539f2c fix for old dynamic external mode 2017-06-11 18:16:19 +02:00
83144efb4d further automerge speed optimization attempts 2017-06-11 17:48:45 +02:00
4670d18474 use separate storage for packed geometry, allows mode switching and re-use of it 2017-06-11 11:49:50 +02:00
8fe651325c recalc normals when merging (distance>0) and not using fix normals 2017-06-10 21:58:25 +02:00
9c2ca73575 clamped distortion and keep shared groups with autohide distance = 0 as well 2017-06-10 21:40:53 +02:00
170007cc4f fix for automerge, with bisect / fast bisect recalc normals on merge, also no redundant shared groups any more 2017-06-10 19:49:45 +02:00
03c11e58a9 crash fix when using ob->derivedFinal for a bbox calculation, needed to check its validity better 2017-06-08 16:50:23 +02:00
fcff61a1bd made do_merge and keep_distort optional 2017-06-08 15:40:20 +02:00
bb9f2e4037 keep distorted shape after tearing, todo, make this optional ? 2017-06-08 14:25:34 +02:00
1b19fea008 tweak for inner crease, only appear on torn edges 2017-06-08 13:19:39 +02:00
b1d786de2c fix for automerge, do not snap together after exceeding threshold, and adding optionally crease to edges, too 2017-06-08 13:00:47 +02:00
4d8b238e4b first attempt for better automerging 2017-06-08 01:15:16 +02:00
e041ca68e1 fix for packing materials, material index start value could overflow due to being a short instead of int 2017-06-07 18:08:43 +02:00
51a088cbea also store material index in shards, so it can be loaded from blend later 2017-06-07 16:15:39 +02:00
05e4103ba4 fix for material assignment when converting back to objects 2017-06-07 16:08:55 +02:00
0812e32572 prefer vector handle on adaptive keyframe in convert to keyframed objects 2017-06-04 19:59:32 +02:00
76e114180d fix attempt for particle systems supporting dynamicly changing vertexgroups 2017-06-04 19:35:26 +02:00
948ad8e88b crash fix and attempt to reduce unnecessary memory usage 2017-06-04 00:55:19 +02:00
b25edc6352 set allowed smoke timescale from 0.0 to 2.0, thus allow static and a bit faster smoke as well 2017-06-03 19:58:00 +02:00
15b3b2bdcd minor tweak, just activate clusters and keep inter-cluster constraints intact in that case 2017-06-02 15:41:03 +02:00
56f42dacd2 fix for cluster percentage, was incorrectly calculated before and only used if regular percentage was set 2017-06-02 10:02:50 +02:00
a293d028b9 new "Handle" option for convert to keyframes, if set calculates handles to be auto or vector(adaptive), but can be slower 2017-06-01 12:42:32 +02:00
899c2b921c further optimization attempts with convert to keyframed objects 2017-05-31 20:43:47 +02:00
b7327017a0 fix for convert to keyframes, needs no bake and should be initialized properly after refracture 2017-05-31 13:41:18 +02:00
fe95515de0 performance improvement with convert to keyframes and new adaptive keyframe option (threshold of changes) 2017-05-30 17:44:18 +02:00
b7f7879ad2 added step option to convert to keyframes, new parameter popup dialog, also backported fseek fix to meshcache modifier 2017-05-29 21:33:40 +02:00
f6924b23bf fix for loading bakes from official build (single objects)
also reverted from exact volume calculation of shards to bbox (faster)
removed some development printouts
2017-05-22 19:28:30 +02:00
2f6f36ef5a added rectangular alignment feature for fast bisect (works with uniform only)
the closer the factor is to 1, the more rectangular-ish the shards will look like. default is 0 which means any rotation is allowed.
2017-05-12 17:48:34 +02:00
ad99d53b8a fix for jumps in rotation when converting to keyframed objects 2017-04-21 13:14:08 +02:00
a9e14e1018 crash fix for physical rough edges (corrupted memory) 2017-03-29 20:55:48 +02:00
0decb16563 do not execute refresh operator in running sim any more 2017-03-28 21:38:59 +02:00
6806065c38 apparently fixed the cuttergroup bug (was an incorrect bbox test) + silenced 2 warnings 2017-03-28 18:35:27 +02:00
e8f0228977 fix attempt for numerical instabilty with cuttergroups + a couple of minor fixes
as workaround you could use particlehelper and uniform together with cuttergroups
2017-03-28 17:41:49 +02:00
65c86fc66b load crash fix if FM is there but hasnt been executed prior to save 2017-03-15 20:55:42 +01:00
5bac7e5ac7 fix for loading cutter group fractures and allow all algorithms now in combination with cuttergroup 2017-03-15 17:36:25 +01:00
5f56257713 added basic material handling and outputting vertexgroups for intersect/difference shards with cuttergroups 2017-03-12 13:11:52 +01:00
e63c6cd345 fix attempt for passive fakeparenting with dynamic/external, and first version of combined cuttergroup and procedural (boolean only) fracture 2017-03-11 18:52:01 +01:00
30acaddb6c fixes for constraint behavior in dynamic_external mode 2017-03-07 21:34:12 +01:00
3b0646b3ac dissolve constraint now only dissolves constraints between different clusters if clusters are used
additionally added a python-settable variable to indicate whether the dynamic fracture data has been loaded externally or not (just set it from the handler)
2017-03-07 16:41:09 +01:00
cd6e18db8a added handlers which are triggered after freeing shards and before rebuilding constraints
this is supposed to keep externally loaded data in place when changing over to dynamic fracture, the handler triggers a python script which populates the meshislands and another to populate the constraints via the FM python API.
Additionally a couple of minor fixes for dynamic fracturing.
2017-03-06 19:24:55 +01:00
57a1e434e5 fix for hair particle system, was wrong hair distribution and render error
suppressed "dynamic" particle redistribution for hair now too
2017-03-03 13:19:57 +01:00
a34e295b68 fix, forgot to copy splinter axis when duplicating FM object 2017-02-26 21:18:45 +01:00
c073d3e8a4 Merge remote-tracking branch 'refs/remotes/origin/blender-v2.78c-release' into fracture_modifier 2017-02-25 15:44:10 +01:00
bc27652e57 tests: Update hash for OBJ
Was a recent update of UV precision.
2017-02-23 18:04:00 +01:00
27167ee3a4 Cycles: Fix compilation error on 32bit Linux 2017-02-23 17:30:54 +01:00
551265424b Fix T50243: libmv_panography_test is broken
There was fully wrong logic in comparison: was actually accessing memory
past the array boundary. Run test manually and the figure seems correct
to me now.

Spotted by @LazyDodo, thanks!
2017-02-23 17:18:03 +01:00
15fb1fdb99 [msvc] Set proper OpenSubdiv flags when not using find_package to find opensubdiv. Fixes T50548 2017-02-23 16:21:16 +01:00
7d77dcd190 Blender 2.78c: Officially move to 'c' 2017-02-23 16:07:47 +01:00
909c8ec07a Cycles: Fix wrong render results with texture limit and half-float textures 2017-02-23 15:07:45 +01:00
b95645c1ae Fix T50748: Render Time incorrect when refreshing rendered preview in GPU mode 2017-02-23 15:07:02 +01:00
67169e70d6 Fix T50687: Cycles baking time estimate and progress bar doesn't work / progress when baking with high samples 2017-02-22 16:58:37 +01:00
e89145efd3 Fix T50512: Linked Backround scene with animation not updating with new depsgraph
Was missing relations for the set scenes.

Perhaps not ideal solution, but should be good enough for now.
2017-02-22 16:48:48 +01:00
dd2e33b24d Blender 2.78c: Fix crash with material preview and image sequences
Don't use built-in API for image sequences since it's not really
finished in RNA API.

Fixes issue reported in T50616.
2017-02-22 16:46:00 +01:00
99abd1f79e Blender 2.78c: Fix wrong render result with pointiness
The issue was caused by pointiness being calculated after
faces split now. Ported all fixes we did here.

Should be safe, pointiness is used all over the barbershop.
2017-02-22 16:34:10 +01:00
92e75a54f4 Cleanup 2017-02-22 15:57:41 +01:00
8ba1dab3a2 Blender 2.78c: Fix Brick Texture GLSL, broken after Mortar Smooth addition. 2017-02-22 15:33:30 +01:00
9215848c38 Fix T50550: GPUShader: compile error - Background image not showing in
viewport.

Caused by rBd6cf28c5e15739f864fbf04614c2a50708b4b152, which forgot to
update the GLSL code for the "Light Path" node.
2017-02-22 15:25:28 +01:00
b3b4084073 Blender 2.78c: Fix wrong cycles hair render results when using BVH motion steps
This commit contains all commits required to get proper hair rendering
with BVH motion steps enabled.

The issue here was mainly coming from minimal pixel width feature
which is quite commonly enabled in production shots.

This feature will use some probabilistic heuristic in the curve
intersection function to check whether we need to return intersection
or not. This probability is calculated for every intersection check.
Now, when we use multiple BVH nodes for curve primitives we increase
probability of that primitive to be considered a good intersection
for us. This is similar to increasing minimal width of curve.

What is worst here is that change in the intersection probability
fully depends on exact layout of BVH, meaning probability might
change differently depending on a view angle, the way how builder
binned the primitives and such. This makes it impossible to do
simple check like dividing probability by number of BVH steps.

Other solution might have been to split BVH into fully independent
trees, but that will increase memory usage of all the static
objects in the scenes, which is also not something desirable.

For now used most simple but robust approach: store BVH primitives
time and test it in curve intersection functions. This solves the
regression, but has two downsides:

- Uses more memory.

  which isn't surprising, and ANY solution to this problem will
  use more memory.

  What we still have to do is to avoid this memory increase for
  cases when we don't use BVH motion steps.

- Reduces number of maximum available textures on pre-kepler cards.

  There is not much we can do here, hardware gets old but we need
  to move forward on more modern hardware..
2017-02-22 15:08:56 +01:00
c6e4a81dfb Blender 2.78c: Port all commits related on new Cycles regression tests 2017-02-22 15:07:18 +01:00
3c043732d3 Blender 2.78b: Point addons to an updated revision 2017-02-08 14:50:08 +01:00
cc6cf0cdce fix, keep bake until convert to keyframe has been finished, and delete then
Deleting the bake after changing the rigidbody count still is necessary, else the shard order and the mesh appearance of fracture modifier objects will be messed up.
Furthermore, decreased the convert to keyframe default threshold from 0.05 to 0.005, reconverting by re-using
the operator again still is somewhat broken
2017-02-05 17:24:44 +01:00
9cb21a1400 Blender release: We are officially 'b' now 2017-02-03 17:54:29 +01:00
a3e746733d [msvc] cmake fixes to support the recent for oiio/ffmpeg/numpy version changes. 2017-02-03 09:47:54 -07:00
8fa3801c49 Fix fluid sim build error with MSVC. 2017-02-03 15:48:09 +01:00
34b09852fd Fluids: improve multithreaded CPU usage.
Fixes for clamp-omp, fewer shared variables, fix some cases of threads writing
to the same memory location. Issue found by Jens Verwiebe, who reports 30%
speedup with 16 core CPU, when using this with a recent clang-omp version.
2017-02-03 15:48:06 +01:00
f6d2981ffb Cycles tests: Allow python auto-exec 2017-02-03 10:46:56 +01:00
9f6cfa3ead Cycles: Fix rng_state initialization when using resumable rendering 2017-02-01 11:48:50 +01:00
9529a96fd0 fix attempt for disappearing fm debris particles after baking 2017-01-29 19:08:38 +01:00
3c518ab4a4 crash fix, do not update tessface data while loading, only ensure it (saved fracture might have been invalid mesh) 2017-01-29 19:07:33 +01:00
7314ede784 Fix compilation error with latest OIIO 1.7.8
There are some changes in OIIO includes so now need to do some
things differently.
2017-01-26 11:27:44 +01:00
8ceed387c9 Return correct alpha for environment map in GLSL 2017-01-26 11:19:12 +01:00
672fbbfb4e Fix T49405: Crash when baking with adaptive subdivision
Blenders baking system currently doesn't support the topology used by
adaptive subdivision and primitive ids will be wrong or out of range
leading to crashes. Updating the baking system to support other
topologies would be a bit involved, so for now we simply disable
subdivision while baking to avoid crashes.
2017-01-26 11:16:34 +01:00
59c224ebc7 Cycles: Don't rely on indirectly included algorithm 2017-01-26 11:16:24 +01:00
7a9f8d0c77 Cycles: Fix typo in the panel name
No user visible changes, it was a typo in the name of the class.

Spotted by povmaniac in IRC, thanks!
2017-01-26 11:15:35 +01:00
2a757450f5 Cycles: Update current Cycles version 2017-01-26 11:15:25 +01:00
82e0127065 Fix T50491: Cycles UI breaks when pushing F8.
Cycles add-on did not actually support reloading correctly.

When you want to correctly reload sub-modules (i.e. modules of an add-on
which is a package), you need to use importlib, a mere import will do
nothing with already loaded modules (RNA classes are sort of
pre-registered when they are evaluated, through the meta-class system).
2017-01-26 11:15:18 +01:00
bfd209007d Cycles: Use more const qualifiers to avoid possible issues 2017-01-26 11:15:06 +01:00
db26c6f66c Cycles: Cleanup, split one gigantic function into two smaller ones 2017-01-26 11:15:00 +01:00
a65a988592 Cycles: Store time in BVH nodes
This way we can stop traversing BVH node early on.

Gives about 2-2.5x times render time improvement with 3 BVH steps.
Hopefully this gives no measurable performance loss for scenes with
single BVH step.

Traversal is currently only implemented for QBVH, meaning old CPUs
and GPU do not benefit from this change.
2017-01-26 11:14:51 +01:00
91fe6bdcb6 Cycles: Add option to split triangle motion primitives by time steps
Similar to the previous commit, the statistics goes as:

BVH Steps     Render time (sec)       Memory usage (MB)
    0                46                    260
    1                27                    373
    2                18                    598
    3                15                    826

Scene used for the tests is the agent's body from one of the barber
shop scenes (no textures or anything, just a diffuse material).

Once again this is limited to regular (non-spatial split) BVH,
Support of spatial split to this feature will come later.
2017-01-26 11:14:42 +01:00
9bf3b4679e Cycles: Add option to split curve motion primitives by time steps
The idea is to create several smaller BVH nodes for each of the motion
curve primitives. This acts as a forced spatial split for the single
primitive.

This gives up render time speedup of motion blurred hair in the cost
of extra memory usage. The numbers goes as:

BVH Steps     Render time (sec)       Memory usage (MB)
    0               258                    191
    1               123                    278
    2                69                    453
    3                43                    627

Scene used for the tests is the agent's hair from one of the barber
shop scenes.

Currently it's only limited to scenes without spatial split enabled,
since the spatial split builder requires some changes to work properly
with motion steps coordinates.
2017-01-26 11:14:36 +01:00
be431c7cdc Cycles: Add utility function to calculate curve boundbox from given 4 keys
Also fixed some issues with motion keys calculation:

- Clamp lower and upper limits of curves so we can safely call those
  functions for the very first and very last curve segment.
- Fixed wrong indexing for the curve radius array.
- Fixed wrong motion attribute offset calculation.
2017-01-26 11:14:28 +01:00
d87caabf29 Cycles: Cleanup, trailing whitespace 2017-01-26 11:14:20 +01:00
f6742d36cd Cycles: Split motion triangle file once again, avoids annoying forward declarations 2017-01-26 11:14:12 +01:00
acbba822f7 Cycles: Move motion triangle intersection functions to own file
Mimics how regular triangles are working and makes it more clear where
the stuff is located in the kernel.

Needed to have some forward declarations because of the current placement
of things in the kernel.
2017-01-26 11:14:02 +01:00
69357d9db0 Cycles: Cleanup, better variable name 2017-01-26 11:13:54 +01:00
5a5b45374b Cycles: Add utility function to fetch motion keys while on CPU side 2017-01-26 11:13:48 +01:00
93c5388e34 Cycles: Cleanup, comments 2017-01-26 11:13:40 +01:00
df3511c96f Cycles: Add utility function to fetch motion triangle when on CPU side 2017-01-26 11:13:34 +01:00
eabb8f1d12 Cycles: Cleanup, delete trailing whitespace 2017-01-26 11:13:28 +01:00
5283a7e518 Fix T50460. Greying out issue with Cycles culling options. 2017-01-26 11:13:06 +01:00
c727bc7743 Fix T50517: Rendering expecting time is negative 2017-01-25 11:22:14 +01:00
feb2f0ae30 FIX T49899: Add EIGEN_MAKE_ALIGNED_OPERATOR_NEW to classes that use eigen's data types , to force aligned on 16 byte boundaries. 2017-01-24 11:54:39 +01:00
44ffbcd254 Fix T49857: Blender crashes after adding texture node to compositing tree 2017-01-24 11:54:39 +01:00
f8a3b9b50c Cycles: Fix compilation error on with older GCC
Hopefully it works on all platforms now.
2017-01-20 12:17:11 +01:00
faaf41b330 Depsgraph: Bone parent should also include armature transform relation
It is required to have world-space bone position, which consists of armature
object transform and local bone transform.
2017-01-20 11:37:00 +01:00
8a0e91366c Depsgraph: Only re-schedule objects which are on visible layers
Otherwise it's possible to cause infinite update loop in Cycles viewport.

Gets a bit messy logic, need to revisit this..
2017-01-20 11:37:00 +01:00
85c7ecce27 Depsgraph: Use HIGH priority for scheduled tasks
This kind of keeps threads "warmer" and should in theory give better
cache coherency bringing some %% of speedup. It was already tested
few months ago and it gave few % speedup in barber shop, but was
reverted due to some bone popping. The popping is now fixed so it
should be fine to use new scheduling policy.
2017-01-20 11:37:00 +01:00
e3ede8294a Depsgraph: avoid more transitive relations for rigid body simulation 2017-01-20 11:37:00 +01:00
bff566215e Depsgraph: Rigid body simulation doesn't need explicit time relation
It'll be dependent on time via Time Source -> Rebuild RB World chain.
2017-01-20 11:36:59 +01:00
10ce1eea3f Depsgraph: Avoid transitive relation from local transform to final
There is always an uber eval node on the way. so we can avoid creating
some relations here in order to speed up both construction time and
evaluation.
2017-01-20 11:36:59 +01:00
5c4c2bebaa Fix depsgraph: hair collision is actually enabled, so add the relations. 2017-01-20 11:36:59 +01:00
85ec0446e1 Depsgraph: Fix matrix_world driver source
Reported by Dalai in IRC, thanks!
2017-01-20 11:36:59 +01:00
4a4959a647 Fix T49981: New Depsgraph - When camera is on inactive layer, it does not evaluate constraints 2017-01-20 11:36:59 +01:00
a3f66a868e Depsgraph: Fix infinite viewport object update in CYcles render mode
The issue was caused by wrong object re-tag needed to have proper dependnecies
update for OpenSubdiv.
2017-01-20 11:36:58 +01:00
8e908ae321 Depsgraph: use more explicit parenthesis 2017-01-20 11:36:58 +01:00
82cee9cb89 Depsgraph: Fix residue of debug-only code 2017-01-20 11:36:58 +01:00
b5b0354b7c Fix copy/paste typo in new depsgraph object geometry builder (found by coverity). 2017-01-20 11:36:58 +01:00
5708ec2a01 Depsgrpah: Fix missing animation update in movie clips 2017-01-20 11:36:58 +01:00
317431461f Depsgraph: Move scene builder function to own file
This way it's much easier to grasp what the graph actually contains.
2017-01-20 11:36:57 +01:00
48a8a20e2a Fix T50060: New depsgraph does not update mask animation 2017-01-20 11:36:57 +01:00
cf60343b06 Depsgraph: Use utility macro to iterate over linked list
This will be compiled into same exact code, just saves us from
doing annoying type casts all over the place.
2017-01-20 11:36:57 +01:00
c02ba89d6a Depsgraph: Move rig builder functions to own files
Those routines are rather big and started to be annoying to have
one big file.

Should be no functional changes.
2017-01-20 11:36:57 +01:00
3d2a6e7db3 Depsgraph: Fix typo in previous optimization commit
Was a residue from another experiment, caused infinite loop when
reporting dependency cycles.
2017-01-20 11:36:57 +01:00
6d6c333ee9 Atomics: Make naming more obvious about which value is being returned 2017-01-20 11:36:56 +01:00
fb2d5a9853 Fix T49994: Setting dupligroup which uses indirect relation will crash
Did similar trick to old dependency graph: tag invisible relations for update.

Might need some re-consideration, see the comment.

This should solve our issues with powerlib addon here in the studio.
2017-01-20 11:36:56 +01:00
8ddc85ab59 Depsgraph: Add missing NULL pointer check 2017-01-20 11:36:56 +01:00
d3963e2bb0 Depsgraph: Fix missing DONE flag in relations builder
Was causing relations be build twice in certain cases.
2017-01-20 11:36:56 +01:00
c0c6af2cdd Fix T49993: Indirectly used taper/bevel crashes new dependency graph
New dependency graph expects strict separation between nodes and relations builder,
meaning, if we try to create relation with an object which is not in the graph yet
we'll have an error in depsgraph.

Now, so far object nodes were created from bases of the current scene, which caused
missing objects in graph in certain cases.

Didn't find better approach than to simply ensure object nodes exists when we know
they'll be used by relation builder.
2017-01-20 11:36:56 +01:00
88d02e5433 Depsgraph: Fix typo in text on curve relation builder 2017-01-20 11:36:56 +01:00
9d2a7961fc Depsgraph: Fix missing ID node tag
Might have caused nodes created multiple times for the same object.
2017-01-20 11:36:55 +01:00
a45d648485 Depsgraph: Add some data builder logic to corresponding function 2017-01-20 11:36:55 +01:00
ad01f0d19b Depsgraph: cleanup, no functional changes 2017-01-20 11:36:55 +01:00
29ef143ef9 Depsgraph: Fix another issue which seems to be a bug
Similar to a previous commit.

Doing separately for an easy of bisect.
2017-01-20 11:36:55 +01:00
5393e78367 Depsgraph: Fix wrong relation from IK solver to pole target
Copy paste error...

How to avoid those?
2017-01-20 11:36:55 +01:00
f737bc673b Depsgraph: Disable timing profile 2017-01-20 11:36:55 +01:00
Martijn Berger
3d75a7d0dc fix building depsgraph after recent changes 2017-01-20 11:36:54 +01:00
faa8b12714 Depsgraph: Do not rely on indirectly included cstring
Also add comment why exactly cstring is needed.
2017-01-20 11:36:54 +01:00
1c5502def8 Despgraph: Optimize cycles detection algorithm
The idea is simple: when falling back to one of the nodes which was partially
handled we "resume" checking outgoing relations from the index which we stopped.

This gives about 15-20% depsgraph construction time save.
2017-01-20 11:36:54 +01:00
34199e82fc Depsgraph: Speedup initial rig build time
We don't need to sort bone channels, it's all taken care about
by the depsgraph itself.

Gives up to 30% initial rig construction time speedup.
2017-01-20 11:36:54 +01:00
b15d218db5 Depsgraph: Move key implementation from header to dedicated file 2017-01-20 11:36:54 +01:00
93783cb176 Depsgraph: Move class implementation from header to implementation files
This is more proper way to go:

- Avoids re-compilation of all dependent files when implementation changes
  without changed API,

- Linker should have much simpler time now de-duplicating and getting rid
  of redundant implementations.
2017-01-20 11:36:54 +01:00
06c202002b Depsgraph: Fully switch from string to const char*
This brings up to 10-20% depsgraph build time improvement in the layout
files from the studio repository.
2017-01-20 11:36:53 +01:00
570c072020 Depsgraph: Add extra name tag for operation nodes
The idea here is to address issue that name on it's own is not
always unique: for example, when adding driver operations the
name used for nodes is the RNA path (and multiple drivers can
write to different array indices of the path). Basically, now
it's possible to pass extra integer value to distinguish
operations in such cases.

So now we've already switched from sprintf() to construct unique
operation name to pass RNA path and array index.

There should be no functional changes yet, but this work is
required for further work about replacing string with const
char*.
2017-01-20 11:36:53 +01:00
1d5833caf5 Depsgraph: Cleanup, operation has name, not description
Hopefully should make things more clear here.
2017-01-20 11:36:53 +01:00
507599270f Depsgraph: Remove unused function
A residue from times where we thought to do partial graph updates,
which we are not committing any time soon.
2017-01-20 11:36:53 +01:00
c520c4955f Depsgraph: Use const char for component API 2017-01-20 11:36:53 +01:00
c8f942574d Depsgraph: Remove some includes which seems unused 2017-01-20 11:36:52 +01:00
4939ec8a13 Depsgraph: Use const char instead of string in part of drivers construction 2017-01-20 11:36:52 +01:00
f7f44da43d Depsgraph: Switch away form string to const char* for node names
There is no real reason to have nodes storing heap-allocated name
and description. Doing this increases amount of allocations during
dependency graph building, which usually means somewhat slowness.

We're temporarily loosing some eyecandy in the graphviz visualizer,
but those we can bring back as a part of graphiz dump (which happens
much less often than depsgraph build).

This will happen in multiple commits for the ease of bisect in the
future just in case this causes any regression. This commit contains
ID creation API changes.
2017-01-20 11:36:52 +01:00
fe53bdf893 Depsgraph: Remove prototype of unused and non-implemented method 2017-01-20 11:36:52 +01:00
f7c0b01c2d Depsgraph: Add code for timing despgraph builder 2017-01-20 11:36:52 +01:00
71d48a44a5 Fix T49826: NEW-DEPSGRAPH - Texture is not updated after changing its space color
The issue was caused by image ID nodes not being in the depsgraph.

Now, tricky part: we only add nodes but do not add relations yet. Reasoning:

- It's currently important to only call editor's ID update callback to solve
  the issue, without need to flush changes somewhere deeper.

- Adding relations might cause some unwanted updates, so will leave that for
  a later investigation.
2017-01-20 11:36:52 +01:00
7d9be2f44e Depsgraph: Fix wrong comparison of ID type vs. node type 2017-01-20 11:36:51 +01:00
6514cbae6b Depsgraph: Fix race condition writing drivers to array property
Animation system has separate fcurves for each of array elements and
dependency graph creates separate nodes for each of fcurve, This is
needed to keep granularity of updates, but causes issues because
animation system will actually write the whole array to property when
modifying single value (this is a limitation of RNA API).

Worked around by adding operation relation between array drivers
so we never write same array form multiple threads.
2017-01-20 11:36:51 +01:00
e4164f31fc Depsgraph: Fix some errors printed to the console
They were not real issues, it's just some areas of code tried to create
relations between non-existing nodes without checking whether such
relations are really needed.

Now it should be easier to see real bugs printed.

Hopefully should be no regressions here.
2017-01-20 11:36:51 +01:00
8b192ade96 Partial fix for T49836: Camera DOF properties not updating via graph editor
Do this for the new dependency graph: was missing handle of OB_UPDATE_TIME in tag update.

Hopefully it's all correct still.

Old dependency graph needs work, but i'm tempting to call it unsupported and move on
to 2.8 branch.
2017-01-20 11:36:51 +01:00
1c29fbed65 Depsgraph: Report proper error when modifier fails to create relation link 2017-01-20 11:36:51 +01:00
085ce77b64 Depsgraph: Avoid some false-positive time dependencies of scripted drivers
This was quite weak to consider all scripted expression to be time-dependent.
Current solution is somewhat better but still crappy. Not sure how can we make
it really nice.
2017-01-20 11:36:51 +01:00
4ad131f9f1 Solve threading conflict when calculating smooth normals
It was possible to have synchronization issues whe naccumulating smooth
normal to a vertex, causing shading artifacts during playback.

Bug found by Dalai, thanks!
2017-01-20 11:36:50 +01:00
05fd3b586f RNA: Expose autosmooth face splitting
This way render engine can request mesh to be auto-split and not
worry about implementing this functionality on it's own.

Please note that this split is to be performed prior to tessellation.
2017-01-20 11:29:02 +01:00
7e5a0c146e Fix compile error (-Werror=float-conversion). 2017-01-20 11:26:25 +01:00
4564b014be Cycles: Expose diffuse and glossy depth to Light Path node
Was a bit confusing to have transparent and translucent depth
exposed but no diffuse or glossy.

Reviewers: brecht

Subscribers: eyecandy

Differential Revision: https://developer.blender.org/D2399
2017-01-20 11:26:24 +01:00
5f2ed8ccf1 Cycles: Don't use fast math for the host code
This is important for the reliable behavior or isnan/isfinite/min/max
functions to work with nan and non-finite values. Some of the issues
with fast math are possible to work around, but didn't find a way to
have reliable min/max implementation yet.
2017-01-20 11:26:24 +01:00
a1570562f3 Cycles: Add fast-math safe isnan and isfinite
Currently unused, but might become really handy in the future.
2017-01-20 11:26:24 +01:00
46926b4b11 Cycles: Remove using namespace hell
Please NEVER EVER use such a statement, it's only causing HUGE
issues. What is even worse: it's not always possible to immediately
see that the hell is coming from such a statement.

There is still some statements in the existing code, will leave
those for a later cleanup.
2017-01-20 11:26:24 +01:00
83d7c64bc9 Cycles: Fix amount of rendered samples not being shown while rendering the last tile on CPU 2017-01-20 11:26:24 +01:00
1f390081c2 Cycles: Cleanup, spelling 2017-01-20 11:26:23 +01:00
d28035aff3 Cycles: Cleanup, avoid shadowing 2017-01-20 11:26:23 +01:00
618177640f Cycles: Fix wrong transparent shadows for motion blur hair
This was a missing bit from b53ce9a.
2017-01-20 11:26:23 +01:00
3f3463700e Cycles: Cleanup, style 2017-01-20 11:26:23 +01:00
3b454eb92c Cycles: Simplify some code in Curve BVH reference fill
makes code slightly shorter and uses idea of const qualifiers.
2017-01-20 11:26:23 +01:00
bd302ecf73 Cycles: Avoid shadowing in BVH code
Run into some nasty bugs while trying various things here.

Wouldn't mind enabling -Wshadow for Cycles actually..
2017-01-20 11:26:23 +01:00
a503e7626a Cycles: Allow up to 4 motion curve primitives per BVH node
This avoids intersection AABB of different curve primitives
which makes it less ray-to-primitive intersections.

This gives about 30% speedup of hair rendering in the barber
shop scenes here. There is still some work to be done on those
files to solve major speed issues on certain frames.
2017-01-20 11:26:22 +01:00
fb6a94170f Cycles: Prepare BVH traversal code to work with multiple curve primitives per node 2017-01-20 11:26:22 +01:00
0f5db226cf Cycles: Correct assert() for cases when there are multiple curves per BVH node 2017-01-20 11:26:22 +01:00
a1f0e53498 Cycles: Use separate limit for motion primitives for BVH node limits
This way we can have different limits for regular and motion curves
which we'll do in one of the upcoming commits in order to gain some
percents of speedup.

The reasoning here is that motion curves are usually intersecting
lots of others bounding boxes, which makes it inefficient to have
single primitive in the leaf node.
2017-01-20 11:26:22 +01:00
d3e6fe0506 Cycles: Change confusing logic of max leaf size check
Maximal number of elements is supposed to be inclusive. That is what
it was always meant in this file and what @brecht considered still
the case in 6974b69c61.

In fact, the commit message to that change mentions that we allowed
up to 2 curve primitives per leaf while in fact it was doing up to 1
curve primitive.

Making it real 2 primitives at a max gives about 5% slowdown for the
koro.blend scene. This is a reason why BVHParams.max_curve_leaf_size
was changed to 1 by this change.
2017-01-20 11:26:22 +01:00
fa1988a34f Cycles: Cleanup, space prior to semicolon
We don't have that in Blender style, no reason to violate it here.
2017-01-20 11:26:22 +01:00
e92e265559 Cycles: Cleanup, make curve functions private
Not only they don't really follow naming convention (we don't use
camel case) but also was not necessary to keep them in the global
symbol table.
2017-01-20 11:26:21 +01:00
10cef4e86f Cycles: Make it more clear message why curve motion attribute was removed 2017-01-20 11:26:21 +01:00
086390dce7 Cycles: Use dedicated debug passes for traversed nodes and intersection tests
This way it's more clear whether some issue is caused by lots of geometry in
the node or by lots of "transparent" BVH nodes.
2017-01-20 11:26:21 +01:00
e15639f1cd Cycles: Remove more duplicated code in debug passes logic 2017-01-20 11:26:21 +01:00
41ed782350 Cycles: Fix wrong scaling of traversed instances debug pass 2017-01-20 11:26:21 +01:00
3cb1398899 Cycles: Cleanup, remove duplicated code 2017-01-20 11:26:20 +01:00
0fdb16ec4d Cycles: Cleanup, indentation within preprocessor 2017-01-20 11:26:20 +01:00
e9e1c95e64 Cycles: Cleanup, use switch() instead of if-else chain
About to add extra debug passes, which will be more clear to use switch().
2017-01-20 11:26:20 +01:00
39bc6172a4 Cycles: move hair particle settings to scene context
Since the beginning of times hair settings in cycles were global for
the whole scene but were located in the particle context. This causes
quite some trickery to get shots set up for the movies here in the
studio by forcing artists to create dummy particle system to change
settings of hair on the shot.

While ideally this settings should be properly become per-particle
system for the time being it will save sweat and blood to move the
settings to scene context.

Reviewers: brecht

Subscribers: jtheninja, eyecandy, venomgfx, Blendify

Differential Revision: https://developer.blender.org/D2287
2017-01-20 11:26:20 +01:00
8e372da1b5 Cycles: Fix wrong motion blur when combining deformation motion blur with autosplit
The issue was that we used to compare number of vertices for mesh after the auto
smooth was applied (at the center of the shutter time) with number of vertices
prior to the auto smooth applied. This caused false-positive consideration of a
mesh as changing topology.

Now we do autosplit as early as possible and do it from blender side, so Cycles
does not need to re-implement splitting on it's side.
2017-01-20 11:26:20 +01:00
aeece53491 Cycles: Pass explicit subdivision type to object_to_mesh
This allows us to do some extra logic checks there based on particular
subdivision type.

Additionally avoids implicit cast of enum to bool.
2017-01-20 11:26:20 +01:00
f0d866d143 Cycles: Cleanup, whitespace around operator 2017-01-20 11:26:20 +01:00
fa73db47e8 Cycles: Improve logging of cases when motion blur is disabled
Next logical step is to expose this somehow to the interface.
2017-01-20 11:26:19 +01:00
f071e48dcf Cycles: Fix uninitialized variable issue after recent changes 2017-01-20 11:26:19 +01:00
d8a8f69c98 Cycles: Move object culling helper to own files
This is a stand-alone logic, which becomes quite comprehensive now.
2017-01-20 11:26:19 +01:00
893aa1cae3 Cycles: Fix indendation 2017-01-20 11:26:19 +01:00
166b6c9240 Cycles: Consider GGX/Beckmann/Ashikhmin of 0 roughness a singular ray
This matches behavior of Multiscatter GGX and could become handy later on
when/if we decide it would be beneficial to replace on closure with another.

Reviewers: lukasstockner97, brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2413
2017-01-20 11:26:19 +01:00
14e7ac956f Cycles: Tweak curve segment (un)pack to handle more curve segments
There was 16 bits reserved for primitive type, while we only need 4.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2401
2017-01-20 11:26:18 +01:00
5030854a66 Cycles: Cleanup, variable names
Use underscore again and also solve confusing part then in BVH smae
thing is called prim_addr but in intersection funcitons it was called
triAddr.
2017-01-20 11:26:18 +01:00
b8fc22fde1 Cycles: Cleanup, variables names
Use underscore instead of camel case.
2017-01-20 11:26:18 +01:00
5edef96d77 Land D2339 by bliblu bli 2017-01-20 11:26:18 +01:00
d546f66efc Fix emissive volumes generates unexpected fireflies around intersections
Discard the whole volume stack on the last bounce (but keep
world volume if present).

Volumes are expected to be closed manifol meshes, meaning if
ray entered the volume there should be an intersection event
of ray exisintg the volume. Case when ray hit nothing and
there are still non-world volumes in the stack can happen in
either of cases.

1. Mesh is not closed manifold.

Such configurations are not really supported anyway and should
not be used.

Previous code would have consider the infinite length of the
ray to sample across, so render result wasn't really correct
anyway.

2. Exit intersection is more far away than the camera far
   clip distance.

This case also will behave differently now, but previously it
wasn't really correct either, so it's not like we're breaking
something which was working as expected.

3. We missed exit event due to intersection precision issues.

This is exact the case which this patch fixes and avoid
fireflies.

4. Volume has Camera only visibility (all the rest visibility
is set to off)

This is what could be considered a regression but could be
solved quite easily by checking volume stack's objects flags
and keep entries which doesn't have Volume Scatter visibility
(or even better: ensure Volume Scatter visibility for objects
with volume closure),

Fixes T46108: Cycles - Overlapping emissive volumes generates unexpected bright hotspots around the intersection
Also fixes fireflies appearing on the edges of cube with
emissive volue.

Reviewers: juicyfruit, brecht

Reviewed By: brecht

Maniphest Tasks: T46108

Differential Revision: https://developer.blender.org/D2212
2017-01-20 11:26:18 +01:00
e4b67e7e5e Cycles :Cleanup, indentation 2017-01-20 11:26:18 +01:00
dd156f743c Cycles: Refactor Progress system to provide better estimates
The Progress system in Cycles had two limitations so far:
 - It just counted tiles, but ignored their size. For example, when rendering a 600x500 image with 512x512 tiles, the right 88x500 tile would count for 50% of the progress, although it only covers 15% of the image.
 - Scene update time was incorrectly counted as rendering time - therefore, the remaining time started very long and gradually decreased.

This patch fixes both problems:
First of all, the Progress now has a function to ignore time spans, and that is used to ignore scene update time.
The larger change is the tile size: Instead of counting samples per tile, so that the final value is num_samples*num_tiles, the code now counts every sample for every pixel, so that the final value is num_samples*num_pixels.

Along with that, some unused variables were removed from the Progress and Session classes.

Reviewers: brecht, sergey, #cycles

Subscribers: brecht, candreacchio, sergey

Differential Revision: https://developer.blender.org/D2214
2017-01-20 11:26:17 +01:00
f2677a58a5 Cycles: Implement AVX2 path for curve intersection functions
Gives little performance improvement on Linux and gives up to 2%
speedup on koro.blend on Windows.

Inspired by Maxym Dmytrychenko, thanks!
2017-01-20 11:26:17 +01:00
7e5af7aefd Cycles: Add AVX intrinsics helpers
They are defined for MSVC but seems to be missing in GCC and CLang-3.8.

Maybe some further tweaks to policy when to define those functions is
needed, but should be fine for now.
2017-01-20 11:26:17 +01:00
6df6f8c982 Cycles: Disable AVX2 crash workarounds
I can no longer reproduce crash with neither of the files where
the crash was originally visible. This is something where other
changes (light threshold, sampling) had an effect and made code
to work as it is supposed to. Could have been optimizator issue
or something like that.

Let's see if we hit same issue again.
2017-01-20 11:26:17 +01:00
a3ef4c1470 Fix T50116: Light threshold broke branched path tracer
In fact, the issue was caused by light threshold being too high for
certain scenes. Lowered it down to 0.01.
2017-01-20 11:26:17 +01:00
5aede15fea Cycles: Fix correlation issues in certain cases
There were two cases where correlation issues were obvious:

- File from T38710 was giving issues in 2.78a again
- File from T50116 was having totally different shadow between
  sample 1 and sample 32.

Use some more simplified version of CMJ hash which seems to give
nice randomized value which solves the correlation.

This commit will break all unit test files, but it's a bug fix
so perhaps OK to commit this.

This also fixes T41143: Sobol gives nonuniform noise

Proper science paper about hash function is coming.

Reviewers: brecht

Reviewed By: brecht

Subscribers: lukasstockner97

Differential Revision: https://developer.blender.org/D2385
2017-01-20 11:26:17 +01:00
5596f970be Fix T50075: Assert during debug render of hair_geom_transmission.blend 2017-01-20 11:26:16 +01:00
921e45d82b Cycles: Pass extra array size argument to builtin image pixels functions
This is a way to avoid possible memory corruption when render threads works
in parallel with UI thread.

Not guarantees complete safe, but makes things easier to check anyway.
2017-01-20 11:26:16 +01:00
d2affb1049 Fix T50104, Race condition in SVMShaderManager::device_update_shader 2017-01-20 11:26:16 +01:00
c3fd2b98ce Cycles: Avoid divisions by zero in volume sampling code
Was giving huge artifacts in the barber shop file here in the studio,

Maybe not fully optimal solution, but committing it for now to have
closer look later.
2017-01-20 11:26:16 +01:00
c61e68f289 Fix T50100: Cycles SeparateRGBNode Red socket defined wrong
Spotted by David (bocs), thanks!
2017-01-20 11:26:16 +01:00
b66d4f5eed Cycles: Fix strict compilation warnings 2017-01-20 11:26:16 +01:00
df6256a6ea Fix Cycles device backwards compatibility error if device type is unavailable. 2017-01-20 11:26:15 +01:00
ef28892654 Fix spelling in Cycles distance culling description. 2017-01-20 11:26:15 +01:00
1e57f6f957 Cycles: Fix strict compilation warnings
Should be no functional changes.
2017-01-20 11:26:15 +01:00
c1080ff73e Fix T50034: Blender changes processor affinity unauthorized 2017-01-20 11:26:15 +01:00
4ace7e1ebf Cycles: Fix re-definition of some functions on x32 arch 2017-01-20 11:26:15 +01:00
567c42bd22 Cycles: Another attempt to fix compilation on 32bit Linux 2017-01-20 11:26:15 +01:00
f4cd05082c Cycles: Attempt to fix 32bit buildbot builds after recent commit 2017-01-20 11:26:14 +01:00
4b7b9ded91 Cycles: Implement texture size limit simplify option
Main intention is to give some quick way to control scene's memory
usage by clamping textures which are too big. This is really handy
on the early production stages when you first create really nice
looking hi-res textures and only when it all works and approved
start investing time on optimizing your scene.

This is a new option in Scene Simplify panel and it acts as
following: when texture size is bigger than the given value it'll
be scaled down by half for until it fits into given limit.

There are various possible improvements, such as:

- Use threaded scaling using our own task manager.

  This is actually one of the main reasons why image resize is
  manually-implemented instead of using OIIO's resize. Other
  reason here is that API seems limited to construct 3D texture
  description easily.

- Vectorization of uchar4/float4/half4 textures.

- Use something smarter than box filter.

  Was playing with some other filters, but not sure they are
  really better: they kind of causes more fuzzy edges.

Even with such a TODOs in the code the option is already quite
useful.

Reviewers: brecht

Reviewed By: brecht

Subscribers: jtheninja, Blendify, gregzaal, venomgfx

Differential Revision: https://developer.blender.org/D2362
2017-01-20 11:26:14 +01:00
d77dcd5896 Cycles: Attempt to fix compilation error on ppc64el
There is some define conflict between system headers and clew,
so delay include of clew.h as much as possible.]

This is something which needed to be done in the code before
the refactor, hopefully such change will still work.
2017-01-20 11:26:14 +01:00
897261c01e Cycles: Don't shadow loop variable 2017-01-20 11:26:14 +01:00
0c4b812d2d Cycles: add basic backwards compatibility for device selection, move to System tab.
For the multi-GPU case users still have to reconfigure the devices they want to use.

Based on patch from Lukas Stockner.

Differential Revision: https://developer.blender.org/D2347
2017-01-20 11:26:14 +01:00
555e21d996 Cycles: refactor culling code into utility class. 2017-01-20 11:26:13 +01:00
59af4562dd Cycles: distance culling for objects.
This can be used together with camera culling to keep nearby objects visible in
reflections, using a minimum distance within which objects are visible. It is
also useful to cull small objects far from the camera.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2332
2017-01-20 11:26:13 +01:00
Dalai Felinto
a38a8497ef Cycles: Different noise seed for stereoscopic rendering (Fix #T50024)
Patch by Sergey Sharybin.
2017-01-20 11:26:13 +01:00
fcde51fd5d Fix T50001: auto tile size addon broken after Cycles GPU device changes.
Adds a get_num_gpu_devices() utility function for the addon to use.
2017-01-20 11:26:13 +01:00
bca4af7610 Cycles: Fix different noise pattern from fix in T49838:
No need to hash subframe == 0.
2017-01-20 11:26:13 +01:00
44e996745b Atomics: Make naming more obvious about which value is being returned 2017-01-20 11:26:11 +01:00
f24d420f16 Cycles: De-duplicate image loading functions
The code was templated already, so don't see big reason to have
3 versions of templated functions. It was giving some extra code
to maintain and in fact already had divergency for support of huge
image resolution (missing size_t cast in byte image loading).

There should be no changes visible by artists.
2017-01-20 11:25:53 +01:00
6832a18198 Fix T49904: Cycles standalone missing default generated texture coordinates. 2017-01-20 11:25:53 +01:00
feff2bfce4 Fix Cycles OSL compilation based on modified time not working. 2017-01-20 11:25:53 +01:00
a684d9375a Fix Cycles standalone not finding CPU device after recent changes. 2017-01-20 11:25:52 +01:00
78c855a370 Fix T49985: cycles standalone XML missing distant lights. 2017-01-20 11:25:52 +01:00
ff1b925ab3 Fix T49985: cycles standalone using wrong socket names for XML reading. 2017-01-20 11:25:52 +01:00
c40c888a52 Cycles: Add comments to endif directives
`kernel_path.h` and `kernel_path_branched.h` have a lot of conditional code and
it was kind of hard to tell what code belonged to which directive. Should be
easier to read now.
2017-01-20 11:25:52 +01:00
4b98b86654 Fix T49838: Noise randomization for frame should be done per interframes as well
Add subframe to the animated seed hash calculation.

Should be no difference for the regular files, only for cases when scene is
rendered from sequencer with a speed effect, which is not really a common thing.
2017-01-20 11:25:52 +01:00
0e9eeccf2e Cycles: Only use new light sample threshold for new files
This is a late follow-up commit to the light sample threshold changes which
caused difference in rendering all existing .blend files which is not something
we are happy about: it is fine to use new optimized defaults for new files, but
existing ones should always be rendering in the same way as they used to be.

Sorry for the inconveniece, but such thing should have been done to begin with.
If this setting was modified it will not be reset to zero.

Now all render tests should be passing again.

P.S. Also really annoying to bump subversion for such reasons, but currently we
don't have better way to achieve what we want.
2017-01-20 11:25:51 +01:00
f6926ea3f8 Fix compilation error when CUDA toolkit is not installed
After CUDA dynload changes having CUDA toolkit became required
in order to compile Cycles. This only happened due to wrong
default value to the option.
2017-01-20 11:25:29 +01:00
4a459704c0 Cycles: Remove device settings from performance tab
This was included in the commit by accident, it doesn't belong there.
2017-01-20 11:25:29 +01:00
f840239ee0 Cycles: Refactor Device selection to allow individual GPU compute device selection
Previously, it was only possible to choose a single GPU or all of that type (CUDA or OpenCL).
Now, a toggle button is displayed for every device.
These settings are tied to the PCI Bus ID of the devices, so they're consistent across hardware addition and removal (but not when swapping/moving cards).

From the code perspective, the more important change is that now, the compute device properties are stored in the Addon preferences of the Cycles addon, instead of directly in the User Preferences.
This allows for a cleaner implementation, removing the Cycles C API functions that were called by the RNA code to specify the enum items.

Note that this change is neither backwards- nor forwards-compatible, but since it's only a User Preference no existing files are broken.

Reviewers: #cycles, brecht

Reviewed By: #cycles, brecht

Subscribers: brecht, juicyfruit, mib2berlin, Blendify

Differential Revision: https://developer.blender.org/D2338
2017-01-20 11:25:29 +01:00
c89d8dd6cb Cycles: Fix T49952: Bad MIS sampling of backgrounds with single bright pixels
With this fix, using a MIS map resolution equal to the image size for closest imterpolation or twice the size for linear interpolation gets rid of all fireflies.
Previously, a much higher resolution was needed to get acceptable noise levels.
2017-01-20 11:25:29 +01:00
Martijn Berger
259d296918 cycles, cuDeviceComputeCapability is deprecated as of cuda 5.0 2017-01-20 11:25:28 +01:00
d812d54812 Cycles: Fix missing underscore in geom_object.h 2017-01-20 11:25:28 +01:00
73753072c2 Cycles: Fix OpenCL build error caused by light termination commit 2017-01-20 11:25:28 +01:00
e961684de5 Cycles: Fix T49901: OpenCL build error after recent light texture coordinate commit
Basically, the problem here was that the transform that's used to bring texture coordinates
to world space is either fetched while setting up the shader (with Object Motion is enabled) or
fetched when needed (otherwise). That helps to save ShaderData memory on OpenCL when Object Motion isn't needed.

Now, if OM is enabled, the Lamp transform can just be stored inside the ShaderData as well. The original commit just assumed it is.
However, when it's not (on OpenCL by default, for example), there is no easy way to fetch it when needed, since the ShaderData doesn't
store the Lamp index.

So, for now the lamps just don't support local texture coordinates anymore when Object Motion is disabled.
To fix and support this properly, one of the following could be done:
- Just always pre-fetch the transform. Downside: Memory Usage increases when not using OM on OpenCL
- Add a variable to ShaderData that stores the Lamp ID to allow fetching it when needed
- Store the Lamp ID inside prim or object. Problem: Cycles currently checks these for whether an object was hit - these checks would need to be changed.
- Enable OM whenever a Texture Coordinate's Normal output is used. Downside: Might not actually be needed.
2017-01-20 11:25:28 +01:00
Martijn Berger
74dc4ef556 Cycles standalone, compile fix UINT_MAX is not defined in device_cuda.cpp 2017-01-20 11:25:28 +01:00
8f8800bbbc Cycles: Deduplicate AO calculation
No functional changes.
2017-01-20 11:25:28 +01:00
927f84af07 Cycles: Fix OpenCL compilation with the new brick texture 2017-01-20 11:25:28 +01:00
44197cafaf Cycles: Style Fix: Light sampling threshold description 2017-01-20 11:25:28 +01:00
e5a86361af Cycles: Initialize the RNG state from the kernel instead of the host
This allows to save a memory copy, which will be particularly useful for network rendering.

Reviewers: sergey, brecht, dingto, juicyfruit, maiself

Differential Revision: https://developer.blender.org/D2323
2017-01-20 11:25:27 +01:00
feb4822346 Cycles: Add optional probabilistic termination of light samples based on their expected contribution
In scenes with many lights, some of them might have a very small contribution to some pixels, but the shadow rays are traced anyways.
To avoid that, this patch adds probabilistic termination to light samples - if the contribution before checking for shadowing is below a user-defined threshold, the sample will be discarded with probability (1 - (contribution / threshold)) and otherwise kept, but weighted more to remain unbiased.
This is the same approach that's also used in path termination based on length.

Note that the rendering remains unbiased with this option, it just adds a bit of noise - but if the setting is used moderately, the speedup gained easily outweighs the additional noise.

Reviewers: #cycles

Subscribers: sergey, brecht

Differential Revision: https://developer.blender.org/D2217
2017-01-20 11:25:27 +01:00
199d7dc70d Cycles: Add smoothing option to the Brick Texture
This option allows to create a smoother transition between Bricks and Mortar - 0 applies no smoothing, and 1 smooths across the whole mortar width.
Mainly useful for displacement textures.

The new default value for the smoothing option is 0.1 to give some smoothing that helps with antialiasing, but existing nodes are loaded with smoothing 0 to preserve compatibility.

Reviewers: sergey, dingto, juicyfruit, brecht

Reviewed By: brecht

Subscribers: Blendify, nutel

Differential Revision: https://developer.blender.org/D2230
2017-01-20 11:25:27 +01:00
e9211860b9 Fix T49846: OpenCL rendering compilation failure 2017-01-20 11:25:27 +01:00
5306621998 Cycles: Implement texture coordinates for Point, Spot and Area Lamps
When using the Normal output of the Texture Coordinate node on Point and Spot lamps, the coordinates now depend on the rotation of the lamp.
On Area lamps, the Parametric output of the Geometry node now returns UV coordinates on the area lamp.

Credit for the Area lamp part goes to Stefan Werner (from D1995).
2017-01-20 11:25:27 +01:00
468022403a Cycles: More workarounds for weird crashes on AVX2
Oh man, is it a compiler bug? Is it something we do stupid?

For now more crap to prevent crashes. During the conference will talk to
Maxyn about how can we troubleshoot such weird issues.
2017-01-20 11:25:27 +01:00
2768e623a9 Cycles: Another attempt to fix crashes on AVX2 processors
Basically don't use rcp() in areas which seems to be critical after
second look. Also disabled some multiplication operators, not sure
yet why they might be a problem.

Tomorrow will be setting up a full test with all cases which were
buggy in our farm to see if this fix is complete.
2017-01-20 11:25:26 +01:00
2b87d3b6cc Cycles: Fix compilation error of AVX2 kernel without SSE math 2017-01-20 11:25:26 +01:00
d00172217b Cycles: Completely disable transform SSE for now
Was causing issues on another frame.

On a tight schedule, disabling for now so artists are happy.

Still looking into root of the issue!
2017-01-20 11:25:26 +01:00
d6e01042b9 Cycles: Fix crashes after recent optimization commits
There is some precision issues for big magnitude coordinates which started
to give weird behavior of release builds. Some weird memory usage in BVH
which is tricky to nail down because only happens in release builds and GDB
reports all variables as optimized out when trying to use RelWithDebInfo.

There are two things in this commit:

- Attempt to make vectorized code closer to original one, hoping that it'll
  eliminate precision issue.
  This seems to work for transform_point().
- Similar trick did not work for transform_direction() even tho absolute
  error here is much smaller. For now disabled that function, need a more
  careful look here.
2017-01-20 11:25:26 +01:00
2956203221 Cycles: Fix for fix (tm)
Sorry guys, for some reason read the expression back-to-front
and did wrong fix :S
2017-01-20 11:25:26 +01:00
c1d25de806 Cycles: Fix typo in previous commit for BVH improvements 2017-01-20 11:25:26 +01:00
98bdc56e4e Cycles: Enable SSE math optimization for AVX kernels
This gives about 5% speedup for AVX processors.

Benefit of such optimization on other microarchitectures is still
under investigation.
2017-01-20 11:25:25 +01:00
cdf556d974 Cycles: Use new SSE version of offset calculation for all QBVH flavors
Gives up to ~1% speedup again.

While it seems to be small, still nice since the code now is actually more
clean that it used to be before.
2017-01-20 11:25:25 +01:00
8ea5cbd89b Cycles: Move QBVH near/far offset calculation to an utility function
Just preparing for new optimization to be used in all traversal implementation.

Should be no measurable difference.
2017-01-20 11:25:25 +01:00
612604f23a Cycles: BVH-related SSE optimization
Several ideas here:

- Optimize calculation of near_{x,y,z} in a way that does not require
  3 if() statements per update, which avoids negative effect of wrong
  branch prediction.

- Optimization of direction clamping for BVH.

- Optimization of point/direction transform.

Brings ~1.5% speedup again depending on a scene (unfortunately, this
speedup can't be sum across all previous commits because speedup of
each of the changes varies from scene to scene, but it still seems to
be nice solid speedup of few percent on Linux and bigger speedup was
reported on Windows).

Once again ,thanks Maxym for inspiration!

Still TODO: We have multiple places where we need to calculate near
x,y,z indices in BVH, for now it's only done for main BVH traversal.
Will try to move this calculation to an utility function and see if
that can be easily re-used across all the BVH flavors.
2017-01-20 11:25:25 +01:00
4db44cee9f Cycles: Avoid branching in SSE version of intersection pre-calculation
Similar to the previous commit, avoid negative effect of bad branch prediction.

Gives measurable performance up to ~2% in tests here.

Once again, thanks to Maxym Dmytrychenko!
2017-01-20 11:25:25 +01:00
c5f4837603 Cycles: Implement SSE-optimized path of util_max_axis()
The idea here is to avoid if statements which could cause wrong
branch prediction.

Gives a bit of measurable speedup up to ~1%. Still nice :)

Inspired by Maxym Dmytrychenko, thanks!
2017-01-20 11:25:25 +01:00
10e583533b Cycles: Add AVX2 path to subsurface triangle intersection
Similar to regular triangle intersection case. Gives about 3% speedup rendering
SSS object on my desktop,

Question: how to avoid such a code duplication in a nice way without speed loss?
2017-01-20 11:25:24 +01:00
3a142ec55a Cycles: Cleanup, style 2017-01-20 11:25:23 +01:00
Hristo Gueorguiev
e2dd5f15d9 Cycles: OpenCL 3d textures support.
Note that volume rendering is not supported yet, this is a step towards that.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2299
2017-01-20 11:25:03 +01:00
7bddb79f49 Cycles: Fix another OpenCL logging issue
Previously an error message would be printed whenever the OpenCL build produced output.
However, some frameworks seem to print extra information even if the build succeeded, so now the actual returned error is checked as well.
When --debug-cycles is activated, the build output will always be printed, otherwise it only gets printed if there was an error.
2017-01-20 11:25:03 +01:00
3778475c61 Fix T49630: Cycles: Swapped shader and bake kernels
The problem here was, as the title says, that the two kernels were swapped.
Since shader evaluation is only used for building the samling map when World MIS is enabled, rendering without it would still work fine, although baking also was broken.
2017-01-20 11:25:03 +01:00
edac0e7b17 Cycles: Improve OpenCL kernel compilation logging
The previous refactor changed the code to use a separate logging mechanism to support multithreaded compilation.
However, since that's not supported by any frameworks yes, it just resulted in bad logging behaviour.
So, this commit changes the logging to go diectly to stdout/stderr once again by default.
2017-01-20 11:25:03 +01:00
290e37dce1 Cycles: Disable optimization of operator / for float3
This was giving some speedup but made intersection tests to fail
from watertight point of view.

Needs deeper investigation, but need to quickly get it fixed for
the studio.
2017-01-20 11:25:03 +01:00
f9b0c10d04 Fix build error with WITH_CYCLES_NATIVE_ONLY and recent AVX2 changes. 2017-01-20 11:25:03 +01:00
87ca259433 Cycles: Use const reference for register variables in non-OpenCL code
This is something tested by @LazyDodo and suggested by Maxym to make
MSVC happier.
2017-01-20 11:25:03 +01:00
73bae90620 Cycles: Use more SSE intrinsics for float3 type
This gives about 5% speedup on AVX2 kernels (other kernels still
have SSE disabled for math operations) and this solves the slowdown
of koro scene mention in the previous commit.

The title says it all actually. This commit also contains
changes to pass float3 as const reference in affected functions.

This should make MSVC happier without breaking OpenCL because it's
only done in areas which are ifdef-ed for non-OpenCL.

Another patch based on inspiration from Maxym Dmytrychenko, thanks!
2017-01-20 11:25:02 +01:00
c01d7c8a8f Cycles: Implement AVX2 version of triangle_intersect
This commit basically vectorizes existing code using AVX2 instructions
(without modifying algorithm itself). This gives quite nice speedups:

  BMW:        -8%
  Classroom:  -5%
  Cat:        -5%
  Koro:       +1%
  Barcelona:  -8%

That's on Linux machine, reported performance improvement on Windows
goes up to 20%.

Not currently sure why Koro is somewhat slower because it mainly uses
curve intersection tests, could be a time noise? Or osmething with the
cache utilization perhaps? In any case speedup in other scenes makes
me thinking that current state is acceptable for initial implementation.

This is again inspired by Maxym Dmytrychenko.
2017-01-20 11:25:02 +01:00
804d4719c6 Cycles: Add new avxf vectorized data type
Based on existing ssef data type and to my knowledge it's also what happens in
Embree nowadays.

Inspired by Maxym Dmytrychenko and required for the upcoming triangle
intersection commit.

Hopefully the copyright message is correct.
2017-01-20 11:25:02 +01:00
19203b42ed Cycles: Enable SSE options of math module for AVX2 kernels
Currently this does not give measurable difference, but is required
ground work for some upcoming further optimization of AVX2 kernels.
2017-01-20 11:25:02 +01:00
dff65a0e6f Cycles: Cleanup, style 2017-01-20 11:25:02 +01:00
3d7eb44707 Cycles: Split device_opencl.cpp into multiple files for easier maintenance
There are no user-visible changes, just some internal restructuring.

Differential Revision: https://developer.blender.org/D2231
2017-01-20 11:25:02 +01:00
acd02c7848 [Windows/Cycles/Clang] Fix compilation error with clang-cl on windows 2017-01-20 11:25:02 +01:00
2482bb1d72 Cycles: implement partial constant folding for exponentiation.
This is also an important mathematical operation that can be folded
if it is known that one argument is a certain constant. For colors
the operation is provided as a Gamma node.

The SVM Gamma node needs a small fix to make it follow the 0 ^ 0 == 1
rule, same as the Power node, or the Gamma node itself in OSL mode.

Reviewers: #cycles

Differential Revision: https://developer.blender.org/D2263
2017-01-20 11:25:01 +01:00
7ef3dfef6e Cycles: Cleanup, indentation 2017-01-20 11:25:01 +01:00
e716f10ba9 Cycles: Use correct light sampling PDF for MIS calculation with Branched Path Tracing
The light sampling functions calculate light sampling PDF for the case that the light has been randomly selected out of all lights.
However, since BPT handles lamps and meshlights separately, this isn't the case. So, to avoid a wrong result, the code just included the 0.5 factor in the throughput.

In theory, however, the correction should be made to the sampling probability, which needs to be doubled. Now, for the regular calculation, that's no real difference since the throughput is divided by the pdf.
However, it does matter for the MIS calculation - it's unbiased both ways, but including the factor in the PDF instead of the throughput should give slightly better results.

Reviewers: sergey, brecht, dingto, juicyfruit

Differential Revision: https://developer.blender.org/D2258
2017-01-20 11:25:01 +01:00
e04cc46b83 Cycles: Cleanup, whitespace 2017-01-20 11:25:01 +01:00
35346dc8e7 Cycles: Make code more uniform across two versions of shadow_blocked()
Just to make it easier to research ways of possible code de-duplication.
2017-01-20 11:25:01 +01:00
3f4bac1fe1 Cycles: Remove out of date comment 2017-01-20 11:25:01 +01:00
a27dd4bf85 Cycles: Make regular bvh traversal functions close to each other 2017-01-20 11:25:00 +01:00
2f2849fca8 Cycles: Re-group ifdef so we check for particular feature only once 2017-01-20 11:25:00 +01:00
1b9ea14782 Cycles: Avoid conversion from bool to uint 2017-01-20 11:25:00 +01:00
518f88efaa Cycles: Cleanup code style in split kernel 2017-01-20 11:25:00 +01:00
3cc7567607 Cycles: More tweaks to make specialized BVH traversal matching 2017-01-20 11:25:00 +01:00
a9b92fc29b Cycles: Avoid redundant intersection pre-calculation 2017-01-20 11:25:00 +01:00
c526932b31 Cycles: Cleanup, sync some comments across different traversal 2017-01-20 11:24:59 +01:00
85225c56b5 Cycles: Cleanup, always use parenthesis
Makes it simpler to compare different traversal algorithms.
2017-01-20 11:24:59 +01:00
92e70d7d8f Revert "Cycles: Tweak empty boundbox children"
This reverts commit ecbfa31caa.

Original commit broke logic in nodes re-fitting. That area can
access non-existing children momentarely. Not sure what would
be best solution here, for now simply reverting the change/
2017-01-20 11:24:59 +01:00
9c15fad5c5 Cycles: Deduplicate light pass code 2017-01-20 11:24:59 +01:00
9f4fe1df8d Cycles: Stop lamp sampling if the lamp isn't visible
Both spot and area light have large areas where they're not visible.
Therefore, this patch stops the light sampling code when one of these cases (outside of the spotlight cone or behind the area light) occurs, before the lamp shader is evaluated.
In the case of the area light, the solid angle sampling can also be skipped.

In a test scene with Sample All Lights and 18 Area lamps and 9 Spot lamps that all point away from the area that the camera sees, render time drops from 12sec to 5sec.

Reviewers: brecht, sergey, dingto, juicyfruit

Differential Revision: https://developer.blender.org/D2216
2017-01-20 11:24:59 +01:00
f1fe4eb3d1 Cycles: Also support the constant emission speedup for mesh lights
Reviewers: brecht, sergey, dingto, juicyfruit

Differential Revision: https://developer.blender.org/D2220
2017-01-20 11:24:59 +01:00
da234142b8 Cycles: Implement threaded SVM nodes compilation
The title says it all actually. From tests with barber shop scene here
gives 2-3x speedup for shader compilation on my oldie i7 machine. The
gain is mainly due to textures metadata query from jpeg files (which
seems to requite de-compression before metadata can be read). But in
theory could give nice improvements for scenes with huge node trees
as well (i'm talking about node trees of complexity of fractal which
we had reports about in the past).

Reviewers: juicyfruit, dingto, lukasstockner97, brecht

Reviewed By: brecht

Subscribers: monio, Blendify

Differential Revision: https://developer.blender.org/D2215
2017-01-20 11:24:58 +01:00
78b472bfa9 Cycles: Tweak empty boundbox children
The idea here is to make assert failure to fail sooner on an incorrect
node address rather than later with stack overflow.
2017-01-20 11:24:58 +01:00
a1c8b3e886 Cycles: Fix compilation error after recent commits 2017-01-20 11:24:58 +01:00
ad0d00e551 Cycles: Use XDG's .cache folder for cached kernels
Basically just moves cached kernels from ~/.config/blender/BLENDER_VERSION to
~/.cache/cycles/kernels. This has following benefits:

- Follows XDG specification more closely,
  not as if it's totally crucial or measurable by users, but still nice.

- Prevents unexpected sizes of config folder, makes disk space used in more
  predictable for users way.

- Allows to share kernels across multiple Blender versions,
  which makes it easier debugging at the times close to release.

- "Copy Previous Settings" operator will no longer be copying possibly
  gigabytes of cached kernels, which used to lead to really nast disk usage
  and annoying delays of copying settings.

- In the future we can have some smart logic to clear old unused cached
  kernels.

Currently only done for Linux and OSX. Windows still follows old "cache"
folder logic, but it's not really important for now because we don't
support kernel compilation on this platform yet.

Reviewers: dingto, juicyfruit, brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2197
2017-01-20 11:24:58 +01:00
c9adc55801 Cycles: Add overall timing log to SVNShaderManager 2017-01-20 11:24:58 +01:00
6ba920dec1 Cycles: Deduplicate QBVH node packing across BVH build and refit 2017-01-20 11:24:58 +01:00
e439892b14 Cycles: Don't run full shader evaluation for constant emission lamps
Most of the time, Lamps in Cycles are just a constant emission closure, no texturing etc. Therefore, running a full shader evaluation is wasteful.
To avoid that, Cycles now detects these constant emission shaders and stores their value in the lamp data along with a flag in the shader.
Then, at runtime, if this flag is set, the lamp code just uses this value and only runs the full shader evaluation if it is neccessary.

In scenes with a lot of lamps and with "Sample all direct/indirect" enabled, this saves up to 20% of rendering time in my tests.

Reviewers: #cycles

Differential Revision: https://developer.blender.org/D2193
2017-01-20 11:24:57 +01:00
c9dd9fceaa Cycles: Revert cleanup commit, will make it easier to cherry-pick 2017-01-20 11:02:20 +01:00
d159161155 retain existing creases, added inner crease and interpolate edge data with carve now 2017-01-08 14:31:01 +01:00
0bc63068ce crash fix for particle grid emission, do not allow to re-distribute particles there... 2017-01-05 01:39:28 +01:00
32e56f5d55 fix when using inner vertexgroup, weights of other vgroups on the same mesh were deleted by accident then 2017-01-03 00:12:18 +01:00
039be9e3c9 fracture modifier RNA refactor, outsourced FM RNA code and python API code to separate files 2016-12-31 00:33:57 +01:00
cde4150d7b fix for crash with physical rough edges (via addon)
caused by not checking whether objects in rigidbody group are rigidbodies, actually.
2016-12-30 17:10:25 +01:00
cbdb75682d let weights fade out at breaking locations with dynamic fracture 2016-12-23 20:25:00 +01:00
809d1aa1e0 transfer all speeds with dynamic fracture now, not only those above the sleep threshold 2016-12-23 20:24:08 +01:00
4916e0b79b particles, only suppress unborn particles when density vgroup is empty / has zero weight 2016-12-23 20:23:28 +01:00
f16d7f481f fix for external FM mode, take object locations into account as centroids for physics shapes, too 2016-12-22 03:05:34 +01:00
420ea4423e particle system: allow changing vgroups over time, suppress emission on empty assigned density vgroups 2016-12-22 00:31:42 +01:00
229688fee1 fix attempt for avoiding unintentional dissolve of all constraints in dynamic fracture 2016-12-22 00:25:24 +01:00
90d644fca4 fix : inner vertexgroups created with fractal boolean now too 2016-12-22 00:24:32 +01:00
751d2354c2 crash fix with FM and forcefields 2016-12-19 22:34:49 +01:00
41ae74df12 added some random rotation for fast bisect, to reduce parallel cuts 2016-12-16 00:48:30 +01:00
025aae4413 support for keeping edge data in fracture modifier (like sharp edges) 2016-12-16 00:15:12 +01:00
a5047171b9 inter-objects constraint objects can now determine which shards (closest) will be connected to the other object 2016-12-15 18:34:50 +01:00
ae9d247ea5 small fix for compounds, new collision suppression is disabled for them now
it caused wrong behavior - one shard always fell off unintendedly.
2016-12-15 00:30:40 +01:00
e5fc4218c7 fix for constraint loop detection (meshislands indirectly connected by a loop should get the same constraint index now) 2016-12-14 01:40:05 +01:00
2984406082 limit the collision check to objects which are actually constrained (whether disabled or not)
additionally take value of "disable collisions flag" into account, omit check if constrainted objects shall collide
2016-12-14 00:27:47 +01:00
f39585c387 hrm forgot something in last commit 2016-12-13 23:49:04 +01:00
a0d52d8e02 further attempt to suppress "unnecessary" collisions when constraints are intact 2016-12-13 23:46:12 +01:00
be4bd5ee69 optimization attempt to suppress collisions among partially constrained objects 2016-12-13 17:10:10 +01:00
d74d156c96 fix for rotational and splinter (with splitshards) issues in dynamic fracture 2016-12-13 11:25:11 +01:00
ef78283dd3 fix attempt for getting better fractal details, using bbox center and a smaller fractal plane now 2016-12-12 22:11:27 +01:00
c01dc55212 crash fix for having less shards than connections in connected fractured objects 2016-12-12 22:08:52 +01:00
3d7b6b6b34 crash fix attempt for connected fm objects 2016-12-12 20:43:36 +01:00
30fc776a68 improvements for inter-object constraints and fix for dissolve constraint when not kinematic (needs to be triggered still) 2016-12-12 14:24:04 +01:00
88fc1dd846 first attempt of inter-object constraints with fracture modifier, via regular constraint / connect operator 2016-12-12 00:26:25 +01:00
0749338492 added new trigger settings: propagate trigger, dynamic trigger and constraint dissolve
propagate trigger allows to propagate impulses across different FM objects, dynamic trigger can start a dynamic fracture independent from force, and constraint dissolve means that all constraints of activated shards will be disabled immediately
2016-12-11 19:44:01 +01:00
10d2c861dd fix for constraint calculation, transform of meshisland centroid was calculated incorrectly 2016-12-07 22:53:59 +01:00
069be54c87 speed optimization for fractal boolean, about 10x (note, Inner UV might not work with fractal still)
before there was a regression, 10 shards with default settings ~ 7 secs, now 100 in same time (left uv boxpacking out)
2016-12-06 23:30:18 +01:00
da2e66e106 small typo fix for mousebased fracture, used wrong index variable name 2016-12-01 23:50:58 +01:00
4777b17ec5 fix for physics visualization in FM, strings for constraint identifiers were not displayed properly under windows 2016-12-01 11:32:02 +01:00
2b25fe3e1c fix for possibly different object / shard order after loading a baked simulation 2016-11-28 22:45:49 +01:00
77599a6be0 fix for crash of loading files with split shards or island detection in fracture 2016-11-28 00:52:46 +01:00
1eabe30d34 stability fix for dynamic fractal, use triangulated cutter planes now and ensure they go through the shard's centroid 2016-11-26 11:47:10 +01:00
672c7d72c2 fixes / cleanup after static analysis of code which showed some potential issues 2016-11-25 21:00:33 +01:00
5148fd7f14 typo fix 2016-11-25 19:04:08 +01:00
8dfff7d339 partial crash fix for dynamic fractal fracture, can still crash in carve and bullet (todo) 2016-11-25 18:19:27 +01:00
509ffe1002 fix for missing omp condition evaluation (should work for boolean now only, because it causes errors with other algorithms) 2016-11-24 19:42:47 +01:00
b472f86804 bugfix / performance fix and new option "constrained collison"
bugfix: switching from kinematic to simulated should work now, performance improvements with dynamic fracture,
new option just exposes the disable collision flag to FM (works inverted here, enable it to let constrained objects collide, disable for default behavior)
2016-11-20 16:35:24 +01:00
ed840c8efb fix, let the FM shards respond to animated gravity in scene 2016-11-07 21:26:59 +01:00
f5da9bc306 corrected centroid calculation by using exact center of mass centroid 2016-11-07 18:10:57 +01:00
d7651d65de fix for crash when appending node groups if Fracture Modifier is active and frame > 1 2016-11-02 20:40:31 +01:00
2d1c068048 argh, missed some default setting for FM for grease pencil edge mode, before this fix no fracture at all was performed, and added bmesh tool flag for grease pencil fracture, too 2016-11-02 19:44:14 +01:00
b674ffb6da Merge remote-tracking branch 'refs/remotes/origin/blender-v2.78-release' into fracture_modifier
Conflicts:
	source/blender/makesrna/intern/rna_modifier.c
2016-10-26 19:30:29 +02:00
e8299c8100 Cycles: Don't use guarded vector for statically initialized data
This will confuse hell of a guarded allocators because it is possible
to have allocation happened prior to Blender's guarded allocator is
fully initialized.

This was causing crashes and assert failures when running blender
with fully guarded memory allocator.
2016-10-24 14:20:27 +02:00
21bf863934 Cycles: Fix shadowing variable which also causes use of uninitialized variable
Was causing wrong aperture for panorama cameras.

Seems to be a regression in 371d357.
2016-10-24 14:05:55 +02:00
0b734f0b59 Fix: Grease Pencil palettes were missing a RNA path callback 2016-10-24 13:51:57 +02:00
759b5fb2a6 Fix Cycles address space OpenCL error after recent fix. 2016-10-24 13:46:45 +02:00
f0adb875cf Cycles: Fix static initialization order fiasco
Initialization order of global stats and node types was not strictly
defined and it was possible to have node types initialized first and
stats after that. This will zero out memory which was allocated from
the statistics causing assert failure when de-initializing node types.
2016-10-24 13:43:55 +02:00
f55221e0a1 Cycles: Fix uninitialized variable from the previous commit 2016-10-24 12:55:05 +02:00
59689bed7b Blender 2.78: Point submodules to a new hash 2016-10-24 12:40:14 +02:00
20e54c99d2 Cycles: Remove explicit std:: from types where possible
We have our own abstraction level on top of the STL's implementation.
This commit will guarantee our tweaks are used for all cases.
2016-10-24 12:39:15 +02:00
faaf033d36 Blender 2.78: Port style cleanup from Cycles
Kinda nice to have official release code to be really clean.
2016-10-24 12:38:33 +02:00
66ed7d7566 Fix T49818: Crash when rendering with motion blur
It was possible to have non-initialized unaligned BVH split
to be used when regular BVH split SAH was inf. Now we ensure
that unaligned splitter is only used when it's really initialized.

It's a regression and should be in 2.78a.
2016-10-24 12:34:02 +02:00
a80104fb31 Cycles: Cleanup, spaces 2016-10-24 12:34:02 +02:00
452d43b1c8 Fix T49827L Crash linking material while in Material viewport shading mode
Material linking might and does change the way how drawObject is calculated
but does not tag drawObject for recalculation in any way.

Now use dependency graph to tag draw object for reclaculation. Currently do
this using OB_RECALC_DATA taq since tagging is not very granular yet. In the
future we can introduce ore granular tagging in the new dependency graph
easily.

Simple and safe for 2.78a.
2016-10-24 12:34:02 +02:00
602b2dbd8c Fix mistake in BKE_mesh_new_from_object handling of materials in MetaBall case.
Typo, spoted by Coverity scan.

To be backported to 2.78a.
2016-10-24 12:34:01 +02:00
4c94e327a2 Fix T49750: Cycles wrong ray differentials for perspective and stereo cameras. 2016-10-24 12:34:01 +02:00
7b311c07ee Fix T49656: Crash when starting playback while using JACK audio with A/V sync
When ED_screen_animation_play is called from wm_event_do_handlers,ScrArea *sa = CTX_wm_area(C); is NULL in ED_screen_animation_timer.
Informing the audio system in CTX_data_main_set, that a new Main has been set.
2016-10-24 12:34:01 +02:00
1bcddea00e Fix T49764: Audio strips crackle when animating the volume
- Implemented linear interpolation for volume changes in the software
mixer.
- Using this in the software device.
2016-10-24 12:34:01 +02:00
e1cf002ee6 Fix T49789: Compositor mix node interpolation bug 2016-10-24 12:34:01 +02:00
dac53963a8 Fix T49797: Exception from scene update handler might leak external engine descriptors
This was causing memory leaks in Cycles.

Some more detailed information in the comment in the code.

Seems to be safe and nice enough for 2.78a.
2016-10-24 12:34:01 +02:00
53cbda0f7f Fix T49793 : Fix enabling SSE2 globally for msvc.
When feeding msvc both /arch:sse2 and /arch:sse it's not smart enough to pick the best option, just goes with the last option
2016-10-24 12:34:01 +02:00
Scott Wu
cb44a3e5d7 Cycles: use near clipping distance in panorama camera.
Reviewed By: sergey, brecht, dfelinto

Differential Revision: https://developer.blender.org/D1952
2016-10-24 12:34:01 +02:00
07c886e976 Blender 2.78a release: Use proper "a' on the splash 2016-10-19 16:56:44 +02:00
2e77ad7f99 Blender 2.78a release: Update addons submodule hash 2016-10-19 15:16:04 +02:00
3da4560143 Fix T49775: Appending data with internal dependency cycles prevents correct clearing of linked data-blocks.
This is not a simple fix, but imho still needs to be backported to 2.78a...
2016-10-19 14:53:52 +02:00
4d043db0db [windows] Create A Blender Desktop Shortcut in the msi installer , fixes T49522 2016-10-19 14:27:30 +02:00
44372d6441 Fix T49722: Appending Bug (Groups).
One day we'll have to reconsider why some many 'real' ID usages are not
refcounting... :(

To be backported to 2.78a.
2016-10-19 14:27:28 +02:00
50751d62e9 Fix T49738: Hair Add Brush doesn't work
the issue was caused by wrong default value for brush particle count
which was clamped on display from 0 to 1. This is technically a regression
but how to port this to 2.78a?
2016-10-19 14:27:08 +02:00
a6220f459b Fix T49746: crash loading user preferences with missing operators. 2016-10-19 14:26:42 +02:00
Chase Willden
8030c4832a Fix assert in the wrong place, should be moved earlier to do anything.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2304
2016-10-19 14:26:42 +02:00
Julian Eisel
00d08c909d Fix missing outliner redraw when adding VSE strip
Needed for outliner "Sequence" display mode.
2016-10-19 14:26:42 +02:00
d1f5c0fe48 Fix T49571: 2d stabilize keys not visible in the Graph Editor and Dope Sheet 2016-10-19 14:26:42 +02:00
dacb53ff71 Fix T49601: Material menu length problem.
Regression from rB69b66d549bcc8, was supposed to be non-functionnal
change, so not sure why search menu was reduced here? For now, restore
to 2.77 width.
2016-10-19 14:26:42 +02:00
e6d9b15ab3 Fix T49646: Switching from large to small image can get stuck zoom at max zoom distance.
Allow for zooming in at max zoom distance.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D2291
2016-10-19 14:26:42 +02:00
3fb0c1b8e7 Fix T49534: 2.78 Wrong texture scaling in material viewport
Seems to be a bug in original implementation of a830280: code was always
using tangent space instead of UV map because it had the same name. Now
prefer UVMap over tangent because this is how Cycles works. At least it's
closer to.

Not sure it the save+reload issue is still relevant after this fix, that
needs to be double-checked.

Thanks @dfelinto for looking into the report and simplifying the case.

Should be included into 2.78a.
2016-10-19 14:26:42 +02:00
fd9aa06440 Fix OLD pre-git links in the API, add missing factory-startup option to blender executions.
Reviewers: mont29

Reviewed By: mont29

Tags: #bf_blender, #python, #infrastructure:_websites

Differential Revision: https://developer.blender.org/D2290
2016-10-19 14:26:41 +02:00
03f935961a Fix T49635: column_flow Layout - last column is too small.
Column flow layout was abuse ui_item_fit in a weird way, which was
broken for last column items.

Now rather use own code, which basically spread available width as
equally as possible between all columns.
2016-10-19 14:26:41 +02:00
15134cf227 Cleanup: UI layout: remove unsed and confusing parameter.
Things are complicated enough like that, no need to add useless noise on
top of it!
2016-10-19 14:26:41 +02:00
106ff0df99 Normal edit modifier: Fix relation builder for the new dependency graph 2016-10-19 14:26:41 +02:00
7ab972fd63 Ammend to rB00dc0666b3fe: forgot to fix boid->ground of first particle.
This code is confusing, such dirty details should not sneak out of
particles' own private code. :(
2016-10-19 14:26:41 +02:00
97bba76e8c Fix T49631: radial control operators not using DPI properly. 2016-10-19 14:26:41 +02:00
10598c084e Fix T49640: Cycles constant folding incorrect for texture coordinates. 2016-10-19 14:26:41 +02:00
c9b5253cfc Fix T49636: material draw mode crash with displacement and missing group input node. 2016-10-19 14:26:41 +02:00
2002334813 Cycles: Get rid of ifdef-ed noinline policy 2016-10-19 14:26:41 +02:00
b42e4c3c40 Cycles: Fix use of uninitialized variable in SSS
When ray hits curve segment with SSS shader it was possible to have
uninitialized hit_P variable used for sampling.

Seems that was a reason of our headache of difference between AVX2
and SSE4 render results here, so now we can revert all the nasty
ifdef-ed inline policies.
2016-10-19 14:26:41 +02:00
9d4e3b0e63 Fix T49622: Grease pencil not rendering out of VSE 2016-10-19 14:26:40 +02:00
4736664da6 Fix T49502: file browser on OS X not highlighting external drives. 2016-10-19 14:26:40 +02:00
8ebc7565e7 Fix T49629: Graph editor normalize function doesn't work on f-curves with a constant key value
Technically it is a regression in behavior and should be 2.78a.
2016-10-19 14:26:40 +02:00
012bbce453 Make console message more clear for --scene argument 2016-10-19 14:26:40 +02:00
be254b52dc Fix T49623: Immediately crash trying to render attached file in Cycles
Original fix in this area was not really complete (but was the safest at
the release time). Now all the crazy configurations of slots going out
of sync should be handled here.
2016-10-19 14:26:40 +02:00
cdedd082f3 Fix viewport camera gets out of sync in certain cases
It was possible to have two viewports opened and start using Ctrl-0
to make different objects an active camera for the viewport. This
worked fine for viewports which had decoupled camera from the scene,
but if viewport was locked to scene camera it was possible to run into
situation when two different viewports are locked to scene camera but
had different v3d->camera pointers.
2016-10-19 14:26:40 +02:00
880ebfff58 Fix T49609: Point density textures: vertex colors are not properly averaged in BI
Nice to have in 2.78a, though not a regression.
2016-10-19 14:26:40 +02:00
29fdcbbf9f Fix T49608: runtime-only particle's boid->ground Object pointer was left dangling to invalid value in read code... 2016-10-19 14:26:40 +02:00
cb6c43b61c Fix a few compile errors with C++11 on macOS. 2016-10-19 14:26:40 +02:00
4dbcbf5ba9 BLI_task: fix case were some pool could work in more threads than allowed.
We were checking for number of tasks from given pool already active, and
then atomically increasing it if allowed - this is not correct, number
could be increased by another thread between check and atomic op!

Atomic primitives are nice, but you must be very careful with *how* you
use them... Now we atomically increase counter, check result, and if we
end up over max value, abort and decrease counter again.

Spotted by Sergey, thanks!
2016-10-19 14:26:40 +02:00
117329ae6d Cycles: Fix OpenCL split kernel compilation after recent CUDA 8 performance fix 2016-10-19 14:26:39 +02:00
6601b4cbdc Datablock management: remove 'proxy_from' pointer from 'is ID used' checks.
Pretty much same reason as for the 'from' pointer of shapekeys - runtime
data creating loops and 'ghost' dependencies between datablocks.

We need to handle them in cases like remapping, but whall not take them
into account to check dependencies between datablocks... :/
2016-10-19 14:26:39 +02:00
02eec191fb Fix T49595: bpy - negative skin_vertices radius crashes Blender
This is unsigned value (negative radius does not have much sense anyway!).
2016-10-19 14:26:39 +02:00
Julian Eisel
2525c4e129 Fix wrong separator line width after drawing vec icon
Was visible in Dynamic Context Menu add-on.
2016-10-19 14:26:39 +02:00
0d1bc587fa Fix T49523: very slow normal map tangent computation for rendering in 2.78. 2016-10-19 14:26:39 +02:00
e65e5045de Fix T49501: Animations imported via alembic render with wrong or no motion blur 2016-10-19 14:26:39 +02:00
b9c996e16b [msvc] make.bat, no need to set the cuda path at all, cmake will figure it out on it's own. 2016-10-19 14:26:39 +02:00
96ac3bd4bf [msvc] make.bat remove mixed cuda 7.5/8.0 build for release since all kernels can now be properly build with 8.0 2016-10-19 14:26:39 +02:00
1d36092627 Cleanup: Update links to online py API doc, and remove old commented stuff. 2016-10-19 14:26:39 +02:00
b8194a52a0 Fix T49553: Blender 2.78 crashes when File->Data Previews ->Refresh Datablock Previews
New recursive iteration over IDs in BKE_library_foreach_ID_link() was
broken by the infamous nodetree case. We cannot really recusively call
this function in that case, so better to deffer handling of
non-datablock NodeTrees as if real IDs here.

Also fixed initial ID not being stored as handled, in rare cases this
could also lead to infinite looping.

To be backported to 2.78a.
2016-10-19 14:26:39 +02:00
f87a81afb4 Cycles CUDA: make CUDA 8.0 the officially supported version for all platforms. 2016-10-19 14:26:39 +02:00
fd0dea585c Fix Cycles CUDA performance on CUDA 8.0.
Mostly this is making inlining match CUDA 7.5 in a few performance critical
places. The end result is that performance is now better than before, possibly
due to less register spilling or other CUDA 8.0 compiler improvements.

On benchmarks scenes, there are 3% to 35% render time reductions. Stack memory
usage is reduced a little too.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D2269
2016-10-19 14:26:38 +02:00
Julian Eisel
4d14bd10c0 Fix memory leak caused by unknown opeartor of keymap item 2016-10-19 14:26:38 +02:00
4640bf890e Fix T49548: Entering Cycles Rendered Viewport Unlinks Material from Objects.
We *always* want to increase mat user count when from Object (and not
Data), because in that case we are moving mat from object to temp
generated mesh, material can never be 'borrowed' in that case.

To be backported to 2.78a
2016-10-19 14:26:38 +02:00
Julian Eisel
e145990fdd Fix missing operator-type registration
Removed in a7dbc0704f, but only should've removed default keymap entry.
2016-10-19 14:26:38 +02:00
Julian Eisel
11120c2981 Fix T49506: Remove unused File Browser theme settings
If I didn't miss anything these are indeed not used. Old themes should still work (will only print info on redundant theme defines into console), but updated non-contrib themes already.
2016-10-19 14:26:38 +02:00
07508c8b93 Fix missing new eyedropper keymap entry in keyconfig_utils.py
Missing from rBe9bcdcdbbd91d9.
2016-10-19 14:26:38 +02:00
e96e66b05b Fix T49520: broken vertex colors in the game engine. 2016-10-19 14:26:38 +02:00
52e601f0c6 [Fix unreported bug] Snap align with normal was not working in derivade mesh
The `use_snapp_align_rotation` option was using only the first vertex
2016-10-19 14:26:38 +02:00
01b71b564b [msvc] make.bat - Fix:msbuild platform wasn't set when the architecture was auto detected. 2016-10-19 14:26:38 +02:00
9fea90ba36 Fix T49502: file browser on OS X not highlighting system folders and bookmarks. 2016-10-19 14:26:38 +02:00
4a8c43d756 [MSVC] Make.bat updates.
- Explicitly specify the platform for msbuild, to facilitate builds with just the Visual C++ Build Tools installed.
- When vs2013 is not found, try looking for 2015 as a fallback
- Clear up any batch variables that might have been set from previous runs
2016-10-19 14:26:37 +02:00
4da266f48c Fix wrong Cycles GLSL pointiness, still not supported but should be neutral 0.5. 2016-10-19 14:26:37 +02:00
90e1adabba Fix MSVC compiler warning due to using */* to start comment. 2016-10-19 14:26:37 +02:00
02605b72f1 CUEW: Use latest upstream version
Fixes typo in README :)

Thanks to @jesterKing!
2016-10-19 14:26:37 +02:00
7b43307508 Fix T49489: Pose marker in camera action + marker bound to camera -> crash.
'camera' Object pointer of TimeMarkers is a 'temp' hack since Durian project...
Would need to be either made definitive now, or removed/reworked/whatever.

But since we intend to use that object pointer for other needs, and current code
could lead to crashing .blend files, for now let's fix that mess (was missing
some bits in read code, and also totally ignored in libquery code).

Should be safe for 2.78a.
2016-10-19 14:26:37 +02:00
f978deddf8 UPBGE: Fix crash when calling shade_light texture when mtex has no tex. 2016-10-19 14:26:37 +02:00
dadd017d06 Cycles: Support earlier tile rendering termination on cancel
It will discard the whole tile, but it's still kind of more friendly than
fully locked interface (sort of) for until tile is fully sampled.

Sorry if it causes PITA to merge for the opencl split work, but this issue
bothering a lot when collecting benchmarks.
2016-10-19 14:26:37 +02:00
08d21ff582 Cycles: Fix typo in shader cancel routines 2016-10-19 14:26:37 +02:00
1733141db8 Adopt referenced scene in the context when evaluating sequences within a Scene Strip
This change makes it so that when the sequences within a Scene strip are
evaluated, they use the Scene that they come from as the context as opposed
the Scene that the Scene strip is in. This is necessary, for example, in the
case of the MulticamSelector where it needs to reference strips in the original
Scene as opposed to the Scene where the Scene strip is located.

Patch by @Matt (HyperSphere), thanks!
2016-10-19 14:26:37 +02:00
0df78d11e0 Cycles: Improve OpenCL line information handling
Previously it was falling back to just a path after #include
statement was finished. Now we fall back to a proper current
file name after dealing with the preprocessor statement.
2016-10-19 14:26:37 +02:00
acaa046e5e Update source tgz builder script
Was broken since splitting BKE_blender_version from BKE_blender.
2016-10-19 14:26:36 +02:00
7466603910 [MSVC] make.bat updates.
- The build folder name used to be depended on the order of the parameters, this is now normalized to
"build_windows_[Release/Full/Lite/Headless/Cycles/Bpy]_[x86/x64]_vc[12/14]_[Release/Debug]" regardless of the order of the parameters.

-Use CUDA8 for all kernels when building the release convenience target with visual studio 2015
2016-10-19 14:26:36 +02:00
08e4846540 Fix T49478: triangulate of face hangs Blender.
Another case of float imprecision leading to endless loop. INcreasing a bit 'noise threashold' seems to work OK.

Not a regression, but might be nice to have in 2.78a.
2016-10-19 14:26:36 +02:00
6c2f93aa7a Cycles: Fix compilation error with minimal feature set 2016-10-19 14:26:36 +02:00
949b23d29b Fix T49471: Vertex Connect randomly broken.
Not sure where this comes from, but code was converting BMEdge* to BMVert* to check oflags,
i.e. not accessing correct memory.

Regression, to be backported to 2.78a.
2016-10-19 14:26:36 +02:00
8aa04160ba Fix T49460: Particle group instance 'Use Count' value gets reset on file-load.
Regression caused rBbcc863993ad, write code was assuming dw->ob was always valid,
wich is no more the case right after reading file e.g.

Another good example of how bad it is to use 'hidden' dependencies between datablocks. :(
And another fix to be backported to 2.78a. :(((
2016-10-19 14:26:36 +02:00
d78a4b0c62 Fix T49466: Stupid typo in logicbricks new copy code from rB776a8548f03a
Moved that code forth and back a few times while creating rB776a8548f03a fix,
ended up forgetting to update it correctly for function where it layed down in the end.

Last-minute fixes are never a good thing... Now we already have real reason for 2.78 'a' release :(
2016-10-19 14:26:36 +02:00
a05f9bef3f Fix T49423: Data Preview of group containing only group instances is empty.
Code was not getting correct boundbox in some cases (group only instancing other groups e.g.), now
compute our own bbox in those cases.

Based on patch by @lichtwerk, but extended the fix to include linked datablocks in some cases
(linked objects in local groups, linked objects in local scene, etc.), this was also broken in existing code.

Reviewers: mont29

Subscribers: duarteframos

Differential Revision: https://developer.blender.org/D2257
2016-10-19 14:26:36 +02:00
a88af3e576 Fix T49461: Dynamic paint wetmap flickers.
Regression from rBa4a968f, we would adjust current point's wetness without actually protecting it
in new multi-threaded context, leading to concurrent access mess.

Now delay applying wetness reduction to current point to end of function, allows us to avoid having
to lock current point twice together with neighbor one (and reducing spinlock awainting too).

To be backported to 2.78a.
2016-10-19 14:26:36 +02:00
ff27b58b4c Fix T49464: Data Transfer modifier slows down redraw of window.
Never call function that might recompute a DM in an RNA itemf callback (or any UI-related func in general)!
There was an XXX comment asking if this was OK - well, no, it was not. :P

Could be ported back to some 2.78 flavour should we need it.
2016-10-19 14:26:35 +02:00
3bf9cbe7a2 Fix export image generated by export UV layout
Was only happening with new dependency graph.

The issue here is that scene's depsgraph layers will be 0 unless
it was ever visible. Worked around by checking for 0 layer in the
update_tagged of new depsgraph. This currently kind of following
logic of visible_layers, but is weak.

Committing so studio is unlocked here, will re-evaluate this layer.
2016-10-19 14:26:35 +02:00
cb9d010421 Fix Scene datablocks being created with a real user while never having any real datablock user.
Now using new system dedicated to that kind of cases, id_ensure_real_user(), instead.
That way, usercount of Scenes is handled correctly at deletion time.

Reported by @sergey over IRC, thanks.
2016-10-19 14:26:35 +02:00
c1205fd5ec [Windows/make.bat] Clean only after all parameters have been processed so the full path is known, and require a convenience target to be set. Also added a helpful error message if any of the required data is not available. 2016-10-19 14:26:35 +02:00
c9361c6935 Cycles: Cleanup file headers
Some of the files were wrongly attributing code to some other
organizations and in few places proper attribution was missing.

This is mainly either a copy-paste error (when new file was
created from an existing one and header wasn't updated) or due
to some refactor which split non-original-BF code with purely
BF code.

Should solve some confusion around.
2016-10-19 14:26:35 +02:00
711421a90f Cycles: Move BVH constants to an own files, so they are easily re-usable 2016-10-19 14:26:35 +02:00
0972786fa4 Buildbot: Another attempt to have OSX builder fixed 2016-10-19 14:26:35 +02:00
61ae5f1b23 Buildbot: Temporary disable CUBIN compilation 2016-10-19 14:26:35 +02:00
d882d4e91d Buildbot: Attempt to use proper Clang for CUDA binaries 2016-10-19 14:26:35 +02:00
bd4185b03b Buildbot: Disable QuickTime for the time being
Buildbot machine was updated to the new SDK which seems to have
QTKit removed.

For until we've installed older SDK or ported our code to a new
AVFramework disabling QuickTime.
2016-10-19 14:26:35 +02:00
Julian Eisel
483b4f0567 Fix missing properties editor update when changing 3D View camera
Actually two errors here:
* Properties editor wasn't refreshing on (NC_SCENE | ND_RENDER_OPTIONS) notifiers
* Was using notifier info bits wrongly, needs to send two separate notifiers

Decided to remove ND_RENDER_OPTIONS rather than adding properties editor scene context refresh for it, this is more than a render option change.
2016-10-19 14:26:34 +02:00
bdbf608941 OpenGL render: Skip GP passes if viewport has GP visibility disabled 2016-10-19 14:26:34 +02:00
b148eda5a7 dynamic fracture, divide force by mass to get higher probability of secondary fractures 2016-10-13 23:22:28 +02:00
bf3bb95097 added dynamic minimum shard size as option 2016-10-13 21:51:35 +02:00
eb45c12ef0 dynamic fracture, fix for passive shards... dynamic cache was not used at all for it 2016-10-13 20:10:52 +02:00
6276e3d174 dynamic fracture, added a third new constraint option "none" 2016-10-13 00:52:23 +02:00
41481a1be6 dynamic frac fixes (better activation, ability to merge cluster count and group) 2016-10-12 22:32:47 +02:00
a3704e9b6b crash fixes for dynamic split, also attempt to get rotations correct with limit impact 2016-10-12 17:25:13 +02:00
8e166a5926 fix, break anyway if there are no constraints at all 2016-10-12 12:13:37 +02:00
d22d1bae7c added constraint dynamic percentage and dynamic constraint building option 2016-10-12 12:06:21 +02:00
f8a043a106 another fix attempt for rotational anomalies 2016-10-12 01:23:07 +02:00
0a15defd44 partial fix attempt for incorrect rotation issue with dynafrac 2016-10-11 21:40:57 +02:00
d735ec0a2e minor fix for dynamic fracture, there was an off by 1 error which caused strange behavior on single shards 2016-10-11 01:22:34 +02:00
0b0fe66838 vary the seed when using presplit in dynafrac and fix for error when applying split to a single island 2016-10-10 23:24:16 +02:00
c9446653e9 improvement of pre-split dynamic fracture 2016-10-10 18:56:47 +02:00
d6574abb83 added split shards to island support for dynamic fracture (works only good if there are multiple islands) 2016-10-09 13:36:50 +02:00
5d6a36eb59 dynamic fracture, further minor transform tweak 2016-10-08 15:27:00 +02:00
794f85516c another minor tweak for transform issue 2016-10-08 00:22:59 +02:00
b5834d39ac fix for dynafrac, disallow passive objects as triggers again (to avoid the ground being a trigger) 2016-10-07 22:45:31 +02:00
5ce8f72a12 further attempt to fix / get the transform issues under control with dynafrac 2016-10-07 22:35:09 +02:00
81a67d8e98 fixed some more transform issues with dynamic fracture, added openmp for loop for boolean fracturing 2016-10-06 22:20:58 +02:00
5a46ad276c dynamic fracture, attempt to better control the higher level fractures via threshold 2016-10-06 17:49:32 +02:00
7c4489be8f partial fix for dynamic fracture transform issues, impact points might be calculated incorrectly still. 2016-10-05 22:16:18 +02:00
05c64b674a dynamic fracture, fix for texture propagation and autohide on secondary fractures 2016-10-05 17:29:22 +02:00
f0058e4980 Fix elbeem omp for msvc 2016-10-04 00:03:07 +02:00
8bd2323829 further tweaks for dynamic fracture 2016-10-03 15:11:24 +02:00
cc00da895e dynamic fracture: added back constraint support for it 2016-10-03 01:21:23 +02:00
63f90d1099 dynamic fracture, crash fix for autohide 2016-10-02 18:24:00 +02:00
030bb2f7e0 8% faster fluidbaking with gcc and 30% faster with clang 2016-10-02 17:58:40 +02:00
ed54923768 attempt to keep shards not affected by fracture kinematic if the object is kinematic / triggered 2016-10-02 13:51:47 +02:00
009dacd317 fixed some warning issues (const vs non const, wrong variable type in format string) 2016-10-01 18:06:52 +02:00
72f52c2dae backport of "fix Mac build for Xcode < 8" to FM branch
This was added to 2.78 release branch after the merge, so adding it here too.
2016-10-01 16:22:01 +02:00
723cb3c1ae added README 2016-10-01 14:31:28 +02:00
1f88e48d08 dynamic fracture can now react to multiple impacts on initial shard and 1st level shards 2016-10-01 14:25:27 +02:00
6b550a563e crash fix for direct text fracture (prefractured) -> bmesh use_toolflags set incorrectly 2016-09-28 22:52:10 +02:00
a6ebe080f7 windows compile fix 2016-09-28 12:47:22 +02:00
0b13b7adef fix Mac build for Xcode < 8
We need a long-term fix, but this will get 2.78 out the door.
2016-09-28 10:41:56 +02:00
192a18a99d added new bmesh boolean solver to fracture modifier as well 2016-09-28 00:01:28 +02:00
07e45ea86c merge compile fixes 2016-09-27 21:46:59 +02:00
23aabf5c81 Merge remote-tracking branch 'refs/remotes/origin/blender-v2.78-release' into fracture_modifier
Conflicts:
	CMakeLists.txt
	build_files/build_environment/install_deps.sh
	build_files/cmake/macros.cmake
	doc/python_api/sphinx_doc_gen.sh
	intern/cycles/app/CMakeLists.txt
	intern/cycles/blender/addon/properties.py
	intern/cycles/blender/blender_sync.cpp
	intern/cycles/kernel/bvh/bvh.h
	intern/cycles/kernel/geom/geom_bvh_volume.h
	intern/cycles/kernel/geom/geom_bvh_volume_all.h
	intern/cycles/kernel/kernel_volume.h
	intern/cycles/kernel/kernels/opencl/kernel.cl
	intern/cycles/kernel/shaders/node_subsurface_scattering.osl
	intern/cycles/kernel/svm/svm_closure.h
	intern/cycles/util/util_vector.h
	release/datafiles/splash.png
	release/datafiles/splash_2x.png
	release/scripts/addons
	source/blender/blenfont/intern/blf_font.c
	source/blender/blenkernel/BKE_blender.h
	source/blender/blenkernel/BKE_mesh_mapping.h
	source/blender/blenkernel/CMakeLists.txt
	source/blender/blenkernel/intern/blender.c
	source/blender/blenkernel/intern/image.c
	source/blender/blenkernel/intern/particle_distribute.c
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/blenkernel/intern/scene.c
	source/blender/blenkernel/intern/speaker.c
	source/blender/blenloader/intern/readfile.c
	source/blender/bmesh/intern/bmesh_core.c
	source/blender/bmesh/intern/bmesh_polygon.c
	source/blender/editors/gpencil/gpencil_brush.c
	source/blender/editors/gpencil/gpencil_ops.c
	source/blender/editors/object/object_relations.c
	source/blender/editors/physics/particle_edit.c
	source/blender/editors/space_view3d/drawarmature.c
	source/blender/editors/space_view3d/drawvolume.c
	source/blender/editors/transform/transform_snap.c
	source/blender/gpu/shaders/gpu_shader_material.glsl
	source/blender/makesdna/DNA_modifier_types.h
	source/blender/makesdna/intern/makesdna.c
	source/blender/makesrna/intern/rna_camera.c
	source/blender/makesrna/intern/rna_modifier.c
	source/blender/makesrna/intern/rna_sculpt_paint.c
	source/blender/modifiers/MOD_modifiertypes.h
	source/blender/modifiers/intern/MOD_util.c
	source/blender/nodes/shader/nodes/node_shader_bump.c
	source/blender/nodes/shader/nodes/node_shader_fresnel.c
	source/blender/nodes/shader/nodes/node_shader_normal_map.c
	source/blender/render/intern/source/render_result.c
	source/blender/render/intern/source/render_texture.c
	source/blender/windowmanager/WM_api.h
	source/creator/CMakeLists.txt
2016-09-27 21:46:27 +02:00
4bb1e224ba Blender 2.78: Update submodule hashes 2016-09-26 14:42:18 +02:00
2c19ddf4a6 Cycles: Fix T49411: Multiscatter GGX with zero roughness when Filter Glossy is enabled 2016-09-26 10:51:51 +02:00
6d483e20e0 Fix T49310: incorrect Cycles standalone normals with negative scale. 2016-09-26 10:51:51 +02:00
599e560a68 Cycles: Fix overflow caused by wrong size calculation in Mesh::add_undisplaced 2016-09-26 10:51:51 +02:00
daa1487425 Cycles: Prevent crash in special cases when object has less slots than mesh
This is something what was guaranteed in give_current_material(), just
copied some range checking logic from there.

Not sure what would be a proper fix here tho.
2016-09-26 10:51:51 +02:00
abc8810911 Cycles: Don't sum up memory usage of all devices together for the stats 2016-09-26 10:51:50 +02:00
5cb1251222 Fix T49417: Cycles crash - can't use 5 Gigabyte Tile EXR texture file
Was an integer overflow issue when calculating offsets.
2016-09-26 10:51:50 +02:00
c5558b3ccd Fix crash in own recent rB776a8548f03a049.
New ID may be null, have to check this too!

Reported by @panzergame over IRC, thanks.

To be ported to 2.78 as well.
2016-09-26 10:51:50 +02:00
94e91ca7e5 Fix T49430: append scene with gamelogic broken.
In fact, it was the whole remapping process that was broken in logic bricks area,
due to terrible design of links between those bricks...

Object copying was also broken in that case, fixed as well.

To be backported to 2.78.

Note that issue was actually probably there since ages, hidden behind dirty hacks
used in previous append code (though likely visible in some corner cases).

Listen kids: do not, never, ever, do what has been done for links between logic bricks. Never. Ever.
Even as pure runtime data it would have been bad, but as stored data...
2016-09-26 10:51:50 +02:00
4ed7fb581a Fix T49441: Grease Pencil - pie menu - brush name field crashes blender
Using context.active_gpencil_brush to access the active Grease Pencil brush
would result in a crash if trying to rename the brush, because the "ID" pointer
was not set.

To be backported to 2.78
2016-09-26 10:51:50 +02:00
08d14a86d4 Collada: Trying to get rid of some warning messages on linux 2016-09-26 10:51:50 +02:00
a5d8efe16c Collada: Trying to get rif of some warning messages on linux 2016-09-26 10:51:49 +02:00
01ed1de0d8 Fix: Collada Importer did not import the Blender Profile information correctly when multiple objects are bound to same armature. This caused Bone tails to be placed wrong. 2016-09-26 10:51:49 +02:00
a2e105186f some improvement for dynamic fracture, it now takes location and size of impact object into account with "Limit Impact" 2016-09-25 21:38:06 +02:00
35f81587b5 Fix T49427: Drivers of Shapekeys break when Append a group.
Optimization attempt with BKE_library_idtype_can_use_idtype() was not taking into account
the fact that drivers may link virtually against any datablock...

Has to be rethinked, but for after 2.78 release, this commit is safe to backport.
2016-09-22 16:52:10 +02:00
d32ae028ba Buildinfo: Improve behavior with detached HEAD
Try real hard to detect which branch we've detached from.
2016-09-22 15:02:52 +02:00
42f42cbfdc Fix T49425: Freestyle in viewport keeps updating over and over.
Regression caused by rBb27ba26, we would always tag datablocks to update in G.main,
ignoring given bmain, now always use this one instead.

To be backported to 2.78.
2016-09-22 15:02:32 +02:00
Julian Eisel
53ff09bc97 GPencil: Fix memory leak using stroke arrange OP 2016-09-22 15:02:25 +02:00
de311a0a15 Blender 2.78: Point locales to the latest branch 2016-09-22 12:37:35 +02:00
f3fe4e736f Cycles: Soft minimum for dice rates
Use 0.5 as a soft minimum for dice rates to help from setting them too
low. Lower values can still be set by typing in the value.
2016-09-22 12:33:32 +02:00
5ef46c1ef1 Cycles: Fix update of subdivision meshes when global dice rates change
When subdivision settings were moved from meshes to objects this was missed,
should work fine now.
2016-09-22 12:33:32 +02:00
7da7611c0b Cycles: Adaptive isolation
Idea here is to select the lowest isolation level that wont compromise quality.
By using the lowest level we save memory and processing time. This will also
help avoid precision issues that have been showing up from using the highest
level (T49179, T49257).

This is a pretty simple heuristic that gives ok results. There's more we could
do here, such as filtering for vertices/edges adjacent geometric features that
need isolation instead of checking them all, but the logic there could get a
bit involved.

There's potential for slight popping of edges during animation if the dice
rate is low, but I don't think this should be a problem since low dice rates
really shouldn't be used in animation anyways.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D2240
2016-09-22 12:33:32 +02:00
d14603021c Blender 2.78: Point addons to an updated branch 2016-09-22 11:14:48 +02:00
bca6aa47bc Blender 2.78: Move to release cycle 2016-09-22 11:13:58 +02:00
d63505e42e CMake: Fix copy-paste error 2016-09-22 11:07:37 +02:00
9836940d4d Bring blender_release.cmake uptodate with the changes from D2227 2016-09-22 11:07:37 +02:00
c6ab7c31a1 [windows] add some helpers to make.bat to facilitate making release builds.
New features:
1) Release target that checks for both cuda 7.5 and 8 with WITH_CYCLES_CUDA_BINARIES=ON and CYCLES_CUDA_BINARIES_ARCH=sm_20;sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61 options set.
2) Option to switch between x86 and x64 builds, the default remains (auto detect the architecture) but can be overridden.
3) Option to switch between vs12(2013) and vs14(2015) default is 2013.

Reviewers: juicyfruit, sergey

Reviewed By: sergey

Tags: #platform:_windows

Differential Revision: https://developer.blender.org/D2180
2016-09-22 11:07:37 +02:00
22b39901e3 Fix non-finite normalization factor in certain cases 2016-09-22 11:07:37 +02:00
213e9aeb8c Fix: Grease Pencil sculpting crashes when sculpting on layers without any strokes
Reported by @loochmunz. I've also gone through checking for and fixing other places
where this was also occurring.


To be included in 2.78
2016-09-22 11:07:37 +02:00
9d976a4f7a GPencil D+W Pie: Don't show editing operators when not in editmode
These operators only operate on the selected strokes, but when not in editmode,
stroke vertices are not shown.

Safe for 2.78
2016-09-22 11:07:37 +02:00
83bbf57b5b regression fix for 1346482d23: The length of leaf bones should always be set to the length of the smallest bone. since the mentioned commit the importer did only recalculate the leaf bone length when the 'fix leaf bones' option was also enabled. 2016-09-22 11:07:36 +02:00
ea7d500b6d Fix T49386: Blender crashes when told to load an OCIO LUT that does not exist 2016-09-22 11:07:36 +02:00
0a97e63246 Fix T49375: align rotation with snap target isn't toggleable in edit mode.
Based on D2237, but fixed patch always hiding 'snap on self' button...

Should be safe for 2.78.
2016-09-22 11:07:36 +02:00
Martijn Berger
0247547b6b Lowercase includes for psapi.h and dbghelp.h windows includes.
This makes cross compilation a little less painful
2016-09-22 11:07:36 +02:00
1782263ef8 CacheFile: make sure SpinLock is destroyed when exiting Blender.
Missed in rB62b1cdd6.
2016-09-22 11:07:36 +02:00
c8c829360b Cycles: Fix typo that would sometimes result in subsurf modifier being disabled 2016-09-22 11:07:36 +02:00
750650c737 Fix T49245: Adaptive Subdivision with Auto Smooth causes weird mesh appearance 2016-09-22 11:07:36 +02:00
8e6aaa08c2 Fix T49384: crash in tangent space calculation with NaN mesh vertices. 2016-09-22 11:07:35 +02:00
fc2b8c9793 Fix T49372: Fresnel node: difference between 2.76 and 2.78 GLSL output 2016-09-22 11:07:35 +02:00
8909ff0e67 Fix filebrowser not getting back to valid dir in Release builds.
Stupid mistake wrapping path validation code inside a BLI_assert, which means it was
only called in Debug builds...

Found by Sergey, thanks.

Should be backported to 2.78.
2016-09-22 11:07:35 +02:00
7b748e9478 Fix crash in some cases when deleting particle systems.
Those 'never null' ID pointers are really a PITA to handle... luckily we don't have much of those around!

Found by Sybren, thanks.

Should be backported to 2.78.
2016-09-22 11:07:35 +02:00
4733544195 Fix Py's IDs user mapping: do not consider ShapeKeys' from here.
This is internal pointer helper for scene evaluation and tools, though exposed to bpy API,
it can give false 'dependency cycles' in bpy.data.user_map() results.

That's followup to rBe007552442634 really, both should be backported to 2.78
2016-09-22 11:07:35 +02:00
ca5f91951c Fix Py's IDs user mapping: do not consider proxy_from here.
This is internal pointer helper for scene evaluation and tools, it's not exposed to bpy API anyway,
and can give false 'dependency cycles' in bpy.data.user_map() results.

Found by sybren in his Splode work.
2016-09-22 11:07:35 +02:00
0960d523a2 Fix T49179: Parts of mesh disappear with adaptive subdivision
Problem was zero length normal caused by a precision issue in patch evaluation.
This is somewhat of a quick fix, but is better than allowing possible NaNs to
occur and cause problems elsewhere.
2016-09-22 11:07:35 +02:00
91966eeefa fix Mac build with Xcode 8
Small issues in GHOST
- use NSApplicationDelegate protocol for our app delegate
- make sure NSApp is initialized before using
(cherry picked from commit df7be04ca6)
2016-09-22 11:07:34 +02:00
fb85484e6c Fix memory leak in copy pose operator 2016-09-22 11:07:34 +02:00
9d70344620 Blender 2.78: Point locales to a new branch hash 2016-09-14 16:46:07 +02:00
d5eb0b58a0 Cleanup: Fix epic indent failure in previous commit :/ 2016-09-14 16:24:16 +02:00
c11fcc34c4 Fix missing PaintCurves list in bpy.data
Minimal list features for now, no add/remove stuff, that we can add later...

Reported by sybren.

Should be safe for 2.78.
2016-09-14 16:15:58 +02:00
a37e4d4738 Fix T49341: Bad motion blur behavior in Cycles when using Speed effect in Sequencer
Cycles was thinking it always rendering integer frame, which is not correct.
2016-09-14 16:14:17 +02:00
14d26df2f1 Fix T49342: TypeError when autocompleting bpy.app.something.
Regression from rB036c006cefe471. We can't use self here, self is bpy.app, not pydescriptor of python path getsetter...

So for now, do not try to replace getsetter by actual value in bpy.app's dict,
just return static var generated on first run.

Should be safe for 2.78.
2016-09-14 15:58:17 +02:00
e02c63df1b Attempt to fix broken path remapping in own rB443b3ca9b9cb. 2016-09-14 13:26:30 +02:00
b6508da380 Code Cleanup: Deduplicate undo node freeing code 2016-09-14 13:26:04 +02:00
929701931d Fix: GPencil drawing sessions now respect limits for maximum undo steps
When drawing with Grease Pencil "continous drawing" for a long time
(i.e. basically, drawing a very large number of strokes), it could be
possible to cause lower-specced machines to run out of RAM and start
swapping. This was because there was no limit on the number of undo
states that the GP undo code was storing; since the undo states grow
exponentially on each stroke (i.e. each stroke results in another undo
state which contains all the existing strokes AND the newest stroke), this
could cause issues when taken to the extreme.
2016-09-14 13:26:01 +02:00
e5f49efe25 Blender 2.78 release: Update addons hash once again 2016-09-14 12:39:07 +02:00
0d7f3d01d7 CMake: decouple WITH_CYCLES_OPENSUBDIV from WITH_OPENSUBDIV, and enable on OS X.
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D2227
2016-09-14 12:37:34 +02:00
9a35ebc1ea Fix two issues related to 'partial' .blend files:
I) Filename was not put in temp Main generated to save selected data only,
this was breaking readcode when trying to open partial file, leading to missing
filename in final loaded Main data.

II) Read code would confuse partial .blend files with Undo ones, when they had no screen in them
(which happens to 99.999% of partial .blend files I guess).

Reported by @sybren, thanks.

Should be safe enough for 2.78 release.
2016-09-14 11:41:16 +02:00
df4602ee3b Fix compilation error: Shadowing of variable 2016-09-14 11:04:34 +02:00
fa47bd1796 2.78 release: Update splash screen label 2016-09-14 10:37:35 +02:00
e38acc2191 2.78 release: Update hash for addons submodule 2016-09-14 10:28:48 +02:00
c6e0c674ee Fix T35333: Update some WM/UI API functions docstrings.
Based on patch by @codemanx, but with slightly less verbose descriptions.

More detailed behavior etc. rather belongs to doc/python_api/examples/bpy.ops.x.py imho.
2016-09-14 10:26:22 +02:00
1e5ac3b648 Fix bpy.data.user_map() ignoring unused datablocks.
Should be backported to 2.78.
Found by Sybren here in studio, thanks!
2016-09-14 10:26:22 +02:00
dcccf4be30 Outliner: Report linked datablock edit failure when trying to rename linked data in outliner 2016-09-14 10:26:22 +02:00
50452f5b67 Fix T49323: Ineffective bone roll calculation with low rig scale
The code was expecting vector to be normalized, however after
applying inverted object matrix it was possible to have scale
applied to it.
2016-09-14 10:26:21 +02:00
4271c1cc71 Fix T49336: Outliner allows to edit restrict flags for linked objects 2016-09-14 10:26:21 +02:00
290e650590 Fix T49290: Specific .blend with hair crashes in MacOS 2.78 RC1 on render
The issue was caused by some false-positive empty non-AABB intersection.
Tried to tweak it a bit so it does not record intersection anymore.

Hopefully will work for all platforms. Tested here on iMac and Debian.
2016-09-14 10:26:21 +02:00
5de77bf8dc Fix T49327: Cycles OSL Mode: RGB Curves node only outputs gray scale images
To be backported to 2.78 release.
2016-09-14 10:26:21 +02:00
90f920c138 Fix T49296, assert failure in Bevel code.
The mesh interpolation function failed to fill a fractions-of-the-way
array properly when the distances are very small but nonzero.
2016-09-14 10:26:21 +02:00
b11f073ca0 Cycles: Fix wrong SSS in combination with hair on AVX2 platform
Not sure why exactly that happened, need a closer look.
2016-09-14 10:26:21 +02:00
293d5db895 Cycles: Fix shading and crashes resulting from constant folding on displacement
Constant folding was removing all nodes connected to the displacement output
if they evaluated to a constant, causing there to be no valid graph for
displacement even when there was displacement to be applied, and sometimes
caused crashes.
2016-09-14 10:26:21 +02:00
fd01cd7d06 Cycles: Replace object index hack with actual checks for SD_TRANSFORM_APPLIED
Using ones complement for detecting if transform has been applied was confusing
and led to several bugs. With this proper checks are made.

Also added a few transforms where they were missing, mostly affecting baking
and displacement when `P` is used in the shader (previously `P` was in the
wrong space for these shaders)

Also removed `TIME_INVALID` as this may have resulted in incorrect
transforms in some cases.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2192
2016-09-14 10:26:21 +02:00
2c1201502d Cycles: Fix bump mapping to use object space when used with true displacement
Bump mapping was happening in world space while displacement happens in object
space, causing shading errors when displacement type was used with bump mapping.

To fix this the proper transforms are added to bump nodes. This is only done
for automatic bump mapping however, to avoid visual changes from other uses of
bump mapping. It would be nice to do this for all bump mapping to be consistent
but that will have to wait till we can break compatibility.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2191
2016-09-14 10:26:20 +02:00
b67db67b01 [CMAKE/Platform/Windows] Only perform version check if the actual compiler is MSVC 2016-09-14 10:26:20 +02:00
Dmitry Dygalo
872065e19e Fix undefined variable on errors in Cycles ctests.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D2201
2016-09-14 10:26:20 +02:00
f6fb072ab2 Fix OpenSubdiv related buffer overrun with multiple FVar channels.
The existing code uses the input value count of the first channel
for all of them. If the first channel is the largest, it leads to
a crash-causing buffer overrun in memcpy below. Likely this was
left since the time when only one channel was supported.

As a crash fix, probably should go into 2.78
2016-09-14 10:26:20 +02:00
16135990cd Fix missing 'prop_required' flags in some ID RNA funcs.
Not critical, but would rather have this in 2.78 (for API doc reasons mostly).
2016-09-14 10:26:20 +02:00
00abe6ecf1 Fix/Workaround T49297: Crash related to custom data draw (Blender with ASAN)
Root of the issue is that active render index became wrong. This is the actual
thing to be fixed, but as usual this is quite tricky to reproduce. Since such
bad situation might have happened more and fix isn't really difficult or
intruisive let's avoid crash for now.

Can be revisited once we figure out root of the issue.

Nice for 2.78 release.
2016-09-14 10:26:20 +02:00
3f5960b869 Fix T49299: Removing offset object in modifiers doesn't update mesh.
Own fault in new ID management work, thought rebuild the DAG itself was
enough to actually update whole scene, but we actually need to tag datablocks
for update as well, when we change (or remove) one of their ID pointers...
2016-09-14 10:26:20 +02:00
fb2a412b56 Cycles: Fix regular BVH nodes refit
For proper indexing to work we need to use unaligned node with
identity transform instead of aligned nodes when doing refit.

To be backported to 2.78 release.
2016-09-14 10:26:20 +02:00
30aaa92a19 Cycles: Add asserts to BVH node packing 2016-09-14 10:26:19 +02:00
979a4a613c Cycles: Cleanup: line wrapping 2016-09-14 10:26:19 +02:00
faec666bbe Fix T49283: Crash in BKE_ptcache_make_particle_key.
This is really hack-fix actually, not sure why `get_pointcache_keys_for_time()` seems to assume
it will always find key for given part index at least for current frame, and whether this assumption
is wrong or whether bug happens elsewhere...

Anyway, this is to be wiped out in 2.8, so no point loosing too much time on it, for now merely
returning unchanged (i.e. zero'ed) ParticleKeys in case index2 is invalid. Won't hurt anyway,
even if this did not crash in release builds, would be returning giberish values.
2016-09-14 10:26:19 +02:00
320d601e01 Fix T49286: Compilation error with XCode 7.0
Weirdly enough, this version of XCode seems to have static_assert()
even when NOT using C++11. This is totally weird and counter intuitive
since static_assert() is supposed to be C++11 onlky feature.

Can XCode stop using future, please? :)
2016-09-14 10:26:19 +02:00
e6071056a4 Cycles: Fix OpenCL speed regression introduced with the improved bump mapping
The two SVM nodes added with e7ea1ae78c caused a slowdown on AMD cards when rendering with OpenCL, whether displacement was used or not.
In the Barcelona Pavillon scene on a RX480, this would cause a 12% slowdown.

Therefore, this commit adds a additional flag for feature-adaptive compilation so that the new SVM nodes are only enabled when they are needed (Node tree connected to the Displacement output and Displacement type set to Both).

Also, the nodes were also added to shaders when the Displacement Type was set to Bump (the default), which was unneccessary and is fixed now.

Thanks to linda2 on IRC for reporting and testing and to maiself for help with the displacement shader code.

This fix might be relevant for 2.78, but it should be tested further before including it.
2016-09-14 10:26:19 +02:00
4929de9df7 Fix T49273: Crash during access to dupli weights at launch time.
See commit's comments for details, but this boils down to: do not try to use
purely runtime cache data as a 'real' ID pointer in readcode, it's likely
doomed to fail in some cases, and is bad practice in any case!

Thix fix implies dupliweight's object will be invalid until first scene update
(i.e. first particles evaluation).
2016-09-14 10:26:19 +02:00
9663471bb7 OpenSubdiv: Support multiple materials drawing in Cycles textured view
Consider for inclusion into 2.78.
2016-09-14 10:26:19 +02:00
abe4c38410 [cmake/cpack] allow override of package name
Cpack generates a standard filename with git information in it, which might not always be wanted for release builds, this patch adds an option to override that default filename.

Reviewers: sergey, juicyfruit

Reviewed By: juicyfruit

Differential Revision: https://developer.blender.org/D2199

ammended to fix: wrong variable name in main CMakeLists.txt
2016-09-14 10:26:19 +02:00
7aa0103ca2 Revert "Depsgraph: Prioritize evaluation of the new scheduled nodes"
This reverts commit 9444cd56db.

This commit caused some flickering in the bones when swapping IK to Fk.

While it's unclear why such change caused any regressions, let's revert
it to unlock the studio.
2016-09-14 10:26:18 +02:00
fcb7973849 [cmake/cpack] allow override of package name
Cpack generates a standard filename with git information in it, which might not always be wanted for release builds, this patch adds an option to override that default filename.

Reviewers: sergey, juicyfruit

Reviewed By: juicyfruit

Differential Revision: https://developer.blender.org/D2199
2016-09-14 10:26:18 +02:00
b281df01c7 Fix T41883: Strip keyframes not respected for scenes rendered by other scenes 2016-09-14 10:26:18 +02:00
8e7d6561f5 Add script which scales splash screen down
Based on reading documentation around. This particular version
is based on the ImageMagic documentation which could be found
there:

  http://www.imagemagick.org/Usage/filter/
  http://www.imagemagick.org/Usage/filter/nicolas/

Current filter is based on measuring mean error with the current
splash screen and choosing combination of parameters which
gives minimal mean error.
2016-09-14 10:26:18 +02:00
559e116a36 Fix cast shadows (material option) in the viewport
Fix cast shadows options (in material tab) not working in the viewport.
An off-by-one error. See D2194 for more.

Committing for Ulysse Martin (youle) who found & fixed this.
2016-09-14 10:26:18 +02:00
989ca313be Fix T49252: Crash when image textures used with true displacement 2016-09-14 10:26:18 +02:00
29f7a4abbd OpenSubdiv: Fix missing ORCO when enabling OSD but having dependency to the geometry
Was causing huge viewport lags.

Reported by angavrilov in IRC, thanks!

Safe and nice for 2.78.
2016-09-14 10:26:18 +02:00
802d253a46 Fix T49251: moving smoke domain with additional resolution causes crash.
This is a bug in the multithreaded task manager in negative value range.

The problem here is that if previter is unsigned, the comparison in the
return statement is unsigned, and works incorrectly if stop < 0 &&
iter >= 0. This in turn can happen if stop is close to 0, because this
code is designed to overrun the stop by chunk_size*num_threads as
the threads terminate.

This probably should go into 2.78 as it prevents a crash.
2016-09-14 10:26:18 +02:00
a2e08ef997 Fix own mistake in recent rB8b2a45052093, broke saving render results as images in some cases.
Reported by sebastian_k over IRC, thanks.

To be backported to 2.78.
2016-09-14 10:26:18 +02:00
44df27dc71 Attempt to fix compilation error with static boost on certain platforms
This was reported in T49231.
2016-09-14 10:26:17 +02:00
98b2411b30 Fix T49226: Incorrect Material viewport shading of Cycles Normal Map node in Edit mode for an object with Array modifier
Was incorrect indexing done in the array. Caused by 5abae51.

Not sure why it needed to be changed here, but array here is supposed to be
a loop data, so bringing back loop index as it originally was. The shading was
wrong in edit mode with BI active as well (so it's not like it's needed for
BI only).

Patch in collaboration with Alexander Gavrilov (angavrilov), thanks!

Should be double-checked and ported to 2.78.
2016-09-14 10:26:17 +02:00
3ea30ce1d0 Fix glUniform called from glBegin/glEnd blocks
Was causing some invalid operations in OpenGL.

After more testing should be fine for 2.78.
2016-09-14 10:26:17 +02:00
f496a34700 Fix T49220: Vertex paint doesn't work with OpenSubdiv
It's a bit tricky to align vertex color data between Blender and OpenSubdiv
so for now we simply disable OpenSubdiv in the paint modes.

Safe for 2.78.
2016-09-14 10:26:17 +02:00
7a6a7d9f7c CMake: Skip addons_contrib for release candidate builds
Nowadays release candidates are supposed to be as close to the final
release as possible.

Safe for 2.78 release branch.
2016-09-14 10:26:17 +02:00
41141248ef API doc update script: Fix generated zipfile name, was broken in 'release' case... 2016-09-14 10:26:17 +02:00
e1c1a0c3ee API doc: add new pure-rsync py script to update API doc on Blender server.
The other one (sphinx_doc_gen.sh) needs an ssh account on the server to work - and I hate bash, too! :P
2016-09-14 10:26:17 +02:00
2ef4db4077 Cycles: Fix unreported - Missing node group for the Camera Node
Thanks to linda2 for reporting in IRC.
2016-09-14 10:26:17 +02:00
579e8c707b Alembic: fix parenting issues when an object has multiple curves/points
subobjects.
2016-09-14 10:26:17 +02:00
4be5fae30c Fix T49249: Alembic export with multiple hair systems crash blender
Crash was due to a name collision in Alembic objects caused by the fact
that names derive from the one of the Blender object. An object having
multiple particles system would thus give its name to various
subobjects.

Now use the name of the particles system for the Alembic object.
2016-09-14 10:26:17 +02:00
184c781657 Fix a few OpenCL compiler warnings. 2016-09-14 10:26:16 +02:00
91705ad477 fix: not initialised variable can crash blender (related to modifiers with cage editing enabled) 2016-09-14 10:26:16 +02:00
ab934e7d61 Fix T49228: Separate by material, materials dissappear after reload.
Yet another mismatch where code would decrease usercount (of Material here) but never increase it again
when re-assigning the datablock...
2016-09-14 10:26:16 +02:00
894a4f5230 Fix T49229: ID user decrement error when deleting group instance twice.
Another great example of inconsistency in usercount handling - dupli_group was considered
as refcounted by readfile.c code (and hence by library_query.c one, which is based on it),
but not by editor/BKE_object code, which never increased group's usercount when creating
an instance of it etc.

To be backported to 2.78.
2016-09-14 10:26:16 +02:00
eb85bb008f windows compile fix, use portable BLI_snprintf instead of snprintf 2016-09-12 19:52:20 +02:00
57c9742438 added global keep shards mode for cutter groups 2016-09-09 14:12:09 +02:00
c04b4d393b fixes: activating clusters via percentage, add meshisland id as name in fracture too, load crash fix 2016-09-09 13:33:34 +02:00
0e5089c30a 2.78 release: Point locales to a proper updated branch 2016-09-02 11:54:54 +02:00
0dd4c3bde7 fix, enabled threading for autoexecute 2016-08-08 20:13:08 +02:00
659ca6a7d6 added threaded checkbox next to execute fracture operator 2016-08-08 14:53:47 +02:00
be6d3df29b made threading optional via a checkbox 2016-08-08 14:07:30 +02:00
af118bd3ec fallback to singlethreaded for dynamic, mousebased and fast bisect.. also changed back fast bisect orderding to have more uniform shapes 2016-08-08 12:38:48 +02:00
0f1f3ca292 first attempt to multithread fracturing, works only for prefractured for now 2016-08-08 00:37:08 +02:00
fe55273199 some more optimizations at bisect, bit faster and less memory consumption, and removing bakes now when refracturing 2016-08-07 16:02:13 +02:00
480a8c2bce fixes for bisect and bisect+fill, should look correct again and be a bit faster as well
using a kdtree based preselection method to speed up bisecting
2016-08-06 11:18:00 +02:00
36f511f9c3 small fix for loading possibly different jack shared library versions on different linux distributions, thanks to sergey for the fix 2016-08-02 15:53:29 +02:00
aaef4310e9 small enhancement for voronoi + bisect and solidify after FM use case
if you use voronoi+bisect and solidify after FM, you can automerge now without having autohideable inner faces. This should have the same effect as autohide in regular use case has.
2016-07-25 23:08:46 +02:00
c6f7f3bc38 memory optimization for smoke compressibility fix, dont use recursion but a queue to avoid potential stack overflows, thanks to angavrilov for this optimization 2016-07-23 16:39:25 +02:00
5c8804d6ae fixes to prevent unwanted smoke "explosions" in the domain when using moving colliders, thanks to angavrilov for investigating those problems and providing this fixes. 2016-07-17 21:31:44 +02:00
8f53838675 attempt to make fast bisect usable with mousebased fracture... now the user has a bit control how the halving is performed via the helpers 2016-07-11 16:42:58 +02:00
d8f5a81a9a some tweaks for the faster voronoi+bisect method, its faster but not interactive yet... but should mostly lead to correct results 2016-07-09 13:43:36 +02:00
0f48c6a392 attempt to make voronoi+bisect faster, but it has problems with selfintersection, so unfortunately not useable on any
model out of the box
2016-07-09 01:35:43 +02:00
89c8718872 fix for converting fm external mode back to objects, used wrong transformation for objects 2016-06-12 17:17:30 +02:00
126e443035 crash fix for starting sim after convert to objects in external mode
stale data was around in depsgraph, missed a relations update tag call
2016-06-11 15:56:28 +02:00
785ac13c39 partial solution for FM autoexecute, auto disables when sim runs and is enabled again on startframe
note: cache will always be overwritten in autoexec sim mode, because keeping it may lead to incorrect sim results
furthermore a couple of changes for external mode (attempt to be more BCB compatible)
2016-06-02 10:48:29 +02:00
0935d32ffb fix, force autohide facepair generation only from valid DM
if primary source is invalid, force fallback to secondary source earlier now
2016-05-27 20:28:33 +02:00
c6388928e6 crash fix, could happen that the internal ob->derivedFinal DM structures were invalid
happened in some cases and most notably under windows when attempting to calculate the DMs bounding box
2016-05-27 10:07:05 +02:00
97f6dc3d10 backport for missing smoke viewport display due to using "min" as variable name
This was a fix for T47991 and affects OSX only.
2016-05-23 10:30:56 +02:00
d47aab201f fix: seems autohide refresh was not triggered each time after loading a file
since this is runtime only data force to refresh it now.
2016-04-27 13:30:59 +02:00
4cf48bbe1f fix for solver / cluster solver iterations override, it caused different behavior at loading / refresh
solver iteration override was taken into account too late, after first validation which probably caused different simulation behavior using the default value for one frame
2016-04-08 13:52:38 +02:00
470d0cd6e8 set version char to "a" and cycle to "release" 2016-04-05 20:00:49 +02:00
1e321b998c Merge remote-tracking branch 'refs/remotes/origin/blender-v2.77-release' into fracture_modifier 2016-04-05 19:58:20 +02:00
89f6987953 Fix UV-Editor crashes w/ over SHRT_MAX UV's 2016-04-05 20:45:38 +10:00
63e0d3a47f Fix T47705: Freestyle line glitch.
The addressed issue is a regression from Blender 2.75, after the internal
switch from double to single precision floating-point numbers in the
Freestyle code base.  Face normal calculations require the higher
precision during the computations, even though the results can be stored
as single precision numbers.
2016-04-05 19:34:50 +10:00
2490779013 Correct merge error 2016-04-05 19:02:39 +10:00
8b55e0e877 Remove newly added function (harmless but unused) 2016-04-05 18:58:42 +10:00
d979ba0f73 Blender 2.77a: Point addons to a new submodule hash 2016-04-05 10:55:38 +02:00
19f323012a Particles: Fix broken grid distribution in some case from own recent rB201d3938622. 2016-04-05 10:51:07 +02:00
e97db72ae4 Fix T47902: Particle grid not using modifier stack, Take II.
Now only fix correct handling of use_modifier_stack for grid distribution,
fixing it globally breaks all existing edited hair systems. :/
2016-04-05 10:51:01 +02:00
2d887ae200 Revert "Fix T47902: Particle grid not using modifier stack."
This reverts commit 2bd3acf7cd.

Commit is valid in theory - but in practice, it means nearly all edited hair systems
would need to be re-created from scratch... Not nice, so better revert and note in code
that particle distribution is ugly and does not respect 'use modifier stack' option in most cases.
2016-04-05 10:50:56 +02:00
ebceb93bb4 Fix T47902: Particle grid not using modifier stack.
Disclaimer: this is tentative fix, seems to be working but you never know with particles.
If issue arise, we'll just revert this commit and hide 'use modifier stack' option
for grid distribution instead.

This commit also try to make choice of which dm to use during distribution more generic
(deduplication of code), again hopping not to break anything. :P
2016-04-05 10:50:55 +02:00
828c7956c8 Fix error in ghash/gset_ensure_p_ex
The key is needed in the case the ghash resizes.
Caused regression T47984.
2016-04-05 18:48:37 +10:00
275ca01eac Fix T47939, take II: Check clang package version, not llvm-devel one.
Looks like some distro still provide llvm-3.4-devel, while no more clang-3.4.
Since clang depends on llvm of same version, check clang only should ensure
us we also have matvhing llvm... *sigh*
2016-04-05 10:46:37 +02:00
95de7b9a5f Fix T47939: Install Deps OSL 1.7.1 and clang-3.5
Until we officially support llvm3.5 or more, only allow for 3.4 llvm packages,
and build own stuff otherwise...
2016-04-05 10:46:28 +02:00
f36de27339 Fix T47848: Fix regression in sequencer GL render
Own changes in 2.77 broke off-screen render with scene render size doesn't match output.
2016-04-05 18:45:36 +10:00
fc78a58337 Cycles: Fix wrong camera in volume check when domain is only visible to camera rays 2016-04-05 10:41:46 +02:00
37ab16d075 Cycles: Fix regression caused by recent camera-in-volume commit
Stupid me forgot that we don't have stop-element in the stack yet.
2016-04-05 10:36:15 +02:00
da0ce86a3c Cycles: Make curves modified by a taper object with modifier considered a deform modified
That might consider a bit more objects to be considered deform modified,
but it covers common case of using taper object without require of doing
recursive checks.

In worst case it'll be just some extra synchronization time, no render
time difference will happen for false-positive because of extra checks
happening in Cycles.
2016-04-05 10:36:14 +02:00
f615b57379 Fix curve editmode adding 3D primitives w/ 2D curves 2016-04-05 10:36:14 +02:00
a5cfe0f9dc Fix curve adding 3D nurbs when 2D is set
Ctrl-LMB ignored 2D constraint
2016-04-05 10:36:14 +02:00
e63a8e7ded Fix curve hide keeping spline active 2016-04-05 10:36:14 +02:00
f2ae9c6f85 Fix curve, missing update on Ctrl-LMB 2016-04-05 10:36:14 +02:00
45e68e190d Fix T47971: rigid body baking crash due to thread race condition. 2016-04-05 10:36:14 +02:00
754566cf5b Fix T48030: Can't zoom VSE properties panel 2016-04-05 10:36:14 +02:00
3ed49f8bc9 Fix T47505: Cycles OpenCL rendering crash on Windows.
Restore the boost bug workaround, but without changing the locale.
2016-04-05 10:36:13 +02:00
0f3d558982 Cycles: Fix wrong camera-in-volume stack when camera ray hits volume domain twice 2016-04-05 10:36:13 +02:00
8e1e3e0228 Fix T48001: Highlighting selected item in filtered lists.
active index was not reset to 'nothing' in case actual active item was filtered out.
2016-04-05 10:36:13 +02:00
f4eb7e149a Knife Project: revert fix for T43896
For now leave precision at half a pixel until we have real fix.
Resolves T48023.
2016-04-05 10:36:12 +02:00
713669f7e6 Cycles: Support deformation motion blur for curves deformed by taper 2016-04-05 10:36:12 +02:00
Philipp Oeser
18875f6aa3 Fix T48013: UV Sculpt Brush Does not appear in UV window - but does show up in uv panels (t, n)
Epic fail in recent rB2c3985 :/

To be backported to 2.77a!
2016-04-05 10:36:12 +02:00
f590b2f89f Fix When using keying sets, the toggling "all items" in the array target only goes from the index value down, instead of keying all 2016-04-05 10:36:12 +02:00
81e8bd107f Hide layers from UI in template 2016-04-05 10:36:12 +02:00
a66116f543 Fix T48012: Knife Project crash 2016-04-05 10:36:12 +02:00
b3f08cddf3 Fix NULL check before free 2016-04-05 10:36:12 +02:00
3108861981 Cycles: Fix wrong initialization order of mesh flags and object transform 2016-04-05 10:36:12 +02:00
0fcb17fc4f Remove the obsolete windows launcher 2016-04-05 10:36:11 +02:00
02081f86d1 CMAKE disable building the windows launcher, fix type in delayloading of debug dll 2016-04-05 10:36:11 +02:00
8efe90f0a0 CMAKE / msvc openmp, delay loading of openmp dll so we can set environment
variable before it is loaded
2016-04-05 10:36:11 +02:00
315703d725 Cycles: Aligned vector was not covered by guarded stat
This was making stats printed by the logging being wrong: they did not
include such memory as BVH storage.
2016-04-05 10:36:11 +02:00
e69c02a392 cmake fix full debug builds on msvc 2016-04-05 10:36:11 +02:00
4960006b27 Fix T47985: VSE GL-render scene strip hangs
Regression in d5f1b9c22,
threading deadlock rendering a scene from the OpenGL preview.
2016-04-05 10:36:11 +02:00
e4b1b00884 Fix T47983: Particles - Emit from Verts emits double on one vert.
When non-random, particle distribution used a small start offset (to avoid
zero-weight faces), which is fine with "continuous" entities like faces, but not
for discrete ones like vertices - in that case it was generating some undesired
"jump" over a few verts in case step was small enough
(i.e. total number of verts/particles was big enough).
2016-04-05 10:36:11 +02:00
96b9f45d7a Partly fix (unreported) particles not updating correctly when changing settings.
Point-cached particles (those using simulations) would not update at all outside of
first frame, due to PSYS_RECALC_RESET flag being ingnored in `system_step()`...

For some mysterious reasons, udate is still non-fully functional outside of startframe
(e.g. changing face distribution between random and jittered), but at least when choosing
'Vertices' you get particles from verts and not faces!
2016-04-05 10:36:11 +02:00
4fc9178af9 CMake cleanup target_link_libraries_decoupled 2016-04-05 10:36:10 +02:00
357787b06b Fix T46623: OSX bpy.app.binary_path_python incorrect
CMake's PYTHON_EXECUTABLE wasn't set.
2016-04-05 10:36:10 +02:00
a80f3d7ddb Fix T48000: Eyedropper sample-merged ignored at first 2016-04-05 10:36:10 +02:00
97836b7250 Fix T47814: VSE Scene 'Use Sequence' fails
Conflict with flags between depsgraph and sequencer caused error.
Now pass state of sequencer parents to avoid recursion.
2016-04-05 10:36:10 +02:00
37a785241b Fix T47961: Wipe effects should have 2 inputs 2016-04-05 10:36:10 +02:00
2ad02b63e5 Fix T47967: Select next active fails in some cases
For cases when there are multiple matches,
find the closest match (with increasingly fuzzy tests) instead of failing.
2016-04-05 10:36:10 +02:00
d17f3c6d56 Fix T47987: Blender Cycles standalone does not properly read UV coordinates from XML 2016-04-05 10:36:10 +02:00
2265628964 Fix T47986: OBJ Import fails w/ imagepath encoding 2016-04-05 10:36:09 +02:00
261c12aab4 Fix T47958: Crash in Walk or Fly Navigation in Camera mode when invoking from non-3DView region 2016-04-05 10:36:09 +02:00
0f5ca755fc Fix T47969: Select Random always uses same seed
Increment the seed on each use,
otherwise calling again selects the same order, unless you manually adjust the seed.
2016-04-05 10:36:09 +02:00
611e544191 Fix T47972: Blender crash showing particle system.
Do same as with faces - if no orcodata is available, fill orco with current location...
2016-04-05 10:36:09 +02:00
8aed449528 Fix T47973: Render stamp ignores font alpha 2016-04-05 10:36:09 +02:00
f3259ae602 BLF: alpha support for drawing to buffer 2016-04-05 10:36:09 +02:00
49573b8e39 Fix T47931: Missed world shader update when having object dependency 2016-04-05 10:36:09 +02:00
edb1cc6fa8 Fix T47697: Smoke simulation doesn't work in viewport
Seems to be a division by zero error.

Should be safe for an upcoming 'a' release.
2016-04-05 10:36:09 +02:00
ee128c348f Fix T47962: It's possible to set a Sound strip as a modifier Mask. 2016-04-05 10:36:08 +02:00
18029edf1f Fix T47758: rigidbody bug with constraint breaking and disable collisions.
This is a regression in Bullet, reverted the problematic change for now with
a custom patch.
2016-04-05 10:36:08 +02:00
fa429b3f0c Fix T47668: Cycles OpenCL glass not rendering correctly on AMD.
Work around what appears to be a compiler bug.
2016-04-05 10:36:08 +02:00
7ea29d69df Fix T47935: Hair particles; The display percentage parameter breaks after a render is done.
Follow same logic in `psys_render_restore` as in `psys_render_set` - if hair and
display percentage is not 100%, we have to recompute particles...

With regular 'emitter' particles just hiding some is fine (though using random here
will not give a precise proportion...).
2016-04-05 10:36:08 +02:00
61aea37d35 Fix T47951: UserId problem on reload.
readfile.c would increment object usercount in three places, where it should not.
Remember kids: Objects are **only** refcounted by Scene's bases, and Object->proxy!
2016-04-05 10:36:08 +02:00
8aefea0c3a Fix Cycles debug panel, being shown in BI as well. 2016-04-05 10:36:08 +02:00
721f0089aa Fix T47928: Crashing save corruption with dynamic paint drip effector groups.
Dynapaint's `foreachIDLink` was mnot handling effector_weights->group pointer...
2016-04-05 10:36:08 +02:00
70d417cbe8 Revert "Fix T47263: numpad4/6 rotates around worl Z axis and not view Y axis."
This reverts commit fe0ca82b23.

This is a design issue, needs more thinking, for now just revert back to old behavior.
2016-04-05 10:36:08 +02:00
1af7bf3a20 Fix T47910: Knife project fails
Regression in fix for T43896, using screen-space precision here is very problematic,
using lower precision here works for both reports.
2016-04-05 10:36:07 +02:00
9a7d576332 Fix T47838: Walk gravity fails w/ intersecting objects
Regression in 3ad0344, fix from @mano-wii.

More comprehensive fix can be done after 2.77a.
2016-04-05 10:36:07 +02:00
5bfa814dcb Fix T47900: VSE adjustment crashes on blank frame 2016-04-05 10:36:07 +02:00
d21ed9af21 Fix T47893: BGE crashes w/ generated mesh data 2016-04-05 10:36:07 +02:00
e71398f3c7 Fix T47890: Vertex mask w/ subsurf select fails
Regression in GL refactor
2016-04-05 10:36:07 +02:00
744ef820d1 Fix incorrect strncat use 2016-04-05 10:36:07 +02:00
f601a4b4f7 Fix T47830: Multi-edit w/ ui-list wont highlight
Regression from 4d6b892.
2016-04-05 10:36:07 +02:00
0889f8c127 Fix for crash of point density textures due to undefined point_data on loading. 2016-04-05 10:36:06 +02:00
a3ef7c986c Fix add mesh template 2016-04-05 10:36:06 +02:00
Philipp Oeser
5ac7186633 Fix T47842: UV sculpt brush widgets are available when not in uv sculpt mode.
rB5b3af3dd made the poll function here slightly too laxist.

To be backported to 2.77 should we make an 'a' release.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D1861
2016-04-05 10:36:06 +02:00
7a7b242007 Fix T47862: VSE hard cut fails
Regression caused by changing how video length is calculated,
however similar problems could be caused by strip length changing on-disk.
2016-04-05 10:36:06 +02:00
f036e1875f GPU: avoid redundant logic for non-spot lamps 2016-04-05 10:36:06 +02:00
7e29ce8e96 Fix for non spot lamps calculating spot values
Logical error in D1378, also incorrectly used lamp type as a flag.
2016-04-05 10:36:06 +02:00
a5bc674e88 Include requests' cacert.pem file
This allows us to verify certificates of HTTPS connections, which is
mandatory for logins like on Blender ID.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1845
2016-04-05 10:36:06 +02:00
4717824f55 Fix T47670: cycles GLSL incorrect normal map node. 2016-04-05 10:36:06 +02:00
4f3178e4a5 Fix T47670: cycles GLSL incorrect layer weight / fresnel.
World space and view space normals were mixed up, we should only convert from
world to view space if a custom normal is connected, otherwise it is already in
view space.
2016-04-05 10:36:05 +02:00
a8ee74ed61 fix for rare crash at loading stored constraints
added a null pointer check so to prevent a crash atleast
2016-04-04 10:54:19 +02:00
d7eeff23bf another fix attempt for occasional loading crashes 2016-04-01 16:30:46 +02:00
47adafe20d fix, forgot to set userpointer in point constraint 2016-04-01 09:46:58 +02:00
0ba11ae9b1 fix, forgot to load participating constraints per meshisland
this caused crashes when trying to simulate with percentage breaking
2016-04-01 01:53:56 +02:00
e62c4c822b fix attempt for crash on loading last blend (quit.blend with dynamic fracture) 2016-03-31 21:36:01 +02:00
790af966a3 crash fix for loading files with dynamic fracture enabled
forgot to set runtime listbase pointers of fractureIDs to NULL
2016-03-31 20:07:07 +02:00
b26e1ad0f1 fix for occasional crashes with dynamic fracture while freeing the modifier
crash happened with scene objects which had a freed rigidbody world but didnt set the pointer to NULL.
2016-03-31 13:19:14 +02:00
7befec292b fix for loading splitshards to island blends and clusters properly
was necessary to skip "empty shards" properly and keep cluster index
2016-03-31 11:27:06 +02:00
8c70dd87c6 a bit clean up and attempt to reduce dynamic fracture memory leaks 2016-03-30 23:09:52 +02:00
603b9dfbe9 dont suppress undo save/load with dynamic any more
this seems a bit more stable, but does crash occasionally too, and may even
corrupt the blend. Workaround, open with official blender and FM is gone, save
and blend should be usable again.
2016-03-30 15:17:54 +02:00
d3cdd5c237 fix for different constraint behavior after refracturing / reloading / param change
constraint enabled flags were changed during sim and next sim started with pre-broken
constraints this way... thus different behavior.
2016-03-30 15:05:21 +02:00
fc5ffd9694 store constraints for prefractured mode now too in blend
this automatically creates constraints from scratch as fallback for older files
2016-03-30 10:24:08 +02:00
9c79a5151e Fix T47758: rigidbody bug with constraint breaking and disable collisions.
This is a regression in Bullet, reverted the problematic change for now with
a custom patch (backported to Fracture Modifier)
2016-03-30 10:21:20 +02:00
dce55610df allow multiple dynamic destruction with extra particles or verts
this should allow triggered dynamic destruction with different colliders at different times. Note: WIP and crashes often in relation with undo
2016-03-29 15:24:13 +02:00
536578a189 fix attempt for some dynamic fracture rotation glitches 2016-03-27 23:19:32 +02:00
738bcd8a0c fix: crash when removing FM, ob->derivedFinal can become NULL in this case 2016-03-27 15:12:47 +02:00
3e2ed11690 keep objects completely intact with compounds and stability factor = 1 2016-03-27 15:11:46 +02:00
e1e6e2d04b stability factor should now influence overall stability of object more directly.
This should allow to control breaking behavior of the compounds better.
As before the masses still have the biggest influence to the breaking behavior, followed by thresholds and
connection count per shard.
2016-03-26 18:50:39 +01:00
45dbc3d19c attempt to make compounds a bit more predictable, they should work now when colliding with passive objects too 2016-03-26 16:07:04 +01:00
cfec6debb6 removed a double bad level call stub, found by jensverwiebe, thanks :) 2016-03-21 16:04:53 +01:00
3990ee1bb8 Merge remote-tracking branch 'refs/remotes/origin/blender-v2.77-release' into fracture_modifier
Conflicts:
	source/blender/windowmanager/intern/wm_operators.c
2016-03-21 11:39:38 +01:00
22a2853b5d Blender 2.77: Point submodules to an updated hashes 2016-03-18 17:34:06 +05:00
870f911e36 Revert "Fix button display clamping values"
This reverts commit e4e21480d6.
2016-03-18 16:45:58 +05:00
4522ee109b Blender 2.77; We are now at release cycle 2016-03-18 16:43:43 +05:00
fc37440216 Sequencer: expose GL preview alpha in scene UI
While this isn't essential, accessing this setting required navigating to each scene and using render menu.
Expose in sequencer UI for more convenient access.
2016-03-18 15:44:39 +05:00
6f49d970e0 Fix T47818: GPencil Sculpt Brush settings update when adjusted using scrollwheel while sculpting 2016-03-18 15:44:25 +05:00
4e53ca9ed2 Fix T47760: Toggling GPencil's "Selection Mask" via Python does not update UI
Add rna updates to greasepencil sculpt properties

D1849 by @lichtwerk, reviewed by @aligorith
2016-03-18 15:44:25 +05:00
48ae702c3c Fix missing 'anim_data' in RNA API of Freestyle's linestyle.
Reported by Manuel Rais on ML, thanks.
2016-03-18 15:44:25 +05:00
2b0f0ffe0a Fix T47763: 2.77 RC2 (Fluid) Particle Baking slower compared to 2.67b.
Static schedule was responsible here...

Also, made a minor optimization in case adaptative (auto) subframes are enabled,
gives a few percent of speedup here.
2016-03-18 15:44:25 +05:00
1e5c7e7a0d Fix T47807: Toggle header shortcut doesn't work 2016-03-18 15:44:25 +05:00
bbaffd7ede Fix T47759: Mesh 'Select less', leaves isolated verts
Select less in mesh edit-mode would leave selected vertices/edges
in edge/face mode which don't support selecting these elements.
2016-03-18 15:44:24 +05:00
bcfa73dfd3 Fix T47784: BMesh.from_object broken keyword args 2016-03-18 15:44:24 +05:00
4bb12140e3 Fix T47772: Randomize stroke has direction bias 2016-03-18 15:44:24 +05:00
e100a8598f Fix T47788: Symmetrize flips multi-res data
Symmetrize was unusable with multi-res data,
add an option for the bmesh operator not to flip the multi-res depth.
2016-03-18 15:44:24 +05:00
f0e52274ad Correct UI active state w/ bevel-factor
D1838 by @JacquesLucke
2016-03-18 15:44:24 +05:00
e511c7a34e Fix/workaround T47685: Drag keymap slider fails
This is a special case where the UI update function re-creases the keymap we're currently editing.
Making it so dragging values fails.
2016-03-18 15:44:24 +05:00
3d1f050608 Fix crash loading some library blend files
Blend files with screen but no scene would crash.
2016-03-18 15:44:23 +05:00
90758ed2e8 Fix T47827: Single Channel Preview Error
Fix by @sergey with own fix for big endian.
2016-03-18 15:44:23 +05:00
80b906cb31 Fix T47787: When performing operation 'Make single user' -> 'obj&data', object could be removed from group.
Similar cause as in T47482, we used to have poor handling of 'user_one' cases of ID usage,
leading to inconsistent behavior depending on order of operations e.g.

Here, was object used by a group but not linked in any scene - once linked in scene,
their usercount would be 2, leading to 'making single copy', when it's actually not needed.
We now have better control here, so let's use it!

Note that other ID 'make single user' code will likely need similar fix (Images, etc.).

Safe to be backported to 2.77.
2016-03-18 15:44:23 +05:00
8b49fa29ca Fix T47785: Rendering Crash, Node Connector Crash, Changing Editors Crash
Regressions after 2.76, to be backported to 2.77.
2016-03-18 15:44:23 +05:00
6d4f51212b Fix T47773: Particle System with Boids Crash.
Problem was, during initialization of boids particles in `dynamics_step()`,
psys of target objects was not obtained with generic `psys_get_target_system()`
as later in code, which could lead to some uninitialized `psys->tree` usage...

Think it's safe enough for 2.77, though not a regression.
2016-03-18 15:44:22 +05:00
ab44c20409 Fix bad UI range of convergence distance which was above the hard limit
That was rather confusing to slide the value.

Perhaps makesrna can check cases like this?
2016-03-18 15:44:22 +05:00
45b0e93b2e Cycles: Do no limit viewport samples to USHRT_MAX when value is at 0.
We don't limit manually setting higher values, this was probably overlooked here.

Found by @Blendify in IRC.
2016-03-18 15:44:21 +05:00
34510e3cce Fix crash adding EditNormals modifier to NURBS object (or other types but mesh).
Kinda stupid, but that eModifierTypeFlag_AcceptsCVs could really use a comment alongside
its definition!

Safe to be backported to 2.77.
2016-03-18 15:44:21 +05:00
de80ecc8fb Fix T47753: World equirectangular regression
D1729 fixed 'View' projection but broke 'Equirectangular'.

This commit also changes equirectangular projection to match Cycles and the viewport.
2016-03-18 15:44:21 +05:00
fc2f0a1a25 Fix T47749: Crash subdividing wire edge w/ mdisps 2016-03-18 15:44:21 +05:00
d402611c1d CMake: remove OSX version lookup table
This assumed the OSX SDK version matched the OSX version, which isn't always true.

Also problematic for maintenance and would make building older Blender versions on OSX fail.

Passing in pre-defined OSX_SYSTEM is also supported,
if you have multiple and want to select one.
2016-03-18 15:44:20 +05:00
6ebd48f353 Skip scopes update for render result during rendering 2016-03-18 15:44:20 +05:00
7268e6c58f Fix T47681: Bump node doesn't work with SSS shader when using OSL 2016-03-18 15:44:20 +05:00
Julian Eisel
c20bcba363 Fix T47706: 'CTRL ALT Left Mouse' clicking on the dope sheet summary line crashes Blender
Simple NULL-check seems fine here, working as it should now. Most likely caused by rBc4dc14b079d81.
2016-03-18 15:44:20 +05:00
1e2c8ca6ea Fix T47688: Regression in gl_load
Error caused by 771f73b6
2016-03-18 15:44:20 +05:00
88a3b68610 BMesh: avoid assert dissolving degenerate faces
For dissolving 2-sided faces, theres no need to check they are valid before removal.
2016-03-18 15:44:19 +05:00
1e1118e7e7 Blender 2.77: We are now RC2 2016-03-04 22:08:19 +05:00
1e7458258c Blender 2.77: Point translations submodule to updated branch 2016-03-04 22:03:16 +05:00
3636693612 Fix typo in 'Vietnamese' language label (must have sneaked in while adding Basque one, grr). 2016-03-04 21:47:54 +05:00
7cd6a5c221 Fix T47683: broken BBox logic when drawing duplis.
Once a dupli had a valid bbox, that bbox would be used for all following objects
without bbox, instead of skipping clipping check.

Issue unveiled by rB3fa0a1a5bc0ff2, but not related at all (in fact, bug was present before that commit).
2016-03-04 21:12:00 +05:00
15ac4b4f9b Fix uninitialized memory use lattice-boundbox
Many other places weren't clearing boundbox dirty flag after calculation.
2016-03-04 21:12:00 +05:00
ce4a8210b3 Curve/line width change broke outline drawing
Partially revert e29a5ba6
2016-03-04 21:11:59 +05:00
Julian Eisel
67d310459d Fix T47674: "Change Data/Files" setting incorrect filter
Image filter was not set, but only if invoked from toolbar (image strip needs to be selected to see the button).
Caused by rB7fa72b8970, Wasn't aware there's another button for this for image strips.
2016-03-04 21:11:59 +05:00
b805b3735c Render Save Buffers: Use proper memory buffer size for a display buffer 2016-03-04 21:11:59 +05:00
ff32f81fd2 UI: move checkbox for missing add-ons to LHS 2016-03-04 21:11:59 +05:00
a78d679ddd Fix RNA property clamp assigning in Python
On first assignment the value was clamped, but successive assignments weren't.
2016-03-04 21:11:59 +05:00
5cbd14241f Edit Mesh: Edge tag toggle when no active path is found
User request, this matches 2.6x behavior more closely.
2016-03-04 21:11:59 +05:00
c82e6fe80b PyAPI: correct function name w/ arg parsing 2016-03-04 21:11:58 +05:00
50f188814f Fix T47676: Broken default values for particle brush strength.
Current startup .blend has old (percent?) values for particle brush strength.

Since rBe4e21480d6331903c90ab073746484498441e1ac, UI controls do not clamp automatically values anymore,
which means when you first enable comb (or any other brush) you get a 50 strength, waaaayyyy to powerful.

This commit fixes this in `BLO_update_defaults_startup_blend`, note that it does not fix custom users'
startup files, nothing to do here...
2016-03-04 21:11:58 +05:00
b00822e42d Fix T47644: crash (use-after-free) regression from rB7a74738914a66e.
Handling `me` data here is not good idea anyway, we override it completly with data
from `tmp` (crash came from freeing already existing bb from me, while pointer still existed in tmp).

(rediscovered it while working on T47676...).

To be backported to 2.77.
2016-03-04 21:11:58 +05:00
67b16c6170 Fix T47564: Unwrapping the same mesh results in different UVs.
Pointers of faces were passed as face keys during parametrizer's face creation. Since those
addresses were different for every run, the layout of the faces ended up being different
in the internal hash, leading to inconsistent order of their evaluation during LSCM solving,
and slightly different UV maps.

Solved by simply using faces' indices as key instead, which ensures we always get same results
with exact same input data now.

Many thanks to Roman Nagornov (RomanN) for raising the issue, investigating it and finding
the solution! And thanks to Brecht for quick review too.
2016-03-04 21:11:58 +05:00
3382ba0238 Cycles: Fix wrong default value for volume samples 2016-03-04 21:11:58 +05:00
d1efd44c1d Fix assert in UI code
Dont attempt to clip empty string
2016-03-04 21:11:57 +05:00
198700a36d Fix T47642: Crash baking w/ cycles 2016-03-04 21:11:57 +05:00
322fa27829 Fix T47635: Texture paint performance regression
Flipped bindcode check in D1414 caused projection paint to always do full updates.
2016-03-04 21:11:57 +05:00
562a488fb0 Add Basque (Euskara) new language.
Nothing critical, but would be nice to backport this to 2.77.
2016-03-04 21:11:57 +05:00
0c32f755a6 Fix T47643: Blender crash. Linked speaker issue.
Speaker's localization func would not make direct-linked its used sound datablock...
2016-03-04 21:11:57 +05:00
aa177d48c7 Fix T47638: Bad auto-smooth value for new meshes
Code was using degrees as radians.

Still unclear why default cube will have 180 degrees angle, but new meshes 30,
but that's kinda separate topic which is to be addressed separately.

This is a subject for final 2.77 release.
2016-03-04 21:11:57 +05:00
6a97b9c4a2 Fix (unreported) crash when opening a file from splash screen when 'load UI' option is disabled.
See rB935e241fa6ea095493 for details of the issue, but first fix caused regression T47632.

So for now handling the issue in a localized way, this is not a real solution (since this could happen
in other cases), but will do for 2.77.

This commit is to be backported to 2.77.
2016-03-04 21:11:57 +05:00
01485b389a Fix T47632: Revert "Fix (unreported) crash when opening a file from splash screen when 'load UI' option is disabled."
This reverts commit 935e241fa6.

Issue will be fixed in a more localized way for now (not that nice, since this use-after-free can possibly happen
in other places too, but only safe solution for 2.77).

This commit is to be backported in 2.77.
2016-03-04 21:11:57 +05:00
91457def83 Fix T47604: Sculpt + Modifier undo gives invalid normals 2016-03-04 21:11:56 +05:00
28e4f8eb5c Fix T47615: crash trying to use point density with lamp object. 2016-03-04 21:11:56 +05:00
550215a65e Cycles: Fix compilation error of certain OpenCL split kernels 2016-03-04 21:11:56 +05:00
77f96266e8 Fix T47608: Cycles cage baking crash after recent uv derivative fixes. 2016-03-04 21:11:56 +05:00
42fd804cca Fix T47605: Elsyiun theme info text hard to read 2016-03-04 21:11:56 +05:00
2d5343cd92 Fix T47582: Curve handle thickness regression 2016-03-04 21:11:56 +05:00
86bb5f70d6 Fix T47586: Nurbs handle thickness regression 2016-03-04 21:11:56 +05:00
9fcc849aa3 Fix T47583: Mesh wire edge thickness regression 2016-03-04 21:11:55 +05:00
9867042ab0 Fix T47592: Wrong line width w/ custom-bones 2016-03-04 21:11:55 +05:00
2c3c8fbaed Docs: early exist build process on error
Don't attempt to build docs when generation fails.
2016-03-04 21:11:55 +05:00
02b0f51164 Docs: Add missing context members 2016-03-04 21:11:55 +05:00
61e848280e Fix T47596: Bone motion path - confusing UI in 3DView tools.
Now using same UI as in object/armature properties, also save one line in 3DView panesl. ;)

Nothing crucial there, but nice & safe to backport to 2.77 imho.
2016-03-04 21:11:55 +05:00
e956ebd0f9 Fix T47593: 'Move to layer' will be crash in blender 2.77rc1.
To be backported to 2.77.
2016-03-04 21:11:54 +05:00
43429578d3 fix, should need to fracture only once now in case you enable split shards to islands with constraints or clusters on 2016-03-01 20:36:36 +01:00
9c33f3db3f partial fix for suddenly missing self-collision of shards of the same object, this happened even after converting to regular rigidbodies when disable collisions was active ! (so this is now off by default) 2016-03-01 18:27:42 +01:00
66ffb880bc fix for loading inner vertex groups and set min weight for passive vertexgroups to 0.01, just keeping it > 0 did not yield correct results when passive vertexgroups were used 2016-02-28 10:24:37 +01:00
1b85ceabc5 fix for loading files, need to skip "empty" shards which dont have any mesh info because they didnt intersect with the original geometry, before this each meshisland stored a temp shard, now we lookup shards out of the shard map instead, but this could point to such empty shards, leading to incorrectly loaded files. 2016-02-27 14:06:33 +01:00
b594b25dad Fix: "Twist" GP Sculpt brush in 2D Editors was unusable... now mostly usable, if still slightly offset 2016-02-26 13:32:47 +01:00
9c474b187a Fix: "Twist" GP Sculpt brush didn't work well in 3D View 2016-02-26 13:32:44 +01:00
4df911aa58 2.77 splash
by Pokedstudio
2016-02-26 12:53:40 +01:00
00ca17acaa Blender 2.77 release: Point submodules to a release branches 2016-02-26 12:12:11 +01:00
f0f38731db fix for wrong transformation of shards after loading (and fix for potential crashers while loading) 2016-02-21 19:53:04 +01:00
3db5b76201 compile fix after merge 2016-02-21 13:27:46 +01:00
1c09344dba Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier
Conflicts:
	CMakeLists.txt
	SConstruct
	build_files/build_environment/install_deps.sh
	build_files/scons/tools/Blender.py
	build_files/scons/tools/btools.py
	extern/CMakeLists.txt
	extern/SConscript
	extern/bullet2/CMakeLists.txt
	intern/cycles/blender/blender_camera.cpp
	intern/cycles/blender/blender_texture.cpp
	intern/cycles/kernel/geom/geom_triangle_intersect.h
	intern/cycles/kernel/kernel_compat_cpu.h
	intern/cycles/kernel/svm/svm_voxel.h
	intern/cycles/util/util_path.cpp
	intern/ghost/intern/GHOST_ContextGLX.cpp
	intern/iksolver/intern/IK_Solver.cpp
	release/datafiles/locale
	release/scripts/addons
	release/scripts/startup/bl_ui/space_userpref.py
	source/blender/blenkernel/BKE_blender.h
	source/blender/blenkernel/BKE_bvhutils.h
	source/blender/blenkernel/SConscript
	source/blender/blenkernel/intern/DerivedMesh.c
	source/blender/blenkernel/intern/armature.c
	source/blender/blenkernel/intern/cdderivedmesh.c
	source/blender/blenkernel/intern/editderivedmesh.c
	source/blender/blenkernel/intern/image.c
	source/blender/blenkernel/intern/mesh_remap.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/blenlib/intern/string.c
	source/blender/blenloader/intern/readfile.c
	source/blender/editors/interface/interface.c
	source/blender/editors/interface/interface_handlers.c
	source/blender/editors/mesh/editmesh_knife.c
	source/blender/editors/mesh/editmesh_select.c
	source/blender/editors/object/object_bake_api.c
	source/blender/editors/space_graph/graph_ops.c
	source/blender/editors/space_outliner/outliner_intern.h
	source/blender/editors/space_outliner/outliner_tools.c
	source/blender/editors/space_sequencer/sequencer_edit.c
	source/blender/editors/space_view3d/drawmesh.c
	source/blender/editors/space_view3d/drawobject.c
	source/blender/editors/transform/transform_conversions.c
	source/blender/editors/transform/transform_input.c
	source/blender/editors/transform/transform_snap.c
	source/blender/makesdna/intern/makesdna.c
	source/blender/makesrna/SConscript
	source/blender/makesrna/intern/SConscript
	source/blender/makesrna/intern/rna_modifier.c
	source/blender/makesrna/intern/rna_nodetree.c
	source/blender/makesrna/intern/rna_rigidbody.c
	source/blender/modifiers/SConscript
	source/blender/python/mathutils/mathutils_geometry.c
	source/blender/render/extern/include/RE_render_ext.h
	source/blender/render/intern/source/bake_api.c
	source/blender/render/intern/source/pipeline.c
	source/blender/render/intern/source/pointdensity.c
	source/blender/render/intern/source/renderdatabase.c
	source/blender/windowmanager/WM_api.h
	source/blender/windowmanager/intern/wm_files.c
	source/blenderplayer/bad_level_call_stubs/stubs.c
	source/gameengine/Ketsji/BL_Action.cpp
2016-02-21 13:27:17 +01:00
eca5449a29 change: let fluid move down across other modifiers in case it will be added after fracture which has a couple of other modifiers above it (exception for fluid only, since it can handle shards) 2016-02-11 11:55:30 +01:00
1051f71291 fix for material loading in FM external mode and generally decreased file loading times, especially noticeable with large FM objects, by using sorted fd->datamap in readfile.c (avoids linear search) 2016-02-09 17:45:34 +01:00
ca21fc8b55 fix, forgot to activate plastic connection handler in external mode 2016-02-08 21:49:40 +01:00
f66e70a855 fix for external mode material collection function 2016-02-08 17:24:51 +01:00
00ccb99a67 fix for name and indexbased meshisland and meshconstraint lookup via python inside the FM 2016-02-05 12:29:23 +01:00
9c744358a5 fix: there was a speed regression when building many constraints during fracture or after loading 2016-02-04 23:14:10 +01:00
80def34da1 some more mutex locking for dynamic fracture, there still were crashes when interactively moving dynamic objects during running sim 2016-02-04 20:19:57 +01:00
25057ba379 added threading lock to modifier sync during rigidbody object sync, helps against crashes in dynamic mode 2016-02-04 19:53:45 +01:00
2b0a6aa5bc improved output of constraint impulse visualization a bit, included name, impulse and threshold as well as attempted to offset strings at same position 2016-02-03 19:37:54 +01:00
03db2ca8e7 windows compile fix 2016-02-03 16:14:28 +01:00
5a834c1608 added constraint impulse visualization (very basic only) and reworked the mesh constraint name system 2016-02-03 14:46:31 +01:00
55b2d46f15 compile fix for windows and mac 2016-02-02 15:47:06 +01:00
b1e4964ede added basic physics visualization for viewport rigidbodies like in game engine (its optional and can be turned off) 2016-02-02 14:01:46 +01:00
9e9bbed144 ignore individual mesh island transforms in rigidbody system again and just re-apply them when converting back to objects, it just caused trouble and brought not the expected result 2016-02-01 14:02:30 +01:00
509bf61c21 fixes for: did assume autohide material was always at number 1, did change to find inner material number, own verts transformation bug, shards to islands delay bug (needed to click twice before), and some crashers with dynamic and prefractured as well as reduced a memoryleak in prefracture mode 2016-01-31 22:45:30 +01:00
87f895311f some more effort to make FM simulation results looking closer to BCB simulation results 2016-01-31 01:59:35 +01:00
12f7fd5a08 attempt to reduce a memoryleak 2016-01-30 16:42:34 +01:00
03a4109930 exposed bullet tick callback to bpy.app.handlers, also wrapped the passed timestep into the rigidbody world, so it can be accessed too 2016-01-30 16:03:26 +01:00
b85da312f0 fixes for dynamic and external mode, in external mode each simulation run should be consistent with the prior ones now 2016-01-30 15:57:56 +01:00
819bc74e22 fix, small typo in appliedImpulse soft limit (read only) 2016-01-29 11:11:37 +01:00
c073d7cf60 added appliedImpulse() to regular constraints too 2016-01-28 23:30:39 +01:00
0c4939c013 added a RNA function to read the appliedImpulse from each constraints live, during simulation (slow when done from a python frame handler over all constraints) 2016-01-28 23:04:12 +01:00
39e00e5959 fix: dynamic mode didnt work at all anymore and has still some issues like flickering after baking and a crasher on exiting blender, also testwise enabled autoexecute on prefracture during sim 2016-01-28 21:01:14 +01:00
0ab52e7f51 fix: added extra update call on hook object in custom modifier evaluation 2016-01-27 23:46:38 +01:00
84696d3c75 fix: forgot to accumulate differences of multiple hook modifier changes 2016-01-27 21:58:08 +01:00
d5d33dbd40 fix: fake parenting in testfile didnt work anymore after fake hook was added to code, now both should work depending on whether the kinematic flag is set (=parenting) or not (=hook, if vertexgroup and hookmodifiers are used) 2016-01-27 21:19:05 +01:00
45435120f3 fix for silly brace mistake, which led to crash with fracturing a default cube 2016-01-27 20:08:21 +01:00
bcc260c778 improved the fake hook system, should behave now exactly as a regular hook and added some FM code comments to plan further work. 2016-01-27 18:23:15 +01:00
2cbd8c9d44 added handling of vertexgroups and a fake hook system inside the FM, so passive shards can be influenced by hook modifiers via vertexgroups. 2016-01-26 21:34:05 +01:00
5ad7a248a3 fixed two crashers: 1) when object had no material, that assignment failed. 2) constraints with empty meshislands crashed too 2016-01-26 01:03:12 +01:00
0adaddd4c4 fix for passive parenting hack, it was not taken into account after transforming the object interactively 2016-01-25 17:58:27 +01:00
1dd3595443 added a fake parenting for passive shards, those are simply moved with the object itself, so you can parent the entire object and have exact motion data in the passive shards 2016-01-25 17:47:18 +01:00
e29680e0e2 forgot to take some rigidbody settings into account during object conversion 2016-01-24 19:11:03 +01:00
6efacde5c0 fix for possible rotation glitch when converting back to objects 2016-01-24 17:46:35 +01:00
7023be40be fix for Fracture Modifier to object converter (external mode), not all settings were taken into account, and object disappeared when not being on startframe, but as converting mid-sim yields unexpected results, still limiting conversion to startframe, added a notification for this 2016-01-24 17:18:28 +01:00
d50a3d7097 added dynamic threshold adaption in case of changing timesteps for plastic constraints, also enabling plastic constraints in case they enter plastic state now 2016-01-24 15:51:13 +01:00
62ac065a4c fix for windows only: avoiding changing the global locale avoids slowdown in windows string operations 2016-01-24 13:02:34 +01:00
e476e50b61 fix: spring constraints were not created properly while setting up the simulation 2016-01-24 00:57:17 +01:00
90b76659ca some more fixes to have proper plastic constraint support 2016-01-23 21:40:40 +01:00
0384b49e14 fix for material assignment to meshislands, dont create unnecessary material slots any more 2016-01-22 10:33:20 +01:00
50e308c19c taking now all constraint properties into account when converting back to objects 2016-01-22 01:56:31 +01:00
7b4a37b1b0 partial fix, take proper constraint locations and rotations into account when converting back to objects, but todo, take own object transform into account too 2016-01-22 00:36:14 +01:00
8e79bae2eb added names for meshislands, can now convert back to named objects, added load / save support (was missing) 2016-01-22 00:00:29 +01:00
3d36d357c2 fixes for the monitoring logic of plastic constraints, again 2016-01-21 19:42:27 +01:00
e2670b3814 fixes for correct rotation calculation in prefractured and external mode 2016-01-21 12:02:00 +01:00
7c3c6f8310 used more exact angle calculation method for external mode, different formulae for tolerances, and some cleanup of obsolete stuff. 2016-01-21 02:12:48 +01:00
7761311305 added material handling (so meshislands get correct materials from original objects) and added plastic tolerance values, which are taken into account with special simulation mode only. 2016-01-20 23:30:55 +01:00
340798fe56 reduced a performance bottleneck when adding many constraints in a loop, do not trigger modifier updates or set validate flags or even call bullet functions... but todo is to keep a useful update mechanism 2016-01-20 18:42:49 +01:00
b8c63aead5 avoid resetting cache (and iterating possibly through the rigidbody group) when adding mesh constraints 2016-01-20 00:40:22 +01:00
3553669d12 attempt to make mesh island packing faster when being called in a loop, create the dm only once after packing 2016-01-20 00:23:33 +01:00
35701ed26e crash fix in FM refresh operator (null pointer access) 2016-01-19 23:23:43 +01:00
982f94f269 rigidbody type on meshisland should be taken into account now properly and be settable, also adding new constraints should happen faster now (when called in a loop) 2016-01-19 21:20:28 +01:00
eb8af755dd further attempt to fix "plastic constraint" logic (external fracturing mode only) 2016-01-19 19:02:55 +01:00
dede676e90 implemented some special constraint breaking method further (plastic constraint breaking), for external fracturing mode 2016-01-18 21:59:07 +01:00
1ae8bcc8e6 exposed per-constraint breaking angle and distance to python (for external mode only, for now) 2016-01-18 19:55:10 +01:00
b800df49d7 fixed constraint restore with external fracture mode (using participants instead of jumping around in list, which messes up the iteration loop) 2016-01-18 18:03:20 +01:00
66242f5e76 constraints transformation fix, transformations are updated on validation now 2016-01-18 01:33:45 +01:00
df389e31d6 first successful simulation attempt with a bigger test data set, todo... set constraints relative to object , multiply with obmat during evaluation 2016-01-18 00:51:44 +01:00
8d58ffe0be extended FM python API: constraints have now settable locations and rotations, additionally there is an highly experimental constraint breaking mode (for external fracture mode ONLY) 2016-01-17 19:33:06 +01:00
f7fa6906e6 initial, basic python API for Fracture Modifier contents: mesh_islands and mesh_constraints are createable, removable externally prior to running the simulation (in special "External" fracturing mode) so you can pack objects into the modifier (as mesh islands) and set constraints to connect them. This can happen in immediate update mode or updating is done via refresh operator. You can also have read access for island data after simulation, to dump the results. 2016-01-17 16:14:48 +01:00
b1c3782c46 added activation by force, if force exceeds an adjustable threshold, kinematic rigidbodies get activated / triggered by a force field 2016-01-14 13:04:10 +01:00
84d8b15a18 set shards to passive if shard weight (average vertex weight) is > 0.0f instead of 0.5f, this allows to keep shards passive in case they dont get enough weightpaint (in case they are inside, and interpolation of weights is not enough) 2016-01-06 18:27:46 +01:00
d34550c126 fixes: lower stability factor now lets the object break earlier ( effect was inverted) and added uv_layer to fracture presets (was missing) 2016-01-05 15:55:20 +01:00
093a5501bf taking stability factor now into account at dummy constraint calculation for compounds, it influences search radius and limit now, too 2016-01-04 21:08:49 +01:00
9ad72754c6 attempt to get more control over compound destruction behavior during simulation, with stability factor; recursive breaking of neighborhood happens if one connection breaks 2016-01-04 19:46:13 +01:00
f1981b3cfc partial fix for displacement / autohide flicker problem, happens now only with automerge (occasionally) and with automerge + fix normals (regularly), but for displacement and glass you mostly need only autohide; automerge and fix normals are for smooth objects where cracks should be nearly invisible (after fracturing) 2015-12-30 20:47:25 +01:00
24ff36d84b added an autohide filter group, its helpers can be used to animate revelation of cracks which are hidden otherwise. This is basic revelation functionality via object locations and sizes only. 2015-12-28 15:04:07 +01:00
d8b561de76 fix: make sure a rigidbody exists on each mesh island after loading when trying to access it 2015-11-29 19:59:47 +01:00
5d554ca7ea enabled trigger in dynamic fracture again, fix for cache stopping problem as well 2015-11-10 09:54:55 +01:00
2ea86a8817 fix for dynamic fracture rotation glitch (was wrong calculation) 2015-11-09 10:59:46 +01:00
5f796ef1ef attempt to fix customdata related memoryleak... it has been reduced, but isnt completely gone yet 2015-11-06 12:55:58 +01:00
e237ef3a40 minor fix for removed fracture setting in preset 2015-11-04 18:07:30 +01:00
e141527ddb Merge remote-tracking branch 'refs/remotes/origin/blender-v2.76-release' into fracture_modifier
Conflicts:
	release/scripts/addons
	source/blender/windowmanager/intern/wm_operators.c
2015-11-04 18:01:12 +01:00
0076ba4833 deactivated the unfinished multiple fracture settings per object for now, didnt work properly 2015-11-04 15:21:27 +01:00
ca18f5ddd4 added inner uv map setting, which will contain only inner face's UVs, useful for texture based inner smoke in conjunction with fracture modifier 2015-11-04 15:05:19 +01:00
f337feaf5a BLender 2.76: We go 'b' series now 2015-11-03 15:56:35 +05:00
936a685ea8 Don't expand toggle brush on linking
Toggle brush is more a runtime only feature, not really supposed to be used
as real ID linking as it's done for modifiers i.e.
2015-11-03 15:49:54 +05:00
b8438a870d Fix T46626: Crash generating previews
Brush.toggle_brush was allowed to be an invalid pointer,
it worked for the one operator that used it - but in general bad practice,
requiring a lookup on every access.

Ensure the pointer is kept valid now.
2015-11-03 15:49:38 +05:00
e5ccc1e19d Fix/workaround T46622: crash w/ metas & particles
Metas are scanning all scenes duplis,
which can go into particle systems without an initialized derived-mesh.

For now just do NULL check, its not correct but real fix is not fitting well with current design.
2015-11-03 15:49:18 +05:00
3c54514354 dynamic fracture should be bake and saveable now, but still has rotation glitches and glitches with change in mesh island sequence. 2015-11-02 14:12:15 +01:00
d7daecccbd Fix T46651: Select linked crash w/ wire seam edges 2015-10-31 19:26:47 +11:00
b611bdb629 Revert "Fix T46494: Can't de-select a face w/ mixed modes"
This reverts commit 381501ab45.
2015-10-31 19:26:11 +11:00
c9cd41547c added basic support to clean up keyframes directly after converting to keyframed objects, but you need cache to bake so the operator can run again (and it will refracture automatically, too) 2015-10-30 19:12:17 +01:00
c794d87f12 optimization: when converting to keyframed objects, do not key passive shards any more (as they dont move anyway) 2015-10-30 11:46:51 +01:00
12e4da6c1a Fix T46507: Cycles baking re-orders face
Regression in 2.76, order of tessellated vertices needs to follow MFace tessellation.
2015-10-30 13:43:59 +05:00
de96d1acd1 Blender 2.76a: Fix CUDA compilation on 32bit platform 2015-10-29 20:11:22 +05:00
379a754b83 changed volume calculation method for convex hull and triangle meshes, mass fractions should be calculated more accurately now, but note, might change behavior of older simulations !!! 2015-10-29 15:58:27 +01:00
b5e4cc820b BLender 2.76a: Update addons submodule 2015-10-29 17:26:14 +05:00
bc9f118169 Set blender version to '2.76a' 2015-10-29 22:08:52 +11:00
74055fb813 Cleanup: quiet warning
Not cherry picked, just included for release build.
2015-10-29 21:32:47 +11:00
Dalai Felinto
b1eff080bd Temporary "fix" for crash when saving OpenEXR Multi-View from Image Editor 2015-10-29 21:10:17 +11:00
Dalai Felinto
c2337748e5 Fix T46617 File Output Node seems to save only black images into OpenEXR image data
If the node output had only one layer, it would be detected as singlelayer, and it would miss the blender exr header string
2015-10-29 21:10:17 +11:00
f30a270a70 Freestyle: Fix for 'Distance from Object' modifiers without a target object.
'Distance from Object' color/alpha/thickness modifiers without a target
object were raising a run-time exception although it is not considered an
error condition.
2015-10-29 21:10:17 +11:00
424ea476b1 Fix T44231: Freestyle causes crash on render.
The reported crash was confirmed as a segmentation fault in std::sort().
The cause of the crash was traced down to a binary comparison function
that was not satisfying the so-called strict weak ordering requirements of
the C++ standard sorting function.  Specifically, the comparison operator
has to return false when two objects are equivalent (i.e., comp(a, a) must
be false), but that requirement was not met.

Since the binary comparison operator in question could be a user-defined
Python function, here a safety measure is implemented in the C++ layer to
make sure the aforementioned requirement is always satisfied.
2015-10-29 21:10:17 +11:00
1823e56625 Follow up to previous commit, proper fix for T46284, incorrect Texture
shading in Texture paint mode and cycles
2015-10-29 21:10:17 +11:00
25beefa8dd Revert "Fix T46284: Texture paint, wrong shading mode"
Should fix T46616 but will reintroduce T46284.
The second, original bug needs different handling

This reverts commit 904db487a7.
2015-10-29 21:10:17 +11:00
887e5cb7b0 Fix T46605: Compositing causes access violation when rendering from command line
Seems was caused by the race condition in the stats printing, should be all fine now.

Nice for 'a' release.
2015-10-29 21:10:16 +11:00
4eb34dbc88 OpenSubdiv: Fix wrong handling of vertex parent
Vertex parent was not registered as CPU data requirement.

Should be in the 'a' release.
2015-10-29 21:10:16 +11:00
8026a1d543 Fix T46606: Trackball Rotate jumps releasing shift 2015-10-29 21:10:16 +11:00
13c473f707 Fix broken comment about our WM progress report for python (its not a progress bar at all). 2015-10-29 21:10:16 +11:00
c2e7f6d5b4 Fix T46604: Crash in ChainPredicateIterator instantiated without predicates.
Also fixed a potential crash in the copy constructor case.
2015-10-29 21:10:16 +11:00
349abb5f58 Freestyle: minor speed-up by omitting the calculation of the smallest edge size.
BlenderFileLoader tries to find the smallest edge size but the computed value is not used.
2015-10-29 21:10:16 +11:00
299f647004 Fix: Prevent warnings from popping up when trying to edit driver expressions from buttons
Previously, a warning was added to provide feedback to users trying to change the values
of driven properties why their edits would not have any effect on the propeerty. However,
it turned out that instead of only showing up when the user tried to increment/decrement/slide
the property's value, it was also firing everytime they were trying to edit the expression.
That however is not what we want at all!

This fix assumes that BUTTON_STATE_TEXT_EDITING is used for expression editing, and
BUTTON_STATE_NUM_EDITING (or everything else) refers to the user trying to adjust the
value normally.
2015-10-29 21:10:16 +11:00
1ce73aa72b Fix T46599: Copy Rotation behaves erratically when Use Y is disabled
When the "Use Y" option in the Copy Rotation constraint is disabled, the constraint
behaves eratically when rotating all the target on all axes at the same time.
This is partially to be expected due to the way that euler rotations work
(i.e. the rotation orders stuff - you should use a rotation order based on most to
least important/significant rotations). Hence, by locking Y, you're causing accuracy
problems for Z.

What was not expected though was that changing the rotation orders on the objects
involved (for the record, it's the constraint owner that counts) did nothing.
It turns out that for objects, the rotation order settings were getting ignored!
This commit fixes this problem, and this particular case can be resolved by using
"XZY".

Notes:
* Since all object constraints were previously working on the assumption that they
  used XYZ (default) order, it is possible that this change may have the unintended
  consequence of changing the behaviour of some rigs which relied on the buggy
  behaviour. Hopefully this will be a rare occurrence.
2015-10-29 21:10:15 +11:00
4081dab9d5 Fix: Missing update after scrubbing time in Graph Editor
Sometimes the timeline header didn't update after time-scrubbing in the graph
editor ends, leaving the "Pause" button visible until the next refresh of the
timeline (e.g. on mouse over)
2015-10-29 21:10:15 +11:00
ebc899790b Fix: X-axis values in Graph Editor should not be displayed as timecodes in "Drivers" mode 2015-10-29 21:10:15 +11:00
95cc31fdcd Fix error in bone UI 2015-10-29 21:10:15 +11:00
50ecd510bb Fix invalid exceptions w/ preview API
D1575 by @januz
2015-10-29 21:10:15 +11:00
ca51398fd8 Fix T46538: Mark and Clear Seam in UV Editor, assigning Hotkeys.
UV Editor keymap is not bound to a given editor (spacetype)...
2015-10-29 21:10:15 +11:00
ff5a34e370 Fix related to T46538: do not popup choice menu of mark/clear seam UV editor op invoke when prop is already set! 2015-10-29 21:10:15 +11:00
4aac73a86f Correct own error w/ snap-scale T46503
Don't use nan for comparisons.
2015-10-29 21:10:15 +11:00
d1c6364099 Fix ffmpeg memory leaks
- audio_stream wasn't freed.
- audio/video stream + context weren't freed on failure.
2015-10-29 21:10:15 +11:00
c01e9cefe1 Fix ffmpeg saving long paths
Was checking wrong length on string copy.
2015-10-29 21:10:14 +11:00
e54f38ebf0 Fix for error w/ RenderView in ImageView list 2015-10-29 21:10:14 +11:00
15364094d0 Fix snap-scale w/ axis constraint
Related to T46503,
fix only worked when the snap target was axis-aligned.
2015-10-29 21:10:14 +11:00
62a973db31 BGE: Fix T46556: check on null sound datablock pointer. 2015-10-29 21:10:14 +11:00
3f067c61a0 Cycles: Watertight fix for SSS intersection
Same as previous commit, just was missing in there.
2015-10-29 21:10:14 +11:00
673bc6d65a Cycles: Fix for watertight intersection
It was possible to miss some intersection caused by wrong barycentric
coordinates sign.

Cases when one of the coordinate is zero and other are negative was not
handled correct.
2015-10-29 21:10:14 +11:00
ce268f6005 Fix T46521: Python: bvh.ray_cast doesn't find a plane facing in the other direction under certain circumstances
The issue was caused by wrong sign check. It originally came from more optimized
Cycles code where because of other reasons it wasn't visible yet. But in fact it
should be solved there as well.
2015-10-29 21:10:14 +11:00
54f1e682c6 Fix T46569: Crash w/ mask & locked-track enabled 2015-10-29 21:10:14 +11:00
4d581c01cc Fix T46561: Crash in outliner delete hierarchy
When children & parents were selected in the outliner,
it attempted to free the the object twice.
2015-10-29 21:10:14 +11:00
e1f5433f1d Fix T46565: Movie render crash w/o permissions
Rendering to a path that didn't have write permissions would crash.

Also fix error where `G.is_rendering` was left set when rendering failed.
2015-10-29 21:10:13 +11:00
7d070f97ad Fix T46524: Use Alpha (Straight/Premultiply) option missing in 2.76, part II.
Different issue actually, here RAWTGA was simply forgotten in the alpha-capable formats...
2015-10-29 21:10:13 +11:00
e8b3ba2983 BGE: Fix physics meshes conversion with modifiers.
Previously meshes with modifiers were considerate as empty (no polys).
2015-10-29 21:10:13 +11:00
be4ee42e1c Fix T46544: Can't unpack generated image 2015-10-29 21:10:13 +11:00
bedc58ac4e BGE: Fix T46381 : last action frame not updated.
It fix T46381. Normally BL_Action::Update (manage action time, end, loop…) should be called the same number of times as BL_Action::UpdateIPO (update action position, scale ect… in the game object).
But the bug report shows that UpdateIPO is called one less time than Update. To fix it i revert the commit 362b25b382 and implement a mutex in BL_Action::Update.
Example file : {F245823}

Reviewers: lordloki, kupoman, campbellbarton, youle, moguri, sybren

Reviewed By: youle, moguri, sybren

Maniphest Tasks: T39928, T46381

Differential Revision: https://developer.blender.org/D1562
2015-10-29 21:10:13 +11:00
349609c743 Fix T46529: Unwrap UV w/ use-subsurf fails
Regression since moving to looptri.
2015-10-29 21:10:13 +11:00
60ad008162 Fix T46531: Cannot use % in filenames.
Same case as with space char really, one should not use those special chars in
filenames, but they are globally supported by all current FS/OS, so no real reason
to enforce that behvior on users here.

To be backported to 'a' release.
2015-10-29 21:10:13 +11:00
34def18764 Fix T46520: mathutils.bvhtree crashes with distance input.
Should be backported to 'a' release.
2015-10-29 21:10:13 +11:00
0afdd1139b Fix T46524: Use Alpha (Straight/Premultiply) option missing in 2.76 for DDS files.
All optional image format are not #define'd in submodules like DDS read/write code.
This means values of `eImbTypes` would not always be the same in all contexts, yuck!

This is a regression and should be backported to 'a' release.
2015-10-29 21:10:12 +11:00
59c1a96975 Fix T46429: Movie clip is deformed by resolution multiplier when offset is added in sequence editor. 2015-10-29 21:10:12 +11:00
f81ecf117f Fix broken CD_NORMAL interpolation callback (would generate non-unit vectors).
Even if the weights are normalized, the weighted sum of normalized vectors
usually does **not** give a normalized vector (unless all source vectors
are aligned).

This probably was not a big issue in most cases, since we usually interpolate
similar vectors here - but still!
2015-10-29 21:10:12 +11:00
cde725e26f Fix T46508: data_transfer of normals fails in case objects are transformed.
The final stage of the process (copying/interpolating new dst cddata from src cddata)
was simply broken in normal case, where we need to convert from source to destination
object space.

This patch is a bit verbose, but I cannot see how to avoid it really.

To think this code is in master since over 6 months and it only gets reported now... :/
2015-10-29 21:10:12 +11:00
42b6d843bd Mesh remapping: fix loop 'best matching normals' not using transform space.
Also, cleanup, reduce declarations of tmp_co/_no...
2015-10-29 21:10:12 +11:00
6c1b73c0da error in last commit 2015-10-29 21:10:07 +11:00
ff3913d1ec Fix for missing id_lib_extern, assigning ID's 2015-10-29 21:08:50 +11:00
dfba50bf6a Fix T46502: Linked dupli-group lost on reload 2015-10-29 21:06:42 +11:00
9a5d74a998 Fix T46503: Snap scale fails using corner pivot 2015-10-29 21:06:41 +11:00
40e69a6e95 Fix crash pressing +/- in file-selector
Filenames over 128 chars would crash.
Move BLI_newname into file_ops,
this was only used in one place and isn't all that re-usable.
Also remove special behavior for 4 digits.
2015-10-29 21:06:41 +11:00
ab6c7c5888 Fix crash w/ PlayAnim & long filenames
Paths >128 chars could crash.
Replace BLI_newname with direct BLI_stringenc/dec use which makes more sense in this case.
2015-10-29 21:06:41 +11:00
040c9ae55c Fix T46493: Wrong camera zoom blur with non-unit pixel aspect 2015-10-29 21:06:41 +11:00
381501ab45 Fix T46494: Can't de-select a face w/ mixed modes 2015-10-29 21:06:41 +11:00
7d25105290 Fix memory leaks in PlayAnim
Was never freeing filenames or pictures.
2015-10-29 21:06:41 +11:00
2f1bab75d7 Fix T46465: Lag scrubbing w/ PlayAnim 2015-10-29 21:06:41 +11:00
c1990affac PlayAnim: avoid list count setting frame from mouse 2015-10-29 21:06:41 +11:00
5acb0ba569 Fix T45900: Allow again white spaces in file names.
Should probably be added to 'a' release, should we do one...
2015-10-29 21:06:41 +11:00
ae1335f7cf Fix T46483: vertex/edge slide with correct UVs sometimes pinning UVs. 2015-10-29 21:06:40 +11:00
e5ee9d1eff Fix related to T46223: memory leak when loading multilayer multiview images.
Differential Revision: https://developer.blender.org/D1549
2015-10-29 21:06:40 +11:00
061f20112e Fix T46223: multiview image sequences crashing.
Differential Revision: https://developer.blender.org/D1549
2015-10-29 21:06:40 +11:00
7d31777d71 BGE: Fix animations update when scene is suspended. 2015-10-29 21:06:40 +11:00
50dd619e88 Fix T46487: OpenSubdiv objects are invisible in Blender Internal "Rendered" viewport mode 2015-10-29 21:06:40 +11:00
228625b9fb Fix T46453: JPEG quality not stored in file
This is a feature unique to jpeg that would store the quality it was saved.

- Use struct instead of bit-shifting.
- No longer store the 'flag'.
2015-10-29 21:06:40 +11:00
57d919c1ec Cleanup: remove historic, blender-only jpeg io 2015-10-29 21:06:40 +11:00
a5a58ec140 Fix T46284: Texture paint, wrong shading mode
Project-paint now supports painting to cycles materials.
2015-10-29 21:06:40 +11:00
1632a5503b Missed this in previous commit... 2015-10-29 21:06:39 +11:00
51a13869bc Fix T46467: Clean Keyframes removes the channels. 2015-10-29 21:06:39 +11:00
f4c22ac4b6 Fix T46002: mathutils.geometry.intersect_line_line_2d doesn't operate on lines, but on line segments.
Ugly issue really, but at least doc now matches behavior of the function. :|
2015-10-29 21:06:39 +11:00
2e4d580f9d Fix T46450: Seams from islands, wont show 'Sharp' 2015-10-29 21:06:39 +11:00
8af2029ca5 Fix T46458: BGE Crash on load
regression from 96dd213e7
2015-10-29 21:06:39 +11:00
5ea4f5b4a3 Fix T46447: fix build on non-x86 platforms. 2015-10-29 21:06:39 +11:00
ff01b24ecd Fix T46446: texture nodes image node not working with image sequences. 2015-10-29 21:06:39 +11:00
cdc8f4d65a Fix T46434: Shear w/ local-center & editmode fails 2015-10-29 21:06:39 +11:00
ae4b02c6bb Fix T46444: Crash importing DAE w/ empty armature 2015-10-29 21:06:39 +11:00
a5938e01e5 Cycles: Increase number of textures allowed for OpenCL render
Currently OpenCL devices are packing images into a single texture,
which means technically number of textures is not limited here.

Now OpenCL will use same number of textures as CPU. If we want
to bump number of textures further, this values are to be modified
in sync.

NOTE OpenCL still does not support float textures.

Original patch from a guy called bliblubli in the tracker with
some own modifications.

Reviewers: brecht, dingto, sergey

Differential Revision: https://developer.blender.org/D1530
2015-10-29 21:06:38 +11:00
d039cc69dc Fix T46441: texture paint soften brush at 0 strength works at full strength. 2015-10-29 21:06:38 +11:00
70549fe8e0 Fix T45152: multiview/stereo render not working with Freestyle + Cycles. 2015-10-29 21:06:38 +11:00
9bfc5fc7b5 Fix T44048: freestyle lines in Cycles are in the wrong color space. 2015-10-29 21:06:38 +11:00
c24d88d488 Fix T46437: Make progress report py helper resitent to 'zero steps' passed value...
To be backported, should we need an 'a' release.
2015-10-29 21:06:38 +11:00
a66d700fa7 small fix for potentially unintended calculation 2015-10-28 19:43:01 +01:00
2ccdaf398e changed calculation of stability factor for compounds and adapted UI a bit (for compounds) 2015-10-28 17:38:34 +01:00
12806f5ef8 disabled damage propagation (and settings) in code and ui, was slow and not really necessary, also fixed a crash which happened when freed bullet manifolds were used again. 2015-10-28 16:43:40 +01:00
e6d181c01a tiny fixes for autohide and attempt to get rid of propagateDamage crashes (again) 2015-10-27 13:19:46 +01:00
e3254e3615 attempted fixes for : autohide, damage propagation in compounds (was crashing after some time) and compound parameter changes do reset the cache now, too 2015-10-27 11:32:48 +01:00
2dfdbe4081 calculating minimum impulse per object now, also made solver iteration settings not visible for compounds any more (they relate only to constraints) 2015-10-26 20:25:59 +01:00
5cb7c07e31 attempt to fix some (stack overflow related ?) crashes 2015-10-26 15:34:40 +01:00
fe4909e752 tiny fix, forgot to assign ids to meshislands in splitshards to island mode 2015-10-26 14:43:36 +01:00
e2a01d408d small fix for ui description of mass_threshold_factor 2015-10-25 09:41:32 +01:00
3c8876c5a1 new parameter "stability factor" (for constraints, compounds) and resetting all shards by default now on refracture, except in mousebased fracture (faster to keep unchanged shards there) 2015-10-25 09:27:37 +01:00
d64c367560 some enhancement attempts for compounding, supposed to be better controllable in some cases, but still odd behavior with multiple compound objects 2015-10-24 13:01:03 +02:00
5019780664 fix for triggers and multiple compound objects (but compound building is slower again, due to necessary broadphase handles for triggers) 2015-10-23 18:45:28 +02:00
d72a489ddb exposed a couple of compound damage propagation parameters, need to test still to find good values 2015-10-23 12:02:41 +02:00
42f644204c windows compile fix 2015-10-22 21:53:18 +02:00
8611d01c68 crash fix in propagateDamage, checking for index being smaller than connection size now 2015-10-22 19:58:08 +02:00
ba39be6bc3 speed enhancement for building compounds (omitting broadphase handles) and successful test with clusters, values need a bit tweaking but basic principle works 2015-10-22 13:16:42 +02:00
a7b45823be added very basic damage propagation scheme to compoundbased fracture (direct damage is too small, can be increased this way, but you mostly get single parts falling off only) 2015-10-21 17:32:01 +02:00
b212d62340 some fixes for compound method, but still not very well controllable 2015-10-21 15:18:26 +02:00
597936b3fb new feature: attempt to accelerate simulation of many adjacent shards by compounds; todo... improve connectivity check 2015-10-20 21:31:29 +02:00
962480865a fracturing multiple settings seems to work (again) but todo: splinters, multiple islands / setting, constraints 2015-10-18 11:25:52 +02:00
0eae9ab115 fix attempt for splinters, did crash.. now works but its incorrect for multiple settings 2015-10-17 17:49:10 +02:00
9168aface9 small fix for multiple fracture settings (but, other files still dont work with it, investigating... 2015-10-17 15:47:03 +02:00
4a2dad0f8d multiple fracturing settings seem to work, but tested with 1 file only for now... 2015-10-17 15:28:21 +02:00
ade29c9713 fix for older blends, so they work as before again 2015-10-16 21:13:32 +02:00
e0fdc8279c experimental new feature: multiple fracture setting per predefined mesh island, delimited by a vertexgroup per island 2015-10-16 20:48:15 +02:00
c2730a8554 dynamic fracture, another improvement attempt, still a bit jerky movement 2015-10-14 20:01:41 +02:00
45d9914ac3 dynamic fracture: attempt of fixing rotation, its better than before but still not 100% correct 2015-10-14 18:16:31 +02:00
9dcabad07b fix for trimesh shape, in case of fracture modifier take physical mesh from each meshisland as shape mesh now 2015-10-11 21:51:58 +02:00
bd5d172bb3 allow to update deforming rigidbody mesh even when vertex count changes (by revalidating it), good for having fluids as deforming rigidbodies for example 2015-10-11 20:53:32 +02:00
48f7dd68f8 Fix T46403: motion tracking not workig with Xcode 7 on OS X.
Caused by use of the uninitialized shape_ variable in Resize().
2015-10-11 11:55:11 +05:00
3ed22c3f3c Revert "Fix T46406: Cycles ignores default socket value associated with group socket"
Fixes T46442.
2015-10-11 11:54:51 +05:00
23f7e16960 Fix/Workaround T46431: blender-softwaregl crashes
Order of initialization bug only impacted mesa's software-gl.

For now effectively revert support for glx-context-flags.
2015-10-10 13:48:35 +05:00
a3cf9c54d8 Use PyThreadState_GetDict, avoid Python internals
Works around problems caused by exposing Py internals (Py_BUILD_CORE).

    Build error with GCC, Py3.6 & OpenMP
    Linking error on MSVC
2015-10-09 23:01:22 +11:00
d53af76420 Blender 2.76: Point submodules to updated release branches 2015-10-09 16:40:54 +05:00
51384e7e36 Blender 2.76: Entering release stage 2015-10-09 16:31:46 +05:00
48c50bea72 Fix T46420: Segfault when instancing smoke domain.
Looks like instancing of smoke sim is not supported at all
(was fake-working in 3DView in 2.74, but not rendered).

But it should not crash - code was adding temp 'fromdupli' base to the delayed
drawing list...

Nice to backport this to 2.76 I think.
2015-10-09 16:23:41 +05:00
31d3d434aa Correct own error in editmesh bvh
Flag mix-up and uninitialized var.
2015-10-09 16:23:41 +05:00
f39babc9d6 Fix leak creating 'empty' looptri bvh tree 2015-10-09 16:23:41 +05:00
a67433bc19 Fix T46415: empty node group in GLSL shader has incorrect socket type conversion. 2015-10-09 16:23:40 +05:00
7a93fbc807 Fix T46407: Enabling OSL breaks Vector Transform node 2015-10-09 16:23:40 +05:00
68d5e1d3ae Fix: Do not show "Paste Flipped" in the Dope Sheet's Grease Pencil mode 2015-10-09 16:23:40 +05:00
323851fa71 Fix: "Tweak user" red-alert flag was not getting set on strips on active track
The "tweak user" flag used to flag strips using the same action as the active strip
was not getting set on other strips that live on the same track as the active one.
Strips with this flag set are shown with a red colour to indicate that editing the
action may have the unintended consequence of modifying another strip.
2015-10-09 16:23:40 +05:00
85f5c1a362 Fix T46406: Cycles ignores default socket value associated with group socket 2015-10-09 16:23:40 +05:00
f4ac865367 Cycles: Fix wrong float3->float3 conversion node 2015-10-09 16:23:40 +05:00
dc018d4f61 Fix bplayer (c) 2015-10-09 16:23:40 +05:00
ef7a3fb2fb Fix T46405: Cycles point density missing update when modifying source object 2015-10-09 16:23:39 +05:00
5d0a99b6ee Cycles: Fix for point density always using render settings for modifiers 2015-10-09 16:23:39 +05:00
7980891a13 Fix T46410: VSE Mask ignores animated properties 2015-10-09 16:23:39 +05:00
8d22715d67 Fix T46401: bad step size w/ radians 2015-10-09 16:23:39 +05:00
fe32c438ac BMesh: maintain select-history when sorting 2015-10-09 16:23:39 +05:00
5d59a51aca Fix T45886: cont.deactivate(ActionActuatorInPropertyMode) does not work
Make sure the Action Actuator actually deactivates when given a negative
event while using the property play mode.
2015-10-09 16:23:38 +05:00
ad950be67c Fix mesh validate: 'r_changed' ignored loop edits 2015-10-09 16:23:38 +05:00
a79f439580 Fix game-property use-after-free error
D1538 by @hal01
2015-10-09 16:23:38 +05:00
9713b11644 Fix FileBrowser: do not show 'advanced filter' panel outside of lib browsing context,
it’s only used there so far.

Reported by Thomas Beck (plasmasolutions) over IRC, thanks.

Safe enough for 2.76.
2015-10-09 16:23:38 +05:00
d5e1c9ab9f Fix T46390: Sound sequencer API doesnt' work when built with SCons
The issue was caused by original patch efde4dbb.

This seems to be really old bug, but safe for 2.76.
2015-10-09 16:23:38 +05:00
1b7fc80ecd Fix T46392: Navmesh generator error.
We now have to explicitely enure tesselation of DMs when we need it.

Notes: Maybe we could use looptris here as well?

Not a regression (bug already present in 2.75, but not 2.74), nice to backport to 2.76 nontheless.
2015-10-09 16:23:38 +05:00
9ccec0a288 Fix T46389: Shrinkwrap fails in editmode
Own regression caused by fix for T46067,
edit-mode bvh only contained unselected faces.

This commit adds support for an edit-mode bvh containing all faces.
2015-10-09 16:23:38 +05:00
e95a213f7a Fix T46333: Particle Info Node broken w/ BI
Patch from @a.romanov

This also fixes multiple particle systems - which never worked.
2015-10-09 16:23:37 +05:00
e5a6c542af Cleanup: warning 2015-10-09 16:23:37 +05:00
c647685538 Fix T46375: Inverted scroll in node template menus 2015-10-09 16:23:37 +05:00
1a37144ecd Fix T46354: Curve Modifier does not update (new Dependency graph)
Result of curve modifier depends on transform of the object which should
be reflected by the depsgraph relations.
2015-10-09 16:23:37 +05:00
3b17a650b6 Fix T46377: No python executable in 2.76 rc3 distribution for OSX 2015-10-09 16:23:37 +05:00
f7bc573b60 SCons: Support compilation with 10.11 SK on OS X 2015-10-09 16:23:36 +05:00
971566ba46 Fix T46352: Cycles fails to render when material contains UV mapped texture as volume input 2015-10-09 16:23:36 +05:00
365dadeecc Cycles: Remove redundant coordinate clipping in voxel SVM node
It is now handled via texture extension type.
2015-10-09 16:23:36 +05:00
5c0d68d687 Cycles: Fix missing z-coordinate check in volume sampling 2015-10-09 16:23:36 +05:00
b5ca4ee5b0 Fix T46358: Cycles point density uses repeat extension type 2015-10-09 16:23:36 +05:00
a142beb888 Fix T46305: normal map display issues in viewport when using VBOs. 2015-10-09 16:23:36 +05:00
690621bd24 CMake: detect OS X 10.11 / Xcode 7. 2015-10-09 16:23:35 +05:00
8621f480bf Fix T46368: Subtitle Export: Subtitles are not sorted by time.
We need a temp list of Text effect strips here, to be able to sort it as we want...
2015-10-09 16:23:35 +05:00
b2d325a768 Fix (unreported) broken export of timecodes in SubRip VSE exporter.
Would write 1.04 seconds as `00:00:01,40` instead of `00:00:01,040`...

Anyway, we already have BLI API for timecodes, much better to add
SubRip timecode format there, heavily simplifies code.

To be backported to final 2.76.
2015-10-09 16:23:35 +05:00
9b153763a3 InstallDeps: Fix broken OSL (would not generate valid default names for its .oso pre-compiled files).
Also, externalize temp/hacky patches in own dir, much much cleaner than integrating them in bash script!
2015-10-09 16:23:35 +05:00
1bc28db0ef Fix memory leak in compositor code with RGB curve nodes. 2015-10-09 16:23:35 +05:00
0c6346379f Cycles: Correction to point density with particle source and world mapping 2015-10-09 16:23:35 +05:00
2976a94c84 BGE: Fix T46302: abort call for unnormalized quaterions. 2015-10-09 16:23:35 +05:00
ea835c8a73 Fix T46339: Edge sliding when there is only one vertex in the mesh crashes blender.
If t->mode remains edge/vert slide, restoreTransObjects() ends up calling
projectVert/EdgeSlideData(), which tries to access invalid customdata...

Not sure why we call again restoreTransObjects() and resetTransRestrictions() here tbh,
but safer not to change that for now.

Should be backported to 2.76 if possible.
2015-10-09 16:23:34 +05:00
c2d070a3fb Fix T46321: 3D view not refreshed immediatelly after pasting keyframe in dope sheet (for a single channel) 2015-10-09 16:23:34 +05:00
2f7eb53ed0 Fix T46331: File open does not show thumbnails, when a filter_glob is provided by python scripts.
No reason to exclude usual file-type 'guessing' for operator-filtered extensions...

Safe for 2.76, should we need to merge more fixes.
2015-10-09 16:23:34 +05:00
596bf1aff6 allow freeslip / partialslip in fluid with export animated mesh on obstacle, for testing purpose with fracture modifier, attempting to reduce fluid jitter on moving shards 2015-10-08 19:51:42 +02:00
3e4ce322c4 allow deforming rigidbodies now with mesh_source 'FINAL' as well 2015-10-06 22:47:25 +02:00
fb78f6d518 Fix T46332: Can't select an object with OpenSubdiv enabled
The issue was introduced by a wrong fix for T46247. Now both reports should
be properly solved.
2015-09-30 21:05:13 +05:00
035d27dca6 Revert "Fix T46247: Side-reported, bbox for zero-verts object with OSD subsurf and GPU compute would be -INF."
This reverts commit b278e8742b.
2015-09-30 21:05:06 +05:00
e1c77fb98d Address request from T46136: make softrange for 'simple deform' angle from -360 to 360 degrees...
This should be safe enough for final 2.76, sould we make other RC.
2015-09-30 20:22:59 +05:00
e0a08d50a2 Blender 2.76: Update Release Candidate splashscreen label 2015-09-30 20:09:46 +05:00
7914d04d13 Fix T46325: Armature: No more possible to rotate a bone with only its tip selected, in EditMode.
Regression from rB312cb0a957b81233ea, now we make an exception for TFM_ROTATION mode...
2015-09-30 20:08:26 +05:00
67dffa60ae Fix T46313: Cycles bake normal map
Regression moving to bake to looptri
caused by mismatch w/ MFace and MLoopTri when the 3rd index was 0.
2015-09-30 20:08:26 +05:00
ae4fcdc7ba Fix T46299: Windows: File Browser Crash while listing big folders in preview mode (fonts, images...).
Windows-only bug, mmap & co are not threadsafe by default on this platform, so we have to add a dedicated
spinlock for them in win32.

Note that we may try to get rid of those mmap later, but not for 2.76!

To be backported to final 2.76...
2015-09-30 20:08:26 +05:00
24615ecab5 Blender Internal: Fix regression in point density texture
The issue was introduced by original Cycles point density support commit,
it lead to a constant density of 1 for object verticies point density source.
2015-09-30 20:08:26 +05:00
6cb20d6287 Cycles: Fix wrong particles min/max calculation for point density
Solves wrong object mapping reported in T46301.
2015-09-30 20:08:26 +05:00
2ecc405b69 Fix T46285: "Select parent" if there is no parent doesn't work correctly. 2015-09-30 20:08:26 +05:00
c3dbb533b2 Fix T46271: switching between textures in texture buttons not updating preview. 2015-09-30 20:08:26 +05:00
0191a618ef Fix T46212: blender internal lights in exclusive light group wrong in viewport. 2015-09-30 20:08:25 +05:00
c31bace2a4 Fix crash reporting render errors during baking. 2015-09-30 20:08:25 +05:00
Julian Eisel
4d76fdd3e9 Fix file browser not sorting file list when opened from editor menu 2015-09-30 20:08:25 +05:00
Julian Eisel
b3d12f65c0 Fix node auto-offset to left broken
Own, really stupid mistake in rBc653077bf56 :| Kids, don't commit at night!
2015-09-30 20:08:25 +05:00
7dcd3a0e0d Fix T46249: Boid goal object that has a force field set to 'Every Point' shape causes crash.
This is a mere bandage, that whole area is known broken anyway, but at least it should prevent the crash.

Note that that kind of stuff (the efd->index being a pointer) is really bad practice imho...

Should be backported to final 2.76.
2015-09-30 20:08:25 +05:00
7a81cccd1d Fix T46239: Cross effect strip input fields can't be changed (in its properties panel).
Those shall not be editable in UI...
2015-09-30 20:08:25 +05:00
fd964bbf1c Fix T46247: Side-reported, bbox for zero-verts object with OSD subsurf and GPU compute would be -INF.
Trivial fix, to be backported to final 2.76 if possible.
2015-09-30 20:08:25 +05:00
Dalai Felinto
a985bf73e5 Multiview: fix Image Editor not showing Views menu when rendering
non-stereo Multi-View camera rigs (unreported)
2015-09-30 20:08:24 +05:00
ca1809988a Fix T46226: Bake normals multi-res crash 2015-09-30 20:08:24 +05:00
21c00cbd0e Fix T46227: ShapeKeys Lattice by the driver, problem updates in new depsgraph
The issue was caused by driver referencing path outside of the key datablock.
2015-09-30 20:08:24 +05:00
eae90798b6 Fix T46232: Boids crash w/ random rule selection 2015-09-30 20:08:24 +05:00
34bcd2f0ea Fix T46219: Knife cuts fail away from center 2015-09-30 20:08:24 +05:00
Dalai Felinto
99cdafc651 Fix T46225: Crash when rendering halo flare
Error introduced in the multiview commit.
Also bringing back the "continue" statement instead of "return", as it
was before multiview.
2015-09-30 20:08:24 +05:00
7ea1e5de8d Fix T46222: Eyedrop picking objects inconsistently 2015-09-30 20:08:23 +05:00
3399314a6f Blender 2.76: Point submodules to new commits 2015-09-30 20:07:06 +05:00
39155c1c46 Revert last commit where attempt of keeping autohide state was made 2015-09-27 21:15:44 +02:00
a2ff84c66a attempt to reduce flickering with autohide by memorizing which faces were not deleted in one autohide pass and keeping them, side effect: when playing the sim backwards autohiding wont work properly until reset to start frame again. 2015-09-27 20:50:07 +02:00
479a1a9a1a separate autohide and automerge distances, autohide alone is ok for glass and is faster, while automerge is more useful in conjunction with smooth objects and fix normals, to hide the cracks better, also automerge caused errors with thin glass objects like window panes 2015-09-26 17:47:18 +02:00
e24ea81d65 Fix T46215: Explode modifier looses textures 2015-09-23 19:02:27 +05:00
f6445cd6ae Fix T46217: Make normal artifacts 2015-09-23 19:02:26 +05:00
8db7ca1cca Fix T46202: OS X (and Windows?) crash when going fullscreen.
Calling event handling recursively during window live resize is problematic,
the code wasn't designed to do that. Instead postpone event handling until
after live resize.
2015-09-23 19:02:26 +05:00
05ed4a4da1 Update module test to pass w/o freestyle enabled 2015-09-23 19:02:26 +05:00
eca8d9aa02 Update test to RNA API 2015-09-23 19:02:26 +05:00
6b9d496aa5 prevent assert: select-linked UV delimit w/o UV's 2015-09-23 19:02:26 +05:00
c8670f45b9 OpenSubdiv: Fix crash with empty mesh
Reported by newbz in IRC, thanks!
2015-09-23 19:02:26 +05:00
65a56a10bb FFmpeg: Solve memory leak happening on encoding video 2015-09-23 19:02:25 +05:00
96c0aebeae Fix T46194: Crash rendering particles
Off by one error in 38940662
2015-09-23 19:02:25 +05:00
d26fc19fd8 Remove arbitrary simulation time limit in liquid sim. Tested and works fine with more than 100s 2015-09-23 19:02:25 +05:00
f6b0194746 Fix T46201: Popup menu in post_load handler crash
Match regular file loading logic for new-file operator.
2015-09-23 19:02:25 +05:00
a41bdb77d3 Fix bplayer (c). 2015-09-23 19:02:25 +05:00
fe98ce1375 Sequencer: show X,Y in text effect location 2015-09-23 19:02:25 +05:00
a457ad0057 Render: Free persistent image storage when loading new file 2015-09-23 19:02:25 +05:00
d16ee90b9c Fix (unreported) Append/link code: All library datablocks could end with same name.
This was broken since ages I think, did not really hurt since we usually never use libs' names
to access them. Rather bad behavior however, breaking a ground rule of our ID system!

And no real reason to add new libraries to new (split) Main at all, libraries are
never considered linked datablocks, which means they should always be in 'main' Main->library list.

Not a regression, but should be included in 2.76 imho.
2015-09-23 19:02:24 +05:00
c0384c4645 Fix T46159: OpenSubdiv does not always give same results as Blender own subsurf code with crease edges 2015-09-23 19:02:24 +05:00
23427bfebf Fix view-selected w/ custom bone shapes
Was ignoring bone-length, also check that drawing shapes is enabled.
2015-09-23 19:02:24 +05:00
574e859e38 Fix T46186: Panel doesn't update on brush change 2015-09-23 19:02:24 +05:00
869c3344c9 Fix T43715: IK pole target + stretch not working for a single bone chain. 2015-09-23 19:02:24 +05:00
78f4e22dc3 RNA: angle step-sizes were too small
These were ignored previously, so it wasn't noticeable.
2015-09-23 19:02:23 +05:00
Julian Eisel
869736b5d6 Fix node auto-offset failing during heavy compositing (sometimes)
Compositing might make main thread so busy that animation is considered done due to duration before final position is reached.

Also added check to avoid unnecessary redraws.
2015-09-23 19:02:23 +05:00
cec28ebf5e Fix T46050: blender internal geometry node UV not working inside node group. 2015-09-23 19:02:23 +05:00
3c30467cda Fix T46144: blender internal face texture color wrong in raytraced reflection. 2015-09-23 19:02:23 +05:00
c8200c000a fix build error w/ clang 2015-09-23 19:02:23 +05:00
74b210387f Fix T46169: Link to bpy API in addons tab of user preferences is outdated.
Now use auto-generated one, like e.g. for link in Help main menu...
2015-09-23 19:02:23 +05:00
c08896e2c4 Fix T46161: Rotate around selection changes bezier curve handle type.
Issue is, when 'Rotate Aroud Selection' is set, in Edit mode we do a fake transform operation
to get center point around which to rotate. For curves, most transform operations involve
a check of handle types. For now, added 'TFM_DUMMY' as an exception here.

Think it would be best to actually undo those changes in case of cancelled operation,
but this is much more involved, while this fix is safe enough to be included in final 2.76.
2015-09-23 19:02:22 +05:00
aabb8db753 Fix leak in UI Panels
Switching screens quickly didn't free the panels activedata.
2015-09-23 19:02:22 +05:00
Julian Eisel
139cab0937 Correction to previous commit 2015-09-23 19:02:22 +05:00
Julian Eisel
1358920716 Fix file key select using wrong file after border select in scrolled view
Basically, after border selecting, a wrong file was selected by using arrow keys if the screen was scrolled a bit vertically. Reason was that we didn't use correct view space coordinates but region space coordinates for measuring distance from mouse to first/last file in selection after border select.
2015-09-23 19:02:22 +05:00
42eb1cc64e Fix T46030: Strange behavior of Cycles Brick Texture
Added some extra seed to the hash, so it's now less likely to give repetitive
patters at values around zero.

This will change distribution of bricks for existing files. but it's something
inevitable.
2015-09-23 19:02:22 +05:00
07c3311475 Fix UI crash entering very long strings
Strings exceeding UI_MAX_DRAW_STR weren't null terminated.
2015-09-23 19:02:21 +05:00
141de0cc7f Fix T46148: Sculpt view-clip fails in ortho mode 2015-09-23 19:02:21 +05:00
b0a6d48659 Doc: escape enum name & description
Needed since key enum now uses many characters as they're typed.
2015-09-23 19:02:21 +05:00
c586e30053 Blender 2.76: Update translations submodule 2015-09-17 19:48:06 +05:00
7b8bfec06d Merge branch 'master' into blender-v2.76-release 2015-09-17 19:46:21 +05:00
20bc9aadc6 Blender 2.76: Point submodules to latest release branch from according repos
No tagging is done yet, will happen in a bit.
2015-09-17 18:03:23 +05:00
c86186f030 small crash fix for fast bisect / fast bisect fill 2015-09-12 15:20:35 +02:00
1bd9a911c4 crash fixes for greasepencil edge fracture 2015-08-07 15:38:23 +02:00
f870eee4d4 fix: remove doubles on internal cutter mesh created by (nearly) cyclic greasepencil strokes (so non-manifolds are avoided there) 2015-08-06 21:10:57 +02:00
9263098a7f fix: set cutter axis correctly (RNA called a different function there) 2015-08-06 19:33:05 +02:00
aa8c0143d2 mark "Dynamic Fracture" as WIP 2015-08-06 14:41:32 +02:00
d05a85cd7f compile fixes due to merge 2015-08-06 14:23:10 +02:00
4c52ad04b1 Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier
Conflicts:
	CMakeLists.txt
	build_files/cmake/macros.cmake
	intern/cycles/kernel/geom/geom_triangle_intersect.h
	intern/cycles/kernel/kernel_shader.h
	intern/cycles/kernel/svm/svm_closure.h
	release/scripts/modules/bpy_extras/io_utils.py
	release/scripts/startup/bl_ui/properties_data_modifier.py
	release/scripts/startup/bl_ui/space_view3d.py
	release/scripts/startup/bl_ui/space_view3d_toolbar.py
	source/blender/blenkernel/BKE_blender.h
	source/blender/blenkernel/BKE_deform.h
	source/blender/blenkernel/BKE_mesh_mapping.h
	source/blender/blenkernel/BKE_object.h
	source/blender/blenkernel/BKE_rigidbody.h
	source/blender/blenkernel/CMakeLists.txt
	source/blender/blenkernel/SConscript
	source/blender/blenkernel/intern/cdderivedmesh.c
	source/blender/blenkernel/intern/object.c
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_270.c
	source/blender/blenloader/intern/writefile.c
	source/blender/editors/animation/keyframes_general.c
	source/blender/editors/armature/armature_edit.c
	source/blender/editors/gpencil/gpencil_ops.c
	source/blender/editors/object/object_intern.h
	source/blender/editors/object/object_shapekey.c
	source/blender/editors/space_action/action_edit.c
	source/blender/editors/space_view3d/view3d_draw.c
	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_fluidsim.c
	source/blender/modifiers/intern/MOD_normal_edit.c
	source/blender/modifiers/intern/MOD_util.c
	source/gameengine/Converter/KX_BlenderSceneConverter.cpp
2015-08-06 14:22:23 +02:00
2c58498e6d fix: properly initialize cluster indices of mesh islands, failing to do so caused different activation behavior when triggering 2015-07-23 17:47:02 +02:00
840cc057a1 crash fix, do not reset shards in dynamic fracture 2015-06-13 10:55:45 +02:00
a8226be315 automatically trigger entire clusters now, if any 2015-06-13 09:22:18 +02:00
a051a76c8a attempt to add a cut by objects / geometry (other FM) option as well as properly resetting shards after fracture parameter change (the latter didnt work properly) 2015-06-07 21:21:06 +02:00
929b0fb444 added possibility to brickify objects, but you need to craft a brick helper object which consists of several islands and covers atleast the bbox of the object to be fractured, and you need to put a fracture modifier which creates just islands on the helper object as well 2015-06-07 16:45:09 +02:00
9a891f26dd fix: limit speed transfer to dynamic objects only, caused severe glitches with prefractured objects 2015-06-06 23:04:44 +02:00
2421696f60 fix : fast bisect algorithms caused misbehavior when refracturing, also removed the forced settings (Mesh shape, constraints) with fractal boolean 2015-06-06 15:50:36 +02:00
73f1c37871 fix: display glitch when triggering shards due to own error in pointcache 2015-06-06 11:19:44 +02:00
c1447bc9ba fix: reducing the shard count didnt work with new, faster refracture method in prefracture 2015-06-05 21:22:48 +02:00
289d8b247e dynamic fracture: some crash fixes when changing between prefractured and dynamic mode (memory was partially overwritten instead of cleared) 2015-06-05 19:23:47 +02:00
40f3759482 dynamic fracture: disabled loading / saving of dynamic mode again, it still has too many issues 2015-06-04 20:34:17 +02:00
cd603674c9 dynamic fracture: re-added modified version of speed transfer, it depends now on linear / angular deactivation threshold whether speed is transferred or not (to reduce "jumping" of shards on the ground) 2015-06-04 14:20:13 +02:00
52ef935b7d dynamic fracture: relocated some functions and removed speed transfer from parent to child shards, it looked unrealistic, but TODO, animation often stops in case of fracture events.... 2015-06-04 10:28:04 +02:00
3a40e2b657 dynamic fracture: new option to limit the first impact (shard activation area can be limited to impact object) 2015-06-03 16:43:05 +02:00
90d6041f4e for now, deactivate loading for dynamic files again, there are still issues to solve (like proper cache handling after loading) 2015-06-03 11:25:46 +02:00
6f71cb361e dynamic fracture: cache works much better now 2015-06-03 11:01:32 +02:00
89e2e80ef6 dynamic fracture: slightly improved caching behavior, but it still flickers and doesnt continue simulation properly after cache ends 2015-06-02 15:44:25 +02:00
d79851ba2f fix: small rotation fix for dynamic fracture and fix for shard lookup 2015-06-02 14:27:10 +02:00
0e5638c04b fix: crash when repeatedly refracturing in prefractured mode with same settings 2015-06-01 21:27:06 +02:00
9888d30bb6 fix: crashes with dynamic fracture, but this is still WIP ! 2015-06-01 20:26:57 +02:00
2c26325272 some performance improvement with mouse based fracture (addon), only attempting to refracture necessary shards 2015-06-01 15:40:23 +02:00
3392741d19 dynamic fracture: do reset after settings changes and clean up constraints now too in dynamic fracture events 2015-05-27 18:29:25 +02:00
e4fbcce537 dynamic fracture: now multiple dynamic objects can exist, need to test interaction with prefractured, though 2015-05-21 18:28:18 +02:00
07ce06d212 dynamic fracture: fix for loss of rotation, and transferring speeds of parent shards to children now 2015-05-21 12:02:33 +02:00
9161459515 dynamic fracture: finally the transforms seem correct... but this mode still is highly unstable, and is prone to crash often, use sparsely ! 2015-05-20 23:03:31 +02:00
0d27ecdc04 hrm, now somethings with caching is broken... need to investigate 2015-05-19 16:35:45 +02:00
809402e927 still fighting with proper transformations in case of multiple fractures 2015-05-19 15:55:40 +02:00
30b3ebb59a dynamic fracture: fixed transformation calculation 2015-05-18 22:40:41 +02:00
d00f6177ae dynamic fracture: works a bit more stable now, but still lacks proper transformation calculation and speed takeover from parent to child rigidbodies 2015-05-18 20:33:24 +02:00
360c01cb86 dynamic fracture: attempts with loading and saving, and proper caching, still highly unstable 2015-05-18 16:29:39 +02:00
ec90dcb5b7 first commit of dynamic fracture, still highly unstable, needs fixes in storage handling and memory management 2015-05-17 22:04:55 +02:00
1e5c376e0f fix: crash when using fractal boolean with 1 shard and split shards and other misbehavior (boolean did not create valid rigidbodies, so objects were stuck in the air with 1 shard and fast bisect / fast bisect fill created 1 shard too much everytime) 2015-05-07 19:52:26 +02:00
f168ba85a9 fix: passive vertexgroup was ignored 2015-04-19 09:54:22 +02:00
728f259329 fix: loading subobject group modifiers correctly again 2015-04-07 18:46:06 +02:00
4f9941afcb fix: modifier will respond now to manual changes in transformation (setting values numerically, clear transformations, apply transformations and origins) and ghost setting should be respected properly now with mesh collision shape 2015-04-07 17:10:48 +02:00
f369be74d3 previous merge went wrong somehow, several parts of mesh data transfer code were missing 2015-04-01 13:43:48 +02:00
4e7f37c6e8 compile fixes due to merge 2015-04-01 11:32:33 +02:00
85cb9a2b0d Merge remote-tracking branch 'refs/remotes/origin/blender-v2.74-release' into fracture_modifier
Conflicts:
	intern/cycles/render/scene.cpp
	release/datafiles/blender_icons.svg
	release/datafiles/blender_icons16/icon16_mod_data_transfer.dat
	release/datafiles/blender_icons32/icon32_mod_data_transfer.dat
	release/scripts/startup/bl_ui/properties_data_modifier.py
	source/blender/blenkernel/BKE_blender.h
	source/blender/blenkernel/BKE_customdata.h
	source/blender/blenkernel/BKE_data_transfer.h
	source/blender/blenkernel/BKE_mesh_remap.h
	source/blender/blenkernel/intern/customdata.c
	source/blender/blenkernel/intern/data_transfer.c
	source/blender/blenkernel/intern/data_transfer_intern.h
	source/blender/blenkernel/intern/deform.c
	source/blender/blenkernel/intern/mesh_mapping.c
	source/blender/blenkernel/intern/mesh_remap.c
	source/blender/blenkernel/intern/object.c
	source/blender/editors/include/UI_icons.h
	source/blender/editors/object/object_data_transfer.c
	source/blender/editors/space_outliner/outliner_draw.c
	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_datatransfer.c
	source/blender/modifiers/intern/MOD_util.c
2015-04-01 11:31:53 +02:00
000dfc0319 Point submodules to the final release tag 2015-03-31 18:39:23 +05:00
dedfd0cfa9 Branch is not really a release state! 2015-03-31 18:26:53 +05:00
08f7b20ebb Bugfix: Fix for crash when trying to create new action in Shape Key DopeSheet mode
When the active object had no shapekey data, trying to create a new action from the
Shape Keys mode of the DopeSheet would crash. The segfault here was a silly regression
caused by my earlier Action Stashing work.

However, the old (pre-Action Stashing) code here also wasn't that great either.
While it didn't crash, it would still silently create a new action, even if that
could not get assigned/used anywhere. To prevent both of these problems from
happening again, I've added additional null checks, as well as beefing up the poll
callback here to forbid keyframing
2015-03-31 18:18:05 +05:00
4f57f15648 Fix T44077 material update fails in textured mode when VBOs are off.
The issue has been here since we changed drawing code for meshes to use
vertex arrays instead of immediate mode when VBO was off. Basically we
should now always invalidate the GPU objects regardless of the VBO
setting in the preferences.

The bug has been there since 2.73 at least, but what made it apparent
now is that new version resets preferences and as an extension the VBO
flag.

Should be included in final 2.74 release
2015-03-31 18:18:05 +05:00
a555fa5b28 Fix T44201: Crash Deleting Hierarchy in Outliner
Typical error using '->next' member of a freed linked list item. A bit trickier
even here, since we have some recursion...

Trivial fix for nasty crasher, safe for 2.74 imho?
2015-03-31 18:18:05 +05:00
abb92632f8 Fix T44193: Hair intersection with duplis causes flickering
It was an issue with what bounds to use for BVH node during construction.

Also corrected case when there are all 4 primitive types in the range and
also there're objects in the same range.
2015-03-31 18:18:04 +05:00
5ca59f7134 Fix T41191: Custom Loop Normals Viewport shading not updating when set from py script
Missing update tagging...

Safe for 2.74.
2015-03-31 18:18:04 +05:00
accd6083a5 Fix for invalid buffer access on zero-face meshes 2015-03-31 18:18:04 +05:00
e6b81ae69a Fix T44186: Bezier Bevel facto mapping broken when 'start' was set to 'Resolution' and 'end' was not.
Trivial, we need totla_length in that case too.

Safe to be backported to 2.74.
2015-03-31 18:18:04 +05:00
5ca0cf3702 Remove use_invert_vertex_group use_ prefix
To match other modifiers.
2015-03-31 18:18:04 +05:00
6410b1bd59 Fix T44149: Compositing : Node Groups do not work correctly
Input constants are to be connected before removing proxies,
otherwise node groups might give totally different result.

This is a regression and to be put into final release.
2015-03-31 18:18:04 +05:00
5e92d1254e Fix T44137: bpy.path.is_subdir fails
`bpy.path.is_subdir("/abc/def/ghi","/abc/de")` incorrectly returned True
2015-03-31 18:18:04 +05:00
3593082a75 Point addons to 2.74-rc4 tag 2015-03-26 21:12:32 +05:00
cb19df1c45 Bump splashscreen to rc4 2015-03-26 21:04:56 +05:00
b2a3796b2d Fix T44133 SSAO in OpenGL rendering from orthographic camera did not
work

Safe to include in final release
2015-03-26 16:18:41 +05:00
01a29487e8 Fix T44138: Crash in DataTransfer modifier when selecting a source with no loops.
Simply check and early return in case we have no source or destination items
(verts/edges/loops/polys) available...

Also, fix an assert in `BKE_mesh_calc_normals_poly()`, when called with no poly.
2015-03-26 16:18:41 +05:00
1311f2d8f1 Yet another fix for crashing particles. 2015-03-26 16:18:41 +05:00
30e06a1775 Fix 2 typos ( shakin' hands ) 2015-03-26 16:18:40 +05:00
1c8ee52423 Fix for crash when using particle emission with clump/roughness curves
in a smoke sim.

This interaction between sims is totally stupid and must be recoded
entirely in some utopian future.
2015-03-26 16:18:40 +05:00
dcfbffcf57 Fix T44128: Ray visibility only enables diffuse if glossy is also enabled
Issue was caused by accident in c8a9a56 which not only disabled glossy
reflection if Glossy visibility is disabled, but also Diffuse reflection.

Quite safe and should go to final release branch.
2015-03-26 16:18:40 +05:00
fa1fc11344 Simplify recent commit 2015-03-26 16:18:40 +05:00
143dbfb33e Fix T44118: Rotated background image disappears
Image clipping didn't take rotation into account.
2015-03-26 16:18:40 +05:00
f1f797599f Fix T44123: Cycles SSS renders black in recent builds
Issue was introduced in 01ee21f where i didn't notice *_setup()
function only doing partial initialization, and some of parameters
are expected to be initialized by callee function.

This was hitting only some setups, so tests with benchmark scenes
didn't unleash issues. Now it should all be fine.

This is to go to the 2.74 branch and we actually might re-AHOY.
2015-03-26 16:18:40 +05:00
8804e6493c Point addons to v2.74-rc3 2015-03-24 20:31:27 +05:00
3ec48d3bd8 We're now RC3 2015-03-24 19:49:40 +05:00
eb9826d8d9 Versioning code to correct socket naming after
340b76b42c

Reported by formerly Old_Demon on blenderartists.

Apparently this caused old files to lose their links to material sockets
(noob own mistake from inexperience with node system).

This should either be included in release with version checking being
set to version 2.73 and subversion 10, without tweaking the
BKE_blender.h file

OR

340b76b42c should be reverted for this
release.

Thanks to Lukas for checking this out.

Conflicts:
	source/blender/blenkernel/BKE_blender.h
	source/blender/blenloader/intern/versioning_270.c
2015-03-24 19:49:18 +05:00
c7dc142c1b Fix T44102: Mirrored objects render black with Blender Internal and Autosmooth.
Normals are not vertices, we cannot apply matrix's scale to them...
2015-03-24 19:47:50 +05:00
d2d3a41ce8 Fix T44089: All addons do not use same default for orientations.
Transformed 'OrientationHelper' class into 'orientation_helper_factory' function,
which returns an OrientationHelper customized class with specified default axes.
2015-03-24 19:47:50 +05:00
03d662d7bd Fix T44065: fixed vehicle constraint
Commit ffee7f1a58 broke vehicle constraints; this fixes that.
2015-03-24 19:47:50 +05:00
33bf1e0e18 Revert part of D1074 related to acceleration taked into account.
It has been reverted because it was affecting obstacle avoidance
(T44041).

This fix should be backported to 2.74
2015-03-24 19:47:50 +05:00
6289d5b8d1 Fix T44110: Plane track doesn't work when built with scons
For some reason recent change in avoiding non-aligned eigen vectors
was behaving differently for cmake and scons. Made it a bit different
now by storing scalars. This is more robust approach anyway, because
it's not really guaranteed Mat.col() gives a pointer inside data,
depending on column-major vs. row-major storage.

This is to be backported to 2.74 branch.
2015-03-24 19:47:50 +05:00
6b1638cf79 tweaks to packman build
remove --asroot arg to makepkg
2015-03-24 19:47:50 +05:00
07e815df4b Fix T44076, SSAO in solid mode will disable antialiasing in wireframe
mode.

Yes it will, because those modes stay active. So on user side, expose
depth of field option always (I don't see why not), but disable SSAO in
wireframe/bounding box mode. It is a known limitation that compositing
does not support antialiasing yet, but better give users some more
control.

This could be included in final release but it's not that serious
either.
2015-03-24 19:47:49 +05:00
a10e7ca830 Make sure matcap icons are within range.
Basically out of range could happen when opening files made in 2.72 when
the new icons for texture painting were added. Apparently some more
caution is needed here.
2015-03-24 19:47:49 +05:00
01ee21ffb9 Fix T43926: Volume scatter: intersecting objects GPU rendering artifacts
Fix T44007: Cycles Volumetrics: block artifacts with overlapping volumes

The issue was caused by uninitialized parameters of some closures, which
lead to unpredictable behavior of shader_merge_closures().
2015-03-24 19:47:49 +05:00
3cf120be67 OSX: fix 1 leak ( found and fixed by marcclintdion ) and 1 possible leak in dragndrop, backport to 2.74 2015-03-24 19:47:49 +05:00
d22c56819c OSX/GHOST: need one more release in error case 2015-03-24 19:47:49 +05:00
ff455f1ae1 Partly fix T44025, pixelFormat retain was left, for 2.74 backport 2015-03-24 19:47:49 +05:00
9bbb53ef68 Cycles: Avoid memcpy of intersecting memory
Could happen when assignment happens to self during sorting.
2015-03-24 19:47:49 +05:00
7b9a8337ad Disable IME for headless builds 2015-03-24 19:47:49 +05:00
210f90cb77 Fix for building win32 headless 2015-03-24 19:47:48 +05:00
856da320e7 Fix/Improve FKey bone creation
- new bone is now made active
- previous selection cleared
- bone direction places the tip on the active bone (if available)
2015-03-24 19:47:48 +05:00
2967c07a61 Add missing update adding a shape-key
Noticeable when pin is enabled.
2015-03-24 19:47:48 +05:00
638368a930 Fix T43989: Sequencer - Ctrl snapping a sequencer strip does not work if you specify the x axis.
New 'strip' snapping was simply not computed in case of constrained transform, hence init
'0' value was used as frame offset in this case.

This commit reorganizes a bit that snapping, to keep it more 'confined' into `snapSequenceBounds()`
dedicated function. It still needs a minor hack (setting snapping mode to something else than
defualt `SCE_SNAP_MODE_INCREMENT`, to avoid this snapping to be called by contraint code).

Thanks to Antony for review and enhancements.

This fix should be backported to 2.74.
2015-03-24 19:47:48 +05:00
bef0649151 Fix T44040: Blender crashes when nodes are muted
It was actually an old issue with wrong conversion happening for muted
nodes, which wasn't visible before memory optimization commit.

This is to be backported to the final release.
2015-03-24 19:47:48 +05:00
8108fc77c6 Fix out-of-bounds read BKE_deform_flip_side_name 2015-03-24 19:47:48 +05:00
d62e3e7001 Use fabsf for floats 2015-03-24 19:47:48 +05:00
16cc6ae80e Fix for crash adding mask modifier 2015-03-24 19:47:48 +05:00
37172e7e49 Fix bad memory access freeing viewport which uses movie clip 2015-03-24 19:47:47 +05:00
f71f559d03 Fix crash using "Copy to selected" on ID-props 2015-03-24 19:47:47 +05:00
163d99b7a9 Fix crash using removed data as function arguments 2015-03-24 19:47:47 +05:00
06adae7b43 Fix RNA active spline assignment 2015-03-24 19:47:47 +05:00
9f69f7f700 Fix T44027: Normal Edit Mod : Radial from object normals affected by target object scale.
The way we were getting diff to apply to vcos from target object was just bad!

Also, fixed another related issue - negated scale would be clamped to nearly zero,
now only consider absolute version of size (we do not care about its sign here anyway).

This should be backported to 2.74 (with previous commit too).
2015-03-24 19:47:47 +05:00
4f08b3cf83 BLI math vec: add 'abs' functions to get absolute values of a vector.
Unseful when handling e.g. scale, sometimes.
2015-03-24 19:47:47 +05:00
c6f1be0728 Fix T44020: Crash exporting fluid sim to fbx
The issue is coming from wrong fluid modifier copy callback,
which might have left some pointers shared across original
and target fluid modifiers.
2015-03-24 19:47:47 +05:00
584aed0721 Fix T44021: Crash switching Rendering Engines while viewport rendering + animating
Make sure preview render job is cancelled before freeing the render engine
associated to the viewport.
2015-03-24 19:47:47 +05:00
337ce035b6 Make sure disabling attribute arrays also resets the counter so we don't
do it twice.
2015-03-24 19:47:46 +05:00
1ad57f287b Fix T43853: Audio animation bug (fcurves)
For a detailed bug explanation see the comments in the report.
2015-03-24 19:47:46 +05:00
3523a136d0 use center between objects for constraint types different than fixed, note: other types only work between clusters and settings for them are limited to the type currently.... 2015-03-22 18:17:11 +01:00
25397ea355 fix: some speed improvement for converting to objects or to keyframed objects and proper renaming of shards and constraints being created 2015-03-22 10:13:39 +01:00
9fa84d09e4 fix: another possible fix for loading correct vertexbased constraints 2015-03-20 00:32:10 +01:00
b3bc2166a6 fix: vertexbased constraints should be rebuilt correctly now after loading 2015-03-19 23:54:30 +01:00
fa116391df added a new vertex coordinate based constraint build method, as alternative to meshisland centroid based constraint building 2015-03-19 18:06:15 +01:00
d11592a700 fix: crash with fast bisect and fast bisect / fill due to refactoring 2015-03-18 16:06:13 +01:00
9775830ef7 fix: bugfixes for fractal boolean and greasepencil edge cutting due to refactoring 2015-03-18 00:00:49 +01:00
14a023abdd refactoring of FractureModifier: split very long functions into more, shorter ones 2015-03-17 20:48:03 +01:00
1f547c14ec Point submodules to 2.74-rc2 2015-03-17 20:11:30 +05:00
a1bb0d698b Fix an incorrect assert in lnor code.
There is one case where we do can have only two edges for two loops...
2015-03-17 18:19:46 +05:00
48d4b80246 Refer to Task 43975: Deleting a Shapekey can break the relative pointers
This patch would reassign the relative of all keyblocks to the relative
of the deleted keyblock. And it fixes the misalignement of the index values
after the keyblock is deleted.

Reviewers: campbellbarton

Differential Revision: https://developer.blender.org/D1176
2015-03-17 18:18:19 +05:00
8d31c7f452 Use "Release Candidate 2" string on the splash 2015-03-17 16:49:59 +05:00
ee87056fd9 Correct assert 2015-03-17 15:49:40 +05:00
9c154d5b58 Fix T43997: Paste fcurve keeps handle selection 2015-03-17 15:49:36 +05:00
a40d7b93ac PyAPI: bpy.ops enum error was cut short 2015-03-17 15:49:33 +05:00
8c3853a9b5 Update themes for 2.74 2015-03-17 15:49:29 +05:00
Julian Eisel
b64d3bde8b Fix T44003: Flatty Light: GPencil vertices and timeline keyframes black
I noticed our version code and subversion got out of sync in the past, maybe
that's what the issue was here.
Deleting the entries from the .xml makes it fall back to the default values.
2015-03-17 15:49:25 +05:00
931f876ddd BGE: Fix for T43994 Steering actuator bug with Navmesh
Now the facing option is taken into account as before

This is a regression and to be ported to the final release branch.
2015-03-17 15:49:21 +05:00
2d1879b714 Fix T43959 jittering in 2D texture painting.
This is still not perfect,
but should work smoother now. Previously there was visible wobbling
while painting.

This can be included in final release.
2015-03-17 15:49:17 +05:00
86b862ecc9 Revert "Fix T43865: Cycles: Watertight rendering produces artifacts on a huge plane"
The fix was really flacky, in terms during speed benchmarks i had
abort() in the fallback block to be sure it never runs in production
scenes, but that affected on the optimization as well. Without this
abort there's quite bad slowdown of 5-7% on the renders even tho
the Pleucker fallback was never run.

This is all weird and for now reverting the change which affects on
all the production scenes and will look into alternative fixes for
the original issue with precision loss on huge planes.

This reverts commit 9489205c5c.
2015-03-17 15:49:08 +05:00
651689fc62 Fix T43974: Alpha output of movie clip node crashes blender
Issue was caused by a bug in the memory optimization commit,
should be backported to the final release branch.
2015-03-17 15:49:04 +05:00
f0e37fceb2 Partial fix for T43967: Background is wrong in 2.74
Was missing do-versions code after rotation order change in Cycles.

This is a regression and to be ported to the final release branch.
2015-03-17 15:48:56 +05:00
d21c1dc1b4 partial material deletion fix for Fracture Modifier, effectively keeping necessary slots, else the mesh gets messed up which leads to crashes, and... making visible_mesh_cached now necessary for returning a dm out of the modifier 2015-03-13 10:32:54 +01:00
13551302c0 fix: correction for material handling with sub object groups, it could happen that the index was calculated incorrectly, thus leading to black faces (no material) 2015-03-12 21:37:51 +01:00
151b6f25db added material handling for sub object groups, target object gets all materials of group (no duplicate slots, with proper index remapping) 2015-03-12 19:42:34 +01:00
8bd7d43ae0 added different constraint types which can be applied between clusters, with sub object groups meshes from different objects are converted to clusters automatically, so you can have in a limited way different constraint types between different objects 2015-03-10 12:42:37 +01:00
29c1dfcf8a combined cutter group with other point sources now, and moved it under Advanced Options, and some cleanup of ifdef 0 code 2015-03-07 12:29:07 +01:00
546eee7005 crash fix: forgot to "walk" over the cutter_group inside the modifier, effectively forgetting to set references to the helper group, thus resulting in a crash at loading time 2015-03-05 20:55:56 +01:00
006d6cfaf4 fix: greasepencil by edges did not take object transformation into account properly 2015-03-05 20:23:41 +01:00
70f7052a54 possible fix for loading subobject group objects with textures 2015-02-25 22:43:38 +01:00
9b6c9a8299 fix: crasher at loading objects with subobject groups, but TODO, sometimes odd mesh error (like missing texture or even 1 displaced vertex, probably due to threading issues ?) 2015-02-23 21:01:07 +01:00
28da4a786e fix: loading for subobject groups partially fixed, needs manual refresh afterwards still, TODO, proper material handling ("merge" object materials) 2015-02-23 14:20:56 +01:00
55df8ba231 fix: sub object groups should work a bit more reliable now, did crash very often before 2015-02-23 10:51:07 +01:00
e2669381e2 simplified greasepencil to mesh code (in fracture by greasepencil edge) a bit 2015-02-22 11:05:33 +01:00
c7b2cbe3b4 good performance improvement for autohide, using BM_face_at_index() now instead of BM_face_at_index_find(), which makes it reasonably faster 2015-02-22 01:44:27 +01:00
61ad3f80b7 fix: improved "fix normals" in conjunction with autohide, might be slower, but looks way better with the right settings (as in fix normals search radius and autohide distance) now, using limited dissolve with keep normals operator (during autohide) 2015-02-21 22:55:07 +01:00
f1714a370e fix: skip invalid shards when doing voronoi+bisect+fill, (less than 3 verts), this caused crashes when trying to load files with fracture results being stored this way 2015-02-21 14:04:05 +01:00
a6b53d6892 fix: some performance optimization when rebuilding constraints on triggered objects (was calling unnecessary restoreKinematic() function in this case) 2015-02-20 12:57:07 +01:00
bb64f588dd fix: rewrote clustering so it operates on the mesh islands now prior to constraint generation, instead of operating on shards only during fracture time 2015-02-19 18:58:23 +01:00
f5414f989b fix: mesh was messed up if you used no pointsource, just the islands. 2015-02-18 23:33:22 +01:00
2d1b5121df added greasepencil edge fracture, the direction of cutting is currently limited to global X, Y or Z axis 2015-02-18 20:46:15 +01:00
66affa5cf3 fix: cutter groups should work mostly now 2015-02-18 11:57:24 +01:00
eebf770f1d fix : set some better default values for Fractal Boolean, so the object / default cube should not explode automatically, but its far from optimal still this way.... (active objects with Mesh Shape cause unstable simulation behavior) 2015-02-17 22:39:25 +01:00
3014c07906 fix : forgot to set inner material with fractal boolean 2015-02-17 22:13:21 +01:00
61ca70df40 added cutter groups, this is intended to define custom sets of objects to make boolean cuts against, but its still WIP, as it still fails too often 2015-02-17 21:37:55 +01:00
0a604079b6 revert bad activation fix for triggering, caused crashes in some cases (like on non-kinematic triggers) 2015-02-15 19:32:47 +01:00
30de8274a3 fix: trigger system now triggers in time, there was a delay before due to unnecessary postponed revalidation, now the shards are directly activated on hit 2015-02-13 16:47:30 +01:00
4d82812e13 fix: for severe performance issue with fractal, did unnecessary unwrapping operations there 2015-02-10 22:37:46 +01:00
ef47b883cd crash fix: removing the fracture modifier again from object without executing fracture first did crash 2015-02-10 10:49:10 +01:00
02d82a9035 limit autohide distance between 0.0 and 10.0 (mostly very low positive values are used, like 0.001) 2015-02-09 14:24:09 +01:00
a238bbf323 crash fix: changing constraint settings prior to execute fracture caused a crash 2015-02-09 14:23:26 +01:00
f085584c71 fix: do not write shards with only 1 vertex, this causes problems when loading the file afterwards, omitting those shards and islands seems not having a negative effect up to now 2015-02-09 14:11:48 +01:00
43d426bb26 fix: crasher when appending object with modifier and when trying to remove rigidbody traces when no rigidbody world is available 2015-02-07 15:06:44 +01:00
28efc108ed fix: added cluster_group to presets 2015-02-06 21:28:53 +01:00
3fb798666a fix: clustergroup centroid search didnt take obmat into account 2015-02-06 21:24:00 +01:00
d4fce19d4f added a cluster group setting, where helper objects can define locations of cluster cores (shards will be added to its clostest core always), converted objects belong to a group now also 2015-02-06 16:26:21 +01:00
5cabdd394f fix: inner vertex group was empty after refracture 2015-02-04 14:49:59 +01:00
841d916796 fix : autosmooth didnt work on all faces when boolean fractal with smooth inner faces was used (added unnecessary sharp edges before) 2015-02-03 19:07:18 +01:00
a715ef9f7f allow independent setting of cuts and iterations (please PLEASE keep low like about 5 max but not at the same time ! or computation time will explode) but this allows some control over fractal pattern,
also allow smoothing of inner faces
2015-02-03 18:02:13 +01:00
5263d91491 first attempt of fractal boolean fracture, but speed is slow, result may be messed up and sim is unstable (use mesh shape and margin = 0, as well as scale down the physics mesh... or use constraints to keep the object together) 2015-02-03 14:41:17 +01:00
746c5035c2 Revert "splash screen update for branch"
This reverts commit 53efacd78c.

In future please don't commit custom splashes to branches, adds unnecessary binary file overhead to the whole repo

Noted here:
http://wiki.blender.org/index.php/Dev:Doc/New_Committer_Info#Branch_Usage
2015-02-02 09:40:21 +11:00
53efacd78c splash screen update for branch 2015-02-01 20:04:10 +01:00
3bc11a9cf2 fix: crasher when removing the modifier on frame > 1 and trying to rerun the sim , fix: crasher when reverting the file with fracture modifier on it 2015-02-01 18:44:44 +01:00
9f987ae2d0 remove version hack for MeshDataTransfer (since this is reverted now) 2015-01-24 13:17:34 +01:00
3dda7a4312 Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier
Conflicts:
	source/blender/editors/space_outliner/outliner_draw.c
	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 (reverse-merged from commit 4401500cac)
2015-01-24 13:15:58 +01:00
fd490f416f Revert "Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier"
This reverts commit 4401500cac, reversing
changes made to bdb170ca60.
2015-01-24 12:58:35 +01:00
bbf09d9ee6 Point 2.73a release to updated addons revision 2015-01-20 23:16:03 +05:00
ced2738049 Show 'a' on the splash screen 2015-01-20 20:40:25 +05:00
e076fca578 Point addons to the backported revision 2015-01-20 19:10:39 +05:00
9bd38a1796 Bugfix T43293: Crash when editing shared GPencil datablock in VSE
The problem here was that when a Grease Pencil datablock is shared between
the 3D view and another one of the editors, all the strokes were getting handled
by the editing operators, even if those strokes could not be displayed/used
in that context. As a result, the coordinate conversion methods would fail,
as some of the needed data would not be set.

The fix here involves not including any offending strokes in such cases...

Conflicts:
	source/blender/editors/gpencil/gpencil_edit.c
2015-01-20 21:17:56 +11:00
aee458d674 Fix error in freestyle api 2015-01-20 20:20:17 +11:00
08eabd1997 Fix own error in freestyle api
Conflicts:
	source/blender/freestyle/intern/python/BPy_ViewShape.cpp
2015-01-20 20:20:03 +11:00
c9ca7b816e Fix T43311: using displacement shader crashes blender
Issue was caused by wrong order of scene device update, which could
lead to missing object flags in shader kernel.

This patch solves a bit more than that making sure objects flags are
always properly updated, so adding/removing volume BSDF will properly
reflect on viewport where camera might become being in volume and so.
2015-01-20 20:18:23 +11:00
dd1be8ccc5 Fix for security issue loading blend's
Auto-Execute option could be overridden by opening a startup.blend
2015-01-20 20:18:23 +11:00
41cb67647d Fix T43301: Three of the 'mirror keyframes' tools were mirroring along wrong axis.
Names are rather confusing here... :/
2015-01-20 20:18:23 +11:00
1bae0566b2 Sequencer: Don't crash when trying to rebuild proxy without having sequence edits 2015-01-20 20:18:23 +11:00
5374cfae78 SDL wrangler: Support loading SDL2 libraries of different names
Seems different distros might have different naming rules, so need
to adopt our code for that.
2015-01-20 20:18:23 +11:00
57087245a4 Fix T43156: Cycles incorrect final render, proper viewport with moblur disabled
Really stupid issue caused by typo in bitfield bit lead to bit conflict,

Not sure how it was done, could be some bad merge conflict resolve in the
original commit or just pure man stupidnes.

This is a nice example when having set of small test render scenes hooked
to the ctest would really help.

It's probably not that stopper issue (even tho still quite bad) since it
was made 2 months ago. But if we ever do 'a' this time it's a nice change
to include.
2015-01-20 20:18:23 +11:00
e51d7f1fb3 Fix T43229: Knife-project regression (broke knife-project)
There have been quite a few issues with knife precision,
tested reports (T43229, T42864, T42459, T41164) and this works with all.
2015-01-20 20:18:22 +11:00
f9aa8c64e6 BMesh: Tweak behavior for select more/less
Stepping over faces gives overall nice results but it stopped wire edges from working.
Now step over wire too.
2015-01-20 20:18:22 +11:00
0073b17d03 Fix OpenGL Context freeing 2015-01-20 20:18:22 +11:00
324d0448b1 Fix typo in OCIO configuration file 2015-01-20 20:18:22 +11:00
c08ef9c62a Fix T43208 material flickering in edit mode.
Happens because material setting now occurs in the derived mesh drawing
routine as it should. However that means that it also happens during
selection and that influenced the drawing state somehow.

In 2.72 this did not occur because material setting happened during draw
setting (skip or draw) instead of after the draw setting passed (so
selection would skip it by use another draw setting function). Of course
this violated design but worked.

Made it now so backbuffer selection does not enable materials (it's
redundant in those cases anyway).

This could be ported to a possible 'a' release but as is classic with
display code there may be some other places that it could backfire.

Tested fix with texture/vertex painting and selection which use
backbuffer for both subsurf and regular meshes and it seems to work OK.
2015-01-20 20:18:22 +11:00
ba43ea24a7 Fix T43204: Shrinkwrap constraint, project mode: Space ignored in bone case.
Own fault in rBb154aa8c060a60d to fix T42447... Reverted that commit, and added
kind of not-so-nice hack instead.

Note root of the issue comes from the special case we are doing here re 'Local'
space of parent-less objects. In that case, local space should be the same as
world one, but instead we apply the object rotation to it... This is inconsistent
with all other cases and could very well lead to other issues as T42447, but afraid
fixing that properly would be rather hairy - not to mention it would likely break
all existing riggings etc. :(

Should be safe for a 2.73a, shall we need it.
2015-01-20 20:18:22 +11:00
1253a46370 Fix for regression in bmesh connect-pair
T42563 fix wasn't right, fortunately this doesn't fail in most cases.
2015-01-20 20:18:22 +11:00
9a0c2c734c Fix texture sampling with generative modifiers - sample backbuffer
returns indices in mesh face range
2015-01-20 20:18:21 +11:00
973e387247 Fix for GTest 2015-01-20 20:18:21 +11:00
fdbedfef69 Fix gtest linking on ubuntu and do minor cleanup.
Generally for build systems, libraries that do not depend on other
libraries, such as system libraries, OpenGL etc always go at the end.

We could even get rid of some duplicate dependency libraries here but
auto duplication by build systems and differences between OSs make this
difficult.

GTest still duplicates all libraries twice to solve some issues which is
weird (maybe libs are not sorted correctly for some reason? needs
investigation)
2015-01-20 20:18:21 +11:00
1d0c23823d Fix crash in texture paint sampling when sampling materials without
textures slots
2015-01-20 20:18:21 +11:00
a1a182c268 Fix T40257: Frustum culling not working properly
Instead of getting fancy this time, we'll just use Mahalin's simpler
fix. This may have slight performance impacts, but it is a lot simpler
than the previous fix and shouldn't cause as many bugs.
2015-01-20 20:18:21 +11:00
e5fbe7466e Revert "Fix T40257: Frustum culling not working properly"
This reverts commit 315609ec0c.

This fix still causes more issues than it solves.
2015-01-20 20:18:21 +11:00
012f7ca1b5 Fix invalid memory access in gradient brushes - could cause a crash in
MacOS.

This looks like an oldie and should not influence release, but if we do
make an 'a' build it's safe to include.

Report by Craig Jones, thanks!
2015-01-20 20:18:21 +11:00
22cc938056 ugly modifier numbering "fix" for fracture modifier... just for the branch! 2015-01-11 18:04:32 +01:00
4401500cac Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier
Conflicts:
	source/blender/editors/space_outliner/outliner_draw.c
	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-01-11 17:35:46 +01:00
bdb170ca60 refactored function for loading fracture modifier out 2015-01-11 17:21:39 +01:00
53034cf102 compile fix due to function name cleanup 2015-01-09 15:12:47 +01:00
4c6b50c8ab Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier 2015-01-09 14:54:19 +01:00
67439dfe06 Remove executable flag from the build configuration files
They're not intended to be executed directly and seems mode change happened
by accident.

Setting -x for this files to avoid possible incidents by trying to run this
files in shell.
2015-01-08 23:44:29 +05:00
96629dfe0e exclude git/arc files from tgz archive 2015-01-08 23:44:02 +05:00
1a7c5ccbfb correct permissions 2015-01-08 23:43:55 +05:00
Dalai Felinto
b4d8fb573e Logic Bricks *must* be kept in alphabetical order 2015-01-07 18:17:20 +05:00
a52fe40c84 Followup to fe3e000: no need to exit pose mode on operator redo
This is to be backported to the release branch.
2015-01-07 15:44:49 +05:00
fedb34c592 Fix: Segfault in Image Editor when transforming GPencil Strokes 2015-01-07 15:44:30 +05:00
9f5223e4d2 Fix: Missing updates for UI panels and main region when using Grease Pencil in Image Editor 2015-01-07 15:44:20 +05:00
2db46a6045 Fix: Restored "Draw Poly" to D Ctrl RMB, as D Alt LMB was blocked by Alt-D (duplicate) keymap 2015-01-07 15:44:15 +05:00
f7aab6ca5b Blender 2.73 release commit
Hopefully this one would eb the exact revision used for 2.73 final release
2015-01-06 17:58:44 +05:00
110459c0da GTest was broken on Linux 2015-01-06 14:57:07 +05:00
ee045d2bd5 BLI_string_utf8: add BLI_strncpy_utf8_rlen 2015-01-06 14:55:57 +05:00
d93ccef052 Fix T43143: DPX header wrong, making it impossible to import to other software
The issue was caused by the single letter in header, which is expected to be
captial as per standard: http://www.simplesystems.org/users/bfriesen/dpx/S268M_Revised.pdf
2015-01-06 14:33:39 +05:00
0b5a64fe7f Fix T43122: Shrinkwrap target, wrong linked object 2015-01-06 14:33:39 +05:00
f322362363 Recent fix for SDL2 broke joysticks for SDL1.2 2015-01-06 14:33:38 +05:00
b8b7bd0e6a Fix for crash for 'Edit Source'
was accessing freed menu region.
2015-01-06 14:33:38 +05:00
ff09547f80 Fix 8 memory leaks from bad PyList_Append use 2015-01-06 14:33:38 +05:00
91a975100c Fix for view map cache not flushed by updates of edge detection options.
This fix should be considered for inclusion in the 2.73 release, since
it concerns a new feature of Freestyle introduced in 2.73.
2015-01-06 14:33:38 +05:00
5be01ff4b3 Cycles: Fix compilation error on AVX platforms with -arch-native
Was a conflict in headers between clew and util_optimization.h.
2015-01-06 14:33:38 +05:00
a912699792 Fix (unreported) 'pad9' not shown by UserPrefs' KeyBinding filter.
Minor glicth, but still... Safe for 2.73.
2015-01-06 14:33:38 +05:00
b7b5c99215 Fix T43099: Modifiers in edit mode might mess up materials
The issue was originall caused by 2e8ba17 by removing necessery call
GPU_enable_material(). It was probably removed because in some cases
material was enabled after calling setDrawOptions.

That wasn't always a case for edit mode.

This is absolutely to be included to 2.73
2015-01-06 14:33:38 +05:00
84dde30662 Fix T43066: Joystick broken in GE since 2.73rc
Caused by move to SDL2, fix thanks to jensverwiebe.
2015-01-06 14:33:38 +05:00
6fab0a4643 Joystick: Suppress add/remove device events
Previously they'll be printed to the console as a totally unknown events
together claim this shouldn't have happened which is just misleading.
2015-01-06 14:33:38 +05:00
137ddd665e Fix an odd line that slipped in my ghost_hack_first_file commit 2015-01-06 14:33:37 +05:00
fe3e000511 Fix T42780: Object linking allows to have linked armatures in pose mode
This isn't so bad for until one goes re-posing the armature and then uses undo.

It is the same issue as with edit mode which was solved back in the days.
2015-01-06 14:33:37 +05:00
b0dc79c14b Revert "Fix T42888: Separate and Combine HSV distorts the hue value"
This reverts commit 1549fea999.

After some further discussion with other developers in the team it becomes
clear there's no correct solution here. It is just more matter of what's
more convenient in particular case.

We're just going back to old code to avoid possible frustration with the
older files in newer blenders. This also means all HSV/HSL is considered
to be "linear" in the shading nodes.

Would be ported to 2.73 final.
2015-01-06 14:33:37 +05:00
6b6b28a9d4 fix for doc generator 2015-01-06 14:33:37 +05:00
0a1deaf89c Fix leak in cycles-bake 2015-01-06 14:33:37 +05:00
71d16196f3 Fix leak in select-similar regions 2015-01-06 14:33:37 +05:00
2a72518af7 Fix buffer overrun calculating unique names 2015-01-06 14:33:37 +05:00
a04f7de6b7 Fix a very stupid memleak in own bpy_app_translations.c code...
Safe for 2.73.
2015-01-06 14:33:37 +05:00
9cc8a5c673 Fix T43034: beautify-fill leaves zero area tri's 2015-01-06 14:33:37 +05:00
4508642489 cleanup: redundant tri-normal calculation 2015-01-06 14:33:36 +05:00
e436c83be0 Only add a fill brush to default .blend if there isn't one already. For
some reason this happened twice here.

Likely candidate for 2.73 final
2015-01-06 14:33:36 +05:00
950be80ab8 Fix T43010 regression in material setting.
Caused by own fix for another display case.

Shoud be safe for 2.73 final.
2015-01-06 14:33:36 +05:00
julianeisel
919ec85f6c Fix T42977: Weights failed to display in Wireframe mode when using Face Select
D948, reviewed by @mont29 (thanks for that)
2015-01-06 14:33:36 +05:00
cde1351578 Fix T42641, Graphical fragments showing on Blender 2.71 and higher when baking.
Safe for 2.73...

This revert rB9b0ab890676790bb1e8e77797629b889ea66f69e - needed to set that threshold to a small
negative value to remove the last artefacts reported in T39735, but now I could not reproduce
any with the previous 0.0f value, so restoring it for the time being.

If this 'shadowed neighbor face' case re-appears, we can always choose a value in-between, like -1e-18f...
2015-01-06 14:33:36 +05:00
9556f61013 Fix T43013: Flip with bridge aligned loops 2015-01-06 14:33:36 +05:00
880f4fbc38 cleanup: use cross_tri_v2 when area isn't needed. 2015-01-06 14:33:36 +05:00
ae1d416aec OSX: revive GHOST_HACK_getFirstFile cause it breaks things on older OSX versions.
Dunno exactly why this was done earlier, but propose not to remove code not understood.
2015-01-06 14:33:36 +05:00
31862bc562 Fix T42938: image.save_render sometimes saved the wrong pass
Stupid mistake with non0initialized image user.

Safe for final 2.73 release branch.
2015-01-06 14:33:36 +05:00
f1ab8f8930 Cycles: Fix really bad bug with shadow rays on non-SSE CPUs
basically shadow rays were totally broken and most of the time did not record
any intersections, leading to really ad rendering artifacts.

This commit makes it so regardless of enabled optimization level render result
would be the same.
2015-01-06 14:33:35 +05:00
3fcc5520fd Fix rna paint update callbacks assuming meshes 2015-01-06 14:33:35 +05:00
5a51b93aa5 fix: restore kinematic state for regular triggered rigidbodies always now, they very likely were kinematic before, user must disable triggered checkbox if this is not desired 2015-01-02 15:15:01 +01:00
6c4c1fbb3c fix for unnecessary activation of all parts again and again, this resulted in never ending movement... now this applies to kinematic objects only, which lose their kinematic state due to being triggered 2015-01-01 12:54:51 +01:00
752dd1c567 fix for incorrect merge in MOD_boolean_util.c, old functionality isnt necessary any more 2014-12-31 15:46:21 +01:00
6be2aab8d6 compile fixes due to merge 2014-12-31 14:00:22 +01:00
6b6a968053 Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier
Conflicts:
	extern/SConscript
	release/datafiles/splash.png
	release/datafiles/splash_2x.png
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/editors/physics/rigidbody_constraint.c
	source/blender/makesrna/intern/rna_modifier.c
	source/blender/modifiers/intern/MOD_boolean_util.c
	source/blender/windowmanager/WM_api.h
2014-12-31 13:59:45 +01:00
480ed9df62 crash fix: automatic material names management was wrong (got internally longer and longer and caused a stack overflow after some fracture attempts) 2014-12-27 16:21:34 +01:00
c93971e49e fix: convert to keyframes works directly from bake now, too 2014-12-27 14:40:05 +01:00
be30a2cd18 added a trigger flag, only rigidbody objects with this flag can trigger other objects (which themselves must be animated and have their "triggered" flag enabled 2014-12-27 13:27:10 +01:00
d46632d4cf fix: apply scale only prior to fracture again, preserve rotation because splinter rotation needs to be local 2014-12-27 13:08:27 +01:00
b0921d3f99 activate objects now when constraints are broken, this is an attempt to get rid of single shards stuck in the air, not being connected visually to other shards 2014-12-18 20:20:23 +01:00
fab16ef5d6 windows crash fix: material name had incorrect length 2014-12-17 21:00:28 +01:00
29434373dd fix for: splinters (axises should be local X, Y, Z again), added object name into material name, and allow conversion-to-keyframed-objects of multiple objects at once 2014-12-17 18:34:46 +01:00
d7a9e5ac94 fix: load inner vertex group now directly after blend has been loaded (no additional refracture necessary) 2014-12-15 20:51:52 +01:00
904dc50fd4 fix for inner vertex groups (contains real inner shards vertices now only) and option for smooth inner faces (useful with following subsurf and displacement modifier, works properly with boolean only 2014-12-15 13:36:42 +01:00
42f7a29f57 small fix, need to check for context.object being possibly None 2014-12-10 23:35:51 +01:00
5bb20444c6 added hack to enable loading fracture presets via python (bpy.context.fracture is not known otherwise when using python_file_run, it needed a fake context 2014-12-10 23:30:18 +01:00
05fdb2e63f added a breakable checkbox for fracture modifier, this is an attempt to enable destructability later on when needed 2014-12-06 22:53:50 +01:00
88ddeb3edc Modifier GUI "redesign", second revision 2014-12-01 20:23:49 +01:00
b4b0eb6315 splash update 2014-12-01 19:52:43 +01:00
420dff8cd3 Modifier GUI "redesign", first revision 2014-12-01 13:12:49 +01:00
8e2b30f1eb rename "Initial Particle Coordinates" to "Particle Birth Coordinates" 2014-11-24 16:39:23 +01:00
c890d60651 cluster breaking angle, distance, percentage added, rename contact distance to search radius, jump back to start frame of rigidbody cache now automatically at fracture time (or frame 1) 2014-11-24 16:36:27 +01:00
f09b89df01 automatically apply scale and rotation when executing fracture now 2014-11-21 20:41:15 +01:00
07d652a840 crash fix for convert to objects and fix for invalid positions after conversion as well (was all zeroed out) 2014-11-21 15:41:54 +01:00
1922d5e6d2 fix for convert to keyframed objects, had oddly rotating objects and NaN values in transform panel 2014-11-21 14:58:43 +01:00
b463ffc52c small improvement for autohide, removing inner edges now as well 2014-11-17 15:48:58 +01:00
95ccb70e1d fix for "fix normals", used incorrect float to short and back conversion and ignore global rotation of object in normals rotation now 2014-11-17 02:35:53 +01:00
60c776d014 limit autohide to faces with inner material and fix attempt for convert to keyframes bug (messed up object locations / rotations) 2014-11-16 16:23:09 +01:00
b89f7af287 added ghost objects, they do not collide but can activate animated objects 2014-11-16 03:07:31 +01:00
dcb0c61495 autohide now automatically removes doubles as well to close small gaps between shards due to constraint movement, tweaks to pointcache (no reset of cache) and a new bm operator (no normal recalc) were necessary 2014-11-15 00:35:18 +01:00
c519abe466 tweaks for convert to keyframe objects and fix normals 2014-11-14 16:49:34 +01:00
949be0f50a change order of checked expressions in rigidbody object creation -> could crash on non-mesh object 2014-11-13 22:43:08 +01:00
1dc314342d memory leak fix in find_normal 2014-11-13 01:43:07 +01:00
9283c5e96c fix normals improvement: take only normals pointing to same direction into account inside a certain search radius 2014-11-13 00:12:39 +01:00
fdb18c9d64 can activate constrained objects too, new setting: cluster solver iterations override, attempt to show only cracks between clusters during activation 2014-11-12 13:14:00 +01:00
96aac3fa6f rigidbody trigger activation fix, works better with constraints now and let objects with passive group appear as active 2014-11-12 11:46:36 +01:00
f7d25d5c6d for rigidbodies with mesh shape, take only the mesh into account when triggering rigidbodies (instead of boundingbox) 2014-11-10 18:46:57 +01:00
985df04b87 only take active objects into account with kinematic deactivation (trigger) 2014-11-09 20:08:46 +01:00
f3d0a7591f automatically create inner (and outer) material if not specified 2014-11-09 12:55:21 +01:00
0a59c0132e Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier
Conflicts:
	source/blender/blenkernel/intern/pointcache.c
	source/blender/blenkernel/intern/rigidbody.c
2014-11-08 12:58:48 +01:00
608a662ecb triggered objects dont need to be fractured any more and restore kinematic after load 2014-11-08 12:14:36 +01:00
16ee031bb7 only activate actually touched shards (todo, maybe override this with a global setting) 2014-11-06 21:16:01 +01:00
b306d0de39 had to disable trigger of constrained object by other non-triggers, this lead to permanent bullet crashes 2014-11-06 19:06:08 +01:00
18675f77fc another crash fix if simulation was continued after cache end with trigger and constraints, cache might behave incorrectly still if an object is refractured for example, but the others are not 2014-11-06 15:47:53 +01:00
ee199c563d crash fix for trigger when used with constraints, they were attempted to be removed multiple times 2014-11-06 14:10:32 +01:00
1fb3642cda added a new "Triggered" checkbox to rigidbodies, which allows them to be triggered in case they are kinematic. this will reset the kinematic state and make them dynamic 2014-11-06 12:39:58 +01:00
fcad67e087 fake trigger, disable animated checkbox on collision, (but this should be done by hand, earlier, to get better impact speeds) 2014-11-06 02:33:21 +01:00
936bb32d45 new splash screen and fixes for convert to keyframe operator, empty was parented incorrectly (depgraph update missing, but threaded option is broken now) 2014-11-02 01:44:22 +01:00
32a4b43dbc bugfix, convert to keyframed objects didnt work when escape was used to stop the simulation before 2014-11-01 17:10:18 +01:00
88a66ded74 optional job system for convert to keyframed objects, faster conversion, and taking bakes into account 2014-11-01 14:37:58 +01:00
026ffafb1b Bake modifier simulation to keyframed objects directly 2014-11-01 01:28:20 +01:00
d7bc7de7a9 customdata support with sub object groups 2014-10-31 11:46:12 +01:00
f12479c458 support fractured mesh as fluid obstacle 2014-10-31 02:08:34 +01:00
d2fa5668ae centroid fix / point cloud fix, forgot to multiply with splinter matrix 2014-10-30 13:20:59 +01:00
f64eef7a5f simplified wood splinter settings, can set scale factor and direction now directly 2014-10-30 12:10:37 +01:00
27521b0671 crash fix: when fracture is triggered on disabled modifier, modifier is re-enabled and fracturing again, simulation can crash. Also fix for not being able to fracture afterwards (push button twice or alternatively hit Alt A or remove and re-add the modifier 2014-10-24 20:48:25 +02:00
cfec1eea63 reordered functions and made them static in MOD_fracture.c, leaving out some unnecessary info for writing to blend in writefile.c (still have that read_struct memoryleak sometimes) 2014-10-21 18:55:18 +02:00
a6a38e56f4 compile fixes after using more strict compilation settings, quiet some warnings effectively this way 2014-10-19 20:59:34 +02:00
aa7ccbff35 crash fix: deleting fracture modifier helper objects left group objects with go->ob == NULL, which caused crashes in depgraph update, now also deleting group objects with go->ob == NULL 2014-10-19 13:28:34 +02:00
79392ccad9 simpler and cleaner reimplementation of clustering algorithm, caused crash before 2014-10-18 10:27:46 +02:00
a98a70dd0c Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier 2014-10-12 17:13:29 +02:00
8cea11e1a7 memoryleak fix, forgot to free nor_tree in some cases 2014-10-11 15:22:25 +02:00
120b572367 fix for messed up mesh if object is moved out of particle range, and some clarification for sub object group (last attempt to fix failed again, hrm) 2014-10-11 14:31:16 +02:00
3aa6de7e43 fix for: comparison with wrong rigidbody count caused deactivation of the cache and simulation was not cached any more 2014-10-10 20:30:00 +02:00
a468002406 dont use BLI_findlink for first shard (can access directly) and load shards into correct "parent" struct 2014-10-10 16:29:33 +02:00
7ccbc6651b crash fix when fracturing, missed initalization of listbase and quiet some warnings 2014-10-10 16:07:17 +02:00
3fbbb2752c replaced Shard pointer to arraypointer by ListBase for FracMesh->shard_map in DNA, for fracture modifier 2014-10-10 15:55:50 +02:00
92dbf1c9da forgot to calculate volume of whole object in mass calculation, leading to each shard having the same mass 2014-10-10 10:43:57 +02:00
e0712fc38b Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier 2014-10-09 23:34:39 +02:00
556476ab22 reactivate fracture modifier object deform motionblur support, was disabled with last commit 2014-10-09 22:55:27 +02:00
b5ab717f88 Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier
Conflicts:
	source/blender/editors/physics/CMakeLists.txt (reverse-merged from commit c9769a6808)
2014-10-09 22:28:51 +02:00
1c256222dd memory leak fix for text fracture / sub object groups 2014-10-09 19:27:04 +02:00
c9769a6808 Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier
Conflicts:
	source/blender/editors/physics/CMakeLists.txt
2014-10-09 17:13:27 +02:00
c4b94f3049 explaining comment: "need to distinguish between mesh and non-mesh objects for fracture modifier" and quiet some warnings 2014-10-09 16:29:33 +02:00
bec396fc96 removed unnecessary conversion from radians to degrees (internally) and using degrees just in the UI 2014-10-09 16:24:55 +02:00
4048c4ddae replaced rigidbody count function (avoiding 3 different loops over rigidbodies) and quiet some warnings 2014-10-09 14:55:42 +02:00
e75530e435 cleanup: automatic code styling with uncrustify_clean.sh 2014-10-09 13:52:13 +02:00
bc99752aa2 closed some memory leaks when calculating shard mass and after fracture (C++ cell struct) 2014-10-08 21:27:11 +02:00
ee936bc922 added new setting for fracturing with particle sources, in most cases you want to use the particle
birth coordinates as pointsource, but you can override this to get the coordinates of the current particle simulation state. But as the particle cache is kinda broken and shows wrong positions at beginning if simulation has been run before, this can lead to errors. Best practice is to keep this option enabled, only disable if you really need to !
2014-10-08 13:02:08 +02:00
255fe8a9b1 cleanup: removed unused code and quiet some warnings 2014-10-08 11:01:41 +02:00
aeaf5d2967 crash fix for fracturing with particles, missed proper initialization of voro++ interface struct (in case no computation takes place we need to zeroize the structs in the array though) and usage of particle_state instead of particle_birth coordinates, to be able to use particles not directly at birth position (after particle simulation has run a while) 2014-10-07 23:20:45 +02:00
78c9142163 crash fix for: appending objects with fracture modifier from library blends without their respective scenes and attempting to fracture then to build up the modifier structures 2014-10-07 16:54:34 +02:00
78a1999a2b windows compile fix for inner shard unwrapping, used C99 standard array before there 2014-10-06 10:59:22 +02:00
556c4ae27f scons compiling fixes 2014-10-05 20:35:59 +02:00
36fa6826a8 cleanup, removed old unused code (old access method with filepointer) 2014-10-05 20:35:26 +02:00
249ccbdca7 rewrote access to voro++ to direct memory access, no file descriptors needed any more, needs test under win / mac as well 2014-10-05 15:54:18 +02:00
6812ad4a82 Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier_oldsim
Conflicts:
	source/blender/modifiers/SConscript
2014-10-03 17:41:41 +02:00
c6c495d7bf forgot copying cluster count when copying modifier settings 2014-10-03 16:38:30 +02:00
3a4344a9fa attempts to fix one small memleak in read_struct, but fail.... grrr where on earth this is supposed to be freed again ? 2014-10-03 11:55:04 +02:00
07a4b5c8e2 set voronoi + boolean as default fracture algorithm 2014-10-02 18:33:32 +02:00
96c15edf23 quick fix: copy modifier settings when copying the object 2014-10-02 16:33:29 +02:00
d8f0f75896 memory leak fixes while fracturing, but small leak while loading still present 2014-10-02 15:47:40 +02:00
de4e6a8c74 re-enabled a bullet(!) assertion which earlier caused frequent crashes in fracture modifier, its not acceptable to disable it (and probably wont help much, either) 2014-10-01 19:45:18 +02:00
86dc5b4e91 fix for compiler errors due to obviously missing includes 2014-09-30 11:03:09 +02:00
0320a2818a pre-review cleanup part 2 (style, comment cleanup) 2014-09-30 11:02:27 +02:00
454f6f7790 pre-review cleanup part 1 (until object.c, rest will follow in part 2) 2014-09-29 20:26:06 +02:00
fbed421177 removed some old demolition remainders (that was accidentally merged in before) 2014-09-25 12:47:16 +02:00
c9db5f28a5 merge related compile fix 2014-09-24 20:22:49 +02:00
249a962bf4 Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier_oldsim
Conflicts:
	source/blender/bmesh/intern/bmesh_operators.c
2014-09-24 18:38:59 +02:00
174b4e3c39 Merge pull request #4 from JT-a/fracture_modifier_oldsim
Updated and added GPL headers w/Scorpion81 as contributor.
2014-09-24 18:22:54 +02:00
JT Nelson
39a080a238 Updated and added GPL headers w/Scorpion81 as contributor.
NOTE: did not assign author as copyright holder.  BF is assigned as copyright holder.
2014-09-19 08:26:21 -07:00
f323034489 preset update (covering newer settings) and inner vgroup now usable without inner material; but not very useful, hmm (because at higher shardcounts the entire object is selected, due to vgroup selection mechanism) 2014-09-09 21:09:20 +02:00
fa9e582898 inner faces are added to the existing active UVMap now 2014-09-09 08:58:28 +02:00
e5ff9cb892 first attempt of adding UVs to inner faces, need to pack them correctly still and put into separate UV Map.... 2014-09-08 15:00:02 +02:00
1a39125f7b fix for percentage (0 means deactivated again if not weighted) and used minimum again for weights 2014-09-05 00:02:20 +02:00
5a5cfba4a6 some bugfixes related to cleanup and taking averages for island weights again 2014-09-04 23:37:45 +02:00
837d3430bc constraint crash fix and breaking conditions fix (were evaluated incorrectly) 2014-09-04 01:48:21 +02:00
fb95e45983 take minimum of island weight instead of average as threshold modifier 2014-09-04 00:10:44 +02:00
d5e20f82c2 cleanup related compile fixes 2014-09-03 23:32:23 +02:00
c9e7a26d2a Cleanup for master, part 1, WARNING: Incompatible to older blends to to changes in DNA / loader 2014-09-03 22:41:46 +02:00
8a78bce10b added weighted percentage, distance, angle 2014-09-02 22:46:56 +02:00
1f1573019c fix attempt for own / extra vertices (was wrong transformation) 2014-09-01 13:03:34 +02:00
8bebaf6e29 fix for: customdata related crash in conjunction with split shards to islands 2014-08-31 23:11:18 +02:00
151d42c4bc fix for: fix normals (will be stored and loaded now, and transferred to convert objects too, BUT: split shards to islands has a bug there still) and convert to objects (get rid of all modifiers before fracture in stack, so the result wont be messed up) 2014-08-31 13:32:30 +02:00
21a070ec33 marking inner edges as sharp for boolean and bisect fill, additional option to fix normals (with edgesplit modifier) 2014-08-30 22:09:43 +02:00
77a2313ee6 fix for bake to keyframes 2014-08-30 11:21:44 +02:00
a955cb0fe8 attempt for customdata warning fix 2014-08-29 22:15:17 +02:00
bb8f482b27 own particles transform fix (forgot to multiply with imat) 2014-08-29 20:41:57 +02:00
689909d027 added fast bisect + fill algorithm 2014-08-29 15:09:34 +02:00
9874aa532d memory leak fix (autohide) 2014-08-28 23:00:23 +02:00
f8d4e67c4c some depgraph fix (related to fracture modifier, and scene_sort_group() 2014-08-28 22:26:46 +02:00
fe30202984 some depgraph attempts... WARNING: unstable ! 2014-08-28 21:33:13 +02:00
1d8c635499 fix for calculate mass crash, and attempt for edgebased fracture with voronoi (disabled, not working yet) 2014-08-28 18:18:32 +02:00
b2d7241473 crash fix when loading blend (due to new autohide option) 2014-08-26 11:54:55 +02:00
9f0017e426 added autohide distance, by default 0 and deactivated, as it slows down the sim and causes a big memory leak, also crashes randomly sometimes 2014-08-26 02:33:24 +02:00
149c6ed4b5 using inner material for finding inner vertex group now, other direct attempt was not successful 2014-08-24 13:21:54 +02:00
e79f713a66 float breaking angle and automatic deactivation (manual re-activation) of auto-execute when sim is started 2014-08-22 21:35:59 +02:00
8f9b3ee41b fix: mesh shape related memory leak and rebuild constraints after refracture 2014-08-19 23:59:06 +02:00
9486eee9bf attempt to create sub-objects by referencing a group of "child" objects within the modifier, but customdata transfer (like textures) wont work for some reason 2014-08-17 16:08:24 +02:00
1bec8ebf5c fix for inner vertexgroup, it worked on 1 shard only because it was always deleted and recreated for each shard, instead of sharing it (split shard to islands needs an inner material still) 2014-08-13 09:37:24 +02:00
5c7774e166 memory leak reduction, there still is a smaller one in readfile.c somewhere, sigh... 2014-07-30 11:05:32 +02:00
c605ce3974 fix for crash at changing mass when not at frame 1 2014-07-29 19:51:18 +02:00
924fbed8bc delete constraints always now before deleting meshislands, may crash otherwise 2014-07-28 16:50:44 +02:00
10b03edbc1 allow convert to object for modifier on non mesh objects too 2014-07-27 20:28:45 +02:00
6accd5ec1d typo: used SURF instead of SURFACE, prevented panels showing up correctly 2014-07-27 17:27:00 +02:00
870c06a9f5 added possibility to fracture text directly 2014-07-27 17:21:21 +02:00
765d2addc2 fix for editmode selection bug, added new option "auto execute" -> enable for editing, disable for simulation 2014-07-27 12:36:52 +02:00
7d6f7b161b crash fix for pressing "use constraints" prior to execute fracture 2014-07-26 18:47:30 +02:00
9a4ab59f33 another fix for the update bug, this time it really should work... 2014-07-26 13:33:01 +02:00
7e3190a51f added support for inner vertex group... WARNING: this is still UNSTABLE 2014-07-26 11:57:23 +02:00
f21c0c9a4b forgot to change one BLI_temporary_dir() call to BLI_temp_dir_base() 2014-07-25 23:57:10 +02:00
aaf82e554c change: rebuilding constraints should work now, BUT you have to put a modifier on all rigidbody objects now, otherwise the regular active rigidbody object will be reset when continuing an interrupted simulation, need to investigate why... 2014-07-25 21:16:01 +02:00
6301adb673 fix for re-enabling the constraints, takes now all objects into account in the first sim step 2014-07-25 20:32:39 +02:00
36ed23d6d5 fix for constraint update bug, all constraints must be re-enabled after a fracturing run if they are not recreated 2014-07-25 16:55:57 +02:00
391c09519c removed compound shape from RNA (did not work with modifier) 2014-07-25 16:55:15 +02:00
39945517e4 crash fix with other pointsources, forgot to initialize counts to 0... 2014-07-25 12:08:41 +02:00
a3b7f55d56 fix for losing texture images after load (pink object) but this still adds the image to the inner faces unintendedly, only should affect viewport and viewport render, glsl and rendering looks ok 2014-07-23 21:28:43 +02:00
9933f8ce80 convert to objects fix: now should take textures into account too 2014-07-21 10:29:02 +02:00
6b428cfb09 windows compile fix: replace BLI_temporary_dir() by BLI_temp_dir_base() 2014-07-21 08:37:35 +02:00
2101aaef83 fix for: fix normals, can use modifiers before fracture now too to get correct result 2014-07-21 08:36:57 +02:00
ed27f45665 revert last change again, was just a test 2014-07-20 21:00:15 +02:00
ead157ff39 gitmodules test 2014-07-20 20:43:18 +02:00
e67bba1100 merge related compile fixes 2014-07-20 10:13:57 +02:00
f1d6d5ab95 Merge branch 'master' into fracture_modifier_oldsim
Conflicts:
	extern/CMakeLists.txt
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/editors/interface/interface_templates.c
	source/blender/editors/object/object_edit.c
	source/creator/CMakeLists.txt
2014-07-20 06:34:51 +02:00
79888418c7 forgot to initialize totvert variable prior to building a kdtree 2014-05-27 19:02:43 +02:00
1ccf1b3e8b fix attempt for halving case, passive groups didnt work properly there 2014-05-27 16:42:00 +02:00
1f2077a8e4 added inner material support for boolean and bisect fill 2014-05-27 14:55:25 +02:00
eace5891ec added a fix normals option to let cracks in smooth objects nearly disappear, also rotates the vertex normals with the verts... WIP... because i need somehow to get the derivedmesh of the previous modifier in stack if there is one 2014-05-26 22:58:42 +02:00
feee2a4a77 added vertweight display for fracture modifier, and attempt to update data in case vgroups are changed, but this doesnt work, seems to require a refracture to interpolate data again 2014-05-26 16:15:06 +02:00
5bac249193 added vertex group support to mark passive areas of an object (which remain static)
also rudimentary ground toggle / ground connect toggle operators
2014-05-25 22:05:46 +02:00
c1515ce482 compile fixes after merge 2014-05-17 13:32:39 +02:00
21c06c40f4 Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier_oldsim
Conflicts:
	source/blender/blenkernel/intern/DerivedMesh.c
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/blenkernel/intern/smoke.c
	source/blender/editors/space_buttons/buttons_context.c
2014-05-17 12:56:31 +02:00
1e8aca99a8 just crash prevention, but mesh can still be messed up when attempting to move mesh out of fracture point location, especially with greasepencil 2014-05-14 23:47:42 +02:00
dd957e2be3 bah, other pointsources than uniform tend to crash, this is a fix attempt for greasepencil (but generally, dont try to move the object after fracturing with greasepencil by hand.... 2014-05-14 23:37:38 +02:00
65b6952a6f small gui fix in regular rigidbody constraints panel 2014-05-14 10:36:40 +02:00
f533d01fc8 well, a crash "prevention" with autosmooth, but it doesnt work anymore with the fracture modifier this way. 2014-05-13 23:22:40 +02:00
3b8eccb58f added threshold vertexgroup support (a single vertexgroup with weightpainting) 2014-05-13 17:23:06 +02:00
d1bbe76be8 reactivated modifier editmode "support" (but well, it doesnt really work...) and removed fracture edit mode (didnt work at all) 2014-05-13 09:28:54 +02:00
bfd5143aa2 added fracture preset storage and fix for loading files -> mesh was doubled there 2014-05-13 01:07:33 +02:00
576c3c5f94 re-added contact distance and mass dep. thresholds, also fixed a python gui error -> override solver iterations in scene 2014-05-12 23:07:06 +02:00
3a9261dbdf fix for automatical recreation of constraints after loading 2014-05-12 13:35:23 +02:00
a0ed785e78 fix for not updating fractured mesh with constraints enabled 2014-05-12 13:07:43 +02:00
dc96f8014d fix attempt for messed up bake data after linking objects 2014-05-11 20:35:49 +02:00
c9e920de81 copy rigidbody world when linking objects to scenes (if it exists) 2014-05-11 19:10:26 +02:00
92b42ef2aa can copy rb bakedata now with scene 2014-05-11 18:15:57 +02:00
4e5c2af871 crash fix for loading data with halving applied only (and no fracture) 2014-05-11 11:01:05 +02:00
04b00078d8 progress bar display fix attempt, still glitchy... 2014-05-10 16:54:59 +02:00
9f83814cb5 partial fix for progress display (can still exceed progressbar) and fix of a memoryleak when halving only 2014-05-10 14:19:21 +02:00
fb7ef3aed4 copied derivedmesh was not freed after usage 2014-05-09 20:55:46 +02:00
c9ad3c2da2 and even more gui cleanup 2014-05-08 19:34:12 +02:00
35cfca7a2c further gui cleanup 2014-05-08 14:16:34 +02:00
4396f9df88 fracture gui cleanup 2014-05-08 01:09:59 +02:00
4e59fa1b4b another crash fix attempt for refreshing constraint data on running / cancelled fracture 2014-05-07 18:31:55 +02:00
9687cb268c partial fix for crash at refresh constraints during fracture, or after cancelling it 2014-05-07 17:43:30 +02:00
f4ff8ff505 prevent fracture modifier removal when job is running 2014-05-07 10:52:39 +02:00
2cced6f6ff added running flag to prevent main thread from modifier execution when job runs, avoids crashes 2014-05-07 10:16:10 +02:00
27ef95a4b9 added (as experimental setting) the possibility to execute the fracture process as separate threaded job, but this crashes still very often, need to copy the modifier and stuff to a separate context and copy back afterwards 2014-05-07 01:59:48 +02:00
5f286bde0c some code cleanup, and attempt to find memoryleaks, but some are still present, sigh... again customdata related... 2014-05-06 14:38:36 +02:00
f158870a9a avoid crash when refresh after split to islands was missing and file was saved, but this is inconsistent sometimes, requiring an additional refresh possibly (due to memoryleaks possibly) 2014-05-05 23:33:08 +02:00
43e4a5b71e customdata fix for split islands 2014-05-05 13:02:26 +02:00
9df14f9c67 storage of split islands should work now... 2014-05-05 12:55:58 +02:00
202fd41d1a halving "improvement" made it only much worse performancewise, so keep the old one 2014-05-04 17:38:13 +02:00
44d97d0f47 added split shards to islands option... but with complex objects you need gazillions of constraints to hold this together... very very slow... 2014-05-04 14:47:58 +02:00
b986107829 another pointcache interpolation fix.... 2014-05-04 11:11:21 +02:00
3279e9227f possible fix for pointcache interpolation error with rigidbodies and subframes 2014-05-04 02:45:04 +02:00
cad0e8f07e hmm motionblur did work now ? strange... so commiting this as well 2014-05-02 20:10:45 +02:00
991100912a attempt to enable deform motionblur, FAIL... (object is not rendered at all) 2014-05-02 20:03:54 +02:00
e47b30595f enabled dependsOnTime... 2014-05-02 17:50:04 +02:00
1cdc116566 fixed the halving again 2014-05-02 16:18:47 +02:00
3453390bad deactivate plain voronoi fracture 2014-05-02 15:16:30 +02:00
ed2c7c7322 crash fix, return null if visible mesh is null 2014-05-02 14:23:52 +02:00
cffb510e65 some constraint change crash fixes 2014-05-02 13:46:09 +02:00
caf9d082cd some memory leak hunting, but some are still there 2014-05-02 11:22:33 +02:00
d7bbdab2f4 removed "fracture level" stuff, did not work properly under windows... 2014-05-02 10:37:23 +02:00
0da7bcb78c fix for warning; unnecessary semicolon... 2014-05-01 19:45:00 +02:00
13b97bbc0b crash fix attempt for loading fractured blends 2014-05-01 19:15:40 +02:00
82ff09ef1a attempt for saving / loading and texture preservation 2014-05-01 17:45:30 +02:00
0f80a3faaf split the processing loops to an openmp one and an openmp free, due to crappy windows compiler error 2014-04-30 23:59:41 +02:00
94c50f1277 removed additional customdata markings, added openmp again (first was not working with textures) 2014-04-30 16:10:05 +02:00
2decc0c647 doubled the shard count internally for fast bisect so input count and output count match 2014-04-30 14:04:57 +02:00
3f8806d394 using malloc instead of calloc for bisect fracture 2014-04-30 12:38:01 +02:00
3e26dfc02e nullify noisemap, for now to prevent crash on loaded file, modifier free 2014-04-30 11:32:25 +02:00
e3adc6e820 changed qsort to BLI_qsort_r 2014-04-30 00:32:50 +02:00
90e500c918 added a fast but inaccurate bisection method 2014-04-29 22:03:34 +02:00
5697d6f26d attempt to speedup bisect, but cant use OpenMP now, so a bit slower... but less cpu load... 2014-04-29 12:46:47 +02:00
f5e17e1f59 extended the critical section, hopefully this stabilizes it a bit 2014-04-27 16:45:16 +02:00
9877852266 tried to increase speed by openmp, but crashes more often now, especially when freeing things (double free...) hrm 2014-04-27 14:59:00 +02:00
fb2198dfe3 some cleanup ... 2014-04-26 23:30:21 +02:00
c2382339d2 all "optimizations" made it actually slower, so using full copy now... 2014-04-26 23:21:00 +02:00
26d7665c09 hrm bisect does not get faster... 2014-04-26 22:13:07 +02:00
4ab0f421a7 attempt to accelerate bisect fracture, but no real success... 2014-04-26 18:26:12 +02:00
8d20bf15c5 mac does not support memorystreams (fmemopen and open_memorystream) as well... using regular file there too 2014-04-24 11:12:39 +02:00
f487116c32 was merged incorrectly as well... 2014-04-24 09:52:39 +02:00
5208108373 those were merged incorrectly from and older branch, error was visible in windows. (crashes) 2014-04-24 01:16:07 +02:00
cef5642825 removed incorrect include stdbool.h 2014-04-24 00:53:56 +02:00
3f87907478 argh, Windows did not support memorystreams, so had to add regular file as fallback 2014-04-23 23:43:59 +02:00
9f34788ad6 memory leak hunting, there is still one unfixable related to customdata behavior (need to alloc twice there somehow, grr...) 2014-04-23 14:51:04 +02:00
9831a6b3e2 attempt to store fracture result and read it, failed, so deactivated for now 2014-04-22 20:21:16 +02:00
74d486b56e fix for crash at removing modifier 2014-04-22 17:46:00 +02:00
2c77a4da8c fix : dont create meshislands for empty shards, causes trouble with rigidbody sim 2014-04-22 17:36:11 +02:00
b34d1f8f8b rigidbody should work without fracture now too 2014-04-22 15:10:12 +02:00
6eb641b93a some more crash fixes 2014-04-22 11:47:17 +02:00
4777e74694 some fixes and a bit performance optimization 2014-04-22 02:17:42 +02:00
2b718bda3f small crash fix in case fracturing goes wrong (sometimes 0 shards...) 2014-04-21 22:58:41 +02:00
6d27993ad8 removed temporary material coloring of clusters and added support for uvs (boolean) 2014-04-21 22:41:44 +02:00
90d22621f5 fix for saving and loading 2014-04-21 13:55:44 +02:00
fe9c308bb1 sim should work again now 2014-04-21 00:46:50 +02:00
22dea61d55 hopefully simulation fixes... 2014-04-20 18:28:18 +02:00
0aa4f1d594 compile fixes... 2014-04-20 15:37:48 +02:00
462f1436c3 Merge branch 'refs/heads/rigid_fracture' into fracture_modifier_oldsim
Conflicts:
	extern/CMakeLists.txt
	extern/voro++/CMakeLists.txt
	extern/voro++/src/Doxyfile
	extern/voro++/src/c_interface.cc
	extern/voro++/src/c_interface.hh
	extern/voro++/src/c_loops.hh
	extern/voro++/src/container.cc
	extern/voro++/src/container.hh
	extern/voro++/src/container_prd.hh
	extern/voro++/src/wall.cc
	extern/voro++/src/worklist_gen.pl
	intern/rigidbody/RBI_api.h
	release/scripts/startup/bl_ui/properties_physics_softbody.py
	source/blender/blenkernel/BKE_rigidbody.h
	source/blender/blenkernel/intern/curve.c
	source/blender/blenkernel/intern/gpencil.c
	source/blender/blenkernel/intern/mask.c
	source/blender/blenkernel/intern/node.c
	source/blender/blenkernel/intern/object.c
	source/blender/blenkernel/intern/pointcache.c
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/blenloader/CMakeLists.txt
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/writefile.c
	source/blender/editors/animation/anim_markers.c
	source/blender/editors/animation/keyframing.c
	source/blender/editors/armature/armature_edit.c
	source/blender/editors/curve/editcurve.c
	source/blender/editors/include/UI_view2d.h
	source/blender/editors/interface/interface_handlers.c
	source/blender/editors/interface/interface_templates.c
	source/blender/editors/interface/view2d_ops.c
	source/blender/editors/mask/mask_ops.c
	source/blender/editors/mask/mask_select.c
	source/blender/editors/object/object_edit.c
	source/blender/editors/object/object_modifier.c
	source/blender/editors/physics/physics_fracture.c
	source/blender/editors/physics/physics_intern.h
	source/blender/editors/screen/area.c
	source/blender/editors/sculpt_paint/paint_hide.c
	source/blender/editors/space_action/action_edit.c
	source/blender/editors/space_clip/tracking_ops.c
	source/blender/editors/space_graph/graph_edit.c
	source/blender/editors/space_sequencer/sequencer_edit.c
	source/blender/editors/space_sequencer/sequencer_select.c
	source/blender/editors/uvedit/uvedit_ops.c
	source/blender/makesdna/DNA_modifier_types.h
	source/blender/makesdna/DNA_rigidbody_types.h
	source/blender/makesdna/intern/makesdna.c
	source/blender/makesrna/intern/rna_modifier.c
	source/blender/modifiers/CMakeLists.txt
	source/blender/modifiers/MOD_modifiertypes.h
	source/blender/modifiers/intern/MOD_explode.c
	source/blender/modifiers/intern/MOD_util.c
	source/blender/windowmanager/intern/wm_event_system.c
	source/blenderplayer/CMakeLists.txt
2014-04-20 14:43:14 +02:00
1972f7bd01 clustering for fracture 2014-04-20 12:41:40 +02:00
7bb6bf21d2 added point sources and seed 2014-04-17 12:13:19 +02:00
f49ddd310d bisect fix, geometry disappeared before 2014-04-16 13:25:56 +02:00
35e4e8a4fd missing brace caused compile errors... 2014-04-16 12:18:52 +02:00
15f50655e8 fixing compile.... 2014-04-16 11:20:05 +02:00
a04214d107 Merge remote-tracking branch 'refs/remotes/origin/master' into fracture_modifier
Conflicts:
	extern/carve/carve-capi.cc
	extern/carve/carve-capi.h
	extern/carve/carve-util.cc
	extern/carve/carve-util.h
	extern/carve/patches/series
	intern/bsp/intern/BSP_CSGException.h
	release/datafiles/locale
	source/blender/blenkernel/BKE_mesh.h
	source/blender/editors/space_view3d/view3d_select.c
	source/blender/makesrna/intern/rna_fracture.c
	source/blender/modifiers/intern/MOD_boolean_util.c
	source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.h
2014-04-16 11:05:38 +02:00
cc8bb235b9 pick attempts, fail 2014-04-16 10:32:24 +02:00
82285878f4 stuck / failing attempt for picking shards :( 2014-02-09 13:53:36 +01:00
de70b4e317 added (empty) fracture edit mode 2014-02-09 12:40:50 +01:00
e15f781ffd integrated latest crash fix (empty mesh at union operands) from sergey 2014-02-07 10:56:05 +01:00
413a80f966 small typo fix from sergeys patch 2014-02-06 11:06:34 +01:00
af818d32b3 Better handling of flipped face normals coming from voro++.
Instead of flipping the normals on the derived mesh, produce the face
loops in the correct order for shards.
2014-02-05 19:27:58 +01:00
5b4caa03ac Allow the fracture modifier to apply in editmode. 2014-02-05 18:51:48 +01:00
0daab1ef32 Fix for last terminator in voro++ output: this is just a single char. 2014-02-05 18:09:58 +01:00
310514c14e Simplified neighbor parsing from voro++ output.
Number of neighbors is exactly the same as number of faces - each face
has one neighbor. Moved this into the face section of voro++ output too,
since it's essentially face data.
2014-02-05 17:57:52 +01:00
d20aec59bd Fix for voro++ output parsing.
Use available print options from voro++ to get number of verts and loops
in advance, to avoid realloc. Also fixed bad mesh results with missing
vertices.
2014-02-05 17:16:59 +01:00
a3b452d752 Removed old dummy code for fracture. 2014-02-05 16:00:05 +01:00
9ca13f6e0e Added fracture_util.h to keep internal utility function declarations
out of the actual blenkernel header.
2014-02-05 15:02:29 +01:00
2befce02af a bit reduction of allocs, but still needed for loops (cant determine loop count fast / reliable for now in advance) 2014-02-04 20:37:01 +01:00
cbe0972d99 fix attempt for boolean 2014-02-04 13:54:17 +01:00
063d438054 Use a memstream again instead of a temporary file. But to avoid crappy
performance when directly parsing the stream, use a read-only string
stream afterward to do the actual parsing on the resulting char buffer.
2014-02-04 09:07:26 +01:00
bf59c1bc66 Use void argument to avoid compiler warning. 2014-02-04 08:54:12 +01:00
40fb7592f9 Applied diffs 837 and 838 from D274. 2014-02-03 13:25:42 +01:00
165bfecbc1 Merge branch 'master' into fracture 2014-02-03 12:39:30 +01:00
e66d3e5d0c Merge branch 'arcpatch-D274' into fracture
Conflicts:
	extern/carve/carve-util.h
	intern/bsp/extern/CSG_BooleanOps.h
	intern/bsp/intern/BOP_CarveInterface.cpp
2014-02-03 11:56:42 +01:00
9675ba189f Merge branch 'master' into fracture
The previous master merge was squashed, this has been reverted to avoid
unnecessary conflicts.

Conflicts:
	extern/carve/patches/series
2014-02-03 11:39:03 +01:00
4aeb8ea28f Revert "Merge remote-tracking branch 'refs/remotes/origin/master' into boolean_fracture"
This reverts commit ecc10dbe29.
2014-02-03 11:37:38 +01:00
15bb397fbb Rework carve integration into boolean modifier
Goal of this commit is to support NGons for boolean modifier
(currently mesh is being tessellated before performing boolean
operation) and also solve the limitation of loosing edge custom
data layers after boolean operation is performed.

Main idea is to make it so boolean modifier uses Carve library
directly via it's C-API, avoiding BSP intermediate level which
was doubling amount of memory needed for the operation and which
also used quite reasonable amount of overhead time.

Reviewers: lukastoenne, campbellbarton

CC: scorpion81, karja, jsm

Differential Revision: https://developer.blender.org/D274
2014-02-03 10:50:01 +01:00
c7a3a79da1 new boolean patch by sergey and small fracture bisect fix (need unity_m4 obmat instead of ob->obmat) 2014-02-02 20:30:03 +01:00
ecc10dbe29 Merge remote-tracking branch 'refs/remotes/origin/master' into boolean_fracture
Conflicts:
	extern/carve/patches/series
2014-02-01 15:53:38 +01:00
56beb2effe testing new boolean patch, CRASH ! in intersect.cpp, line 438 from carve 2014-02-01 15:24:29 +01:00
c2edd4cf8c memory leaks fixed 2014-02-01 13:11:52 +01:00
fe93f08d57 made fill optional with bisect 2014-01-31 23:31:56 +01:00
94c111072b tested different bisect fill algorithms; triangle fill on triangulated input turns out to be best 2014-01-31 22:12:58 +01:00
ae25dc66df changed memorystream back to real file, what a performance boost ! 2014-01-31 19:33:00 +01:00
0de34dcda1 added shard count / shard id to gui, tested performance, its very lousy compared to my earlier modifiers 2014-01-31 18:10:24 +01:00
cd6a1f503a made fracture algorithm selectable 2014-01-31 12:50:55 +01:00
87f2b86cd8 added bisect as second fracture algorithm 2014-01-31 12:23:25 +01:00
bffce8c727 tiny fix, boolean works without flipping the loops as well (except suzanne) 2014-01-31 10:08:38 +01:00
c20718e9d5 boolean fracture works ! (atleast partially, suzanne produces still errors) 2014-01-30 22:36:28 +01:00
5f8997a7a4 still a "negative" result, somewhere the normals need to be flipped, but how ?? 2014-01-30 21:03:11 +01:00
98e0ec4850 Merge branch 'refs/heads/boolean_fracture' into fracture
Conflicts:
	intern/bsp/extern/CSG_BooleanOps.h
	intern/bsp/intern/BOP_CarveInterface.cpp
2014-01-30 19:08:35 +01:00
2993b02b8e some fix attempts for flipping the face orientation, fail... 2014-01-26 23:56:30 +01:00
653a951ea3 first attempt of direct communication between blender<->carve layer and fracmesh, fail because normals are inverted.... 2014-01-26 22:53:32 +01:00
b257850ce2 saving fracture to blend and loading from it 2014-01-26 13:48:05 +01:00
de2e6a7004 Removed the vertco member in Shard, this was previously used for
simulation but is not needed any longer.
2014-01-26 12:05:15 +01:00
98ae9b083b Extended the BKE_create_fracture_shard funktion with a 'copy' argument,
so we can pass over arrays without having to do double alloc.
2014-01-26 11:58:09 +01:00
dd278f6a50 some memory leaks fixed, but some left, and attempt for writefile 2014-01-26 11:50:29 +01:00
57f8d0721f parsing and createdm makes valid mesh now 2014-01-26 11:13:26 +01:00
d1393032a2 parsing of voro++ data should work now, but a crappy mesh appears, hmm 2014-01-26 01:42:17 +01:00
7ff93f27ea attempt to parse voro++ data from string, not working yet 2014-01-25 23:36:03 +01:00
ca0b5ca635 Fix for point cloud construction: Use a point struct to avoid difficult
float arrays.
Also added Frac prefixes to prevent potential name collisions.
2014-01-25 20:41:03 +01:00
64e9066f4f A few small fixes for the voro++ C API, which seem to have fixed a
freezing issue when building with clang.

Also min/max initialization for point cloud construction.
2014-01-25 20:29:13 +01:00
f91218cbdf cmake cleanup: removed the ++ suffix from VORO cmake variables and
defines.
2014-01-25 20:02:03 +01:00
a511e86ebf Stub code for voro++ integration.
Not functional yet, but needs testing for potential voro++ bug.
2014-01-25 19:26:05 +01:00
34c07eed51 Removed the ShardList return value of the fracture function.
This is not used atm and it's a bit ugly to return such allocated
values. If necessary this can be added back later.
2014-01-25 17:28:53 +01:00
f86d71b025 Updated the pseudo-fracture method to new Mesh types. 2014-01-25 16:29:58 +01:00
3c310d565a New method for constructing the DerivedMesh for the fracture modifier.
Uses a simple union of all the shard mesh data.
2014-01-25 15:52:31 +01:00
f5e624aaad Create the initial fracmesh geometry by copying the input DerivedMesh
as a single shard.
2014-01-25 15:23:31 +01:00
fa1ace9f2d Removed the BMesh reference from FracMesh.
With the new Mesh data types this will no longer be needed.
2014-01-25 15:03:08 +01:00
5c21d96e5c Use plain Mesh types (MVert, MPoly, MLoop) in shards instead of copying
BMesh element arrays.

This will make Shard work more like a mini-Mesh struct and allow storing
of mesh data in blend files.

Larger construction methods currently disabled, TODO.
2014-01-25 14:36:30 +01:00
77cfd4e2f8 Partial revert of previous commit: DerivedMesh should be released by
setting needsFree and then calling dm->release.
2014-01-25 13:43:55 +01:00
414352fced fixed majority of memory leaks (of fracture) 2014-01-25 13:24:06 +01:00
090016f9d1 Moved the render_mesh DerivedMesh from FracMesh into the
FractureModifierData.

This keeps the derived mesh inside the modifier system and is more
in line with common principles in other modifiers.

Also did lots of style cleanup.
2014-01-24 17:15:22 +01:00
7e50455b8d basic foundation for fracture modifier / operator laid; todo fix memoryleaks... 2014-01-18 22:01:24 +01:00
d832011b82 modifier initial setup 2014-01-18 15:23:54 +01:00
c0907a6aa7 initial commit for new fracture system 2014-01-18 10:30:57 +01:00
30467f8e5c Code cleanup: As Sergey stated on bf-committers one should use id_us_min() if the user counter has to be decremented and not decrement the counter by hand. 2013-11-25 21:54:58 +01:00
3f8bd4fe15 Correct fix for T37617, (own recent regression) 2013-11-25 21:37:07 +01:00
375b6f5a57 Fix T37617: "Add plane" was adding a 2*2 grid
Was a regression from rBaa3c06b41ca9, hope this time all things are OK again (note the X/Y subdivision values still are different than before (-1 for same result), but imho they make more sense this way).
2013-11-25 21:27:35 +01:00
3f661c6355 Code Cleanup: rename vars for detecting change to be more consistent
rename change/is_change/is_changed/modified -> changed
also use bools over int/short/char and once accidental float.
2013-11-25 21:27:35 +01:00
a3050d4b2d fix: marking edges as sharp in modifier did not work any more 2013-11-25 20:09:53 +01:00
f3007c42fc partial fix for fracturing meshes where origin is not in bounds center 2013-11-25 20:09:53 +01:00
c1ae472a10 some hacks to keep baked files with clipping working... 2013-11-25 20:09:53 +01:00
f6b0828870 hopefully fixed atleast the fracture with text converted to mesh/remeshed and objects whose origin is not at bounds center 2013-11-25 20:09:53 +01:00
81fb6d5261 changed (i think corrected) the centroid calculation for fractured objects with boolean 2013-11-25 20:09:53 +01:00
b7a772f567 fixing crash at refreshing fractured text, cause was improper handling of the necessary temp object for boolean function (yuck) 2013-11-25 20:09:53 +01:00
d612fd67b4 attempt to make text and curves work with rigidbody modifiers too, still failing (flying apart... crashes...) 2013-11-25 20:09:53 +01:00
8d25904e52 fix for autorefresh and depgraph callback, strangely did only work for the testblend and not for others... 2013-11-25 20:09:53 +01:00
fb6afeedce using direct function for dissolve in object conversion too 2013-11-25 20:09:53 +01:00
d58cbd01dd using dissolve function now directly to circumvent (hopefully) the va_arg problems under windows 2013-11-25 20:09:53 +01:00
29766b78c3 cosmetical update in gui 2013-11-25 20:09:53 +01:00
f35868f1b3 fix for use_animation and no autorefresh, mesh was reset to initial state always... 2013-11-25 20:09:52 +01:00
75bd4dabbe making ngons in boolean case now too 2013-11-25 20:09:52 +01:00
a926f7afe7 attempt to fix strange misbehavior of va_list / va_arg under windows by passing it as pointer to BM_op_vinitf instead of as value 2013-11-25 20:09:52 +01:00
7e0258de36 using bool variables (true, false) instead of int TRUE/FALSE now 2013-11-25 20:09:52 +01:00
0a62a7f52d making real ngons in convert to object as well now 2013-11-25 20:09:52 +01:00
e62419008f added depgraph callback for autorefresh 2013-11-25 20:09:52 +01:00
0bd32da174 crash fix and graphical error fix when rigidbody modifier is used with autorefresh, for now must disable autorefresh manually to make sim work again 2013-11-25 20:09:52 +01:00
91d018bb76 added autorefresh for explode modifier and particle selection mask (still crashing with rigidbody modifier attached, hmm) 2013-11-25 20:09:52 +01:00
ac6b1d923d added solver iterations override and proportional solver iterations options 2013-11-25 20:09:52 +01:00
80f71bf21c dont convert unnecessarily in clipping mode as well 2013-11-25 20:09:52 +01:00
f718c1cdbe fixes for making explode "applyable" again, did not work anymore 2013-11-25 20:09:52 +01:00
6b7ab62c94 increased cache playback speed by atleast 10fps (from 14 to 24 in a 5000 shard testcube) by eliminating unnecessary bmesh conversions in explode modifier 2013-11-25 20:09:52 +01:00
70e1988a1c some attempt to reduce memory usage, but no luck, hrm. 2013-11-25 20:09:52 +01:00
d76ead8e13 fix for null-pointer crash when attempting to create a cached derivedmesh from nonexistent bmesh 2013-11-25 20:09:52 +01:00
ab4ddd008f free vertices_cached if present before re-allocating -> prevent memory leak 2013-11-25 20:09:52 +01:00
3be53ebfde init explode modifier right after addition 2013-11-25 20:09:51 +01:00
1291b54616 changed visible mesh to derivedmesh, some performance gain, but still need to copy it in modifier 2013-11-25 20:09:51 +01:00
1de7452ba5 made parenting to empty default, it also cleans up the outliner a bit, so removed the 2nd operator button and the operator property again, was confusing 2013-11-25 20:09:51 +01:00
6f6bf095d6 added "convenience" support for blender destructability editor -> convert with parenting, usable together with addon in "Loose Parts" mode 2013-11-25 20:09:51 +01:00
a584f90abc crash fix for bake to keyframes 2013-11-25 20:09:51 +01:00
b95df881af partial crash fix for outer constraints, convert to objects takes mass / dist dependent thresholds into account now 2013-11-25 20:09:51 +01:00
353892bb14 better refresh manually after duplicating objects with modifiers 2013-11-25 20:09:51 +01:00
728db50b65 some (failing) attempts to fix boolean intersection (often has "inverted" results) 2013-11-25 20:09:51 +01:00
a4f7e80d76 remove gitignore files from commits 2013-11-25 20:09:51 +01:00
9c9e8808c2 making ngons and marking edges as sharp for object convert operator 2013-11-25 20:09:51 +01:00
29d8e09c4c another attempt to fix baking, doesnt show negative side effects up to now 2013-11-25 20:09:51 +01:00
7d320da003 fix for baking regular rigidbodies, (hopefully) 2013-11-25 20:09:51 +01:00
48e8faeac9 hide the constraint empties after bake to keyframes, make sure you select the constraints as well prior to bake to keyframes or blender crashes afterwards (because of stray constraints not being removed properly) 2013-11-25 20:09:51 +01:00
5d4538ab29 fix for converting classic explode modifier to objects, objects had holes 2013-11-25 20:09:51 +01:00
169033992d compile fixes due to merge 2013-11-25 20:09:51 +01:00
24cf767e15 convert to objects takes textures into account now and makes ngons 2013-11-25 20:09:50 +01:00
b2459b805c crash fix for bake to keyframes and crash at quitting blender 2013-11-25 20:09:50 +01:00
a2d10e9848 throw away whole Rigidbodyworld and recreate when converting to objects to circumvent crashes 2013-11-25 20:09:50 +01:00
c2b0603e7a attempt for selecting the shards, doesnt work for some reason... hmm 2013-11-25 20:09:50 +01:00
69db68e8eb added experimental "convert to objects" operator, doesnt take textures into account yet 2013-11-25 20:09:50 +01:00
94a039ac52 fixed a memory leak; framemap was not deleted in some cases 2013-11-25 20:09:50 +01:00
e631dbb9af crash fix for using baked data with compounds 2013-11-25 20:09:50 +01:00
030423e7e2 mark edges from faces with inner material as sharp (for usage with smooth shading and edgesplit modifier to hide the fracture cracks) 2013-11-25 20:09:50 +01:00
11d23a9f61 silently ignore refresh requests when not on startframe now, otherwise internally (bullet userpointers) get freed but not nulled which can lead to crashes 2013-11-25 20:09:50 +01:00
99e70a6faf fix: clusters did not work with booleans 2013-11-25 20:09:50 +01:00
3c1701d498 activate collision between intact/destroyed compounds when compound shape is chosen 2013-11-25 20:09:50 +01:00
869ad992de use normal breaking threshold with cluster size 1 (means no clustering at all) 2013-11-25 20:09:50 +01:00
e90872ca24 fix (attempt) for cluster refreshing, clusters fall apart without this unexpectedly 2013-11-25 20:09:50 +01:00
6886a42d7f added cluster size and cluster percentage in explode modifier, and a new inner-cluster threshold in rigidbody modifier, removed map delay and emit continously options (they were misleading) 2013-11-25 20:09:49 +01:00
0f21491fa2 apply clustering with "Map Delay" to rigidbody modifier as well, by comparing particle indexes, need still a threshold value entry for "inside" the clusters 2013-11-25 20:09:49 +01:00
298b8a25e9 compile fix 2013-11-25 20:09:49 +01:00
3a838c01f6 crash fix for compound shape and making particle animation work again 2013-11-25 20:09:49 +01:00
506edfefb9 modifiers need to say whether they depend on normals, update due to changes in solidify modifier and normal calculation 2013-11-25 20:09:49 +01:00
90892008bd crash fix for compound shape 2013-11-25 20:09:49 +01:00
c262e138e6 crash fix when moving object interactively and only one object is in list (did not fall) 2013-11-25 20:09:49 +01:00
90b777c18a crash fix after merge, NULL seems to be invalid here now 2013-11-25 20:09:49 +01:00
4d60d54fa8 compile fixes 2013-11-25 20:09:49 +01:00
ce044b6740 crash fix (hopefully) for NULL cache_offset_map 2013-11-25 20:09:49 +01:00
776da90407 recenter fix (again) car roof was clipped away and refresh logic fix, hopefully 2013-11-25 20:09:49 +01:00
2857a137f5 crash fix for uninitialized modifiers 2013-11-25 20:09:49 +01:00
070162b490 make compounds of different objects collide with each other 2013-11-25 20:09:49 +01:00
85351b8bd8 fix for unwanted rigidbody settings reset (with modifiers) when simulation is recalculated 2013-11-25 20:09:49 +01:00
5eb9a24efa do not construct modifiers automatically after loading, can cause crashes in case of important related objects not loaded yet, but need to refresh manually each time after loading 2013-11-25 20:09:49 +01:00
c99f531ae9 object recenter fix, need to refresh to correct wrong translation of object in case of changing the origin 2013-11-25 20:09:48 +01:00
31eabfc221 copying rigidbody objects before modifiers now, in case of rigidbody modifiers changes should be taken into account 2013-11-25 20:09:48 +01:00
afdd86826e fixes for crash after loading file with classic explode and rigidbody and fix for memory leak 2013-11-25 20:09:48 +01:00
b208c6730d using classical explode retains its shapes in rigidbody modfier, only centroids seem not completely correct yet 2013-11-25 20:09:48 +01:00
3a3fa959b9 fix attempt for corrupt Memory blocks with cache_index_map / cache_offset_map 2013-11-25 20:09:48 +01:00
79934f6bdc refresh on modifiers works over a whole selection now 2013-11-25 20:09:48 +01:00
b7aed3b37f crash fix for duplicating objects with explo and rigidbody modifier 2013-11-25 20:09:48 +01:00
b91192d454 long faces support, part 2, still have double faces 2013-11-25 20:09:48 +01:00
ddac6fbea1 hmm, there is a bug in MOD_rigidbody.c but fixing it causes worse behavior, so keeping it for now 2013-11-25 20:09:48 +01:00
f5f1515fe9 first step of adding "long face" support 2013-11-25 20:09:48 +01:00
947653bbf3 added option to enable/disable self collision of constrained objects, does not affect compounds yet (led to strange results there) 2013-11-25 20:09:48 +01:00
fa1ac8c040 keep using neighborhood info with VERTS target if explomodifier is available, need this for correct wood bar, compounds wont really work with scaled objects yet. 2013-11-25 20:09:48 +01:00
4af38f7067 dont use neighborhood info for boolean any more, use bounds center for convex hull compounds without constraints 2013-11-25 20:09:48 +01:00
0854457667 some fix for scaled objects, cell grid was not aligned with object 2013-11-25 20:09:48 +01:00
ecc278fe46 further attempt to get scaling with compounds correctly working, still no luck, hrm. 2013-11-25 20:09:47 +01:00
17c81aac12 partial fix for using compounds on scaled objects, but not solved fully yet 2013-11-25 20:09:47 +01:00
87d693e112 fix for non-compound case, was not working with baking anymore 2013-11-25 20:09:47 +01:00
ed619166da small fix against possible corrupt end block (reallocating NULL pointer) 2013-11-25 20:09:47 +01:00
e3ff45781c baking with compounds should work now, finally... 2013-11-25 20:09:47 +01:00
007e2507c3 baking almost fixed... 2013-11-25 20:09:47 +01:00
da2014727e little progress only, breaking in baked mode, but some rigidbodies or so still missing 2013-11-25 20:09:47 +01:00
8cc646b531 stupid baking does not work after save and load yet... means compounds wont disintegrate visually, hrm. 2013-11-25 20:09:47 +01:00
53db50a9b4 damn baking errors, not fully solved yet... 2013-11-25 20:09:47 +01:00
4bb76122d2 missing some properties to copy 2013-11-25 20:09:47 +01:00
4977e05c53 not using old cell neighborhood anymore in case of compound usage 2013-11-25 20:09:47 +01:00
3563f48435 bmesh asserts do not occur anymore, yay ! 2013-11-25 20:09:47 +01:00
77e8608d73 small fix: use_experimental did invalidate cache, which is nonsense in this case 2013-11-25 20:09:47 +01:00
d3736eefd6 fix for explo and rigidbody modifier combination: simple fractured cube did not fall any more 2013-11-25 20:09:47 +01:00
3c89a23c2b crash fix for missing particlesystem and changes being made to explo modifier while rigidbodymodifier is enabled too 2013-11-25 20:09:47 +01:00
a1b1750253 partial fix for bmesh asserts, still got a lot of them, need to investigate further 2013-11-25 20:09:46 +01:00
06a30364b8 rigidbody modifier gui cleanup 2013-11-25 20:09:46 +01:00
61977f80cb fix for windows crash, tried to write at freed location, gcc must have "optimized" that out 2013-11-25 20:09:46 +01:00
04cdf953dd small hack for reducing clipping time and hopefully a fix for windows crashes... 2013-11-25 20:09:46 +01:00
b08b930a8b accelerated clipping by 50 % total, and it does increase less then linear for more cells now 2013-11-25 20:09:46 +01:00
ba1c830df1 auto-recenter should work now 2013-11-25 20:09:46 +01:00
c960f7eb89 accelerated clipping by approximately 30%(in a smaller testfile), not so much but its noticeable 2013-11-25 20:09:46 +01:00
4e8c7adeb3 windows crash fix (hopefully) for removing cells (was a warning in linux only) 2013-11-25 20:09:46 +01:00
94b265a2e2 increased voronoi container size, sometimes it is too small (when bbox is too small!!) 2013-11-25 20:09:46 +01:00
9bbfc0623e attempt for acceleration of clipping, failed due to incorrectness (holes appear), and was not so much faster at all 2013-11-25 20:09:46 +01:00
df92812fdc hole problem solved by 98 % or so, only 2 wrong triangles at whole car !! 2013-11-25 20:09:46 +01:00
4c21dd4e6f hole problem seems to be solved, need more tests still 2013-11-25 20:09:46 +01:00
8cafbff1c2 creating hole filling shapes separately from mesh 2013-11-25 20:09:46 +01:00
e0eaff4a78 successful test with clipping and car 2013-11-25 20:09:46 +01:00
2e377fb40d hole problem almost solved, need to deal with a special case still (wrong vert selected..) 2013-11-25 20:09:46 +01:00
cbb385043a clipping works mostly, mesh has some leftover holes, hmm 2013-11-25 20:09:45 +01:00
d9d6d13f39 first steps towards mesh clipping 2013-11-25 20:09:45 +01:00
4f41011f66 fix for compound creation, was throwing unnecessary error there 2013-11-25 20:09:45 +01:00
2901a846ee fix for wrong compound rotation 2013-11-25 20:09:45 +01:00
b79c97163d fix for crash while changing contact dist, changing back collision condition 2013-11-25 20:09:45 +01:00
a42e2efb3b improved refresh logic, can do updates with rigidbody constraint refresh mostly, which is called automatically on value changes as well 2013-11-25 20:09:45 +01:00
eade7e9baa small collision tweak for compounds (no implosions) 2013-11-25 20:09:45 +01:00
0e0cc39079 added compound shapes and disabled collision between compound/compound and compound/shard, reduces the "explosions" 2013-11-25 20:09:45 +01:00
3babd5a0f0 windows NAN fix, better do this elsewhere... 2013-11-25 20:09:45 +01:00
05c4b50d1d cache should work now mostly, but still need full refresh to do it properly, hmm, maybe reset the frame data... 2013-11-25 20:09:45 +01:00
c54e7bfd54 compound sim need still refresh constraints, cache works only partially because compound parents disappear from simulation (better deactivate them only or so) 2013-11-25 20:09:45 +01:00
b996b71df2 compound needs some work still, but becomes usable step by step 2013-11-25 20:09:45 +01:00
d6d0931d91 still working on proper compound / constraint cooperation 2013-11-25 20:09:44 +01:00
085975ad4a compound basic principle working, but very uncomfortable to control still, needs to be rebuilt once broken correctly 2013-11-25 20:09:44 +01:00
a6d3d775b0 first attempt for cell based simulation, not very good yet, needs improvement 2013-11-25 20:09:44 +01:00
019d927188 fix for last commit, still accelerating but correctly now 2013-11-25 20:09:44 +01:00
068ee02ed8 accelerated the check for existing constraints 2013-11-25 20:09:44 +01:00
13d5400054 added separate constraint update operator (only updating constraints) for quicker workflow 2013-11-25 20:09:44 +01:00
be39771bc7 opticall separation of values which need refresh and which dont 2013-11-25 20:09:44 +01:00
53515ddec4 changes for cell calculation, but this mode does not really work, still (just in for testing purposes) 2013-11-25 20:09:44 +01:00
7cc1fe1f45 added cell/centroid based approach again, delivers only the most necessary constraints in good time 2013-11-25 20:09:44 +01:00
c57a476494 added new cellbased search, performance not so ok... 2013-11-25 20:09:44 +01:00
0137ee3038 calculation fix for cell/meshisland assignment 2013-11-25 20:09:44 +01:00
801ab516c0 attempt for cellbased search, but loss of performance instead of gain, hrm. 2013-11-25 20:09:44 +01:00
4cbc15449f breking threshold 0 means undestructible now 2013-11-25 20:09:44 +01:00
11132108b9 added time printouts in seconds 2013-11-25 20:09:44 +01:00
72a46c10c0 fix for 0 limit and prop checked, was creating 0 constraints instead of "all" 2013-11-25 20:09:44 +01:00
972a73b316 added proportional limit and proportional distance for reducing number of neighborhood lookups in dense areas with many small parts 2013-11-25 20:09:43 +01:00
6adf68d8b5 expose bullet activation state and use it to deactivate both constraint partners in case of one is deactivated (avoids objects jittering around) 2013-11-25 20:09:43 +01:00
b399d9ce6c reset cache on moving objects and reenable all constraints 2013-11-25 20:09:43 +01:00
da029a6d97 fix for: canceling transforms with rigidbody modifier, was not done properly before 2013-11-25 20:09:43 +01:00
787a49d4fc ensure updateability of noise (when it changes) 2013-11-25 20:09:43 +01:00
a29cf33e61 yes! baking fixed finally now, need to rebake once to include a noisemap, which will be applied instead of generating new noise 2013-11-25 20:09:43 +01:00
ec9d5a45a2 added 3 more breakup options: breaking percentage, breaking angle and breaking distance 2013-11-25 20:09:43 +01:00
d482007dfd fix mass and centroid calculation for 1 vertex objects 2013-11-25 20:09:43 +01:00
408f931dd9 fix for separation method, did not work correctly if an unsuccessful halve occurred 2013-11-25 20:09:43 +01:00
1eb3d85e13 fix for crash when deleting objects with modifier (and cache is valid) 2013-11-25 20:09:43 +01:00
a5363ff015 fix for crash at object deletion when cache is valid 2013-11-25 20:09:43 +01:00
7e7b4708f3 sim startup time with applied array modifiers (on 20x20x20 test cube) reduced, removed unnecessary bmesh conversions 2013-11-25 20:09:43 +01:00
aa11c52611 fixed baking (to earlier state, with old errors, but works again), added mass calculation again was omitted testwise (long sim startup time) 2013-11-25 20:09:43 +01:00
999441106f pointcache and crash fix 2013-11-25 20:09:43 +01:00
3ce0957f1b cache index lookup speedup, WARNING, buggy 2013-11-25 20:09:42 +01:00
d4b41cf4a6 now properly deleted objects in open scenes as well, there were remainders in depsgraph causing crashes after incomplete delete 2013-11-25 20:09:42 +01:00
3b18a17010 added threshold and solver iterations, but its all still crash prone (when exchanging objects after simulation, DAG_tag updates makes this visible, probably object is STILL not properly deleted... 2013-11-25 20:09:42 +01:00
8fdc3b10d5 rotation and scale was not taken into account, fixed that 2013-11-25 20:09:42 +01:00
26c2fd49f5 further attempts to restore recent functionality of modifiers 2013-11-25 20:09:42 +01:00
db8a69f076 fracture works sorta, but cleaning up own mess in new run not. Very hard to get rid of objects actually. 2013-11-25 20:09:42 +01:00
512598da0a first steps to make operators from modifiers 2013-11-25 20:09:42 +01:00
e467249f35 hrm, fix for volume calculation and mass setting 2013-11-25 20:09:42 +01:00
0af63c9859 add a test for 0 length in volume calculation and set a minimum mass for 0 mass active objects 2013-11-25 20:09:42 +01:00
7a7d7165d2 do not abort at 0 verts, its too early, potential constraints are skipped 2013-11-25 20:09:42 +01:00
1713964d69 abort with 0 shared verts 2013-11-25 20:09:42 +01:00
13644afe9a fix for vertexbased constraint lookup: bboxtest continues loop instead of breaking it, and atleast 1 vertex is enough now for a constraint 2013-11-25 20:09:42 +01:00
1c4106ada2 fix for crash with missing particle texture (and no fracture mesh available) 2013-11-25 20:09:42 +01:00
d9a39262c4 added old constraint code (vertex distances) again, maybe it turns out to be useful in some cases 2013-11-25 20:09:42 +01:00
6803ed3265 forgot to add function to header 2013-11-25 20:09:42 +01:00
1deafe9d6d added dist dependent Threshold, but does it really help ? 2013-11-25 20:09:41 +01:00
ab004e58ee fix for crash applying/deleting explo modifier with rigidbody modifier below 2013-11-25 20:09:41 +01:00
26edda3db4 changed physics mesh from bmesh to derived mesh, reduces memory usage 2013-11-25 20:09:41 +01:00
030ce80a73 changed select linked walker method from island to shell, works on non manifolds too 2013-11-25 20:09:41 +01:00
f09d82a541 some fix for bigger undividable islands 2013-11-25 20:09:41 +01:00
501785846d regular explode modifier and rigidbody should not crash anymore 2013-11-25 20:09:41 +01:00
c060f042dc another fix for missed unvisited seed vertices and check if island is dividable 2013-11-25 20:09:41 +01:00
4dd4479970 Halving approach fixed now, still very fast compared to before 2013-11-25 20:09:41 +01:00
51fad3521a Halving Approach successfully implemented, very fast and correct now 2013-11-25 20:09:41 +01:00
b4eb9fe87d first attempt of halving method, fast but still incorrect 2013-11-25 20:09:41 +01:00
b649feaf59 mainly performance optimization attempts and some cleanup 2013-11-25 20:09:41 +01:00
ed6726c9f3 automerge quick fix 2013-11-25 20:09:41 +01:00
6a35f695ef performance fix, if array and subsurf modifiers before rigidbody were in a certain sequence, performance was extremely bad due to incorrect mesh_separate_tagged function 2013-11-25 20:09:41 +01:00
76620e8d53 crash fix for cache_offset_map (needed to nullify) 2013-11-25 20:09:41 +01:00
460bfa85dd oddly, in rigidbody.c not everywhere MEM_ functions were used, fixed that due to odd crash 2013-11-25 20:09:40 +01:00
5090b47a03 fixes to allow other constraint types and (mostly) correct outer constraints again 2013-11-25 20:09:40 +01:00
37aa3b1d0c cache_offset_map, store offset instead of calculating, but only 1fps speed gain, hrm 2013-11-25 20:09:40 +01:00
1ba6e997f5 memory leaks fixed 2013-11-25 20:09:40 +01:00
4b71477299 automerge fix applied again (was not working any more) 2013-11-25 20:09:40 +01:00
eb1fce1cd1 attempt for fixing bake error, unfortunately no luck yet 2013-11-25 20:09:40 +01:00
dc388537ab some stabilization (refreshing modifiers crashed before) but still error with baked data and memory leak 2013-11-25 20:09:40 +01:00
3151004efe seems to run faster now, but still have a big memory leak 2013-11-25 20:09:40 +01:00
9875537458 further work at speedup, automerge needs to be tackled still 2013-11-25 20:09:40 +01:00
d52a57ee9d partial success with speedup attempt, but automerge still slow and wrong 2013-11-25 20:09:40 +01:00
36c17c46fe minor correctional fixes, enable automerge workaround again 2013-11-25 20:09:40 +01:00
edbe775ebe some attempts to increase performance, only a bit faster now 2013-11-25 20:09:40 +01:00
d03b5110bb first attempt to increase performance: disable storage of fracture results, this costs more performance instead improving it, and added a boundbox test for constraints calculation (but often those intersect each other, so not much performance gain, also need to fix for not touching islands which possibly should act as fixed too (using higher contact distance) 2013-11-25 20:09:40 +01:00
4335d31689 merge related compile fix 2013-11-25 20:09:39 +01:00
0ffa93618f correction: calculate only (many) fixed constraints faster, the other outer constraint types connect to 1 shard basically and work incorrectly if calculation stops at 0 shared vertices. 2013-11-25 20:09:39 +01:00
4cce73db0f small performance plus when building constraints, stop when 0 shared vertices occur (because meshislands are sorted by distance, kdtree) 2013-11-25 20:09:39 +01:00
665ae32809 adapt change from BMesh Operator "recalc face normals", removed some printouts 2013-11-25 20:09:39 +01:00
0d36d920aa merge related fixes 2013-11-25 20:09:39 +01:00
e69f1e80f5 can move constrained objects now during sim, will be autorefreshed next time, a bit more overall stability, but especially with constraint groups still bullet assertions possible when moving objects 2013-11-25 20:09:39 +01:00
c83727f844 some minor cleanup 2013-11-25 20:09:39 +01:00
71106384d7 a bit more stabilization for outer constraints, but cache shows still unexpected behavior 2013-11-25 20:09:39 +01:00
5787989733 disable auto-refresh in rigidbody modifier (can be very slow, but ... always remember to hit refresh before starting the sim now !) 2013-11-25 20:09:39 +01:00
ee239cce8f fix for scrubbing around in timeline while cache is not full yet -> did reshape too often (at saving, not at loading) accidentally 2013-11-25 20:09:39 +01:00
d6ae5785b7 a bit code cleanup 2013-11-25 20:09:39 +01:00
5f6659b35e re-introduce Group Contact Distance (has effect for fixed type only) fix for changing passive to active unexpectedly 2013-11-25 20:09:39 +01:00
bccb1971ab allow explode/voronoi modifer usage of previous modifier data 2013-11-25 20:09:39 +01:00
f77608aca2 fix for outer constraints, should work more reliably now 2013-11-25 20:09:39 +01:00
db73e4e4da closed some memory leaks 2013-11-25 20:09:39 +01:00
fe0dbf7ea2 crash fix for using customdata like e.g. textures, need manual refresh after load ! 2013-11-25 20:09:38 +01:00
36933e4bc2 compile fixes related to merge 2013-11-25 20:09:38 +01:00
6f8fa4182e fix for ownVertices, extraParticles (noise and coordinate correction) 2013-11-25 20:09:38 +01:00
ebf21db092 small fix for crash with outer constraints between more than 2 objects (after duplicating object with modifier) 2013-11-25 20:09:38 +01:00
a68f7159f9 added more constraint types for outer (and inner) constraints and outer constraint location (still subject to change) 2013-11-25 20:09:38 +01:00
5372591d0f additional test whether modifier is active (and not only there) when running rigidbody sim 2013-11-25 20:09:38 +01:00
60d80857d3 crash fix for selecting own verts on default cube 2013-11-25 20:09:38 +01:00
2ec4973d69 crash fix for constraint groups in conjunction with automerge 2013-11-25 20:09:38 +01:00
b76ab4e343 crash fix for loading files with constraint group enabled 2013-11-25 20:09:38 +01:00
a9f33f51d7 merge related compile fixes 2013-11-25 20:09:38 +01:00
9c20a46f5a small tweak for automerge 2013-11-25 20:09:38 +01:00
8f86353b88 storing vertco now, crash fix for adding new rigidbody modifier, attempt to fix glitch when simulation is interrupted and continued before cache is full (everything gets reset->why ?) 2013-11-25 20:09:38 +01:00
5e48a020d5 copying object with modifiers active should not crash anymore now 2013-11-25 20:09:38 +01:00
78a0670728 crash fixes for saving and loading, some tweaks for automerge 2013-11-25 20:09:38 +01:00
5242899aad added automerge distance, the whole automerge still needs tweaking, not reliable enough yet 2013-11-25 20:09:37 +01:00
093f437356 crash fixes for running sim / saving / undo after applying modifier 2013-11-25 20:09:37 +01:00
cba006d52e missed some null pointer checks 2013-11-25 20:09:37 +01:00
9ac7ac04ac 4th attempt, memory leaks eliminated 2013-11-25 20:09:37 +01:00
92928c0b00 3rd attempt, saving /loading working now, need to test still with customdata and undo 2013-11-25 20:09:37 +01:00
cd345412c8 second attempt for storing fracture result, its incorrect and slower than regenerating, so deactivated as well, but might be usable as reference later 2013-11-25 20:09:37 +01:00
add28fe4ce first attempt for storing fracture results, deactivated for now 2013-11-25 20:09:37 +01:00
7ce7f8a453 added null test for meshisland again, workaround when removing mesh islands and cache data is still there (would crash otherwise) 2013-11-25 20:09:37 +01:00
c8ad1ba65a added limited dissolve, crash fix when less constraints than expected 2013-11-25 20:09:37 +01:00
ba6e6a932d improved version of automerge, taking constraints into account 2013-11-25 20:09:37 +01:00
1f34dfef18 automerging inner geometry if object has not been hit, works for very low threshold only (settable via group contact property) and for now globally only, its possibly easier to fake an intact rigidbody with traceable settings or cycles nodes 2013-11-25 20:09:37 +01:00
3391e7a84c additional NULL check (but sometimes that area isnt NULL, just FREE, need still to investigate) 2013-11-25 20:09:37 +01:00
8711e3c6d8 allow modifier settings to be copied (when duplicating objects) 2013-11-25 20:09:37 +01:00
73f0b2d22d some code cleanup 2013-11-25 20:09:37 +01:00
3359d02d12 calling updateCell now in each case->evade corner case for one frame lag 2013-11-25 20:09:36 +01:00
964bdd434a catch possible NULL pointers 2013-11-25 20:09:36 +01:00
41fc551a86 fix for frame-lag when using kinematic fractured objects 2013-11-25 20:09:36 +01:00
46e81cf749 some code cleanup 2013-11-25 20:09:36 +01:00
0ce1f2b886 properly syncing shards now with RNA rigidbody settings of object, should allow correct animation now 2013-11-25 20:09:36 +01:00
194816da67 added (internally) a collision callback, allows partial activation of fractured deactivated objects 2013-11-25 20:09:36 +01:00
2ceb96f479 attempt for testing for group slave (deactivated in code) 2013-11-25 20:09:36 +01:00
02573fe35d -option for mass dependent threshold (constraint with max mass gets set threshold, the others are relative to that mass) -attempt for automating the refresh process (needs manual refreshes still now, even more) 2013-11-25 20:09:36 +01:00
7dcc5e692a some stabilization attempts for constraint groups, but still crashy and not intuitive enough 2013-11-25 20:09:36 +01:00
9212bd6832 compile fix (hopefully, at least here it works) 2013-11-25 20:09:36 +01:00
816e67e537 added group breaking threshold and group contact distance, now evalulating each modifiers settings in group constraints when overriding 2013-11-25 20:09:36 +01:00
91bba9bcbb added feature: Can connect multiple fractured rigidbody objects together automatically, fixed constraint for now only. To Use add another fractured object into constraint group of "parent" object (where others will be attached to) 2013-11-25 20:09:36 +01:00
31248db13c forgot to free some memory blocks 2013-11-25 20:09:36 +01:00
89aa38094c fixed wrong calculation and memory handling of point clouds, which led to often crashes. made explode a single modifier (removed copy), added outliner icon for rigidbody modifier 2013-11-25 20:09:35 +01:00
313adc270d fixing attempt for crash when using no pointsource and boolean intersection, change how noise is applied (memory access) 2013-11-25 20:09:35 +01:00
f2ec6d41ca added noise / percentage for pointsource, replaced child options by a group selection, made only one breaking threshold, removal of unused options, rename of Use Rigidbody, added refresh operator for explode voronoi mode (behavior still a bit inconsistent) 2013-11-25 20:09:35 +01:00
1a83942915 support smooth shards (if atleast one original object face is smooth), but looks bad still 2013-11-25 20:09:35 +01:00
c97f0437ad added some null checks, a bit cleanup 2013-11-25 20:09:35 +01:00
4a464602f9 calculating shard mass at creation/change, coordinate calculation fixes with own verts and greasepencil 2013-11-25 20:09:35 +01:00
433126d856 removing invalid faces in (very small area and less than 3 verts) in explode modifier (geometry fix) 2013-11-25 20:09:35 +01:00
8d89c7d8be small correction for constraints, atleast 3 shared vertices are needed to build a constraint fixes for incorrect meshes with radial point clouds step 1 (still non-manifold edges/faces) 2013-11-25 20:09:35 +01:00
083cc275fd ignore symlinks 2013-11-25 20:09:35 +01:00
c7d6fded16 child vertex wrong coordinate fix, but still problems with radial pointclouds (triangles miss, tessface fails ?) 2013-11-25 20:09:35 +01:00
fbe4d474ea make constraints optional, its very slow to set them up between many shards 2013-11-25 20:09:35 +01:00
ec8cacf7ae correction for cluster calculation 2013-11-25 20:09:35 +01:00
e9c1b187ce its possible to set inner and outer breaking threshold now for shard constraints 2013-11-25 20:09:35 +01:00
80c81856dd inner constraints work now basically, but need to have user interface to define strengths yet. 2013-11-25 20:09:34 +01:00
48663dd9df first steps with inner constraints, but moving the object when we have cached frames crashes bullet 2013-11-25 20:09:34 +01:00
d162008d5d small cleanup 2013-11-25 20:09:34 +01:00
3375afa3fe using polygons instead of tessfaces for voronoi cells now, but still faces miss 2013-11-25 20:09:34 +01:00
9439e57fc4 attempt for fixing missing faces problem (due to bm->dm->bm conversion ?) 2013-11-25 20:09:34 +01:00
80b6e52c09 fix for freeing NULL pointer, fix for visual errors with kinematic objects and interactive rotation and wrong mass calculation for shards 2013-11-25 20:09:34 +01:00
d635f222a1 correctly initializing ob->imat before using it, fixes bug where object was positioned at camera after render 2013-11-25 20:09:34 +01:00
29a64d71f2 scaling problem should be fixed now 2013-11-25 20:09:34 +01:00
d5e87fc445 fix for uneven scaling (mesh was distorted at collision before) 2013-11-25 20:09:34 +01:00
3d0795b044 attempt for getting scale properly to work, no success yet 2013-11-25 20:09:34 +01:00
4f47f0fc68 partial fix for scaling problem, but scaled fractured objects still lead to display errors, workaround: apply scale before fracture 2013-11-25 20:09:34 +01:00
4ad2bd8c0e fix for animation "jump" bug when rigidbody modifier is on animated object 2013-11-25 20:09:34 +01:00
ad7e1c124b attempt for fix for MeshIsland Null Pointer in Pointcache (index calculation fix) 2013-11-25 20:09:34 +01:00
ca216d9e7e crash fix when selected no point source, fix for using child vertices 2013-11-25 20:09:34 +01:00
1d195e6362 Fix NULL checks when dealing with pointcache
This needs to be cleaned up further but should be at least correct.
2013-11-25 20:09:34 +01:00
94eeeb9c4b Style and warning fixes 2013-11-25 20:09:33 +01:00
4ff02f7fc3 there should be only one rigidbody modifier per object, so it must not be copyable as well 2013-11-25 20:09:33 +01:00
862d098125 small fix, attempted to free some NULL pointers before. 2013-11-25 20:09:33 +01:00
055c5c91a7 ok, values are passed through now at once to shards at change (tested with kinematic) 2013-11-25 20:09:33 +01:00
2e1de279d3 first attempt to apply settings to each shard and calculate mass, maybe better move this into modifier/refresh ? 2013-11-25 20:09:33 +01:00
91eea4a3de fixed a rotation bug (each shard was rotated differently) and a small memory leak, although rotating objects during simulation (by hand) yields still an error (objects breaks apart at once) 2013-11-25 20:09:33 +01:00
54517891d8 fix for wrong pos calculation after moving objects 2013-11-25 20:09:33 +01:00
cd806601fb added refresh operator for rigidbody modifier to recalculate rigidbodies when mesh changes 2013-11-25 20:09:33 +01:00
3f2658bb99 calculating centers of mass now correctly for shards 2013-11-25 20:09:33 +01:00
d5aea12969 small fix for grabbing and moving objects during the sim 2013-11-25 20:09:33 +01:00
7b53f675bd this fix resets the simulation on esc properly 2013-11-25 20:09:33 +01:00
e39fc2c8ab added new rigidbody modifier doing the mesh island handling, instead of explode modifier 2013-11-25 20:09:33 +01:00
e81c5cec0a crash fix (wrong cache mapping) and white space cleanup (tabs only) 2013-11-25 20:09:33 +01:00
c593241cc7 fixes for: moving the object during rigidbody sim (no crash anymore) and one piece was always stuck in the air (wrong calculation in cache) 2013-11-25 20:09:32 +01:00
c8a4744ca5 some cache fixes to allow multiple (duplicated) rigidbodies with modifiers on them 2013-11-25 20:09:32 +01:00
e509a65885 added use rigidbody as new option, some smaller fixes 2013-11-25 20:09:32 +01:00
5516678889 can run simulation backwards now too (update mesh from cache, but still sometimes crashes) 2013-11-25 20:09:32 +01:00
1a77e9f316 very basic collision works, but unreliably for now (sometime cache crashes, center of mass still wrong 2013-11-25 20:09:32 +01:00
a89196af1b sorta optical feedback (but massively wrong) 2013-11-25 20:09:32 +01:00
776cd94b77 crash fixes, wip 2013-11-25 20:09:32 +01:00
c0ab26b8a7 attempts for integrating fractured objects into rigidbody sim, still wrong and incomplete 2013-11-25 20:09:32 +01:00
427783a3ac adapting rigidbody sim to accept mesh shards too (in progress) 2013-11-25 20:09:32 +01:00
0508f7be8d small build and link fixes 2013-11-25 20:09:32 +01:00
fbea1a566c update and merge code branches - voronoi modifier 2013-11-25 20:09:32 +01:00
e48616d08a test commit 2013-11-25 20:09:32 +01:00
164 changed files with 41738 additions and 1058 deletions

6
.gitmodules vendored
View File

@@ -2,7 +2,7 @@
path = release/scripts/addons
url = ../blender-addons.git
ignore = all
branch = master
branch = blender-v2.79-release
[submodule "release/scripts/addons_contrib"]
path = release/scripts/addons_contrib
url = ../blender-addons-contrib.git
@@ -12,9 +12,9 @@
path = release/datafiles/locale
url = ../blender-translations.git
ignore = all
branch = master
branch = blender-v2.79-release
[submodule "source/tools"]
path = source/tools
url = ../blender-dev-tools.git
ignore = all
branch = master
branch = blender-v2.79-release

View File

@@ -234,6 +234,7 @@ else()
endif()
option(WITH_PLAYER "Build Player" OFF)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
option(WITH_VORO "Enable Voronoi Fracture based on Voro++" ON)
# Compositor
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
@@ -1760,6 +1761,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_OPENCOLORIO)
info_cfg_option(WITH_VORO)
info_cfg_option(WITH_OPENVDB)
info_cfg_option(WITH_ALEMBIC)

16
README.md Normal file
View File

@@ -0,0 +1,16 @@
# Blender Fracture Modifier
The Fracture Modifier is a system to interactively destroy and physically simulate the shards of objects in an easy, performant and
non-destructive way. This allows you to shatter and simulate the objects as you like while the original geometry of the object remains
untouched and intact.
## Support and builds
[BlenderArtists.org support forum thread](http://blenderartists.org/forum/showthread.php?343637)<br>
[DF-VFX Hosted Fracture Modifier Builds](http://df-vfx.de/fracturemodifier/)
## Main Documentation
[BlenderWiki page about Fracture Modifier](https://wiki.blender.org/index.php/User:Scorpion81/Fracture_Documentation)
## Useful Videos
[Development and experimental videos from the fracture modifier build & helpers addon by Dennis Fassbaender](https://www.youtube.com/playlist?list=PLyWdRVpqt5ZdQ6SdPuLQ76nShiuwXu_uC)<br>
[Simulation Videos made by Kai Kostack](https://www.youtube.com/playlist?list=PLGYnM-Mk7-OeqpCBmw6ZjFyiopkvkE6_S)

View File

@@ -753,6 +753,10 @@ function(SETUP_BLENDER_SORTED_LIBS)
list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect)
endif()
if(WITH_VORO)
list(APPEND BLENDER_SORTED_LIBS extern_voro)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv)
endif()

View File

@@ -90,6 +90,10 @@ if(WITH_X11 AND WITH_GHOST_XDND)
add_subdirectory(xdnd)
endif()
if(WITH_VORO)
add_subdirectory(voro++)
endif()
if(WITH_LIBMV)
add_subdirectory(ceres)
endif()
@@ -99,6 +103,7 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
add_subdirectory(gflags)
endif()
add_subdirectory(glog)
endif()
if(WITH_GTESTS)

View File

@@ -130,6 +130,7 @@ set(SRC
src/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
src/BulletDynamics/Character/btKinematicCharacterController.cpp
src/BulletDynamics/ConstraintSolver/btCompoundConstraint.cpp
src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp
src/BulletDynamics/ConstraintSolver/btContactConstraint.cpp
src/BulletDynamics/ConstraintSolver/btFixedConstraint.cpp
@@ -148,7 +149,9 @@ set(SRC
src/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp
src/BulletDynamics/Dynamics/Bullet-C-API.cpp
src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp
src/BulletDynamics/Dynamics/btFractureDynamicsWorld.cpp
src/BulletDynamics/Dynamics/btRigidBody.cpp
src/BulletDynamics/Dynamics/btFractureBody.cpp
src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp
src/BulletDynamics/Featherstone/btMultiBody.cpp
src/BulletDynamics/Featherstone/btMultiBodyConstraint.cpp
@@ -314,6 +317,7 @@ set(SRC
src/BulletDynamics/Character/btCharacterControllerInterface.h
src/BulletDynamics/Character/btKinematicCharacterController.h
src/BulletDynamics/ConstraintSolver/btCompoundConstraint.h
src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
src/BulletDynamics/ConstraintSolver/btConstraintSolver.h
src/BulletDynamics/ConstraintSolver/btContactConstraint.h

View File

@@ -80,6 +80,11 @@ class btUnionFind
void unite(int p, int q)
{
if (p == -1 && q == -1) {
//error case... should not happen but happens ?
return;
}
int i = find(p), j = find(q);
if (i == j)
return;

View File

@@ -0,0 +1,8 @@
#include "btCompoundConstraint.h"
btCompoundConstraint::btCompoundConstraint(btRigidBody& rbA, btRigidBody& rbB)
:btTypedConstraint(static_cast<btTypedConstraintType>(COMPOUND_CONSTRAINT_TYPE), rbA, rbB)
{
}

View File

@@ -0,0 +1,20 @@
#ifndef BTCOMPOUNDCONSTRAINT_H
#define BTCOMPOUNDCONSTRAINT_H
#include "btTypedConstraint.h"
#define COMPOUND_CONSTRAINT_TYPE (MAX_CONSTRAINT_TYPE+1)
ATTRIBUTE_ALIGNED16(class) btCompoundConstraint : public btTypedConstraint
{
public:
btCompoundConstraint(btRigidBody& rbA,btRigidBody& rbB);
virtual void getInfo1(btConstraintInfo1* info) {}
virtual void getInfo2(btConstraintInfo2* info) {}
virtual btScalar getParam(int num, int axis) const { return 0;}
virtual void setParam(int num, btScalar value, int axis) {}
int m_objectId;
};
#endif // BTCOMPOUNDCONSTRAINT_H

View File

@@ -0,0 +1,239 @@
#include "btFractureBody.h"
#include "BulletCollision/CollisionDispatch/btCollisionWorld.h"
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
#include "BulletDynamics/Dynamics/btFractureDynamicsWorld.h"
class btConnectionSortPredicate
{
public:
bool operator() ( const btConnection& lhs, const btConnection& rhs ) const
{
btVector3 locLhsA = lhs.m_parent->getWorldTransform().inverse() * lhs.m_obA->getWorldTransform().getOrigin();
btVector3 locLhsB = lhs.m_parent->getWorldTransform().inverse() * lhs.m_obB->getWorldTransform().getOrigin();
btVector3 locRhsA = rhs.m_parent->getWorldTransform().inverse() * rhs.m_obA->getWorldTransform().getOrigin();
btVector3 locRhsB = rhs.m_parent->getWorldTransform().inverse() * rhs.m_obB->getWorldTransform().getOrigin();
btVector3 locLhs = (locLhsA + locLhsB) * 0.5f;
btVector3 locRhs = (locRhsA + locRhsB) * 0.5f;
//lhs.parent should match rhs.parent... same object
btAssert(lhs.m_parent == rhs.m_parent);
btScalar dLhs = lhs.m_parent->getWorldTransform().getOrigin().distance(locLhs);
btScalar dRhs = rhs.m_parent->getWorldTransform().getOrigin().distance(locRhs);
//btTransform id = btTransform::getIdentity();
//btScalar dLhs = id.getOrigin().distance(locLhs);
//btScalar dRhs = id.getOrigin().distance(locRhs);
return dLhs < dRhs;
}
};
void btFractureBody::recomputeConnectivity(btCollisionWorld* world)
{
m_connections.clear();
//@todo use the AABB tree to avoid N^2 checks
if (getCollisionShape()->isCompound())
{
btCompoundShape* compound = (btCompoundShape*)getCollisionShape();
for (int i=0;i<compound->getNumChildShapes();i++)
{
for (int j=i+1;j<compound->getNumChildShapes();j++)
{
struct MyContactResultCallback : public btCollisionWorld::ContactResultCallback
{
bool m_connected;
btScalar m_margin;
MyContactResultCallback() :m_connected(false),m_margin(0.05)
{
}
virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0Wrap,int partId0,int index0,const btCollisionObjectWrapper* colObj1Wrap,int partId1,int index1)
{
if (cp.getDistance()<=m_margin)
m_connected = true;
return 1.f;
}
};
MyContactResultCallback result;
btCollisionObject obA;
obA.setWorldTransform(compound->getChildTransform(i));
obA.setCollisionShape(compound->getChildShape(i));
btCollisionObject obB;
obB.setWorldTransform(compound->getChildTransform(j));
obB.setCollisionShape(compound->getChildShape(j));
world->contactPairTest(&obA,&obB,result);
if (result.m_connected)
{
btConnection tmp;
tmp.m_childIndex0 = i;
tmp.m_childIndex1 = j;
tmp.m_childShape0 = compound->getChildShape(i);
tmp.m_childShape1 = compound->getChildShape(j);
tmp.m_strength = 1.f;//??
m_connections.push_back(tmp);
}
}
}
}
}
void btFractureBody::recomputeConnectivityByConstraints(btCollisionWorld *world1)
{
btFractureDynamicsWorld *world = (btFractureDynamicsWorld*)world1;
if (world->m_idCallback != NULL)
{
int i, size = world->m_compoundConstraints.size();
m_connections.clear();
for (i=0; i<size;i++)
{
btCompoundConstraint *con = world->m_compoundConstraints[i];
if (con->isEnabled())
{
int obIdA, shardIdA, obIdB, shardIdB;
btFractureBody *obA = (btFractureBody*)&con->getRigidBodyA();
btFractureBody *obB = (btFractureBody*)&con->getRigidBodyB();
//if (this == obA || this == obB)
{
int *index0 = NULL, *index1 = NULL;
world->m_idCallback(obA->getUserPointer(), &obIdA, &shardIdA);
world->m_idCallback(obB->getUserPointer(), &obIdB, &shardIdB);
index0 = world->m_childIndexHash->find(to_str(obIdA, shardIdA));
index1 = world->m_childIndexHash->find(to_str(obIdB, shardIdB));
if ((obIdA == obIdB) && (shardIdA != shardIdB) &&
index0 && index1 && *index0 > -1 && *index1 > -1)
{
btConnection tmp;
tmp.m_childIndex0 = *index0;
tmp.m_childIndex1 = *index1;
tmp.m_childShape0 = obA->getCollisionShape();
tmp.m_childShape1 = obB->getCollisionShape();
tmp.m_strength = con->getBreakingImpulseThreshold();
tmp.m_obA = obA;
tmp.m_obB = obB;
tmp.m_parent = this;
tmp.m_id = i;
m_connections.push_back(tmp);
}
//break;
}
}
}
m_connections.quickSort(btConnectionSortPredicate());
//build a connection map
m_connection_map->clear();
size = m_connections.size();
for (i=0; i < size; i++)
{
btConnection& con = m_connections[i];
btAlignedObjectArray<int> *adjacents = m_connection_map->find(con.m_childIndex0);
if (!adjacents) {
btAlignedObjectArray<int> adj;
adj.push_back(con.m_childIndex1);
m_connection_map->insert(con.m_childIndex0, adj);
}
else
{
if (adjacents->size() != adjacents->findLinearSearch(con.m_childIndex1))
adjacents->push_back(con.m_childIndex1);
}
}
}
}
btCompoundShape* btFractureBody::shiftTransformDistributeMass(btCompoundShape* boxCompound,btScalar mass,btTransform& shift)
{
btVector3 principalInertia;
btScalar* masses = new btScalar[boxCompound->getNumChildShapes()];
for (int j=0;j<boxCompound->getNumChildShapes();j++)
{
//evenly distribute mass
masses[j]=mass/boxCompound->getNumChildShapes();
}
return shiftTransform(boxCompound,masses,shift,principalInertia);
}
btCompoundShape* btFractureBody::shiftTransform(btCompoundShape* boxCompound,btScalar* masses,btTransform& shift, btVector3& principalInertia)
{
btTransform principal;
boxCompound->calculatePrincipalAxisTransform(masses,principal,principalInertia);
///create a new compound with world transform/center of mass properly aligned with the principal axis
///non-recursive compound shapes perform better
#ifdef USE_RECURSIVE_COMPOUND
btCompoundShape* newCompound = new btCompoundShape();
newCompound->addChildShape(principal.inverse(),boxCompound);
newBoxCompound = newCompound;
//m_collisionShapes.push_back(newCompound);
//btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
//btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,newCompound,principalInertia);
#else
#ifdef CHANGE_COMPOUND_INPLACE
newBoxCompound = boxCompound;
for (int i=0;i<boxCompound->getNumChildShapes();i++)
{
btTransform newChildTransform = principal.inverse()*boxCompound->getChildTransform(i);
///updateChildTransform is really slow, because it re-calculates the AABB each time. todo: add option to disable this update
boxCompound->updateChildTransform(i,newChildTransform);
}
bool isDynamic = (mass != 0.f);
btVector3 localInertia(0,0,0);
if (isDynamic)
boxCompound->calculateLocalInertia(mass,localInertia);
#else
///creation is faster using a new compound to store the shifted children
btCompoundShape* newBoxCompound = new btCompoundShape();
for (int i=0;i<boxCompound->getNumChildShapes();i++)
{
btTransform newChildTransform = principal.inverse()*boxCompound->getChildTransform(i);
///updateChildTransform is really slow, because it re-calculates the AABB each time. todo: add option to disable this update
newBoxCompound->addChildShape(newChildTransform,boxCompound->getChildShape(i));
}
#endif
#endif//USE_RECURSIVE_COMPOUND
shift = principal;
return newBoxCompound;
}

View File

@@ -0,0 +1,115 @@
#ifndef BT_FRACTURE_BODY
#define BT_FRACTURE_BODY
class btCollisionShape;
class btDynamicsWorld;
class btCollisionWorld;
class btCompoundShape;
class btManifoldPoint;
#include "LinearMath/btAlignedObjectArray.h"
#include "LinearMath/btHashMap.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
#define CUSTOM_FRACTURE_TYPE (btRigidBody::CO_USER_TYPE+1)
struct btConnection
{
bool operator==(const btConnection& con)
{
return this->m_childIndex0 == con.m_childIndex0 &&
this->m_childIndex1 == con.m_childIndex1 &&
this->m_childShape0 == con.m_childShape0 &&
this->m_childShape1 == con.m_childShape1 &&
this->m_strength == con.m_strength;
}
btCollisionShape* m_childShape0;
btCollisionShape* m_childShape1;
int m_childIndex0;
int m_childIndex1;
btScalar m_strength;
//btVector3 m_location; //this must be local to the "Parent" compound
//better calc this "live" from the objects themselves, so also keep ob pointers here
btCollisionObject* m_obA;
btCollisionObject* m_obB;
btCollisionObject* m_parent;
btScalar m_id;
};
struct btPropagationParameter
{
btScalar m_impulse_dampening;
btScalar m_directional_factor;
btScalar m_minimum_impulse;
btScalar m_stability_factor;
};
class btFractureBody : public btRigidBody
{
//connections
public:
btDynamicsWorld* m_world;
btAlignedObjectArray<btScalar> m_masses;
btAlignedObjectArray<btConnection> m_connections;
btHashMap<btHashInt, btAlignedObjectArray<int> > *m_connection_map;
btPropagationParameter m_propagationParameter;
btFractureBody( const btRigidBodyConstructionInfo& constructionInfo, btPropagationParameter parameter)
:btRigidBody(constructionInfo),
m_world(0),
m_connection_map(NULL),
m_propagationParameter(parameter)
{
m_masses.push_back(constructionInfo.m_mass);
m_internalType=CUSTOM_FRACTURE_TYPE+CO_RIGID_BODY;
}
///btRigidBody constructor for backwards compatibility.
///To specify friction (etc) during rigid body construction, please use the other constructor (using btRigidBodyConstructionInfo)
btFractureBody( btScalar mass, btMotionState* motionState, btCollisionShape* collisionShape, const btVector3& localInertia, btScalar* masses, int numMasses, btDynamicsWorld* world, btPropagationParameter parameter)
:btRigidBody(mass,motionState,collisionShape,localInertia),
m_world(world),
m_propagationParameter(parameter)
{
for (int i=0;i<numMasses;i++)
m_masses.push_back(masses[i]);
m_internalType=CUSTOM_FRACTURE_TYPE+CO_RIGID_BODY;
m_connection_map = new btHashMap<btHashInt, btAlignedObjectArray<int> >();
}
void setWorld(btDynamicsWorld *world)
{
m_world = world;
}
void recomputeConnectivity(btCollisionWorld* world);
void recomputeConnectivityByConstraints(btCollisionWorld* world);
static btCompoundShape* shiftTransform(btCompoundShape* boxCompound,btScalar* masses,btTransform& shift, btVector3& principalInertia);
static btCompoundShape* shiftTransformDistributeMass(btCompoundShape* boxCompound,btScalar mass,btTransform& shift);
static bool collisionCallback(btManifoldPoint& cp, const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1);
~btFractureBody()
{
delete m_connection_map;
}
};
void fractureCallback(btDynamicsWorld* world, btScalar timeStep);
void glueCallback(btDynamicsWorld* world, btScalar timeStep);
#endif //BT_FRACTURE_BODY

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
#ifndef _BT_FRACTURE_DYNAMICS_WORLD_H
#define _BT_FRACTURE_DYNAMICS_WORLD_H
#include "btBulletDynamicsCommon.h"
#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
#include "LinearMath/btAlignedObjectArray.h"
#include "LinearMath/btHashMap.h"
#include <string>
#include <sstream>
class btFractureBody;
class btCompoundShape;
class btTransform;
struct btPropagationParameter;
//callback to retrieve id from user application (blender)
typedef void (*IdCallback)(void *userPtr, int* object_id, int* shard_id);
typedef btRigidBody* (*ShapeBodyCallback)(void *userPtr);
char *to_str(int objectId, int shardId);
///The btFractureDynamicsWorld class enabled basic glue and fracture of objects.
///If/once this implementation is stablized/tested we might merge it into btDiscreteDynamicsWorld and remove the class.
class btFractureDynamicsWorld : public btDiscreteDynamicsWorld
{
btFractureBody* addNewBody(const btTransform& oldTransform, btScalar* masses, btCompoundShape* oldCompound, btPropagationParameter &param);
bool m_addBroadPhaseHandle;
public:
btFractureDynamicsWorld ( btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration, IdCallback callback, ShapeBodyCallback shapebodycallback);
~btFractureDynamicsWorld();
btAlignedObjectArray<btCompoundConstraint*> m_compoundConstraints;
btAlignedObjectArray<btFractureBody*> m_fractureBodies;
bool m_fracturingMode;
IdCallback m_idCallback;
ShapeBodyCallback m_shapeBodyCallback;
btHashMap<btHashString, int> *m_childIndexHash;
virtual void addRigidBody(btRigidBody* body);
virtual void removeRigidBody(btRigidBody* body);
void solveConstraints(btContactSolverInfo& solverInfo);
virtual void addConstraint(btTypedConstraint *constraint, bool disableCollisionsBetweenLinkedBodies);
virtual void removeConstraint(btTypedConstraint *constraint);
///either fracture or glue (!fracture)
void setFractureMode(bool fracture)
{
m_fracturingMode = fracture;
}
bool getFractureMode() const { return m_fracturingMode;}
///normally those callbacks are called internally by the 'solveConstraints'
void glueCallback();
///normally those callbacks are called internally by the 'solveConstraints'
void fractureCallback();
void updateBodies();
void propagateDamage(btFractureBody *body, btScalar *impulse, int connection_index, bool *needsBreakingCheck,
const btVector3 &direction, int *depth);
void breakNeighborhood(btFractureBody *body, int connection_index);
void breakDisconnectedParts( btFractureBody* fracObj);
virtual void updateAabbs();
};
#endif //_BT_FRACTURE_DYNAMICS_WORLD_H

View File

@@ -183,7 +183,7 @@ public:
{
//No constraints should point to this rigidbody
//Remove constraints from the dynamics world before you delete the related rigidbodies.
btAssert(m_constraintRefs.size()==0);
// btAssert(m_constraintRefs.size()==0);
}
protected:

View File

@@ -34,6 +34,7 @@ subject to the following restrictions:
#include "BulletDynamics/ConstraintSolver/btHinge2Constraint.h"
#include "BulletDynamics/ConstraintSolver/btGearConstraint.h"
#include "BulletDynamics/ConstraintSolver/btFixedConstraint.h"
#include "BulletDynamics/ConstraintSolver/btCompoundConstraint.h"
#include "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h"

40
extern/voro++/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,40 @@
set (INC
src
)
set (INC_SYS
)
set (SRC
src/c_loops.cc
src/cell.cc
src/cmd_line.cc
src/common.cc
src/container_prd.cc
src/container.cc
src/pre_container.cc
src/unitcell.cc
src/v_base.cc
src/v_compute.cc
# src/voro++.cc
src/wall.cc
src/c_interface.cc
src/c_loops.hh
src/cell.hh
src/common.hh
src/config.hh
src/container_prd.hh
src/container.hh
src/pre_container.hh
src/rad_option.hh
src/unitcell.hh
src/v_base.hh
src/v_compute.hh
# src/voro++.hh
src/wall.hh
src/worklist.hh
src/c_interface.hh
)
blender_add_lib(extern_voro "${SRC}" "${INC}" "${INC_SYS}")

39
extern/voro++/LICENSE vendored Normal file
View File

@@ -0,0 +1,39 @@
Voro++ Copyright (c) 2008, The Regents of the University of California, through
Lawrence Berkeley National Laboratory (subject to receipt of any required
approvals from the U.S. Dept. of Energy). All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
(1) Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
(3) Neither the name of the University of California, Lawrence Berkeley
National Laboratory, U.S. Dept. of Energy nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You are under no obligation whatsoever to provide any bug fixes, patches, or
upgrades to the features, functionality or performance of the source code
("Enhancements") to anyone; however, if you choose to make your Enhancements
available either publicly, or directly to Lawrence Berkeley National
Laboratory, without imposing a separate written license agreement for such
Enhancements, then you hereby grant the following license: a non-exclusive,
royalty-free perpetual license to install, use, modify, prepare derivative
works, incorporate into other computer software, distribute, and sublicense
such enhancements or derivative works thereof, in binary and source code form.

341
extern/voro++/NEWS vendored Normal file
View File

@@ -0,0 +1,341 @@
Version 0.4.6 (October 17th 2013)
=================================
* Fixed an issue with template instantiation in wall.cc that was causing
compilation problems with new versions of Apple Xcode. Thanks to Barend
Thijsse (Delft University of Technology) and Juan Pablo Cruz Pérez (Instituto
de Física y Matemáticas) for pointing this out.
* Added routines to the container classes to compute a ghost Voronoi cell at
any given location, as though an extra particle was inserted at that
location
* Removed unused private variable in c_loops.hh
* Updated Doxyfile to 1.8.5
Version 0.4.5 (July 27th 2012)
==============================
* Removed "using namespace std" from the header files and added extra "std::"
qualifiers on STL vectors and queues. This is to prevent naming conflicts
with other libraries. Thanks to Florian Hoffmann (University of Luxembourg)
for pointing this out.
* Fixed an error in the check_facets diagnostic routine. Thanks to Tristan
Carrier-Baudouin (Université catholique de Louvain) for pointing this out.
* Fixed a memory leak in the new container_periodic class. Thanks to Massimo
Marchi (Commissariat á l'Energie Atomique) for pointing this out.
* Removed some duplicate or unnecessary #include statements of the standard C++
header files
* Fix small naming mismatch between cell.cc and cell.hh in plane_intersects
and nplane routines, which would give a warning with Doxygen
* More changes for older MS Visual C++ compatability
* Updated Doxyfile to 1.8.1.1
Version 0.4.4 (January 17th 2012)
=================================
* Fixed an error in pointer arithmetic that was introduced in version 0.4,
which would occur in cases where the delete stack was extended when a large
number of vertices were being removed. Thanks to Jeff Johnson (Lawrence
Berkeley Laboratory) and Matt Freeman (Texas A&M University) for pointing
this out.
Version 0.4.3 (November 12th 2011)
==================================
* Removed spurious Gnuplot output line from torus.cc example
* More changes for better Visual C++ compatibility
* Fixed indexing error in worklist generation routine. This had no effect
on the generated worklists, but would become apparent in other situations.
* Added rad_option.hh to the list of files included by voro++.hh for
completeness
* Fix errors in Gnuplot commands in the basic examples README file. Thanks to
William-Fernando Oquendo (National University of Colombia) for pointing this
out.
* Fixed memory allocation issue in face_freq_table routine - thanks to Lingti
Kong for pointing this out
* Minor cleanups and optimizations to wall classes
Version 0.4.2 (September 23rd 2011)
===================================
* Fixed a bug in the put_remap routine where a z periodic boolean was
switched to an x periodic boolean. This would only be noticed when using
mixed periodic boundary conditions and importing particles that need to be
remapped.
* The pid function in the c_loop_base class was mistakenly labeled as double
instead of int - this is now fixed. Thanks to William-Fernando Oquendo
(National University of Colombia) for pointing this out.
* Fixed an extremely subtle bounds checking issue that would only materialize
for the radical Voronoi tessellation with large particle radii. Thanks to
Richard Martin and Maciej Haranczyk (Lawrence Berkeley Laboratory) for
pointing out the original problem.
* Fixed other problems with the radical tessellation. Originally, the
algorithms were concieved for with hard spheres in mind, where the particles
would not overlap, and an assumption was used in the cutoff procedure that
made use of this, but would not be true in general.
* Removed more bracket initializations like "double a(3);" for better
consistency, and more compatibility with older versions of MS Visual C++.
Thanks to Martin Brehm for help with this.
* Factored out the regular/radical inline routines into separate classes, so
that they don't have to be duplicated in the container_periodic classes
* Fixed problems with the container_periodic classes referencing the wrong
loop classes. Thanks to Wang Chuncheng (Nanyang Technological University) for
pointing this out.
* Added c_loop_order_periodic class for doing ordered loops with the periodic
container classes
* Updated the README file in the src directory. The detailed description of
each file has been removed since this is difficult to maintain and this
information is already present in the class reference manual.
* Fixed an error in the pre_container selection of the optimal computational
grid size
* Code comment cleanups, particularly in wall.hh
* Minor man page reformatting
* Updated Doxyfile to version 1.7.5.1
Version 0.4.1 (September 7th 2011)
==================================
* Fixed bug in command-line utility that would give incorrect results when
using the "-c" option for custom output. Thanks to Prof. Aldo Romero
(CINVESTAV-Unidad Queretaro) for pointing this out.
* Added some additional documentation about neighbor information
Version 0.4 (August 30th 2011)
==============================
* New classes called container_periodic and container_periodic_poly that carry
out Voronoi computations in 3D periodic parallelepiped unit cells have been
added. This adds significant complexity to the computation, and the memory
organization of these classes is different, requiring allocation for ghost
regions. Currently these classes cannot be accessed by the command-line
utility, but will be integrated further in future releases. These classes are
currently mainly exploited by a sister software project Zeo++ for chemical
informatics (Maciej Haranczyk, Chris Rycroft, Thomas Willems, Richard Martin)
to be released in late 2011.
* As part of the new container_periodic classes, a new class called unitcell
has been added, which will compute the Voronoi cell for a single particle in
a 3D periodic parallelepiped class. The Voronoi cell is formed by the
influences of the periodic images of itself only. This turns out to be an
important component of the calculations done by the container_periodic
classes but can also be used independently.
* The container classes now have a routine called find_voronoi_cell that will
take a given position vector and return the Voronoi cell which is contained
within. For the regular Voronoi tessellation, this is just the Voronoi cell
corresponding to the closest particle (by definition). For the radical
Voronoi tessellation, this is weighted by the particle radii.
* The library is now enclosed within the "voro" namespace. This requires
specifying "using namespace voro;" in the preamble of codes or prepending
"voro::" to access functions. This greatly minimizes the possiblity of naming
conflicts when using multiple libraries, particularly since many of the
classes iin the library have fairly generic names (eg. "container"). Thanks to
Allan Johns (Dr. D Studios) for suggesting this.
* Voro++ can now be built as a static library that can be installed and linked
to. As part of this, the .cc and .hh files have been significantly revised
with some small inline functions and template code being written into the
header files.
* Previously, all of the voronoicell output routines sent data to an output
stream. However, input and output are now carried out using the STL vector
class, allowing for programs to directly link to and use Voro++ output. The
STL vector class has been chosen since it the simplest and most standard
mechanism for returning a variable amount of data. Several new examples are
provided to demonstrate this functionality, for both the voronoicell class
and the container class.
* A common issue has been that the order of particles in the output file does
not match the input file, since Voro++ internally sorts particles according
to their position. A new class called voro_order has been provided, which can
link to particles as they are stored, allowing for the Voronoi computation to
be carried out in the same order as the input file. The core computation
routines can be run with a variety of different loops, and a new example
"loops.cc" is provided to demonstrate this.
* The order of parameters to certain functions have been changed to take
advantage of the C++ default parameter mechanism wherever possible
* The container and container_poly classes are now derived from a base class,
rather than being different instances of a template. This simplifies the code
and stops common routines from being duplicated. The core Voronoi computation
routine is now held within a voro_compute class, which can be instantiated on
any container with the correct access functions.
* The voronoicell and voronoicell_neighbor classes are now derived from a
common base class, rather than being different instances of a template. This
simplifies the code and stops common routines from being duplicated. The core
nplane routine is now a function template that can be instantiated on the
parent class itself.
* All output routines have been switched from using C++ iostreams to using the C
cstdio library. This has been done for increased performance. In general the
cstdio routines run significantly faster than the comparable iostream
routines: for one file import test, using fscanf from cstdio was five times
as fast as the comparable << operator from iostream. As another example,
the program "cylinder.cc", which uses both file import and export, runs
approximately twice as fast before. Since many people use Voro++ to batch
process large numbers of input files, this increase in input/output speed
seemed desirable.
* The Gnuplot output routines now merge individual lines into contiguous paths
wherever possible, resulting in a ~15% reduction in their file size and a
noticeable improvement in rendering speed
* Previously, the POV-Ray output routines could create cylinders where the start
and end points matched. This was a benign problem, due to the fact the vertex
positions within Voro++ were held to higher precision than the POV-Ray output
file, meaning that distinct vertices could appear to be at the same position;
a perl script was provided to post-process and remove these. However, Voro++
now scans each cylinder before saving to file to automatically remove these
cases from consideration.
* Pointer arithmetic is now used within a number of critical cell computation
routines, and gives a speedup of 10%-20% in many cases. On some typical
problems on typical machines, Voro++ currently computes around 50,000
cells/second. New machines can achieve upwards of 70,000 cells/second.
* A new pre-container mechanism is provided, which can read in a file of
unknown length, and then make a guess at the correct computational grid size
to use. This removes the need for specifying a length scale with the
command-line utility. However, a length scale or grid decomposition can still
be manually specified.
* Removed the option to compile in single-precision. This was a highly
specialized feature, and it appears better to allow users who wish to do this
to make their own modifications. This option also conflicted with building
Voro++ as a standard static library.
* Fixed a benign bug in the block computation list that would cause it to get
extended prematurely
* Numerous small improvements to memory allocation routines
* Added routines to copy a Voronoi cell
* Created a new wall_list class to handle a list of walls. This simplifies the
command-line utility code.
* Labels in the worklist that are used in the transition from the radius search
to the block search have been optimized
* The command-line utility can now produce POV-Ray output. Also, the main loop
in the utility has been combined so that the Voronoi tessellation is only
carried out once, even if POV-Ray and Gnuplot output is also required.
* The command-line utility does range checking on the filename to prevent
buffer overruns
* The routines that put particles into a container now do so more reliably for
periodic cases, remapping them into the primary domain if necessary
* A number of the POV-Ray header files have been altered to directly make use
of a right-handed coordinate system in which the z axis points upwards. This
matches the Gnuplot style, and the style used in many scientific simulations.
It avoids the need for a rotation or matrix transformation when rendering
many of the particle packings. Some of the test particle packings have been
transformed to ensure consistency with previous renderings.
* Some POV-Ray files have been cleaned up and there are additional comments
* Fixed a bug in the print_all_custom() routine, affecting "%P" output. Thanks
to David Waroquiers (Université Catholique de Louvain, Belgium) for pointing
this out.
* Fixed a bug that caused the neighbor list not to be outputted in the same
order as the other plane diagnostic routines. Thanks to Olufemi Olorode
(Texas A&M University) for pointing this out.
* Removed the add_vertex() and init_test() routines, which were mainly used for
debugging
* Updated Doxyfile to version 1.7.4
Version 0.3.1 (September 29, 2009)
==================================
* Carried out a major overhaul of the source code comments that are used by
Doxygen. Several errors in the documentation were fixed.
* Additional comments in the Makefiles, and added the "phony target" keyword
* Many code cleanups and standardizations. Some double and triple loops
were concatenated into one to reduce the amount of indentation.
* Fixed the import.cc example program
* Updated Doxyfile to version 1.6.1
Version 0.3 (August 17, 2009)
=============================
* In response to feedback from several people, the routines for computing
statistics about computed Voronoi cells have been significantly revised,
extended, and put within a common framework. The voronoicell class now has a
large number of routines of the form output_...() that will print cell
information to an output stream. There are also a number of new, simple
routines for computing basic statistics such as the number of edges and faces
of each cell. All of these routines can now be used during the container
analysis, by making use of the new print_custom() routine, which can output
according to a given format string, that uses control sequences similar to
the standard C printf() routine.
* Renamed the "radical" example directory to "custom", and added two
new programs called "cell_statistics.cc" and "custom_output.cc" for
demonstrating the new output routines for the voronoicell and container
classes respectively
* Added a routine for computing the centroid of a Voronoi cell
* Added new routines for computing neighbor normals, in response to a
request from Dave Greenwood
* Removed unnecessary trailing tabs and spaces in the source code
* Fixed a few text justification problems, and altered some of the comments
in the example programs
* Improved the command-line utility, allowing it to specify custom information
in the output. Implemented better error checking on command-line arguments.
* Removed the facets() routine, since this has been superseded by the new
output_...() routines. This also rendered some functions in the neighbor_none
and neighbor_track classes obsolete, and they have also been removed.
* Some reorganization of the cell.hh and container.hh header files to group
similar functions together
* Added torus.cc example that shows how to write custom walls as derived
classes
* Updated Doxyfile to version 1.5.9
Version 0.2.7 (March 25, 2009)
==============================
* Added some missing cstdlib and cstring header files that cause compilation
errors on some systems
* Some text cleanups in the main README file and cmd_line.cc
* The worklist_gen.pl script was in DOS format. It has been switched to Unix
format to match the rest of the code.
* Fixed some incorrect inequalities in degenerate2.cc
* Improved some error messages in container.cc
Version 0.2.6 (March 23, 2009)
==============================
* Significantly improved the error messages generated by the code. It now
makes use of the exit() routine rather than throwing errors, and it returns
various status codes (defined in config.hh) for different types of abnormal
behavior.
* Changed two occurences of "cin" to "cout" in the draw_particles routines
* Corrected error in comment in the tetrahedron example
* Minor comment cleanups of the worklist_gen.pl script
* Updated Doxyfile to version 1.5.8
* Added a routine print_facet_information() in response to a problem
from Hengxing Lan
* Many of the cell based statistics routines (like number_of_faces() and
facets()) internally track their progress by temporarily flipping the edge
table entries to negative values, so that they know where they have already
been. The common code that was used at the end of each of these functions for
resetting the edges back to positive has now been made into a private inline
function called reset_edges().
* Fixed a missing initialization of max_radius to zero in the radius_poly
class. This should not have ever caused any errors, as max_radius would
always have been big enough. However if max_radius was initially set to a
large value, it could have potentially made the code run slower.
* Fixed the code layout in the suretest class header
* Added some additional checks in the command-line utility to screen out
invalid command-line arguments. Switched the test on the number of
computational blocks to use floating point arithmetic, because integers
could potentially overflow and become negative.
* Included several more of the POV-Ray header files that were used to create
the example images on the website
* Removed a "cout" statement in the wall_cone class
* Cleanup of the README files for the basic examples and the wall examples
Version 0.2.5 (January 1, 2009)
===============================
* Added the DOE acknowledgements to the code overview document
Version 0.2.4 (December 14, 2008)
=================================
* Added the code overview PDF document to the package, in the docs directory
* Fixed some spelling errors in the comments
* Many more documentation updates
Version 0.2.3 (December 9, 2008)
================================
* Removed an unused variable that was reported by the Portland C compiler
* Documentation updates
* Added the import.pov script
* Added some simple functions to solve the problem from Stefan Eibl of counting
faces
* Renamed the facets_loop to voropp_loop
Version 0.2.2 (November 19, 2008)
=================================
* Main README file updated
Version 0.2.1 (November 3, 2008)
================================
* Much more documentation
* Brief Doxygen class comments
* Updated Doxyfile to version 1.5.7
Version 0.2 (October 31, 2008)
==============================
* Updated some occurrences of char* with const char* for compatability with
version 4.2 of the GNU C++ compiler
* Making use of default parameters in the wall classes
* The command-line utility can now add walls
Version 0.1 (August 22, 2008)
=============================
* Initial version uploaded to the web

153
extern/voro++/README2 vendored Normal file
View File

@@ -0,0 +1,153 @@
Voro++, a 3D cell-based Voronoi library (http://math.lbl.gov/voro++/)
By Chris H. Rycroft (UC Berkeley / Lawrence Berkeley Laboratory)
================================================================
Voro++ is a software library for carrying out three-dimensional computations
of the Voronoi tessellation. A distinguishing feature of the Voro++ library
is that it carries out cell-based calculations, computing the Voronoi cell
for each particle individually, rather than computing the Voronoi
tessellation as a global network of vertices and edges. It is particularly
well-suited for applications that rely on cell-based statistics, where
features of Voronoi cells (eg. volume, centroid, number of faces) can be
used to analyze a system of particles
Voro++ comprises of several C++ classes that can be built as a static library
and linked to. A command-line utility is also provided that can analyze text
files of particle configurations and use most of the features of the code.
Numerous examples are provided to demonstrate the library's features and all of
these are discussed in detail on the library website.
Compilation - Linux / Mac OS / Windows with Cygwin
==================================================
The code is written in ANSI C++, and compiles on many system architectures. The
package contains the C++ source code, example files, miscellaneous utilities
and documentation. On Linux, Mac OS, and Windows (using Cygwin), the
compilation and installed can be carried out using GNU Make.
To begin, the user should review the file "config.mk" in the top level
directory, to make sure that the compilation and installation settings are
appropriate for their system. Typing "make" will then compile the static
library, command-line utility, and examples. The command-line utility and
library will appear within the "src" directory.
Following successful compilation, the library, command-line utility, and
documentation can be installed by typing "sudo make install". By default, the
program files are installed into /usr/local, and it may be necessary to modify
your environment variables in order to access the installed files:
- to use the command-line utility, the variable PATH should contain
/usr/local/bin.
- to access the Voro++ man page, the variable MANPATH should contain
/usr/local/man.
- to access the Voro++ header files, code compilation should include
the flag '-I/usr/local/include/voro++'.
- to link to the static library, code compilation should include the
flags '-L/usr/local/lib' to tell the linker where to look, and then
'-lvoro++' to link to the library.
The library website contains additional notes on setting environment variables,
and many guides are available on the Internet.
The code can later be uninstalled with "sudo make uninstall". It is also
possible to use the library and command-line utility without installation by
calling the files directly once they have been compiled. On systems where the
user does not have root privileges to install into /usr/local, the "config.mk"
file can be modified to install into the user's home directory by setting
PREFIX=$(HOME). Voro++ supports parallel compilation by using the "make -j <n>"
command where n is the number of threads.
Compilation - Windows without Cygwin
====================================
On a Windows machine without a terminal environment like Cygwin, it is possible
to import and compile the library in many standard C++ development
environments. Users have reported success in building the library with
Microsoft Visual C++ Express and Code::Blocks.
Related programs
================
No external dependencies are required to compile and run the code, but several
programs may be useful for analyzing the output:
- The freeware plotting program Gnuplot (available at www.gnuplot.info) can be
used for rapid 2D and 3D visualization of the program output.
- The freeware raytracer POV-Ray (available at www.povray.org) can be used for
high-quality renderings of the program output.
- The reference manual is generated from comments in the source code using
Doxygen (available at www.doxygen.org). This package is only required if the
library files are being developed and the reference manuals need to be
regenerated. The complete reference manual to the current code is available
online at http://math.lbl.gov/voro++/doc/refman/
Contents
========
examples - many documented examples making use of the library
html - an HTML-based reference manual (generated by Doxygen)
man - contains the man page that is installed with the program
scripts - miscellaneous helper scripts
src - source code files
Usage
=====
Voro++ is released as free software through the Lawrence Berkeley National
Laboratory - a detailed copyright notice is provided below, and the complete
terms of the license can be found in the LICENSE file.
I am very interested to hear from users of the software, so if you find this
useful, please email me at chr@alum.mit.edu. Also, if you plan to publish an
academic paper using this software, please consider citing one of the following
publications:
- Chris H. Rycroft, "Voro++: A three-dimensional Voronoi cell library in C++",
Chaos 19, 041111 (2009).
- Chris H. Rycroft, Gary S. Grest, James W. Landry, and Martin Z. Bazant,
"Analysis of Granular Flow in a Pebble-Bed Nuclear Reactor",
Phys. Rev. E 74, 021306 (2006).
- Chris H. Rycroft, "Multiscale Modeling in Granular Flow", PhD thesis
submitted to the Massachusetts Institute of Technology, September 2007.
(http://math.berkeley.edu/~chr/publish/phd.html)
The first reference contains a one-page overview of the library. The second
reference contains some of the initial images that were made using a very early
version of this code, to track small changes in packing fraction in a large
particle simulation. The third reference discusses the use of 3D Voronoi cells,
and describes the algorithms that were employed in the early version of this
code. Since the publication of the above references, the algorithms in Voro++
have been significantly improved, and a paper specifically devoted to the
current code architecture will be published during 2012.
Copyright Notice
================
Voro++ Copyright (c) 2008, The Regents of the University of California, through
Lawrence Berkeley National Laboratory (subject to receipt of any required
approvals from the U.S. Dept. of Energy). All rights reserved.
If you have questions about your rights to use or distribute this software,
please contact Berkeley Lab's Technology Transfer Department at TTD@lbl.gov.
NOTICE. This software was developed under partial funding from the U.S.
Department of Energy. As such, the U.S. Government has been granted for itself
and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide
license in the Software to reproduce, prepare derivative works, and perform
publicly and display publicly. Beginning five (5) years after the date
permission to assert copyright is obtained from the U.S. Department of Energy,
and subject to any subsequent five (5) year renewals, the U.S. Government is
granted for itself and others acting on its behalf a paid-up, nonexclusive,
irrevocable, worldwide license in the Software to reproduce, prepare derivative
works, distribute copies to the public, perform publicly and display publicly,
and to permit others to do so.
Acknowledgments
===============
This work was supported by the Director, Office of Science, Computational and
Technology Research, U.S. Department of Energy under Contract No.
DE-AC02-05CH11231.

12
extern/voro++/SConscript vendored Normal file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/python
import os
Import ('env')
sources = env.Glob('src/*.cc')
sources.remove('src'+os.sep+'voro++.cc')
sources.remove('src'+os.sep+'v_base_wl.cc')
defs = []
incs = ['src']
env.BlenderLib ('extern_voro++', Split(sources), incs, defs, libtype=['extern'], priority=[40] )

2281
extern/voro++/src/Doxyfile vendored Normal file

File diff suppressed because it is too large Load Diff

39
extern/voro++/src/LICENSE vendored Normal file
View File

@@ -0,0 +1,39 @@
Voro++ Copyright (c) 2008, The Regents of the University of California, through
Lawrence Berkeley National Laboratory (subject to receipt of any required
approvals from the U.S. Dept. of Energy). All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
(1) Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
(3) Neither the name of the University of California, Lawrence Berkeley
National Laboratory, U.S. Dept. of Energy nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You are under no obligation whatsoever to provide any bug fixes, patches, or
upgrades to the features, functionality or performance of the source code
("Enhancements") to anyone; however, if you choose to make your Enhancements
available either publicly, or directly to Lawrence Berkeley National
Laboratory, without imposing a separate written license agreement for such
Enhancements, then you hereby grant the following license: a non-exclusive,
royalty-free perpetual license to install, use, modify, prepare derivative
works, incorporate into other computer software, distribute, and sublicense
such enhancements or derivative works thereof, in binary and source code form.

39
extern/voro++/src/Makefile vendored Normal file
View File

@@ -0,0 +1,39 @@
# Voro++ makefile
#
# Author : Chris H. Rycroft (LBL / UC Berkeley)
# Email : chr@alum.mit.edu
# Date : August 30th 2011
# Load the common configuration file
include ../config.mk
# List of the common source files
objs=cell.o common.o container.o unitcell.o v_compute.o c_loops.o \
v_base.o wall.o pre_container.o container_prd.o
src=$(patsubst %.o,%.cc,$(objs))
# Makefile rules
all: libvoro++.a voro++
depend:
$(CXX) -MM $(src) >Makefile.dep
include Makefile.dep
libvoro++.a: $(objs)
rm -f libvoro++.a
ar rs libvoro++.a $^
voro++: libvoro++.a cmd_line.cc
$(CXX) $(CFLAGS) -L. -o voro++ cmd_line.cc -lvoro++
%.o: %.cc
$(CXX) $(CFLAGS) -c $<
help: Doxyfile $(SOURCE)
doxygen Doxyfile
clean:
rm -f $(objs) voro++ libvoro++.a
.PHONY: all help execs depend

18
extern/voro++/src/Makefile.dep vendored Normal file
View File

@@ -0,0 +1,18 @@
cell.o: cell.cc config.hh common.hh cell.hh
common.o: common.cc common.hh config.hh
container.o: container.cc container.hh config.hh common.hh v_base.hh \
worklist.hh cell.hh c_loops.hh v_compute.hh rad_option.hh
unitcell.o: unitcell.cc unitcell.hh config.hh cell.hh common.hh
v_compute.o: v_compute.cc worklist.hh v_compute.hh config.hh cell.hh \
common.hh rad_option.hh container.hh v_base.hh c_loops.hh \
container_prd.hh unitcell.hh
c_loops.o: c_loops.cc c_loops.hh config.hh
v_base.o: v_base.cc v_base.hh worklist.hh config.hh v_base_wl.cc
wall.o: wall.cc wall.hh cell.hh config.hh common.hh container.hh \
v_base.hh worklist.hh c_loops.hh v_compute.hh rad_option.hh
pre_container.o: pre_container.cc config.hh pre_container.hh c_loops.hh \
container.hh common.hh v_base.hh worklist.hh cell.hh v_compute.hh \
rad_option.hh
container_prd.o: container_prd.cc container_prd.hh config.hh common.hh \
v_base.hh worklist.hh cell.hh c_loops.hh v_compute.hh unitcell.hh \
rad_option.hh

21
extern/voro++/src/README vendored Normal file
View File

@@ -0,0 +1,21 @@
Voro++ library source files
===========================
This directory contains the source code for the library. For full details of
each file, see the files section of the online reference manual at
http://math.lbl.gov/voro++/doc/refman/
Several other files are present:
Makefile - the GNU Makefile controlling the compilation.
Makefile.dep - a file containing all the dependencies of the source files,
automatically generated by the GNU compiler.
cmd_line.cc - source file for creating the command-line utility that makes use
of the library.
Doxyfile - configuration file for Doxygen, used to automatically generate
documentation based on the source code comments.
worklist_gen.pl - perl script for automatically generating the worklist.hh and
v_base_wl.cc files.

194
extern/voro++/src/c_interface.cc vendored Normal file
View File

@@ -0,0 +1,194 @@
#include <stdio.h>
#include "c_interface.hh"
#include "voro++.hh"
container* container_new(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
int nx_,int ny_,int nz_,int xperiodic_,int yperiodic_,int zperiodic_,int init_mem)
{
return (container*)(new voro::container(ax_, bx_, ay_, by_, az_, bz_, nx_, ny_, nz_,
xperiodic_, yperiodic_, zperiodic_, init_mem));
}
particle_order* particle_order_new(void)
{
return (particle_order*)(new voro::particle_order());
}
void container_put(container* con, particle_order* p_order, int n,double x,double y,double z)
{
voro::container* c = (voro::container*)con;
voro::particle_order* po = (voro::particle_order*)p_order;
if (po)
{
c->put(*po, n, x, y, z);
}
else
{
c->put(n, x, y, z);
}
}
void container_compute_cells(container* con, cell* cells)
{
int i = 0, v = 0, fo = 0, fv = 0, n = 0;
voro::container* cn = (voro::container*)con;
voro::voronoicell_neighbor vc;
voro::c_loop_all vl(*cn);
cell c;
if(vl.start()) {
do {
if (cn->compute_cell(vc,vl)) {
// adapted from voro++
std::vector<double> verts;
std::vector<int> face_orders;
std::vector<int> face_verts;
std::vector<int> neighbors;
double *pp, centroid[3];
pp = vl.p[vl.ijk]+vl.ps*vl.q;
// cell particle index
c.index = cn->id[vl.ijk][vl.q];
// verts
vc.vertices(*pp, pp[1], pp[2], verts);
c.totvert = vc.p;
c.verts = new float[c.totvert][3];
for (v = 0; v < c.totvert; v++) {
c.verts[v][0] = (float)verts[v * 3];
c.verts[v][1] = (float)verts[v * 3 + 1];
c.verts[v][2] = (float)verts[v * 3 + 2];
}
// faces
c.totpoly = vc.number_of_faces();
vc.face_orders(face_orders);
c.poly_totvert = new int[c.totpoly];
for (fo = 0; fo < c.totpoly; fo++) {
c.poly_totvert[fo] = face_orders[fo];
}
vc.face_vertices(face_verts);
c.poly_indices = new int*[c.totpoly];
int skip = 0;
for (fo = 0; fo < c.totpoly; fo++) {
int num_verts = c.poly_totvert[fo];
c.poly_indices[fo] = new int[num_verts];
for (fv = 0; fv < num_verts; fv++) {
c.poly_indices[fo][fv] = face_verts[skip + 1 + fv];
}
skip += (num_verts+1);
}
// neighbors
vc.neighbors(neighbors);
c.neighbors = new int[c.totpoly];
for (n = 0; n < c.totpoly; n++)
{
c.neighbors[n] = neighbors[n];
}
// centroid
vc.centroid(centroid[0], centroid[1], centroid[2]);
c.centroid[0] = (float)centroid[0] + (float)*pp;
c.centroid[1] = (float)centroid[1] + (float)pp[1];
c.centroid[2] = (float)centroid[2] + (float)pp[2];
// volume
c.volume = (float)vc.volume();
// valid cell, store
cells[i] = c;
}
else { // invalid cell, set NULL XXX TODO (Somehow !!!)
c.centroid[0] = 0.0f;
c.centroid[1] = 0.0f;
c.centroid[2] = 0.0f;
c.index = 0;
c.neighbors = NULL;
c.totpoly = 0;
c.totvert = 0;
c.poly_totvert = NULL;
c.poly_indices = NULL;
c.verts = NULL;
cells[i] = c;
}
i++;
}
while(vl.inc());
}
}
void container_free(container* con)
{
voro::container* c = (voro::container*)con;
delete c;
}
void particle_order_free(particle_order* p_order)
{
voro::particle_order* po = (voro::particle_order*)p_order;
delete po;
}
cell* cells_new(int totcells)
{
int i = 0;
cell c;
cell *cl;
//need to initalize properly in case we dont compute....
c.centroid[0] = 0.0f;
c.centroid[1] = 0.0f;
c.centroid[2] = 0.0f;
c.index = 0;
c.neighbors = NULL;
c.totpoly = 0;
c.totvert = 0;
c.poly_totvert = NULL;
c.poly_indices = NULL;
c.verts = NULL;
cl = new cell[totcells];
for (i = 0; i < totcells; i++)
{
cl[i] = c;
}
return cl;
}
void cells_free(cell *cells, int totcells)
{
// XXX TODO free properly !
if (cells) {
int i = 0, j = 0;
for (i = 0; i < totcells; i++) {
cell c = cells[i];
if (c.verts)
{
delete [] c.verts;
}
if (c.neighbors) delete [] c.neighbors;
if (c.poly_indices)
{
for (j = 0; j < c.totpoly; j++)
{
delete [] c.poly_indices[j];
}
delete [] c.poly_indices;
}
if (c.poly_totvert) delete [] c.poly_totvert;
}
delete [] cells;
}
}

65
extern/voro++/src/c_interface.hh vendored Normal file
View File

@@ -0,0 +1,65 @@
#ifndef VORO_C_INTERFACE_H
#define VORO_C_INTERFACE_H
#ifdef __cplusplus
extern "C" {
#endif
typedef void container;
typedef void loop_order;
typedef struct particle_order {
int *o;
int *op;
int size;
} particle_order;
/* Necessary Voro++ data for fracture:
* %i the particle/cell index
*
* %w number of vertices (totvert)
* %P global vertex coordinates
* v vertex section delimiter
*
* %s number of faces (totpoly)
* %a number of vertices in each face (sum is totloop)
* %t the indices to the cell vertices, describes which vertices build each face
* %n neighboring cell index for each face
* f face section delimiter
*
* %C the centroid of the voronoi cell
* c centroid section delimiter
*/
typedef struct cell {
float (*verts)[3];
int *poly_totvert;
int **poly_indices;
int *neighbors;
float centroid[3];
float volume;
int index;
int totvert;
int totpoly;
} cell;
container* container_new(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
int nx_,int ny_,int nz_,int xperiodic_,int yperiodic_,int zperiodic_,int init_mem);
particle_order* particle_order_new(void);
void container_put(container* con, particle_order* po, int n, double x, double y, double z);
void container_free(container* con);
void particle_order_free(particle_order* po);
// cell array for direct access
cell* cells_new(int totcell);
void cells_free(cell* cells, int totcells);
void container_compute_cells(container* con, cell* cells);
#ifdef __cplusplus
}
#endif
#endif /* VORO_C_INTERFACE_H */

150
extern/voro++/src/c_loops.cc vendored Normal file
View File

@@ -0,0 +1,150 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file c_loops.cc
* \brief Function implementations for the loop classes. */
#include "c_loops.hh"
namespace voro {
/** Initializes a c_loop_subset object to scan over all particles within a
* given sphere.
* \param[in] (vx,vy,vz) the position vector of the center of the sphere.
* \param[in] r the radius of the sphere.
* \param[in] bounds_test whether to do detailed bounds checking. If this is
* false then the class will loop over all particles in
* blocks that overlap the given sphere. If it is true,
* the particle will only loop over the particles which
* actually lie within the sphere.
* \return True if there is any valid point to loop over, false otherwise. */
void c_loop_subset::setup_sphere(double vx,double vy,double vz,double r,bool bounds_test) {
if(bounds_test) {mode=sphere;v0=vx;v1=vy;v2=vz;v3=r*r;} else mode=no_check;
ai=step_int((vx-ax-r)*xsp);
bi=step_int((vx-ax+r)*xsp);
aj=step_int((vy-ay-r)*ysp);
bj=step_int((vy-ay+r)*ysp);
ak=step_int((vz-az-r)*zsp);
bk=step_int((vz-az+r)*zsp);
setup_common();
}
/** Initializes the class to loop over all particles in a rectangular subgrid
* of blocks.
* \param[in] (ai_,bi_) the subgrid range in the x-direction, inclusive of both
* ends.
* \param[in] (aj_,bj_) the subgrid range in the y-direction, inclusive of both
* ends.
* \param[in] (ak_,bk_) the subgrid range in the z-direction, inclusive of both
* ends.
* \return True if there is any valid point to loop over, false otherwise. */
void c_loop_subset::setup_intbox(int ai_,int bi_,int aj_,int bj_,int ak_,int bk_) {
ai=ai_;bi=bi_;aj=aj_;bj=bj_;ak=ak_;bk=bk_;
mode=no_check;
setup_common();
}
/** Sets up all of the common constants used for the loop.
* \return True if there is any valid point to loop over, false otherwise. */
void c_loop_subset::setup_common() {
if(!xperiodic) {
if(ai<0) {ai=0;if(bi<0) bi=0;}
if(bi>=nx) {bi=nx-1;if(ai>=nx) ai=nx-1;}
}
if(!yperiodic) {
if(aj<0) {aj=0;if(bj<0) bj=0;}
if(bj>=ny) {bj=ny-1;if(aj>=ny) aj=ny-1;}
}
if(!zperiodic) {
if(ak<0) {ak=0;if(bk<0) bk=0;}
if(bk>=nz) {bk=nz-1;if(ak>=nz) ak=nz-1;}
}
ci=ai;cj=aj;ck=ak;
di=i=step_mod(ci,nx);apx=px=step_div(ci,nx)*sx;
dj=j=step_mod(cj,ny);apy=py=step_div(cj,ny)*sy;
dk=k=step_mod(ck,nz);apz=pz=step_div(ck,nz)*sz;
inc1=di-step_mod(bi,nx);
inc2=nx*(ny+dj-step_mod(bj,ny))+inc1;
inc1+=nx;
ijk=di+nx*(dj+ny*dk);
q=0;
}
/** Starts the loop by finding the first particle within the container to
* consider.
* \return True if there is any particle to consider, false otherwise. */
bool c_loop_subset::start() {
while(co[ijk]==0) {if(!next_block()) return false;}
while(mode!=no_check&&out_of_bounds()) {
q++;
while(q>=co[ijk]) {q=0;if(!next_block()) return false;}
}
return true;
}
/** Initializes the class to loop over all particles in a rectangular box.
* \param[in] (xmin,xmax) the minimum and maximum x coordinates of the box.
* \param[in] (ymin,ymax) the minimum and maximum y coordinates of the box.
* \param[in] (zmin,zmax) the minimum and maximum z coordinates of the box.
* \param[in] bounds_test whether to do detailed bounds checking. If this is
* false then the class will loop over all particles in
* blocks that overlap the given box. If it is true, the
* particle will only loop over the particles which
* actually lie within the box.
* \return True if there is any valid point to loop over, false otherwise. */
void c_loop_subset::setup_box(double xmin,double xmax,double ymin,double ymax,double zmin,double zmax,bool bounds_test) {
if(bounds_test) {mode=box;v0=xmin;v1=xmax;v2=ymin;v3=ymax;v4=zmin;v5=zmax;} else mode=no_check;
ai=step_int((xmin-ax)*xsp);
bi=step_int((xmax-ax)*xsp);
aj=step_int((ymin-ay)*ysp);
bj=step_int((ymax-ay)*ysp);
ak=step_int((zmin-az)*zsp);
bk=step_int((zmax-az)*zsp);
setup_common();
}
/** Computes whether the current point is out of bounds, relative to the
* current loop setup.
* \return True if the point is out of bounds, false otherwise. */
bool c_loop_subset::out_of_bounds() {
double *pp=p[ijk]+ps*q;
if(mode==sphere) {
double fx(*pp+px-v0),fy(pp[1]+py-v1),fz(pp[2]+pz-v2);
return fx*fx+fy*fy+fz*fz>v3;
} else {
double f(*pp+px);if(f<v0||f>v1) return true;
f=pp[1]+py;if(f<v2||f>v3) return true;
f=pp[2]+pz;return f<v4||f>v5;
}
}
/** Returns the next block to be tested in a loop, and updates the periodicity
* vector if necessary. */
bool c_loop_subset::next_block() {
if(i<bi) {
i++;
if(ci<nx-1) {ci++;ijk++;} else {ci=0;ijk+=1-nx;px+=sx;}
return true;
} else if(j<bj) {
i=ai;ci=di;px=apx;j++;
if(cj<ny-1) {cj++;ijk+=inc1;} else {cj=0;ijk+=inc1-nxy;py+=sy;}
return true;
} else if(k<bk) {
i=ai;ci=di;j=aj;cj=dj;px=apx;py=apy;k++;
if(ck<nz-1) {ck++;ijk+=inc2;} else {ck=0;ijk+=inc2-nxyz;pz+=sz;}
return true;
} else return false;
}
/** Extends the memory available for storing the ordering. */
void particle_order::add_ordering_memory() {
int *no=new int[size<<2],*nop=no,*opp=o;
while(opp<op) *(nop++)=*(opp++);
delete [] o;
size<<=1;o=no;op=nop;
}
}

456
extern/voro++/src/c_loops.hh vendored Normal file
View File

@@ -0,0 +1,456 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file c_loops.hh
* \brief Header file for the loop classes. */
#ifndef VOROPP_C_LOOPS_HH
#define VOROPP_C_LOOPS_HH
#include "config.hh"
namespace voro {
/** A type associated with a c_loop_subset class, determining what type of
* geometrical region to loop over. */
enum c_loop_subset_mode {
sphere,
box,
no_check
};
/** \brief A class for storing ordering information when particles are added to
* a container.
*
* When particles are added to a container class, they are sorted into an
* internal computational grid of blocks. The particle_order class provides a
* mechanism for remembering which block particles were sorted into. The import
* and put routines in the container class have variants that also take a
* particle_order class. Each time they are called, they will store the block
* that the particle was sorted into, plus the position of the particle within
* the block. The particle_order class can used by the c_loop_order class to
* specifically loop over the particles that have their information stored
* within it. */
class particle_order {
public:
/** A pointer to the array holding the ordering. */
int *o;
/** A pointer to the next position in the ordering array in
* which to store an entry. */
int *op;
/** The current memory allocation for the class, set to the
* number of entries which can be stored. */
int size;
/** The particle_order constructor allocates memory to store the
* ordering information.
* \param[in] init_size the initial amount of memory to
* allocate. */
particle_order(int init_size=init_ordering_size)
: o(new int[init_size<<1]),op(o),size(init_size) {}
/** The particle_order destructor frees the dynamically allocated
* memory used to store the ordering information. */
~particle_order() {
delete [] o;
}
/** Adds a record to the order, corresponding to the memory
* address of where a particle was placed into the container.
* \param[in] ijk the block into which the particle was placed.
* \param[in] q the position within the block where the
* particle was placed. */
inline void add(int ijk,int q) {
if(op==o+size) add_ordering_memory();
*(op++)=ijk;*(op++)=q;
}
private:
void add_ordering_memory();
};
/** \brief Base class for looping over particles in a container.
*
* This class forms the base of all classes that can loop over a subset of
* particles in a contaner in some order. When initialized, it stores constants
* about the corresponding container geometry. It also contains a number of
* routines for interrogating which particle currently being considered by the
* loop, which are common between all of the derived classes. */
class c_loop_base {
public:
/** The number of blocks in the x direction. */
const int nx;
/** The number of blocks in the y direction. */
const int ny;
/** The number of blocks in the z direction. */
const int nz;
/** A constant, set to the value of nx multiplied by ny, which
* is used in the routines that step through blocks in
* sequence. */
const int nxy;
/** A constant, set to the value of nx*ny*nz, which is used in
* the routines that step through blocks in sequence. */
const int nxyz;
/** The number of floating point numbers per particle in the
* associated container data structure. */
const int ps;
/** A pointer to the particle position information in the
* associated container data structure. */
double **p;
/** A pointer to the particle ID information in the associated
* container data structure. */
int **id;
/** A pointer to the particle counts in the associated
* container data structure. */
int *co;
/** The current x-index of the block under consideration by the
* loop. */
int i;
/** The current y-index of the block under consideration by the
* loop. */
int j;
/** The current z-index of the block under consideration by the
* loop. */
int k;
/** The current index of the block under consideration by the
* loop. */
int ijk;
/** The index of the particle under consideration within the current
* block. */
int q;
/** The constructor copies several necessary constants from the
* base container class.
* \param[in] con the container class to use. */
template<class c_class>
c_loop_base(c_class &con) : nx(con.nx), ny(con.ny), nz(con.nz),
nxy(con.nxy), nxyz(con.nxyz), ps(con.ps),
p(con.p), id(con.id), co(con.co) {}
/** Returns the position vector of the particle currently being
* considered by the loop.
* \param[out] (x,y,z) the position vector of the particle. */
inline void pos(double &x,double &y,double &z) {
double *pp=p[ijk]+ps*q;
x=*(pp++);y=*(pp++);z=*pp;
}
/** Returns the ID, position vector, and radius of the particle
* currently being considered by the loop.
* \param[out] pid the particle ID.
* \param[out] (x,y,z) the position vector of the particle.
* \param[out] r the radius of the particle. If no radius
* information is available the default radius
* value is returned. */
inline void pos(int &pid,double &x,double &y,double &z,double &r) {
pid=id[ijk][q];
double *pp=p[ijk]+ps*q;
x=*(pp++);y=*(pp++);z=*pp;
r=ps==3?default_radius:*(++pp);
}
/** Returns the x position of the particle currently being
* considered by the loop. */
inline double x() {return p[ijk][ps*q];}
/** Returns the y position of the particle currently being
* considered by the loop. */
inline double y() {return p[ijk][ps*q+1];}
/** Returns the z position of the particle currently being
* considered by the loop. */
inline double z() {return p[ijk][ps*q+2];}
/** Returns the ID of the particle currently being considered
* by the loop. */
inline int pid() {return id[ijk][q];}
};
/** \brief Class for looping over all of the particles in a container.
*
* This is one of the simplest loop classes, that scans the computational
* blocks in order, and scans all the particles within each block in order. */
class c_loop_all : public c_loop_base {
public:
/** The constructor copies several necessary constants from the
* base container class.
* \param[in] con the container class to use. */
template<class c_class>
c_loop_all(c_class &con) : c_loop_base(con) {}
/** Sets the class to consider the first particle.
* \return True if there is any particle to consider, false
* otherwise. */
inline bool start() {
i=j=k=ijk=q=0;
while(co[ijk]==0) if(!next_block()) return false;
return true;
}
/** Finds the next particle to test.
* \return True if there is another particle, false if no more
* particles are available. */
inline bool inc() {
q++;
if(q>=co[ijk]) {
q=0;
do {
if(!next_block()) return false;
} while(co[ijk]==0);
}
return true;
}
private:
/** Updates the internal variables to find the next
* computational block with any particles.
* \return True if another block is found, false if there are
* no more blocks. */
inline bool next_block() {
ijk++;
i++;
if(i==nx) {
i=0;j++;
if(j==ny) {
j=0;k++;
if(ijk==nxyz) return false;
}
}
return true;
}
};
/** \brief Class for looping over a subset of particles in a container.
*
* This class can loop over a subset of particles in a certain geometrical
* region within the container. The class can be set up to loop over a
* rectangular box or sphere. It can also rectangular group of internal
* computational blocks. */
class c_loop_subset : public c_loop_base {
public:
/** The current mode of operation, determining whether tests
* should be applied to particles to ensure they are within a
* certain geometrical object. */
c_loop_subset_mode mode;
/** The constructor copies several necessary constants from the
* base container class.
* \param[in] con the container class to use. */
template<class c_class>
c_loop_subset(c_class &con) : c_loop_base(con), ax(con.ax), ay(con.ay), az(con.az),
sx(con.bx-ax), sy(con.by-ay), sz(con.bz-az), xsp(con.xsp), ysp(con.ysp), zsp(con.zsp),
xperiodic(con.xperiodic), yperiodic(con.yperiodic), zperiodic(con.zperiodic) {}
void setup_sphere(double vx,double vy,double vz,double r,bool bounds_test=true);
void setup_box(double xmin,double xmax,double ymin,double ymax,double zmin,double zmax,bool bounds_test=true);
void setup_intbox(int ai_,int bi_,int aj_,int bj_,int ak_,int bk_);
bool start();
/** Finds the next particle to test.
* \return True if there is another particle, false if no more
* particles are available. */
inline bool inc() {
do {
q++;
while(q>=co[ijk]) {q=0;if(!next_block()) return false;}
} while(mode!=no_check&&out_of_bounds());
return true;
}
private:
const double ax,ay,az,sx,sy,sz,xsp,ysp,zsp;
const bool xperiodic,yperiodic,zperiodic;
double px,py,pz,apx,apy,apz;
double v0,v1,v2,v3,v4,v5;
int ai,bi,aj,bj,ak,bk;
int ci,cj,ck,di,dj,dk,inc1,inc2;
inline int step_mod(int a,int b) {return a>=0?a%b:b-1-(b-1-a)%b;}
inline int step_div(int a,int b) {return a>=0?a/b:-1+(a+1)/b;}
inline int step_int(double a) {return a<0?int(a)-1:int(a);}
void setup_common();
bool next_block();
bool out_of_bounds();
};
/** \brief Class for looping over all of the particles specified in a
* pre-assembled particle_order class.
*
* The particle_order class can be used to create a specific order of particles
* within the container. This class can then loop over these particles in this
* order. The class is particularly useful in cases where the ordering of the
* output must match the ordering of particles as they were inserted into the
* container. */
class c_loop_order : public c_loop_base {
public:
/** A reference to the ordering class to use. */
particle_order &vo;
/** A pointer to the current position in the ordering class. */
int *cp;
/** A pointer to the end position in the ordering class. */
int *op;
/** The constructor copies several necessary constants from the
* base class, and sets up a reference to the ordering class to
* use.
* \param[in] con the container class to use.
* \param[in] vo_ the ordering class to use. */
template<class c_class>
c_loop_order(c_class &con,particle_order &vo_)
: c_loop_base(con), vo(vo_), nx(con.nx), nxy(con.nxy) {}
/** Sets the class to consider the first particle.
* \return True if there is any particle to consider, false
* otherwise. */
inline bool start() {
cp=vo.o;op=vo.op;
if(cp!=op) {
ijk=*(cp++);decode();
q=*(cp++);
return true;
} else return false;
}
/** Finds the next particle to test.
* \return True if there is another particle, false if no more
* particles are available. */
inline bool inc() {
if(cp==op) return false;
ijk=*(cp++);decode();
q=*(cp++);
return true;
}
private:
/** The number of computational blocks in the x direction. */
const int nx;
/** The number of computational blocks in a z-slice. */
const int nxy;
/** Takes the current block index and computes indices in the
* x, y, and z directions. */
inline void decode() {
k=ijk/nxy;
int ijkt=ijk-nxy*k;
j=ijkt/nx;
i=ijkt-j*nx;
}
};
/** \brief A class for looping over all particles in a container_periodic or
* container_periodic_poly class.
*
* Since the container_periodic and container_periodic_poly classes have a
* fundamentally different memory organization, the regular loop classes cannot
* be used with them. */
class c_loop_all_periodic : public c_loop_base {
public:
/** The constructor copies several necessary constants from the
* base periodic container class.
* \param[in] con the periodic container class to use. */
template<class c_class>
c_loop_all_periodic(c_class &con) : c_loop_base(con), ey(con.ey), ez(con.ez), wy(con.wy), wz(con.wz),
ijk0(nx*(ey+con.oy*ez)), inc2(2*nx*con.ey+1) {}
/** Sets the class to consider the first particle.
* \return True if there is any particle to consider, false
* otherwise. */
inline bool start() {
i=0;
j=ey;
k=ez;
ijk=ijk0;
q=0;
while(co[ijk]==0) if(!next_block()) return false;
return true;
}
/** Finds the next particle to test.
* \return True if there is another particle, false if no more
* particles are available. */
inline bool inc() {
q++;
if(q>=co[ijk]) {
q=0;
do {
if(!next_block()) return false;
} while(co[ijk]==0);
}
return true;
}
private:
/** The lower y index (inclusive) of the primary domain within
* the block structure. */
int ey;
/** The lower y index (inclusive) of the primary domain within
* the block structure. */
int ez;
/** The upper y index (exclusive) of the primary domain within
* the block structure. */
int wy;
/** The upper z index (exclusive) of the primary domain within
* the block structure. */
int wz;
/** The index of the (0,0,0) block within the block structure.
*/
int ijk0;
/** A value to increase ijk by when the z index is increased.
*/
int inc2;
/** Updates the internal variables to find the next
* computational block with any particles.
* \return True if another block is found, false if there are
* no more blocks. */
inline bool next_block() {
i++;
if(i==nx) {
i=0;j++;
if(j==wy) {
j=ey;k++;
if(k==wz) return false;
ijk+=inc2;
} else ijk++;
} else ijk++;
return true;
}
};
/** \brief Class for looping over all of the particles specified in a
* pre-assembled particle_order class, for use with container_periodic classes.
*
* The particle_order class can be used to create a specific order of particles
* within the container. This class can then loop over these particles in this
* order. The class is particularly useful in cases where the ordering of the
* output must match the ordering of particles as they were inserted into the
* container. */
class c_loop_order_periodic : public c_loop_base {
public:
/** A reference to the ordering class to use. */
particle_order &vo;
/** A pointer to the current position in the ordering class. */
int *cp;
/** A pointer to the end position in the ordering class. */
int *op;
/** The constructor copies several necessary constants from the
* base class, and sets up a reference to the ordering class to
* use.
* \param[in] con the container class to use.
* \param[in] vo_ the ordering class to use. */
template<class c_class>
c_loop_order_periodic(c_class &con,particle_order &vo_)
: c_loop_base(con), vo(vo_), nx(con.nx), oxy(con.nx*con.oy) {}
/** Sets the class to consider the first particle.
* \return True if there is any particle to consider, false
* otherwise. */
inline bool start() {
cp=vo.o;op=vo.op;
if(cp!=op) {
ijk=*(cp++);decode();
q=*(cp++);
return true;
} else return false;
}
/** Finds the next particle to test.
* \return True if there is another particle, false if no more
* particles are available. */
inline bool inc() {
if(cp==op) return false;
ijk=*(cp++);decode();
q=*(cp++);
return true;
}
private:
/** The number of computational blocks in the x direction. */
const int nx;
/** The number of computational blocks in a z-slice. */
const int oxy;
/** Takes the current block index and computes indices in the
* x, y, and z directions. */
inline void decode() {
k=ijk/oxy;
int ijkt=ijk-oxy*k;
j=ijkt/nx;
i=ijkt-j*nx;
}
};
}
#endif

2252
extern/voro++/src/cell.cc vendored Normal file

File diff suppressed because it is too large Load Diff

514
extern/voro++/src/cell.hh vendored Normal file
View File

@@ -0,0 +1,514 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file cell.hh
* \brief Header file for the voronoicell and related classes. */
#ifndef VOROPP_CELL_HH
#define VOROPP_CELL_HH
#include <vector>
#include "config.hh"
#include "common.hh"
namespace voro {
/** \brief A class representing a single Voronoi cell.
*
* This class represents a single Voronoi cell, as a collection of vertices
* that are connected by edges. The class contains routines for initializing
* the Voronoi cell to be simple shapes such as a box, tetrahedron, or octahedron.
* It the contains routines for recomputing the cell based on cutting it
* by a plane, which forms the key routine for the Voronoi cell computation.
* It contains numerous routine for computing statistics about the Voronoi cell,
* and it can output the cell in several formats.
*
* This class is not intended for direct use, but forms the base of the
* voronoicell and voronoicell_neighbor classes, which extend it based on
* whether neighboring particle ID information needs to be tracked. */
class voronoicell_base {
public:
/** This holds the current size of the arrays ed and nu, which
* hold the vertex information. If more vertices are created
* than can fit in this array, then it is dynamically extended
* using the add_memory_vertices routine. */
int current_vertices;
/** This holds the current maximum allowed order of a vertex,
* which sets the size of the mem, mep, and mec arrays. If a
* vertex is created with more vertices than this, the arrays
* are dynamically extended using the add_memory_vorder routine.
*/
int current_vertex_order;
/** This sets the size of the main delete stack. */
int current_delete_size;
/** This sets the size of the auxiliary delete stack. */
int current_delete2_size;
/** This sets the total number of vertices in the current cell.
*/
int p;
/** This is the index of particular point in the cell, which is
* used to start the tracing routines for plane intersection
* and cutting. These routines will work starting from any
* point, but it's often most efficient to start from the last
* point considered, since in many cases, the cell construction
* algorithm may consider many planes with similar vectors
* concurrently. */
int up;
/** This is a two dimensional array that holds information
* about the edge connections of the vertices that make up the
* cell. The two dimensional array is not allocated in the
* usual method. To account for the fact the different vertices
* have different orders, and thus require different amounts of
* storage, the elements of ed[i] point to one-dimensional
* arrays in the mep[] array of different sizes.
*
* More specifically, if vertex i has order m, then ed[i]
* points to a one-dimensional array in mep[m] that has 2*m+1
* entries. The first m elements hold the neighboring edges, so
* that the jth edge of vertex i is held in ed[i][j]. The next
* m elements hold a table of relations which is redundant but
* helps speed up the computation. It satisfies the relation
* ed[ed[i][j]][ed[i][m+j]]=i. The final entry holds a back
* pointer, so that ed[i+2*m]=i. The back pointers are used
* when rearranging the memory. */
int **ed;
/** This array holds the order of the vertices in the Voronoi
* cell. This array is dynamically allocated, with its current
* size held by current_vertices. */
int *nu;
/** This in an array with size 3*current_vertices for holding
* the positions of the vertices. */
double *pts;
voronoicell_base();
~voronoicell_base();
void init_base(double xmin,double xmax,double ymin,double ymax,double zmin,double zmax);
void init_octahedron_base(double l);
void init_tetrahedron_base(double x0,double y0,double z0,double x1,double y1,double z1,double x2,double y2,double z2,double x3,double y3,double z3);
void translate(double x,double y,double z);
void draw_pov(double x,double y,double z,FILE *fp=stdout);
/** Outputs the cell in POV-Ray format, using cylinders for edges
* and spheres for vertices, to a given file.
* \param[in] (x,y,z) a displacement to add to the cell's
* position.
* \param[in] filename the name of the file to write to. */
inline void draw_pov(double x,double y,double z,const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_pov(x,y,z,fp);
fclose(fp);
};
void draw_pov_mesh(double x,double y,double z,FILE *fp=stdout);
/** Outputs the cell in POV-Ray format as a mesh2 object to a
* given file.
* \param[in] (x,y,z) a displacement to add to the cell's
* position.
* \param[in] filename the name of the file to write to. */
inline void draw_pov_mesh(double x,double y,double z,const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_pov_mesh(x,y,z,fp);
fclose(fp);
}
void draw_gnuplot(double x,double y,double z,FILE *fp=stdout);
/** Outputs the cell in Gnuplot format a given file.
* \param[in] (x,y,z) a displacement to add to the cell's
* position.
* \param[in] filename the name of the file to write to. */
inline void draw_gnuplot(double x,double y,double z,const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_gnuplot(x,y,z,fp);
fclose(fp);
}
double volume();
double max_radius_squared();
double total_edge_distance();
double surface_area();
void centroid(double &cx,double &cy,double &cz);
int number_of_faces();
int number_of_edges();
void vertex_orders(std::vector<int> &v);
void output_vertex_orders(FILE *fp=stdout);
void vertices(std::vector<double> &v);
void output_vertices(FILE *fp=stdout);
void vertices(double x,double y,double z,std::vector<double> &v);
void output_vertices(double x,double y,double z,FILE *fp=stdout);
void face_areas(std::vector<double> &v);
/** Outputs the areas of the faces.
* \param[in] fp the file handle to write to. */
inline void output_face_areas(FILE *fp=stdout) {
std::vector<double> v;face_areas(v);
voro_print_vector(v,fp);
}
void face_orders(std::vector<int> &v);
/** Outputs a list of the number of sides of each face.
* \param[in] fp the file handle to write to. */
inline void output_face_orders(FILE *fp=stdout) {
std::vector<int> v;face_orders(v);
voro_print_vector(v,fp);
}
void face_freq_table(std::vector<int> &v);
/** Outputs a */
inline void output_face_freq_table(FILE *fp=stdout) {
std::vector<int> v;face_freq_table(v);
voro_print_vector(v,fp);
}
void face_vertices(std::vector<int> &v);
/** Outputs the */
inline void output_face_vertices(FILE *fp=stdout) {
std::vector<int> v;face_vertices(v);
voro_print_face_vertices(v,fp);
}
void face_perimeters(std::vector<double> &v);
/** Outputs a list of the perimeters of each face.
* \param[in] fp the file handle to write to. */
inline void output_face_perimeters(FILE *fp=stdout) {
std::vector<double> v;face_perimeters(v);
voro_print_vector(v,fp);
}
void normals(std::vector<double> &v);
/** Outputs a list of the perimeters of each face.
* \param[in] fp the file handle to write to. */
inline void output_normals(FILE *fp=stdout) {
std::vector<double> v;normals(v);
voro_print_positions(v,fp);
}
/** Outputs a custom string of information about the Voronoi
* cell to a file. It assumes the cell is at (0,0,0) and has a
* the default_radius associated with it.
* \param[in] format the custom format string to use.
* \param[in] fp the file handle to write to. */
inline void output_custom(const char *format,FILE *fp=stdout) {output_custom(format,0,0,0,0,default_radius,fp);}
void output_custom(const char *format,int i,double x,double y,double z,double r,FILE *fp=stdout);
template<class vc_class>
bool nplane(vc_class &vc,double x,double y,double z,double rsq,int p_id);
bool plane_intersects(double x,double y,double z,double rsq);
bool plane_intersects_guess(double x,double y,double z,double rsq);
void construct_relations();
void check_relations();
void check_duplicates();
void print_edges();
/** Returns a list of IDs of neighboring particles
* corresponding to each face.
* \param[out] v a reference to a vector in which to return the
* results. If no neighbor information is
* available, a blank vector is returned. */
virtual void neighbors(std::vector<int> &v) {v.clear();}
/** This is a virtual function that is overridden by a routine
* to print a list of IDs of neighboring particles
* corresponding to each face. By default, when no neighbor
* information is available, the routine does nothing.
* \param[in] fp the file handle to write to. */
virtual void output_neighbors(FILE *fp=stdout) {}
/** This a virtual function that is overridden by a routine to
* print the neighboring particle IDs for a given vertex. By
* default, when no neighbor information is available, the
* routine does nothing.
* \param[in] i the vertex to consider. */
virtual void print_edges_neighbors(int i) {};
/** This is a simple inline function for picking out the index
* of the next edge counterclockwise at the current vertex.
* \param[in] a the index of an edge of the current vertex.
* \param[in] p the number of the vertex.
* \return 0 if a=nu[p]-1, or a+1 otherwise. */
inline int cycle_up(int a,int p) {return a==nu[p]-1?0:a+1;}
/** This is a simple inline function for picking out the index
* of the next edge clockwise from the current vertex.
* \param[in] a the index of an edge of the current vertex.
* \param[in] p the number of the vertex.
* \return nu[p]-1 if a=0, or a-1 otherwise. */
inline int cycle_down(int a,int p) {return a==0?nu[p]-1:a-1;}
protected:
/** This a one dimensional array that holds the current sizes
* of the memory allocations for them mep array.*/
int *mem;
/** This is a one dimensional array that holds the current
* number of vertices of order p that are stored in the mep[p]
* array. */
int *mec;
/** This is a two dimensional array for holding the information
* about the edges of the Voronoi cell. mep[p] is a
* one-dimensional array for holding the edge information about
* all vertices of order p, with each vertex holding 2*p+1
* integers of information. The total number of vertices held
* on mep[p] is stored in mem[p]. If the space runs out, the
* code allocates more using the add_memory() routine. */
int **mep;
inline void reset_edges();
template<class vc_class>
void check_memory_for_copy(vc_class &vc,voronoicell_base* vb);
void copy(voronoicell_base* vb);
private:
/** This is the delete stack, used to store the vertices which
* are going to be deleted during the plane cutting procedure.
*/
int *ds,*stacke;
/** This is the auxiliary delete stack, which has size set by
* current_delete2_size. */
int *ds2,*stacke2;
/** This stores the current memory allocation for the marginal
* cases. */
int current_marginal;
/** This stores the total number of marginal points which are
* currently in the buffer. */
int n_marg;
/** This array contains a list of the marginal points, and also
* the outcomes of the marginal tests. */
int *marg;
/** The x coordinate of the normal vector to the test plane. */
double px;
/** The y coordinate of the normal vector to the test plane. */
double py;
/** The z coordinate of the normal vector to the test plane. */
double pz;
/** The magnitude of the normal vector to the test plane. */
double prsq;
template<class vc_class>
void add_memory(vc_class &vc,int i,int *stackp2);
template<class vc_class>
void add_memory_vertices(vc_class &vc);
template<class vc_class>
void add_memory_vorder(vc_class &vc);
void add_memory_ds(int *&stackp);
void add_memory_ds2(int *&stackp2);
template<class vc_class>
inline bool collapse_order1(vc_class &vc);
template<class vc_class>
inline bool collapse_order2(vc_class &vc);
template<class vc_class>
inline bool delete_connection(vc_class &vc,int j,int k,bool hand);
template<class vc_class>
inline bool search_for_outside_edge(vc_class &vc,int &up);
template<class vc_class>
inline void add_to_stack(vc_class &vc,int lp,int *&stackp2);
inline bool plane_intersects_track(double x,double y,double z,double rs,double g);
inline void normals_search(std::vector<double> &v,int i,int j,int k);
inline bool search_edge(int l,int &m,int &k);
inline int m_test(int n,double &ans);
int check_marginal(int n,double &ans);
friend class voronoicell;
friend class voronoicell_neighbor;
};
/** \brief Extension of the voronoicell_base class to represent a Voronoi
* cell without neighbor information.
*
* This class is an extension of the voronoicell_base class, in cases when
* is not necessary to track the IDs of neighboring particles associated
* with each face of the Voronoi cell. */
class voronoicell : public voronoicell_base {
public:
using voronoicell_base::nplane;
/** Copies the information from another voronoicell class into
* this class, extending memory allocation if necessary.
* \param[in] c the class to copy. */
inline void operator=(voronoicell &c) {
voronoicell_base* vb((voronoicell_base*) &c);
check_memory_for_copy(*this,vb);copy(vb);
}
/** Cuts a Voronoi cell using by the plane corresponding to the
* perpendicular bisector of a particle.
* \param[in] (x,y,z) the position of the particle.
* \param[in] rsq the modulus squared of the vector.
* \param[in] p_id the plane ID, ignored for this case where no
* neighbor tracking is enabled.
* \return False if the plane cut deleted the cell entirely,
* true otherwise. */
inline bool nplane(double x,double y,double z,double rsq,int p_id) {
return nplane(*this,x,y,z,rsq,0);
}
/** Cuts a Voronoi cell using by the plane corresponding to the
* perpendicular bisector of a particle.
* \param[in] (x,y,z) the position of the particle.
* \param[in] p_id the plane ID, ignored for this case where no
* neighbor tracking is enabled.
* \return False if the plane cut deleted the cell entirely,
* true otherwise. */
inline bool nplane(double x,double y,double z,int p_id) {
double rsq=x*x+y*y+z*z;
return nplane(*this,x,y,z,rsq,0);
}
/** Cuts a Voronoi cell using by the plane corresponding to the
* perpendicular bisector of a particle.
* \param[in] (x,y,z) the position of the particle.
* \param[in] rsq the modulus squared of the vector.
* \return False if the plane cut deleted the cell entirely,
* true otherwise. */
inline bool plane(double x,double y,double z,double rsq) {
return nplane(*this,x,y,z,rsq,0);
}
/** Cuts a Voronoi cell using by the plane corresponding to the
* perpendicular bisector of a particle.
* \param[in] (x,y,z) the position of the particle.
* \return False if the plane cut deleted the cell entirely,
* true otherwise. */
inline bool plane(double x,double y,double z) {
double rsq=x*x+y*y+z*z;
return nplane(*this,x,y,z,rsq,0);
}
/** Initializes the Voronoi cell to be rectangular box with the
* given dimensions.
* \param[in] (xmin,xmax) the minimum and maximum x coordinates.
* \param[in] (ymin,ymax) the minimum and maximum y coordinates.
* \param[in] (zmin,zmax) the minimum and maximum z coordinates. */
inline void init(double xmin,double xmax,double ymin,double ymax,double zmin,double zmax) {
init_base(xmin,xmax,ymin,ymax,zmin,zmax);
}
/** Initializes the cell to be an octahedron with vertices at
* (l,0,0), (-l,0,0), (0,l,0), (0,-l,0), (0,0,l), and (0,0,-l).
* \param[in] l a parameter setting the size of the octahedron.
*/
inline void init_octahedron(double l) {
init_octahedron_base(l);
}
/** Initializes the cell to be a tetrahedron.
* \param[in] (x0,y0,z0) the coordinates of the first vertex.
* \param[in] (x1,y1,z1) the coordinates of the second vertex.
* \param[in] (x2,y2,z2) the coordinates of the third vertex.
* \param[in] (x3,y3,z3) the coordinates of the fourth vertex.
*/
inline void init_tetrahedron(double x0,double y0,double z0,double x1,double y1,double z1,double x2,double y2,double z2,double x3,double y3,double z3) {
init_tetrahedron_base(x0,y0,z0,x1,y1,z1,x2,y2,z2,x3,y3,z3);
}
private:
inline void n_allocate(int i,int m) {};
inline void n_add_memory_vertices(int i) {};
inline void n_add_memory_vorder(int i) {};
inline void n_set_pointer(int p,int n) {};
inline void n_copy(int a,int b,int c,int d) {};
inline void n_set(int a,int b,int c) {};
inline void n_set_aux1(int k) {};
inline void n_copy_aux1(int a,int b) {};
inline void n_copy_aux1_shift(int a,int b) {};
inline void n_set_aux2_copy(int a,int b) {};
inline void n_copy_pointer(int a,int b) {};
inline void n_set_to_aux1(int j) {};
inline void n_set_to_aux2(int j) {};
inline void n_allocate_aux1(int i) {};
inline void n_switch_to_aux1(int i) {};
inline void n_copy_to_aux1(int i,int m) {};
inline void n_set_to_aux1_offset(int k,int m) {};
inline void n_neighbors(std::vector<int> &v) {v.clear();};
friend class voronoicell_base;
};
/** \brief Extension of the voronoicell_base class to represent a Voronoi cell
* with neighbor information.
*
* This class is an extension of the voronoicell_base class, in cases when the
* IDs of neighboring particles associated with each face of the Voronoi cell.
* It contains additional data structures mne and ne for storing this
* information. */
class voronoicell_neighbor : public voronoicell_base {
public:
using voronoicell_base::nplane;
/** This two dimensional array holds the neighbor information
* associated with each vertex. mne[p] is a one dimensional
* array which holds all of the neighbor information for
* vertices of order p. */
int **mne;
/** This is a two dimensional array that holds the neighbor
* information associated with each vertex. ne[i] points to a
* one-dimensional array in mne[nu[i]]. ne[i][j] holds the
* neighbor information associated with the jth edge of vertex
* i. It is set to the ID number of the plane that made the
* face that is clockwise from the jth edge. */
int **ne;
voronoicell_neighbor();
~voronoicell_neighbor();
void operator=(voronoicell &c);
void operator=(voronoicell_neighbor &c);
/** Cuts the Voronoi cell by a particle whose center is at a
* separation of (x,y,z) from the cell center. The value of rsq
* should be initially set to \f$x^2+y^2+z^2\f$.
* \param[in] (x,y,z) the normal vector to the plane.
* \param[in] rsq the distance along this vector of the plane.
* \param[in] p_id the plane ID (for neighbor tracking only).
* \return False if the plane cut deleted the cell entirely,
* true otherwise. */
inline bool nplane(double x,double y,double z,double rsq,int p_id) {
return nplane(*this,x,y,z,rsq,p_id);
}
/** This routine calculates the modulus squared of the vector
* before passing it to the main nplane() routine with full
* arguments.
* \param[in] (x,y,z) the vector to cut the cell by.
* \param[in] p_id the plane ID (for neighbor tracking only).
* \return False if the plane cut deleted the cell entirely,
* true otherwise. */
inline bool nplane(double x,double y,double z,int p_id) {
double rsq=x*x+y*y+z*z;
return nplane(*this,x,y,z,rsq,p_id);
}
/** This version of the plane routine just makes up the plane
* ID to be zero. It will only be referenced if neighbor
* tracking is enabled.
* \param[in] (x,y,z) the vector to cut the cell by.
* \param[in] rsq the modulus squared of the vector.
* \return False if the plane cut deleted the cell entirely,
* true otherwise. */
inline bool plane(double x,double y,double z,double rsq) {
return nplane(*this,x,y,z,rsq,0);
}
/** Cuts a Voronoi cell using the influence of a particle at
* (x,y,z), first calculating the modulus squared of this
* vector before passing it to the main nplane() routine. Zero
* is supplied as the plane ID, which will be ignored unless
* neighbor tracking is enabled.
* \param[in] (x,y,z) the vector to cut the cell by.
* \return False if the plane cut deleted the cell entirely,
* true otherwise. */
inline bool plane(double x,double y,double z) {
double rsq=x*x+y*y+z*z;
return nplane(*this,x,y,z,rsq,0);
}
void init(double xmin,double xmax,double ymin,double ymax,double zmin,double zmax);
void init_octahedron(double l);
void init_tetrahedron(double x0,double y0,double z0,double x1,double y1,double z1,double x2,double y2,double z2,double x3,double y3,double z3);
void check_facets();
virtual void neighbors(std::vector<int> &v);
virtual void print_edges_neighbors(int i);
virtual void output_neighbors(FILE *fp=stdout) {
std::vector<int> v;neighbors(v);
voro_print_vector(v,fp);
}
private:
int *paux1;
int *paux2;
inline void n_allocate(int i,int m) {mne[i]=new int[m*i];}
inline void n_add_memory_vertices(int i) {
int **pp=new int*[i];
for(int j=0;j<current_vertices;j++) pp[j]=ne[j];
delete [] ne;ne=pp;
}
inline void n_add_memory_vorder(int i) {
int **p2=new int*[i];
for(int j=0;j<current_vertex_order;j++) p2[j]=mne[j];
delete [] mne;mne=p2;
}
inline void n_set_pointer(int p,int n) {
ne[p]=mne[n]+n*mec[n];
}
inline void n_copy(int a,int b,int c,int d) {ne[a][b]=ne[c][d];}
inline void n_set(int a,int b,int c) {ne[a][b]=c;}
inline void n_set_aux1(int k) {paux1=mne[k]+k*mec[k];}
inline void n_copy_aux1(int a,int b) {paux1[b]=ne[a][b];}
inline void n_copy_aux1_shift(int a,int b) {paux1[b]=ne[a][b+1];}
inline void n_set_aux2_copy(int a,int b) {
paux2=mne[b]+b*mec[b];
for(int i=0;i<b;i++) ne[a][i]=paux2[i];
}
inline void n_copy_pointer(int a,int b) {ne[a]=ne[b];}
inline void n_set_to_aux1(int j) {ne[j]=paux1;}
inline void n_set_to_aux2(int j) {ne[j]=paux2;}
inline void n_allocate_aux1(int i) {paux1=new int[i*mem[i]];}
inline void n_switch_to_aux1(int i) {delete [] mne[i];mne[i]=paux1;}
inline void n_copy_to_aux1(int i,int m) {paux1[m]=mne[i][m];}
inline void n_set_to_aux1_offset(int k,int m) {ne[k]=paux1+m;}
friend class voronoicell_base;
};
}
#endif

498
extern/voro++/src/cmd_line.cc vendored Normal file
View File

@@ -0,0 +1,498 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file cmd_line.cc
* \brief Source code for the command-line utility. */
#include <cstring>
#include "voro++.hh"
using namespace voro;
enum blocks_mode {
none,
length_scale,
specified
};
// A maximum allowed number of regions, to prevent enormous amounts of memory
// being allocated
const int max_regions=16777216;
// This message gets displayed if the user requests the help flag
void help_message() {
puts("Voro++ version 0.4.5, by Chris H. Rycroft (UC Berkeley/LBL)\n\n"
"Syntax: voro++ [options] <x_min> <x_max> <y_min>\n"
" <y_max> <z_min> <z_max> <filename>\n\n"
"By default, the utility reads in the input file of particle IDs and positions,\n"
"computes the Voronoi cell for each, and then creates <filename.vol> with an\n"
"additional column containing the volume of each Voronoi cell.\n\n"
"Available options:\n"
" -c <str> : Specify a custom output string\n"
" -g : Turn on the gnuplot output to <filename.gnu>\n"
" -h/--help : Print this information\n"
" -hc : Print information about custom output\n"
" -l <len> : Manually specify a length scale to configure the internal\n"
" computational grid\n"
" -m <mem> : Manually choose the memory allocation per grid block\n"
" (default 8)\n"
" -n [3] : Manually specify the internal grid size\n"
" -o : Ensure that the output file has the same order as the input\n"
" file\n"
" -p : Make container periodic in all three directions\n"
" -px : Make container periodic in the x direction\n"
" -py : Make container periodic in the y direction\n"
" -pz : Make container periodic in the z direction\n"
" -r : Assume the input file has an extra coordinate for radii\n"
" -v : Verbose output\n"
" --version : Print version information\n"
" -wb [6] : Add six plane wall objects to make rectangular box containing\n"
" the space x1<x<x2, x3<y<x4, x5<z<x6\n"
" -wc [7] : Add a cylinder wall object, centered on (x1,x2,x3),\n"
" pointing in (x4,x5,x6), radius x7\n"
" -wo [7] : Add a conical wall object, apex at (x1,x2,x3), axis\n"
" along (x4,x5,x6), angle x7 in radians\n"
" -ws [4] : Add a sphere wall object, centered on (x1,x2,x3),\n"
" with radius x4\n"
" -wp [4] : Add a plane wall object, with normal (x1,x2,x3),\n"
" and displacement x4\n"
" -y : Save POV-Ray particles to <filename_p.pov> and POV-Ray Voronoi\n"
" cells to <filename_v.pov>\n"
" -yp : Save only POV-Ray particles to <filename_p.pov>\n"
" -yv : Save only POV-Ray Voronoi cells to <filename_v.pov>");
}
// This message gets displayed if the user requests information about doing
// custom output
void custom_output_message() {
puts("The \"-c\" option allows a string to be specified that will customize the output\n"
"file to contain a variety of statistics about each computed Voronoi cell. The\n"
"string is similar to the standard C printf() function, made up of text with\n"
"additional control sequences that begin with percentage signs that are expanded\n"
"to different statistics. See http://math.lbl.gov/voro++/doc/custom.html for more\n"
"information.\n"
"\nParticle-related:\n"
" %i The particle ID number\n"
" %x The x coordinate of the particle\n"
" %y The y coordinate of the particle\n"
" %z The z coordinate of the particle\n"
" %q The position vector of the particle, short for \"%x %y %z\"\n"
" %r The radius of the particle (only printed if -p enabled)\n"
"\nVertex-related:\n"
" %w The number of vertices in the Voronoi cell\n"
" %p A list of the vertices of the Voronoi cell in the format (x,y,z),\n"
" relative to the particle center\n"
" %P A list of the vertices of the Voronoi cell in the format (x,y,z),\n"
" relative to the global coordinate system\n"
" %o A list of the orders of each vertex\n"
" %m The maximum radius squared of a vertex position, relative to the\n"
" particle center\n"
"\nEdge-related:\n"
" %g The number of edges of the Voronoi cell\n"
" %E The total edge distance\n"
" %e A list of perimeters of each face\n"
"\nFace-related:\n"
" %s The number of faces of the Voronoi cell\n"
" %F The total surface area of the Voronoi cell\n"
" %A A frequency table of the number of edges for each face\n"
" %a A list of the number of edges for each face\n"
" %f A list of areas of each face\n"
" %t A list of bracketed sequences of vertices that make up each face\n"
" %l A list of normal vectors for each face\n"
" %n A list of neighboring particle or wall IDs corresponding to each face\n"
"\nVolume-related:\n"
" %v The volume of the Voronoi cell\n"
" %c The centroid of the Voronoi cell, relative to the particle center\n"
" %C The centroid of the Voronoi cell, in the global coordinate system");
}
// Ths message is displayed if the user requests version information
void version_message() {
puts("Voro++ version 0.4.5 (July 27th 2012)");
}
// Prints an error message. This is called when the program is unable to make
// sense of the command-line options.
void error_message() {
fputs("voro++: Unrecognized command-line options; type \"voro++ -h\" for more\ninformation.\n",stderr);
}
// Carries out the Voronoi computation and outputs the results to the requested
// files
template<class c_loop,class c_class>
void cmd_line_output(c_loop &vl,c_class &con,const char* format,FILE* outfile,FILE* gnu_file,FILE* povp_file,FILE* povv_file,bool verbose,double &vol,int &vcc,int &tp) {
int pid,ps=con.ps;double x,y,z,r;
if(con.contains_neighbor(format)) {
voronoicell_neighbor c;
if(vl.start()) do if(con.compute_cell(c,vl)) {
vl.pos(pid,x,y,z,r);
if(outfile!=NULL) c.output_custom(format,pid,x,y,z,r,outfile);
if(gnu_file!=NULL) c.draw_gnuplot(x,y,z,gnu_file);
if(povp_file!=NULL) {
fprintf(povp_file,"// id %d\n",pid);
if(ps==4) fprintf(povp_file,"sphere{<%g,%g,%g>,%g}\n",x,y,z,r);
else fprintf(povp_file,"sphere{<%g,%g,%g>,s}\n",x,y,z);
}
if(povv_file!=NULL) {
fprintf(povv_file,"// cell %d\n",pid);
c.draw_pov(x,y,z,povv_file);
}
if(verbose) {vol+=c.volume();vcc++;}
} while(vl.inc());
} else {
voronoicell c;
if(vl.start()) do if(con.compute_cell(c,vl)) {
vl.pos(pid,x,y,z,r);
if(outfile!=NULL) c.output_custom(format,pid,x,y,z,r,outfile);
if(gnu_file!=NULL) c.draw_gnuplot(x,y,z,gnu_file);
if(povp_file!=NULL) {
fprintf(povp_file,"// id %d\n",pid);
if(ps==4) fprintf(povp_file,"sphere{<%g,%g,%g>,%g}\n",x,y,z,r);
else fprintf(povp_file,"sphere{<%g,%g,%g>,s}\n",x,y,z);
}
if(povv_file!=NULL) {
fprintf(povv_file,"// cell %d\n",pid);
c.draw_pov(x,y,z,povv_file);
}
if(verbose) {vol+=c.volume();vcc++;}
} while(vl.inc());
}
if(verbose) tp=con.total_particles();
}
int main(int argc,char **argv) {
int i=1,j=-7,custom_output=0,nx,ny,nz,init_mem(8);
double ls=0;
blocks_mode bm=none;
bool gnuplot_output=false,povp_output=false,povv_output=false,polydisperse=false;
bool xperiodic=false,yperiodic=false,zperiodic=false,ordered=false,verbose=false;
pre_container *pcon=NULL;pre_container_poly *pconp=NULL;
wall_list wl;
// If there's one argument, check to see if it's requesting help.
// Otherwise, bail out with an error.
if(argc==2) {
if(strcmp(argv[1],"-h")==0||strcmp(argv[1],"--help")==0) {
help_message();return 0;
} else if(strcmp(argv[1],"-hc")==0) {
custom_output_message();return 0;
} else if(strcmp(argv[1],"--version")==0) {
version_message();return 0;
} else {
error_message();
return VOROPP_CMD_LINE_ERROR;
}
}
// If there aren't enough command-line arguments, then bail out
// with an error.
if(argc<7) {
error_message();
return VOROPP_CMD_LINE_ERROR;
}
// We have enough arguments. Now start searching for command-line
// options.
while(i<argc-7) {
if(strcmp(argv[i],"-c")==0) {
if(i>=argc-8) {error_message();wl.deallocate();return VOROPP_CMD_LINE_ERROR;}
if(custom_output==0) {
custom_output=++i;
} else {
fputs("voro++: multiple custom output strings detected\n",stderr);
wl.deallocate();
return VOROPP_CMD_LINE_ERROR;
}
} else if(strcmp(argv[i],"-g")==0) {
gnuplot_output=true;
} else if(strcmp(argv[i],"-h")==0||strcmp(argv[i],"--help")==0) {
help_message();wl.deallocate();return 0;
} else if(strcmp(argv[i],"-hc")==0) {
custom_output_message();wl.deallocate();return 0;
} else if(strcmp(argv[i],"-l")==0) {
if(i>=argc-8) {error_message();wl.deallocate();return VOROPP_CMD_LINE_ERROR;}
if(bm!=none) {
fputs("voro++: Conflicting options about grid setup (-l/-n)\n",stderr);
wl.deallocate();
return VOROPP_CMD_LINE_ERROR;
}
bm=length_scale;
i++;ls=atof(argv[i]);
} else if(strcmp(argv[i],"-m")==0) {
i++;init_mem=atoi(argv[i]);
} else if(strcmp(argv[i],"-n")==0) {
if(i>=argc-10) {error_message();wl.deallocate();return VOROPP_CMD_LINE_ERROR;}
if(bm!=none) {
fputs("voro++: Conflicting options about grid setup (-l/-n)\n",stderr);
wl.deallocate();
return VOROPP_CMD_LINE_ERROR;
}
bm=specified;
i++;
nx=atoi(argv[i++]);
ny=atoi(argv[i++]);
nz=atoi(argv[i]);
if(nx<=0||ny<=0||nz<=0) {
fputs("voro++: Computational grid specified with -n must be greater than one\n"
"in each direction\n",stderr);
wl.deallocate();
return VOROPP_CMD_LINE_ERROR;
}
} else if(strcmp(argv[i],"-o")==0) {
ordered=true;
} else if(strcmp(argv[i],"-p")==0) {
xperiodic=yperiodic=zperiodic=true;
} else if(strcmp(argv[i],"-px")==0) {
xperiodic=true;
} else if(strcmp(argv[i],"-py")==0) {
yperiodic=true;
} else if(strcmp(argv[i],"-pz")==0) {
zperiodic=true;
} else if(strcmp(argv[i],"-r")==0) {
polydisperse=true;
} else if(strcmp(argv[i],"-v")==0) {
verbose=true;
} else if(strcmp(argv[i],"--version")==0) {
version_message();
wl.deallocate();
return 0;
} else if(strcmp(argv[i],"-wb")==0) {
if(i>=argc-13) {error_message();wl.deallocate();return VOROPP_CMD_LINE_ERROR;}
i++;
double w0=atof(argv[i++]),w1=atof(argv[i++]);
double w2=atof(argv[i++]),w3=atof(argv[i++]);
double w4=atof(argv[i++]),w5=atof(argv[i]);
wl.add_wall(new wall_plane(-1,0,0,-w0,j));j--;
wl.add_wall(new wall_plane(1,0,0,w1,j));j--;
wl.add_wall(new wall_plane(0,-1,0,-w2,j));j--;
wl.add_wall(new wall_plane(0,1,0,w3,j));j--;
wl.add_wall(new wall_plane(0,0,-1,-w4,j));j--;
wl.add_wall(new wall_plane(0,0,1,w5,j));j--;
} else if(strcmp(argv[i],"-ws")==0) {
if(i>=argc-11) {error_message();wl.deallocate();return VOROPP_CMD_LINE_ERROR;}
i++;
double w0=atof(argv[i++]),w1=atof(argv[i++]);
double w2=atof(argv[i++]),w3=atof(argv[i]);
wl.add_wall(new wall_sphere(w0,w1,w2,w3,j));
j--;
} else if(strcmp(argv[i],"-wp")==0) {
if(i>=argc-11) {error_message();wl.deallocate();return VOROPP_CMD_LINE_ERROR;}
i++;
double w0=atof(argv[i++]),w1=atof(argv[i++]);
double w2=atof(argv[i++]),w3=atof(argv[i]);
wl.add_wall(new wall_plane(w0,w1,w2,w3,j));
j--;
} else if(strcmp(argv[i],"-wc")==0) {
if(i>=argc-14) {error_message();wl.deallocate();return VOROPP_CMD_LINE_ERROR;}
i++;
double w0=atof(argv[i++]),w1=atof(argv[i++]);
double w2=atof(argv[i++]),w3=atof(argv[i++]);
double w4=atof(argv[i++]),w5=atof(argv[i++]);
double w6=atof(argv[i]);
wl.add_wall(new wall_cylinder(w0,w1,w2,w3,w4,w5,w6,j));
j--;
} else if(strcmp(argv[i],"-wo")==0) {
if(i>=argc-14) {error_message();wl.deallocate();return VOROPP_CMD_LINE_ERROR;}
i++;
double w0=atof(argv[i++]),w1=atof(argv[i++]);
double w2=atof(argv[i++]),w3=atof(argv[i++]);
double w4=atof(argv[i++]),w5=atof(argv[i++]);
double w6=atof(argv[i]);
wl.add_wall(new wall_cone(w0,w1,w2,w3,w4,w5,w6,j));
j--;
} else if(strcmp(argv[i],"-y")==0) {
povp_output=povv_output=true;
} else if(strcmp(argv[i],"-yp")==0) {
povp_output=true;
} else if(strcmp(argv[i],"-yv")==0) {
povv_output=true;
} else {
wl.deallocate();
error_message();
return VOROPP_CMD_LINE_ERROR;
}
i++;
}
// Check the memory guess is positive
if(init_mem<=0) {
fputs("voro++: The memory allocation must be positive\n",stderr);
wl.deallocate();
return VOROPP_CMD_LINE_ERROR;
}
// Read in the dimensions of the test box, and estimate the number of
// boxes to divide the region up into
double ax=atof(argv[i]),bx=atof(argv[i+1]);
double ay=atof(argv[i+2]),by=atof(argv[i+3]);
double az=atof(argv[i+4]),bz=atof(argv[i+5]);
// Check that for each coordinate, the minimum value is smaller
// than the maximum value
if(bx<ax) {
fputs("voro++: Minimum x coordinate exceeds maximum x coordinate\n",stderr);
wl.deallocate();
return VOROPP_CMD_LINE_ERROR;
}
if(by<ay) {
fputs("voro++: Minimum y coordinate exceeds maximum y coordinate\n",stderr);
wl.deallocate();
return VOROPP_CMD_LINE_ERROR;
}
if(bz<az) {
fputs("voro++: Minimum z coordinate exceeds maximum z coordinate\n",stderr);
wl.deallocate();
return VOROPP_CMD_LINE_ERROR;
}
if(bm==none) {
if(polydisperse) {
pconp=new pre_container_poly(ax,bx,ay,by,az,bz,xperiodic,yperiodic,zperiodic);
pconp->import(argv[i+6]);
pconp->guess_optimal(nx,ny,nz);
} else {
pcon=new pre_container(ax,bx,ay,by,az,bz,xperiodic,yperiodic,zperiodic);
pcon->import(argv[i+6]);
pcon->guess_optimal(nx,ny,nz);
}
} else {
double nxf,nyf,nzf;
if(bm==length_scale) {
// Check that the length scale is positive and
// reasonably large
if(ls<tolerance) {
fputs("voro++: ",stderr);
if(ls<0) {
fputs("The length scale must be positive\n",stderr);
} else {
fprintf(stderr,"The length scale is smaller than the safe limit of %g. Either\nincrease the particle length scale, or recompile with a different limit.\n",tolerance);
}
wl.deallocate();
return VOROPP_CMD_LINE_ERROR;
}
ls=0.6/ls;
nxf=(bx-ax)*ls+1;
nyf=(by-ay)*ls+1;
nzf=(bz-az)*ls+1;
nx=int(nxf);ny=int(nyf);nz=int(nzf);
} else {
nxf=nx;nyf=ny;nzf=nz;
}
// Compute the number regions based on the length scale
// provided. If the total number exceeds a cutoff then bail
// out, to prevent making a massive memory allocation. Do this
// test using floating point numbers, since huge integers could
// potentially wrap around to negative values.
if(nxf*nyf*nzf>max_regions) {
fprintf(stderr,"voro++: Number of computational blocks exceeds the maximum allowed of %d.\n"
"Either increase the particle length scale, or recompile with an increased\nmaximum.",max_regions);
wl.deallocate();
return VOROPP_MEMORY_ERROR;
}
}
// Check that the output filename is a sensible length
int flen=strlen(argv[i+6]);
if(flen>4096) {
fputs("voro++: Filename too long\n",stderr);
wl.deallocate();
return VOROPP_CMD_LINE_ERROR;
}
// Open files for output
char *buffer=new char[flen+7];
sprintf(buffer,"%s.vol",argv[i+6]);
FILE *outfile=safe_fopen(buffer,"w"),*gnu_file,*povp_file,*povv_file;
if(gnuplot_output) {
sprintf(buffer,"%s.gnu",argv[i+6]);
gnu_file=safe_fopen(buffer,"w");
} else gnu_file=NULL;
if(povp_output) {
sprintf(buffer,"%s_p.pov",argv[i+6]);
povp_file=safe_fopen(buffer,"w");
} else povp_file=NULL;
if(povv_output) {
sprintf(buffer,"%s_v.pov",argv[i+6]);
povv_file=safe_fopen(buffer,"w");
} else povv_file=NULL;
delete [] buffer;
const char *c_str=(custom_output==0?(polydisperse?"%i %q %v %r":"%i %q %v"):argv[custom_output]);
// Now switch depending on whether polydispersity was enabled, and
// whether output ordering is requested
double vol=0;int tp=0,vcc=0;
if(polydisperse) {
if(ordered) {
particle_order vo;
container_poly con(ax,bx,ay,by,az,bz,nx,ny,nz,xperiodic,yperiodic,zperiodic,init_mem);
con.add_wall(wl);
if(bm==none) {
pconp->setup(vo,con);delete pconp;
} else con.import(vo,argv[i+6]);
c_loop_order vlo(con,vo);
cmd_line_output(vlo,con,c_str,outfile,gnu_file,povp_file,povv_file,verbose,vol,vcc,tp);
} else {
container_poly con(ax,bx,ay,by,az,bz,nx,ny,nz,xperiodic,yperiodic,zperiodic,init_mem);
con.add_wall(wl);
if(bm==none) {
pconp->setup(con);delete pconp;
} else con.import(argv[i+6]);
c_loop_all vla(con);
cmd_line_output(vla,con,c_str,outfile,gnu_file,povp_file,povv_file,verbose,vol,vcc,tp);
}
} else {
if(ordered) {
particle_order vo;
container con(ax,bx,ay,by,az,bz,nx,ny,nz,xperiodic,yperiodic,zperiodic,init_mem);
con.add_wall(wl);
if(bm==none) {
pcon->setup(vo,con);delete pcon;
} else con.import(vo,argv[i+6]);
c_loop_order vlo(con,vo);
cmd_line_output(vlo,con,c_str,outfile,gnu_file,povp_file,povv_file,verbose,vol,vcc,tp);
} else {
container con(ax,bx,ay,by,az,bz,nx,ny,nz,xperiodic,yperiodic,zperiodic,init_mem);
con.add_wall(wl);
if(bm==none) {
pcon->setup(con);delete pcon;
} else con.import(argv[i+6]);
c_loop_all vla(con);
cmd_line_output(vla,con,c_str,outfile,gnu_file,povp_file,povv_file,verbose,vol,vcc,tp);
}
}
// Print information if verbose output requested
if(verbose) {
printf("Container geometry : [%g:%g] [%g:%g] [%g:%g]\n"
"Computational grid size : %d by %d by %d (%s)\n"
"Filename : %s\n"
"Output string : %s%s\n",ax,bx,ay,by,az,bz,nx,ny,nz,
bm==none?"estimated from file":(bm==length_scale?
"estimated using length scale":"directly specified"),
argv[i+6],c_str,custom_output==0?" (default)":"");
printf("Total imported particles : %d (%.2g per grid block)\n"
"Total V. cells computed : %d\n"
"Total container volume : %g\n"
"Total V. cell volume : %g\n",tp,((double) tp)/(nx*ny*nz),
vcc,(bx-ax)*(by-ay)*(bz-az),vol);
}
// Close output files
fclose(outfile);
if(gnu_file!=NULL) fclose(gnu_file);
if(povp_file!=NULL) fclose(povp_file);
if(povv_file!=NULL) fclose(povv_file);
return 0;
}

90
extern/voro++/src/common.cc vendored Normal file
View File

@@ -0,0 +1,90 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file common.cc
* \brief Implementations of the small helper functions. */
#include "common.hh"
namespace voro {
/** \brief Prints a vector of integers.
*
* Prints a vector of integers.
* \param[in] v the vector to print.
* \param[in] fp the file stream to print to. */
void voro_print_vector(std::vector<int> &v,FILE *fp) {
int k=0,s=v.size();
while(k+4<s) {
fprintf(fp,"%d %d %d %d ",v[k],v[k+1],v[k+2],v[k+3]);
k+=4;
}
if(k+3<=s) {
if(k+4==s) fprintf(fp,"%d %d %d %d",v[k],v[k+1],v[k+2],v[k+3]);
else fprintf(fp,"%d %d %d",v[k],v[k+1],v[k+2]);
} else {
if(k+2==s) fprintf(fp,"%d %d",v[k],v[k+1]);
else fprintf(fp,"%d",v[k]);
}
}
/** \brief Prints a vector of doubles.
*
* Prints a vector of doubles.
* \param[in] v the vector to print.
* \param[in] fp the file stream to print to. */
void voro_print_vector(std::vector<double> &v,FILE *fp) {
int k=0,s=v.size();
while(k+4<s) {
fprintf(fp,"%g %g %g %g ",v[k],v[k+1],v[k+2],v[k+3]);
k+=4;
}
if(k+3<=s) {
if(k+4==s) fprintf(fp,"%g %g %g %g",v[k],v[k+1],v[k+2],v[k+3]);
else fprintf(fp,"%g %g %g",v[k],v[k+1],v[k+2]);
} else {
if(k+2==s) fprintf(fp,"%g %g",v[k],v[k+1]);
else fprintf(fp,"%g",v[k]);
}
}
/** \brief Prints a vector a face vertex information.
*
* Prints a vector of face vertex information. A value is read, which
* corresponds to the number of vertices in the next face. The routine reads
* this number of values and prints them as a bracked list. This is repeated
* until the end of the vector is reached.
* \param[in] v the vector to interpret and print.
* \param[in] fp the file stream to print to. */
void voro_print_face_vertices(std::vector<int> &v,FILE *fp) {
int j,k=0,l;
if(v.size()>0) {
l=v[k++];
if(l<=1) {
if(l==1) fprintf(fp,"(%d)",v[k++]);
else fputs("()",fp);
} else {
j=k+l;
fprintf(fp,"(%d",v[k++]);
while(k<j) fprintf(fp,",%d",v[k++]);
fputs(")",fp);
}
while((unsigned int) k<v.size()) {
l=v[k++];
if(l<=1) {
if(l==1) fprintf(fp," (%d)",v[k++]);
else fputs(" ()",fp);
} else {
j=k+l;
fprintf(fp," (%d",v[k++]);
while(k<j) fprintf(fp,",%d",v[k++]);
fputs(")",fp);
}
}
}
}
}

67
extern/voro++/src/common.hh vendored Normal file
View File

@@ -0,0 +1,67 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file common.hh
* \brief Header file for the small helper functions. */
#ifndef VOROPP_COMMON_HH
#define VOROPP_COMMON_HH
#include <cstdio>
#include <cstdlib>
#include <vector>
#include "config.hh"
namespace voro {
/** \brief Function for printing fatal error messages and exiting.
*
* Function for printing fatal error messages and exiting.
* \param[in] p a pointer to the message to print.
* \param[in] status the status code to return with. */
inline void voro_fatal_error(const char *p,int status) {
fprintf(stderr,"voro++: %s\n",p);
exit(status);
}
/** \brief Prints a vector of positions.
*
* Prints a vector of positions as bracketed triplets.
* \param[in] v the vector to print.
* \param[in] fp the file stream to print to. */
inline void voro_print_positions(std::vector<double> &v,FILE *fp=stdout) {
if(v.size()>0) {
fprintf(fp,"(%g,%g,%g)",v[0],v[1],v[2]);
for(int k=3;(unsigned int) k<v.size();k+=3) {
fprintf(fp," (%g,%g,%g)",v[k],v[k+1],v[k+2]);
}
}
}
/** \brief Opens a file and checks the operation was successful.
*
* Opens a file, and checks the return value to ensure that the operation
* was successful.
* \param[in] filename the file to open.
* \param[in] mode the cstdio fopen mode to use.
* \return The file handle. */
inline FILE* safe_fopen(const char *filename,const char *mode) {
FILE *fp=fopen(filename,mode);
if(fp==NULL) {
fprintf(stderr,"voro++: Unable to open file '%s'\n",filename);
exit(VOROPP_FILE_ERROR);
}
return fp;
}
void voro_print_vector(std::vector<int> &v,FILE *fp=stdout);
void voro_print_vector(std::vector<double> &v,FILE *fp=stdout);
void voro_print_face_vertices(std::vector<int> &v,FILE *fp=stdout);
}
#endif

127
extern/voro++/src/config.hh vendored Normal file
View File

@@ -0,0 +1,127 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file config.hh
* \brief Master configuration file for setting various compile-time options. */
#ifndef VOROPP_CONFIG_HH
#define VOROPP_CONFIG_HH
namespace voro {
// These constants set the initial memory allocation for the Voronoi cell
/** The initial memory allocation for the number of vertices. */
const int init_vertices=256;
/** The initial memory allocation for the maximum vertex order. */
const int init_vertex_order=64;
/** The initial memory allocation for the number of regular vertices of order
* 3. */
const int init_3_vertices=256;
/** The initial memory allocation for the number of vertices of higher order.
*/
const int init_n_vertices=8;
/** The initial buffer size for marginal cases used by the suretest class. */
const int init_marginal=64;
/** The initial size for the delete stack. */
const int init_delete_size=256;
/** The initial size for the auxiliary delete stack. */
const int init_delete2_size=256;
/** The initial size for the wall pointer array. */
const int init_wall_size=32;
/** The default initial size for the ordering class. */
const int init_ordering_size=4096;
/** The initial size of the pre_container chunk index. */
const int init_chunk_size=256;
// If the initial memory is too small, the program dynamically allocates more.
// However, if the limits below are reached, then the program bails out.
/** The maximum memory allocation for the number of vertices. */
const int max_vertices=16777216;
/** The maximum memory allocation for the maximum vertex order. */
const int max_vertex_order=2048;
/** The maximum memory allocation for the any particular order of vertex. */
const int max_n_vertices=16777216;
/** The maximum buffer size for marginal cases used by the suretest class. */
const int max_marginal=16777216;
/** The maximum size for the delete stack. */
const int max_delete_size=16777216;
/** The maximum size for the auxiliary delete stack. */
const int max_delete2_size=16777216;
/** The maximum amount of particle memory allocated for a single region. */
const int max_particle_memory=16777216;
/** The maximum size for the wall pointer array. */
const int max_wall_size=2048;
/** The maximum size for the ordering class. */
const int max_ordering_size=67108864;
/** The maximum size for the pre_container chunk index. */
const int max_chunk_size=65536;
/** The chunk size in the pre_container classes. */
const int pre_container_chunk_size=1024;
#ifndef VOROPP_VERBOSE
/** Voro++ can print a number of different status and debugging messages to
* notify the user of special behavior, and this macro sets the amount which
* are displayed. At level 0, no messages are printed. At level 1, messages
* about unusual cases during cell construction are printed, such as when the
* plane routine bails out due to floating point problems. At level 2, general
* messages about memory expansion are printed. At level 3, technical details
* about memory management are printed. */
#define VOROPP_VERBOSE 0
#endif
/** If a point is within this distance of a cutting plane, then the code
* assumes that point exactly lies on the plane. */
const double tolerance=1e-11;
/** If a point is within this distance of a cutting plane, then the code stores
* whether this point is inside, outside, or exactly on the cutting plane in
* the marginal cases buffer, to prevent the test giving a different result on
* a subsequent evaluation due to floating point rounding errors. */
const double tolerance2=2e-11;
/** The square of the tolerance, used when deciding whether some squared
* quantities are large enough to be used. */
const double tolerance_sq=tolerance*tolerance;
/** A large number that is used in the computation. */
const double large_number=1e30;
/** A radius to use as a placeholder when no other information is available. */
const double default_radius=0.5;
/** The maximum number of shells of periodic images to test over. */
const int max_unit_voro_shells=10;
/** A guess for the optimal number of particles per block, used to set up the
* container grid. */
const double optimal_particles=5.6;
/** If this is set to 1, then the code reports any instances of particles being
* put outside of the container geometry. */
#define VOROPP_REPORT_OUT_OF_BOUNDS 0
/** Voro++ returns this status code if there is a file-related error, such as
* not being able to open file. */
#define VOROPP_FILE_ERROR 1
/** Voro++ returns this status code if there is a memory allocation error, if
* one of the safe memory limits is exceeded. */
#define VOROPP_MEMORY_ERROR 2
/** Voro++ returns this status code if there is any type of internal error, if
* it detects that representation of the Voronoi cell is inconsistent. This
* status code will generally indicate a bug, and the developer should be
* contacted. */
#define VOROPP_INTERNAL_ERROR 3
/** Voro++ returns this status code if it could not interpret the command line
* arguments passed to the command line utility. */
#define VOROPP_CMD_LINE_ERROR 4
}
#endif

549
extern/voro++/src/container.cc vendored Normal file
View File

@@ -0,0 +1,549 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file container.cc
* \brief Function implementations for the container and related classes. */
#include "container.hh"
namespace voro {
/** The class constructor sets up the geometry of container, initializing the
* minimum and maximum coordinates in each direction, and setting whether each
* direction is periodic or not. It divides the container into a rectangular
* grid of blocks, and allocates memory for each of these for storing particle
* positions and IDs.
* \param[in] (ax_,bx_) the minimum and maximum x coordinates.
* \param[in] (ay_,by_) the minimum and maximum y coordinates.
* \param[in] (az_,bz_) the minimum and maximum z coordinates.
* \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three
* coordinate directions.
* \param[in] (xperiodic_,yperiodic_,zperiodic_) flags setting whether the
* container is periodic in each
* coordinate direction.
* \param[in] init_mem the initial memory allocation for each block.
* \param[in] ps_ the number of floating point entries to store for each
* particle. */
container_base::container_base(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
int nx_,int ny_,int nz_,bool xperiodic_,bool yperiodic_,bool zperiodic_,int init_mem,int ps_)
: voro_base(nx_,ny_,nz_,(bx_-ax_)/nx_,(by_-ay_)/ny_,(bz_-az_)/nz_),
ax(ax_), bx(bx_), ay(ay_), by(by_), az(az_), bz(bz_),
xperiodic(xperiodic_), yperiodic(yperiodic_), zperiodic(zperiodic_),
id(new int*[nxyz]), p(new double*[nxyz]), co(new int[nxyz]), mem(new int[nxyz]), ps(ps_) {
int l;
for(l=0;l<nxyz;l++) co[l]=0;
for(l=0;l<nxyz;l++) mem[l]=init_mem;
for(l=0;l<nxyz;l++) id[l]=new int[init_mem];
for(l=0;l<nxyz;l++) p[l]=new double[ps*init_mem];
}
/** The container destructor frees the dynamically allocated memory. */
container_base::~container_base() {
int l;
for(l=0;l<nxyz;l++) delete [] p[l];
for(l=0;l<nxyz;l++) delete [] id[l];
delete [] id;
delete [] p;
delete [] co;
delete [] mem;
}
/** The class constructor sets up the geometry of container.
* \param[in] (ax_,bx_) the minimum and maximum x coordinates.
* \param[in] (ay_,by_) the minimum and maximum y coordinates.
* \param[in] (az_,bz_) the minimum and maximum z coordinates.
* \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three
* coordinate directions.
* \param[in] (xperiodic_,yperiodic_,zperiodic_) flags setting whether the
* container is periodic in each
* coordinate direction.
* \param[in] init_mem the initial memory allocation for each block. */
container::container(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
int nx_,int ny_,int nz_,bool xperiodic_,bool yperiodic_,bool zperiodic_,int init_mem)
: container_base(ax_,bx_,ay_,by_,az_,bz_,nx_,ny_,nz_,xperiodic_,yperiodic_,zperiodic_,init_mem,3),
vc(*this,xperiodic_?2*nx_+1:nx_,yperiodic_?2*ny_+1:ny_,zperiodic_?2*nz_+1:nz_) {}
/** The class constructor sets up the geometry of container.
* \param[in] (ax_,bx_) the minimum and maximum x coordinates.
* \param[in] (ay_,by_) the minimum and maximum y coordinates.
* \param[in] (az_,bz_) the minimum and maximum z coordinates.
* \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three
* coordinate directions.
* \param[in] (xperiodic_,yperiodic_,zperiodic_) flags setting whether the
* container is periodic in each
* coordinate direction.
* \param[in] init_mem the initial memory allocation for each block. */
container_poly::container_poly(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
int nx_,int ny_,int nz_,bool xperiodic_,bool yperiodic_,bool zperiodic_,int init_mem)
: container_base(ax_,bx_,ay_,by_,az_,bz_,nx_,ny_,nz_,xperiodic_,yperiodic_,zperiodic_,init_mem,4),
vc(*this,xperiodic_?2*nx_+1:nx_,yperiodic_?2*ny_+1:ny_,zperiodic_?2*nz_+1:nz_) {ppr=p;}
/** Put a particle into the correct region of the container.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle. */
void container::put(int n,double x,double y,double z) {
int ijk;
if(put_locate_block(ijk,x,y,z)) {
id[ijk][co[ijk]]=n;
double *pp=p[ijk]+3*co[ijk]++;
*(pp++)=x;*(pp++)=y;*pp=z;
}
}
/** Put a particle into the correct region of the container.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle.
* \param[in] r the radius of the particle. */
void container_poly::put(int n,double x,double y,double z,double r) {
int ijk;
if(put_locate_block(ijk,x,y,z)) {
id[ijk][co[ijk]]=n;
double *pp=p[ijk]+4*co[ijk]++;
*(pp++)=x;*(pp++)=y;*(pp++)=z;*pp=r;
if(max_radius<r) max_radius=r;
}
}
/** Put a particle into the correct region of the container, also recording
* into which region it was stored.
* \param[in] vo the ordering class in which to record the region.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle. */
void container::put(particle_order &vo,int n,double x,double y,double z) {
int ijk;
if(put_locate_block(ijk,x,y,z)) {
id[ijk][co[ijk]]=n;
vo.add(ijk,co[ijk]);
double *pp=p[ijk]+3*co[ijk]++;
*(pp++)=x;*(pp++)=y;*pp=z;
}
}
/** Put a particle into the correct region of the container, also recording
* into which region it was stored.
* \param[in] vo the ordering class in which to record the region.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle.
* \param[in] r the radius of the particle. */
void container_poly::put(particle_order &vo,int n,double x,double y,double z,double r) {
int ijk;
if(put_locate_block(ijk,x,y,z)) {
id[ijk][co[ijk]]=n;
vo.add(ijk,co[ijk]);
double *pp=p[ijk]+4*co[ijk]++;
*(pp++)=x;*(pp++)=y;*(pp++)=z;*pp=r;
if(max_radius<r) max_radius=r;
}
}
/** This routine takes a particle position vector, tries to remap it into the
* primary domain. If successful, it computes the region into which it can be
* stored and checks that there is enough memory within this region to store
* it.
* \param[out] ijk the region index.
* \param[in,out] (x,y,z) the particle position, remapped into the primary
* domain if necessary.
* \return True if the particle can be successfully placed into the container,
* false otherwise. */
bool container_base::put_locate_block(int &ijk,double &x,double &y,double &z) {
if(put_remap(ijk,x,y,z)) {
if(co[ijk]==mem[ijk]) add_particle_memory(ijk);
return true;
}
#if VOROPP_REPORT_OUT_OF_BOUNDS ==1
fprintf(stderr,"Out of bounds: (x,y,z)=(%g,%g,%g)\n",x,y,z);
#endif
return false;
}
/** Takes a particle position vector and computes the region index into which
* it should be stored. If the container is periodic, then the routine also
* maps the particle position to ensure it is in the primary domain. If the
* container is not periodic, the routine bails out.
* \param[out] ijk the region index.
* \param[in,out] (x,y,z) the particle position, remapped into the primary
* domain if necessary.
* \return True if the particle can be successfully placed into the container,
* false otherwise. */
inline bool container_base::put_remap(int &ijk,double &x,double &y,double &z) {
int l;
ijk=step_int((x-ax)*xsp);
if(xperiodic) {l=step_mod(ijk,nx);x+=boxx*(l-ijk);ijk=l;}
else if(ijk<0||ijk>=nx) return false;
int j=step_int((y-ay)*ysp);
if(yperiodic) {l=step_mod(j,ny);y+=boxy*(l-j);j=l;}
else if(j<0||j>=ny) return false;
int k=step_int((z-az)*zsp);
if(zperiodic) {l=step_mod(k,nz);z+=boxz*(l-k);k=l;}
else if(k<0||k>=nz) return false;
ijk+=nx*j+nxy*k;
return true;
}
/** Takes a position vector and attempts to remap it into the primary domain.
* \param[out] (ai,aj,ak) the periodic image displacement that the vector is in,
* with (0,0,0) corresponding to the primary domain.
* \param[out] (ci,cj,ck) the index of the block that the position vector is
* within, once it has been remapped.
* \param[in,out] (x,y,z) the position vector to consider, which is remapped
* into the primary domain during the routine.
* \param[out] ijk the block index that the vector is within.
* \return True if the particle is within the container or can be remapped into
* it, false if it lies outside of the container bounds. */
inline bool container_base::remap(int &ai,int &aj,int &ak,int &ci,int &cj,int &ck,double &x,double &y,double &z,int &ijk) {
ci=step_int((x-ax)*xsp);
if(ci<0||ci>=nx) {
if(xperiodic) {ai=step_div(ci,nx);x-=ai*(bx-ax);ci-=ai*nx;}
else return false;
} else ai=0;
cj=step_int((y-ay)*ysp);
if(cj<0||cj>=ny) {
if(yperiodic) {aj=step_div(cj,ny);y-=aj*(by-ay);cj-=aj*ny;}
else return false;
} else aj=0;
ck=step_int((z-az)*zsp);
if(ck<0||ck>=nz) {
if(zperiodic) {ak=step_div(ck,nz);z-=ak*(bz-az);ck-=ak*nz;}
else return false;
} else ak=0;
ijk=ci+nx*cj+nxy*ck;
return true;
}
/** Takes a vector and finds the particle whose Voronoi cell contains that
* vector. This is equivalent to finding the particle which is nearest to the
* vector. Additional wall classes are not considered by this routine.
* \param[in] (x,y,z) the vector to test.
* \param[out] (rx,ry,rz) the position of the particle whose Voronoi cell
* contains the vector. If the container is periodic,
* this may point to a particle in a periodic image of
* the primary domain.
* \param[out] pid the ID of the particle.
* \return True if a particle was found. If the container has no particles,
* then the search will not find a Voronoi cell and false is returned. */
bool container::find_voronoi_cell(double x,double y,double z,double &rx,double &ry,double &rz,int &pid) {
int ai,aj,ak,ci,cj,ck,ijk;
particle_record w;
double mrs;
// If the given vector lies outside the domain, but the container
// is periodic, then remap it back into the domain
if(!remap(ai,aj,ak,ci,cj,ck,x,y,z,ijk)) return false;
vc.find_voronoi_cell(x,y,z,ci,cj,ck,ijk,w,mrs);
if(w.ijk!=-1) {
// Assemble the position vector of the particle to be returned,
// applying a periodic remapping if necessary
if(xperiodic) {ci+=w.di;if(ci<0||ci>=nx) ai+=step_div(ci,nx);}
if(yperiodic) {cj+=w.dj;if(cj<0||cj>=ny) aj+=step_div(cj,ny);}
if(zperiodic) {ck+=w.dk;if(ck<0||ck>=nz) ak+=step_div(ck,nz);}
rx=p[w.ijk][3*w.l]+ai*(bx-ax);
ry=p[w.ijk][3*w.l+1]+aj*(by-ay);
rz=p[w.ijk][3*w.l+2]+ak*(bz-az);
pid=id[w.ijk][w.l];
return true;
}
// If no particle if found then just return false
return false;
}
/** Takes a vector and finds the particle whose Voronoi cell contains that
* vector. Additional wall classes are not considered by this routine.
* \param[in] (x,y,z) the vector to test.
* \param[out] (rx,ry,rz) the position of the particle whose Voronoi cell
* contains the vector. If the container is periodic,
* this may point to a particle in a periodic image of
* the primary domain.
* \param[out] pid the ID of the particle.
* \return True if a particle was found. If the container has no particles,
* then the search will not find a Voronoi cell and false is returned. */
bool container_poly::find_voronoi_cell(double x,double y,double z,double &rx,double &ry,double &rz,int &pid) {
int ai,aj,ak,ci,cj,ck,ijk;
particle_record w;
double mrs;
// If the given vector lies outside the domain, but the container
// is periodic, then remap it back into the domain
if(!remap(ai,aj,ak,ci,cj,ck,x,y,z,ijk)) return false;
vc.find_voronoi_cell(x,y,z,ci,cj,ck,ijk,w,mrs);
if(w.ijk!=-1) {
// Assemble the position vector of the particle to be returned,
// applying a periodic remapping if necessary
if(xperiodic) {ci+=w.di;if(ci<0||ci>=nx) ai+=step_div(ci,nx);}
if(yperiodic) {cj+=w.dj;if(cj<0||cj>=ny) aj+=step_div(cj,ny);}
if(zperiodic) {ck+=w.dk;if(ck<0||ck>=nz) ak+=step_div(ck,nz);}
rx=p[w.ijk][4*w.l]+ai*(bx-ax);
ry=p[w.ijk][4*w.l+1]+aj*(by-ay);
rz=p[w.ijk][4*w.l+2]+ak*(bz-az);
pid=id[w.ijk][w.l];
return true;
}
// If no particle if found then just return false
return false;
}
/** Increase memory for a particular region.
* \param[in] i the index of the region to reallocate. */
void container_base::add_particle_memory(int i) {
int l,nmem=mem[i]<<1;
// Carry out a check on the memory allocation size, and
// print a status message if requested
if(nmem>max_particle_memory)
voro_fatal_error("Absolute maximum memory allocation exceeded",VOROPP_MEMORY_ERROR);
#if VOROPP_VERBOSE >=3
fprintf(stderr,"Particle memory in region %d scaled up to %d\n",i,nmem);
#endif
// Allocate new memory and copy in the contents of the old arrays
int *idp=new int[nmem];
for(l=0;l<co[i];l++) idp[l]=id[i][l];
double *pp=new double[ps*nmem];
for(l=0;l<ps*co[i];l++) pp[l]=p[i][l];
// Update pointers and delete old arrays
mem[i]=nmem;
delete [] id[i];id[i]=idp;
delete [] p[i];p[i]=pp;
}
/** Import a list of particles from an open file stream into the container.
* Entries of four numbers (Particle ID, x position, y position, z position)
* are searched for. If the file cannot be successfully read, then the routine
* causes a fatal error.
* \param[in] fp the file handle to read from. */
void container::import(FILE *fp) {
int i,j;
double x,y,z;
while((j=fscanf(fp,"%d %lg %lg %lg",&i,&x,&y,&z))==4) put(i,x,y,z);
if(j!=EOF) voro_fatal_error("File import error",VOROPP_FILE_ERROR);
}
/** Import a list of particles from an open file stream, also storing the order
* of that the particles are read. Entries of four numbers (Particle ID, x
* position, y position, z position) are searched for. If the file cannot be
* successfully read, then the routine causes a fatal error.
* \param[in,out] vo a reference to an ordering class to use.
* \param[in] fp the file handle to read from. */
void container::import(particle_order &vo,FILE *fp) {
int i,j;
double x,y,z;
while((j=fscanf(fp,"%d %lg %lg %lg",&i,&x,&y,&z))==4) put(vo,i,x,y,z);
if(j!=EOF) voro_fatal_error("File import error",VOROPP_FILE_ERROR);
}
/** Import a list of particles from an open file stream into the container.
* Entries of five numbers (Particle ID, x position, y position, z position,
* radius) are searched for. If the file cannot be successfully read, then the
* routine causes a fatal error.
* \param[in] fp the file handle to read from. */
void container_poly::import(FILE *fp) {
int i,j;
double x,y,z,r;
while((j=fscanf(fp,"%d %lg %lg %lg %lg",&i,&x,&y,&z,&r))==5) put(i,x,y,z,r);
if(j!=EOF) voro_fatal_error("File import error",VOROPP_FILE_ERROR);
}
/** Import a list of particles from an open file stream, also storing the order
* of that the particles are read. Entries of four numbers (Particle ID, x
* position, y position, z position, radius) are searched for. If the file
* cannot be successfully read, then the routine causes a fatal error.
* \param[in,out] vo a reference to an ordering class to use.
* \param[in] fp the file handle to read from. */
void container_poly::import(particle_order &vo,FILE *fp) {
int i,j;
double x,y,z,r;
while((j=fscanf(fp,"%d %lg %lg %lg %lg",&i,&x,&y,&z,&r))==5) put(vo,i,x,y,z,r);
if(j!=EOF) voro_fatal_error("File import error",VOROPP_FILE_ERROR);
}
/** Outputs the a list of all the container regions along with the number of
* particles stored within each. */
void container_base::region_count() {
int i,j,k,*cop=co;
for(k=0;k<nz;k++) for(j=0;j<ny;j++) for(i=0;i<nx;i++)
printf("Region (%d,%d,%d): %d particles\n",i,j,k,*(cop++));
}
/** Clears a container of particles. */
void container::clear() {
for(int *cop=co;cop<co+nxyz;cop++) *cop=0;
}
/** Clears a container of particles, also clearing resetting the maximum radius
* to zero. */
void container_poly::clear() {
for(int *cop=co;cop<co+nxyz;cop++) *cop=0;
max_radius=0;
}
/** Computes all the Voronoi cells and saves customized information about them.
* \param[in] format the custom output string to use.
* \param[in] fp a file handle to write to. */
void container::print_custom(const char *format,FILE *fp) {
c_loop_all vl(*this);
print_custom(vl,format,fp);
}
/** Computes all the Voronoi cells and saves customized
* information about them.
* \param[in] format the custom output string to use.
* \param[in] fp a file handle to write to. */
void container_poly::print_custom(const char *format,FILE *fp) {
c_loop_all vl(*this);
print_custom(vl,format,fp);
}
/** Computes all the Voronoi cells and saves customized information about them.
* \param[in] format the custom output string to use.
* \param[in] filename the name of the file to write to. */
void container::print_custom(const char *format,const char *filename) {
FILE *fp=safe_fopen(filename,"w");
print_custom(format,fp);
fclose(fp);
}
/** Computes all the Voronoi cells and saves customized
* information about them
* \param[in] format the custom output string to use.
* \param[in] filename the name of the file to write to. */
void container_poly::print_custom(const char *format,const char *filename) {
FILE *fp=safe_fopen(filename,"w");
print_custom(format,fp);
fclose(fp);
}
/** Computes all of the Voronoi cells in the container, but does nothing
* with the output. It is useful for measuring the pure computation time
* of the Voronoi algorithm, without any additional calculations such as
* volume evaluation or cell output. */
void container::compute_all_cells() {
voronoicell c;
c_loop_all vl(*this);
if(vl.start()) do compute_cell(c,vl);
while(vl.inc());
}
/** Computes all of the Voronoi cells in the container, but does nothing
* with the output. It is useful for measuring the pure computation time
* of the Voronoi algorithm, without any additional calculations such as
* volume evaluation or cell output. */
void container_poly::compute_all_cells() {
voronoicell c;
c_loop_all vl(*this);
if(vl.start()) do compute_cell(c,vl);while(vl.inc());
}
/** Calculates all of the Voronoi cells and sums their volumes. In most cases
* without walls, the sum of the Voronoi cell volumes should equal the volume
* of the container to numerical precision.
* \return The sum of all of the computed Voronoi volumes. */
double container::sum_cell_volumes() {
voronoicell c;
double vol=0;
c_loop_all vl(*this);
if(vl.start()) do if(compute_cell(c,vl)) vol+=c.volume();while(vl.inc());
return vol;
}
/** Calculates all of the Voronoi cells and sums their volumes. In most cases
* without walls, the sum of the Voronoi cell volumes should equal the volume
* of the container to numerical precision.
* \return The sum of all of the computed Voronoi volumes. */
double container_poly::sum_cell_volumes() {
voronoicell c;
double vol=0;
c_loop_all vl(*this);
if(vl.start()) do if(compute_cell(c,vl)) vol+=c.volume();while(vl.inc());
return vol;
}
/** This function tests to see if a given vector lies within the container
* bounds and any walls.
* \param[in] (x,y,z) the position vector to be tested.
* \return True if the point is inside the container, false if the point is
* outside. */
bool container_base::point_inside(double x,double y,double z) {
if(x<ax||x>bx||y<ay||y>by||z<az||z>bz) return false;
return point_inside_walls(x,y,z);
}
/** Draws an outline of the domain in gnuplot format.
* \param[in] fp the file handle to write to. */
void container_base::draw_domain_gnuplot(FILE *fp) {
fprintf(fp,"%g %g %g\n%g %g %g\n%g %g %g\n%g %g %g\n",ax,ay,az,bx,ay,az,bx,by,az,ax,by,az);
fprintf(fp,"%g %g %g\n%g %g %g\n%g %g %g\n%g %g %g\n",ax,by,bz,bx,by,bz,bx,ay,bz,ax,ay,bz);
fprintf(fp,"%g %g %g\n\n%g %g %g\n%g %g %g\n\n",ax,by,bz,ax,ay,az,ax,ay,bz);
fprintf(fp,"%g %g %g\n%g %g %g\n\n%g %g %g\n%g %g %g\n\n",bx,ay,az,bx,ay,bz,bx,by,az,bx,by,bz);
}
/** Draws an outline of the domain in POV-Ray format.
* \param[in] fp the file handle to write to. */
void container_base::draw_domain_pov(FILE *fp) {
fprintf(fp,"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n"
"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n",ax,ay,az,bx,ay,az,ax,by,az,bx,by,az);
fprintf(fp,"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n"
"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n",ax,by,bz,bx,by,bz,ax,ay,bz,bx,ay,bz);
fprintf(fp,"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n"
"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n",ax,ay,az,ax,by,az,bx,ay,az,bx,by,az);
fprintf(fp,"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n"
"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n",bx,ay,bz,bx,by,bz,ax,ay,bz,ax,by,bz);
fprintf(fp,"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n"
"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n",ax,ay,az,ax,ay,bz,bx,ay,az,bx,ay,bz);
fprintf(fp,"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n"
"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n",bx,by,az,bx,by,bz,ax,by,az,ax,by,bz);
fprintf(fp,"sphere{<%g,%g,%g>,rr}\nsphere{<%g,%g,%g>,rr}\n"
"sphere{<%g,%g,%g>,rr}\nsphere{<%g,%g,%g>,rr}\n",ax,ay,az,bx,ay,az,ax,by,az,bx,by,az);
fprintf(fp,"sphere{<%g,%g,%g>,rr}\nsphere{<%g,%g,%g>,rr}\n"
"sphere{<%g,%g,%g>,rr}\nsphere{<%g,%g,%g>,rr}\n",ax,ay,bz,bx,ay,bz,ax,by,bz,bx,by,bz);
}
/** The wall_list constructor sets up an array of pointers to wall classes. */
wall_list::wall_list() : walls(new wall*[init_wall_size]), wep(walls), wel(walls+init_wall_size),
current_wall_size(init_wall_size) {}
/** The wall_list destructor frees the array of pointers to the wall classes.
*/
wall_list::~wall_list() {
delete [] walls;
}
/** Adds all of the walls on another wall_list to this class.
* \param[in] wl a reference to the wall class. */
void wall_list::add_wall(wall_list &wl) {
for(wall **wp=wl.walls;wp<wl.wep;wp++) add_wall(*wp);
}
/** Deallocates all of the wall classes pointed to by the wall_list. */
void wall_list::deallocate() {
for(wall **wp=walls;wp<wep;wp++) delete *wp;
}
/** Increases the memory allocation for the walls array. */
void wall_list::increase_wall_memory() {
current_wall_size<<=1;
if(current_wall_size>max_wall_size)
voro_fatal_error("Wall memory allocation exceeded absolute maximum",VOROPP_MEMORY_ERROR);
wall **nwalls=new wall*[current_wall_size],**nwp=nwalls,**wp=walls;
while(wp<wep) *(nwp++)=*(wp++);
delete [] walls;
walls=nwalls;wel=walls+current_wall_size;wep=nwp;
}
}

729
extern/voro++/src/container.hh vendored Normal file
View File

@@ -0,0 +1,729 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file container.hh
* \brief Header file for the container_base and related classes. */
#ifndef VOROPP_CONTAINER_HH
#define VOROPP_CONTAINER_HH
#include <cstdio>
#include <vector>
#include "config.hh"
#include "common.hh"
#include "v_base.hh"
#include "cell.hh"
#include "c_loops.hh"
#include "v_compute.hh"
#include "rad_option.hh"
namespace voro {
/** \brief Pure virtual class from which wall objects are derived.
*
* This is a pure virtual class for a generic wall object. A wall object
* can be specified by deriving a new class from this and specifying the
* functions.*/
class wall {
public:
virtual ~wall() {}
/** A pure virtual function for testing whether a point is
* inside the wall object. */
virtual bool point_inside(double x,double y,double z) = 0;
/** A pure virtual function for cutting a cell without
* neighbor-tracking with a wall. */
virtual bool cut_cell(voronoicell &c,double x,double y,double z) = 0;
/** A pure virtual function for cutting a cell with
* neighbor-tracking enabled with a wall. */
virtual bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) = 0;
};
/** \brief A class for storing a list of pointers to walls.
*
* This class stores a list of pointers to wall classes. It contains several
* simple routines that make use of the wall classes (such as telling whether a
* given position is inside all of the walls or not). It can be used by itself,
* but also forms part of container_base, for associating walls with this
* class. */
class wall_list {
public:
/** An array holding pointers to wall objects. */
wall **walls;
/** A pointer to the next free position to add a wall pointer.
*/
wall **wep;
wall_list();
~wall_list();
/** Adds a wall to the list.
* \param[in] w the wall to add. */
inline void add_wall(wall *w) {
if(wep==wel) increase_wall_memory();
*(wep++)=w;
}
/** Adds a wall to the list.
* \param[in] w a reference to the wall to add. */
inline void add_wall(wall &w) {add_wall(&w);}
void add_wall(wall_list &wl);
/** Determines whether a given position is inside all of the
* walls on the list.
* \param[in] (x,y,z) the position to test.
* \return True if it is inside, false if it is outside. */
inline bool point_inside_walls(double x,double y,double z) {
for(wall **wp=walls;wp<wep;wp++) if(!((*wp)->point_inside(x,y,z))) return false;
return true;
}
/** Cuts a Voronoi cell by all of the walls currently on
* the list.
* \param[in] c a reference to the Voronoi cell class.
* \param[in] (x,y,z) the position of the cell.
* \return True if the cell still exists, false if the cell is
* deleted. */
template<class c_class>
bool apply_walls(c_class &c,double x,double y,double z) {
for(wall **wp=walls;wp<wep;wp++) if(!((*wp)->cut_cell(c,x,y,z))) return false;
return true;
}
void deallocate();
protected:
void increase_wall_memory();
/** A pointer to the limit of the walls array, used to
* determine when array is full. */
wall **wel;
/** The current amount of memory allocated for walls. */
int current_wall_size;
};
/** \brief Class for representing a particle system in a three-dimensional
* rectangular box.
*
* This class represents a system of particles in a three-dimensional
* rectangular box. Any combination of non-periodic and periodic coordinates
* can be used in the three coordinate directions. The class is not intended
* for direct use, but instead forms the base of the container and
* container_poly classes that add specialized routines for computing the
* regular and radical Voronoi tessellations respectively. It contains routines
* that are commonly between these two classes, such as those for drawing the
* domain, and placing particles within the internal data structure.
*
* The class is derived from the wall_list class, which encapsulates routines
* for associating walls with the container, and the voro_base class, which
* encapsulates routines about the underlying computational grid. */
class container_base : public voro_base, public wall_list {
public:
/** The minimum x coordinate of the container. */
const double ax;
/** The maximum x coordinate of the container. */
const double bx;
/** The minimum y coordinate of the container. */
const double ay;
/** The maximum y coordinate of the container. */
const double by;
/** The minimum z coordinate of the container. */
const double az;
/** The maximum z coordinate of the container. */
const double bz;
/** A boolean value that determines if the x coordinate in
* periodic or not. */
const bool xperiodic;
/** A boolean value that determines if the y coordinate in
* periodic or not. */
const bool yperiodic;
/** A boolean value that determines if the z coordinate in
* periodic or not. */
const bool zperiodic;
/** This array holds the numerical IDs of each particle in each
* computational box. */
int **id;
/** A two dimensional array holding particle positions. For the
* derived container_poly class, this also holds particle
* radii. */
double **p;
/** This array holds the number of particles within each
* computational box of the container. */
int *co;
/** This array holds the maximum amount of particle memory for
* each computational box of the container. If the number of
* particles in a particular box ever approaches this limit,
* more is allocated using the add_particle_memory() function.
*/
int *mem;
/** The amount of memory in the array structure for each
* particle. This is set to 3 when the basic class is
* initialized, so that the array holds (x,y,z) positions. If
* the container class is initialized as part of the derived
* class container_poly, then this is set to 4, to also hold
* the particle radii. */
const int ps;
container_base(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
int nx_,int ny_,int nz_,bool xperiodic_,bool yperiodic_,bool zperiodic_,
int init_mem,int ps_);
~container_base();
bool point_inside(double x,double y,double z);
void region_count();
/** Initializes the Voronoi cell prior to a compute_cell
* operation for a specific particle being carried out by a
* voro_compute class. The cell is initialized to fill the
* entire container. For non-periodic coordinates, this is set
* by the position of the walls. For periodic coordinates, the
* space is equally divided in either direction from the
* particle's initial position. Plane cuts made by any walls
* that have been added are then applied to the cell.
* \param[in,out] c a reference to a voronoicell object.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within its block.
* \param[in] (ci,cj,ck) the coordinates of the block in the
* container coordinate system.
* \param[out] (i,j,k) the coordinates of the test block
* relative to the voro_compute
* coordinate system.
* \param[out] (x,y,z) the position of the particle.
* \param[out] disp a block displacement used internally by the
* compute_cell routine.
* \return False if the plane cuts applied by walls completely
* removed the cell, true otherwise. */
template<class v_cell>
inline bool initialize_voronoicell(v_cell &c,int ijk,int q,int ci,int cj,int ck,
int &i,int &j,int &k,double &x,double &y,double &z,int &disp) {
double x1,x2,y1,y2,z1,z2,*pp=p[ijk]+ps*q;
x=*(pp++);y=*(pp++);z=*pp;
if(xperiodic) {x1=-(x2=0.5*(bx-ax));i=nx;} else {x1=ax-x;x2=bx-x;i=ci;}
if(yperiodic) {y1=-(y2=0.5*(by-ay));j=ny;} else {y1=ay-y;y2=by-y;j=cj;}
if(zperiodic) {z1=-(z2=0.5*(bz-az));k=nz;} else {z1=az-z;z2=bz-z;k=ck;}
c.init(x1,x2,y1,y2,z1,z2);
if(!apply_walls(c,x,y,z)) return false;
disp=ijk-i-nx*(j+ny*k);
return true;
}
/** Initializes parameters for a find_voronoi_cell call within
* the voro_compute template.
* \param[in] (ci,cj,ck) the coordinates of the test block in
* the container coordinate system.
* \param[in] ijk the index of the test block
* \param[out] (i,j,k) the coordinates of the test block
* relative to the voro_compute
* coordinate system.
* \param[out] disp a block displacement used internally by the
* find_voronoi_cell routine. */
inline void initialize_search(int ci,int cj,int ck,int ijk,int &i,int &j,int &k,int &disp) {
i=xperiodic?nx:ci;
j=yperiodic?ny:cj;
k=zperiodic?nz:ck;
disp=ijk-i-nx*(j+ny*k);
}
/** Returns the position of a particle currently being computed
* relative to the computational block that it is within. It is
* used to select the optimal worklist entry to use.
* \param[in] (x,y,z) the position of the particle.
* \param[in] (ci,cj,ck) the block that the particle is within.
* \param[out] (fx,fy,fz) the position relative to the block.
*/
inline void frac_pos(double x,double y,double z,double ci,double cj,double ck,
double &fx,double &fy,double &fz) {
fx=x-ax-boxx*ci;
fy=y-ay-boxy*cj;
fz=z-az-boxz*ck;
}
/** Calculates the index of block in the container structure
* corresponding to given coordinates.
* \param[in] (ci,cj,ck) the coordinates of the original block
* in the current computation, relative
* to the container coordinate system.
* \param[in] (ei,ej,ek) the displacement of the current block
* from the original block.
* \param[in,out] (qx,qy,qz) the periodic displacement that
* must be added to the particles
* within the computed block.
* \param[in] disp a block displacement used internally by the
* find_voronoi_cell and compute_cell routines.
* \return The block index. */
inline int region_index(int ci,int cj,int ck,int ei,int ej,int ek,double &qx,double &qy,double &qz,int &disp) {
if(xperiodic) {if(ci+ei<nx) {ei+=nx;qx=-(bx-ax);} else if(ci+ei>=(nx<<1)) {ei-=nx;qx=bx-ax;} else qx=0;}
if(yperiodic) {if(cj+ej<ny) {ej+=ny;qy=-(by-ay);} else if(cj+ej>=(ny<<1)) {ej-=ny;qy=by-ay;} else qy=0;}
if(zperiodic) {if(ck+ek<nz) {ek+=nz;qz=-(bz-az);} else if(ck+ek>=(nz<<1)) {ek-=nz;qz=bz-az;} else qz=0;}
return disp+ei+nx*(ej+ny*ek);
}
void draw_domain_gnuplot(FILE *fp=stdout);
/** Draws an outline of the domain in Gnuplot format.
* \param[in] filename the filename to write to. */
inline void draw_domain_gnuplot(const char* filename) {
FILE *fp=safe_fopen(filename,"w");
draw_domain_gnuplot(fp);
fclose(fp);
}
void draw_domain_pov(FILE *fp=stdout);
/** Draws an outline of the domain in Gnuplot format.
* \param[in] filename the filename to write to. */
inline void draw_domain_pov(const char* filename) {
FILE *fp=safe_fopen(filename,"w");
draw_domain_pov(fp);
fclose(fp);
}
/** Sums up the total number of stored particles.
* \return The number of particles. */
inline int total_particles() {
int tp=*co;
for(int *cop=co+1;cop<co+nxyz;cop++) tp+=*cop;
return tp;
}
protected:
void add_particle_memory(int i);
bool put_locate_block(int &ijk,double &x,double &y,double &z);
inline bool put_remap(int &ijk,double &x,double &y,double &z);
inline bool remap(int &ai,int &aj,int &ak,int &ci,int &cj,int &ck,double &x,double &y,double &z,int &ijk);
};
/** \brief Extension of the container_base class for computing regular Voronoi
* tessellations.
*
* This class is an extension of the container_base class that has routines
* specifically for computing the regular Voronoi tessellation with no
* dependence on particle radii. */
class container : public container_base, public radius_mono {
public:
container(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
int nx_,int ny_,int nz_,bool xperiodic_,bool yperiodic_,bool zperiodic_,int init_mem);
void clear();
void put(int n,double x,double y,double z);
void put(particle_order &vo,int n,double x,double y,double z);
void import(FILE *fp=stdin);
void import(particle_order &vo,FILE *fp=stdin);
/** Imports a list of particles from an open file stream into
* the container. Entries of four numbers (Particle ID, x
* position, y position, z position) are searched for. If the
* file cannot be successfully read, then the routine causes a
* fatal error.
* \param[in] filename the name of the file to open and read
* from. */
inline void import(const char* filename) {
FILE *fp=safe_fopen(filename,"r");
import(fp);
fclose(fp);
}
/** Imports a list of particles from an open file stream into
* the container. Entries of four numbers (Particle ID, x
* position, y position, z position) are searched for. In
* addition, the order in which particles are read is saved
* into an ordering class. If the file cannot be successfully
* read, then the routine causes a fatal error.
* \param[in,out] vo the ordering class to use.
* \param[in] filename the name of the file to open and read
* from. */
inline void import(particle_order &vo,const char* filename) {
FILE *fp=safe_fopen(filename,"r");
import(vo,fp);
fclose(fp);
}
void compute_all_cells();
double sum_cell_volumes();
/** Dumps particle IDs and positions to a file.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_particles(c_loop &vl,FILE *fp) {
double *pp;
if(vl.start()) do {
pp=p[vl.ijk]+3*vl.q;
fprintf(fp,"%d %g %g %g\n",id[vl.ijk][vl.q],*pp,pp[1],pp[2]);
} while(vl.inc());
}
/** Dumps all of the particle IDs and positions to a file.
* \param[in] fp a file handle to write to. */
inline void draw_particles(FILE *fp=stdout) {
c_loop_all vl(*this);
draw_particles(vl,fp);
}
/** Dumps all of the particle IDs and positions to a file.
* \param[in] filename the name of the file to write to. */
inline void draw_particles(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_particles(fp);
fclose(fp);
}
/** Dumps particle positions in POV-Ray format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_particles_pov(c_loop &vl,FILE *fp) {
double *pp;
if(vl.start()) do {
pp=p[vl.ijk]+3*vl.q;
fprintf(fp,"// id %d\nsphere{<%g,%g,%g>,s}\n",
id[vl.ijk][vl.q],*pp,pp[1],pp[2]);
} while(vl.inc());
}
/** Dumps all particle positions in POV-Ray format.
* \param[in] fp a file handle to write to. */
inline void draw_particles_pov(FILE *fp=stdout) {
c_loop_all vl(*this);
draw_particles_pov(vl,fp);
}
/** Dumps all particle positions in POV-Ray format.
* \param[in] filename the name of the file to write to. */
inline void draw_particles_pov(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_particles_pov(fp);
fclose(fp);
}
/** Computes Voronoi cells and saves the output in gnuplot
* format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_cells_gnuplot(c_loop &vl,FILE *fp) {
voronoicell c;double *pp;
if(vl.start()) do if(compute_cell(c,vl)) {
pp=p[vl.ijk]+ps*vl.q;
c.draw_gnuplot(*pp,pp[1],pp[2],fp);
} while(vl.inc());
}
/** Computes all Voronoi cells and saves the output in gnuplot
* format.
* \param[in] fp a file handle to write to. */
inline void draw_cells_gnuplot(FILE *fp=stdout) {
c_loop_all vl(*this);
draw_cells_gnuplot(vl,fp);
}
/** Computes all Voronoi cells and saves the output in gnuplot
* format.
* \param[in] filename the name of the file to write to. */
inline void draw_cells_gnuplot(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_cells_gnuplot(fp);
fclose(fp);
}
/** Computes Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_cells_pov(c_loop &vl,FILE *fp) {
voronoicell c;double *pp;
if(vl.start()) do if(compute_cell(c,vl)) {
fprintf(fp,"// cell %d\n",id[vl.ijk][vl.q]);
pp=p[vl.ijk]+ps*vl.q;
c.draw_pov(*pp,pp[1],pp[2],fp);
} while(vl.inc());
}
/** Computes all Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] fp a file handle to write to. */
inline void draw_cells_pov(FILE *fp=stdout) {
c_loop_all vl(*this);
draw_cells_pov(vl,fp);
}
/** Computes all Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] filename the name of the file to write to. */
inline void draw_cells_pov(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_cells_pov(fp);
fclose(fp);
}
/** Computes the Voronoi cells and saves customized information
* about them.
* \param[in] vl the loop class to use.
* \param[in] format the custom output string to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void print_custom(c_loop &vl,const char *format,FILE *fp) {
int ijk,q;double *pp;
if(contains_neighbor(format)) {
voronoicell_neighbor c;
if(vl.start()) do if(compute_cell(c,vl)) {
ijk=vl.ijk;q=vl.q;pp=p[ijk]+ps*q;
c.output_custom(format,id[ijk][q],*pp,pp[1],pp[2],default_radius,fp);
} while(vl.inc());
} else {
voronoicell c;
if(vl.start()) do if(compute_cell(c,vl)) {
ijk=vl.ijk;q=vl.q;pp=p[ijk]+ps*q;
c.output_custom(format,id[ijk][q],*pp,pp[1],pp[2],default_radius,fp);
} while(vl.inc());
}
}
void print_custom(const char *format,FILE *fp=stdout);
void print_custom(const char *format,const char *filename);
bool find_voronoi_cell(double x,double y,double z,double &rx,double &ry,double &rz,int &pid);
/** Computes the Voronoi cell for a particle currently being
* referenced by a loop class.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] vl the loop class to use.
* \return True if the cell was computed. If the cell cannot be
* computed, if it is removed entirely by a wall or boundary
* condition, then the routine returns false. */
template<class v_cell,class c_loop>
inline bool compute_cell(v_cell &c,c_loop &vl) {
return vc.compute_cell(c,vl.ijk,vl.q,vl.i,vl.j,vl.k);
}
/** Computes the Voronoi cell for given particle.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within the block.
* \return True if the cell was computed. If the cell cannot be
* computed, if it is removed entirely by a wall or boundary
* condition, then the routine returns false. */
template<class v_cell>
inline bool compute_cell(v_cell &c,int ijk,int q) {
int k=ijk/nxy,ijkt=ijk-nxy*k,j=ijkt/nx,i=ijkt-j*nx;
return vc.compute_cell(c,ijk,q,i,j,k);
}
/** Computes the Voronoi cell for a ghost particle at a given
* location.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] (x,y,z) the location of the ghost particle.
* \return True if the cell was computed. If the cell cannot be
* computed, if it is removed entirely by a wall or boundary
* condition, then the routine returns false. */
template<class v_cell>
inline bool compute_ghost_cell(v_cell &c,double x,double y,double z) {
int ijk;
if(put_locate_block(ijk,x,y,z)) {
double *pp=p[ijk]+3*co[ijk]++;
*(pp++)=x;*(pp++)=y;*pp=z;
bool q=compute_cell(c,ijk,co[ijk]-1);
co[ijk]--;
return q;
}
return false;
}
private:
voro_compute<container> vc;
friend class voro_compute<container>;
};
/** \brief Extension of the container_base class for computing radical Voronoi
* tessellations.
*
* This class is an extension of container_base class that has routines
* specifically for computing the radical Voronoi tessellation that depends on
* the particle radii. */
class container_poly : public container_base, public radius_poly {
public:
container_poly(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
int nx_,int ny_,int nz_,bool xperiodic_,bool yperiodic_,bool zperiodic_,int init_mem);
void clear();
void put(int n,double x,double y,double z,double r);
void put(particle_order &vo,int n,double x,double y,double z,double r);
void import(FILE *fp=stdin);
void import(particle_order &vo,FILE *fp=stdin);
/** Imports a list of particles from an open file stream into
* the container_poly class. Entries of five numbers (Particle
* ID, x position, y position, z position, radius) are searched
* for. If the file cannot be successfully read, then the
* routine causes a fatal error.
* \param[in] filename the name of the file to open and read
* from. */
inline void import(const char* filename) {
FILE *fp=safe_fopen(filename,"r");
import(fp);
fclose(fp);
}
/** Imports a list of particles from an open file stream into
* the container_poly class. Entries of five numbers (Particle
* ID, x position, y position, z position, radius) are searched
* for. In addition, the order in which particles are read is
* saved into an ordering class. If the file cannot be
* successfully read, then the routine causes a fatal error.
* \param[in,out] vo the ordering class to use.
* \param[in] filename the name of the file to open and read
* from. */
inline void import(particle_order &vo,const char* filename) {
FILE *fp=safe_fopen(filename,"r");
import(vo,fp);
fclose(fp);
}
void compute_all_cells();
double sum_cell_volumes();
/** Dumps particle IDs, positions and radii to a file.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_particles(c_loop &vl,FILE *fp) {
double *pp;
if(vl.start()) do {
pp=p[vl.ijk]+4*vl.q;
fprintf(fp,"%d %g %g %g %g\n",id[vl.ijk][vl.q],*pp,pp[1],pp[2],pp[3]);
} while(vl.inc());
}
/** Dumps all of the particle IDs, positions and radii to a
* file.
* \param[in] fp a file handle to write to. */
inline void draw_particles(FILE *fp=stdout) {
c_loop_all vl(*this);
draw_particles(vl,fp);
}
/** Dumps all of the particle IDs, positions and radii to a
* file.
* \param[in] filename the name of the file to write to. */
inline void draw_particles(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_particles(fp);
fclose(fp);
}
/** Dumps particle positions in POV-Ray format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_particles_pov(c_loop &vl,FILE *fp) {
double *pp;
if(vl.start()) do {
pp=p[vl.ijk]+4*vl.q;
fprintf(fp,"// id %d\nsphere{<%g,%g,%g>,%g}\n",
id[vl.ijk][vl.q],*pp,pp[1],pp[2],pp[3]);
} while(vl.inc());
}
/** Dumps all the particle positions in POV-Ray format.
* \param[in] fp a file handle to write to. */
inline void draw_particles_pov(FILE *fp=stdout) {
c_loop_all vl(*this);
draw_particles_pov(vl,fp);
}
/** Dumps all the particle positions in POV-Ray format.
* \param[in] filename the name of the file to write to. */
inline void draw_particles_pov(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_particles_pov(fp);
fclose(fp);
}
/** Computes Voronoi cells and saves the output in gnuplot
* format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_cells_gnuplot(c_loop &vl,FILE *fp) {
voronoicell c;double *pp;
if(vl.start()) do if(compute_cell(c,vl)) {
pp=p[vl.ijk]+ps*vl.q;
c.draw_gnuplot(*pp,pp[1],pp[2],fp);
} while(vl.inc());
}
/** Compute all Voronoi cells and saves the output in gnuplot
* format.
* \param[in] fp a file handle to write to. */
inline void draw_cells_gnuplot(FILE *fp=stdout) {
c_loop_all vl(*this);
draw_cells_gnuplot(vl,fp);
}
/** Compute all Voronoi cells and saves the output in gnuplot
* format.
* \param[in] filename the name of the file to write to. */
inline void draw_cells_gnuplot(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_cells_gnuplot(fp);
fclose(fp);
}
/** Computes Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_cells_pov(c_loop &vl,FILE *fp) {
voronoicell c;double *pp;
if(vl.start()) do if(compute_cell(c,vl)) {
fprintf(fp,"// cell %d\n",id[vl.ijk][vl.q]);
pp=p[vl.ijk]+ps*vl.q;
c.draw_pov(*pp,pp[1],pp[2],fp);
} while(vl.inc());
}
/** Computes all Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] fp a file handle to write to. */
inline void draw_cells_pov(FILE *fp=stdout) {
c_loop_all vl(*this);
draw_cells_pov(vl,fp);
}
/** Computes all Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] filename the name of the file to write to. */
inline void draw_cells_pov(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_cells_pov(fp);
fclose(fp);
}
/** Computes the Voronoi cells and saves customized information
* about them.
* \param[in] vl the loop class to use.
* \param[in] format the custom output string to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void print_custom(c_loop &vl,const char *format,FILE *fp) {
int ijk,q;double *pp;
if(contains_neighbor(format)) {
voronoicell_neighbor c;
if(vl.start()) do if(compute_cell(c,vl)) {
ijk=vl.ijk;q=vl.q;pp=p[ijk]+ps*q;
c.output_custom(format,id[ijk][q],*pp,pp[1],pp[2],pp[3],fp);
} while(vl.inc());
} else {
voronoicell c;
if(vl.start()) do if(compute_cell(c,vl)) {
ijk=vl.ijk;q=vl.q;pp=p[ijk]+ps*q;
c.output_custom(format,id[ijk][q],*pp,pp[1],pp[2],pp[3],fp);
} while(vl.inc());
}
}
/** Computes the Voronoi cell for a particle currently being
* referenced by a loop class.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] vl the loop class to use.
* \return True if the cell was computed. If the cell cannot be
* computed, if it is removed entirely by a wall or boundary
* condition, then the routine returns false. */
template<class v_cell,class c_loop>
inline bool compute_cell(v_cell &c,c_loop &vl) {
return vc.compute_cell(c,vl.ijk,vl.q,vl.i,vl.j,vl.k);
}
/** Computes the Voronoi cell for given particle.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within the block.
* \return True if the cell was computed. If the cell cannot be
* computed, if it is removed entirely by a wall or boundary
* condition, then the routine returns false. */
template<class v_cell>
inline bool compute_cell(v_cell &c,int ijk,int q) {
int k=ijk/nxy,ijkt=ijk-nxy*k,j=ijkt/nx,i=ijkt-j*nx;
return vc.compute_cell(c,ijk,q,i,j,k);
}
/** Computes the Voronoi cell for a ghost particle at a given
* location.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] (x,y,z) the location of the ghost particle.
* \param[in] r the radius of the ghost particle.
* \return True if the cell was computed. If the cell cannot be
* computed, if it is removed entirely by a wall or boundary
* condition, then the routine returns false. */
template<class v_cell>
inline bool compute_ghost_cell(v_cell &c,double x,double y,double z,double r) {
int ijk;
if(put_locate_block(ijk,x,y,z)) {
double *pp=p[ijk]+4*co[ijk]++,tm=max_radius;
*(pp++)=x;*(pp++)=y;*(pp++)=z;*pp=r;
if(r>max_radius) max_radius=r;
bool q=compute_cell(c,ijk,co[ijk]-1);
co[ijk]--;max_radius=tm;
return q;
}
return false;
}
void print_custom(const char *format,FILE *fp=stdout);
void print_custom(const char *format,const char *filename);
bool find_voronoi_cell(double x,double y,double z,double &rx,double &ry,double &rz,int &pid);
private:
voro_compute<container_poly> vc;
friend class voro_compute<container_poly>;
};
}
#endif

768
extern/voro++/src/container_prd.cc vendored Normal file
View File

@@ -0,0 +1,768 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file container_prd.cc
* \brief Function implementations for the container_periodic_base and
* related classes. */
#include "container_prd.hh"
namespace voro {
/** The class constructor sets up the geometry of container, initializing the
* minimum and maximum coordinates in each direction, and setting whether each
* direction is periodic or not. It divides the container into a rectangular
* grid of blocks, and allocates memory for each of these for storing particle
* positions and IDs.
* \param[in] (bx_) The x coordinate of the first unit vector.
* \param[in] (bxy_,by_) The x and y coordinates of the second unit vector.
* \param[in] (bxz_,byz_,bz_) The x, y, and z coordinates of the third unit
* vector.
* \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three
* coordinate directions.
* \param[in] init_mem_ the initial memory allocation for each block.
* \param[in] ps_ the number of floating point entries to store for each
* particle. */
container_periodic_base::container_periodic_base(double bx_,double bxy_,double by_,
double bxz_,double byz_,double bz_,int nx_,int ny_,int nz_,int init_mem_,int ps_)
: unitcell(bx_,bxy_,by_,bxz_,byz_,bz_), voro_base(nx_,ny_,nz_,bx_/nx_,by_/ny_,bz_/nz_),
ey(int(max_uv_y*ysp+1)), ez(int(max_uv_z*zsp+1)), wy(ny+ey), wz(nz+ez),
oy(ny+2*ey), oz(nz+2*ez), oxyz(nx*oy*oz), id(new int*[oxyz]), p(new double*[oxyz]),
co(new int[oxyz]), mem(new int[oxyz]), img(new char[oxyz]), init_mem(init_mem_), ps(ps_) {
int i,j,k,l;
// Clear the global arrays
int *pp=co;while(pp<co+oxyz) *(pp++)=0;
pp=mem;while(pp<mem+oxyz) *(pp++)=0;
char *cp=img;while(cp<img+oxyz) *(cp++)=0;
// Set up memory for the blocks in the primary domain
for(k=ez;k<wz;k++) for(j=ey;j<wy;j++) for(i=0;i<nx;i++) {
l=i+nx*(j+oy*k);
mem[l]=init_mem;
id[l]=new int[init_mem];
p[l]=new double[ps*init_mem];
}
}
/** The container destructor frees the dynamically allocated memory. */
container_periodic_base::~container_periodic_base() {
for(int l=oxyz-1;l>=0;l--) if(mem[l]>0) {
delete [] p[l];
delete [] id[l];
}
delete [] img;
delete [] mem;
delete [] co;
delete [] id;
delete [] p;
}
/** The class constructor sets up the geometry of container.
* \param[in] (bx_) The x coordinate of the first unit vector.
* \param[in] (bxy_,by_) The x and y coordinates of the second unit vector.
* \param[in] (bxz_,byz_,bz_) The x, y, and z coordinates of the third unit
* vector.
* \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three
* coordinate directions.
* \param[in] init_mem_ the initial memory allocation for each block. */
container_periodic::container_periodic(double bx_,double bxy_,double by_,double bxz_,double byz_,double bz_,
int nx_,int ny_,int nz_,int init_mem_)
: container_periodic_base(bx_,bxy_,by_,bxz_,byz_,bz_,nx_,ny_,nz_,init_mem_,3),
vc(*this,2*nx_+1,2*ey+1,2*ez+1) {}
/** The class constructor sets up the geometry of container.
* \param[in] (bx_) The x coordinate of the first unit vector.
* \param[in] (bxy_,by_) The x and y coordinates of the second unit vector.
* \param[in] (bxz_,byz_,bz_) The x, y, and z coordinates of the third unit
* vector.
* \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three
* coordinate directions.
* \param[in] init_mem_ the initial memory allocation for each block. */
container_periodic_poly::container_periodic_poly(double bx_,double bxy_,double by_,double bxz_,double byz_,double bz_,
int nx_,int ny_,int nz_,int init_mem_)
: container_periodic_base(bx_,bxy_,by_,bxz_,byz_,bz_,nx_,ny_,nz_,init_mem_,4),
vc(*this,2*nx_+1,2*ey+1,2*ez+1) {ppr=p;}
/** Put a particle into the correct region of the container.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle. */
void container_periodic::put(int n,double x,double y,double z) {
int ijk;
put_locate_block(ijk,x,y,z);
id[ijk][co[ijk]]=n;
double *pp=p[ijk]+3*co[ijk]++;
*(pp++)=x;*(pp++)=y;*pp=z;
}
/** Put a particle into the correct region of the container.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle.
* \param[in] r the radius of the particle. */
void container_periodic_poly::put(int n,double x,double y,double z,double r) {
int ijk;
put_locate_block(ijk,x,y,z);
id[ijk][co[ijk]]=n;
double *pp=p[ijk]+4*co[ijk]++;
*(pp++)=x;*(pp++)=y;*(pp++)=z;*pp=r;
if(max_radius<r) max_radius=r;
}
/** Put a particle into the correct region of the container.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle.
* \param[out] (ai,aj,ak) the periodic image displacement that the particle is
* in, with (0,0,0) corresponding to the primary domain.
*/
void container_periodic::put(int n,double x,double y,double z,int &ai,int &aj,int &ak) {
int ijk;
put_locate_block(ijk,x,y,z,ai,aj,ak);
id[ijk][co[ijk]]=n;
double *pp=p[ijk]+3*co[ijk]++;
*(pp++)=x;*(pp++)=y;*pp=z;
}
/** Put a particle into the correct region of the container.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle.
* \param[in] r the radius of the particle.
* \param[out] (ai,aj,ak) the periodic image displacement that the particle is
* in, with (0,0,0) corresponding to the primary domain.
*/
void container_periodic_poly::put(int n,double x,double y,double z,double r,int &ai,int &aj,int &ak) {
int ijk;
put_locate_block(ijk,x,y,z,ai,aj,ak);
id[ijk][co[ijk]]=n;
double *pp=p[ijk]+4*co[ijk]++;
*(pp++)=x;*(pp++)=y;*(pp++)=z;*pp=r;
if(max_radius<r) max_radius=r;
}
/** Put a particle into the correct region of the container, also recording
* into which region it was stored.
* \param[in] vo the ordering class in which to record the region.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle. */
void container_periodic::put(particle_order &vo,int n,double x,double y,double z) {
int ijk;
put_locate_block(ijk,x,y,z);
id[ijk][co[ijk]]=n;
vo.add(ijk,co[ijk]);
double *pp=p[ijk]+3*co[ijk]++;
*(pp++)=x;*(pp++)=y;*pp=z;
}
/** Put a particle into the correct region of the container, also recording
* into which region it was stored.
* \param[in] vo the ordering class in which to record the region.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle.
* \param[in] r the radius of the particle. */
void container_periodic_poly::put(particle_order &vo,int n,double x,double y,double z,double r) {
int ijk;
put_locate_block(ijk,x,y,z);
id[ijk][co[ijk]]=n;
vo.add(ijk,co[ijk]);
double *pp=p[ijk]+4*co[ijk]++;
*(pp++)=x;*(pp++)=y;*(pp++)=z;*pp=r;
if(max_radius<r) max_radius=r;
}
/** Takes a particle position vector and computes the region index into which
* it should be stored. If the container is periodic, then the routine also
* maps the particle position to ensure it is in the primary domain. If the
* container is not periodic, the routine bails out.
* \param[out] ijk the region index.
* \param[in,out] (x,y,z) the particle position, remapped into the primary
* domain if necessary.
* \return True if the particle can be successfully placed into the container,
* false otherwise. */
void container_periodic_base::put_locate_block(int &ijk,double &x,double &y,double &z) {
// Remap particle in the z direction if necessary
int k=step_int(z*zsp);
if(k<0||k>=nz) {
int ak=step_div(k,nz);
z-=ak*bz;y-=ak*byz;x-=ak*bxz;k-=ak*nz;
}
// Remap particle in the y direction if necessary
int j=step_int(y*ysp);
if(j<0||j>=ny) {
int aj=step_div(j,ny);
y-=aj*by;x-=aj*bxy;j-=aj*ny;
}
// Remap particle in the x direction if necessary
ijk=step_int(x*xsp);
if(ijk<0||ijk>=nx) {
int ai=step_div(ijk,nx);
x-=ai*bx;ijk-=ai*nx;
}
// Compute the block index and check memory allocation
j+=ey;k+=ez;
ijk+=nx*(j+oy*k);
if(co[ijk]==mem[ijk]) add_particle_memory(ijk);
}
/** Takes a particle position vector and computes the region index into which
* it should be stored. If the container is periodic, then the routine also
* maps the particle position to ensure it is in the primary domain. If the
* container is not periodic, the routine bails out.
* \param[out] ijk the region index.
* \param[in,out] (x,y,z) the particle position, remapped into the primary
* domain if necessary.
* \param[out] (ai,aj,ak) the periodic image displacement that the particle is
* in, with (0,0,0) corresponding to the primary domain.
* \return True if the particle can be successfully placed into the container,
* false otherwise. */
void container_periodic_base::put_locate_block(int &ijk,double &x,double &y,double &z,int &ai,int &aj,int &ak) {
// Remap particle in the z direction if necessary
int k=step_int(z*zsp);
if(k<0||k>=nz) {
ak=step_div(k,nz);
z-=ak*bz;y-=ak*byz;x-=ak*bxz;k-=ak*nz;
} else ak=0;
// Remap particle in the y direction if necessary
int j=step_int(y*ysp);
if(j<0||j>=ny) {
aj=step_div(j,ny);
y-=aj*by;x-=aj*bxy;j-=aj*ny;
} else aj=0;
// Remap particle in the x direction if necessary
ijk=step_int(x*xsp);
if(ijk<0||ijk>=nx) {
ai=step_div(ijk,nx);
x-=ai*bx;ijk-=ai*nx;
} else ai=0;
// Compute the block index and check memory allocation
j+=ey;k+=ez;
ijk+=nx*(j+oy*k);
if(co[ijk]==mem[ijk]) add_particle_memory(ijk);
}
/** Takes a position vector and remaps it into the primary domain.
* \param[out] (ai,aj,ak) the periodic image displacement that the vector is in,
* with (0,0,0) corresponding to the primary domain.
* \param[out] (ci,cj,ck) the index of the block that the position vector is
* within, once it has been remapped.
* \param[in,out] (x,y,z) the position vector to consider, which is remapped
* into the primary domain during the routine.
* \param[out] ijk the block index that the vector is within. */
inline void container_periodic_base::remap(int &ai,int &aj,int &ak,int &ci,int &cj,int &ck,double &x,double &y,double &z,int &ijk) {
// Remap particle in the z direction if necessary
ck=step_int(z*zsp);
if(ck<0||ck>=nz) {
ak=step_div(ck,nz);
z-=ak*bz;y-=ak*byz;x-=ak*bxz;ck-=ak*nz;
} else ak=0;
// Remap particle in the y direction if necessary
cj=step_int(y*ysp);
if(cj<0||cj>=ny) {
aj=step_div(cj,ny);
y-=aj*by;x-=aj*bxy;cj-=aj*ny;
} else aj=0;
// Remap particle in the x direction if necessary
ci=step_int(x*xsp);
if(ci<0||ci>=nx) {
ai=step_div(ci,nx);
x-=ai*bx;ci-=ai*nx;
} else ai=0;
cj+=ey;ck+=ez;
ijk=ci+nx*(cj+oy*ck);
}
/** Takes a vector and finds the particle whose Voronoi cell contains that
* vector. This is equivalent to finding the particle which is nearest to the
* vector.
* \param[in] (x,y,z) the vector to test.
* \param[out] (rx,ry,rz) the position of the particle whose Voronoi cell
* contains the vector. This may point to a particle in
* a periodic image of the primary domain.
* \param[out] pid the ID of the particle.
* \return True if a particle was found. If the container has no particles,
* then the search will not find a Voronoi cell and false is returned. */
bool container_periodic::find_voronoi_cell(double x,double y,double z,double &rx,double &ry,double &rz,int &pid) {
int ai,aj,ak,ci,cj,ck,ijk;
particle_record w;
double mrs;
// Remap the vector into the primary domain and then search for the
// Voronoi cell that it is within
remap(ai,aj,ak,ci,cj,ck,x,y,z,ijk);
vc.find_voronoi_cell(x,y,z,ci,cj,ck,ijk,w,mrs);
if(w.ijk!=-1) {
// Assemble the position vector of the particle to be returned,
// applying a periodic remapping if necessary
ci+=w.di;if(ci<0||ci>=nx) ai+=step_div(ci,nx);
rx=p[w.ijk][3*w.l]+ak*bxz+aj*bxy+ai*bx;
ry=p[w.ijk][3*w.l+1]+ak*byz+aj*by;
rz=p[w.ijk][3*w.l+2]+ak*bz;
pid=id[w.ijk][w.l];
return true;
}
return false;
}
/** Takes a vector and finds the particle whose Voronoi cell contains that
* vector. Additional wall classes are not considered by this routine.
* \param[in] (x,y,z) the vector to test.
* \param[out] (rx,ry,rz) the position of the particle whose Voronoi cell
* contains the vector. If the container is periodic,
* this may point to a particle in a periodic image of
* the primary domain.
* \param[out] pid the ID of the particle.
* \return True if a particle was found. If the container has no particles,
* then the search will not find a Voronoi cell and false is returned. */
bool container_periodic_poly::find_voronoi_cell(double x,double y,double z,double &rx,double &ry,double &rz,int &pid) {
int ai,aj,ak,ci,cj,ck,ijk;
particle_record w;
double mrs;
// Remap the vector into the primary domain and then search for the
// Voronoi cell that it is within
remap(ai,aj,ak,ci,cj,ck,x,y,z,ijk);
vc.find_voronoi_cell(x,y,z,ci,cj,ck,ijk,w,mrs);
if(w.ijk!=-1) {
// Assemble the position vector of the particle to be returned,
// applying a periodic remapping if necessary
ci+=w.di;if(ci<0||ci>=nx) ai+=step_div(ci,nx);
rx=p[w.ijk][4*w.l]+ak*bxz+aj*bxy+ai*bx;
ry=p[w.ijk][4*w.l+1]+ak*byz+aj*by;
rz=p[w.ijk][4*w.l+2]+ak*bz;
pid=id[w.ijk][w.l];
return true;
}
return false;
}
/** Increase memory for a particular region.
* \param[in] i the index of the region to reallocate. */
void container_periodic_base::add_particle_memory(int i) {
// Handle the case when no memory has been allocated for this block
if(mem[i]==0) {
mem[i]=init_mem;
id[i]=new int[init_mem];
p[i]=new double[ps*init_mem];
return;
}
// Otherwise, double the memory allocation for this block. Carry out a
// check on the memory allocation size, and print a status message if
// requested.
int l,nmem(mem[i]<<1);
if(nmem>max_particle_memory)
voro_fatal_error("Absolute maximum memory allocation exceeded",VOROPP_MEMORY_ERROR);
#if VOROPP_VERBOSE >=3
fprintf(stderr,"Particle memory in region %d scaled up to %d\n",i,nmem);
#endif
// Allocate new memory and copy in the contents of the old arrays
int *idp=new int[nmem];
for(l=0;l<co[i];l++) idp[l]=id[i][l];
double *pp=new double[ps*nmem];
for(l=0;l<ps*co[i];l++) pp[l]=p[i][l];
// Update pointers and delete old arrays
mem[i]=nmem;
delete [] id[i];id[i]=idp;
delete [] p[i];p[i]=pp;
}
/** Import a list of particles from an open file stream into the container.
* Entries of four numbers (Particle ID, x position, y position, z position)
* are searched for. If the file cannot be successfully read, then the routine
* causes a fatal error.
* \param[in] fp the file handle to read from. */
void container_periodic::import(FILE *fp) {
int i,j;
double x,y,z;
while((j=fscanf(fp,"%d %lg %lg %lg",&i,&x,&y,&z))==4) put(i,x,y,z);
if(j!=EOF) voro_fatal_error("File import error",VOROPP_FILE_ERROR);
}
/** Import a list of particles from an open file stream, also storing the order
* of that the particles are read. Entries of four numbers (Particle ID, x
* position, y position, z position) are searched for. If the file cannot be
* successfully read, then the routine causes a fatal error.
* \param[in,out] vo a reference to an ordering class to use.
* \param[in] fp the file handle to read from. */
void container_periodic::import(particle_order &vo,FILE *fp) {
int i,j;
double x,y,z;
while((j=fscanf(fp,"%d %lg %lg %lg",&i,&x,&y,&z))==4) put(vo,i,x,y,z);
if(j!=EOF) voro_fatal_error("File import error",VOROPP_FILE_ERROR);
}
/** Import a list of particles from an open file stream into the container.
* Entries of five numbers (Particle ID, x position, y position, z position,
* radius) are searched for. If the file cannot be successfully read, then the
* routine causes a fatal error.
* \param[in] fp the file handle to read from. */
void container_periodic_poly::import(FILE *fp) {
int i,j;
double x,y,z,r;
while((j=fscanf(fp,"%d %lg %lg %lg %lg",&i,&x,&y,&z,&r))==5) put(i,x,y,z,r);
if(j!=EOF) voro_fatal_error("File import error",VOROPP_FILE_ERROR);
}
/** Import a list of particles from an open file stream, also storing the order
* of that the particles are read. Entries of four numbers (Particle ID, x
* position, y position, z position, radius) are searched for. If the file
* cannot be successfully read, then the routine causes a fatal error.
* \param[in,out] vo a reference to an ordering class to use.
* \param[in] fp the file handle to read from. */
void container_periodic_poly::import(particle_order &vo,FILE *fp) {
int i,j;
double x,y,z,r;
while((j=fscanf(fp,"%d %lg %lg %lg %lg",&i,&x,&y,&z,&r))==5) put(vo,i,x,y,z,r);
if(j!=EOF) voro_fatal_error("File import error",VOROPP_FILE_ERROR);
}
/** Outputs the a list of all the container regions along with the number of
* particles stored within each. */
void container_periodic_base::region_count() {
int i,j,k,*cop=co;
for(k=0;k<nz;k++) for(j=0;j<ny;j++) for(i=0;i<nx;i++)
printf("Region (%d,%d,%d): %d particles\n",i,j,k,*(cop++));
}
/** Clears a container of particles. */
void container_periodic::clear() {
for(int *cop=co;cop<co+nxyz;cop++) *cop=0;
}
/** Clears a container of particles, also clearing resetting the maximum radius
* to zero. */
void container_periodic_poly::clear() {
for(int *cop=co;cop<co+nxyz;cop++) *cop=0;
max_radius=0;
}
/** Computes all the Voronoi cells and saves customized information about them.
* \param[in] format the custom output string to use.
* \param[in] fp a file handle to write to. */
void container_periodic::print_custom(const char *format,FILE *fp) {
c_loop_all_periodic vl(*this);
print_custom(vl,format,fp);
}
/** Computes all the Voronoi cells and saves customized
* information about them.
* \param[in] format the custom output string to use.
* \param[in] fp a file handle to write to. */
void container_periodic_poly::print_custom(const char *format,FILE *fp) {
c_loop_all_periodic vl(*this);
print_custom(vl,format,fp);
}
/** Computes all the Voronoi cells and saves customized information about them.
* \param[in] format the custom output string to use.
* \param[in] filename the name of the file to write to. */
void container_periodic::print_custom(const char *format,const char *filename) {
FILE *fp=safe_fopen(filename,"w");
print_custom(format,fp);
fclose(fp);
}
/** Computes all the Voronoi cells and saves customized
* information about them
* \param[in] format the custom output string to use.
* \param[in] filename the name of the file to write to. */
void container_periodic_poly::print_custom(const char *format,const char *filename) {
FILE *fp=safe_fopen(filename,"w");
print_custom(format,fp);
fclose(fp);
}
/** Computes all of the Voronoi cells in the container, but does nothing
* with the output. It is useful for measuring the pure computation time
* of the Voronoi algorithm, without any additional calculations such as
* volume evaluation or cell output. */
void container_periodic::compute_all_cells() {
voronoicell c;
c_loop_all_periodic vl(*this);
if(vl.start()) do compute_cell(c,vl);
while(vl.inc());
}
/** Computes all of the Voronoi cells in the container, but does nothing
* with the output. It is useful for measuring the pure computation time
* of the Voronoi algorithm, without any additional calculations such as
* volume evaluation or cell output. */
void container_periodic_poly::compute_all_cells() {
voronoicell c;
c_loop_all_periodic vl(*this);
if(vl.start()) do compute_cell(c,vl);while(vl.inc());
}
/** Calculates all of the Voronoi cells and sums their volumes. In most cases
* without walls, the sum of the Voronoi cell volumes should equal the volume
* of the container to numerical precision.
* \return The sum of all of the computed Voronoi volumes. */
double container_periodic::sum_cell_volumes() {
voronoicell c;
double vol=0;
c_loop_all_periodic vl(*this);
if(vl.start()) do if(compute_cell(c,vl)) vol+=c.volume();while(vl.inc());
return vol;
}
/** Calculates all of the Voronoi cells and sums their volumes. In most cases
* without walls, the sum of the Voronoi cell volumes should equal the volume
* of the container to numerical precision.
* \return The sum of all of the computed Voronoi volumes. */
double container_periodic_poly::sum_cell_volumes() {
voronoicell c;
double vol=0;
c_loop_all_periodic vl(*this);
if(vl.start()) do if(compute_cell(c,vl)) vol+=c.volume();while(vl.inc());
return vol;
}
/** This routine creates all periodic images of the particles. It is meant for
* diagnostic purposes only, since usually periodic images are dynamically
* created in when they are referenced. */
void container_periodic_base::create_all_images() {
int i,j,k;
for(k=0;k<oz;k++) for(j=0;j<oy;j++) for(i=0;i<nx;i++) create_periodic_image(i,j,k);
}
/** Checks that the particles within each block lie within that block's bounds.
* This is useful for diagnosing problems with periodic image computation. */
void container_periodic_base::check_compartmentalized() {
int c,l,i,j,k;
double mix,miy,miz,max,may,maz,*pp;
for(k=l=0;k<oz;k++) for(j=0;j<oy;j++) for(i=0;i<nx;i++,l++) if(mem[l]>0) {
// Compute the block's bounds, adding in a small tolerance
mix=i*boxx-tolerance;max=mix+boxx+tolerance;
miy=(j-ey)*boxy-tolerance;may=miy+boxy+tolerance;
miz=(k-ez)*boxz-tolerance;maz=miz+boxz+tolerance;
// Print entries for any particles that lie outside the block's
// bounds
for(pp=p[l],c=0;c<co[l];c++,pp+=ps) if(*pp<mix||*pp>max||pp[1]<miy||pp[1]>may||pp[2]<miz||pp[2]>maz)
printf("%d %d %d %d %f %f %f %f %f %f %f %f %f\n",
id[l][c],i,j,k,*pp,pp[1],pp[2],mix,max,miy,may,miz,maz);
}
}
/** Creates particles within an image block that is aligned with the primary
* domain in the z axis. In this case, the image block may be comprised of
* particles from two primary blocks. The routine considers these two primary
* blocks, and adds the needed particles to the image. The remaining particles
* from the primary blocks are also filled into the neighboring images.
* \param[in] (di,dj,dk) the index of the block to consider. The z index must
* satisfy ez<=dk<wz. */
void container_periodic_base::create_side_image(int di,int dj,int dk) {
int l,dijk=di+nx*(dj+oy*dk),odijk,ima=step_div(dj-ey,ny);
int qua=di+step_int(-ima*bxy*xsp),quadiv=step_div(qua,nx);
int fi=qua-quadiv*nx,fijk=fi+nx*(dj-ima*ny+oy*dk);
double dis=ima*bxy+quadiv*bx,switchx=di*boxx-ima*bxy-quadiv*bx,adis;
// Left image computation
if((img[dijk]&1)==0) {
if(di>0) {
odijk=dijk-1;adis=dis;
} else {
odijk=dijk+nx-1;adis=dis+bx;
}
img[odijk]|=2;
for(l=0;l<co[fijk];l++) {
if(p[fijk][ps*l]>switchx) put_image(dijk,fijk,l,dis,by*ima,0);
else put_image(odijk,fijk,l,adis,by*ima,0);
}
}
// Right image computation
if((img[dijk]&2)==0) {
if(fi==nx-1) {
fijk+=1-nx;switchx+=(1-nx)*boxx;dis+=bx;
} else {
fijk++;switchx+=boxx;
}
if(di==nx-1) {
odijk=dijk-nx+1;adis=dis-bx;
} else {
odijk=dijk+1;adis=dis;
}
img[odijk]|=1;
for(l=0;l<co[fijk];l++) {
if(p[fijk][ps*l]<switchx) put_image(dijk,fijk,l,dis,by*ima,0);
else put_image(odijk,fijk,l,adis,by*ima,0);
}
}
// All contributions to the block now added, so set both two bits of
// the image information
img[dijk]=3;
}
/** Creates particles within an image block that is not aligned with the
* primary domain in the z axis. In this case, the image block may be comprised
* of particles from four primary blocks. The routine considers these four
* primary blocks, and adds the needed particles to the image. The remaining
* particles from the primary blocks are also filled into the neighboring
* images.
* \param[in] (di,dj,dk) the index of the block to consider. The z index must
* satisfy dk<ez or dk>=wz. */
void container_periodic_base::create_vertical_image(int di,int dj,int dk) {
int l,dijk=di+nx*(dj+oy*dk),dijkl,dijkr,ima=step_div(dk-ez,nz);
int qj=dj+step_int(-ima*byz*ysp),qjdiv=step_div(qj-ey,ny);
int qi=di+step_int((-ima*bxz-qjdiv*bxy)*xsp),qidiv=step_div(qi,nx);
int fi=qi-qidiv*nx,fj=qj-qjdiv*ny,fijk=fi+nx*(fj+oy*(dk-ima*nz)),fijk2;
double disy=ima*byz+qjdiv*by,switchy=(dj-ey)*boxy-ima*byz-qjdiv*by;
double disx=ima*bxz+qjdiv*bxy+qidiv*bx,switchx=di*boxx-ima*bxz-qjdiv*bxy-qidiv*bx;
double switchx2,disxl,disxr,disx2,disxr2;
if(di==0) {dijkl=dijk+nx-1;disxl=disx+bx;}
else {dijkl=dijk-1;disxl=disx;}
if(di==nx-1) {dijkr=dijk-nx+1;disxr=disx-bx;}
else {dijkr=dijk+1;disxr=disx;}
// Down-left image computation
bool y_exist=dj!=0;
if((img[dijk]&1)==0) {
img[dijkl]|=2;
if(y_exist) {
img[dijkl-nx]|=8;
img[dijk-nx]|=4;
}
for(l=0;l<co[fijk];l++) {
if(p[fijk][ps*l+1]>switchy) {
if(p[fijk][ps*l]>switchx) put_image(dijk,fijk,l,disx,disy,bz*ima);
else put_image(dijkl,fijk,l,disxl,disy,bz*ima);
} else {
if(!y_exist) continue;
if(p[fijk][ps*l]>switchx) put_image(dijk-nx,fijk,l,disx,disy,bz*ima);
else put_image(dijkl-nx,fijk,l,disxl,disy,bz*ima);
}
}
}
// Down-right image computation
if((img[dijk]&2)==0) {
if(fi==nx-1) {
fijk2=fijk+1-nx;switchx2=switchx+(1-nx)*boxx;disx2=disx+bx;disxr2=disxr+bx;
} else {
fijk2=fijk+1;switchx2=switchx+boxx;disx2=disx;disxr2=disxr;
}
img[dijkr]|=1;
if(y_exist) {
img[dijkr-nx]|=4;
img[dijk-nx]|=8;
}
for(l=0;l<co[fijk2];l++) {
if(p[fijk2][ps*l+1]>switchy) {
if(p[fijk2][ps*l]>switchx2) put_image(dijkr,fijk2,l,disxr2,disy,bz*ima);
else put_image(dijk,fijk2,l,disx2,disy,bz*ima);
} else {
if(!y_exist) continue;
if(p[fijk2][ps*l]>switchx2) put_image(dijkr-nx,fijk2,l,disxr2,disy,bz*ima);
else put_image(dijk-nx,fijk2,l,disx2,disy,bz*ima);
}
}
}
// Recomputation of some intermediate quantities for boundary cases
if(fj==wy-1) {
fijk+=nx*(1-ny)-fi;
switchy+=(1-ny)*boxy;
disy+=by;
qi=di+step_int(-(ima*bxz+(qjdiv+1)*bxy)*xsp);
int dqidiv=step_div(qi,nx)-qidiv;qidiv+=dqidiv;
fi=qi-qidiv*nx;
fijk+=fi;
disx+=bxy+bx*dqidiv;
disxl+=bxy+bx*dqidiv;
disxr+=bxy+bx*dqidiv;
switchx-=bxy+bx*dqidiv;
} else {
fijk+=nx;switchy+=boxy;
}
// Up-left image computation
y_exist=dj!=oy-1;
if((img[dijk]&4)==0) {
img[dijkl]|=8;
if(y_exist) {
img[dijkl+nx]|=2;
img[dijk+nx]|=1;
}
for(l=0;l<co[fijk];l++) {
if(p[fijk][ps*l+1]>switchy) {
if(!y_exist) continue;
if(p[fijk][ps*l]>switchx) put_image(dijk+nx,fijk,l,disx,disy,bz*ima);
else put_image(dijkl+nx,fijk,l,disxl,disy,bz*ima);
} else {
if(p[fijk][ps*l]>switchx) put_image(dijk,fijk,l,disx,disy,bz*ima);
else put_image(dijkl,fijk,l,disxl,disy,bz*ima);
}
}
}
// Up-right image computation
if((img[dijk]&8)==0) {
if(fi==nx-1) {
fijk2=fijk+1-nx;switchx2=switchx+(1-nx)*boxx;disx2=disx+bx;disxr2=disxr+bx;
} else {
fijk2=fijk+1;switchx2=switchx+boxx;disx2=disx;disxr2=disxr;
}
img[dijkr]|=4;
if(y_exist) {
img[dijkr+nx]|=1;
img[dijk+nx]|=2;
}
for(l=0;l<co[fijk2];l++) {
if(p[fijk2][ps*l+1]>switchy) {
if(!y_exist) continue;
if(p[fijk2][ps*l]>switchx2) put_image(dijkr+nx,fijk2,l,disxr2,disy,bz*ima);
else put_image(dijk+nx,fijk2,l,disx2,disy,bz*ima);
} else {
if(p[fijk2][ps*l]>switchx2) put_image(dijkr,fijk2,l,disxr2,disy,bz*ima);
else put_image(dijk,fijk2,l,disx2,disy,bz*ima);
}
}
}
// All contributions to the block now added, so set all four bits of
// the image information
img[dijk]=15;
}
/** Copies a particle position from the primary domain into an image block.
* \param[in] reg the block index within the primary domain that the particle
* is within.
* \param[in] fijk the index of the image block.
* \param[in] l the index of the particle entry within the primary block.
* \param[in] (dx,dy,dz) the displacement vector to add to the particle. */
void container_periodic_base::put_image(int reg,int fijk,int l,double dx,double dy,double dz) {
if(co[reg]==mem[reg]) add_particle_memory(reg);
double *p1=p[reg]+ps*co[reg],*p2=p[fijk]+ps*l;
*(p1++)=*(p2++)+dx;
*(p1++)=*(p2++)+dy;
*p1=*p2+dz;
if(ps==4) *(++p1)=*(++p2);
id[reg][co[reg]++]=id[fijk][l];
}
}

654
extern/voro++/src/container_prd.hh vendored Normal file
View File

@@ -0,0 +1,654 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file container_prd.hh
* \brief Header file for the container_periodic_base and related classes. */
#ifndef VOROPP_CONTAINER_PRD_HH
#define VOROPP_CONTAINER_PRD_HH
#include <cstdio>
#include <vector>
#include "config.hh"
#include "common.hh"
#include "v_base.hh"
#include "cell.hh"
#include "c_loops.hh"
#include "v_compute.hh"
#include "unitcell.hh"
#include "rad_option.hh"
namespace voro {
/** \brief Class for representing a particle system in a 3D periodic
* non-orthogonal periodic domain.
*
* This class represents a particle system in a three-dimensional
* non-orthogonal periodic domain. The domain is defined by three periodicity
* vectors (bx,0,0), (bxy,by,0), and (bxz,byz,bz) that represent a
* parallelepiped. Internally, the class stores particles in the box 0<x<bx,
* 0<y<by, 0<z<bz, and constructs periodic images of particles that displaced
* by the three periodicity vectors when they are necessary for the
* computation. The internal memory structure for this class is significantly
* different from the container_base class in order to handle the dynamic
* construction of these periodic images.
*
* The class is derived from the unitcell class, which encapsulates information
* about the domain geometry, and the voro_base class, which encapsulates
* information about the underlying computational grid. */
class container_periodic_base : public unitcell, public voro_base {
public:
/** The lower y index (inclusive) of the primary domain within
* the block structure. */
int ey;
/** The lower z index (inclusive) of the primary domain within
* the block structure. */
int ez;
/** The upper y index (exclusive) of the primary domain within
* the block structure. */
int wy;
/** The upper z index (exclusive) of the primary domain within
* the block structure. */
int wz;
/** The total size of the block structure (including images) in
* the y direction. */
int oy;
/** The total size of the block structure (including images) in
* the z direction. */
int oz;
/** The total number of blocks. */
int oxyz;
/** This array holds the numerical IDs of each particle in each
* computational box. */
int **id;
/** A two dimensional array holding particle positions. For the
* derived container_poly class, this also holds particle
* radii. */
double **p;
/** This array holds the number of particles within each
* computational box of the container. */
int *co;
/** This array holds the maximum amount of particle memory for
* each computational box of the container. If the number of
* particles in a particular box ever approaches this limit,
* more is allocated using the add_particle_memory() function.
*/
int *mem;
/** An array holding information about periodic image
* construction at a given location. */
char *img;
/** The initial amount of memory to allocate for particles
* for each block. */
const int init_mem;
/** The amount of memory in the array structure for each
* particle. This is set to 3 when the basic class is
* initialized, so that the array holds (x,y,z) positions. If
* the container class is initialized as part of the derived
* class container_poly, then this is set to 4, to also hold
* the particle radii. */
const int ps;
container_periodic_base(double bx_,double bxy_,double by_,double bxz_,double byz_,double bz_,
int nx_,int ny_,int nz_,int init_mem_,int ps);
~container_periodic_base();
/** Prints all particles in the container, including those that
* have been constructed in image blocks. */
inline void print_all_particles() {
int ijk,q;
for(ijk=0;ijk<oxyz;ijk++) for(q=0;q<co[ijk];q++)
printf("%d %g %g %g\n",id[ijk][q],p[ijk][ps*q],p[ijk][ps*q+1],p[ijk][ps*q+2]);
}
void region_count();
/** Initializes the Voronoi cell prior to a compute_cell
* operation for a specific particle being carried out by a
* voro_compute class. The cell is initialized to be the
* pre-computed unit Voronoi cell based on planes formed by
* periodic images of the particle.
* \param[in,out] c a reference to a voronoicell object.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within its block.
* \param[in] (ci,cj,ck) the coordinates of the block in the
* container coordinate system.
* \param[out] (i,j,k) the coordinates of the test block
* relative to the voro_compute
* coordinate system.
* \param[out] (x,y,z) the position of the particle.
* \param[out] disp a block displacement used internally by the
* compute_cell routine.
* \return False if the plane cuts applied by walls completely
* removed the cell, true otherwise. */
template<class v_cell>
inline bool initialize_voronoicell(v_cell &c,int ijk,int q,int ci,int cj,int ck,int &i,int &j,int &k,double &x,double &y,double &z,int &disp) {
c=unit_voro;
double *pp=p[ijk]+ps*q;
x=*(pp++);y=*(pp++);z=*pp;
i=nx;j=ey;k=ez;
return true;
}
/** Initializes parameters for a find_voronoi_cell call within
* the voro_compute template.
* \param[in] (ci,cj,ck) the coordinates of the test block in
* the container coordinate system.
* \param[in] ijk the index of the test block
* \param[out] (i,j,k) the coordinates of the test block
* relative to the voro_compute
* coordinate system.
* \param[out] disp a block displacement used internally by the
* find_voronoi_cell routine (but not needed
* in this instance.) */
inline void initialize_search(int ci,int cj,int ck,int ijk,int &i,int &j,int &k,int &disp) {
i=nx;j=ey;k=ez;
}
/** Returns the position of a particle currently being computed
* relative to the computational block that it is within. It is
* used to select the optimal worklist entry to use.
* \param[in] (x,y,z) the position of the particle.
* \param[in] (ci,cj,ck) the block that the particle is within.
* \param[out] (fx,fy,fz) the position relative to the block.
*/
inline void frac_pos(double x,double y,double z,double ci,double cj,double ck,double &fx,double &fy,double &fz) {
fx=x-boxx*ci;
fy=y-boxy*(cj-ey);
fz=z-boxz*(ck-ez);
}
/** Calculates the index of block in the container structure
* corresponding to given coordinates.
* \param[in] (ci,cj,ck) the coordinates of the original block
* in the current computation, relative
* to the container coordinate system.
* \param[in] (ei,ej,ek) the displacement of the current block
* from the original block.
* \param[in,out] (qx,qy,qz) the periodic displacement that
* must be added to the particles
* within the computed block.
* \param[in] disp a block displacement used internally by the
* find_voronoi_cell and compute_cell routines
* (but not needed in this instance.)
* \return The block index. */
inline int region_index(int ci,int cj,int ck,int ei,int ej,int ek,double &qx,double &qy,double &qz,int &disp) {
int qi=ci+(ei-nx),qj=cj+(ej-ey),qk=ck+(ek-ez);
int iv(step_div(qi,nx));if(iv!=0) {qx=iv*bx;qi-=nx*iv;} else qx=0;
create_periodic_image(qi,qj,qk);
return qi+nx*(qj+oy*qk);
}
void create_all_images();
void check_compartmentalized();
protected:
void add_particle_memory(int i);
void put_locate_block(int &ijk,double &x,double &y,double &z);
void put_locate_block(int &ijk,double &x,double &y,double &z,int &ai,int &aj,int &ak);
/** Creates particles within an image block by copying them
* from the primary domain and shifting them. If the given
* block is aligned with the primary domain in the z-direction,
* the routine calls the simpler create_side_image routine
* where the image block may comprise of particles from up to
* two primary blocks. Otherwise is calls the more complex
* create_vertical_image where the image block may comprise of
* particles from up to four primary blocks.
* \param[in] (di,dj,dk) the coordinates of the image block to
* create. */
inline void create_periodic_image(int di,int dj,int dk) {
if(di<0||di>=nx||dj<0||dj>=oy||dk<0||dk>=oz)
voro_fatal_error("Constructing periodic image for nonexistent point",VOROPP_INTERNAL_ERROR);
if(dk>=ez&&dk<wz) {
if(dj<ey||dj>=wy) create_side_image(di,dj,dk);
} else create_vertical_image(di,dj,dk);
}
void create_side_image(int di,int dj,int dk);
void create_vertical_image(int di,int dj,int dk);
void put_image(int reg,int fijk,int l,double dx,double dy,double dz);
inline void remap(int &ai,int &aj,int &ak,int &ci,int &cj,int &ck,double &x,double &y,double &z,int &ijk);
};
/** \brief Extension of the container_periodic_base class for computing regular
* Voronoi tessellations.
*
* This class is an extension of the container_periodic_base that has routines
* specifically for computing the regular Voronoi tessellation with no
* dependence on particle radii. */
class container_periodic : public container_periodic_base, public radius_mono {
public:
container_periodic(double bx_,double bxy_,double by_,double bxz_,double byz_,double bz_,
int nx_,int ny_,int nz_,int init_mem_);
void clear();
void put(int n,double x,double y,double z);
void put(int n,double x,double y,double z,int &ai,int &aj,int &ak);
void put(particle_order &vo,int n,double x,double y,double z);
void import(FILE *fp=stdin);
void import(particle_order &vo,FILE *fp=stdin);
/** Imports a list of particles from an open file stream into
* the container. Entries of four numbers (Particle ID, x
* position, y position, z position) are searched for. If the
* file cannot be successfully read, then the routine causes a
* fatal error.
* \param[in] filename the name of the file to open and read
* from. */
inline void import(const char* filename) {
FILE *fp=safe_fopen(filename,"r");
import(fp);
fclose(fp);
}
/** Imports a list of particles from an open file stream into
* the container. Entries of four numbers (Particle ID, x
* position, y position, z position) are searched for. In
* addition, the order in which particles are read is saved
* into an ordering class. If the file cannot be successfully
* read, then the routine causes a fatal error.
* \param[in,out] vo the ordering class to use.
* \param[in] filename the name of the file to open and read
* from. */
inline void import(particle_order &vo,const char* filename) {
FILE *fp=safe_fopen(filename,"r");
import(vo,fp);
fclose(fp);
}
void compute_all_cells();
double sum_cell_volumes();
/** Dumps particle IDs and positions to a file.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_particles(c_loop &vl,FILE *fp) {
double *pp;
if(vl.start()) do {
pp=p[vl.ijk]+3*vl.q;
fprintf(fp,"%d %g %g %g\n",id[vl.ijk][vl.q],*pp,pp[1],pp[2]);
} while(vl.inc());
}
/** Dumps all of the particle IDs and positions to a file.
* \param[in] fp a file handle to write to. */
inline void draw_particles(FILE *fp=stdout) {
c_loop_all_periodic vl(*this);
draw_particles(vl,fp);
}
/** Dumps all of the particle IDs and positions to a file.
* \param[in] filename the name of the file to write to. */
inline void draw_particles(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_particles(fp);
fclose(fp);
}
/** Dumps particle positions in POV-Ray format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_particles_pov(c_loop &vl,FILE *fp) {
double *pp;
if(vl.start()) do {
pp=p[vl.ijk]+3*vl.q;
fprintf(fp,"// id %d\nsphere{<%g,%g,%g>,s}\n",
id[vl.ijk][vl.q],*pp,pp[1],pp[2]);
} while(vl.inc());
}
/** Dumps all particle positions in POV-Ray format.
* \param[in] fp a file handle to write to. */
inline void draw_particles_pov(FILE *fp=stdout) {
c_loop_all_periodic vl(*this);
draw_particles_pov(vl,fp);
}
/** Dumps all particle positions in POV-Ray format.
* \param[in] filename the name of the file to write to. */
inline void draw_particles_pov(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_particles_pov(fp);
fclose(fp);
}
/** Computes Voronoi cells and saves the output in gnuplot
* format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_cells_gnuplot(c_loop &vl,FILE *fp) {
voronoicell c;double *pp;
if(vl.start()) do if(compute_cell(c,vl)) {
pp=p[vl.ijk]+ps*vl.q;
c.draw_gnuplot(*pp,pp[1],pp[2],fp);
} while(vl.inc());
}
/** Computes all Voronoi cells and saves the output in gnuplot
* format.
* \param[in] fp a file handle to write to. */
inline void draw_cells_gnuplot(FILE *fp=stdout) {
c_loop_all_periodic vl(*this);
draw_cells_gnuplot(vl,fp);
}
/** Compute all Voronoi cells and saves the output in gnuplot
* format.
* \param[in] filename the name of the file to write to. */
inline void draw_cells_gnuplot(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_cells_gnuplot(fp);
fclose(fp);
}
/** Computes Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_cells_pov(c_loop &vl,FILE *fp) {
voronoicell c;double *pp;
if(vl.start()) do if(compute_cell(c,vl)) {
fprintf(fp,"// cell %d\n",id[vl.ijk][vl.q]);
pp=p[vl.ijk]+ps*vl.q;
c.draw_pov(*pp,pp[1],pp[2],fp);
} while(vl.inc());
}
/** Computes all Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] fp a file handle to write to. */
inline void draw_cells_pov(FILE *fp=stdout) {
c_loop_all_periodic vl(*this);
draw_cells_pov(vl,fp);
}
/** Computes all Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] filename the name of the file to write to. */
inline void draw_cells_pov(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_cells_pov(fp);
fclose(fp);
}
/** Computes the Voronoi cells and saves customized information
* about them.
* \param[in] vl the loop class to use.
* \param[in] format the custom output string to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void print_custom(c_loop &vl,const char *format,FILE *fp) {
int ijk,q;double *pp;
if(contains_neighbor(format)) {
voronoicell_neighbor c;
if(vl.start()) do if(compute_cell(c,vl)) {
ijk=vl.ijk;q=vl.q;pp=p[ijk]+ps*q;
c.output_custom(format,id[ijk][q],*pp,pp[1],pp[2],default_radius,fp);
} while(vl.inc());
} else {
voronoicell c;
if(vl.start()) do if(compute_cell(c,vl)) {
ijk=vl.ijk;q=vl.q;pp=p[ijk]+ps*q;
c.output_custom(format,id[ijk][q],*pp,pp[1],pp[2],default_radius,fp);
} while(vl.inc());
}
}
void print_custom(const char *format,FILE *fp=stdout);
void print_custom(const char *format,const char *filename);
bool find_voronoi_cell(double x,double y,double z,double &rx,double &ry,double &rz,int &pid);
/** Computes the Voronoi cell for a particle currently being
* referenced by a loop class.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] vl the loop class to use.
* \return True if the cell was computed. If the cell cannot be
* computed because it was removed entirely for some reason,
* then the routine returns false. */
template<class v_cell,class c_loop>
inline bool compute_cell(v_cell &c,c_loop &vl) {
return vc.compute_cell(c,vl.ijk,vl.q,vl.i,vl.j,vl.k);
}
/** Computes the Voronoi cell for given particle.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within the block.
* \return True if the cell was computed. If the cell cannot be
* computed because it was removed entirely for some reason,
* then the routine returns false. */
template<class v_cell>
inline bool compute_cell(v_cell &c,int ijk,int q) {
int k(ijk/(nx*oy)),ijkt(ijk-(nx*oy)*k),j(ijkt/nx),i(ijkt-j*nx);
return vc.compute_cell(c,ijk,q,i,j,k);
}
/** Computes the Voronoi cell for a ghost particle at a given
* location.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] (x,y,z) the location of the ghost particle.
* \return True if the cell was computed. If the cell cannot be
* computed, if it is removed entirely by a wall or boundary
* condition, then the routine returns false. */
template<class v_cell>
inline bool compute_ghost_cell(v_cell &c,double x,double y,double z) {
int ijk;
put_locate_block(ijk,x,y,z);
double *pp=p[ijk]+3*co[ijk]++;
*(pp++)=x;*(pp++)=y;*(pp++)=z;
bool q=compute_cell(c,ijk,co[ijk]-1);
co[ijk]--;
return q;
}
private:
voro_compute<container_periodic> vc;
friend class voro_compute<container_periodic>;
};
/** \brief Extension of the container_periodic_base class for computing radical
* Voronoi tessellations.
*
* This class is an extension of container_periodic_base that has routines
* specifically for computing the radical Voronoi tessellation that depends
* on the particle radii. */
class container_periodic_poly : public container_periodic_base, public radius_poly {
public:
container_periodic_poly(double bx_,double bxy_,double by_,double bxz_,double byz_,double bz_,
int nx_,int ny_,int nz_,int init_mem_);
void clear();
void put(int n,double x,double y,double z,double r);
void put(int n,double x,double y,double z,double r,int &ai,int &aj,int &ak);
void put(particle_order &vo,int n,double x,double y,double z,double r);
void import(FILE *fp=stdin);
void import(particle_order &vo,FILE *fp=stdin);
/** Imports a list of particles from an open file stream into
* the container_poly class. Entries of five numbers (Particle
* ID, x position, y position, z position, radius) are searched
* for. If the file cannot be successfully read, then the
* routine causes a fatal error.
* \param[in] filename the name of the file to open and read
* from. */
inline void import(const char* filename) {
FILE *fp=safe_fopen(filename,"r");
import(fp);
fclose(fp);
}
/** Imports a list of particles from an open file stream into
* the container_poly class. Entries of five numbers (Particle
* ID, x position, y position, z position, radius) are searched
* for. In addition, the order in which particles are read is
* saved into an ordering class. If the file cannot be
* successfully read, then the routine causes a fatal error.
* \param[in,out] vo the ordering class to use.
* \param[in] filename the name of the file to open and read
* from. */
inline void import(particle_order &vo,const char* filename) {
FILE *fp=safe_fopen(filename,"r");
import(vo,fp);
fclose(fp);
}
void compute_all_cells();
double sum_cell_volumes();
/** Dumps particle IDs, positions and radii to a file.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_particles(c_loop &vl,FILE *fp) {
double *pp;
if(vl.start()) do {
pp=p[vl.ijk]+4*vl.q;
fprintf(fp,"%d %g %g %g %g\n",id[vl.ijk][vl.q],*pp,pp[1],pp[2],pp[3]);
} while(vl.inc());
}
/** Dumps all of the particle IDs, positions and radii to a
* file.
* \param[in] fp a file handle to write to. */
inline void draw_particles(FILE *fp=stdout) {
c_loop_all_periodic vl(*this);
draw_particles(vl,fp);
}
/** Dumps all of the particle IDs, positions and radii to a
* file.
* \param[in] filename the name of the file to write to. */
inline void draw_particles(const char *filename) {
FILE *fp=safe_fopen(filename,"w");
draw_particles(fp);
fclose(fp);
}
/** Dumps particle positions in POV-Ray format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_particles_pov(c_loop &vl,FILE *fp) {
double *pp;
if(vl.start()) do {
pp=p[vl.ijk]+4*vl.q;
fprintf(fp,"// id %d\nsphere{<%g,%g,%g>,%g}\n",
id[vl.ijk][vl.q],*pp,pp[1],pp[2],pp[3]);
} while(vl.inc());
}
/** Dumps all the particle positions in POV-Ray format.
* \param[in] fp a file handle to write to. */
inline void draw_particles_pov(FILE *fp=stdout) {
c_loop_all_periodic vl(*this);
draw_particles_pov(vl,fp);
}
/** Dumps all the particle positions in POV-Ray format.
* \param[in] filename the name of the file to write to. */
inline void draw_particles_pov(const char *filename) {
FILE *fp(safe_fopen(filename,"w"));
draw_particles_pov(fp);
fclose(fp);
}
/** Computes Voronoi cells and saves the output in gnuplot
* format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_cells_gnuplot(c_loop &vl,FILE *fp) {
voronoicell c;double *pp;
if(vl.start()) do if(compute_cell(c,vl)) {
pp=p[vl.ijk]+ps*vl.q;
c.draw_gnuplot(*pp,pp[1],pp[2],fp);
} while(vl.inc());
}
/** Compute all Voronoi cells and saves the output in gnuplot
* format.
* \param[in] fp a file handle to write to. */
inline void draw_cells_gnuplot(FILE *fp=stdout) {
c_loop_all_periodic vl(*this);
draw_cells_gnuplot(vl,fp);
}
/** Compute all Voronoi cells and saves the output in gnuplot
* format.
* \param[in] filename the name of the file to write to. */
inline void draw_cells_gnuplot(const char *filename) {
FILE *fp(safe_fopen(filename,"w"));
draw_cells_gnuplot(fp);
fclose(fp);
}
/** Computes Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] vl the loop class to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void draw_cells_pov(c_loop &vl,FILE *fp) {
voronoicell c;double *pp;
if(vl.start()) do if(compute_cell(c,vl)) {
fprintf(fp,"// cell %d\n",id[vl.ijk][vl.q]);
pp=p[vl.ijk]+ps*vl.q;
c.draw_pov(*pp,pp[1],pp[2],fp);
} while(vl.inc());
}
/** Computes all Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] fp a file handle to write to. */
inline void draw_cells_pov(FILE *fp=stdout) {
c_loop_all_periodic vl(*this);
draw_cells_pov(vl,fp);
}
/** Computes all Voronoi cells and saves the output in POV-Ray
* format.
* \param[in] filename the name of the file to write to. */
inline void draw_cells_pov(const char *filename) {
FILE *fp(safe_fopen(filename,"w"));
draw_cells_pov(fp);
fclose(fp);
}
/** Computes the Voronoi cells and saves customized information
* about them.
* \param[in] vl the loop class to use.
* \param[in] format the custom output string to use.
* \param[in] fp a file handle to write to. */
template<class c_loop>
void print_custom(c_loop &vl,const char *format,FILE *fp) {
int ijk,q;double *pp;
if(contains_neighbor(format)) {
voronoicell_neighbor c;
if(vl.start()) do if(compute_cell(c,vl)) {
ijk=vl.ijk;q=vl.q;pp=p[ijk]+ps*q;
c.output_custom(format,id[ijk][q],*pp,pp[1],pp[2],pp[3],fp);
} while(vl.inc());
} else {
voronoicell c;
if(vl.start()) do if(compute_cell(c,vl)) {
ijk=vl.ijk;q=vl.q;pp=p[ijk]+ps*q;
c.output_custom(format,id[ijk][q],*pp,pp[1],pp[2],pp[3],fp);
} while(vl.inc());
}
}
/** Computes the Voronoi cell for a particle currently being
* referenced by a loop class.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] vl the loop class to use.
* \return True if the cell was computed. If the cell cannot be
* computed because it was removed entirely for some reason,
* then the routine returns false. */
template<class v_cell,class c_loop>
inline bool compute_cell(v_cell &c,c_loop &vl) {
return vc.compute_cell(c,vl.ijk,vl.q,vl.i,vl.j,vl.k);
}
/** Computes the Voronoi cell for given particle.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within the block.
* \return True if the cell was computed. If the cell cannot be
* computed because it was removed entirely for some reason,
* then the routine returns false. */
template<class v_cell>
inline bool compute_cell(v_cell &c,int ijk,int q) {
int k(ijk/(nx*oy)),ijkt(ijk-(nx*oy)*k),j(ijkt/nx),i(ijkt-j*nx);
return vc.compute_cell(c,ijk,q,i,j,k);
}
/** Computes the Voronoi cell for a ghost particle at a given
* location.
* \param[out] c a Voronoi cell class in which to store the
* computed cell.
* \param[in] (x,y,z) the location of the ghost particle.
* \param[in] r the radius of the ghost particle.
* \return True if the cell was computed. If the cell cannot be
* computed, if it is removed entirely by a wall or boundary
* condition, then the routine returns false. */
template<class v_cell>
inline bool compute_ghost_cell(v_cell &c,double x,double y,double z,double r) {
int ijk;
put_locate_block(ijk,x,y,z);
double *pp=p[ijk]+4*co[ijk]++,tm=max_radius;
*(pp++)=x;*(pp++)=y;*(pp++)=z;*pp=r;
if(r>max_radius) max_radius=r;
bool q=compute_cell(c,ijk,co[ijk]-1);
co[ijk]--;max_radius=tm;
return q;
}
void print_custom(const char *format,FILE *fp=stdout);
void print_custom(const char *format,const char *filename);
bool find_voronoi_cell(double x,double y,double z,double &rx,double &ry,double &rz,int &pid);
private:
voro_compute<container_periodic_poly> vc;
friend class voro_compute<container_periodic_poly>;
};
}
#endif

236
extern/voro++/src/pre_container.cc vendored Normal file
View File

@@ -0,0 +1,236 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file pre_container.cc
* \brief Function implementations for the pre_container and related classes.
*/
#include <cmath>
#include "config.hh"
#include "pre_container.hh"
namespace voro {
/** The class constructor sets up the geometry of container, initializing the
* minimum and maximum coordinates in each direction. It allocates an initial
* chunk into which to store particle information.
* \param[in] (ax_,bx_) the minimum and maximum x coordinates.
* \param[in] (ay_,by_) the minimum and maximum y coordinates.
* \param[in] (az_,bz_) the minimum and maximum z coordinates.
* \param[in] (xperiodic_,yperiodic_,zperiodic_ ) flags setting whether the
* container is periodic in each
* coordinate direction.
* \param[in] ps_ the number of floating point entries to store for each
* particle. */
pre_container_base::pre_container_base(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
bool xperiodic_,bool yperiodic_,bool zperiodic_,int ps_) :
ax(ax_), bx(bx_), ay(ay_), by(by_), az(az_), bz(bz_),
xperiodic(xperiodic_), yperiodic(yperiodic_), zperiodic(zperiodic_), ps(ps_),
index_sz(init_chunk_size), pre_id(new int*[index_sz]), end_id(pre_id),
pre_p(new double*[index_sz]), end_p(pre_p) {
ch_id=*end_id=new int[pre_container_chunk_size];
l_id=end_id+index_sz;e_id=ch_id+pre_container_chunk_size;
ch_p=*end_p=new double[ps*pre_container_chunk_size];
}
/** The destructor frees the dynamically allocated memory. */
pre_container_base::~pre_container_base() {
delete [] *end_p;
delete [] *end_id;
while (end_id!=pre_id) {
end_p--;
delete [] *end_p;
end_id--;
delete [] *end_id;
}
delete [] pre_p;
delete [] pre_id;
}
/** Makes a guess at the optimal grid of blocks to use, computing in
* a way that
* \param[out] (nx,ny,nz) the number of blocks to use. */
void pre_container_base::guess_optimal(int &nx,int &ny,int &nz) {
double dx=bx-ax,dy=by-ay,dz=bz-az;
double ilscale=pow(total_particles()/(optimal_particles*dx*dy*dz),1/3.0);
nx=int(dx*ilscale+1);
ny=int(dy*ilscale+1);
nz=int(dz*ilscale+1);
}
/** Stores a particle ID and position, allocating a new memory chunk if
* necessary. For coordinate directions in which the container is not periodic,
* the routine checks to make sure that the particle is within the container
* bounds. If the particle is out of bounds, it is not stored.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle. */
void pre_container::put(int n,double x,double y,double z) {
if((xperiodic||(x>=ax&&x<=bx))&&(yperiodic||(y>=ay&&y<=by))&&(zperiodic||(z>=az&&z<=bz))) {
if(ch_id==e_id) new_chunk();
*(ch_id++)=n;
*(ch_p++)=x;*(ch_p++)=y;*(ch_p++)=z;
}
#if VOROPP_REPORT_OUT_OF_BOUNDS ==1
else fprintf(stderr,"Out of bounds: (x,y,z)=(%g,%g,%g)\n",x,y,z);
#endif
}
/** Stores a particle ID and position, allocating a new memory chunk if necessary.
* \param[in] n the numerical ID of the inserted particle.
* \param[in] (x,y,z) the position vector of the inserted particle.
* \param[in] r the radius of the particle. */
void pre_container_poly::put(int n,double x,double y,double z,double r) {
if((xperiodic||(x>=ax&&x<=bx))&&(yperiodic||(y>=ay&&y<=by))&&(zperiodic||(z>=az&&z<=bz))) {
if(ch_id==e_id) new_chunk();
*(ch_id++)=n;
*(ch_p++)=x;*(ch_p++)=y;*(ch_p++)=z;*(ch_p++)=r;
}
#if VOROPP_REPORT_OUT_OF_BOUNDS ==1
else fprintf(stderr,"Out of bounds: (x,y,z)=(%g,%g,%g)\n",x,y,z);
#endif
}
/** Transfers the particles stored within the class to a container class.
* \param[in] con the container class to transfer to. */
void pre_container::setup(container &con) {
int **c_id=pre_id,*idp,*ide,n;
double **c_p=pre_p,*pp,x,y,z;
while(c_id<end_id) {
idp=*(c_id++);ide=idp+pre_container_chunk_size;
pp=*(c_p++);
while(idp<ide) {
n=*(idp++);x=*(pp++);y=*(pp++);z=*(pp++);
con.put(n,x,y,z);
}
}
idp=*c_id;
pp=*c_p;
while(idp<ch_id) {
n=*(idp++);x=*(pp++);y=*(pp++);z=*(pp++);
con.put(n,x,y,z);
}
}
/** Transfers the particles stored within the class to a container_poly class.
* \param[in] con the container_poly class to transfer to. */
void pre_container_poly::setup(container_poly &con) {
int **c_id=pre_id,*idp,*ide,n;
double **c_p=pre_p,*pp,x,y,z,r;
while(c_id<end_id) {
idp=*(c_id++);ide=idp+pre_container_chunk_size;
pp=*(c_p++);
while(idp<ide) {
n=*(idp++);x=*(pp++);y=*(pp++);z=*(pp++);r=*(pp++);
con.put(n,x,y,z,r);
}
}
idp=*c_id;
pp=*c_p;
while(idp<ch_id) {
n=*(idp++);x=*(pp++);y=*(pp++);z=*(pp++);r=*(pp++);
con.put(n,x,y,z,r);
}
}
/** Transfers the particles stored within the class to a container class, also
* recording the order in which particles were stored.
* \param[in] vo the ordering class to use.
* \param[in] con the container class to transfer to. */
void pre_container::setup(particle_order &vo,container &con) {
int **c_id=pre_id,*idp,*ide,n;
double **c_p=pre_p,*pp,x,y,z;
while(c_id<end_id) {
idp=*(c_id++);ide=idp+pre_container_chunk_size;
pp=*(c_p++);
while(idp<ide) {
n=*(idp++);x=*(pp++);y=*(pp++);z=*(pp++);
con.put(vo,n,x,y,z);
}
}
idp=*c_id;
pp=*c_p;
while(idp<ch_id) {
n=*(idp++);x=*(pp++);y=*(pp++);z=*(pp++);
con.put(vo,n,x,y,z);
}
}
/** Transfers the particles stored within the class to a container_poly class,
* also recording the order in which particles were stored.
* \param[in] vo the ordering class to use.
* \param[in] con the container_poly class to transfer to. */
void pre_container_poly::setup(particle_order &vo,container_poly &con) {
int **c_id=pre_id,*idp,*ide,n;
double **c_p=pre_p,*pp,x,y,z,r;
while(c_id<end_id) {
idp=*(c_id++);ide=idp+pre_container_chunk_size;
pp=*(c_p++);
while(idp<ide) {
n=*(idp++);x=*(pp++);y=*(pp++);z=*(pp++);r=*(pp++);
con.put(vo,n,x,y,z,r);
}
}
idp=*c_id;
pp=*c_p;
while(idp<ch_id) {
n=*(idp++);x=*(pp++);y=*(pp++);z=*(pp++);r=*(pp++);
con.put(vo,n,x,y,z,r);
}
}
/** Import a list of particles from an open file stream into the container.
* Entries of four numbers (Particle ID, x position, y position, z position)
* are searched for. If the file cannot be successfully read, then the routine
* causes a fatal error.
* \param[in] fp the file handle to read from. */
void pre_container::import(FILE *fp) {
int i,j;
double x,y,z;
while((j=fscanf(fp,"%d %lg %lg %lg",&i,&x,&y,&z))==4) put(i,x,y,z);
if(j!=EOF) voro_fatal_error("File import error",VOROPP_FILE_ERROR);
}
/** Import a list of particles from an open file stream, also storing the order
* of that the particles are read. Entries of four numbers (Particle ID, x
* position, y position, z position) are searched for. If the file cannot be
* successfully read, then the routine causes a fatal error.
* \param[in] fp the file handle to read from. */
void pre_container_poly::import(FILE *fp) {
int i,j;
double x,y,z,r;
while((j=fscanf(fp,"%d %lg %lg %lg %lg",&i,&x,&y,&z,&r))==5) put(i,x,y,z,r);
if(j!=EOF) voro_fatal_error("File import error",VOROPP_FILE_ERROR);
}
/** Allocates a new chunk of memory for storing particles. */
void pre_container_base::new_chunk() {
end_id++;end_p++;
if(end_id==l_id) extend_chunk_index();
ch_id=*end_id=new int[pre_container_chunk_size];
e_id=ch_id+pre_container_chunk_size;
ch_p=*end_p=new double[ps*pre_container_chunk_size];
}
/** Extends the index of chunks. */
void pre_container_base::extend_chunk_index() {
index_sz<<=1;
if(index_sz>max_chunk_size)
voro_fatal_error("Absolute memory limit on chunk index reached",VOROPP_MEMORY_ERROR);
#if VOROPP_VERBOSE >=2
fprintf(stderr,"Pre-container chunk index scaled up to %d\n",index_sz);
#endif
int **n_id=new int*[index_sz],**p_id=n_id,**c_id=pre_id;
double **n_p=new double*[index_sz],**p_p=n_p,**c_p=pre_p;
while(c_id<end_id) {
*(p_id++)=*(c_id++);
*(p_p++)=*(c_p++);
}
delete [] pre_id;pre_id=n_id;end_id=p_id;l_id=pre_id+index_sz;
delete [] pre_p;pre_p=n_p;end_p=p_p;
}
}

162
extern/voro++/src/pre_container.hh vendored Normal file
View File

@@ -0,0 +1,162 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file pre_container.hh
* \brief Header file for the pre_container and related classes. */
#ifndef VOROPP_PRE_CONTAINER_HH
#define VOROPP_PRE_CONTAINER_HH
#include <cstdio>
#include "c_loops.hh"
#include "container.hh"
namespace voro {
/** \brief A class for storing an arbitrary number of particles, prior to setting
* up a container geometry.
*
* The pre_container_base class can dynamically import and store an arbitrary
* number of particles. Once the particles have been read in, an appropriate
* container class can be set up with the optimal grid size, and the particles
* can be transferred.
*
* The pre_container_base class is not intended for direct use, but forms the
* base of the pre_container and pre_container_poly classes, that add routines
* depending on whether particle radii need to be tracked or not. */
class pre_container_base {
public:
/** The minimum x coordinate of the container. */
const double ax;
/** The maximum x coordinate of the container. */
const double bx;
/** The minimum y coordinate of the container. */
const double ay;
/** The maximum y coordinate of the container. */
const double by;
/** The minimum z coordinate of the container. */
const double az;
/** The maximum z coordinate of the container. */
const double bz;
/** A boolean value that determines if the x coordinate in
* periodic or not. */
const bool xperiodic;
/** A boolean value that determines if the y coordinate in
* periodic or not. */
const bool yperiodic;
/** A boolean value that determines if the z coordinate in
* periodic or not. */
const bool zperiodic;
void guess_optimal(int &nx,int &ny,int &nz);
pre_container_base(double ax_,double bx_,double ay_,double by_,double az_,double bz_,bool xperiodic_,bool yperiodic_,bool zperiodic_,int ps_);
~pre_container_base();
/** Calculates and returns the total number of particles stored
* within the class.
* \return The number of particles. */
inline int total_particles() {
return (end_id-pre_id)*pre_container_chunk_size+(ch_id-*end_id);
}
protected:
/** The number of doubles associated with a single particle
* (three for the standard container, four when radius
* information is stored). */
const int ps;
void new_chunk();
void extend_chunk_index();
/** The size of the chunk index. */
int index_sz;
/** A pointer to the chunk index to store the integer particle
* IDs. */
int **pre_id;
/** A pointer to the last allocated integer ID chunk. */
int **end_id;
/** A pointer to the end of the integer ID chunk index, used to
* determine when the chunk index is full. */
int **l_id;
/** A pointer to the next available slot on the current
* particle ID chunk. */
int *ch_id;
/** A pointer to the end of the current integer chunk. */
int *e_id;
/** A pointer to the chunk index to store the floating point
* information associated with particles. */
double **pre_p;
/** A pointer to the last allocated chunk of floating point
* information. */
double **end_p;
/** A pointer to the next available slot on the current
* floating point chunk. */
double *ch_p;
};
/** \brief A class for storing an arbitrary number of particles without radius
* information, prior to setting up a container geometry.
*
* The pre_container class is an extension of the pre_container_base class for
* cases when no particle radius information is available. */
class pre_container : public pre_container_base {
public:
/** The class constructor sets up the geometry of container,
* initializing the minimum and maximum coordinates in each
* direction.
* \param[in] (ax_,bx_) the minimum and maximum x coordinates.
* \param[in] (ay_,by_) the minimum and maximum y coordinates.
* \param[in] (az_,bz_) the minimum and maximum z coordinates.
* \param[in] (xperiodic_,yperiodic_,zperiodic_ ) flags setting whether the
* container is periodic in
* each coordinate direction. */
pre_container(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
bool xperiodic_,bool yperiodic_,bool zperiodic_)
: pre_container_base(ax_,bx_,ay_,by_,az_,bz_,xperiodic_,yperiodic_,zperiodic_,3) {};
void put(int n,double x,double y,double z);
void import(FILE *fp=stdin);
/** Imports particles from a file.
* \param[in] filename the name of the file to read from. */
inline void import(const char* filename) {
FILE *fp=safe_fopen(filename,"r");
import(fp);
fclose(fp);
}
void setup(container &con);
void setup(particle_order &vo,container &con);
};
/** \brief A class for storing an arbitrary number of particles with radius
* information, prior to setting up a container geometry.
*
* The pre_container_poly class is an extension of the pre_container_base class
* for cases when particle radius information is available. */
class pre_container_poly : public pre_container_base {
public:
/** The class constructor sets up the geometry of container,
* initializing the minimum and maximum coordinates in each
* direction.
* \param[in] (ax_,bx_) the minimum and maximum x coordinates.
* \param[in] (ay_,by_) the minimum and maximum y coordinates.
* \param[in] (az_,bz_) the minimum and maximum z coordinates.
* \param[in] (xperiodic_,yperiodic_,zperiodic_ ) flags setting whether the
* container is periodic in
* each coordinate direction. */
pre_container_poly(double ax_,double bx_,double ay_,double by_,double az_,double bz_,
bool xperiodic_,bool yperiodic_,bool zperiodic_)
: pre_container_base(ax_,bx_,ay_,by_,az_,bz_,xperiodic_,yperiodic_,zperiodic_,4) {};
void put(int n,double x,double y,double z,double r);
void import(FILE *fp=stdin);
/** Imports particles from a file.
* \param[in] filename the name of the file to read from. */
inline void import(const char* filename) {
FILE *fp=safe_fopen(filename,"r");
import(fp);
fclose(fp);
}
void setup(container_poly &con);
void setup(particle_order &vo,container_poly &con);
};
}
#endif

158
extern/voro++/src/rad_option.hh vendored Normal file
View File

@@ -0,0 +1,158 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file rad_option.hh
* \brief Header file for the classes encapsulating functionality for the
* regular and radical Voronoi tessellations. */
#ifndef VOROPP_RAD_OPTION_HH
#define VOROPP_RAD_OPTION_HH
#include <cmath>
namespace voro {
/** \brief Class containing all of the routines that are specific to computing
* the regular Voronoi tessellation.
*
* The container and container_periodic classes are derived from this class,
* and during the Voronoi cell computation, these routines are used to create
* the regular Voronoi tessellation. */
class radius_mono {
protected:
/** This is called prior to computing a Voronoi cell for a
* given particle to initialize any required constants.
* \param[in] ijk the block that the particle is within.
* \param[in] s the index of the particle within the block. */
inline void r_init(int ijk,int s) {}
/** Sets a required constant to be used when carrying out a
* plane bounds check. */
inline void r_prime(double rv) {}
/** Carries out a radius bounds check.
* \param[in] crs the radius squared to be tested.
* \param[in] mrs the current maximum distance to a Voronoi
* vertex multiplied by two.
* \return True if particles at this radius could not possibly
* cut the cell, false otherwise. */
inline bool r_ctest(double crs,double mrs) {return crs>mrs;}
/** Scales a plane displacement during a plane bounds check.
* \param[in] lrs the plane displacement.
* \return The scaled value. */
inline double r_cutoff(double lrs) {return lrs;}
/** Adds the maximum radius squared to a given value.
* \param[in] rs the value to consider.
* \return The value with the radius squared added. */
inline double r_max_add(double rs) {return rs;}
/** Subtracts the radius squared of a particle from a given
* value.
* \param[in] rs the value to consider.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within the block.
* \return The value with the radius squared subtracted. */
inline double r_current_sub(double rs,int ijk,int q) {return rs;}
/** Scales a plane displacement prior to use in the plane cutting
* algorithm.
* \param[in] rs the initial plane displacement.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within the block.
* \return The scaled plane displacement. */
inline double r_scale(double rs,int ijk,int q) {return rs;}
/** Scales a plane displacement prior to use in the plane
* cutting algorithm, and also checks if it could possibly cut
* the cell.
* \param[in,out] rs the plane displacement to be scaled.
* \param[in] mrs the current maximum distance to a Voronoi
* vertex multiplied by two.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within the block.
* \return True if the cell could possibly cut the cell, false
* otherwise. */
inline bool r_scale_check(double &rs,double mrs,int ijk,int q) {return rs<mrs;}
};
/** \brief Class containing all of the routines that are specific to computing
* the radical Voronoi tessellation.
*
* The container_poly and container_periodic_poly classes are derived from this
* class, and during the Voronoi cell computation, these routines are used to
* create the radical Voronoi tessellation. */
class radius_poly {
public:
/** A two-dimensional array holding particle positions and radii. */
double **ppr;
/** The current maximum radius of any particle, used to
* determine when to cut off the radical Voronoi computation.
* */
double max_radius;
/** The class constructor sets the maximum particle radius to
* be zero. */
radius_poly() : max_radius(0) {}
protected:
/** This is called prior to computing a Voronoi cell for a
* given particle to initialize any required constants.
* \param[in] ijk the block that the particle is within.
* \param[in] s the index of the particle within the block. */
inline void r_init(int ijk,int s) {
r_rad=ppr[ijk][4*s+3]*ppr[ijk][4*s+3];
r_mul=r_rad-max_radius*max_radius;
}
/** Sets a required constant to be used when carrying out a
* plane bounds check. */
inline void r_prime(double rv) {r_val=1+r_mul/rv;}
/** Carries out a radius bounds check.
* \param[in] crs the radius squared to be tested.
* \param[in] mrs the current maximum distance to a Voronoi
* vertex multiplied by two.
* \return True if particles at this radius could not possibly
* cut the cell, false otherwise. */
inline bool r_ctest(double crs,double mrs) {return crs+r_mul>sqrt(mrs*crs);}
/** Scales a plane displacement during a plane bounds check.
* \param[in] lrs the plane displacement.
* \return The scaled value. */
inline double r_cutoff(double lrs) {return lrs*r_val;}
/** Adds the maximum radius squared to a given value.
* \param[in] rs the value to consider.
* \return The value with the radius squared added. */
inline double r_max_add(double rs) {return rs+max_radius*max_radius;}
/** Subtracts the radius squared of a particle from a given
* value.
* \param[in] rs the value to consider.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within the block.
* \return The value with the radius squared subtracted. */
inline double r_current_sub(double rs,int ijk,int q) {
return rs-ppr[ijk][4*q+3]*ppr[ijk][4*q+3];
}
/** Scales a plane displacement prior to use in the plane cutting
* algorithm.
* \param[in] rs the initial plane displacement.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within the block.
* \return The scaled plane displacement. */
inline double r_scale(double rs,int ijk,int q) {
return rs+r_rad-ppr[ijk][4*q+3]*ppr[ijk][4*q+3];
}
/** Scales a plane displacement prior to use in the plane
* cutting algorithm, and also checks if it could possibly cut
* the cell.
* \param[in,out] rs the plane displacement to be scaled.
* \param[in] mrs the current maximum distance to a Voronoi
* vertex multiplied by two.
* \param[in] ijk the block that the particle is within.
* \param[in] q the index of the particle within the block.
* \return True if the cell could possibly cut the cell, false
* otherwise. */
inline bool r_scale_check(double &rs,double mrs,int ijk,int q) {
double trs=rs;
rs+=r_rad-ppr[ijk][4*q+3]*ppr[ijk][4*q+3];
return rs<sqrt(mrs*trs);
}
private:
double r_rad,r_mul,r_val;
};
}
#endif

231
extern/voro++/src/unitcell.cc vendored Normal file
View File

@@ -0,0 +1,231 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file unitcell.cc
* \brief Function implementations for the unitcell class. */
#include <cmath>
#include <queue>
#include "unitcell.hh"
#include "cell.hh"
namespace voro {
/** Initializes the unit cell class for a particular non-orthogonal periodic
* geometry, corresponding to a parallelepiped with sides given by three
* vectors. The class constructs the unit Voronoi cell corresponding to this
* geometry.
* \param[in] (bx_) The x coordinate of the first unit vector.
* \param[in] (bxy_,by_) The x and y coordinates of the second unit vector.
* \param[in] (bxz_,byz_,bz_) The x, y, and z coordinates of the third unit
* vector. */
unitcell::unitcell(double bx_,double bxy_,double by_,double bxz_,double byz_,double bz_)
: bx(bx_), bxy(bxy_), by(by_), bxz(bxz_), byz(byz_), bz(bz_) {
int i,j,l=1;
// Initialize the Voronoi cell to be a very large rectangular box
const double ucx=max_unit_voro_shells*bx,ucy=max_unit_voro_shells*by,ucz=max_unit_voro_shells*bz;
unit_voro.init(-ucx,ucx,-ucy,ucy,-ucz,ucz);
// Repeatedly cut the cell by shells of periodic image particles
while(l<2*max_unit_voro_shells) {
// Check to see if any of the planes from the current shell
// will cut the cell
if(unit_voro_intersect(l)) {
// If they do, apply the plane cuts from the current
// shell
unit_voro_apply(l,0,0);
for(i=1;i<l;i++) {
unit_voro_apply(l,i,0);
unit_voro_apply(-l,i,0);
}
for(i=-l;i<=l;i++) unit_voro_apply(i,l,0);
for(i=1;i<l;i++) for(j=-l+1;j<=l;j++) {
unit_voro_apply(l,j,i);
unit_voro_apply(-j,l,i);
unit_voro_apply(-l,-j,i);
unit_voro_apply(j,-l,i);
}
for(i=-l;i<=l;i++) for(j=-l;j<=l;j++) unit_voro_apply(i,j,l);
} else {
// Calculate a bound on the maximum y and z coordinates
// that could possibly cut the cell. This is based upon
// a geometric result that particles with z>l can't cut
// a cell lying within the paraboloid
// z<=(l*l-x*x-y*y)/(2*l). It is always a tighter bound
// than the one based on computing the maximum radius
// of a Voronoi cell vertex.
max_uv_y=max_uv_z=0;
double y,z,q,*pts=unit_voro.pts,*pp=pts;
while(pp<pts+3*unit_voro.p) {
q=*(pp++);y=*(pp++);z=*(pp++);q=sqrt(q*q+y*y+z*z);
if(y+q>max_uv_y) max_uv_y=y+q;
if(z+q>max_uv_z) max_uv_z=z+q;
}
max_uv_z*=0.5;
max_uv_y*=0.5;
return;
}
l++;
}
// If the routine makes it here, then the unit cell still hasn't been
// completely bounded by the plane cuts. Give the memory error code,
// because this is mainly a case of hitting a safe limit, than any
// inherent problem.
voro_fatal_error("Periodic cell computation failed",VOROPP_MEMORY_ERROR);
}
/** Applies a pair of opposing plane cuts from a periodic image point
* to the unit Voronoi cell.
* \param[in] (i,j,k) the index of the periodic image to consider. */
inline void unitcell::unit_voro_apply(int i,int j,int k) {
double x=i*bx+j*bxy+k*bxz,y=j*by+k*byz,z=k*bz;
unit_voro.plane(x,y,z);
unit_voro.plane(-x,-y,-z);
}
/** Calculates whether the unit Voronoi cell intersects a given periodic image
* of the domain.
* \param[in] (dx,dy,dz) the displacement of the periodic image.
* \param[out] vol the proportion of the unit cell volume within this image,
* only computed in the case that the two intersect.
* \return True if they intersect, false otherwise. */
bool unitcell::intersects_image(double dx,double dy,double dz,double &vol) {
const double bxinv=1/bx,byinv=1/by,bzinv=1/bz,ivol=bxinv*byinv*bzinv;
voronoicell c;
c=unit_voro;
dx*=2;dy*=2;dz*=2;
if(!c.plane(0,0,bzinv,dz+1)) return false;
if(!c.plane(0,0,-bzinv,-dz+1)) return false;
if(!c.plane(0,byinv,-byz*byinv*bzinv,dy+1)) return false;
if(!c.plane(0,-byinv,byz*byinv*bzinv,-dy+1)) return false;
if(!c.plane(bxinv,-bxy*bxinv*byinv,(bxy*byz-by*bxz)*ivol,dx+1)) return false;
if(!c.plane(-bxinv,bxy*bxinv*byinv,(-bxy*byz+by*bxz)*ivol,-dx+1)) return false;
vol=c.volume()*ivol;
return true;
}
/** Computes a list of periodic domain images that intersect the unit Voronoi cell.
* \param[out] vi a vector containing triplets (i,j,k) corresponding to domain
* images that intersect the unit Voronoi cell, when it is
* centered in the middle of the primary domain.
* \param[out] vd a vector containing the fraction of the Voronoi cell volume
* within each corresponding image listed in vi. */
void unitcell::images(std::vector<int> &vi,std::vector<double> &vd) {
const int ms2=max_unit_voro_shells*2+1,mss=ms2*ms2*ms2;
bool *a=new bool[mss],*ac=a+max_unit_voro_shells*(1+ms2*(1+ms2)),*ap=a;
int i,j,k;
double vol;
// Initialize mask
while(ap<ac) *(ap++)=true;
*(ap++)=false;
while(ap<a+mss) *(ap++)=true;
// Set up the queue and add (0,0,0) image to it
std::queue<int> q;
q.push(0);q.push(0);q.push(0);
while(!q.empty()) {
// Read the next entry on the queue
i=q.front();q.pop();
j=q.front();q.pop();
k=q.front();q.pop();
// Check intersection of this image
if(intersects_image(i,j,k,vol)) {
// Add this entry to the output vectors
vi.push_back(i);
vi.push_back(j);
vi.push_back(k);
vd.push_back(vol);
// Add neighbors to the queue if they have not been
// tested
ap=ac+i+ms2*(j+ms2*k);
if(k>-max_unit_voro_shells&&*(ap-ms2*ms2)) {q.push(i);q.push(j);q.push(k-1);*(ap-ms2*ms2)=false;}
if(j>-max_unit_voro_shells&&*(ap-ms2)) {q.push(i);q.push(j-1);q.push(k);*(ap-ms2)=false;}
if(i>-max_unit_voro_shells&&*(ap-1)) {q.push(i-1);q.push(j);q.push(k);*(ap-1)=false;}
if(i<max_unit_voro_shells&&*(ap+1)) {q.push(i+1);q.push(j);q.push(k);*(ap+1)=false;}
if(j<max_unit_voro_shells&&*(ap+ms2)) {q.push(i);q.push(j+1);q.push(k);*(ap+ms2)=false;}
if(k<max_unit_voro_shells&&*(ap+ms2*ms2)) {q.push(i);q.push(j);q.push(k+1);*(ap+ms2*ms2)=false;}
}
}
// Remove mask memory
delete [] a;
}
/** Tests to see if a shell of periodic images could possibly cut the periodic
* unit cell.
* \param[in] l the index of the shell to consider.
* \return True if a point in the shell cuts the cell, false otherwise. */
bool unitcell::unit_voro_intersect(int l) {
int i,j;
if(unit_voro_test(l,0,0)) return true;
for(i=1;i<l;i++) {
if(unit_voro_test(l,i,0)) return true;
if(unit_voro_test(-l,i,0)) return true;
}
for(i=-l;i<=l;i++) if(unit_voro_test(i,l,0)) return true;
for(i=1;i<l;i++) for(j=-l+1;j<=l;j++) {
if(unit_voro_test(l,j,i)) return true;
if(unit_voro_test(-j,l,i)) return true;
if(unit_voro_test(-l,-j,i)) return true;
if(unit_voro_test(j,-l,i)) return true;
}
for(i=-l;i<=l;i++) for(j=-l;j<=l;j++) if(unit_voro_test(i,j,l)) return true;
return false;
}
/** Tests to see if a plane cut from a particular periodic image will cut th
* unit Voronoi cell.
* \param[in] (i,j,k) the index of the periodic image to consider.
* \return True if the image cuts the cell, false otherwise. */
inline bool unitcell::unit_voro_test(int i,int j,int k) {
double x=i*bx+j*bxy+k*bxz,y=j*by+k*byz,z=k*bz;
double rsq=x*x+y*y+z*z;
return unit_voro.plane_intersects(x,y,z,rsq);
}
/** Draws the periodic domain in gnuplot format.
* \param[in] fp the file handle to write to. */
void unitcell::draw_domain_gnuplot(FILE *fp) {
fprintf(fp,"0 0 0\n%g 0 0\n%g %g 0\n%g %g 0\n",bx,bx+bxy,by,bxy,by);
fprintf(fp,"%g %g %g\n%g %g %g\n%g %g %g\n%g %g %g\n",bxy+bxz,by+byz,bz,bx+bxy+bxz,by+byz,bz,bx+bxz,byz,bz,bxz,byz,bz);
fprintf(fp,"0 0 0\n%g %g 0\n\n%g %g %g\n%g %g %g\n\n",bxy,by,bxz,byz,bz,bxy+bxz,by+byz,bz);
fprintf(fp,"%g 0 0\n%g %g %g\n\n%g %g 0\n%g %g %g\n\n",bx,bx+bxz,byz,bz,bx+bxy,by,bx+bxy+bxz,by+byz,bz);
}
/** Draws the periodic domain in POV-Ray format.
* \param[in] fp the file handle to write to. */
void unitcell::draw_domain_pov(FILE *fp) {
fprintf(fp,"cylinder{0,0,0>,<%g,0,0>,rr}\n"
"cylinder{<%g,%g,0>,<%g,%g,0>,rr}\n",bx,bxy,by,bx+bxy,by);
fprintf(fp,"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n"
"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n",bxz,byz,bz,bx+bxz,byz,bz,bxy+bxz,by+byz,bz,bx+bxy+bxz,by+byz,bz);
fprintf(fp,"cylinder{<0,0,0>,<%g,%g,0>,rr}\n"
"cylinder{<%g,0,0>,<%g,%g,0>,rr}\n",bxy,by,bx,bx+bxy,by);
fprintf(fp,"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n"
"cylinder{<%g,%g,%g>,<%g,%g,%g>,rr}\n",bxz,byz,bz,bxy+bxz,by+byz,bz,bx+bxz,byz,bz,bx+bxy+bxz,by+byz,bz);
fprintf(fp,"cylinder{<0,0,0>,<%g,%g,%g>,rr}\n"
"cylinder{<%g,0,0>,<%g,%g,%g>,rr}\n",bxz,byz,bz,bx,bx+bxz,byz,bz);
fprintf(fp,"cylinder{<%g,%g,0>,<%g,%g,%g>,rr}\n"
"cylinder{<%g,%g,0>,<%g,%g,%g>,rr}\n",bxy,by,bxy+bxz,by+byz,bz,bx+bxy,by,bx+bxy+bxz,by+byz,bz);
fprintf(fp,"sphere{<0,0,0>,rr}\nsphere{<%g,0,0>,rr}\n"
"sphere{<%g,%g,0>,rr}\nsphere{<%g,%g,0>,rr}\n",bx,bxy,by,bx+bxy,by);
fprintf(fp,"sphere{<%g,%g,%g>,rr}\nsphere{<%g,%g,%g>,rr}\n"
"sphere{<%g,%g,%g>,rr}\nsphere{<%g,%g,%g>,rr}\n",bxz,byz,bz,bx+bxz,byz,bz,bxy+bxz,by+byz,bz,bx+bxy+bxz,by+byz,bz);
}
}

79
extern/voro++/src/unitcell.hh vendored Normal file
View File

@@ -0,0 +1,79 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file unitcell.hh
* \brief Header file for the unitcell class. */
#ifndef VOROPP_UNITCELL_HH
#define VOROPP_UNITCELL_HH
#include <vector>
#include "config.hh"
#include "cell.hh"
namespace voro {
/** \brief Class for computation of the unit Voronoi cell associated with
* a 3D non-rectangular periodic domain. */
class unitcell {
public:
/** The x coordinate of the first vector defining the periodic
* domain. */
const double bx;
/** The x coordinate of the second vector defining the periodic
* domain. */
const double bxy;
/** The y coordinate of the second vector defining the periodic
* domain. */
const double by;
/** The x coordinate of the third vector defining the periodic
* domain. */
const double bxz;
/** The y coordinate of the third vector defining the periodic
* domain. */
const double byz;
/** The z coordinate of the third vector defining the periodic
* domain. */
const double bz;
/** The computed unit Voronoi cell corresponding the given
* 3D non-rectangular periodic domain geometry. */
voronoicell unit_voro;
unitcell(double bx_,double bxy_,double by_,double bxz_,double byz_,double bz_);
/** Draws an outline of the domain in Gnuplot format.
* \param[in] filename the filename to write to. */
inline void draw_domain_gnuplot(const char* filename) {
FILE *fp(safe_fopen(filename,"w"));
draw_domain_gnuplot(fp);
fclose(fp);
}
void draw_domain_gnuplot(FILE *fp=stdout);
/** Draws an outline of the domain in Gnuplot format.
* \param[in] filename the filename to write to. */
inline void draw_domain_pov(const char* filename) {
FILE *fp(safe_fopen(filename,"w"));
draw_domain_pov(fp);
fclose(fp);
}
void draw_domain_pov(FILE *fp=stdout);
bool intersects_image(double dx,double dy,double dz,double &vol);
void images(std::vector<int> &vi,std::vector<double> &vd);
protected:
/** The maximum y-coordinate that could possibly cut the
* computed unit Voronoi cell. */
double max_uv_y;
/** The maximum z-coordinate that could possibly cut the
* computed unit Voronoi cell. */
double max_uv_z;
private:
inline void unit_voro_apply(int i,int j,int k);
bool unit_voro_intersect(int l);
inline bool unit_voro_test(int i,int j,int k);
};
}
#endif

118
extern/voro++/src/v_base.cc vendored Normal file
View File

@@ -0,0 +1,118 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file v_base.cc
* \brief Function implementations for the base Voronoi container class. */
#include "v_base.hh"
#include "config.hh"
namespace voro {
/** This function is called during container construction. The routine scans
* all of the worklists in the wl[] array. For a given worklist of blocks
* labeled \f$w_1\f$ to \f$w_n\f$, it computes a sequence \f$r_0\f$ to
* \f$r_n\f$ so that $r_i$ is the minimum distance to all the blocks
* \f$w_{j}\f$ where \f$j>i\f$ and all blocks outside the worklist. The values
* of \f$r_n\f$ is calculated first, as the minimum distance to any block in
* the shell surrounding the worklist. The \f$r_i\f$ are then computed in
* reverse order by considering the distance to \f$w_{i+1}\f$. */
voro_base::voro_base(int nx_,int ny_,int nz_,double boxx_,double boxy_,double boxz_) :
nx(nx_), ny(ny_), nz(nz_), nxy(nx_*ny_), nxyz(nxy*nz_), boxx(boxx_), boxy(boxy_), boxz(boxz_),
xsp(1/boxx_), ysp(1/boxy_), zsp(1/boxz_), mrad(new double[wl_hgridcu*wl_seq_length]) {
const unsigned int b1=1<<21,b2=1<<22,b3=1<<24,b4=1<<25,b5=1<<27,b6=1<<28;
const double xstep=boxx/wl_fgrid,ystep=boxy/wl_fgrid,zstep=boxz/wl_fgrid;
int i,j,k,lx,ly,lz,q;
unsigned int f,*e=const_cast<unsigned int*> (wl);
double xlo,ylo,zlo,xhi,yhi,zhi,minr,*radp=mrad;
for(zlo=0,zhi=zstep,lz=0;lz<wl_hgrid;zlo=zhi,zhi+=zstep,lz++) {
for(ylo=0,yhi=ystep,ly=0;ly<wl_hgrid;ylo=yhi,yhi+=ystep,ly++) {
for(xlo=0,xhi=xstep,lx=0;lx<wl_hgrid;xlo=xhi,xhi+=xstep,lx++) {
minr=large_number;
for(q=e[0]+1;q<wl_seq_length;q++) {
f=e[q];
i=(f&127)-64;
j=(f>>7&127)-64;
k=(f>>14&127)-64;
if((f&b2)==b2) {
compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i-1,j,k);
if((f&b1)==0) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i+1,j,k);
} else if((f&b1)==b1) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i+1,j,k);
if((f&b4)==b4) {
compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j-1,k);
if((f&b3)==0) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j+1,k);
} else if((f&b3)==b3) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j+1,k);
if((f&b6)==b6) {
compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j,k-1);
if((f&b5)==0) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j,k+1);
} else if((f&b5)==b5) compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j,k+1);
}
q--;
while(q>0) {
radp[q]=minr;
f=e[q];
i=(f&127)-64;
j=(f>>7&127)-64;
k=(f>>14&127)-64;
compute_minimum(minr,xlo,xhi,ylo,yhi,zlo,zhi,i,j,k);
q--;
}
*radp=minr;
e+=wl_seq_length;
radp+=wl_seq_length;
}
}
}
}
/** Computes the minimum distance from a subregion to a given block. If this distance
* is smaller than the value of minr, then it passes
* \param[in,out] minr a pointer to the current minimum distance. If the distance
* computed in this function is smaller, then this distance is
* set to the new one.
* \param[out] (xlo,ylo,zlo) the lower coordinates of the subregion being
* considered.
* \param[out] (xhi,yhi,zhi) the upper coordinates of the subregion being
* considered.
* \param[in] (ti,tj,tk) the coordinates of the block. */
void voro_base::compute_minimum(double &minr,double &xlo,double &xhi,double &ylo,double &yhi,double &zlo,double &zhi,int ti,int tj,int tk) {
double radsq,temp;
if(ti>0) {temp=boxx*ti-xhi;radsq=temp*temp;}
else if(ti<0) {temp=xlo-boxx*(1+ti);radsq=temp*temp;}
else radsq=0;
if(tj>0) {temp=boxy*tj-yhi;radsq+=temp*temp;}
else if(tj<0) {temp=ylo-boxy*(1+tj);radsq+=temp*temp;}
if(tk>0) {temp=boxz*tk-zhi;radsq+=temp*temp;}
else if(tk<0) {temp=zlo-boxz*(1+tk);radsq+=temp*temp;}
if(radsq<minr) minr=radsq;
}
/** Checks to see whether "%n" appears in a format sequence to determine
* whether neighbor information is required or not.
* \param[in] format the format string to check.
* \return True if a "%n" is found, false otherwise. */
bool voro_base::contains_neighbor(const char *format) {
char *fmp=(const_cast<char*>(format));
// Check to see if "%n" appears in the format sequence
while(*fmp!=0) {
if(*fmp=='%') {
fmp++;
if(*fmp=='n') return true;
else if(*fmp==0) return false;
}
fmp++;
}
return false;
}
#include "v_base_wl.cc"
}

88
extern/voro++/src/v_base.hh vendored Normal file
View File

@@ -0,0 +1,88 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file v_base.hh
* \brief Header file for the base Voronoi container class. */
#ifndef VOROPP_V_BASE_HH
#define VOROPP_V_BASE_HH
#include "worklist.hh"
namespace voro {
/** \brief Class containing data structures common across all particle container classes.
*
* This class contains constants and data structures that are common across all
* particle container classes. It contains constants setting the size of the
* underlying subgrid of blocks that forms the basis of the Voronoi cell
* computations. It also constructs bound tables that are used in the Voronoi
* cell computation, and contains a number of routines that are common across
* all container classes. */
class voro_base {
public:
/** The number of blocks in the x direction. */
const int nx;
/** The number of blocks in the y direction. */
const int ny;
/** The number of blocks in the z direction. */
const int nz;
/** A constant, set to the value of nx multiplied by ny, which
* is used in the routines that step through blocks in
* sequence. */
const int nxy;
/** A constant, set to the value of nx*ny*nz, which is used in
* the routines that step through blocks in sequence. */
const int nxyz;
/** The size of a computational block in the x direction. */
const double boxx;
/** The size of a computational block in the y direction. */
const double boxy;
/** The size of a computational block in the z direction. */
const double boxz;
/** The inverse box length in the x direction. */
const double xsp;
/** The inverse box length in the y direction. */
const double ysp;
/** The inverse box length in the z direction. */
const double zsp;
/** An array to hold the minimum distances associated with the
* worklists. This array is initialized during container
* construction, by the initialize_radii() routine. */
double *mrad;
/** The pre-computed block worklists. */
static const unsigned int wl[wl_seq_length*wl_hgridcu];
bool contains_neighbor(const char* format);
voro_base(int nx_,int ny_,int nz_,double boxx_,double boxy_,double boxz_);
~voro_base() {delete [] mrad;}
protected:
/** A custom int function that returns consistent stepping
* for negative numbers, so that (-1.5, -0.5, 0.5, 1.5) maps
* to (-2,-1,0,1).
* \param[in] a the number to consider.
* \return The value of the custom int operation. */
inline int step_int(double a) {return a<0?int(a)-1:int(a);}
/** A custom modulo function that returns consistent stepping
* for negative numbers. For example, (-2,-1,0,1,2) step_mod 2
* is (0,1,0,1,0).
* \param[in] (a,b) the input integers.
* \return The value of a modulo b, consistent for negative
* numbers. */
inline int step_mod(int a,int b) {return a>=0?a%b:b-1-(b-1-a)%b;}
/** A custom integer division function that returns consistent
* stepping for negative numbers. For example, (-2,-1,0,1,2)
* step_div 2 is (-1,-1,0,0,1).
* \param[in] (a,b) the input integers.
* \return The value of a div b, consistent for negative
* numbers. */
inline int step_div(int a,int b) {return a>=0?a/b:-1+(a+1)/b;}
private:
void compute_minimum(double &minr,double &xlo,double &xhi,double &ylo,double &yhi,double &zlo,double &zhi,int ti,int tj,int tk);
};
}
#endif

79
extern/voro++/src/v_base_wl.cc vendored Normal file
View File

@@ -0,0 +1,79 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file v_base_wl.cc
* \brief The table of block worklists that are used during the cell
* computation, which is part of the voro_base class.
*
* This file is automatically generated by worklist_gen.pl and it is not
* intended to be edited by hand. */
const unsigned int voro_base::wl[wl_seq_length*wl_hgridcu]={
7,0x10203f,0x101fc0,0xfe040,0xfe03f,0x101fbf,0xfdfc0,0xfdfbf,0x10fe0bf,0x11020bf,0x11020c0,0x10fe0c0,0x2fe041,0x302041,0x301fc1,0x2fdfc1,0x8105fc0,0x8106040,0x810603f,0x8105fbf,0x701fbe,0x70203e,0x6fe03e,0x6fdfbe,0x30fdf3f,0x3101f3f,0x3101f40,0x30fdf40,0x180f9fc0,0x180fa040,0x180fa03f,0x180f9fbf,0x12fe0c1,0x13020c1,0x91060c0,0x91060bf,0x8306041,0x8305fc1,0x3301f41,0x32fdf41,0x182f9fc1,0x182fa041,0x190fa0c0,0x190fa0bf,0x16fe0be,0x17020be,0x870603e,0x8705fbe,0xb105f3f,0xb105f40,0x3701f3e,0x36fdf3e,0x186f9fbe,0x186fa03e,0x1b0f9f3f,0x1b0f9f40,0x93060c1,0x192fa0c1,0x97060be,0xb305f41,0x1b2f9f41,0x196fa0be,0xb705f3e,0x1b6f9f3e,
11,0x101fc0,0xfe040,0xfdfc0,0x10203f,0x101fbf,0xfe03f,0xfdfbf,0xfdfc1,0x101fc1,0x102041,0xfe041,0x10fe0c0,0x11020c0,0x8106040,0x8105fc0,0x8105fbf,0x810603f,0x11020bf,0x10fe0bf,0x180fa040,0x180f9fc0,0x30fdf40,0x3101f40,0x3101f3f,0x30fdf3f,0x180f9fbf,0x180fa03f,0x6fe03e,0x70203e,0x701fbe,0x6fdfbe,0x8105fc1,0x8106041,0x11020c1,0x10fe0c1,0x180fa041,0x180f9fc1,0x30fdf41,0x3101f41,0x91060c0,0x91060bf,0x190fa0c0,0x190fa0bf,0xb105f40,0xb105f3f,0x8705fbe,0x870603e,0x97020be,0x16fe0be,0x1b0f9f40,0x1b0f9f3f,0x36fdf3e,0xb701f3e,0x1b6f9fbe,0x196fa03e,0x93060c1,0xb305f41,0x192fa0c1,0x1b2f9f41,0x1b2fdfc2,0xb301fc2,0x9302042,0x192fe042,
11,0x101fc0,0xfe040,0xfdfc0,0xfdfbf,0x101fbf,0x10203f,0xfe03f,0xfe041,0x102041,0x101fc1,0xfdfc1,0x8105fc0,0x8106040,0x11020c0,0x10fe0c0,0x10fe0bf,0x11020bf,0x810603f,0x8105fbf,0x3101f40,0x30fdf40,0x180f9fc0,0x180fa040,0x180fa03f,0x180f9fbf,0x30fdf3f,0x3101f3f,0x8105fc1,0x8106041,0x11020c1,0x10fe0c1,0x180fa041,0x180f9fc1,0x30fdf41,0x3101f41,0x701fbe,0x70203e,0x6fe03e,0x6fdfbe,0x91060c0,0x91060bf,0xb105f40,0xb105f3f,0x190fa0c0,0x190fa0bf,0x93060c1,0x1b0f9f40,0x1b0f9f3f,0xb305f41,0x192fa0c1,0x16fe0be,0x17020be,0x970603e,0x8705fbe,0xb701f3e,0x36fdf3e,0x1b2f9f41,0x1b2fdfc2,0x192fe042,0x9302042,0xb301fc2,0x1b6f9fbe,0x196fa03e,
11,0x101fc0,0xfe040,0xfdfc0,0xfdfbf,0x101fbf,0x10203f,0xfe03f,0xfe041,0x102041,0x101fc1,0xfdfc1,0x8105fc0,0x8106040,0x11020c0,0x10fe0c0,0x10fe0bf,0x11020bf,0x810603f,0x8105fbf,0x3101f40,0x30fdf40,0x180f9fc0,0x180fa040,0x10fe0c1,0x11020c1,0x8106041,0x8105fc1,0x3101f3f,0x30fdf3f,0x180f9fbf,0x180fa03f,0x180fa041,0x180f9fc1,0x30fdf41,0x3101f41,0x91060c0,0x91060bf,0x70203e,0x701fbe,0x6fdfbe,0x6fe03e,0x190fa0c0,0xb105f40,0xb105f3f,0x93060c1,0x190fa0bf,0x192fa0c1,0x1b0f9f40,0x1b0f9f3f,0xb305f41,0xb301fc2,0x9302042,0x192fe042,0x1b2fdfc2,0x1b2f9f41,0x16fe0be,0x17020be,0x970603e,0x8705fbe,0xb701f3e,0x36fdf3e,0x1b6f9fbe,0x196fa03e,
11,0x10203f,0xfe040,0xfe03f,0x101fc0,0x101fbf,0xfdfc0,0xfdfbf,0xfe0bf,0x1020bf,0x1020c0,0xfe0c0,0x2fe041,0x302041,0x8106040,0x810603f,0x8105fbf,0x8105fc0,0x301fc1,0x2fdfc1,0x180fa040,0x180fa03f,0x6fe03e,0x70203e,0x701fbe,0x6fdfbe,0x180f9fbf,0x180f9fc0,0x30fdf40,0x3101f40,0x3101f3f,0x30fdf3f,0x81060bf,0x81060c0,0x3020c1,0x2fe0c1,0x180fa0c0,0x180fa0bf,0x6fe0be,0x7020be,0x8306041,0x8305fc1,0x182fa041,0x182f9fc1,0x870603e,0x8705fbe,0xb105f3f,0xb105f40,0xb301f41,0x32fdf41,0x186fa03e,0x186f9fbe,0x36fdf3e,0xb701f3e,0x1b6f9f3f,0x1b2f9f40,0x93060c1,0x97060be,0x192fa0c1,0x196fa0be,0x196fe13f,0x970213f,0x9302140,0x192fe140,
9,0xfe040,0x10203f,0x101fc0,0xfdfc0,0xfe03f,0xfdfbf,0x101fbf,0x102041,0xfe041,0x10fe0c0,0x11020c0,0x11020bf,0x10fe0bf,0xfdfc1,0x101fc1,0x8106040,0x810603f,0x8105fc0,0x8105fbf,0x180fa040,0x180f9fc0,0x180fa03f,0x180f9fbf,0x10fe0c1,0x11020c1,0x70203e,0x6fe03e,0x6fdfbe,0x701fbe,0x3101f3f,0x3101f40,0x30fdf40,0x30fdf3f,0x8106041,0x91060c0,0x91060bf,0x8305fc1,0x180fa041,0x190fa0c0,0x190fa0bf,0x180f9fc1,0x30fdf41,0x3301f41,0x17020be,0x16fe0be,0x93060c1,0x870603e,0x8705fbe,0xb105f3f,0xb105f40,0x192fa0c1,0x1b0f9f40,0x1b0f9f3f,0x186f9fbe,0x196fa03e,0x1b6fdf3e,0xb701f3e,0x97060be,0xb305f41,0x1b2f9f41,0x1b2fdfc2,0x192fe042,0xa302042,
11,0xfe040,0x101fc0,0xfdfc0,0xfe03f,0x10203f,0x101fbf,0xfdfbf,0xfe041,0x102041,0x101fc1,0xfdfc1,0x10fe0c0,0x11020c0,0x11020bf,0x10fe0bf,0x8106040,0x8105fc0,0x810603f,0x8105fbf,0x11020c1,0x10fe0c1,0x180fa040,0x180f9fc0,0x180fa03f,0x180f9fbf,0x30fdf40,0x3101f40,0x8106041,0x8105fc1,0x3101f3f,0x30fdf3f,0x91060c0,0x91060bf,0x180fa041,0x180f9fc1,0x6fe03e,0x70203e,0x701fbe,0x6fdfbe,0x190fa0c0,0x190fa0bf,0x30fdf41,0x3101f41,0x93060c1,0x192fa0c1,0xb105f40,0xb105f3f,0x17020be,0x16fe0be,0x970603e,0x8705fbe,0x1b0f9f40,0x1b0f9f3f,0x186f9fbe,0x196fa03e,0xb305f41,0xb301fc2,0x9302042,0x192fe042,0x1b2fdfc2,0x1b2f9f41,0x1b6fdf3e,0xb701f3e,
11,0xfe040,0x101fc0,0xfdfc0,0xfe03f,0x10203f,0x101fbf,0xfdfbf,0xfe041,0x102041,0x101fc1,0xfdfc1,0x10fe0c0,0x11020c0,0x11020bf,0x10fe0bf,0x8106040,0x8105fc0,0x11020c1,0x10fe0c1,0x810603f,0x8105fbf,0x180fa040,0x180f9fc0,0x8106041,0x8105fc1,0x3101f40,0x180fa03f,0x180f9fbf,0x30fdf40,0x180fa041,0x180f9fc1,0x91060c0,0x3101f3f,0x30fdf3f,0x30fdf41,0x3101f41,0x91060bf,0x190fa0c0,0x91060c1,0x190fa0bf,0x186fe03e,0x70203e,0x3701fbe,0x1b6fdfbe,0x190fa0c1,0x182fe042,0xb105f40,0xb105f3f,0x302042,0x3301fc2,0x1b2fdfc2,0x1b0f9f40,0x1b6f9f3f,0xb105f41,0x17020be,0x196fe0be,0x970603e,0xb705fbe,0x1b2f9f41,0x192fe0c2,0x13020c2,0x9306042,0xb305fc2,
11,0x10203f,0xfe040,0xfe03f,0xfdfbf,0x101fbf,0x101fc0,0xfdfc0,0xfe0c0,0x1020c0,0x1020bf,0xfe0bf,0x810603f,0x8106040,0x302041,0x2fe041,0x2fdfc1,0x301fc1,0x8105fc0,0x8105fbf,0x70203e,0x6fe03e,0x180fa03f,0x180fa040,0x180f9fc0,0x180f9fbf,0x6fdfbe,0x701fbe,0x81060bf,0x81060c0,0x3020c1,0x2fe0c1,0x180fa0c0,0x180fa0bf,0x6fe0be,0x7020be,0x3101f3f,0x3101f40,0x30fdf40,0x30fdf3f,0x8306041,0x8305fc1,0x870603e,0x8705fbe,0x182fa041,0x182f9fc1,0x93060c1,0x186fa03e,0x186f9fbe,0x97060be,0x192fa0c1,0x32fdf41,0x3301f41,0xb305f40,0xb105f3f,0xb701f3e,0x36fdf3e,0x196fa0be,0x196fe13f,0x192fe140,0x9302140,0x970213f,0x1b6f9f3f,0x1b2f9f40,
11,0xfe040,0x10203f,0xfe03f,0xfdfc0,0x101fc0,0x101fbf,0xfdfbf,0xfe0c0,0x1020c0,0x1020bf,0xfe0bf,0x2fe041,0x302041,0x301fc1,0x2fdfc1,0x8106040,0x810603f,0x8105fc0,0x8105fbf,0x3020c1,0x2fe0c1,0x180fa040,0x180fa03f,0x180f9fc0,0x180f9fbf,0x6fe03e,0x70203e,0x81060c0,0x81060bf,0x701fbe,0x6fdfbe,0x8306041,0x8305fc1,0x180fa0c0,0x180fa0bf,0x30fdf40,0x3101f40,0x3101f3f,0x30fdf3f,0x182fa041,0x182f9fc1,0x6fe0be,0x7020be,0x93060c1,0x192fa0c1,0x870603e,0x8705fbe,0x3301f41,0x32fdf41,0xb305f40,0xb105f3f,0x186fa03e,0x186f9fbe,0x1b0f9f3f,0x1b2f9f40,0x97060be,0x970213f,0x9302140,0x192fe140,0x196fe13f,0x196fa0be,0x1b6fdf3e,0xb701f3e,
15,0xfe040,0xfe03f,0x10203f,0x101fc0,0xfdfc0,0xfdfbf,0x101fbf,0x102041,0xfe041,0xfe0c0,0x1020c0,0x1020bf,0xfe0bf,0xfdfc1,0x101fc1,0x8106040,0x1020c1,0xfe0c1,0x810603f,0x8105fc0,0x8105fbf,0x180fa040,0x180fa03f,0x180f9fc0,0x180f9fbf,0x8106041,0x81060c0,0x81060bf,0x8105fc1,0x180fa041,0x180fa0c0,0x180fa0bf,0x6fe03e,0x70203e,0x3101f40,0x30fdf40,0x180f9fc1,0x30fdf3f,0x3101f3f,0x3701fbe,0x36fdfbe,0x93060c1,0x192fa0c1,0x6fe0be,0x7020be,0x3101f41,0x30fdf41,0xb305f40,0xb105f3f,0x970603e,0xb705fbe,0x196fa03e,0x186f9fbe,0x1b2f9f40,0x1b6f9f3f,0x192fe042,0x9302042,0xb301fc2,0x1b2fdfc2,0x192fe140,0x9302140,0x970213f,0x196fe13f,
15,0xfe040,0xfdfc0,0x101fc0,0x10203f,0xfe03f,0xfdfbf,0x101fbf,0x102041,0xfe041,0xfdfc1,0x101fc1,0x1020c0,0xfe0c0,0xfe0bf,0x1020bf,0x1020c1,0xfe0c1,0x8106040,0x8105fc0,0x810603f,0x8105fbf,0x180fa040,0x180f9fc0,0x8106041,0x8105fc1,0x81060c0,0x180fa03f,0x180f9fbf,0x180fa041,0x180f9fc1,0x180fa0c0,0x81060bf,0x91060c1,0x3101f40,0x30fdf40,0x30fdf3f,0x180fa0bf,0x190fa0c1,0x3101f3f,0x3101f41,0x30fdf41,0x186fe03e,0x70203e,0x3701fbe,0x1b6fdfbe,0x186fe0be,0x7020be,0x8302042,0x182fe042,0x1b2fdfc2,0xb301fc2,0xb105f40,0xb705f3f,0xb305f41,0x1b2f9f40,0x1b6f9f3f,0x192fe140,0x9302140,0x93020c2,0x192fe0c2,0x196fe13f,0x970213f,0xa70603e,
11,0x10203f,0xfe040,0xfe03f,0xfdfbf,0x101fbf,0x101fc0,0xfdfc0,0xfe0c0,0x1020c0,0x1020bf,0xfe0bf,0x810603f,0x8106040,0x302041,0x2fe041,0x2fdfc1,0x301fc1,0x8105fc0,0x8105fbf,0x70203e,0x6fe03e,0x180fa03f,0x180fa040,0x2fe0c1,0x3020c1,0x81060c0,0x81060bf,0x701fbe,0x6fdfbe,0x180f9fbf,0x180f9fc0,0x180fa0c0,0x180fa0bf,0x6fe0be,0x7020be,0x8306041,0x8305fc1,0x3101f40,0x3101f3f,0x30fdf3f,0x30fdf40,0x182fa041,0x870603e,0x8705fbe,0x93060c1,0x182f9fc1,0x192fa0c1,0x186fa03e,0x186f9fbe,0x97060be,0x970213f,0x9302140,0x192fe140,0x196fe13f,0x196fa0be,0x32fdf41,0x3301f41,0xb305f40,0xb105f3f,0xb701f3e,0x36fdf3e,0x1b6f9f3f,0x1b2f9f40,
11,0xfe040,0x10203f,0xfe03f,0xfdfc0,0x101fc0,0x101fbf,0xfdfbf,0xfe0c0,0x1020c0,0x1020bf,0xfe0bf,0x2fe041,0x302041,0x301fc1,0x2fdfc1,0x8106040,0x810603f,0x3020c1,0x2fe0c1,0x8105fc0,0x8105fbf,0x180fa040,0x180fa03f,0x81060c0,0x81060bf,0x70203e,0x180f9fc0,0x180f9fbf,0x6fe03e,0x180fa0c0,0x180fa0bf,0x8306041,0x701fbe,0x6fdfbe,0x6fe0be,0x7020be,0x8305fc1,0x182fa041,0x83060c1,0x182f9fc1,0x1b0fdf40,0x3101f40,0x3701f3f,0x1b6fdf3f,0x182fa0c1,0x190fe140,0x870603e,0x8705fbe,0x1102140,0x170213f,0x196fe13f,0x186fa03e,0x1b6f9fbe,0x87060be,0x3301f41,0x1b2fdf41,0xb305f40,0xb705f3f,0x196fa0be,0x192fe141,0x1302141,0x9306140,0x970613f,
15,0xfe040,0xfe03f,0x10203f,0x101fc0,0xfdfc0,0xfdfbf,0x101fbf,0x1020c0,0xfe0c0,0xfe0bf,0x1020bf,0x102041,0xfe041,0xfdfc1,0x101fc1,0x1020c1,0xfe0c1,0x8106040,0x810603f,0x8105fc0,0x8105fbf,0x180fa040,0x180fa03f,0x81060c0,0x81060bf,0x8106041,0x180f9fc0,0x180f9fbf,0x180fa0c0,0x180fa0bf,0x180fa041,0x8105fc1,0x83060c1,0x70203e,0x6fe03e,0x6fdfbe,0x180f9fc1,0x182fa0c1,0x701fbe,0x7020be,0x6fe0be,0x1b0fdf40,0x3101f40,0x3701f3f,0x1b6fdf3f,0x1b0fdf41,0x3101f41,0x9102140,0x190fe140,0x196fe13f,0x970213f,0x870603e,0xb705fbe,0x97060be,0x196fa03e,0x1b6f9fbe,0x192fe042,0x9302042,0x9302141,0x192fe141,0x1b2fdfc2,0xb301fc2,0xb505f40,
17,0xfe040,0xfe03f,0x10203f,0x101fc0,0xfdfc0,0xfe041,0x102041,0x1020c0,0xfe0c0,0xfdfbf,0x101fbf,0x1020bf,0xfe0bf,0xfdfc1,0x101fc1,0x1020c1,0xfe0c1,0x8106040,0x810603f,0x8105fc0,0x8106041,0x81060c0,0x180fa040,0x180fa03f,0x180f9fc0,0x8105fbf,0x81060bf,0x8105fc1,0x180fa041,0x180fa0c0,0x180f9fbf,0x81060c1,0x180fa0bf,0x180f9fc1,0x180fa0c1,0x186fe03e,0x70203e,0x3101f40,0x1b0fdf40,0x1b0fdf3f,0x3101f3f,0x3701fbe,0x1b6fdfbe,0x186fe0be,0x7020be,0x9102140,0x190fe140,0x182fe042,0x8302042,0x3101f41,0x1b0fdf41,0x1b2fdfc2,0xb301fc2,0x83020c2,0x182fe0c2,0x196fe13f,0x970213f,0x9302141,0x192fe141,0x970603e,0xb305f40,0xb105f3f,0xb705fbe,
11,0x10203f,0x101fc0,0x101fbf,0xfe040,0xfe03f,0xfdfc0,0xfdfbf,0x105fbf,0x10603f,0x106040,0x105fc0,0x301fc1,0x302041,0x11020c0,0x11020bf,0x10fe0bf,0x10fe0c0,0x2fe041,0x2fdfc1,0x3101f40,0x3101f3f,0x701fbe,0x70203e,0x6fe03e,0x6fdfbe,0x30fdf3f,0x30fdf40,0x180f9fc0,0x180fa040,0x180fa03f,0x180f9fbf,0x11060bf,0x11060c0,0x306041,0x305fc1,0x3105f40,0x3105f3f,0x705fbe,0x70603e,0x13020c1,0x12fe0c1,0x3301f41,0x32fdf41,0x17020be,0x16fe0be,0x190fa0bf,0x190fa0c0,0x192fa041,0x182f9fc1,0x3701f3e,0x36fdf3e,0x186f9fbe,0x196fa03e,0x1b6f9f3f,0x1b2f9f40,0x93060c1,0x97060be,0xb305f41,0xb705f3e,0xb709fbf,0x970a03f,0x930a040,0xb309fc0,
9,0x101fc0,0x10203f,0xfe040,0xfdfc0,0x101fbf,0xfdfbf,0xfe03f,0x102041,0x101fc1,0x8105fc0,0x8106040,0x810603f,0x8105fbf,0xfdfc1,0xfe041,0x11020c0,0x11020bf,0x10fe0c0,0x10fe0bf,0x3101f40,0x30fdf40,0x3101f3f,0x30fdf3f,0x8105fc1,0x8106041,0x70203e,0x701fbe,0x6fdfbe,0x6fe03e,0x180fa03f,0x180fa040,0x180f9fc0,0x180f9fbf,0x11020c1,0x91060c0,0x91060bf,0x12fe0c1,0x3101f41,0xb105f40,0xb105f3f,0x30fdf41,0x180f9fc1,0x182fa041,0x870603e,0x8705fbe,0x93060c1,0x17020be,0x16fe0be,0x190fa0bf,0x190fa0c0,0xb305f41,0x1b0f9f40,0x1b0f9f3f,0x36fdf3e,0xb701f3e,0x1b6f9fbe,0x196fa03e,0x97060be,0x192fa0c1,0x1b2f9f41,0x1b2fdfc2,0xb301fc2,0x11302042,
11,0x101fc0,0xfe040,0xfdfc0,0x101fbf,0x10203f,0xfe03f,0xfdfbf,0x101fc1,0x102041,0xfe041,0xfdfc1,0x8105fc0,0x8106040,0x810603f,0x8105fbf,0x11020c0,0x10fe0c0,0x11020bf,0x10fe0bf,0x8106041,0x8105fc1,0x3101f40,0x30fdf40,0x3101f3f,0x30fdf3f,0x180f9fc0,0x180fa040,0x11020c1,0x10fe0c1,0x180fa03f,0x180f9fbf,0x91060c0,0x91060bf,0x3101f41,0x30fdf41,0x701fbe,0x70203e,0x6fe03e,0x6fdfbe,0xb105f40,0xb105f3f,0x180f9fc1,0x180fa041,0x93060c1,0xb305f41,0x190fa0c0,0x190fa0bf,0x870603e,0x8705fbe,0x97020be,0x16fe0be,0x1b0f9f40,0x1b0f9f3f,0x36fdf3e,0xb701f3e,0x192fa0c1,0x192fe042,0x9302042,0xb301fc2,0x1b2fdfc2,0x1b2f9f41,0x1b6f9fbe,0x196fa03e,
11,0x101fc0,0xfe040,0xfdfc0,0x101fbf,0x10203f,0xfe03f,0xfdfbf,0x101fc1,0x102041,0xfe041,0xfdfc1,0x8105fc0,0x8106040,0x810603f,0x8105fbf,0x11020c0,0x10fe0c0,0x8106041,0x8105fc1,0x11020bf,0x10fe0bf,0x3101f40,0x30fdf40,0x11020c1,0x10fe0c1,0x180fa040,0x3101f3f,0x30fdf3f,0x180f9fc0,0x3101f41,0x30fdf41,0x91060c0,0x180fa03f,0x180f9fbf,0x180f9fc1,0x180fa041,0x91060bf,0xb105f40,0x91060c1,0xb105f3f,0x3701fbe,0x70203e,0x186fe03e,0x1b6fdfbe,0xb105f41,0x3301fc2,0x190fa0c0,0x190fa0bf,0x302042,0x182fe042,0x1b2fdfc2,0x1b0f9f40,0x1b6f9f3f,0x190fa0c1,0x870603e,0xb705fbe,0x97020be,0x196fe0be,0x1b2f9f41,0xb305fc2,0x8306042,0x93020c2,0x192fe0c2,
9,0x10203f,0x101fc0,0xfe040,0xfe03f,0x101fbf,0xfdfbf,0xfdfc0,0x1020c0,0x1020bf,0x810603f,0x8106040,0x8105fc0,0x8105fbf,0xfe0bf,0xfe0c0,0x302041,0x301fc1,0x2fe041,0x2fdfc1,0x70203e,0x6fe03e,0x701fbe,0x6fdfbe,0x81060bf,0x81060c0,0x3101f40,0x3101f3f,0x30fdf3f,0x30fdf40,0x180f9fc0,0x180fa040,0x180fa03f,0x180f9fbf,0x3020c1,0x8306041,0x8305fc1,0x12fe0c1,0x7020be,0x870603e,0x8705fbe,0x6fe0be,0x180fa0bf,0x190fa0c0,0xb105f40,0xb105f3f,0x93060c1,0x3301f41,0x32fdf41,0x182f9fc1,0x182fa041,0x97060be,0x186fa03e,0x186f9fbe,0x36fdf3e,0xb701f3e,0x1b6f9f3f,0x1b2f9f40,0xb305f41,0x192fa0c1,0x196fa0be,0x196fe13f,0x970213f,0x11302140,
7,0x10203f,0x101fc0,0xfe040,0xfe03f,0x101fbf,0xfdfc0,0xfdfbf,0x302041,0x1020c0,0x8106040,0x810603f,0x1020bf,0xfe0c0,0x2fe041,0x301fc1,0x8105fc0,0x8105fbf,0xfe0bf,0x2fdfc1,0x3020c1,0x8306041,0x81060c0,0x81060bf,0x2fe0c1,0x8305fc1,0x3101f40,0x3101f3f,0x701fbe,0x70203e,0x6fe03e,0x180fa03f,0x180fa040,0x180f9fc0,0x30fdf40,0x30fdf3f,0x6fdfbe,0x180f9fbf,0x180fa0c0,0x182fa041,0x93060c1,0x870603e,0x7020be,0x6fe0be,0x180fa0bf,0x182f9fc1,0x32fdf41,0x3301f41,0xb105f40,0xb105f3f,0x8705fbe,0x97060be,0x192fa0c1,0xb305f41,0xb701f3e,0x36fdf3e,0x1b0f9f3f,0x1b2f9f40,0x1b6f9fbe,0x196fa03e,0x196fe13f,0x9302140,0x970213f,0x192fe140,
11,0x101fc0,0xfe040,0xfdfc0,0x10203f,0x101fbf,0xfe03f,0xfdfbf,0x102041,0x101fc1,0xfe041,0xfdfc1,0x11020c0,0x8106040,0x8105fc0,0x10fe0c0,0x11020bf,0x810603f,0x8105fbf,0x10fe0bf,0x11020c1,0x8106041,0x8105fc1,0x10fe0c1,0x91060c0,0x91060bf,0x3101f40,0x30fdf40,0x180f9fc0,0x180fa040,0x180fa03f,0x180f9fbf,0x30fdf3f,0x3101f3f,0x701fbe,0x70203e,0x6fe03e,0x6fdfbe,0x93060c1,0x3101f41,0x30fdf41,0x180f9fc1,0x180fa041,0x190fa0c0,0x190fa0bf,0xb105f40,0xb105f3f,0x8705fbe,0x870603e,0x17020be,0x16fe0be,0x192fa0c1,0xb305f41,0xb301fc2,0x9302042,0x192fe042,0x1b2fdfc2,0x1b2f9f40,0x1b0f9f3f,0x186f9fbe,0x196fa03e,0x97060be,0xb701f3e,0x1b6fdf3e,
11,0x101fc0,0xfe040,0xfdfc0,0x10203f,0x101fbf,0xfe03f,0xfdfbf,0x102041,0x101fc1,0xfe041,0xfdfc1,0x11020c0,0x8106040,0x8105fc0,0x10fe0c0,0x11020bf,0x810603f,0x8105fbf,0x10fe0bf,0x11020c1,0x8106041,0x8105fc1,0x10fe0c1,0x91060c0,0x91060bf,0x3101f40,0x30fdf40,0x180f9fc0,0x180fa040,0x180fa03f,0x180f9fbf,0x30fdf3f,0x3101f3f,0x3101f41,0x91060c1,0x180fa041,0x180f9fc1,0x30fdf41,0xb105f40,0x70203e,0x3701fbe,0x186fe03e,0x1b6fdfbe,0x190fa0c0,0x190fa0bf,0x190fa0c1,0xb105f3f,0xb105f41,0x3301fc2,0x302042,0x182fe042,0x1b2fdfc2,0x1b0f9f40,0x17020be,0x970603e,0xb705fbe,0x196fe0be,0x1b6f9f3f,0x1b2f9f41,0x13020c2,0x9306042,0xb305fc2,0x192fe0c2,
11,0x10203f,0xfe040,0xfe03f,0x101fbf,0x101fc0,0xfdfc0,0xfdfbf,0x1020bf,0x1020c0,0xfe0c0,0xfe0bf,0x810603f,0x8106040,0x8105fc0,0x8105fbf,0x302041,0x2fe041,0x301fc1,0x2fdfc1,0x81060c0,0x81060bf,0x70203e,0x6fe03e,0x701fbe,0x6fdfbe,0x180fa03f,0x180fa040,0x3020c1,0x2fe0c1,0x180f9fc0,0x180f9fbf,0x8306041,0x8305fc1,0x7020be,0x6fe0be,0x3101f3f,0x3101f40,0x30fdf40,0x30fdf3f,0x870603e,0x8705fbe,0x180fa0bf,0x180fa0c0,0x93060c1,0x97060be,0x182fa041,0x182f9fc1,0xb105f40,0xb105f3f,0xb301f41,0x32fdf41,0x186fa03e,0x186f9fbe,0x36fdf3e,0xb701f3e,0x192fa0c1,0x192fe140,0x9302140,0x970213f,0x196fe13f,0x196fa0be,0x1b6f9f3f,0x1b2f9f40,
11,0x10203f,0xfe040,0xfe03f,0x101fc0,0x101fbf,0xfdfc0,0xfdfbf,0x1020c0,0x1020bf,0xfe0c0,0xfe0bf,0x302041,0x8106040,0x810603f,0x2fe041,0x301fc1,0x8105fc0,0x8105fbf,0x2fdfc1,0x3020c1,0x81060c0,0x81060bf,0x2fe0c1,0x8306041,0x8305fc1,0x70203e,0x6fe03e,0x180fa03f,0x180fa040,0x180f9fc0,0x180f9fbf,0x6fdfbe,0x701fbe,0x3101f3f,0x3101f40,0x30fdf40,0x30fdf3f,0x93060c1,0x7020be,0x6fe0be,0x180fa0bf,0x180fa0c0,0x182fa041,0x182f9fc1,0x870603e,0x8705fbe,0xb105f3f,0xb105f40,0x3301f41,0x32fdf41,0x192fa0c1,0x97060be,0x970213f,0x9302140,0x192fe140,0x196fe13f,0x196fa03e,0x186f9fbe,0x1b0f9f3f,0x1b2f9f40,0xb305f41,0xb701f3e,0x1b6fdf3e,
15,0xfe040,0x10203f,0x101fc0,0xfdfc0,0xfe03f,0x101fbf,0xfdfbf,0x102041,0x1020c0,0xfe0c0,0xfe041,0x101fc1,0xfdfc1,0x1020bf,0xfe0bf,0x8106040,0x810603f,0x8105fc0,0x8105fbf,0x1020c1,0xfe0c1,0x8106041,0x81060c0,0x81060bf,0x8105fc1,0x180fa040,0x180f9fc0,0x180fa03f,0x180f9fbf,0x93060c1,0x70203e,0x6fe03e,0x3101f40,0x1b0fdf40,0x3101f3f,0x3701fbe,0x6fdfbe,0x1b6fdf3f,0x180fa041,0x180fa0c0,0x180fa0bf,0x180f9fc1,0x1b0fdf41,0x3101f41,0x7020be,0x6fe0be,0x870603e,0x8705fbe,0xb105f40,0xb705f3f,0x192fa0c1,0x192fe140,0x9302140,0x970213f,0x97060be,0x9302042,0x192fe042,0xb301fc2,0xb305f41,0x1b2fdfc2,0x196fe13f,0x196fa03e,0x1b6f9fbe,
14,0xfe040,0x101fc0,0xfdfc0,0x10203f,0xfe03f,0x101fbf,0xfdfbf,0x102041,0xfe041,0x101fc1,0xfdfc1,0x1020c0,0xfe0c0,0x1020bf,0x8106040,0xfe0bf,0x8105fc0,0x1020c1,0xfe0c1,0x810603f,0x8105fbf,0x8106041,0x8105fc1,0x81060c0,0x81060bf,0x91060c1,0x180fa040,0x180f9fc0,0x180fa03f,0x180f9fbf,0x180fa041,0x180f9fc1,0x1b0fdf40,0x3101f40,0x3101f3f,0x1b0fdf3f,0x180fa0c0,0x190fa0bf,0x186fe03e,0x70203e,0x3701fbe,0x3101f41,0x1b0fdf41,0x1b6fdfbe,0x190fa0c1,0x182fe042,0x302042,0xb105f40,0xb105f3f,0x3301fc2,0x1b2fdfc2,0x7020be,0x196fe0be,0x970603e,0xb705fbe,0xb105f41,0x9302140,0x192fe140,0x13020c2,0x192fe0c2,0x9306042,0xb305fc2,0x1170213f,
11,0x10203f,0xfe040,0xfe03f,0x101fbf,0x101fc0,0xfdfc0,0xfdfbf,0x1020bf,0x1020c0,0xfe0c0,0xfe0bf,0x810603f,0x8106040,0x8105fc0,0x8105fbf,0x302041,0x2fe041,0x81060c0,0x81060bf,0x301fc1,0x2fdfc1,0x70203e,0x6fe03e,0x3020c1,0x2fe0c1,0x180fa040,0x701fbe,0x6fdfbe,0x180fa03f,0x7020be,0x6fe0be,0x8306041,0x180f9fc0,0x180f9fbf,0x180fa0bf,0x180fa0c0,0x8305fc1,0x870603e,0x83060c1,0x8705fbe,0x3701f3f,0x3101f40,0x1b0fdf40,0x1b6fdf3f,0x87060be,0x170213f,0x182fa041,0x182f9fc1,0x1102140,0x190fe140,0x196fe13f,0x186fa03e,0x1b6f9fbe,0x182fa0c1,0xb105f40,0xb705f3f,0xb301f41,0x1b2fdf41,0x196fa0be,0x970613f,0x9106140,0x9302141,0x192fe141,
11,0x10203f,0xfe040,0xfe03f,0x101fc0,0x101fbf,0xfdfc0,0xfdfbf,0x1020c0,0x1020bf,0xfe0c0,0xfe0bf,0x302041,0x8106040,0x810603f,0x2fe041,0x301fc1,0x8105fc0,0x8105fbf,0x2fdfc1,0x3020c1,0x81060c0,0x81060bf,0x2fe0c1,0x8306041,0x8305fc1,0x70203e,0x6fe03e,0x180fa03f,0x180fa040,0x180f9fc0,0x180f9fbf,0x6fdfbe,0x701fbe,0x7020be,0x83060c1,0x180fa0c0,0x180fa0bf,0x6fe0be,0x870603e,0x3101f40,0x3701f3f,0x1b0fdf40,0x1b6fdf3f,0x182fa041,0x182f9fc1,0x182fa0c1,0x8705fbe,0x87060be,0x170213f,0x1102140,0x190fe140,0x196fe13f,0x186fa03e,0x3301f41,0xb305f40,0xb705f3f,0x1b2fdf41,0x1b6f9fbe,0x196fa0be,0x1302141,0x9306140,0x970613f,0x192fe141,
14,0xfe040,0x10203f,0xfe03f,0x101fc0,0xfdfc0,0x101fbf,0xfdfbf,0x1020c0,0xfe0c0,0x1020bf,0xfe0bf,0x102041,0xfe041,0x101fc1,0x8106040,0xfdfc1,0x810603f,0x1020c1,0xfe0c1,0x8105fc0,0x8105fbf,0x81060c0,0x81060bf,0x8106041,0x8105fc1,0x83060c1,0x180fa040,0x180fa03f,0x180f9fc0,0x180f9fbf,0x180fa0c0,0x180fa0bf,0x186fe03e,0x70203e,0x701fbe,0x186fdfbe,0x180fa041,0x182f9fc1,0x1b0fdf40,0x3101f40,0x3701f3f,0x7020be,0x186fe0be,0x1b6fdf3f,0x182fa0c1,0x190fe140,0x1102140,0x870603e,0x8705fbe,0x170213f,0x196fe13f,0x3101f41,0x1b2fdf41,0xb305f40,0xb705f3f,0x87060be,0x9302042,0x192fe042,0x1302141,0x192fe141,0x9306140,0x970613f,0x13301fc2,
17,0xfe040,0x10203f,0x101fc0,0xfdfc0,0xfe03f,0x1020c0,0x102041,0xfe041,0xfe0c0,0x101fbf,0xfdfbf,0x1020bf,0xfe0bf,0x101fc1,0xfdfc1,0x1020c1,0xfe0c1,0x8106040,0x810603f,0x8105fc0,0x8106041,0x81060c0,0x8105fbf,0x81060bf,0x8105fc1,0x81060c1,0x180fa040,0x180f9fc0,0x180fa03f,0x180fa0c0,0x180fa041,0x180f9fbf,0x180fa0bf,0x180f9fc1,0x180fa0c1,0x70203e,0x186fe03e,0x3101f40,0x1b0fdf40,0x3101f3f,0x3701fbe,0x186fdfbe,0x1b6fdf3f,0x3101f41,0x1b0fdf41,0x8302042,0x182fe042,0x9102140,0x7020be,0x186fe0be,0x190fe140,0x970213f,0x196fe13f,0x9102141,0xb301fc2,0x1b2fdfc2,0x93020c2,0x182fe0c2,0x192fe141,0x970603e,0xb305f40,0xb105f3f,0xb705fbe,
11,0x10203f,0x101fc0,0x101fbf,0xfdfbf,0xfe03f,0xfe040,0xfdfc0,0x105fc0,0x106040,0x10603f,0x105fbf,0x11020bf,0x11020c0,0x302041,0x301fc1,0x2fdfc1,0x2fe041,0x10fe0c0,0x10fe0bf,0x70203e,0x701fbe,0x3101f3f,0x3101f40,0x30fdf40,0x30fdf3f,0x6fdfbe,0x6fe03e,0x11060bf,0x11060c0,0x306041,0x305fc1,0x3105f40,0x3105f3f,0x705fbe,0x70603e,0x180fa03f,0x180fa040,0x180f9fc0,0x180f9fbf,0x13020c1,0x12fe0c1,0x17020be,0x16fe0be,0x3301f41,0x32fdf41,0x93060c1,0x3701f3e,0x36fdf3e,0x97060be,0xb305f41,0x182f9fc1,0x182fa041,0x192fa0c0,0x190fa0bf,0x196fa03e,0x186f9fbe,0xb705f3e,0xb709fbf,0xb309fc0,0x930a040,0x970a03f,0x1b6f9f3f,0x1b2f9f40,
11,0x101fc0,0x10203f,0x101fbf,0xfdfc0,0xfe040,0xfe03f,0xfdfbf,0x105fc0,0x106040,0x10603f,0x105fbf,0x301fc1,0x302041,0x2fe041,0x2fdfc1,0x11020c0,0x11020bf,0x10fe0c0,0x10fe0bf,0x306041,0x305fc1,0x3101f40,0x3101f3f,0x30fdf40,0x30fdf3f,0x701fbe,0x70203e,0x11060c0,0x11060bf,0x6fe03e,0x6fdfbe,0x13020c1,0x12fe0c1,0x3105f40,0x3105f3f,0x180f9fc0,0x180fa040,0x180fa03f,0x180f9fbf,0x3301f41,0x32fdf41,0x705fbe,0x70603e,0x93060c1,0xb305f41,0x17020be,0x16fe0be,0x182fa041,0x182f9fc1,0x192fa0c0,0x190fa0bf,0x3701f3e,0x36fdf3e,0x1b0f9f3f,0x1b2f9f40,0x97060be,0x970a03f,0x930a040,0xb309fc0,0xb709fbf,0xb705f3e,0x1b6f9fbe,0x196fa03e,
15,0x101fc0,0x101fbf,0x10203f,0xfe040,0xfdfc0,0xfdfbf,0xfe03f,0x102041,0x101fc1,0x105fc0,0x106040,0x10603f,0x105fbf,0xfdfc1,0xfe041,0x11020c0,0x106041,0x105fc1,0x11020bf,0x10fe0c0,0x10fe0bf,0x3101f40,0x3101f3f,0x30fdf40,0x30fdf3f,0x11020c1,0x11060c0,0x11060bf,0x10fe0c1,0x3101f41,0x3105f40,0x3105f3f,0x701fbe,0x70203e,0x180fa040,0x180f9fc0,0x30fdf41,0x180f9fbf,0x180fa03f,0x186fe03e,0x186fdfbe,0x93060c1,0xb305f41,0x705fbe,0x70603e,0x180fa041,0x180f9fc1,0x192fa0c0,0x190fa0bf,0x97020be,0x196fe0be,0xb701f3e,0x36fdf3e,0x1b2f9f40,0x1b6f9f3f,0xb301fc2,0x9302042,0x192fe042,0x1b2fdfc2,0xb309fc0,0x930a040,0x970a03f,0xb709fbf,
15,0x101fc0,0xfdfc0,0xfe040,0x10203f,0x101fbf,0xfdfbf,0xfe03f,0x102041,0x101fc1,0xfdfc1,0xfe041,0x106040,0x105fc0,0x105fbf,0x10603f,0x106041,0x105fc1,0x11020c0,0x10fe0c0,0x11020bf,0x10fe0bf,0x3101f40,0x30fdf40,0x11020c1,0x10fe0c1,0x11060c0,0x3101f3f,0x30fdf3f,0x3101f41,0x30fdf41,0x3105f40,0x11060bf,0x91060c1,0x180fa040,0x180f9fc0,0x180f9fbf,0x3105f3f,0xb105f41,0x180fa03f,0x180fa041,0x180f9fc1,0x3701fbe,0x70203e,0x186fe03e,0x1b6fdfbe,0x3705fbe,0x70603e,0x1302042,0x3301fc2,0x1b2fdfc2,0x192fe042,0x190fa0c0,0x196fa0bf,0x192fa0c1,0x1b2f9f40,0x1b6f9f3f,0xb309fc0,0x930a040,0x9306042,0xb305fc2,0xb709fbf,0x970a03f,0x117020be,
11,0x10203f,0x101fc0,0x101fbf,0xfe03f,0xfe040,0xfdfc0,0xfdfbf,0x10603f,0x106040,0x105fc0,0x105fbf,0x11020bf,0x11020c0,0x10fe0c0,0x10fe0bf,0x302041,0x301fc1,0x2fe041,0x2fdfc1,0x11060c0,0x11060bf,0x70203e,0x701fbe,0x6fe03e,0x6fdfbe,0x3101f3f,0x3101f40,0x306041,0x305fc1,0x30fdf40,0x30fdf3f,0x13020c1,0x12fe0c1,0x70603e,0x705fbe,0x180fa03f,0x180fa040,0x180f9fc0,0x180f9fbf,0x17020be,0x16fe0be,0x3105f3f,0x3105f40,0x93060c1,0x97060be,0x3301f41,0x32fdf41,0x190fa0c0,0x190fa0bf,0x192fa041,0x182f9fc1,0x3701f3e,0x36fdf3e,0x186f9fbe,0x196fa03e,0xb305f41,0xb309fc0,0x930a040,0x970a03f,0xb709fbf,0xb705f3e,0x1b6f9f3f,0x1b2f9f40,
11,0x10203f,0x101fc0,0x101fbf,0xfe040,0xfe03f,0xfdfc0,0xfdfbf,0x106040,0x10603f,0x105fc0,0x105fbf,0x302041,0x11020c0,0x11020bf,0x301fc1,0x2fe041,0x10fe0c0,0x10fe0bf,0x2fdfc1,0x306041,0x11060c0,0x11060bf,0x305fc1,0x13020c1,0x12fe0c1,0x70203e,0x701fbe,0x3101f3f,0x3101f40,0x30fdf40,0x30fdf3f,0x6fdfbe,0x6fe03e,0x180fa03f,0x180fa040,0x180f9fc0,0x180f9fbf,0x93060c1,0x70603e,0x705fbe,0x3105f3f,0x3105f40,0x3301f41,0x32fdf41,0x17020be,0x16fe0be,0x190fa0bf,0x190fa0c0,0x182fa041,0x182f9fc1,0xb305f41,0x97060be,0x970a03f,0x930a040,0xb309fc0,0xb709fbf,0xb701f3e,0x36fdf3e,0x1b0f9f3f,0x1b2f9f40,0x192fa0c1,0x196fa03e,0x1b6f9fbe,
15,0x101fc0,0x10203f,0xfe040,0xfdfc0,0x101fbf,0xfe03f,0xfdfbf,0x102041,0x106040,0x105fc0,0x101fc1,0xfe041,0xfdfc1,0x10603f,0x105fbf,0x11020c0,0x11020bf,0x10fe0c0,0x10fe0bf,0x106041,0x105fc1,0x11020c1,0x11060c0,0x11060bf,0x10fe0c1,0x3101f40,0x30fdf40,0x3101f3f,0x30fdf3f,0x93060c1,0x70203e,0x701fbe,0x180fa040,0x1b0f9fc0,0x180fa03f,0x186fe03e,0x6fdfbe,0x1b6f9fbf,0x3101f41,0x3105f40,0x3105f3f,0x30fdf41,0x1b0f9fc1,0x180fa041,0x70603e,0x705fbe,0x17020be,0x16fe0be,0x190fa0c0,0x196fa0bf,0xb305f41,0xb309fc0,0x930a040,0x970a03f,0x97060be,0x9302042,0xb301fc2,0x192fe042,0x192fa0c1,0x1b2fdfc2,0xb709fbf,0xb701f3e,0x1b6fdf3e,
14,0x101fc0,0xfe040,0xfdfc0,0x10203f,0x101fbf,0xfe03f,0xfdfbf,0x102041,0x101fc1,0xfe041,0xfdfc1,0x106040,0x105fc0,0x10603f,0x11020c0,0x105fbf,0x10fe0c0,0x106041,0x105fc1,0x11020bf,0x10fe0bf,0x11020c1,0x10fe0c1,0x11060c0,0x11060bf,0x91060c1,0x3101f40,0x30fdf40,0x3101f3f,0x30fdf3f,0x3101f41,0x30fdf41,0x1b0f9fc0,0x180fa040,0x180fa03f,0x1b0f9fbf,0x3105f40,0xb105f3f,0x3701fbe,0x70203e,0x186fe03e,0x180fa041,0x1b0f9fc1,0x1b6fdfbe,0xb105f41,0x3301fc2,0x302042,0x190fa0c0,0x190fa0bf,0x182fe042,0x1b2fdfc2,0x70603e,0xb705fbe,0x97020be,0x196fe0be,0x190fa0c1,0x930a040,0xb309fc0,0x8306042,0xb305fc2,0x93020c2,0x192fe0c2,0xa70a03f,
15,0x10203f,0x101fbf,0x101fc0,0xfe040,0xfe03f,0xfdfbf,0xfdfc0,0x1020c0,0x1020bf,0x10603f,0x106040,0x105fc0,0x105fbf,0xfe0bf,0xfe0c0,0x302041,0x1060c0,0x1060bf,0x301fc1,0x2fe041,0x2fdfc1,0x70203e,0x701fbe,0x6fe03e,0x6fdfbe,0x3020c1,0x306041,0x305fc1,0x2fe0c1,0x7020be,0x70603e,0x705fbe,0x3101f3f,0x3101f40,0x180fa040,0x180fa03f,0x6fe0be,0x180f9fbf,0x180f9fc0,0x1b0fdf40,0x1b0fdf3f,0x93060c1,0x97060be,0x3105f3f,0x3105f40,0x180fa0c0,0x180fa0bf,0x192fa041,0x182f9fc1,0xb301f41,0x1b2fdf41,0xb701f3e,0x36fdf3e,0x196fa03e,0x1b6f9fbe,0x970213f,0x9302140,0x192fe140,0x196fe13f,0x970a03f,0x930a040,0xb309fc0,0xb709fbf,
15,0x10203f,0x101fc0,0xfe040,0xfe03f,0x101fbf,0xfdfc0,0xfdfbf,0x1020c0,0x106040,0x10603f,0x1020bf,0xfe0c0,0xfe0bf,0x105fc0,0x105fbf,0x302041,0x301fc1,0x2fe041,0x2fdfc1,0x1060c0,0x1060bf,0x3020c1,0x306041,0x305fc1,0x2fe0c1,0x70203e,0x6fe03e,0x701fbe,0x6fdfbe,0x93060c1,0x3101f40,0x3101f3f,0x180fa040,0x186fa03f,0x180f9fc0,0x1b0fdf40,0x30fdf3f,0x1b6f9fbf,0x7020be,0x70603e,0x705fbe,0x6fe0be,0x186fa0bf,0x180fa0c0,0x3105f40,0x3105f3f,0x3301f41,0x32fdf41,0x182fa041,0x1b2f9fc1,0x97060be,0x970a03f,0x930a040,0xb309fc0,0xb305f41,0x9302140,0x970213f,0x192fe140,0x192fa0c1,0x196fe13f,0xb709fbf,0xb701f3e,0x1b6fdf3e,
16,0x10203f,0x101fc0,0xfe040,0xfe03f,0x101fbf,0xfdfc0,0xfdfbf,0x102041,0x1020c0,0x106040,0x10603f,0x1020bf,0xfe0c0,0xfe041,0x101fc1,0x105fc0,0x105fbf,0xfe0bf,0xfdfc1,0x1020c1,0x106041,0x1060c0,0x1060bf,0xfe0c1,0x105fc1,0x93060c1,0x70203e,0x3101f40,0x180fa040,0x180fa03f,0x186fe03e,0x701fbe,0x3701f3f,0x30fdf40,0x1b0f9fc0,0x180f9fbf,0x186fdfbe,0x1b6fdf3f,0x3101f41,0x3105f40,0xb105f3f,0x70603e,0x7020be,0x6fe0be,0x180fa0c0,0x180fa041,0x182f9fc1,0x1b2fdf41,0xb705fbe,0x186fa0bf,0x192fa0c1,0x97060be,0xb305f41,0x9302042,0x192fe042,0x13301fc2,0x930a040,0x970a03f,0xb509fc0,0x9302140,0x970213f,0x192fe140,0x196fe13f,
15,0x101fc0,0xfe040,0xfdfc0,0x10203f,0x101fbf,0xfe03f,0x102041,0x101fc1,0xfdfbf,0xfe041,0x1020c0,0x106040,0xfdfc1,0x105fc0,0xfe0c0,0x1020bf,0x10603f,0x105fbf,0xfe0bf,0x1020c1,0x106041,0x105fc1,0xfe0c1,0x1060c0,0x11060bf,0x91060c1,0x3101f40,0x180fa040,0x180f9fc0,0x1b0fdf40,0x3101f3f,0x30fdf3f,0x180fa03f,0x1b0f9fbf,0x180fa041,0x180f9fc1,0x3101f41,0x1b0fdf41,0x70203e,0x3701fbe,0x186fe03e,0x1b6fdfbe,0x3105f40,0xb105f3f,0x180fa0c0,0x190fa0bf,0x192fa0c1,0x302042,0x3301fc2,0xb305f41,0x182fe042,0x1b2fdfc2,0x17020be,0x170603e,0xb705fbe,0x196fe0be,0x9502140,0x194fe140,0x193020c2,0xa306042,0x930a040,0xb309fc0,0xa70a03f,
15,0x10203f,0xfe03f,0xfe040,0x101fc0,0x101fbf,0xfdfbf,0xfdfc0,0x1020c0,0x1020bf,0xfe0bf,0xfe0c0,0x106040,0x10603f,0x105fbf,0x105fc0,0x1060c0,0x1060bf,0x302041,0x2fe041,0x301fc1,0x2fdfc1,0x70203e,0x6fe03e,0x3020c1,0x2fe0c1,0x306041,0x701fbe,0x6fdfbe,0x7020be,0x6fe0be,0x70603e,0x305fc1,0x83060c1,0x180fa040,0x180fa03f,0x180f9fbf,0x705fbe,0x87060be,0x180f9fc0,0x180fa0c0,0x180fa0bf,0x3701f3f,0x3101f40,0x1b0fdf40,0x1b6fdf3f,0x3705f3f,0x3105f40,0x1302140,0x170213f,0x196fe13f,0x192fe140,0x182fa041,0x1b2f9fc1,0x192fa0c1,0x196fa03e,0x1b6f9fbe,0x970a03f,0x930a040,0x9306140,0x970613f,0xb709fbf,0xb309fc0,0x13301f41,
14,0x10203f,0xfe040,0xfe03f,0x101fc0,0x101fbf,0xfdfc0,0xfdfbf,0x1020c0,0x1020bf,0xfe0c0,0xfe0bf,0x106040,0x10603f,0x105fc0,0x302041,0x105fbf,0x2fe041,0x1060c0,0x1060bf,0x301fc1,0x2fdfc1,0x3020c1,0x2fe0c1,0x306041,0x305fc1,0x83060c1,0x70203e,0x6fe03e,0x701fbe,0x6fdfbe,0x7020be,0x6fe0be,0x186fa03f,0x180fa040,0x180f9fc0,0x186f9fbf,0x70603e,0x8705fbe,0x3701f3f,0x3101f40,0x1b0fdf40,0x180fa0c0,0x186fa0bf,0x1b6fdf3f,0x87060be,0x170213f,0x1102140,0x182fa041,0x182f9fc1,0x190fe140,0x196fe13f,0x3105f40,0xb705f3f,0xb301f41,0x1b2fdf41,0x182fa0c1,0x930a040,0x970a03f,0x9106140,0x970613f,0x9302141,0x192fe141,0xb509fc0,
15,0x10203f,0xfe040,0xfe03f,0x101fc0,0x101fbf,0xfdfc0,0x1020c0,0x1020bf,0xfdfbf,0xfe0c0,0x102041,0x106040,0xfe0bf,0x10603f,0xfe041,0x101fc1,0x105fc0,0x105fbf,0xfdfc1,0x1020c1,0x1060c0,0x1060bf,0xfe0c1,0x106041,0x305fc1,0x83060c1,0x70203e,0x180fa040,0x180fa03f,0x186fe03e,0x701fbe,0x6fdfbe,0x180f9fc0,0x186f9fbf,0x180fa0c0,0x180fa0bf,0x7020be,0x186fe0be,0x3101f40,0x3701f3f,0x1b0fdf40,0x1b6fdf3f,0x70603e,0x8705fbe,0x180fa041,0x182f9fc1,0x192fa0c1,0x1102140,0x170213f,0x97060be,0x190fe140,0x196fe13f,0x3301f41,0x3305f40,0xb705f3f,0x1b2fdf41,0xa302042,0x1a2fe042,0x19302141,0x9506140,0x930a040,0x970a03f,0xb509fc0,
17,0xfe040,0x10203f,0x101fc0,0xfdfc0,0xfe03f,0x1020c0,0x102041,0x101fbf,0xfe041,0xfe0c0,0x106040,0xfdfbf,0x1020bf,0x101fc1,0xfdfc1,0xfe0bf,0x1020c1,0x10603f,0x105fc0,0xfe0c1,0x1060c0,0x106041,0x8105fbf,0x81060bf,0x8105fc1,0x81060c1,0x180fa040,0x180f9fc0,0x180fa03f,0x180fa0c0,0x180fa041,0x180f9fbf,0x70203e,0x186fe03e,0x3101f40,0x1b0fdf40,0x180f9fc1,0x180fa0bf,0x701fbe,0x3701f3f,0x1b0fdf3f,0x1b6fdfbe,0x7020be,0x186fe0be,0x192fa0c1,0x9102140,0x190fe140,0x8302042,0x3101f41,0x1b0fdf41,0x182fe042,0xb301fc2,0xb305f40,0x870603e,0x970213f,0x196fe13f,0x11102141,0x113020c2,0x1b2fdfc2,0xb105f3f,0xb705fbe,0x97060be,0xa50a040,
11,0x10203f,0x101fc0,0x101fbf,0xfdfbf,0xfe03f,0xfe040,0xfdfc0,0x105fc0,0x106040,0x10603f,0x105fbf,0x11020bf,0x11020c0,0x302041,0x301fc1,0x2fdfc1,0x2fe041,0x10fe0c0,0x10fe0bf,0x70203e,0x701fbe,0x3101f3f,0x3101f40,0x305fc1,0x306041,0x11060c0,0x11060bf,0x6fe03e,0x6fdfbe,0x30fdf3f,0x30fdf40,0x3105f40,0x3105f3f,0x705fbe,0x70603e,0x13020c1,0x12fe0c1,0x180fa040,0x180fa03f,0x180f9fbf,0x180f9fc0,0x3301f41,0x17020be,0x16fe0be,0x93060c1,0x32fdf41,0xb305f41,0x3701f3e,0x36fdf3e,0x97060be,0x970a03f,0x930a040,0xb309fc0,0xb709fbf,0xb705f3e,0x182f9fc1,0x182fa041,0x192fa0c0,0x190fa0bf,0x196fa03e,0x186f9fbe,0x1b6f9f3f,0x1b2f9f40,
11,0x101fc0,0x10203f,0x101fbf,0xfdfc0,0xfe040,0xfe03f,0xfdfbf,0x105fc0,0x106040,0x10603f,0x105fbf,0x301fc1,0x302041,0x2fe041,0x2fdfc1,0x11020c0,0x11020bf,0x306041,0x305fc1,0x10fe0c0,0x10fe0bf,0x3101f40,0x3101f3f,0x11060c0,0x11060bf,0x70203e,0x30fdf40,0x30fdf3f,0x701fbe,0x3105f40,0x3105f3f,0x13020c1,0x6fe03e,0x6fdfbe,0x705fbe,0x70603e,0x12fe0c1,0x3301f41,0x13060c1,0x32fdf41,0x1b0f9fc0,0x180fa040,0x186fa03f,0x1b6f9fbf,0x3305f41,0xb109fc0,0x17020be,0x16fe0be,0x810a040,0x870a03f,0xb709fbf,0x3701f3e,0x1b6fdf3e,0x17060be,0x182fa041,0x1b2f9fc1,0x192fa0c0,0x196fa0bf,0xb705f3e,0xb309fc1,0x830a041,0x930a0c0,0x970a0bf,
15,0x101fc0,0x101fbf,0x10203f,0xfe040,0xfdfc0,0xfdfbf,0xfe03f,0x106040,0x105fc0,0x105fbf,0x10603f,0x102041,0x101fc1,0xfdfc1,0xfe041,0x106041,0x105fc1,0x11020c0,0x11020bf,0x10fe0c0,0x10fe0bf,0x3101f40,0x3101f3f,0x11060c0,0x11060bf,0x11020c1,0x30fdf40,0x30fdf3f,0x3105f40,0x3105f3f,0x3101f41,0x10fe0c1,0x13060c1,0x70203e,0x701fbe,0x6fdfbe,0x30fdf41,0x3305f41,0x6fe03e,0x70603e,0x705fbe,0x1b0f9fc0,0x180fa040,0x186fa03f,0x1b6f9fbf,0x1b0f9fc1,0x180fa041,0x910a040,0xb109fc0,0xb709fbf,0x970a03f,0x17020be,0x196fe0be,0x97060be,0xb701f3e,0x1b6fdf3e,0xb301fc2,0x9302042,0x930a041,0xb309fc1,0x1b2fdfc2,0x192fe042,0x194fa0c0,
17,0x101fc0,0x101fbf,0x10203f,0xfe040,0xfdfc0,0x101fc1,0x102041,0x106040,0x105fc0,0xfdfbf,0xfe03f,0x10603f,0x105fbf,0xfdfc1,0xfe041,0x106041,0x105fc1,0x11020c0,0x11020bf,0x10fe0c0,0x11020c1,0x11060c0,0x3101f40,0x3101f3f,0x30fdf40,0x10fe0bf,0x11060bf,0x10fe0c1,0x3101f41,0x3105f40,0x30fdf3f,0x11060c1,0x3105f3f,0x30fdf41,0x3105f41,0x3701fbe,0x70203e,0x180fa040,0x1b0f9fc0,0x1b0f9fbf,0x180fa03f,0x186fe03e,0x1b6fdfbe,0x3705fbe,0x70603e,0x910a040,0xb109fc0,0x3301fc2,0x1302042,0x180fa041,0x1b0f9fc1,0x1b2fdfc2,0x192fe042,0x1306042,0x3305fc2,0xb709fbf,0x970a03f,0x930a041,0xb309fc1,0x97020be,0x192fa0c0,0x190fa0bf,0x196fe0be,
11,0x10203f,0x101fc0,0x101fbf,0xfe03f,0xfe040,0xfdfc0,0xfdfbf,0x10603f,0x106040,0x105fc0,0x105fbf,0x11020bf,0x11020c0,0x10fe0c0,0x10fe0bf,0x302041,0x301fc1,0x11060c0,0x11060bf,0x2fe041,0x2fdfc1,0x70203e,0x701fbe,0x306041,0x305fc1,0x3101f40,0x6fe03e,0x6fdfbe,0x3101f3f,0x70603e,0x705fbe,0x13020c1,0x30fdf40,0x30fdf3f,0x3105f3f,0x3105f40,0x12fe0c1,0x17020be,0x13060c1,0x16fe0be,0x186fa03f,0x180fa040,0x1b0f9fc0,0x1b6f9fbf,0x17060be,0x870a03f,0x3301f41,0x32fdf41,0x810a040,0xb109fc0,0xb709fbf,0x3701f3e,0x1b6fdf3e,0x3305f41,0x190fa0c0,0x196fa0bf,0x192fa041,0x1b2f9fc1,0xb705f3e,0x970a0bf,0x910a0c0,0x930a041,0xb309fc1,
11,0x10203f,0x101fc0,0x101fbf,0xfe040,0xfe03f,0xfdfc0,0xfdfbf,0x106040,0x10603f,0x105fc0,0x105fbf,0x302041,0x11020c0,0x11020bf,0x301fc1,0x2fe041,0x10fe0c0,0x10fe0bf,0x2fdfc1,0x306041,0x11060c0,0x11060bf,0x305fc1,0x13020c1,0x12fe0c1,0x70203e,0x701fbe,0x3101f3f,0x3101f40,0x30fdf40,0x30fdf3f,0x6fdfbe,0x6fe03e,0x70603e,0x13060c1,0x3105f40,0x3105f3f,0x705fbe,0x17020be,0x180fa040,0x186fa03f,0x1b0f9fc0,0x1b6f9fbf,0x3301f41,0x32fdf41,0x3305f41,0x16fe0be,0x17060be,0x870a03f,0x810a040,0xb109fc0,0xb709fbf,0x3701f3e,0x182fa041,0x192fa0c0,0x196fa0bf,0x1b2f9fc1,0x1b6fdf3e,0xb705f3e,0x830a041,0x930a0c0,0x970a0bf,0xb309fc1,
14,0x101fc0,0x10203f,0x101fbf,0xfe040,0xfdfc0,0xfe03f,0xfdfbf,0x106040,0x105fc0,0x10603f,0x105fbf,0x102041,0x101fc1,0xfe041,0x11020c0,0xfdfc1,0x11020bf,0x106041,0x105fc1,0x10fe0c0,0x10fe0bf,0x11060c0,0x11060bf,0x11020c1,0x10fe0c1,0x13060c1,0x3101f40,0x3101f3f,0x30fdf40,0x30fdf3f,0x3105f40,0x3105f3f,0x3701fbe,0x70203e,0x6fe03e,0x36fdfbe,0x3101f41,0x32fdf41,0x1b0f9fc0,0x180fa040,0x186fa03f,0x70603e,0x3705fbe,0x1b6f9fbf,0x3305f41,0xb109fc0,0x810a040,0x17020be,0x16fe0be,0x870a03f,0xb709fbf,0x180fa041,0x1b2f9fc1,0x192fa0c0,0x196fa0bf,0x17060be,0x9302042,0xb301fc2,0x830a041,0xb309fc1,0x930a0c0,0x970a0bf,0x1a2fe042,
17,0x101fc0,0x10203f,0xfe040,0xfdfc0,0x101fbf,0x106040,0x102041,0x101fc1,0x105fc0,0xfe03f,0xfdfbf,0x10603f,0x105fbf,0xfe041,0xfdfc1,0x106041,0x105fc1,0x11020c0,0x11020bf,0x10fe0c0,0x11020c1,0x11060c0,0x10fe0bf,0x11060bf,0x10fe0c1,0x11060c1,0x3101f40,0x30fdf40,0x3101f3f,0x3105f40,0x3101f41,0x30fdf3f,0x3105f3f,0x30fdf41,0x3105f41,0x70203e,0x3701fbe,0x180fa040,0x1b0f9fc0,0x180fa03f,0x186fe03e,0x36fdfbe,0x1b6f9fbf,0x180fa041,0x1b0f9fc1,0x1302042,0x3301fc2,0x910a040,0x70603e,0x3705fbe,0xb109fc0,0x970a03f,0xb709fbf,0x910a041,0x192fe042,0x1b2fdfc2,0x9306042,0x3305fc2,0xb309fc1,0x97020be,0x192fa0c0,0x190fa0bf,0x196fe0be,
15,0x10203f,0x101fbf,0x101fc0,0xfe040,0xfe03f,0xfdfbf,0xfdfc0,0x106040,0x10603f,0x105fbf,0x105fc0,0x1020c0,0x1020bf,0xfe0bf,0xfe0c0,0x1060c0,0x1060bf,0x302041,0x301fc1,0x2fe041,0x2fdfc1,0x70203e,0x701fbe,0x306041,0x305fc1,0x3020c1,0x6fe03e,0x6fdfbe,0x70603e,0x705fbe,0x7020be,0x2fe0c1,0x13060c1,0x3101f40,0x3101f3f,0x30fdf3f,0x6fe0be,0x17060be,0x30fdf40,0x3105f40,0x3105f3f,0x186fa03f,0x180fa040,0x1b0f9fc0,0x1b6f9fbf,0x186fa0bf,0x180fa0c0,0x830a040,0x870a03f,0xb709fbf,0xb309fc0,0x3301f41,0x1b2fdf41,0xb305f41,0xb701f3e,0x1b6fdf3e,0x970213f,0x9302140,0x930a0c0,0x970a0bf,0x196fe13f,0x192fe140,0x1a2fa041,
14,0x10203f,0x101fc0,0x101fbf,0xfe040,0xfe03f,0xfdfc0,0xfdfbf,0x106040,0x10603f,0x105fc0,0x105fbf,0x1020c0,0x1020bf,0xfe0c0,0x302041,0xfe0bf,0x301fc1,0x1060c0,0x1060bf,0x2fe041,0x2fdfc1,0x306041,0x305fc1,0x3020c1,0x2fe0c1,0x13060c1,0x70203e,0x701fbe,0x6fe03e,0x6fdfbe,0x70603e,0x705fbe,0x3701f3f,0x3101f40,0x30fdf40,0x36fdf3f,0x7020be,0x16fe0be,0x186fa03f,0x180fa040,0x1b0f9fc0,0x3105f40,0x3705f3f,0x1b6f9fbf,0x17060be,0x870a03f,0x810a040,0x3301f41,0x32fdf41,0xb109fc0,0xb709fbf,0x180fa0c0,0x196fa0bf,0x192fa041,0x1b2f9fc1,0x3305f41,0x9302140,0x970213f,0x910a0c0,0x970a0bf,0x930a041,0xb309fc1,0x194fe140,
15,0x10203f,0x101fc0,0x101fbf,0xfe040,0xfe03f,0xfdfc0,0x106040,0x10603f,0xfdfbf,0x105fc0,0x102041,0x1020c0,0x105fbf,0x1020bf,0x101fc1,0xfe041,0xfe0c0,0xfe0bf,0xfdfc1,0x106041,0x1060c0,0x1060bf,0x105fc1,0x1020c1,0x2fe0c1,0x13060c1,0x70203e,0x3101f40,0x3101f3f,0x3701fbe,0x6fe03e,0x6fdfbe,0x30fdf40,0x36fdf3f,0x3105f40,0x3105f3f,0x70603e,0x3705fbe,0x180fa040,0x186fa03f,0x1b0f9fc0,0x1b6f9fbf,0x7020be,0x16fe0be,0x3101f41,0x32fdf41,0xb305f41,0x810a040,0x870a03f,0x97060be,0xb109fc0,0xb709fbf,0x182fa041,0x182fa0c0,0x196fa0bf,0x1b2f9fc1,0x11302042,0x13301fc2,0xb30a041,0x950a0c0,0x9302140,0x970213f,0x194fe140,
17,0x101fc0,0x10203f,0xfe040,0xfdfc0,0x101fbf,0x106040,0x102041,0xfe03f,0x101fc1,0x105fc0,0x1020c0,0xfdfbf,0x10603f,0xfe041,0xfdfc1,0x105fbf,0x106041,0x1020bf,0xfe0c0,0x105fc1,0x1060c0,0x1020c1,0x10fe0bf,0x11060bf,0x10fe0c1,0x11060c1,0x3101f40,0x30fdf40,0x3101f3f,0x3105f40,0x3101f41,0x30fdf3f,0x70203e,0x3701fbe,0x180fa040,0x1b0f9fc0,0x30fdf41,0x3105f3f,0x6fe03e,0x186fa03f,0x1b0f9fbf,0x1b6fdfbe,0x70603e,0x3705fbe,0xb305f41,0x910a040,0xb109fc0,0x1302042,0x180fa041,0x1b0f9fc1,0x3301fc2,0x192fe042,0x192fa0c0,0x17020be,0x970a03f,0xb709fbf,0xa10a041,0xa306042,0x1b2fdfc2,0x190fa0bf,0x196fe0be,0x97060be,0x11502140,
17,0x10203f,0x101fbf,0x101fc0,0xfe040,0xfe03f,0x1020bf,0x1020c0,0x106040,0x10603f,0xfdfbf,0xfdfc0,0x105fc0,0x105fbf,0xfe0bf,0xfe0c0,0x1060c0,0x1060bf,0x302041,0x301fc1,0x2fe041,0x3020c1,0x306041,0x70203e,0x701fbe,0x6fe03e,0x2fdfc1,0x305fc1,0x2fe0c1,0x7020be,0x70603e,0x6fdfbe,0x3060c1,0x705fbe,0x6fe0be,0x7060be,0x3701f3f,0x3101f40,0x180fa040,0x186fa03f,0x186f9fbf,0x180f9fc0,0x1b0fdf40,0x1b6fdf3f,0x3705f3f,0x3105f40,0x830a040,0x870a03f,0x170213f,0x1302140,0x180fa0c0,0x186fa0bf,0x196fe13f,0x192fe140,0x1306140,0x170613f,0xb709fbf,0xb309fc0,0x930a0c0,0x970a0bf,0xb301f41,0x192fa041,0x182f9fc1,0x1b2fdf41,
17,0x10203f,0x101fc0,0xfe040,0xfe03f,0x101fbf,0x106040,0x1020c0,0x1020bf,0x10603f,0xfdfc0,0xfdfbf,0x105fc0,0x105fbf,0xfe0c0,0xfe0bf,0x1060c0,0x1060bf,0x302041,0x301fc1,0x2fe041,0x3020c1,0x306041,0x2fdfc1,0x305fc1,0x2fe0c1,0x3060c1,0x70203e,0x6fe03e,0x701fbe,0x70603e,0x7020be,0x6fdfbe,0x705fbe,0x6fe0be,0x7060be,0x3101f40,0x3701f3f,0x180fa040,0x186fa03f,0x180f9fc0,0x1b0fdf40,0x36fdf3f,0x1b6f9fbf,0x180fa0c0,0x186fa0bf,0x1302140,0x170213f,0x830a040,0x3105f40,0x3705f3f,0x870a03f,0xb309fc0,0xb709fbf,0x830a0c0,0x192fe140,0x196fe13f,0x9306140,0x170613f,0x970a0bf,0xb301f41,0x192fa041,0x182f9fc1,0x1b2fdf41,
17,0x10203f,0x101fc0,0xfe040,0xfe03f,0x101fbf,0x106040,0x1020c0,0xfdfc0,0x1020bf,0x10603f,0x102041,0xfdfbf,0x105fc0,0xfe0c0,0xfe0bf,0x105fbf,0x1060c0,0x101fc1,0xfe041,0x1060bf,0x106041,0x1020c1,0x2fdfc1,0x305fc1,0x2fe0c1,0x3060c1,0x70203e,0x6fe03e,0x701fbe,0x70603e,0x7020be,0x6fdfbe,0x3101f40,0x3701f3f,0x180fa040,0x186fa03f,0x6fe0be,0x705fbe,0x30fdf40,0x1b0f9fc0,0x186f9fbf,0x1b6fdf3f,0x3105f40,0x3705f3f,0x97060be,0x830a040,0x870a03f,0x1302140,0x180fa0c0,0x186fa0bf,0x170213f,0x192fe140,0x192fa041,0x3301f41,0xb309fc0,0xb709fbf,0x850a0c0,0x9506140,0x196fe13f,0x182f9fc1,0x1b2fdf41,0xb305f41,0x12302042,
16,0x10203f,0x101fc0,0xfe040,0x102041,0x1020c0,0x106040,0x101fbf,0xfe03f,0xfdfc0,0x101fc1,0x105fc0,0x10603f,0x1020bf,0xfe0c0,0xfe041,0xfdfbf,0x1020c1,0x106041,0x1060c0,0x105fbf,0xfe0bf,0xfdfc1,0x105fc1,0x1060bf,0xfe0c1,0x83060c1,0x70203e,0x3101f40,0x180fa040,0x180fa03f,0x186fe03e,0x701fbe,0x3701f3f,0x30fdf40,0x1b0f9fc0,0x180fa041,0x180fa0c0,0x7020be,0x70603e,0x3105f40,0xb101f41,0x9302042,0x1102140,0x930a040,0x6fdfbe,0x36fdf3f,0x1b6f9fbf,0x190fa0bf,0x196fe0be,0x170213f,0x196fe140,0x182f9fc1,0x1b2fdf41,0xb301fc2,0x1a2fe042,0x192fa0c1,0x8705fbe,0xb705f3f,0xb309fc0,0xa70a03f,0x97060be,0x9706140,0x11302141
};

1006
extern/voro++/src/v_compute.cc vendored Normal file

File diff suppressed because it is too large Load Diff

149
extern/voro++/src/v_compute.hh vendored Normal file
View File

@@ -0,0 +1,149 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file v_compute.hh
* \brief Header file for the voro_compute template and related classes. */
#ifndef VOROPP_V_COMPUTE_HH
#define VOROPP_V_COMPUTE_HH
#include "config.hh"
#include "worklist.hh"
#include "cell.hh"
namespace voro {
/** \brief Structure for holding information about a particle.
*
* This small structure holds information about a single particle, and is used
* by several of the routines in the voro_compute template for passing
* information by reference between functions. */
struct particle_record {
/** The index of the block that the particle is within. */
int ijk;
/** The number of particle within its block. */
int l;
/** The x-index of the block. */
int di;
/** The y-index of the block. */
int dj;
/** The z-index of the block. */
int dk;
};
/** \brief Template for carrying out Voronoi cell computations. */
template <class c_class>
class voro_compute {
public:
/** A reference to the container class on which to carry out*/
c_class &con;
/** The size of an internal computational block in the x
* direction. */
const double boxx;
/** The size of an internal computational block in the y
* direction. */
const double boxy;
/** The size of an internal computational block in the z
* direction. */
const double boxz;
/** The inverse box length in the x direction, set to
* nx/(bx-ax). */
const double xsp;
/** The inverse box length in the y direction, set to
* ny/(by-ay). */
const double ysp;
/** The inverse box length in the z direction, set to
* nz/(bz-az). */
const double zsp;
/** The number of boxes in the x direction for the searching mask. */
const int hx;
/** The number of boxes in the y direction for the searching mask. */
const int hy;
/** The number of boxes in the z direction for the searching mask. */
const int hz;
/** A constant, set to the value of hx multiplied by hy, which
* is used in the routines which step through mask boxes in
* sequence. */
const int hxy;
/** A constant, set to the value of hx*hy*hz, which is used in
* the routines which step through mask boxes in sequence. */
const int hxyz;
/** The number of floating point entries to store for each
* particle. */
const int ps;
/** This array holds the numerical IDs of each particle in each
* computational box. */
int **id;
/** A two dimensional array holding particle positions. For the
* derived container_poly class, this also holds particle
* radii. */
double **p;
/** An array holding the number of particles within each
* computational box of the container. */
int *co;
voro_compute(c_class &con_,int hx_,int hy_,int hz_);
/** The class destructor frees the dynamically allocated memory
* for the mask and queue. */
~voro_compute() {
delete [] qu;
delete [] mask;
}
template<class v_cell>
bool compute_cell(v_cell &c,int ijk,int s,int ci,int cj,int ck);
void find_voronoi_cell(double x,double y,double z,int ci,int cj,int ck,int ijk,particle_record &w,double &mrs);
private:
/** A constant set to boxx*boxx+boxy*boxy+boxz*boxz, which is
* frequently used in the computation. */
const double bxsq;
/** This sets the current value being used to mark tested blocks
* in the mask. */
unsigned int mv;
/** The current size of the search list. */
int qu_size;
/** A pointer to the array of worklists. */
const unsigned int *wl;
/** An pointer to the array holding the minimum distances
* associated with the worklists. */
double *mrad;
/** This array is used during the cell computation to determine
* which blocks have been considered. */
unsigned int *mask;
/** An array is used to store the queue of blocks to test
* during the Voronoi cell computation. */
int *qu;
/** A pointer to the end of the queue array, used to determine
* when the queue is full. */
int *qu_l;
template<class v_cell>
bool corner_test(v_cell &c,double xl,double yl,double zl,double xh,double yh,double zh);
template<class v_cell>
inline bool edge_x_test(v_cell &c,double x0,double yl,double zl,double x1,double yh,double zh);
template<class v_cell>
inline bool edge_y_test(v_cell &c,double xl,double y0,double zl,double xh,double y1,double zh);
template<class v_cell>
inline bool edge_z_test(v_cell &c,double xl,double yl,double z0,double xh,double yh,double z1);
template<class v_cell>
inline bool face_x_test(v_cell &c,double xl,double y0,double z0,double y1,double z1);
template<class v_cell>
inline bool face_y_test(v_cell &c,double x0,double yl,double z0,double x1,double z1);
template<class v_cell>
inline bool face_z_test(v_cell &c,double x0,double y0,double zl,double x1,double y1);
bool compute_min_max_radius(int di,int dj,int dk,double fx,double fy,double fz,double gx,double gy,double gz,double& crs,double mrs);
bool compute_min_radius(int di,int dj,int dk,double fx,double fy,double fz,double mrs);
inline void add_to_mask(int ei,int ej,int ek,int *&qu_e);
inline void scan_bits_mask_add(unsigned int q,unsigned int *mijk,int ei,int ej,int ek,int *&qu_e);
inline void scan_all(int ijk,double x,double y,double z,int di,int dj,int dk,particle_record &w,double &mrs);
void add_list_memory(int*& qu_s,int*& qu_e);
/** Resets the mask in cases where the mask counter wraps
* around. */
inline void reset_mask() {
for(unsigned int *mp(mask);mp<mask+hxyz;mp++) *mp=0;
}
};
}
#endif

19
extern/voro++/src/voro++.cc vendored Normal file
View File

@@ -0,0 +1,19 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file voro++.cc
* \brief A file that loads all of the function implementation files. */
#include "cell.cc"
#include "common.cc"
#include "v_base.cc"
#include "container.cc"
#include "unitcell.cc"
#include "container_prd.cc"
#include "pre_container.cc"
#include "v_compute.cc"
#include "c_loops.cc"
#include "wall.cc"

333
extern/voro++/src/voro++.hh vendored Normal file
View File

@@ -0,0 +1,333 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file voro++.hh
* \brief A file that loads all of the Voro++ header files. */
/** \mainpage Voro++ class reference manual
* \section intro Introduction
* Voro++ is a software library for carrying out three-dimensional computations
* of the Voronoi tessellation. A distinguishing feature of the Voro++ library
* is that it carries out cell-based calculations, computing the Voronoi cell
* for each particle individually, rather than computing the Voronoi
* tessellation as a global network of vertices and edges. It is particularly
* well-suited for applications that rely on cell-based statistics, where
* features of Voronoi cells (eg. volume, centroid, number of faces) can be
* used to analyze a system of particles.
*
* Voro++ is written in C++ and can be built as a static library that can be
* linked to. This manual provides a reference for every function in the class
* structure. For a general overview of the program, see the Voro++ website at
* http://math.lbl.gov/voro++/ and in particular the example programs at
* http://math.lbl.gov/voro++/examples/ that demonstrate many of the library's
* features.
*
* \section class C++ class structure
* The code is structured around several C++ classes. The voronoicell_base
* class contains all of the routines for constructing a single Voronoi cell.
* It represents the cell as a collection of vertices that are connected by
* edges, and there are routines for initializing, making, and outputting the
* cell. The voronoicell_base class form the base of the voronoicell and
* voronoicell_neighbor classes, which add specialized routines depending on
* whether neighboring particle ID information for each face must be tracked or
* not. Collectively, these classes are referred to as "voronoicell classes"
* within the documentation.
*
* There is a hierarchy of classes that represent three-dimensional particle
* systems. All of these are derived from the voro_base class, which contains
* constants that divide a three-dimensional system into a rectangular grid of
* equally-sized rectangular blocks; this grid is used for computational
* efficiency during the Voronoi calculations.
*
* The container_base, container, and container_poly are then derived from the
* voro_base class to represent a particle system in a specific
* three-dimensional rectangular box using both periodic and non-periodic
* boundary conditions. In addition, the container_periodic_base,
* container_periodic, and container_periodic_poly classes represent
* a particle system in a three-dimensional non-orthogonal periodic domain,
* defined by three periodicity vectors that represent a parallelepiped.
* Collectively, these classes are referred to as "container classes" within
* the documentation.
*
* The voro_compute template encapsulates all of the routines for computing
* Voronoi cells. Each container class has a voro_compute template within
* it, that accesses the container's particle system, and computes the Voronoi
* cells.
*
* There are several wall classes that can be used to apply certain boundary
* conditions using additional plane cuts during the Voronoi cell compution.
* The code also contains a number of small loop classes, c_loop_all,
* c_loop_subset, c_loop_all_periodic, and c_loop_order that can be used to
* iterate over a certain subset of particles in a container. The latter class
* makes use of a special particle_order class that stores a specific order of
* particles within the container. The library also contains the classes
* pre_container_base, pre_container, and pre_container_poly, that can be used
* as temporary storage when importing data of unknown size.
*
* \section voronoicell The voronoicell classes
* The voronoicell class represents a single Voronoi cell as a convex
* polyhedron, with a set of vertices that are connected by edges. The class
* contains a variety of functions that can be used to compute and output the
* Voronoi cell corresponding to a particular particle. The command init()
* can be used to initialize a cell as a large rectangular box. The Voronoi cell
* can then be computed by repeatedly cutting it with planes that correspond to
* the perpendicular bisectors between that particle and its neighbors.
*
* This is achieved by using the plane() routine, which will recompute the
* cell's vertices and edges after cutting it with a single plane. This is the
* key routine in voronoicell class. It begins by exploiting the convexity
* of the underlying cell, tracing between edges to work out if the cell
* intersects the cutting plane. If it does not intersect, then the routine
* immediately exits. Otherwise, it finds an edge or vertex that intersects
* the plane, and from there, traces out a new face on the cell, recomputing
* the edge and vertex structure accordingly.
*
* Once the cell is computed, there are many routines for computing features of
* the the Voronoi cell, such as its volume, surface area, or centroid. There
* are also many routines for outputting features of the Voronoi cell, or
* writing its shape in formats that can be read by Gnuplot or POV-Ray.
*
* \subsection internal Internal data representation
* The voronoicell class has a public member p representing the
* number of vertices. The polyhedral structure of the cell is stored
* in the following arrays:
*
* - pts: a one-dimensional array of floating point numbers, that represent the
* position vectors x_0, x_1, ..., x_{p-1} of the polyhedron vertices.
* - nu: the order of each vertex n_0, n_1, ..., n_{p-1}, corresponding to
* the number of other vertices to which each is connected.
* - ed: a two-dimensional table of edges and relations. For the ith vertex,
* ed[i] has 2n_i+1 elements. The first n_i elements are the edges e(j,i),
* where e(j,i) is the jth neighbor of vertex i. The edges are ordered
* according to a right-hand rule with respect to an outward-pointing normal.
* The next n_i elements are the relations l(j,i) which satisfy the property
* e(l(j,i),e(j,i)) = i. The final element of the ed[i] list is a back
* pointer used in memory allocation.
*
* In a very large number of cases, the values of n_i will be 3. This is because
* the only way that a higher-order vertex can be created in the plane()
* routine is if the cutting plane perfectly intersects an existing vertex. For
* random particle arrangements with position vectors specified to double
* precision this should happen very rarely. A preliminary version of this code
* was quite successful with only making use of vertices of order 3. However,
* when calculating millions of cells, it was found that this approach is not
* robust, since a single floating point error can invalidate the computation.
* This can also be a problem for cases featuring crystalline arrangements of
* particles where the corresponding Voronoi cells may have high-order vertices
* by construction.
*
* Because of this, Voro++ takes the approach that it if an existing vertex is
* within a small numerical tolerance of the cutting plane, it is treated as
* being exactly on the plane, and the polyhedral topology is recomputed
* accordingly. However, while this improves robustness, it also adds the
* complexity that n_i may no longer always be 3. This causes memory management
* to be significantly more complicated, as different vertices require a
* different number of elements in the ed[][] array. To accommodate this, the
* voronoicell class allocated edge memory in a different array called mep[][],
* in such a way that all vertices of order k are held in mep[k]. If vertex
* i has order k, then ed[i] points to memory within mep[k]. The array ed[][]
* is never directly initialized as a two-dimensional array itself, but points
* at allocations within mep[][]. To the user, it appears as though each row of
* ed[][] has a different number of elements. When vertices are added or
* deleted, care must be taken to reorder and reassign elements in these
* arrays.
*
* During the plane() routine, the code traces around the vertices of the cell,
* and adds new vertices along edges which intersect the cutting plane to
* create a new face. The values of l(j,i) are used in this computation, as
* when the code is traversing from one vertex on the cell to another, this
* information allows the code to immediately work out which edge of a vertex
* points back to the one it came from. As new vertices are created, the l(j,i)
* are also updated to ensure consistency. To ensure robustness, the plane
* cutting algorithm should work with any possible combination of vertices
* which are inside, outside, or exactly on the cutting plane.
*
* Vertices exactly on the cutting plane create some additional computational
* difficulties. If there are two marginal vertices connected by an existing
* edge, then it would be possible for duplicate edges to be created between
* those two vertices, if the plane routine traces along both sides of this
* edge while constructing the new face. The code recognizes these cases and
* prevents the double edge from being formed. Another possibility is the
* formation of vertices of order two or one. At the end of the plane cutting
* routine, the code checks to see if any of these are present, removing the
* order one vertices by just deleting them, and removing the order two
* vertices by connecting the two neighbors of each vertex together. It is
* possible that the removal of a single low-order vertex could result in the
* creation of additional low-order vertices, so the process is applied
* recursively until no more are left.
*
* \section container The container classes
* There are four container classes available for general usage: container,
* container_poly, container_periodic, and container_periodic_poly. Each of
* these represent a system of particles in a specific three-dimensional
* geometry. They contain routines for importing particles from a text file,
* and adding particles individually. They also contain a large number of
* analyzing and outputting the particle system. Internally, the routines that
* compute Voronoi cells do so by making use of the voro_compute template.
* Each container class contains routines that tell the voro_compute template
* about the specific geometry of this container.
*
* \section voro_compute The voro_compute template
* The voro_compute template encapsulates the routines for carrying out the
* Voronoi cell computations. It contains data structures suchs as a mask and a
* queue that are used in the computations. The voro_compute template is
* associated with a specific container class, and during the computation, it
* calls routines in the container class to access the particle positions that
* are stored there.
*
* The key routine in this class is compute_cell(), which makes use of a
* voronoicell class to construct a Voronoi cell for a specific particle in the
* container. The basic approach that this function takes is to repeatedly cut
* the Voronoi cell by planes corresponding neighboring particles, and stop
* when it recognizes that all the remaining particles in the container are too
* far away to possibly influence cell's shape. The code makes use of two
* possible methods for working out when a cell computation is complete:
*
* - Radius test: if the maximum distance of a Voronoi cell
* vertex from the cell center is R, then no particles more than a distance
* 2R away can possibly influence the cell. This a very fast computation to
* do, but it has no directionality: if the cell extends a long way in one
* direction then particles a long distance in other directions will still
* need to be tested.
* - Region test: it is possible to test whether a specific region can
* possibly influence the cell by applying a series of plane tests at the
* point on the region which is closest to the Voronoi cell center. This is a
* slower computation to do, but it has directionality.
*
* Another useful observation is that the regions that need to be tested are
* simply connected, meaning that if a particular region does not need to be
* tested, then neighboring regions which are further away do not need to be
* tested.
*
* For maximum efficiency, it was found that a hybrid approach making use of
* both of the above tests worked well in practice. Radius tests work well for
* the first few blocks, but switching to region tests after then prevent the
* code from becoming extremely slow, due to testing over very large spherical
* shells of particles. The compute_cell() routine therefore takes the
* following approach:
*
* - Initialize the voronoicell class to fill the entire computational domain.
* - Cut the cell by any wall objects that have been added to the container.
* - Apply plane cuts to the cell corresponding to the other particles which
* are within the current particle's region.
* - Test over a pre-computed worklist of neighboring regions, that have been
* ordered according to the minimum distance away from the particle's
* position. Apply radius tests after every few regions to see if the
* calculation can terminate.
* - If the code reaches the end of the worklist, add all the neighboring
* regions to a new list.
* - Carry out a region test on the first item of the list. If the region needs
* to be tested, apply the plane() routine for all of its particles, and then
* add any neighboring regions to the end of the list that need to be tested.
* Continue until the list has no elements left.
*
* The compute_cell() routine forms the basis of many other routines, such as
* store_cell_volumes() and draw_cells_gnuplot() that can be used to calculate
* and draw the cells in a container.
*
* \section walls Wall computation
* Wall computations are handled by making use of a pure virtual wall class.
* Specific wall types are derived from this class, and require the
* specification of two routines: point_inside() that tests to see if a point
* is inside a wall or not, and cut_cell() that cuts a cell according to the
* wall's position. The walls can be added to the container using the
* add_wall() command, and these are called each time a compute_cell() command
* is carried out. At present, wall types for planes, spheres, cylinders, and
* cones are provided, although custom walls can be added by creating new
* classes derived from the pure virtual class. Currently all wall types
* approximate the wall surface with a single plane, which produces some small
* errors, but generally gives good results for dense particle packings in
* direct contact with a wall surface. It would be possible to create more
* accurate walls by making cut_cell() routines that approximate the curved
* surface with multiple plane cuts.
*
* The wall objects can used for periodic calculations, although to obtain
* valid results, the walls should also be periodic as well. For example, in a
* domain that is periodic in the x direction, a cylinder aligned along the x
* axis could be added. At present, the interior of all wall objects are convex
* domains, and consequently any superposition of them will be a convex domain
* also. Carrying out computations in non-convex domains poses some problems,
* since this could theoretically lead to non-convex Voronoi cells, which the
* internal data representation of the voronoicell class does not support. For
* non-convex cases where the wall surfaces feature just a small amount of
* negative curvature (eg. a torus) approximating the curved surface with a
* single plane cut may give an acceptable level of accuracy. For non-convex
* cases that feature internal angles, the best strategy may be to decompose
* the domain into several convex subdomains, carry out a calculation in each,
* and then add the results together. The voronoicell class cannot be easily
* modified to handle non-convex cells as this would fundamentally alter the
* algorithms that it uses, and cases could arise where a single plane cut
* could create several new faces as opposed to just one.
*
* \section loops Loop classes
* The container classes have a number of simple routines for calculating
* Voronoi cells for all particles within them. However, in some situations it
* is desirable to iterate over a specific subset of particles. This can be
* achieved with the c_loop classes that are all derived from the c_loop_base
* class. Each class can iterate over a specific subset of particles in a
* container. There are three loop classes for use with the container and
* container_poly classes:
*
* - c_loop_all will loop over all of the particles in a container.
* - c_loop_subset will loop over a subset of particles in a container that lie
* within some geometrical region. It can loop over particles in a
* rectangular box, particles in a sphere, or particles that lie within
* specific internal computational blocks.
* - c_loop_order will loop over a specific list of particles that were
* previously stored in a particle_order class.
*
* Several of the key routines within the container classes (such as
* draw_cells_gnuplot and print_custom) have versions where they can be passed
* a loop class to use. Loop classes can also be used directly and there are
* some examples on the library website that demonstrate this. It is also
* possible to write custom loop classes.
*
* In addition to the loop classes mentioned above, there is also a
* c_loop_all_periodic class, that is specifically for use with the
* container_periodic and container_periodic_poly classes. Since the data
* structures of these containers differ considerably, it requires a different
* loop class that is not interoperable with the others.
*
* \section pre_container The pre_container classes
* Voro++ makes use of internal computational grid of blocks that are used to
* configure the code for maximum efficiency. As discussed on the library
* website, the best performance is achieved for around 5 particles per block,
* with anything in the range from 3 to 12 giving good performance. Usually
* the size of the grid can be chosen by ensuring that the number of blocks is
* equal to the number of particles divided by 5.
*
* However, this can be difficult to choose in cases when the number of
* particles is not known a priori, and in thes cases the pre_container classes
* can be used. They can import an arbitrary number of particle positions from
* a file, dynamically allocating memory in chunks as necessary. Once particles
* are imported, they can guess an optimal block arrangement to use for the
* container class, and then transfer the particles to the container. By
* default, this procedure is used by the command-line utility to enable it to
* work well with arbitrary sizes of input data.
*
* The pre_container class can be used when no particle radius information is
* available, and the pre_container_poly class can be used when radius
* information is available. At present, the pre_container classes can only be
* used with the container and container_poly classes. They do not support
* the container_periodic and container_periodic_poly classes. */
#ifndef VOROPP_HH
#define VOROPP_HH
#include "config.hh"
#include "common.hh"
#include "cell.hh"
#include "v_base.hh"
#include "rad_option.hh"
#include "container.hh"
#include "unitcell.hh"
#include "container_prd.hh"
#include "pre_container.hh"
#include "v_compute.hh"
#include "c_loops.hh"
#include "wall.hh"
#endif

132
extern/voro++/src/wall.cc vendored Normal file
View File

@@ -0,0 +1,132 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file wall.cc
* \brief Function implementations for the derived wall classes. */
#include "wall.hh"
namespace voro {
/** Tests to see whether a point is inside the sphere wall object.
* \param[in,out] (x,y,z) the vector to test.
* \return True if the point is inside, false if the point is outside. */
bool wall_sphere::point_inside(double x,double y,double z) {
return (x-xc)*(x-xc)+(y-yc)*(y-yc)+(z-zc)*(z-zc)<rc*rc;
}
/** Cuts a cell by the sphere wall object. The spherical wall is approximated by
* a single plane applied at the point on the sphere which is closest to the center
* of the cell. This works well for particle arrangements that are packed against
* the wall, but loses accuracy for sparse particle distributions.
* \param[in,out] c the Voronoi cell to be cut.
* \param[in] (x,y,z) the location of the Voronoi cell.
* \return True if the cell still exists, false if the cell is deleted. */
template<class v_cell>
bool wall_sphere::cut_cell_base(v_cell &c,double x,double y,double z) {
double xd=x-xc,yd=y-yc,zd=z-zc,dq=xd*xd+yd*yd+zd*zd;
if (dq>1e-5) {
dq=2*(sqrt(dq)*rc-dq);
return c.nplane(xd,yd,zd,dq,w_id);
}
return true;
}
/** Tests to see whether a point is inside the plane wall object.
* \param[in] (x,y,z) the vector to test.
* \return True if the point is inside, false if the point is outside. */
bool wall_plane::point_inside(double x,double y,double z) {
return x*xc+y*yc+z*zc<ac;
}
/** Cuts a cell by the plane wall object.
* \param[in,out] c the Voronoi cell to be cut.
* \param[in] (x,y,z) the location of the Voronoi cell.
* \return True if the cell still exists, false if the cell is deleted. */
template<class v_cell>
bool wall_plane::cut_cell_base(v_cell &c,double x,double y,double z) {
double dq=2*(ac-x*xc-y*yc-z*zc);
return c.nplane(xc,yc,zc,dq,w_id);
}
/** Tests to see whether a point is inside the cylindrical wall object.
* \param[in] (x,y,z) the vector to test.
* \return True if the point is inside, false if the point is outside. */
bool wall_cylinder::point_inside(double x,double y,double z) {
double xd=x-xc,yd=y-yc,zd=z-zc;
double pa=(xd*xa+yd*ya+zd*za)*asi;
xd-=xa*pa;yd-=ya*pa;zd-=za*pa;
return xd*xd+yd*yd+zd*zd<rc*rc;
}
/** Cuts a cell by the cylindrical wall object. The cylindrical wall is
* approximated by a single plane applied at the point on the cylinder which is
* closest to the center of the cell. This works well for particle arrangements
* that are packed against the wall, but loses accuracy for sparse particle
* distributions.
* \param[in,out] c the Voronoi cell to be cut.
* \param[in] (x,y,z) the location of the Voronoi cell.
* \return True if the cell still exists, false if the cell is deleted. */
template<class v_cell>
bool wall_cylinder::cut_cell_base(v_cell &c,double x,double y,double z) {
double xd=x-xc,yd=y-yc,zd=z-zc,pa=(xd*xa+yd*ya+zd*za)*asi;
xd-=xa*pa;yd-=ya*pa;zd-=za*pa;
pa=xd*xd+yd*yd+zd*zd;
if(pa>1e-5) {
pa=2*(sqrt(pa)*rc-pa);
return c.nplane(xd,yd,zd,pa,w_id);
}
return true;
}
/** Tests to see whether a point is inside the cone wall object.
* \param[in] (x,y,z) the vector to test.
* \return True if the point is inside, false if the point is outside. */
bool wall_cone::point_inside(double x,double y,double z) {
double xd=x-xc,yd=y-yc,zd=z-zc,pa=(xd*xa+yd*ya+zd*za)*asi;
xd-=xa*pa;yd-=ya*pa;zd-=za*pa;
pa*=gra;
if (pa<0) return false;
pa*=pa;
return xd*xd+yd*yd+zd*zd<pa;
}
/** Cuts a cell by the cone wall object. The conical wall is
* approximated by a single plane applied at the point on the cone which is
* closest to the center of the cell. This works well for particle arrangements
* that are packed against the wall, but loses accuracy for sparse particle
* distributions.
* \param[in,out] c the Voronoi cell to be cut.
* \param[in] (x,y,z) the location of the Voronoi cell.
* \return True if the cell still exists, false if the cell is deleted. */
template<class v_cell>
bool wall_cone::cut_cell_base(v_cell &c,double x,double y,double z) {
double xd=x-xc,yd=y-yc,zd=z-zc,xf,yf,zf,q,pa=(xd*xa+yd*ya+zd*za)*asi;
xd-=xa*pa;yd-=ya*pa;zd-=za*pa;
pa=xd*xd+yd*yd+zd*zd;
if(pa>1e-5) {
pa=1/sqrt(pa);
q=sqrt(asi);
xf=-sang*q*xa+cang*pa*xd;
yf=-sang*q*ya+cang*pa*yd;
zf=-sang*q*za+cang*pa*zd;
pa=2*(xf*(xc-x)+yf*(yc-y)+zf*(zc-z));
return c.nplane(xf,yf,zf,pa,w_id);
}
return true;
}
// Explicit instantiation
template bool wall_sphere::cut_cell_base(voronoicell&,double,double,double);
template bool wall_sphere::cut_cell_base(voronoicell_neighbor&,double,double,double);
template bool wall_plane::cut_cell_base(voronoicell&,double,double,double);
template bool wall_plane::cut_cell_base(voronoicell_neighbor&,double,double,double);
template bool wall_cylinder::cut_cell_base(voronoicell&,double,double,double);
template bool wall_cylinder::cut_cell_base(voronoicell_neighbor&,double,double,double);
template bool wall_cone::cut_cell_base(voronoicell&,double,double,double);
template bool wall_cone::cut_cell_base(voronoicell_neighbor&,double,double,double);
}

119
extern/voro++/src/wall.hh vendored Normal file
View File

@@ -0,0 +1,119 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file wall.hh
* \brief Header file for the derived wall classes. */
#ifndef VOROPP_WALL_HH
#define VOROPP_WALL_HH
#include "cell.hh"
#include "container.hh"
namespace voro {
/** \brief A class representing a spherical wall object.
*
* This class represents a spherical wall object. */
struct wall_sphere : public wall {
public:
/** Constructs a spherical wall object.
* \param[in] w_id_ an ID number to associate with the wall for
* neighbor tracking.
* \param[in] (xc_,yc_,zc_) a position vector for the sphere's
* center.
* \param[in] rc_ the radius of the sphere. */
wall_sphere(double xc_,double yc_,double zc_,double rc_,int w_id_=-99)
: w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), rc(rc_) {}
bool point_inside(double x,double y,double z);
template<class v_cell>
bool cut_cell_base(v_cell &c,double x,double y,double z);
bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
private:
const int w_id;
const double xc,yc,zc,rc;
};
/** \brief A class representing a plane wall object.
*
* This class represents a single plane wall object. */
struct wall_plane : public wall {
public:
/** Constructs a plane wall object.
* \param[in] (xc_,yc_,zc_) a normal vector to the plane.
* \param[in] ac_ a displacement along the normal vector.
* \param[in] w_id_ an ID number to associate with the wall for
* neighbor tracking. */
wall_plane(double xc_,double yc_,double zc_,double ac_,int w_id_=-99)
: w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), ac(ac_) {}
bool point_inside(double x,double y,double z);
template<class v_cell>
bool cut_cell_base(v_cell &c,double x,double y,double z);
bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
private:
const int w_id;
const double xc,yc,zc,ac;
};
/** \brief A class representing a cylindrical wall object.
*
* This class represents a open cylinder wall object. */
struct wall_cylinder : public wall {
public:
/** Constructs a cylinder wall object.
* \param[in] (xc_,yc_,zc_) a point on the axis of the
* cylinder.
* \param[in] (xa_,ya_,za_) a vector pointing along the
* direction of the cylinder.
* \param[in] rc_ the radius of the cylinder
* \param[in] w_id_ an ID number to associate with the wall for
* neighbor tracking. */
wall_cylinder(double xc_,double yc_,double zc_,double xa_,double ya_,double za_,double rc_,int w_id_=-99)
: w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), xa(xa_), ya(ya_), za(za_),
asi(1/(xa_*xa_+ya_*ya_+za_*za_)), rc(rc_) {}
bool point_inside(double x,double y,double z);
template<class v_cell>
bool cut_cell_base(v_cell &c,double x,double y,double z);
bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
private:
const int w_id;
const double xc,yc,zc,xa,ya,za,asi,rc;
};
/** \brief A class representing a conical wall object.
*
* This class represents a cone wall object. */
struct wall_cone : public wall {
public:
/** Constructs a cone wall object.
* \param[in] (xc_,yc_,zc_) the apex of the cone.
* \param[in] (xa_,ya_,za_) a vector pointing along the axis of
* the cone.
* \param[in] ang the angle (in radians) of the cone, measured
* from the axis.
* \param[in] w_id_ an ID number to associate with the wall for
* neighbor tracking. */
wall_cone(double xc_,double yc_,double zc_,double xa_,double ya_,double za_,double ang,int w_id_=-99)
: w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), xa(xa_), ya(ya_), za(za_),
asi(1/(xa_*xa_+ya_*ya_+za_*za_)),
gra(tan(ang)), sang(sin(ang)), cang(cos(ang)) {}
bool point_inside(double x,double y,double z);
template<class v_cell>
bool cut_cell_base(v_cell &c,double x,double y,double z);
bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
private:
const int w_id;
const double xc,yc,zc,xa,ya,za,asi,gra,sang,cang;
};
}
#endif

32
extern/voro++/src/worklist.hh vendored Normal file
View File

@@ -0,0 +1,32 @@
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr@alum.mit.edu
// Date : August 30th 2011
/** \file worklist.hh
* \brief Header file for setting constants used in the block worklists that are
* used during cell computation.
*
* This file is automatically generated by worklist_gen.pl and it is not
* intended to be edited by hand. */
#ifndef VOROPP_WORKLIST_HH
#define VOROPP_WORKLIST_HH
namespace voro {
/** Each region is divided into a grid of subregions, and a worklist is
# constructed for each. This parameter sets is set to half the number of
# subregions that the block is divided into. */
const int wl_hgrid=4;
/** The number of subregions that a block is subdivided into, which is twice
the value of hgrid. */
const int wl_fgrid=8;
/** The total number of worklists, set to the cube of hgrid. */
const int wl_hgridcu=64;
/** The number of elements in each worklist. */
const int wl_seq_length=64;
}
#endif

236
extern/voro++/src/worklist_gen.pl vendored Executable file
View File

@@ -0,0 +1,236 @@
#!/usr/bin/perl
# Voro++, a 3D cell-based Voronoi library
#
# Author : Chris H. Rycroft (LBL / UC Berkeley)
# Email : chr@alum.mit.edu
# Date : August 30th 2011
#
# worklist_gen.pl - this perl script is used to automatically generate the
# worklists of blocks that are stored in worklist.cc, that are used by the
# compute_cell() routine to ensure maximum efficiency
# Each region is divided into a grid of subregions, and a worklist is
# constructed for each. This parameter sets is set to half the number of
# subregions that the block is divided into.
$hr=4;
# This parameter is automatically set to the the number of subregions that the
# block is divided into
$r=$hr*2;
# This parameter sets the total number of block entries in each worklist
$ls=63;
# When the worklists are being constructed, a mask array is made use of. To
# prevent the creation of array elements with negative indices, this parameter
# sets an arbitrary displacement.
$dis=8;
# Constants used mask indexing
$d=2*$dis+1;$dd=$d*$d;$d0=(1+$d+$dd)*$dis;
use Math::Trig;
# Construct the worklist header file, based on the parameters above
open W,">worklist.hh";
print W <<EOF;
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr\@alum.mit.edu
// Date : August 30th 2011
/** \\file worklist.hh
* \\brief Header file for setting constants used in the block worklists that are
* used during cell computation.
*
* This file is automatically generated by worklist_gen.pl and it is not
* intended to be edited by hand. */
#ifndef VOROPP_WORKLIST_HH
#define VOROPP_WORKLIST_HH
namespace voro {
/** Each region is divided into a grid of subregions, and a worklist is
# constructed for each. This parameter sets is set to half the number of
# subregions that the block is divided into. */
EOF
print W "const int wl_hgrid=$hr;\n";
print W <<EOF;
/** The number of subregions that a block is subdivided into, which is twice
the value of hgrid. */
EOF
print W "const int wl_fgrid=$r;\n";
print W <<EOF;
/** The total number of worklists, set to the cube of hgrid. */
EOF
printf W "const int wl_hgridcu=%d;\n",$hr*$hr*$hr;
print W <<EOF;
/** The number of elements in each worklist. */
EOF
printf W "const int wl_seq_length=%d;\n",$ls+1;
print W <<EOF;
}
#endif
EOF
close W;
# Construct the preamble to the worklist.cc file
open W,">v_base_wl.cc";
print W <<EOF;
// Voro++, a 3D cell-based Voronoi library
//
// Author : Chris H. Rycroft (LBL / UC Berkeley)
// Email : chr\@alum.mit.edu
// Date : August 30th 2011
/** \\file v_base_wl.cc
* \\brief The table of block worklists that are used during the cell
* computation, which is part of the voro_base class.
*
* This file is automatically generated by worklist_gen.pl and it is not
* intended to be edited by hand. */
EOF
printf W "const unsigned int voro_base::wl[wl_seq_length*wl_hgridcu]={\n";
# Now create a worklist for each subregion
for($kk=0;$kk<$hr;$kk++) {
for($jj=0;$jj<$hr;$jj++) {
for($ii=0;$ii<$hr;$ii++) {
worklist($ii,$jj,$kk);
}
}
}
# Finish the file and close it
print W "};\n";
close W;
# A subroutine
sub worklist {
# print "@_[0] @_[1] @_[2]\n";
$ind=@_[0]+$hr*(@_[1]+$hr*@_[2]);
$ac=0;$v+=2;
$xp=$yp=$zp=0;
$x=(@_[0]+0.5)/$r;
$y=(@_[1]+0.5)/$r;
$z=(@_[2]+0.5)/$r;
$m[$d0]=$v;
add(1,0,0);add(0,1,0);add(0,0,1);
add(-1,0,0);add(0,-1,0);add(0,0,-1);
foreach $l (1..$ls) {
$minwei=1e9;
foreach (0..$ac-1) {
$xt=@a[3*$_];$yt=@a[3*$_+1];$zt=@a[3*$_+2];
# $wei=dis($x,$y,$z,$xt,$yt,$zt)+1*acos(($xt*$xp+$yt*$yp+$zt*$zp)/($xt*$xt+$yt*$yt+$zt*$zt)*($xp*$xp+$yp*$yp+$zp*$zp));
$wei=adis($x,$y,$z,$xt,$yt,$zt)+0.02*sqrt(($xt-$xp)**2+($yt-$yp)**2+($zt-$zp)**2);
$nx=$_,$minwei=$wei if $wei<$minwei;
}
$xp=@a[3*$nx];$yp=@a[3*$nx+1];$zp=@a[3*$nx+2];
add($xp+1,$yp,$zp);add($xp,$yp+1,$zp);add($xp,$yp,$zp+1);
add($xp-1,$yp,$zp);add($xp,$yp-1,$zp);add($xp,$yp,$zp-1);
# print "=> $l $xp $yp $zp\n" if $l<4;
push @b,(splice @a,3*$nx,3);$ac--;
}
# Mark all blocks that are on this worklist entry
$m[$d0]=++$v;
for($i=0;$i<$#b;$i+=3) {
$xt=$b[$i];$yt=$b[$i+1];$zt=$b[$i+2];
$m[$d0+$xt+$d*$yt+$dd*$zt]=$v;
}
# Find which neighboring outside blocks need to be marked when
# considering this block, being as conservative as possible by
# overwriting the marks, so that the last possible entry that can reach
# a block is used
for($i=$j=0;$i<$#b;$i+=3,$j++) {
$xt=$b[$i];$yt=$b[$i+1];$zt=$b[$i+2];
$k=$d0+$xt+$yt*$d+$zt*$dd;
$la[$k+1]=$j, $m[$k+1]=$v+1 if $xt>=0 && $m[$k+1]!=$v;
$la[$k+$d]=$j, $m[$k+$d]=$v+1 if $yt>=0 && $m[$k+$d]!=$v;
$la[$k+$dd]=$j, $m[$k+$dd]=$v+1 if $zt>=0 && $m[$k+$dd]!=$v;
$la[$k-1]=$j, $m[$k-1]=$v+1 if $xt<=0 && $m[$k-1]!=$v;
$la[$k-$d]=$j, $m[$k-$d]=$v+1 if $yt<=0 && $m[$k-$d]!=$v;
$la[$k-$dd]=$j, $m[$k-$dd]=$v+1 if $zt<=0 && $m[$k-$dd]!=$v;
}
# Scan to ensure that no neighboring blocks have been missed by the
# outwards-looking logic in the above section
for($i=0;$i<$#b;$i+=3) {
wl_check($d0+$b[$i]+$b[$i+1]*$d+$b[$i+2]*$dd);
}
# Compute the number of entries where outside blocks do not need to be
# consider
for($i=$j=0;$i<$#b;$i+=3,$j++) {
$k=$d0+$b[$i]+$b[$i+1]*$d+$b[$i+2]*$dd;
last if $m[$k+1]!=$v;
last if $m[$k+$d]!=$v;
last if $m[$k+$dd]!=$v;
last if $m[$k-1]!=$v;
last if $m[$k-$d]!=$v;
last if $m[$k-$dd]!=$v;
}
print W "\t$j";
# Create worklist entry and save to file
$j=0;
while ($#b>0) {
$xt=shift @b;$yt=shift @b;$zt=shift @b;
$k=$d0+$xt+$yt*$d+$zt*$dd;
$o=0;
$o|=1 if $m[$k+1]!=$v && $la[$k+1]==$j;
$o^=3 if $m[$k-1]!=$v && $la[$k-1]==$j;
$o|=8 if $m[$k+$d]!=$v && $la[$k+$d]==$j;
$o^=24 if $m[$k-$d]!=$v && $la[$k-$d]==$j;
$o|=64 if $m[$k+$dd]!=$v && $la[$k+$dd]==$j;
$o^=192 if $m[$k-$dd]!=$v && $la[$k-$dd]==$j;
printf W ",%#x",(($xt+64)|($yt+64)<<7|($zt+64)<<14|$o<<21);
$j++;
}
print W "," unless $ind==$hr*$hr*$hr-1;
print W "\n";
# Remove list memory
undef @a;
undef @b;
}
sub add {
if ($m[$d0+@_[0]+$d*@_[1]+$dd*@_[2]]!=$v) {
$ac++;
push @a,@_[0],@_[1],@_[2];
$m[$d0+@_[0]+$d*@_[1]+$dd*@_[2]]=$v;
}
}
sub dis {
$xl=@_[3]+0.3-@_[0];$xh=@_[3]+0.7-@_[0];
$yl=@_[4]+0.3-@_[1];$yh=@_[4]+0.7-@_[1];
$zl=@_[5]+0.3-@_[2];$zh=@_[5]+0.7-@_[2];
$dis=(abs($xl)<abs($xh)?$xl:$xh)**2
+(abs($yl)<abs($yh)?$yl:$yh)**2
+(abs($zl)<abs($zh)?$zl:$zh)**2;
return sqrt $dis;
}
sub adis {
$xco=$yco=$zco=0;
$xco=@_[0]-@_[3] if @_[3]>0;
$xco=@_[0]-@_[3]-1 if @_[3]<0;
$yco=@_[1]-@_[4] if @_[4]>0;
$yco=@_[1]-@_[4]-1 if @_[4]<0;
$zco=@_[2]-@_[5] if @_[5]>0;
$zco=@_[2]-@_[5]-1 if @_[5]<0;
return sqrt $xco*$xco+$yco*$yco+$zco*$zco;
}
sub wl_check {
die "Failure in worklist construction\n" if $m[@_[0]+1]<$v||$m[@_[0]-1]<$v
||$m[@_[0]+$d]<$v||$m[@_[0]-$d]<$v
||$m[@_[0]+$dd]<$v||$m[@_[0]-$dd]<$v;
}

View File

@@ -1069,6 +1069,54 @@ static void sync_mesh_fluid_motion(BL::Object& b_ob, Scene *scene, Mesh *mesh)
}
}
static bool sync_mesh_precalculated_motion(BL::Mesh& b_mesh, BL::Scene& b_scene, Scene *scene, Mesh *mesh)
{
if(scene->need_motion() == Scene::MOTION_NONE)
return false;
/* Find or add attribute */
float3 *P = &mesh->verts[0];
Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
if(!attr_mP) {
attr_mP = mesh->attributes.add(ATTR_STD_MOTION_VERTEX_POSITION);
}
/* Only export previous and next frame, we don't have any in between data. */
float motion_times[2] = {-1.0f, 1.0f};
for(int step = 0; step < 2; step++) {
/* those are TIMES, but treated like Frames ? makes too high values, so take fps into account*/
float relative_time = motion_times[step] * scene->motion_shutter_time() * 0.5f / b_scene.render().fps();
float3 *mP = attr_mP->data_float3() + step*mesh->verts.size();
int i = 0;
BL::MeshVertexFloatPropertyLayer vlX = b_mesh.vertex_layers_float[std::string("velX")];
BL::MeshVertexFloatPropertyLayer vlY = b_mesh.vertex_layers_float[std::string("velY")];
BL::MeshVertexFloatPropertyLayer vlZ = b_mesh.vertex_layers_float[std::string("velZ")];
BL::Pointer ptrX = (BL::Pointer)vlX;
BL::Pointer ptrY = (BL::Pointer)vlY;
BL::Pointer ptrZ = (BL::Pointer)vlZ;
if (!ptrX || !ptrY || !ptrZ || vlX.data.length() != mesh->verts.size())
{
return false;
}
for(i = 0; i < mesh->verts.size(); i++)
{
float x = vlX.data[i].value();
float y = vlY.data[i].value();
float z = vlZ.data[i].value();
//printf("Vel %f %f %f\n", (double)x, (double)y, (double)z);
mP[i] = P[i] + make_float3(x, y, z) * relative_time;
}
}
return true;
}
Mesh *BlenderSync::sync_mesh(BL::Object& b_ob,
bool object_updated,
bool hide_tris)
@@ -1210,6 +1258,8 @@ Mesh *BlenderSync::sync_mesh(BL::Object& b_ob,
b_ob.cache_release();
}
sync_mesh_precalculated_motion(b_mesh, b_scene, scene, mesh);
/* free derived mesh */
b_data.meshes.remove(b_mesh, false, true, false);
}
@@ -1270,6 +1320,12 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
if(b_fluid_domain)
return;
/* other precalculated motion (remesher for now only) */
BL::RemeshModifier b_remesher = object_metaball_remesher_find(b_ob);
BL::FractureModifier b_fracture = object_fracture_modifier_find(b_ob);
if(b_remesher || b_fracture)
return;
if(ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
/* get derived mesh */
b_mesh = object_to_mesh(b_data,

View File

@@ -582,6 +582,36 @@ static inline BL::DomainFluidSettings object_fluid_domain_find(BL::Object b_ob)
return BL::DomainFluidSettings(PointerRNA_NULL);
}
static inline BL::RemeshModifier object_metaball_remesher_find(BL::Object b_ob)
{
BL::Object::modifiers_iterator b_mod;
for(b_ob.modifiers.begin(b_mod); b_mod != b_ob.modifiers.end(); ++b_mod) {
if(b_mod->is_a(&RNA_RemeshModifier)) {
BL::RemeshModifier b_fmd(*b_mod);
if(b_fmd.mode() == BL::RemeshModifier::mode_METABALL)
return b_fmd;
}
}
return BL::RemeshModifier(PointerRNA_NULL);
}
static inline BL::FractureModifier object_fracture_modifier_find(BL::Object b_ob)
{
BL::Object::modifiers_iterator b_mod;
for(b_ob.modifiers.begin(b_mod); b_mod != b_ob.modifiers.end(); ++b_mod) {
if(b_mod->is_a(&RNA_FractureModifier)) {
BL::FractureModifier b_fmd(*b_mod);
return b_fmd;
}
}
return BL::FractureModifier(PointerRNA_NULL);
}
static inline Mesh::SubdivisionType object_subdivision_type(BL::Object& b_ob, bool preview, bool experimental)
{
PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles");

View File

@@ -517,6 +517,10 @@ bool ImageManager::file_load_image(Image *img,
/* Could be that we've run out of memory. */
return false;
}
if(pixels == NULL) {
/* Could be that we've run out of memory. */
return false;
}
bool cmyk = false;
const size_t num_pixels = ((size_t)width) * height * depth;
if(in) {

View File

@@ -20,7 +20,7 @@
*
* The Original Code is: all of this file.
*
* Contributor(s): Joshua Leung, Sergej Reich
* Contributor(s): Joshua Leung, Sergej Reich, Martin Felke
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -66,14 +66,32 @@ typedef struct rbMeshData rbMeshData;
/* Constraint */
typedef struct rbConstraint rbConstraint;
/* Collision feedback (manifolds and contact points */
typedef struct rbContactPoint {
float contact_force;
int contact_body_indexA;
int contact_body_indexB;
float contact_pos_world_onA[3];
float contact_pos_world_onB[3];
} rbContactPoint;
/*Subclass because of Internal Tick Callback... sigh why doesnt this work with a simple collision callback ? */
typedef void (*draw_string)(float loc[3], const char *str, const size_t len, float color[3]);
/* ********************************** */
/* Dynamics World Methods */
/* Setup ---------------------------- */
void RB_dworld_init_compounds(rbDynamicsWorld *world);
/* Create a new dynamics world instance */
// TODO: add args to set the type of constraint solvers, etc.
rbDynamicsWorld *RB_dworld_new(const float gravity[3]);
rbDynamicsWorld *RB_dworld_new(const float gravity[3], void* blenderWorld, void *blenderScene, int (*callback)(void*, void*, void*, void*, void*, bool),
void (*contactCallback)(rbContactPoint*, void *), void (*idCallbackOut)(void*, void*, int*, int*),
void (*tickCallback)(float, void *));
/* Delete the given dynamics world, and free any extra data it may require */
void RB_dworld_delete(rbDynamicsWorld *world);
@@ -94,6 +112,8 @@ void RB_dworld_set_split_impulse(rbDynamicsWorld *world, int split_impulse);
/* Step the simulation by the desired amount (in seconds) with extra controls on substep sizes and maximum substeps */
void RB_dworld_step_simulation(rbDynamicsWorld *world, float timeStep, int maxSubSteps, float timeSubStep);
void RB_dworld_debug_draw(rbDynamicsWorld *world, draw_string str_callback);
/* Export -------------------------- */
/* Exports the dynamics world to physics simulator's serialisation format */
@@ -105,7 +125,7 @@ void RB_dworld_export(rbDynamicsWorld *world, const char *filename);
/* Setup ---------------------------- */
/* Add RigidBody to dynamics world */
void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *body, int col_groups);
void RB_dworld_add_body(rbDynamicsWorld *world, rbRigidBody *body, int col_groups, void* meshIsland, void *blenderOb, int linear_index);
/* Remove RigidBody from dynamics world */
void RB_dworld_remove_body(rbDynamicsWorld *world, rbRigidBody *body);
@@ -120,7 +140,8 @@ void RB_world_convex_sweep_test(
/* ............ */
/* Create new RigidBody instance */
rbRigidBody *RB_body_new(rbCollisionShape *shape, const float loc[3], const float rot[4]);
rbRigidBody *RB_body_new(rbCollisionShape *shape, const float loc[3], const float rot[4], bool use_compounds, float dampening, float factor,
float min_impulse, float stability_factor, const float bbox[3]);
/* Delete the given RigidBody instance */
void RB_body_delete(rbRigidBody *body);
@@ -167,6 +188,10 @@ void RB_body_set_angular_sleep_thresh(rbRigidBody *body, float value);
void RB_body_set_sleep_thresh(rbRigidBody *body, float linear, float angular);
/* Force and Torque */
void RB_body_get_total_force(rbRigidBody *body, float v_out[3]);
void RB_body_get_total_torque(rbRigidBody *body, float v_out[3]);
/* Linear Velocity */
void RB_body_get_linear_velocity(rbRigidBody *body, float v_out[3]);
void RB_body_set_linear_velocity(rbRigidBody *body, const float v_in[3]);
@@ -210,6 +235,9 @@ void RB_body_get_orientation(rbRigidBody *body, float v_out[4]);
void RB_body_apply_central_force(rbRigidBody *body, const float v_in[3]);
void RB_body_apply_impulse(rbRigidBody* object, const float impulse[3], const float pos[3]);
void RB_body_apply_force(rbRigidBody* object, const float force[3], const float pos[3]);
/* ********************************** */
/* Collision Shape Methods */
@@ -237,6 +265,10 @@ rbCollisionShape *RB_shape_new_trimesh(rbMeshData *mesh);
/* 2b - GImpact Meshes */
rbCollisionShape *RB_shape_new_gimpact_mesh(rbMeshData *mesh);
int RB_shape_get_num_verts(rbCollisionShape *shape);
rbCollisionShape *RB_shape_new_compound(void);
void RB_shape_add_compound_child(rbCollisionShape** compound, rbCollisionShape* child, float loc[3], float rot[4]);
/* Cleanup --------------------------- */
@@ -269,6 +301,7 @@ rbConstraint *RB_constraint_new_piston(float pivot[3], float orn[4], rbRigidBody
rbConstraint *RB_constraint_new_6dof(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2);
rbConstraint *RB_constraint_new_6dof_spring(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2);
rbConstraint *RB_constraint_new_motor(float pivot[3], float orn[4], rbRigidBody *rb1, rbRigidBody *rb2);
rbConstraint *RB_constraint_new_compound(rbRigidBody *rb1, rbRigidBody *rb2);
/* ............ */
@@ -280,6 +313,8 @@ void RB_constraint_delete(rbConstraint *con);
/* Enable or disable constraint */
void RB_constraint_set_enabled(rbConstraint *con, int enabled);
int RB_constraint_is_enabled(rbConstraint *con);
float RB_constraint_get_applied_impulse(rbConstraint *con);
/* Limits */
#define RB_LIMIT_LIN_X 0
@@ -316,6 +351,9 @@ void RB_constraint_set_solver_iterations(rbConstraint *con, int num_solver_itera
/* Set breaking impulse threshold, if constraint shouldn't break it can be set to FLT_MAX */
void RB_constraint_set_breaking_threshold(rbConstraint *con, float threshold);
float RB_constraint_get_breaking_threshold(rbConstraint *con);
void RB_constraint_set_id(rbConstraint *con, char id[64]);
/* ********************************** */

File diff suppressed because it is too large Load Diff

View File

@@ -228,7 +228,20 @@ class ExecutePreset(Operator):
# execute the preset using script.python_file_run
if ext == ".py":
bpy.ops.script.python_file_run(filepath=filepath)
#FRACTURE MODIFIER HACK, cant get bpy.context.fracture to be run via py script else...
#so fake a context here
mod = False
if context.object is not None:
for md in context.object.modifiers:
if md.type == 'FRACTURE':
mod = True
break
if (mod):
ctx = bpy.context.copy()
ctx["fracture"] = md
bpy.ops.script.python_file_run(ctx, filepath=filepath)
else:
bpy.ops.script.python_file_run(filepath=filepath)
elif ext == ".xml":
import rna_xml
rna_xml.xml_file_run(context,
@@ -601,6 +614,111 @@ class AddPresetKeyconfig(AddPresetBase, Operator):
if self.remove_active:
keyconfigs.remove(keyconfigs.active)
class AddPresetFracture(AddPresetBase, Operator):
"""Add or remove a Fracture Preset"""
bl_idname = "fracture.preset_add"
bl_label = "Add Fracture Preset"
preset_menu = "FRACTURE_MT_presets"
preset_defines = [
"fracture = bpy.context.fracture"
]
preset_values = [
"fracture.frac_algorithm",
"fracture.shard_count",
"fracture.cluster_count",
"fracture.point_seed",
"fracture.shards_to_islands",
"fracture.auto_execute",
"fracture.use_constraints",
"fracture.constraint_limit",
"fracture.contact_dist",
"fracture.breaking_threshold",
"fracture.cluster_breaking_threshold",
"fracture.point_source",
"fracture.extra_group",
"fracture.dm_group",
"fracture.use_particle_birth_coordinates",
"fracture.splinter_axis",
"fracture.splinter_length",
"fracture.percentage",
"fracture.breaking_percentage",
"fracture.breaking_percentage_weighted",
"fracture.breaking_angle",
"fracture.breaking_angle_weighted",
"fracture.breaking_distance",
"fracture.breaking_distance_weighted",
"fracture.cluster_breaking_percentage",
"fracture.cluster_breaking_angle",
"fracture.cluster_breaking_distance",
"fracture.solver_iterations_override",
"fracture.use_mass_dependent_thresholds",
"fracture.thresh_vertex_group",
"fracture.ground_vertex_group",
"fracture.inner_vertex_group",
"fracture.autohide_dist",
"fracture.fix_normals",
"fracture.execute_threaded",
"fracture.use_breaking",
"fracture.nor_range",
"fracture.cluster_group",
"fracture.cutter_group",
"fracture.grease_offset",
"fracture.grease_decimate",
"fracture.use_greasepencil_edges",
"fracture.cutter_axis",
"fracture.cluster_constraint_type",
"fracture.constraint_target",
"fracture.fracture_mode",
"fracture.dynamic_force",
"fracture.limit_impact",
"fracture.use_compounds",
# "fracture.impulse_dampening",
# "fracture.directional_factor",
"fracture.minimum_impulse",
"fracture.mass_threshold_factor",
"fracture.autohide_filter_group",
"fracture.uv_layer",
"fracture.inner_material",
"fracture.boolean_solver",
"fracture.boolean_double_threshold",
"fracture.dynamic_percentage",
"fracture.dynamic_new_constraints",
"fracture.dynamic_min_size",
"fracture.use_constraint_collision",
"fracture.inner_crease",
"fracture.material_offset_difference",
"fracture.material_offset_intersect",
"fracture.orthogonality_factor",
"fracture.keep_distort",
"fracture.do_merge",
"fracture.constraint_type",
"fracture.automerge_dist",
"fracture.deform_distance",
"fracture.deform_distance_weighted",
"fracture.cluster_deform_distance",
"fracture.deform_angle",
"fracture.deform_angle_weighted",
"fracture.cluster_deform_angle",
"fracture.deform_weakening",
"fracture.use_centroids",
"fracture.use_vertices",
"fracture.use_self_collision",
"fracture.grid_resolution",
"fracture.min_acceleration",
"fracture.max_acceleration",
"fracture.acceleration_fade",
"fracture.use_animated_mesh",
"fracture.animated_mesh_input",
"fracture.use_animated_mesh_rotation",
"fracture.grid_offset",
"fracture.grid_spacing",
"fracture.use_constraint_group",
]
preset_subdir = "fracture"
class AddPresetOperator(AddPresetBase, Operator):
"""Add or remove an Operator Preset"""
@@ -688,6 +806,7 @@ classes = (
AddPresetCamera,
AddPresetCloth,
AddPresetFluid,
AddPresetFracture,
AddPresetHairDynamics,
AddPresetInteraction,
AddPresetInterfaceTheme,

View File

@@ -116,6 +116,14 @@ class BakeToKeyframes(Operator):
obj = context.object
return (obj and obj.rigid_body)
def has_fracture_modifier(self, ob, report=False):
for m in ob.modifiers:
if m.type == 'FRACTURE':
if (report == True):
self.report({'WARNING'}, "Object '%s' has a fracture modifier, use 'Convert to Objects' before 'Bake to Keyframes'" % ob.name)
return True
return False
def execute(self, context):
bake = []
objects = []
@@ -124,10 +132,13 @@ class BakeToKeyframes(Operator):
frames_step = range(self.frame_start, self.frame_end + 1, self.step)
frames_full = range(self.frame_start, self.frame_end + 1)
constraints = []
# filter objects selection
for obj in context.selected_objects:
if not obj.rigid_body or obj.rigid_body.type != 'ACTIVE':
if (not obj.rigid_body or obj.rigid_body.type != 'ACTIVE' or self.has_fracture_modifier(obj, True)):
obj.select = False
if (obj.rigid_body_constraint):
constraints.append(obj)
objects = context.selected_objects
@@ -173,8 +184,29 @@ class BakeToKeyframes(Operator):
bpy.ops.anim.keyframe_insert(type='BUILTIN_KSI_LocRot', confirm_success=False)
# remove baked objects from simulation
bpy.ops.rigidbody.objects_remove()
# remove baked objects from simulation, only if no Fracture Modifier is detected (messes up bake possibly)!
hasFracture = False
for obj in bpy.data.objects:
if (self.has_fracture_modifier(obj)):
hasFracture = True
break
if (hasFracture == False):
#remove (selected) constraints first
for obj in constraints:
obj.select = True
bpy.ops.rigidbody.constraints_remove()
for obj in constraints:
obj.select = False
obj.hide = True
bpy.ops.rigidbody.objects_remove()
else:
# set to kinematic only
for obj in objects:
obj.rigid_body.kinematic = True
# clean up keyframes
for obj in objects:

View File

@@ -52,6 +52,7 @@ _modules = [
"properties_physics_dynamicpaint",
"properties_physics_field",
"properties_physics_fluid",
"properties_physics_fracture",
"properties_physics_rigidbody",
"properties_physics_rigidbody_constraint",
"properties_physics_smoke",

View File

@@ -153,6 +153,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.row().prop(md, "offset_type", expand=True)
def BOOLEAN(self, layout, ob, md):
if not bpy.app.build_options.mod_boolean:
layout.label("Built without Boolean modifier")
return
split = layout.split()
col = split.column()
@@ -404,6 +408,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
def FLUID_SIMULATION(self, layout, ob, md):
layout.label(text="Settings are inside the Physics tab")
def FRACTURE(self, layout, ob, md):
layout.label(text="Settings are inside the Physics tab")
def HOOK(self, layout, ob, md):
use_falloff = (md.falloff_type != 'NONE')
split = layout.split()
@@ -1153,14 +1160,38 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row.prop(md, "octree_depth")
row.prop(md, "scale")
if md.mode == 'SHARP':
layout.prop(md, "sharpness")
if md.mode == 'METABALL':
row = layout.row()
row.prop(md, "input")
if 'PARTICLES' in md.input:
row = layout.row()
row.prop(md, "psys")
row = layout.row()
row.prop(md, "filter")
row = layout.row()
col = row.column(align=True)
col.prop(md, "mball_size")
col = row.column(align=True)
col.label("Display Parameters:")
col.prop(md, "mball_threshold")
col.prop(md, "mball_resolution")
col.prop(md, "mball_render_resolution")
layout.prop_search(md, "size_vertex_group", ob, "vertex_groups", text = "Size Vertex Group")
layout.prop(md, "use_smooth_shade")
layout.prop(md, "use_smooth_shade")
layout.prop(md, "use_remove_disconnected")
row = layout.row()
row.active = md.use_remove_disconnected
row.prop(md, "threshold")
else:
row = layout.row()
row.prop(md, "octree_depth")
row.prop(md, "scale")
if md.mode == 'SHARP':
layout.prop(md, "sharpness")
layout.prop(md, "use_smooth_shade")
layout.prop(md, "use_remove_disconnected")
row = layout.row()
row.active = md.use_remove_disconnected
row.prop(md, "threshold")
@staticmethod
def vertex_weight_mask(layout, ob, md):

View File

@@ -76,6 +76,10 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
physics_add(self, col, context.collision, "Collision", 'COLLISION', 'MOD_PHYSICS', False)
physics_add(self, col, context.cloth, "Cloth", 'CLOTH', 'MOD_CLOTH', True)
physics_add(self, col, context.dynamic_paint, "Dynamic Paint", 'DYNAMIC_PAINT', 'MOD_DYNAMICPAINT', True)
physics_add(self, col, context.fracture, "Fracture", 'FRACTURE', 'MOD_EXPLODE', True)
if obj.type in {'CURVE', 'SURFACE', 'FONT'}:
physics_add(self, col, context.fracture, "Fracture", 'FRACTURE', 'MOD_EXPLODE', True)
col = split.column()
@@ -91,6 +95,12 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
"rigidbody.object_remove",
'MESH_ICOSPHERE') # XXX: need dedicated icon
if obj.type == 'CURVE' or obj.type == 'SURFACE' or obj.type == 'FONT': #works with fracture modifier
physics_add_special(self, col, obj.rigid_body, "Rigid Body",
"rigidbody.object_add",
"rigidbody.object_remove",
'MESH_ICOSPHERE') # XXX: need dedicated icon
# all types of objects can have rigid body constraint
physics_add_special(self, col, obj.rigid_body_constraint, "Rigid Body Constraint",
"rigidbody.constraint_add",

View File

@@ -127,8 +127,8 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
col = split.column()
subsplit = col.split()
subcol = subsplit.column()
if fluid.use_animated_mesh:
subcol.enabled = False
#if fluid.use_animated_mesh:
# subcol.enabled = False
subcol.label(text="Slip Type:")
subcol.prop(fluid, "slip_type", text="")
if fluid.slip_type == 'PARTIALSLIP':

View File

@@ -0,0 +1,334 @@
# ##### 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.
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy
from bpy.types import Panel, Menu, UIList
from bpy.app.translations import pgettext_iface as iface_
class FRACTURE_MT_presets(Menu):
bl_label = "Fracture Presets"
preset_subdir = "fracture"
preset_operator = "script.execute_preset"
draw = Menu.draw_preset
class PhysicButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "physics"
@classmethod
def poll(cls, context):
ob = context.object
rd = context.scene.render
return (ob and (ob.type == 'MESH' or ob.type == 'CURVE' or ob.type == 'SURFACE' or ob.type == 'FONT')) and (not rd.use_game_engine) and (context.fracture)
#class FRACTURE_UL_fracture_settings(UIList):
# def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
# fl = item
# if self.layout_type in {'DEFAULT', 'COMPACT'}:
# layout.prop(fl, "name", text="", emboss=False, icon_value=icon)
# elif self.layout_type in {'GRID'}:
# layout.alignment = 'CENTER'
# layout.label(text="", icon_value=icon)
class PHYSICS_PT_fracture_anim_mesh(PhysicButtonsPanel, Panel):
bl_label = "Fracture Animated Mesh Settings"
def draw(self, context):
layout = self.layout
md = context.fracture
layout.context_pointer_set("modifier", md)
row = layout.row()
row.prop(md, "use_animated_mesh")
row.prop(md, "use_animated_mesh_rotation")
row = layout.row()
row.prop(md, "animated_mesh_limit")
row = layout.row()
row.prop(md, "animated_mesh_input")
row = layout.row()
row.operator("object.fracture_anim_bind", text="Bind", icon="UV_VERTEXSEL")
# layout.template_list("FRACTURE_UL_fracture_settings", "", md, "fracture_settings", md, "active_setting", rows=3)
class PHYSICS_PT_fracture(PhysicButtonsPanel, Panel):
bl_label = "Fracture Settings"
def icon(self, bool):
if bool:
return 'TRIA_DOWN'
else:
return 'TRIA_RIGHT'
def draw(self, context):
layout = self.layout
md = context.fracture
ob = context.object
if md.fracture_mode != 'EXTERNAL':
layout.label(text="Presets:")
sub = layout.row(align=True)
sub.menu("FRACTURE_MT_presets", text=bpy.types.FRACTURE_MT_presets.bl_label)
sub.operator("fracture.preset_add", text="", icon='ZOOMIN')
sub.operator("fracture.preset_add", text="", icon='ZOOMOUT').remove_active = True
else:
layout.label(text="No UI controls here!")
layout.label(text="Control happens via Python")
row = layout.row()
row.prop(md, "fracture_mode")
if md.fracture_mode == 'EXTERNAL':
# col = layout.column(align=True)
# col.context_pointer_set("modifier", md)
# col.operator("object.rigidbody_convert_to_objects", text = "Convert To Objects")
# col.operator("object.rigidbody_convert_to_keyframes", text = "Convert To Keyframed Objects")
return
if md.fracture_mode == 'DYNAMIC':
row = layout.row(align=True)
row.prop(md, "dynamic_force")
row.prop(md, "dynamic_percentage")
col = layout.column(align=True)
col.prop(md, "dynamic_new_constraints")
row = col.row(align=True)
row.prop(md, "limit_impact")
row.prop(md, "dynamic_min_size")
layout.prop(md, "frac_algorithm")
if md.frac_algorithm in {'BOOLEAN', 'BOOLEAN_FRACTAL'}:
col = layout.column(align=True)
col.prop(md, "boolean_double_threshold")
col = layout.column(align=True)
col.prop(md, "shard_count")
col.prop(md, "point_seed")
if md.frac_algorithm in {'BOOLEAN', 'BISECT_FILL', 'BISECT_FAST_FILL', 'BOOLEAN_FRACTAL'}:
col = layout.column()
col.prop(md, "inner_material")
col.prop_search(md, "uv_layer", ob.data, "uv_textures")
if md.frac_algorithm == 'BOOLEAN_FRACTAL':
col = layout.column(align=True)
row = col.row(align=True)
row.prop(md, "fractal_cuts")
row.prop(md, "fractal_iterations")
row = col.row(align=True)
row.prop(md, "fractal_amount")
row.prop(md, "physics_mesh_scale")
row = layout.row()
row.prop(md, "shards_to_islands")
row.prop(md, "use_smooth")
row = layout.row()
row.prop(md, "auto_execute")
row = layout.row(align=True)
row.prop(md, "splinter_axis")
layout.prop(md, "splinter_length")
box = layout.box()
box.prop(md, "use_experimental", text="Advanced Fracture Settings", icon=self.icon(md.use_experimental), emboss = False)
if md.use_experimental:
box.label("Fracture Point Source:")
col = box.column()
col.prop(md, "point_source")
if 'GRID' in md.point_source:
sub = col.split(0.33)
sub.prop(md, "grid_resolution")
sub.prop(md, "grid_offset")
sub.prop(md, "grid_spacing")
if 'GREASE_PENCIL' in md.point_source:
col.prop(md, "use_greasepencil_edges")
col.prop(md, "grease_offset")
col.prop(md, "grease_decimate")
col.prop(md, "cutter_axis")
col.prop(md, "extra_group")
col.prop(md, "dm_group")
col.prop(md, "use_constraint_group")
col.prop(md, "cutter_group")
if (md.cutter_group):
col.prop(md, "keep_cutter_shards")
col.label("Material Index Offset")
row = col.row(align=True)
row.prop(md, "material_offset_intersect", text="Intersect")
row.prop(md, "material_offset_difference", text="Difference")
col.prop(md, "use_particle_birth_coordinates")
box.prop(md, "percentage")
box.label("Threshold Vertex Group:")
box.prop_search(md, "thresh_vertex_group", ob, "vertex_groups", text = "")
box.label("Passive Vertex Group:")
box.prop_search(md, "ground_vertex_group", ob, "vertex_groups", text = "")
box.label("Inner Vertex Group:")
box.prop_search(md, "inner_vertex_group", ob, "vertex_groups", text = "")
box.prop(md, "inner_crease")
box.label("Acceleration Map:")
box.prop_search(md, "acceleration_vertex_group", ob, "vertex_groups", text = "")
row = box.row(align=True)
row.prop(md, "min_acceleration")
row.prop(md, "max_acceleration")
row.prop(md, "acceleration_fade")
if (md.frac_algorithm in {'BISECT_FAST', 'BISECT_FAST_FILL', 'BOOLEAN_FRACTAL'}):
box.prop(md, "orthogonality_factor", text="Rectangular Alignment")
layout.context_pointer_set("modifier", md)
row = layout.row()
row.operator("object.fracture_refresh", text="Execute Fracture", icon='MOD_EXPLODE').reset = True
row.prop(md, "execute_threaded", text="Threaded (WIP)")
class PHYSICS_PT_fracture_simulation(PhysicButtonsPanel, Panel):
bl_label = "Fracture Constraint Settings"
@classmethod
def poll(cls, context):
md = context.fracture
return PhysicButtonsPanel.poll(context) and md.fracture_mode != 'EXTERNAL'
def draw(self, context):
layout = self.layout
md = context.fracture
ob = context.object
layout.label("Constraint Building Settings")
row = layout.row()
row.prop(md, "use_constraints")
row.prop(md, "use_breaking")
row = layout.row()
row.prop(md, "use_constraint_collision")
row.prop(md, "use_self_collision")
row = layout.row()
row.prop(md, "use_compounds")
row.prop(md, "activate_broken")
col = layout.column(align=True)
col.prop(md, "constraint_target")
col.prop(md, "constraint_type")
col = layout.column(align=True)
col.prop(md, "constraint_limit", text="Constraint limit, per MeshIsland")
col.prop(md, "contact_dist")
layout.label("Constraint Cluster Settings")
layout.prop(md, "cluster_count")
col = layout.column(align=True)
col.prop(md, "cluster_group")
col.prop(md, "cluster_constraint_type", text="Cluster Type")
if md.use_compounds:
layout.label("Compound Breaking Settings")
else:
layout.label("Constraint Breaking Settings")
col = layout.column(align=True)
col.prop(md, "breaking_threshold", text="Threshold")
col.prop(md, "cluster_breaking_threshold")
if md.use_compounds:
#layout.label("Compound Damage Propagation Settings")
col = layout.column(align=True)
col.prop(md, "minimum_impulse")
#col.prop(md, "impulse_dampening")
#col.prop(md, "directional_factor")
col.prop(md, "mass_threshold_factor")
else:
layout.label("Constraint Special Breaking Settings")
col = layout.column(align=True)
row = col.row(align=True)
row.prop(md, "breaking_percentage", text="Percentage")
row.prop(md, "cluster_breaking_percentage", text="Cluster Percentage")
row = col.row(align=True)
row.prop(md, "breaking_angle", text="Angle")
row.prop(md, "cluster_breaking_angle", text="Cluster Angle")
row = col.row(align=True)
row.prop(md, "breaking_distance", text="Distance")
row.prop(md, "cluster_breaking_distance", text="Cluster Distance")
col = layout.column(align=True)
col.prop(md, "solver_iterations_override")
col.prop(md, "cluster_solver_iterations_override")
row = layout.row(align=True)
row.prop(md, "breaking_angle_weighted")
row.prop(md, "breaking_distance_weighted")
row = layout.row(align=True)
row.prop(md, "breaking_percentage_weighted")
row.prop(md, "use_mass_dependent_thresholds", text="Mass Dependent Thresholds")
if not md.use_compounds:
layout.label("Constraint Deform Settings")
col = layout.column(align=True)
row = col.row(align=True)
row.prop(md, "deform_angle", text="Deforming Angle")
row.prop(md, "cluster_deform_angle", text="Cluster Deforming Angle")
row = col.row(align=True)
row.prop(md, "deform_distance", text="Deforming Distance")
row.prop(md, "cluster_deform_distance", text="Cluster Deforming Distance")
col.prop(md, "deform_weakening")
row = layout.row(align=True)
row.prop(md, "deform_angle_weighted")
row.prop(md, "deform_distance_weighted")
class PHYSICS_PT_fracture_utilities(PhysicButtonsPanel, Panel):
bl_label = "Fracture Utilities"
@classmethod
def poll(cls, context):
md = context.fracture
return PhysicButtonsPanel.poll(context) # and md.fracture_mode != 'EXTERNAL'
def draw(self, context):
layout = self.layout
md = context.fracture
layout.prop(md, "autohide_filter_group", text = "Filter Group")
col = layout.column(align=True)
col.prop(md, "autohide_dist")
col.prop(md, "automerge_dist")
row = layout.row()
row.prop(md, "keep_distort")
row.prop(md, "do_merge")
row = layout.row()
row.prop(md, "use_centroids")
row.prop(md, "use_vertices")
row = layout.row()
row.prop(md, "fix_normals")
row.prop(md, "nor_range")
col = layout.column(align=True)
col.context_pointer_set("modifier", md)
col.operator("object.rigidbody_convert_to_objects", text = "Convert To Objects")
col.operator("object.rigidbody_convert_to_keyframes", text = "Convert To Keyframed Objects")
classes = (
FRACTURE_MT_presets,
#FRACTURE_UL_fracture_settings,
PHYSICS_PT_fracture,
PHYSICS_PT_fracture_simulation,
PHYSICS_PT_fracture_utilities,
PHYSICS_PT_fracture_anim_mesh,
)
if __name__ == "__main__": # only for live edit.
from bpy.utils import register_class
for cls in classes:
register_class(cls)

View File

@@ -49,10 +49,39 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
if rbo.type == 'ACTIVE':
row.prop(rbo, "enabled", text="Dynamic")
row.prop(rbo, "kinematic", text="Animated")
if rbo.type == 'ACTIVE':
row = layout.row()
row.prop(rbo, "use_kinematic_deactivation", text="Triggered")
row.prop(rbo, "is_trigger")
if rbo.type == 'ACTIVE':
layout.prop(rbo, "mass")
class PHYSICS_PT_rigid_body_trigger_advanced(PHYSICS_PT_rigidbody_panel, Panel):
bl_label = "Rigid Body Trigger Advanced"
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
obj = context.object
return (obj and obj.rigid_body and
(context.scene.render.engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
ob = context.object
rbo = ob.rigid_body
row = layout.row()
row.prop(rbo, "is_ghost")
row.prop(rbo, "propagate_trigger")
row = layout.row()
row.prop(rbo, "constraint_dissolve")
row.prop(rbo, "dynamic_trigger")
row = layout.row()
row.prop(rbo, "plastic_dissolve")
row.prop(rbo, "stop_trigger")
class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
bl_label = "Rigid Body Collisions"
@@ -75,7 +104,7 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
if rbo.collision_shape in {'MESH', 'CONVEX_HULL'}:
layout.prop(rbo, "mesh_source", text="Source")
if rbo.collision_shape == 'MESH' and rbo.mesh_source == 'DEFORM':
if rbo.collision_shape == 'MESH' and rbo.mesh_source in {'DEFORM', 'FINAL', 'FINAL_SOLID'}:
layout.prop(rbo, "use_deform", text="Deforming")
split = layout.split()
@@ -89,11 +118,13 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
col.label(text="Sensitivity:")
if rbo.collision_shape in {'MESH', 'CONE'}:
col.prop(rbo, "collision_margin", text="Margin")
col.prop(rbo, "use_random_margin", text="Randomize")
else:
col.prop(rbo, "use_margin")
sub = col.column()
sub.active = rbo.use_margin
sub.prop(rbo, "collision_margin", text="Margin")
sub.prop(rbo, "use_random_margin", text="Randomize")
layout.prop(rbo, "collision_groups")
@@ -131,6 +162,8 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
sub.prop(rbo, "deactivate_linear_velocity", text="Linear Vel")
sub.prop(rbo, "deactivate_angular_velocity", text="Angular Vel")
# TODO: other params such as time?
col.label(text="Activation:")
col.prop(rbo, "force_threshold", text="Force Thresh")
col = split.column()
col.label(text="Damping:")
@@ -140,6 +173,7 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
classes = (
PHYSICS_PT_rigid_body,
PHYSICS_PT_rigid_body_trigger_advanced,
PHYSICS_PT_rigid_body_collisions,
PHYSICS_PT_rigid_body_dynamics,
)

View File

@@ -29,6 +29,9 @@ from .properties_physics_common import (
COMPAT_OB_TYPES = {'MESH', 'LATTICE', 'CURVE', 'SURFACE', 'FONT'}
COMPAT_OB_TYPES = {'MESH', 'LATTICE', 'CURVE', 'SURFACE', 'FONT'}
def softbody_panel_enabled(md):
return (md.point_cache.is_baked is False)

View File

@@ -370,6 +370,8 @@ class SCENE_PT_rigid_body_world(SceneButtonsPanel, Panel):
col.prop(rbw, "steps_per_second", text="Steps Per Second")
col.prop(rbw, "solver_iterations", text="Solver Iterations")
layout.prop(rbw, "visualize_physics")
class SCENE_PT_rigid_body_cache(SceneButtonsPanel, Panel):
bl_label = "Rigid Body Cache"

View File

@@ -0,0 +1,48 @@
/*
* ***** 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) Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenkernel/BKE_boolean.h
* \ingroup blenkernel
*/
#ifndef __BKE_BOOLEAN_H__
#define __BKE_BOOLEAN_H__
struct Object;
struct DerivedMesh;
struct BooleanModifierData;
/* Performs a boolean between two mesh objects, it is assumed that both objects
* are in fact mesh object. On success returns a DerivedMesh. On failure
* returns NULL and reports an error. */
struct DerivedMesh *BKE_boolean_bmesh(struct DerivedMesh *dm, struct Object *ob,
struct DerivedMesh *dm_other, struct Object *ob_other, int op_type,
float double_threshold, struct BooleanModifierData *bmd);
#endif /* BKE_BOOLEAN_H */

View File

@@ -225,6 +225,12 @@ void CustomData_bmesh_copy_data(const struct CustomData *source,
struct CustomData *dest, void *src_block,
void **dest_block);
/* need this function exposed to deal with customdata in Fracture Modifier properly */
void CustomData_copy_data_layer(
const CustomData *source, CustomData *dest,
int src_i, int dst_i,
int src_index, int dst_index, int count);
/* frees data in a CustomData object
* return 1 on success, 0 on failure
*/
@@ -269,6 +275,7 @@ void *CustomData_get(const struct CustomData *data, int index, int type);
void *CustomData_get_n(const struct CustomData *data, int type, int index, int n);
void *CustomData_bmesh_get(const struct CustomData *data, void *block, int type);
void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int type, int n);
void *CustomData_bmesh_get_named(const CustomData *data, void *block, int type, const char *name);
/* gets the layer at physical index n, with no type checking.
*/
@@ -282,7 +289,8 @@ const char *CustomData_get_layer_name(const struct CustomData *data, int type, i
*/
void *CustomData_get_layer(const struct CustomData *data, int type);
void *CustomData_get_layer_n(const struct CustomData *data, int type, int n);
void *CustomData_get_layer_named(const struct CustomData *data, int type, const char *name);
void *CustomData_get_layer_named(const struct CustomData *data, int type,
const char *name);
int CustomData_get_offset(const struct CustomData *data, int type);
int CustomData_get_n_offset(const struct CustomData *data, int type, int n);

View File

@@ -28,6 +28,8 @@
#ifndef __BKE_DEFORM_H__
#define __BKE_DEFORM_H__
#include "DNA_object_types.h"
/** \file BKE_deform.h
* \ingroup bke
* \since June 2001

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.
*
* Copyright (C) 2014 by Martin Felke.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenkernel/BKE_fracture.h
* \ingroup blenkernel
*/
#ifndef BKE_FRACTURE_H
#define BKE_FRACTURE_H
#include "BLI_sys_types.h"
struct FracMesh;
struct Shard;
struct RigidBodyWorld;
struct FractureModifierData;
struct FractureSetting;
struct DerivedMesh;
struct Object;
struct Group;
struct MeshIsland;
struct RigidBodyShardCon;
struct GHash;
struct BoundBox;
struct MVert;
struct MPoly;
struct MLoop;
struct MEdge;
struct BMesh;
typedef int ShardID;
typedef struct FracPoint {
float co[3];
float offset[3];
} FracPoint;
typedef struct FracPointCloud {
struct FracPoint *points; /* just a bunch of positions in space*/
int totpoints; /* number of positions */
} FracPointCloud;
/* direct access */
struct Shard *BKE_shard_by_id(struct FracMesh *mesh, ShardID id, struct DerivedMesh *dm);
/* detailed info to the particular shards */
bool BKE_get_shard_minmax(struct FracMesh *mesh, ShardID id, float min_r[3], float max_r[3], struct DerivedMesh *dm);
/* container object handling functions */
struct FracMesh *BKE_create_fracture_container(void);
struct Shard *BKE_create_fracture_shard(struct MVert *mvert, struct MPoly *mpoly, struct MLoop *mloop, struct MEdge *medge,
int totvert, int totpoly, int totloop, int totedge, bool copy);
struct Shard *BKE_custom_data_to_shard(struct Shard *s, struct DerivedMesh *dm);
/* utility functions */
bool BKE_fracture_shard_center_median(struct Shard *shard, float cent[3]);
bool BKE_fracture_shard_center_centroid(struct Shard *shard, float cent[3]);
bool BKE_fracture_shard_center_centroid_area(struct Shard *shard, float cent[3]);
float BKE_shard_calc_minmax(struct Shard *shard);
void BKE_fracmesh_free(struct FracMesh *fm, bool doCustomData);
void BKE_shard_free(struct Shard *s, bool doCustomData);
struct Shard* BKE_fracture_shard_copy(struct Shard *s);
/* DerivedMesh */
struct DerivedMesh *BKE_fracture_create_dm(struct FractureModifierData *fmd, bool doCustomData, bool use_packed);
struct DerivedMesh *BKE_shard_create_dm(struct Shard *s, bool doCustomData);
/* create shards from base mesh and a list of points */
void BKE_fracture_shard_by_points(struct FracMesh *fmesh, ShardID id, struct FracPointCloud *points, int algorithm,
struct Object *obj, struct DerivedMesh *dm, short inner_material_index, float mat[4][4],
int num_cuts, float fractal, bool smooth, int num_levels, int mode, bool reset, int active_setting,
int num_settings, char uv_layer[], bool threaded, float thresh, bool shards_to_islands,
int override_count, float factor, int point_source, int resolution[], float spacing[]);
/* create shards from a base mesh and a set of other objects / cutter planes */
void BKE_fracture_shard_by_planes(struct FractureModifierData *fmd, struct Object *obj, short inner_material_index, float mat[4][4]);
void BKE_fracture_shard_by_greasepencil(struct FractureModifierData *fmd, struct Object *obj, short inner_material_index, float mat[4][4]);
void BKE_match_vertex_coords(struct MeshIsland* mi, struct MeshIsland *par, struct Object *ob, int frame, bool is_parent, bool shards_to_islands);
bool BKE_lookup_mesh_state(struct FractureModifierData *fmd, int frame, int do_lookup);
void BKE_get_prev_entries(struct FractureModifierData *fmd);
void BKE_get_next_entries(struct FractureModifierData *fmd);
void BKE_free_constraints(struct FractureModifierData *fmd);
void BKE_fracture_load_settings(struct FractureModifierData *fmd, struct FractureSetting *fs);
void BKE_fracture_store_settings(struct FractureModifierData *fs, struct FractureSetting *fmd);
struct Shard* BKE_create_initial_shard(struct DerivedMesh *dm);
void BKE_copy_customdata_layers(struct CustomData* dest, struct CustomData *src, int type, int count);
struct MeshIsland *BKE_fracture_mesh_island_add(struct FractureModifierData *fmd, struct Object *own, struct Object *target);
void BKE_fracture_mesh_island_remove(struct FractureModifierData *fmd, struct MeshIsland *mi);
void BKE_fracture_mesh_island_remove_all(struct FractureModifierData *fmd);
struct RigidBodyShardCon* BKE_fracture_mesh_islands_connect(struct FractureModifierData *fmd, struct MeshIsland *mi1, struct MeshIsland *mi2, short con_type);
void BKE_fracture_mesh_constraint_remove(struct FractureModifierData* fmd, struct RigidBodyShardCon *con);
void BKE_fracture_mesh_constraint_remove_all(struct FractureModifierData *fmd);
void BKE_fracture_free_mesh_island(struct FractureModifierData *rmd, struct MeshIsland *mi, bool remove_rigidbody);
int BKE_fracture_update_visual_mesh(struct FractureModifierData *fmd, struct Object *ob, bool do_custom_data);
short BKE_fracture_collect_materials(struct Object* o, struct Object* ob, int matstart, struct GHash** mat_index_map);
void BKE_bm_mesh_hflag_flush_vert(struct BMesh *bm, const char hflag);
void BKE_meshisland_constraint_create(struct FractureModifierData* fmd, struct MeshIsland *mi1, struct MeshIsland *mi2, int con_type, float thresh);
void BKE_update_acceleration_map(struct FractureModifierData *fmd, struct MeshIsland* mi, struct Object* ob, int ctime, float acc, struct RigidBodyWorld *rbw);
void BKE_update_velocity_layer(struct FractureModifierData *fmd, struct MeshIsland *mi);
void BKE_read_animated_loc_rot(struct FractureModifierData *fmd, Object *ob, bool do_bind);
#endif /* BKE_FRACTURE_H */

View File

@@ -0,0 +1,45 @@
/*
* ***** 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.
*
* Copyright (C) 2014 by Martin Felke.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenkernel/BKE_fracture_util.h
* \ingroup blenkernel
* \brief CSG operations
*/
#ifndef BKE_FRACTURE_UTIL_H
#define BKE_FRACTURE_UTIL_H
#include "DNA_fracture_types.h"
Shard *BKE_fracture_shard_boolean(Object *obj, DerivedMesh *dm_parent, Shard* child, short inner_material_index, int num_cuts, float fractal,
Shard **other, float mat[4][4], float radius, bool use_smooth_inner, int num_levels, char uv_layer[], float thresh);
Shard *BKE_fracture_shard_bisect(struct BMesh *bm_orig, Shard* child, float obmat[4][4], bool use_fill,
bool clear_inner, bool clear_outer, int cutlimit, float centroid[],
short inner_mat_index, char uv_layer[], struct KDTree *preselect_tree, float normal[]);
#endif /* BKE_FRACTURE_UTIL_H*/

View File

@@ -26,6 +26,8 @@
struct EvaluationContext;
struct Object;
struct Scene;
struct DerivedMesh;
struct DispList;
void BKE_mball_polygonize(
struct EvaluationContext *eval_ctx, struct Scene *scene,
@@ -33,4 +35,9 @@ void BKE_mball_polygonize(
void BKE_mball_cubeTable_free(void);
struct DerivedMesh* BKE_repolygonize_dm(struct DerivedMesh *dm, float thresh, float basesize[3], float wiresize,
float rendersize, bool render, bool override_size, int defgrp_size);
void BKE_dm_from_metaball(struct DispList *dl, struct DerivedMesh *dm, struct DerivedMesh *odm, int *orig_index);
#endif /* __BKE_MBALL_TESSELLATE_H__ */

View File

@@ -79,11 +79,4 @@ void BKE_object_defgroup_mirror_selection(
}
#endif
/* Select helpers */
bool *BKE_objdef_vgroup_subset_from_select_type(
struct Object *ob, enum eVGroupSelect subset_type, int *r_vgroup_tot, int *r_subset_count);
void BKE_objdef_vgroup_subset_to_index_array(
const bool *vgroup_validmap, const int vgroup_tot, int *r_vgroup_subset_map);
#endif /* __BKE_OBJECT_DEFORM_H__ */

View File

@@ -431,7 +431,7 @@ void psys_particle_on_dm(struct DerivedMesh *dm_final, int from, int index, int
float orco[3], float ornor[3]);
/* particle_system.c */
void distribute_particles(struct ParticleSimulationData *sim, int from);
int distribute_particles(struct ParticleSimulationData *sim, int from);
void initialize_particle(struct ParticleSimulationData *sim, struct ParticleData *pa);
void psys_calc_dmcache(struct Object *ob, struct DerivedMesh *dm_final, struct DerivedMesh *dm_deformed, struct ParticleSystem *psys);
int psys_particle_dm_face_lookup(struct DerivedMesh *dm_final, struct DerivedMesh *dm_deformed, int findex, const float fw[4], struct LinkNode **poly_nodes);

View File

@@ -36,9 +36,13 @@
struct RigidBodyWorld;
struct RigidBodyOb;
struct RigidBodyShardCon;
struct Scene;
struct Object;
struct Group;
struct MeshIsland;
struct FractureModifierData;
/* -------------- */
/* Memory Management */
@@ -62,8 +66,10 @@ void BKE_rigidbody_world_id_loop(struct RigidBodyWorld *rbw, RigidbodyWorldIDFun
/* create Blender-side settings data - physics objects not initialized yet */
struct RigidBodyWorld *BKE_rigidbody_create_world(struct Scene *scene);
struct RigidBodyOb *BKE_rigidbody_create_object(struct Scene *scene, struct Object *ob, short type);
struct RigidBodyCon *BKE_rigidbody_create_constraint(struct Scene *scene, struct Object *ob, short type);
struct RigidBodyOb *BKE_rigidbody_create_object(struct Scene *scene, struct Object *ob, short type, struct MeshIsland *mi);
struct RigidBodyCon *BKE_rigidbody_create_constraint(struct Scene *scene, struct Object *ob, short type, struct RigidBodyShardCon *con);
struct RigidBodyOb *BKE_rigidbody_create_shard(struct Scene *scene, struct Object *ob, struct Object *target, struct MeshIsland *mi);
struct RigidBodyShardCon *BKE_rigidbody_create_shard_constraint(struct Scene *scene, short type, bool reset);
/* copy */
struct RigidBodyWorld *BKE_rigidbody_world_copy(struct RigidBodyWorld *rbw, const int flag);
@@ -71,8 +77,19 @@ void BKE_rigidbody_world_groups_relink(struct RigidBodyWorld *rbw);
/* 'validate' (i.e. make new or replace old) Physics-Engine objects */
void BKE_rigidbody_validate_sim_world(struct Scene *scene, struct RigidBodyWorld *rbw, bool rebuild);
void BKE_rigidbody_validate_sim_object(struct RigidBodyWorld *rbw, struct Object *ob, short rebuild);
void BKE_rigidbody_validate_sim_shape(struct Object *ob, short rebuild);
void BKE_rigidbody_validate_sim_constraint(struct RigidBodyWorld *rbw, struct Object *ob, short rebuild);
void BKE_rigidbody_validate_sim_shard_constraint(struct RigidBodyWorld *rbw, struct FractureModifierData* fmd, struct Object*,
struct RigidBodyShardCon *rbsc, short rebuild);
void BKE_rigidbody_validate_sim_shard(struct RigidBodyWorld *rbw, struct MeshIsland *mi, struct Object *ob, short rebuild, int transfer_speeds, float size[3]);
void BKE_rigidbody_validate_sim_shard_shape(struct MeshIsland *mi, struct Object *ob, short rebuild);
/* move the islands of the visible mesh according to shard rigidbody movement */
void BKE_rigidbody_update_cell(struct MeshIsland *mi, struct Object* ob, float loc[3], float rot[4], struct FractureModifierData *rmd,
int frame, struct RigidBodyWorld *rbw);
void BKE_rigidbody_calc_volume(struct Object *ob, float *r_vol);
void BKE_rigidbody_calc_center_of_mass(struct Object *ob, float r_center[3]);
/* -------------- */
@@ -81,7 +98,15 @@ void BKE_rigidbody_calc_center_of_mass(struct Object *ob, float r_center[3]);
struct RigidBodyWorld *BKE_rigidbody_get_world(struct Scene *scene);
void BKE_rigidbody_remove_object(struct Scene *scene, struct Object *ob);
void BKE_rigidbody_remove_constraint(struct Scene *scene, struct Object *ob);
float BKE_rigidbody_calc_volume_dm(struct DerivedMesh *dm, struct RigidBodyOb *rbo, Object *ob);
void BKE_rigidbody_calc_shard_mass(struct Object* ob, struct MeshIsland* mi, struct DerivedMesh* dm);
void BKE_rigidbody_calc_threshold(float max_con_mass, struct FractureModifierData* rmd, struct RigidBodyShardCon *con);
float BKE_rigidbody_calc_max_con_mass(struct Object* ob);
float BKE_rigidbody_calc_min_con_dist(struct Object* ob);
void BKE_rigidbody_start_dist_angle(struct RigidBodyShardCon* con, bool exact, bool both);
void BKE_rigidbody_remove_shard_con(struct Scene* scene, struct RigidBodyShardCon* con);
void BKE_rigidbody_remove_shard(struct Scene* scene, struct MeshIsland *mi);
void BKE_rigidbody_update_ob_array(struct RigidBodyWorld *rbw, bool do_bake_correction);
/* -------------- */
/* Utility Macros */
@@ -99,7 +124,7 @@ void BKE_rigidbody_aftertrans_update(struct Object *ob, float loc[3], float rot[
void BKE_rigidbody_sync_transforms(struct RigidBodyWorld *rbw, struct Object *ob, float ctime);
bool BKE_rigidbody_check_sim_running(struct RigidBodyWorld *rbw, float ctime);
void BKE_rigidbody_cache_reset(struct RigidBodyWorld *rbw);
void BKE_rigidbody_rebuild_world(struct Scene *scene, float ctime);
void BKE_rigidbody_rebuild_world(struct Scene *scene, float ctime, bool do_resetDynamic);
void BKE_rigidbody_do_simulation(struct Scene *scene, float ctime);
/* -------------------- */
@@ -117,4 +142,6 @@ void BKE_rigidbody_object_sync_transforms(struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob);
bool BKE_restoreKinematic(struct RigidBodyWorld *rbw, bool override_bind);
#endif /* __BKE_RIGIDBODY_H__ */

View File

@@ -78,6 +78,7 @@ set(SRC
intern/blender_undo.c
intern/blendfile.c
intern/bmfont.c
intern/boolean.c
intern/boids.c
intern/bpath.c
intern/brush.c
@@ -111,6 +112,8 @@ set(SRC
intern/fluidsim.c
intern/fmodifier.c
intern/font.c
intern/fracture.c
intern/fracture_util.c
intern/freestyle.c
intern/gpencil.c
intern/group.c
@@ -212,6 +215,7 @@ set(SRC
BKE_bmfont.h
BKE_bmfont_types.h
BKE_boids.h
BKE_boolean.h
BKE_bpath.h
BKE_brush.h
BKE_bullet.h
@@ -242,6 +246,8 @@ set(SRC
BKE_fcurve.h
BKE_fluidsim.h
BKE_font.h
BKE_fracture.h
BKE_fracture_util.h
BKE_freestyle.h
BKE_global.h
BKE_gpencil.h
@@ -313,7 +319,6 @@ set(SRC
intern/CCGSubSurf_inline.h
intern/CCGSubSurf_intern.h
intern/pbvh_intern.h
intern/data_transfer_intern.h
)
if(WITH_BINRELOC)
@@ -503,6 +508,13 @@ if(WITH_FREESTYLE)
add_definitions(-DWITH_FREESTYLE)
endif()
if(WITH_VORO)
add_definitions(-DWITH_VORO)
list(APPEND INC
../../../extern/voro++
)
endif()
if(WITH_ALEMBIC)
list(APPEND INC
../alembic

View File

@@ -0,0 +1,200 @@
/*
* ***** 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) Blender Foundation
* All rights reserved.
*
* Contributor(s): Sergey Sharybin.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenkernel/intern/boolean.c
* \ingroup blenkernel
*/
#include "BLI_alloca.h"
#include "BKE_boolean.h"
#include "BLI_math_geom.h"
#include "BKE_material.h"
#include "BKE_global.h" /* only to check G.debug */
#include "MEM_guardedalloc.h"
#include "bmesh.h"
#include "bmesh_tools.h"
#include "tools/bmesh_intersect.h"
#include "BKE_cdderivedmesh.h"
#ifdef DEBUG_TIME
#include "PIL_time.h"
#include "PIL_time_utildefines.h"
#endif
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_modifier_types.h"
#include "BLI_utildefines.h"
/* has no meaning for faces, do this so we can tell which face is which */
#define BM_FACE_TAG BM_ELEM_DRAW
/**
* Compare selected/unselected.
*/
static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data))
{
return BM_elem_flag_test(f, BM_FACE_TAG) ? 1 : 0;
}
DerivedMesh *BKE_boolean_bmesh(DerivedMesh *dm, struct Object *ob,
DerivedMesh *dm_other, struct Object *ob_other, int op_type,
float double_threshold, struct BooleanModifierData *bmd)
{
BMesh *bm;
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_DM(dm, dm_other);
const bool is_flip = (is_negative_m4(ob->obmat) != is_negative_m4(ob_other->obmat));
DerivedMesh *result;
#ifdef DEBUG_TIME
TIMEIT_START(boolean_bmesh);
#endif
bm = BM_mesh_create(
&allocsize,
&((struct BMeshCreateParams){.use_toolflags = false,}));
DM_to_bmesh_ex(dm_other, bm, true);
if (UNLIKELY(is_flip)) {
const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS);
BMIter iter;
BMFace *efa;
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
BM_face_normal_flip_ex(bm, efa, cd_loop_mdisp_offset, true);
}
}
DM_to_bmesh_ex(dm, bm, true);
/* main bmesh intersection setup */
{
/* create tessface & intersect */
const int looptris_tot = poly_to_tri_count(bm->totface, bm->totloop);
int tottri;
BMLoop *(*looptris)[3];
looptris = MEM_mallocN(sizeof(*looptris) * looptris_tot, __func__);
BM_mesh_calc_tessellation(bm, looptris, &tottri);
/* postpone this until after tessellating
* so we can use the original normals before the vertex are moved */
{
BMIter iter;
int i;
const int i_verts_end = dm_other->getNumVerts(dm_other);
const int i_faces_end = dm_other->getNumPolys(dm_other);
float imat[4][4];
float omat[4][4];
invert_m4_m4(imat, ob->obmat);
mul_m4_m4m4(omat, imat, ob_other->obmat);
BMVert *eve;
i = 0;
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
mul_m4_v3(omat, eve->co);
if (++i == i_verts_end) {
break;
}
}
/* we need face normals because of 'BM_face_split_edgenet'
* we could calculate on the fly too (before calling split). */
{
float nmat[4][4];
invert_m4_m4(nmat, omat);
const short ob_src_totcol = ob_other->totcol;
short *material_remap = BLI_array_alloca(material_remap, ob_src_totcol ? ob_src_totcol : 1);
BKE_material_remap_object_calc(ob, ob_other, material_remap);
BMFace *efa;
i = 0;
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
mul_transposed_mat3_m4_v3(nmat, efa->no);
normalize_v3(efa->no);
BM_elem_flag_enable(efa, BM_FACE_TAG); /* temp tag to test which side split faces are from */
/* remap material */
if (LIKELY(efa->mat_nr < ob_src_totcol)) {
efa->mat_nr = material_remap[efa->mat_nr];
}
if (++i == i_faces_end) {
break;
}
}
}
}
/* not needed, but normals for 'dm' will be invalid,
* currently this is ok for 'BM_mesh_intersect' */
// BM_mesh_normals_update(bm);
bool use_separate = false;
bool use_dissolve = true;
bool use_island_connect = true;
/* change for testing */
if (G.debug & G_DEBUG) {
use_separate = (bmd->bm_flag & eBooleanModifierBMeshFlag_BMesh_Separate) != 0;
use_dissolve = (bmd->bm_flag & eBooleanModifierBMeshFlag_BMesh_NoDissolve) == 0;
use_island_connect = (bmd->bm_flag & eBooleanModifierBMeshFlag_BMesh_NoConnectRegions) == 0;
}
BM_mesh_intersect(
bm,
looptris, tottri,
bm_face_isect_pair, NULL,
false,
use_separate,
use_dissolve,
use_island_connect,
false,
op_type,
double_threshold);
MEM_freeN(looptris);
}
result = CDDM_from_bmesh(bm, true);
BM_mesh_free(bm);
result->dirty |= DM_DIRTY_NORMALS;
#ifdef DEBUG_TIME
TIMEIT_END(boolean_bmesh);
#endif
return result;
}

View File

@@ -497,6 +497,7 @@ BVHTree *bvhtree_from_editmesh_verts(
epsilon, tree_type, axis);
}
/**
* Builds a bvh tree where nodes are the given vertices (note: does not copy given mverts!).
* \param vert_allocated if true, vert freeing will be done when freeing data.

View File

@@ -925,6 +925,7 @@ static void layerInterp_mloopuv(
}
/* delay writing to the destination incase dest is in sources */
((MLoopUV *)dest)->flag = ((MLoopUV *)sources)->flag;
copy_v2_v2(((MLoopUV *)dest)->uv, uv);
((MLoopUV *)dest)->flag = flag;
}
@@ -1940,7 +1941,6 @@ void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
return NULL;
}
bool CustomData_free_layer(CustomData *data, int type, int totelem, int index)
{
const int index_first = CustomData_get_layer_index(data, type);
@@ -2158,7 +2158,7 @@ void CustomData_copy_elements(int type, void *src_data_ofs, void *dst_data_ofs,
memcpy(dst_data_ofs, src_data_ofs, (size_t)count * typeInfo->size);
}
static void CustomData_copy_data_layer(
void CustomData_copy_data_layer(
const CustomData *source, CustomData *dest,
int src_i, int dst_i,
int src_index, int dst_index, int count)
@@ -2913,6 +2913,18 @@ void *CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int
return POINTER_OFFSET(block, data->layers[layer_index + n].offset);
}
/* why did this miss here before, useful ! */
void *CustomData_bmesh_get_named(const CustomData *data, void *block, int type, const char *name)
{
int layer_index;
/* get the layer index of the first layer of type */
layer_index = CustomData_get_named_layer_index(data, type, name);
if (layer_index == -1) return NULL;
return POINTER_OFFSET(block, data->layers[layer_index].offset);
}
/*gets from the layer at physical index n, note: doesn't check type.*/
void *CustomData_bmesh_get_layer_n(const CustomData *data, void *block, int n)
{

View File

@@ -1387,7 +1387,7 @@ static void emDM_drawFacesTex_common(
glVertex3fv(ltri[1]->v->co);
glTexCoord2fv(luv[2]->uv);
if (has_vcol_any) glColor4ubv((const GLubyte *)&(lcol[2]->r));
if (has_vcol_any) glColor3ubv((const GLubyte *)&(lcol[2]->r));
if (lnors) glNormal3fv(lnors[BM_elem_index_get(ltri[2])]);
else glNormal3fv(ltri[2]->v->no);
glVertex3fv(ltri[2]->v->co);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,943 @@
/*
* ***** 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.
*
* Copyright (C) 2014 by Martin Felke.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/blenkernel/intern/fracture_util.c
* \ingroup blenkernel
* \brief CSG operations
*/
#include "BKE_boolean.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_fracture.h"
#include "BKE_fracture_util.h"
#include "BKE_material.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BLI_alloca.h"
#include "BLI_ghash.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_sys_types.h"
#include "BLI_kdtree.h"
#include "BLI_boxpack_2d.h"
#include "BLI_convexhull_2d.h"
#include "DNA_fracture_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_material_types.h"
#include "DNA_modifier_types.h"
#include "MEM_guardedalloc.h"
#include "bmesh.h"
#include "bmesh_tools.h"
struct BoxPack;
/*prototypes*/
void uv_bbox(float uv[][2], int num_uv, float minv[2], float maxv[2]);
void uv_translate(float uv[][2], int num_uv, float trans[2]);
void uv_scale(float uv[][2], int num_uv, float scale);
void uv_transform(float uv[][2], int num_uv, float mat[2][2]);
void unwrap_shard_dm(DerivedMesh *dm, char uv_layer[], bool do_boxpack);
/* UV Helpers */
void uv_bbox(float uv[][2], int num_uv, float minv[2], float maxv[2])
{
int v;
INIT_MINMAX2(minv, maxv);
for (v = 0; v < num_uv; v++) {
minmax_v2v2_v2(minv, maxv, uv[v]);
}
}
void uv_translate(float uv[][2], int num_uv, float trans[2])
{
int v;
for (v = 0; v < num_uv; v++) {
uv[v][0] += trans[0];
uv[v][1] += trans[1];
}
}
void uv_scale(float uv[][2], int num_uv, float scale)
{
int v;
for (v = 0; v < num_uv; v++) {
uv[v][0] *= scale;
uv[v][1] *= scale;
}
}
void uv_transform(float uv[][2], int num_uv, float mat[2][2])
{
int v;
for (v = 0; v < num_uv; v++) {
mul_m2v2(mat, uv[v]);
}
}
static void do_clean_uv(DerivedMesh *dm, char uv_layer[64])
{
MLoopUV* mluv = CustomData_get_layer_named(&dm->loopData, CD_MLOOPUV, uv_layer);
int i, totpoly = dm->getNumPolys(dm);
MPoly *mp, *mpoly = dm->getPolyArray(dm);
if (mluv)
{
for (i = 0, mp = mpoly; i < totpoly; i++, mp++)
{
if (mp->mat_nr != 1)
{ //clean up (set uv coords to zero) all except inner faces (material based)
int j;
for (j = mp->loopstart; j < mp->loopstart + mp->totloop; j++)
{
mluv[j].uv[0] = 0.0f;
mluv[j].uv[1] = 0.0f;
}
}
}
}
}
static void do_unwrap(MPoly *mp, MVert *mvert, MLoop* mloop, int i, MLoopUV **mluv, BoxPack **boxpack)
{
MLoop *ml;
int j = 0;
float (*verts)[3] = MEM_mallocN(sizeof(float[3]) * mp->totloop, "unwrap_shard_dm verts");
float nor[3];
float mat[3][3];
float (*uv)[2] = MEM_mallocN(sizeof(float[2]) * mp->totloop, "unwrap_shard_dm_uv");
float uvbbox[2][2];
float angle;
BoxPack *box;
/* uv unwrap cells, so inner faces get a uv map */
for (j = 0; j < mp->totloop; j++) {
ml = mloop + mp->loopstart + j;
copy_v3_v3(verts[j], (mvert + ml->v)->co);
}
normal_poly_v3(nor, (const float (*)[3])verts, mp->totloop);
normalize_v3(nor);
axis_dominant_v3_to_m3(mat, nor);
for (j = 0; j < mp->totloop; j++) {
mul_v2_m3v3(uv[j], mat, verts[j]);
}
/* rotate uvs for better packing */
angle = BLI_convexhull_aabb_fit_points_2d((const float (*)[2])uv, mp->totloop);
if (angle != 0.0f) {
float matt[2][2];
angle_to_mat2(matt, angle);
uv_transform((float (*)[2])uv, mp->totloop, matt);
}
/* prepare box packing... one poly is a box */
box = (*boxpack) + i;
uv_bbox((float (*)[2])uv, mp->totloop, uvbbox[0], uvbbox[1]);
uvbbox[0][0] = -uvbbox[0][0];
uvbbox[0][1] = -uvbbox[0][1];
uv_translate((float (*)[2])uv, mp->totloop, uvbbox[0]);
box->w = uvbbox[1][0] + uvbbox[0][0];
box->h = uvbbox[1][1] + uvbbox[0][1];
box->index = i;
/* copy coords back */
for (j = 0; j < mp->totloop; j++) {
copy_v2_v2((*mluv)[j + mp->loopstart].uv, uv[j]);
(*mluv)[j + mp->loopstart].flag = 0;
}
MEM_freeN(uv);
MEM_freeN(verts);
}
void unwrap_shard_dm(DerivedMesh *dm, char uv_layer[64], bool do_boxpack)
{
MVert *mvert;
MLoop *mloop;
MPoly *mpoly, *mp;
int totpoly, i = 0;
MLoopUV *mluv = MEM_callocN(sizeof(MLoopUV) * dm->numLoopData, "mluv");
BoxPack *boxpack = MEM_mallocN(sizeof(BoxPack) * dm->numPolyData, "boxpack");
float scale, tot_width, tot_height;
/* set inner material on child shard */
mvert = dm->getVertArray(dm);
mpoly = dm->getPolyArray(dm);
mloop = dm->getLoopArray(dm);
totpoly = dm->getNumPolys(dm);
for (i = 0, mp = mpoly; i < totpoly; i++, mp++) {
do_unwrap(mp, mvert, mloop, i, &mluv, &boxpack);
}
if (do_boxpack)
{
/* do box packing and match uvs according to it */
BLI_box_pack_2d(boxpack, totpoly, &tot_width, &tot_height);
if (tot_height > tot_width)
scale = 1.0f / tot_height;
else
scale = 1.0f / tot_width;
for (i = 0, mp = mpoly; i < totpoly; i++, mp++) {
float trans[2];
BoxPack *box;
int j;
box = boxpack + i;
trans[0] = box->x;
trans[1] = box->y;
for (j = 0; j < mp->totloop; j++)
{
uv_translate((float (*)[2])mluv[j + mp->loopstart].uv, 1, trans);
uv_scale((float (*)[2])mluv[j + mp->loopstart].uv, 1, scale);
}
}
}
MEM_freeN(boxpack);
CustomData_add_layer_named(&dm->loopData, CD_MLOOPUV, CD_ASSIGN, mluv, dm->numLoopData, uv_layer);
CustomData_add_layer_named(&dm->polyData, CD_MTEXPOLY, CD_CALLOC, NULL, totpoly, uv_layer);
}
static bool check_non_manifold(DerivedMesh* dm)
{
BMesh *bm;
BMVert* v;
BMIter iter;
BMEdge *e;
/*check for watertightness*/
bm = BM_mesh_create(&bm_mesh_allocsize_default, &((struct BMeshCreateParams){.use_toolflags = true,}));
DM_to_bmesh_ex(dm, bm, true);
if (bm->totface < 4) {
BM_mesh_free(bm);
printf("Empty mesh...\n");
return true;
}
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
if (!BM_vert_is_manifold(v)) {
BM_mesh_free(bm);
printf("Mesh not watertight...\n");
return true;
}
}
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_edge_is_wire(e) ||
BM_edge_is_boundary(e) ||
(BM_edge_is_manifold(e) && !BM_edge_is_contiguous(e)) ||
BM_edge_face_count(e) > 2)
{
/* check we never select perfect edge (in test above) */
BLI_assert(!(BM_edge_is_manifold(e) && BM_edge_is_contiguous(e)));
BM_mesh_free(bm);
printf("Mesh not watertight...\n");
return true;
}
}
BM_mesh_free(bm);
return false;
}
static int DM_mesh_minmax(DerivedMesh *dm, float r_min[3], float r_max[3])
{
MVert *v;
int i = 0;
for (i = 0; i < dm->numVertData; i++) {
v = CDDM_get_vert(dm, i);
minmax_v3v3_v3(r_min, r_max, v->co);
}
return (dm->numVertData != 0);
}
static bool compare_dm_size(DerivedMesh *dmOld, DerivedMesh *dmNew)
{
float min[3], max[3];
float size[3];
float v1, v2;
INIT_MINMAX(min, max);
DM_mesh_minmax(dmOld, min, max);
sub_v3_v3v3(size, max, min);
v1 = size[0] * size[1] * size[2];
INIT_MINMAX(min, max);
DM_mesh_minmax(dmNew, min, max);
sub_v3_v3v3(size, max, min);
v2 = size[0] * size[1] * size[2];
if (v2 > (v1 + 0.000001))
{
printf("Size mismatch !\n");
}
return v2 <= (v1 + 0.000001);
}
static bool do_other_output(DerivedMesh** other_dm, Shard** other, DerivedMesh** output_dm, DerivedMesh** left_dm, float mat[4][4])
{
if (*other_dm)
{
*other = BKE_create_fracture_shard((*other_dm)->getVertArray(*other_dm),
(*other_dm)->getPolyArray(*other_dm),
(*other_dm)->getLoopArray(*other_dm),
(*other_dm)->getEdgeArray(*other_dm),
(*other_dm)->getNumVerts(*other_dm),
(*other_dm)->getNumPolys(*other_dm),
(*other_dm)->getNumLoops(*other_dm),
(*other_dm)->getNumEdges(*other_dm),
true);
*other = BKE_custom_data_to_shard(*other, *other_dm);
#if 0
/* XXX TODO this might be wrong by now ... */
output_s->neighbor_count = child->neighbor_count;
output_s->neighbor_ids = MEM_mallocN(sizeof(int) * child->neighbor_count, __func__);
memcpy(output_s->neighbor_ids, child->neighbor_ids, sizeof(int) * child->neighbor_count);
#endif
BKE_fracture_shard_center_centroid_area(*other, (*other)->centroid);
/* free the temp derivedmesh */
(*other_dm)->needsFree = 1;
(*other_dm)->release(*other_dm);
*other_dm = NULL;
}
else
{
if (other != NULL)
*other = NULL;
if (*left_dm != NULL) {
(*left_dm)->needsFree = 1;
(*left_dm)->release(*left_dm);
(*left_dm) = NULL;
}
if (*other_dm != NULL)
{
(*other_dm)->needsFree = 1;
(*other_dm)->release(*other_dm);
(*other_dm) = NULL;
}
/*discard only at fractal boolean */
if (mat != NULL)
{
if (*output_dm != NULL) {
(*output_dm)->needsFree = 1;
(*output_dm)->release(*output_dm);
(*output_dm) = NULL;
}
return true;
}
}
return false;
}
static Shard *do_output_shard_dm(DerivedMesh** output_dm, Shard *child, int num_cuts, float fractal, Shard **other)
{
Shard* output_s = BKE_create_fracture_shard((*output_dm)->getVertArray(*output_dm),
(*output_dm)->getPolyArray(*output_dm),
(*output_dm)->getLoopArray(*output_dm),
(*output_dm)->getEdgeArray(*output_dm),
(*output_dm)->getNumVerts(*output_dm),
(*output_dm)->getNumPolys(*output_dm),
(*output_dm)->getNumLoops(*output_dm),
(*output_dm)->getNumEdges(*output_dm),
true);
output_s = BKE_custom_data_to_shard(output_s, *output_dm);
/* useless, because its a bisect fast-like approach here */
if (num_cuts == 0 || fractal == 0.0f || other == NULL) {
/* XXX TODO this might be wrong by now ... */
output_s->neighbor_count = child->neighbor_count;
output_s->neighbor_ids = MEM_mallocN(sizeof(int) * child->neighbor_count, __func__);
memcpy(output_s->neighbor_ids, child->neighbor_ids, sizeof(int) * child->neighbor_count);
copy_v3_v3(output_s->raw_centroid, child->raw_centroid);
output_s->raw_volume = child->raw_volume;
}
BKE_fracture_shard_center_centroid_area(output_s, output_s->centroid);
/* free the temp derivedmesh */
(*output_dm)->needsFree = 1;
(*output_dm)->release(*output_dm);
*output_dm = NULL;
return output_s;
}
static DerivedMesh* do_fractal(float radius, float mat[4][4], bool use_smooth_inner, short inner_material_index,
int num_levels, int num_cuts, float fractal)
{
BMFace* f;
BMIter iter;
BMesh *bm;
int i;
DerivedMesh *ret = NULL;
/*create a grid plane */
bm = BM_mesh_create(&bm_mesh_allocsize_default, &((struct BMeshCreateParams){.use_toolflags = true,}));
BMO_op_callf(bm, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"create_grid x_segments=%i y_segments=%i size=%f matrix=%m4",
1, 1, radius, mat);
/*subdivide the plane fractally*/
for (i = 0; i < num_levels; i++)
{
BMO_op_callf(bm,(BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"subdivide_edges edges=ae "
"smooth=%f smooth_falloff=%i use_smooth_even=%b "
"fractal=%f along_normal=%f "
"cuts=%i "
"quad_corner_type=%i "
"use_single_edge=%b use_grid_fill=%b "
"use_only_quads=%b "
"seed=%i",
0.0f, SUBD_FALLOFF_ROOT, false,
fractal, 1.0f,
num_cuts,
SUBD_CORNER_INNERVERT,
false, true,
true,
0);
}
BMO_op_callf(bm, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"triangulate faces=af quad_method=%i ngon_method=%i", MOD_TRIANGULATE_QUAD_BEAUTY, MOD_TRIANGULATE_NGON_BEAUTY);
BMO_op_callf(bm, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"recalc_face_normals faces=af");
BM_ITER_MESH(f, &iter, bm, BM_FACES_OF_MESH)
{
if (use_smooth_inner)
{
BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
}
if (inner_material_index > 0)
{
f->mat_nr = inner_material_index;
}
}
/*convert back*/
ret = CDDM_from_bmesh(bm, false);
BM_mesh_free(bm);
return ret;
}
static bool do_check_watertight_other(DerivedMesh **other_dm, DerivedMesh **output_dm, Shard **other, DerivedMesh *right_dm,
DerivedMesh **left_dm, float mat[4][4])
{
bool do_return = false;
if (!other_dm || check_non_manifold(*other_dm) || !compare_dm_size(right_dm, *other_dm)) {
if (other != NULL)
*other = NULL;
if (*left_dm != NULL) {
(*left_dm)->needsFree = 1;
(*left_dm)->release(*left_dm);
(*left_dm) = NULL;
}
if (*other_dm != NULL)
{
(*other_dm)->needsFree = 1;
(*other_dm)->release(*other_dm);
(*other_dm) = NULL;
}
/*discard only at fractal boolean */
if (mat != NULL)
{
if (*output_dm != NULL) {
(*output_dm)->needsFree = 1;
(*output_dm)->release(*output_dm);
(*output_dm) = NULL;
}
do_return = true;
}
}
return do_return;
}
static bool do_check_watertight(DerivedMesh **output_dm, DerivedMesh** left_dm, DerivedMesh *right_dm, Shard **other, float mat[4][4])
{
bool do_return = false;
if (!(*output_dm) || check_non_manifold(*output_dm) || !compare_dm_size(right_dm, (*output_dm))) {
if (mat != NULL)
{
if (other != NULL)
*other = NULL;
if (*left_dm != NULL) {
(*left_dm)->needsFree = 1;
(*left_dm)->release(*left_dm);
*left_dm = NULL;
}
}
if (*output_dm != NULL) {
(*output_dm)->needsFree = 1;
(*output_dm)->release(*output_dm);
*output_dm = NULL;
}
if (mat != NULL)
{
do_return = true;
}
}
return do_return;
}
static void do_set_inner_material(Shard **other, float mat[4][4], DerivedMesh* left_dm, short inner_material_index, Shard* s, Object *ob)
{
MPoly *mpoly, *mp;
int totpoly, i = 0;
MDeformVert *dvert;
int totvert = left_dm->getNumVerts(left_dm);
FractureModifierData *fmd = (FractureModifierData*)modifiers_findByType(ob, eModifierType_Fracture);
/* set inner material on child shard */
if (other == NULL || mat == NULL)
{
mpoly = left_dm->getPolyArray(left_dm);
totpoly = left_dm->getNumPolys(left_dm);
for (i = 0, mp = mpoly; i < totpoly; i++, mp++) {
if (inner_material_index > 0) {
mp->mat_nr = inner_material_index;
}
mp->flag |= ME_FACE_SEL;
//set flag on shard too to have it available on load
s->mpoly[i].flag |= ME_FACE_SEL;
}
}
if (fmd && fmd->inner_defgrp_name[0]) {
int defgrp = defgroup_name_index(ob, fmd->inner_defgrp_name);
dvert = CustomData_add_layer(&left_dm->vertData, CD_MDEFORMVERT, CD_CALLOC, NULL, totvert);
for (i = 0; i < totvert; i++) {
defvert_add_index_notest(dvert + i, defgrp, 1.0f);
}
}
}
Shard *BKE_fracture_shard_boolean(Object *obj, DerivedMesh *dm_parent, Shard *child, short inner_material_index,
int num_cuts, float fractal, Shard** other, float mat[4][4], float radius,
bool use_smooth_inner, int num_levels, char uv_layer[64], float thresh)
{
DerivedMesh *left_dm = NULL, *right_dm, *output_dm, *other_dm;
if (other != NULL && mat != NULL)
{
left_dm = do_fractal(radius, mat, use_smooth_inner, inner_material_index, num_levels, num_cuts, fractal);
unwrap_shard_dm(left_dm, uv_layer, false);
}
else
{
left_dm = BKE_shard_create_dm(child, false);
unwrap_shard_dm(left_dm, uv_layer, true);
}
do_set_inner_material(other, mat, left_dm, inner_material_index, child, obj);
right_dm = dm_parent;
output_dm = BKE_boolean_bmesh(right_dm, obj, left_dm, obj, 0, thresh, NULL); /*0 == intersection, 2 == difference*/
/*check for watertightness, but for fractal only*/
if (other != NULL && do_check_watertight(&output_dm, &left_dm, right_dm, other, mat))
{
return NULL;
}
if (other != NULL)
{
other_dm = BKE_boolean_bmesh(left_dm, obj, right_dm, obj, 2, thresh, NULL);
/*check for watertightness again, true means do return NULL here*/
if (!other_dm || do_check_watertight_other(&other_dm, &output_dm, other, right_dm, &left_dm, mat))
{
if (!other_dm) {
/* in case of failed boolean op, clean up other dms too before returning NULL */
if (left_dm) {
left_dm->needsFree = 1;
left_dm->release(left_dm);
left_dm = NULL;
}
if (output_dm) {
output_dm->needsFree = 1;
output_dm->release(output_dm);
output_dm = NULL;
}
}
return NULL;
}
/*return here if this function returns true */
if (do_other_output(&other_dm, other, &output_dm, &left_dm, mat))
{
return NULL;
}
}
if (left_dm)
{
left_dm->needsFree = 1;
left_dm->release(left_dm);
left_dm = NULL;
}
if (output_dm)
{
do_clean_uv(output_dm, uv_layer);
return do_output_shard_dm(&output_dm, child, num_cuts, fractal, other);
}
return NULL;
}
static Shard *do_output_shard(BMesh* bm_parent, Shard *child, char uv_layer[64])
{
Shard *output_s = NULL;
DerivedMesh *dm_out;
if (bm_parent->totvert >= 3)
{ /* atleast 3 verts form a face, so strip out invalid stuff */
dm_out = CDDM_from_bmesh(bm_parent, true);
//"cleanup" dm here, set UVs to 0,0 whose poly->mat_nr = 1 (i cant find where its originally created... grrr)
do_clean_uv(dm_out, uv_layer);
output_s = BKE_create_fracture_shard(dm_out->getVertArray(dm_out),
dm_out->getPolyArray(dm_out),
dm_out->getLoopArray(dm_out),
dm_out->getEdgeArray(dm_out),
dm_out->getNumVerts(dm_out),
dm_out->getNumPolys(dm_out),
dm_out->getNumLoops(dm_out),
dm_out->getNumEdges(dm_out), true);
output_s = BKE_custom_data_to_shard(output_s, dm_out);
/*XXX TODO this might be wrong by now ... */
output_s->neighbor_count = child->neighbor_count;
output_s->neighbor_ids = MEM_mallocN(sizeof(int) * child->neighbor_count, __func__);
memcpy(output_s->neighbor_ids, child->neighbor_ids, sizeof(int) * child->neighbor_count);
BKE_fracture_shard_center_centroid_area(output_s, output_s->centroid);
copy_v3_v3(output_s->raw_centroid, child->raw_centroid);
output_s->raw_volume = child->raw_volume;
dm_out->needsFree = 1;
dm_out->release(dm_out);
dm_out = NULL;
}
return output_s;
}
static void do_fill(float plane_no[3], bool clear_outer, bool clear_inner, BMOperator bmop, short inner_mat_index, BMesh* bm_parent)
{
float normal_fill[3];
BMOperator bmop_fill;
//BMOperator bmop_attr;
normalize_v3_v3(normal_fill, plane_no);
if (clear_outer == true && clear_inner == false) {
negate_v3(normal_fill);
}
/*
if (inner_mat_index == 0) { // dont use inner material here
BMO_op_initf(
bm_parent, &bmop_fill, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"triangle_fill edges=%S normal=%v use_dissolve=%b use_beauty=%b",
&bmop, "geom_cut.out", normal_fill, true, true);
BMO_op_exec(bm_parent, &bmop_fill);
BMO_op_initf(bm_parent, &bmop_attr, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"face_attribute_fill faces=%S use_normals=%b use_data=%b",
&bmop_fill, "geom.out", false, true);
BMO_op_exec(bm_parent, &bmop_attr);
BMO_op_finish(bm_parent, &bmop_attr);
BMO_slot_buffer_hflag_enable(bm_parent, bmop_fill.slots_out, "geom.out", BM_FACE, BM_ELEM_TAG | BM_ELEM_SELECT, true);
}
else { */
/* use edgenet fill with inner material */
BMO_op_initf(
bm_parent, &bmop_fill, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"edgenet_fill edges=%S mat_nr=%i use_smooth=%b sides=%i",
&bmop, "geom_cut.out", inner_mat_index, false, 2);
BMO_op_exec(bm_parent, &bmop_fill);
//}
/*gah, edgenetfill now overwrites the set materials internally, so attempt to re-set them */
BMO_slot_buffer_hflag_enable(bm_parent, bmop_fill.slots_out, "faces.out", BM_FACE, BM_ELEM_TAG, true);
{
BMFace* f;
BMIter iter;
BM_ITER_MESH(f, &iter, bm_parent, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_TAG)) {
f->mat_nr = inner_mat_index;
}
}
}
BMO_op_finish(bm_parent, &bmop_fill);
}
static void do_bisect(BMesh* bm_parent, BMesh* bm_child, float obmat[4][4], bool use_fill, bool clear_inner,
bool clear_outer, int cutlimit, float centroid[3], short inner_mat_index, float normal[3])
{
BMIter iter;
BMFace *f;
BMOperator bmop;
float plane_co[3];
float plane_no[3];
float imat[4][4];
float thresh = 0.00001f;
bool do_break = false;
int cut_index = 0;
invert_m4_m4(imat, obmat);
BM_ITER_MESH_INDEX (f, &iter, bm_child, BM_FACES_OF_MESH, cut_index)
{
if (do_break) {
break;
}
if (cutlimit > -1) {
//f = BM_face_at_index_find(bm_child, cutlimit);
copy_v3_v3(plane_co, centroid);
copy_v3_v3(plane_no, normal); //f->no /*normal*/);
do_break = true;
//mul_qt_v3(quat, plane_no);
}
else {
copy_v3_v3(plane_co, f->l_first->v->co);
copy_v3_v3(plane_no, f->no);
}
mul_m4_v3(imat, plane_co);
mul_mat3_m4_v3(imat, plane_no);
BM_mesh_elem_hflag_enable_all(bm_parent, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false);
BMO_op_initf(bm_parent, &bmop, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"bisect_plane geom=%hvef dist=%f plane_co=%v plane_no=%v use_snap_center=%b clear_inner=%b clear_outer=%b",
BM_ELEM_TAG, thresh, plane_co, plane_no, false, clear_inner, clear_outer);
BMO_op_exec(bm_parent, &bmop);
BM_mesh_elem_hflag_disable_all(bm_parent, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false);
if (use_fill) {
do_fill(plane_no, clear_outer, clear_inner, bmop, inner_mat_index, bm_parent);
}
BMO_slot_buffer_hflag_enable(bm_parent, bmop.slots_out, "geom_cut.out", BM_VERT | BM_EDGE, BM_ELEM_TAG, true);
BMO_op_finish(bm_parent, &bmop);
}
}
static BMesh *do_preselection(BMesh* bm_orig, Shard *child, KDTree *preselect_tree)
{
int i = 0, r = 0;
float max_dist = 0;
KDTreeNearest* n = NULL;
BMesh *bm_new = BM_mesh_create(&bm_mesh_allocsize_default, &((struct BMeshCreateParams){.use_toolflags = true,}));
BMIter iter;
BMFace *f;
#define MY_TAG (1 << 6)
BM_mesh_elem_toolflags_ensure(bm_new); /* needed for 'duplicate' bmo */
CustomData_copy(&bm_orig->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&bm_orig->edata, &bm_new->edata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&bm_orig->ldata, &bm_new->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_copy(&bm_orig->pdata, &bm_new->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
CustomData_bmesh_init_pool(&bm_new->vdata, bm_mesh_allocsize_default.totvert, BM_VERT);
CustomData_bmesh_init_pool(&bm_new->edata, bm_mesh_allocsize_default.totedge, BM_EDGE);
CustomData_bmesh_init_pool(&bm_new->ldata, bm_mesh_allocsize_default.totloop, BM_LOOP);
CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE);
for (i = 0; i < child->totvert; i++)
{
float dist = len_squared_v3v3(child->raw_centroid, child->mvert[i].co);
if (dist > max_dist) {
max_dist = dist;
}
}
BM_mesh_elem_hflag_disable_all(bm_orig, BM_VERT | BM_EDGE | BM_FACE, MY_TAG, false);
//do a range search first in case we have many verts as in dense geometry
r = BLI_kdtree_range_search(preselect_tree, child->raw_centroid, &n, sqrt(max_dist)*1.5f);
//skip empty cells
/*if (r == 0) {
BM_mesh_free(bm_new);
return NULL;
}*/
//if we have sparse geometry, just return all
if (r < child->totvert) {
//BM_mesh_free(bm_new);
//return BM_mesh_copy(bm_orig);
int j = 0, s = 0;
KDTreeNearest *n2 = MEM_callocN(sizeof(KDTreeNearest) * child->totvert, "n2 kdtreenearest");
s = BLI_kdtree_find_nearest_n(preselect_tree, child->raw_centroid, n2, child->totvert);
for (j = 0; j < s; j++)
{
BMVert* v;
int index = n2[j].index;
v = BM_vert_at_index(bm_orig, index);
BM_elem_flag_enable(v, MY_TAG);
}
if (n2) {
MEM_freeN(n2);
n2 = NULL;
}
}
else {
BMVert *v = NULL;
for (i = 0; i < r; i++) {
int index = n[i].index;
v = BM_vert_at_index(bm_orig, index);
BM_elem_flag_enable(v, MY_TAG);
}
}
BM_ITER_MESH(f, &iter, bm_orig, BM_FACES_OF_MESH) {
//select bigger squarish faces and long skinny ones
float area = BM_face_calc_area(f);
BMIter eiter;
BMEdge *e;
BM_ITER_ELEM(e, &eiter, f, BM_EDGES_OF_FACE) {
if ((area > 0.75f) || (BM_edge_calc_length_squared(e) > max_dist * 3.0f) ||
BM_elem_flag_test(e->v1, MY_TAG) || BM_elem_flag_test(e->v2, MY_TAG))
{
BM_elem_flag_enable(e->v1, MY_TAG);
BM_elem_flag_enable(e->v2, MY_TAG);
}
}
}
/* Flush the selection to get edge/face selections matching
* the vertex selection */
BKE_bm_mesh_hflag_flush_vert(bm_orig, MY_TAG);
BMO_op_callf(bm_orig, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"duplicate geom=%hvef dest=%p", MY_TAG, bm_new);
#undef MY_TAG
BM_mesh_elem_index_ensure(bm_new, BM_VERT | BM_EDGE | BM_FACE);
return bm_new;
}
Shard *BKE_fracture_shard_bisect(BMesh *bm_orig, Shard *child, float obmat[4][4], bool use_fill, bool clear_inner,
bool clear_outer, int cutlimit, float centroid[3], short inner_mat_index, char uv_layer[64],
KDTree *preselect_tree, float normal[3])
{
Shard *output_s;
DerivedMesh *dm_child = BKE_shard_create_dm(child, false);
BMesh *bm_parent;
BMesh *bm_child;
unwrap_shard_dm(dm_child, uv_layer, true);
bm_child = BM_mesh_create(&bm_mesh_allocsize_default, &((struct BMeshCreateParams){.use_toolflags = true,}));
DM_to_bmesh_ex(dm_child, bm_child, true);
//hmmm need to copy only preselection !!! or rebuild bm_parent from selected data only....
if (preselect_tree != NULL) {
bm_parent = do_preselection(bm_orig, child, preselect_tree);
}
else {
bm_parent = BM_mesh_copy(bm_orig);
}
if (bm_parent != NULL) {
BM_mesh_elem_hflag_enable_all(bm_parent, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false);
do_bisect(bm_parent, bm_child, obmat, use_fill, clear_inner, clear_outer, cutlimit, centroid, inner_mat_index, normal);
output_s = do_output_shard(bm_parent, child, uv_layer);
BM_mesh_free(bm_parent);
}
else {
output_s = NULL;
}
BM_mesh_free(bm_child);
dm_child->needsFree = 1;
dm_child->release(dm_child);
dm_child = NULL;
return output_s;
}

View File

@@ -175,7 +175,9 @@ static int group_object_unlink_internal(Group *group, Object *ob)
go = group->gobject.first;
while (go) {
gon = go->next;
if (go->ob == ob) {
/* case go->ob == NULL occurs in Fracture Modifier helper object group, should be checked for here or will crash
* in following depgraph update */
if (go->ob == ob || go->ob == NULL) {
BLI_remlink(&group->gobject, go);
free_group_object(go);
removed = 1;

View File

@@ -45,6 +45,7 @@
#include "DNA_customdata_types.h"
#include "DNA_ID.h"
#include "DNA_meta_types.h"
#include "DNA_modifier_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -57,6 +58,7 @@
#include "BKE_animsys.h"
#include "BKE_displist.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_depsgraph.h"
#include "BKE_icons.h"
@@ -67,6 +69,7 @@
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_scene.h"
#include "BKE_node.h"
#include "BKE_curve.h"
@@ -1213,6 +1216,7 @@ bool BKE_object_material_slot_remove(Object *ob)
Material *mao, ***matarar;
short *totcolp;
short a, actcol;
FractureModifierData *fmd;
if (ob == NULL || ob->totcol == 0) {
return false;
@@ -1294,6 +1298,14 @@ bool BKE_object_material_slot_remove(Object *ob)
}
}
/* also check the Fracture Modifier stored Derivedmesh, its polys may point to invalid index by now */
fmd = (FractureModifierData *)modifiers_findByType(ob, eModifierType_Fracture);
if (fmd && fmd->visible_mesh_cached) {
/* this effectively removes materials, but regenerates atleast 2 of them (as being necessary for modifier,
* thus avoiding crashes and messing up the mesh, an ugly solution but better than crash... */
fmd->refresh = true;
}
return true;
}

View File

@@ -52,12 +52,17 @@
#include "BKE_scene.h"
#include "BKE_displist.h"
#include "BKE_mball_tessellate.h" /* own include */
#include "BKE_cdderivedmesh.h"
#include "BLI_strict_flags.h"
/* experimental (faster) normal calculation */
// #define USE_ACCUM_NORMAL
struct MVert;
struct MLoop;
struct MPoly;
/* Data types */
typedef struct corner { /* corner of a cube */
@@ -67,7 +72,7 @@ typedef struct corner { /* corner of a cube */
} CORNER;
typedef struct cube { /* partitioning cell (cube) */
int i, j, k; /* lattice location of cube */
int i, j, k, index; /* lattice location of cube + original index ? */
CORNER *corners[8]; /* eight corners */
} CUBE;
@@ -134,13 +139,15 @@ typedef struct process { /* parameters, storage */
unsigned int totvertex; /* memory size */
unsigned int curvertex; /* currently added vertices */
int* orig_index; /* map new vertices to original ones */
/* memory allocation from common pool */
MemArena *pgn_elements;
} PROCESS;
/* Forward declarations */
static int vertid(PROCESS *process, const CORNER *c1, const CORNER *c2);
static void add_cube(PROCESS *process, int i, int j, int k);
static int vertid(PROCESS *process, const CORNER *c1, const CORNER *c2, int index);
static void add_cube(PROCESS *process, int i, int j, int k, int index);
static void make_face(PROCESS *process, int i1, int i2, int i3, int i4);
static void converge(PROCESS *process, const CORNER *c1, const CORNER *c2, float r_p[3]);
@@ -440,6 +447,7 @@ static void freepolygonize(PROCESS *process)
if (process->mainb) MEM_freeN(process->mainb);
if (process->bvh_queue) MEM_freeN(process->bvh_queue);
if (process->pgn_elements) BLI_memarena_free(process->pgn_elements);
if (process->orig_index) MEM_freeN(process->orig_index);
}
/* **************** POLYGONIZATION ************************ */
@@ -495,12 +503,12 @@ static void docube(PROCESS *process, CUBE *cube)
}
/* Using faces[] table, adds neighbouring cube if surface intersects face in this direction. */
if (MB_BIT(faces[index], 0)) add_cube(process, cube->i - 1, cube->j, cube->k);
if (MB_BIT(faces[index], 1)) add_cube(process, cube->i + 1, cube->j, cube->k);
if (MB_BIT(faces[index], 2)) add_cube(process, cube->i, cube->j - 1, cube->k);
if (MB_BIT(faces[index], 3)) add_cube(process, cube->i, cube->j + 1, cube->k);
if (MB_BIT(faces[index], 4)) add_cube(process, cube->i, cube->j, cube->k - 1);
if (MB_BIT(faces[index], 5)) add_cube(process, cube->i, cube->j, cube->k + 1);
if (MB_BIT(faces[index], 0)) add_cube(process, cube->i - 1, cube->j, cube->k, cube->index);
if (MB_BIT(faces[index], 1)) add_cube(process, cube->i + 1, cube->j, cube->k, cube->index);
if (MB_BIT(faces[index], 2)) add_cube(process, cube->i, cube->j - 1, cube->k, cube->index);
if (MB_BIT(faces[index], 3)) add_cube(process, cube->i, cube->j + 1, cube->k, cube->index);
if (MB_BIT(faces[index], 4)) add_cube(process, cube->i, cube->j, cube->k - 1, cube->index);
if (MB_BIT(faces[index], 5)) add_cube(process, cube->i, cube->j, cube->k + 1, cube->index);
/* Using cubetable[], determines polygons for output. */
for (polys = cubetable[index]; polys; polys = polys->next) {
@@ -512,7 +520,7 @@ static void docube(PROCESS *process, CUBE *cube)
c1 = cube->corners[corner1[edges->i]];
c2 = cube->corners[corner2[edges->i]];
indexar[count] = vertid(process, c1, c2);
indexar[count] = vertid(process, c1, c2, cube->index);
count++;
}
@@ -808,16 +816,18 @@ static int getedge(EDGELIST *table[],
/**
* Adds a vertex, expands memory if needed.
*/
static void addtovertices(PROCESS *process, const float v[3], const float no[3])
static void addtovertices(PROCESS *process, const float v[3], const float no[3], const int index)
{
if (process->curvertex == process->totvertex) {
process->totvertex += 4096;
process->co = MEM_reallocN(process->co, process->totvertex * sizeof(float[3]));
process->no = MEM_reallocN(process->no, process->totvertex * sizeof(float[3]));
process->orig_index = MEM_reallocN(process->orig_index, process->totvertex * sizeof(int));
}
copy_v3_v3(process->co[process->curvertex], v);
copy_v3_v3(process->no[process->curvertex], no);
process->orig_index[process->curvertex] = index;
process->curvertex++;
}
@@ -865,7 +875,7 @@ static void vnormal(PROCESS *process, const float point[3], float r_no[3])
*
* If it wasn't previously computed, does #converge() and adds vertex to process.
*/
static int vertid(PROCESS *process, const CORNER *c1, const CORNER *c2)
static int vertid(PROCESS *process, const CORNER *c1, const CORNER *c2, int index)
{
float v[3], no[3];
int vid = getedge(process->edges, c1->i, c1->j, c1->k, c2->i, c2->j, c2->k);
@@ -880,7 +890,7 @@ static int vertid(PROCESS *process, const CORNER *c1, const CORNER *c2)
vnormal(process, v, no);
#endif
addtovertices(process, v, no); /* save vertex */
addtovertices(process, v, no, index); /* save vertex */
vid = (int)process->curvertex - 1;
setedge(process, c1->i, c1->j, c1->k, c2->i, c2->j, c2->k, vid);
@@ -933,7 +943,7 @@ static void converge(PROCESS *process, const CORNER *c1, const CORNER *c2, float
/**
* Adds cube at given lattice position to cube stack of process.
*/
static void add_cube(PROCESS *process, int i, int j, int k)
static void add_cube(PROCESS *process, int i, int j, int k, int index)
{
CUBES *ncube;
int n;
@@ -948,6 +958,7 @@ static void add_cube(PROCESS *process, int i, int j, int k)
ncube->cube.i = i;
ncube->cube.j = j;
ncube->cube.k = k;
ncube->cube.index = index;
/* set corners of initial cube: */
for (n = 0; n < 8; n++)
@@ -1011,7 +1022,7 @@ static void find_first_points(PROCESS *process, const unsigned int em)
add[1] = it[1] - dir[1];
add[2] = it[2] - dir[2];
DO_MIN(it, add);
add_cube(process, add[0], add[1], add[2]);
add_cube(process, add[0], add[1], add[2], (int)em);
break;
}
} while ((it[0] > lbn[0]) && (it[1] > lbn[1]) && (it[2] > lbn[2]) &&
@@ -1241,6 +1252,7 @@ void BKE_mball_polygonize(EvaluationContext *eval_ctx, Scene *scene, Object *ob,
mb = ob->data;
process.orig_index = NULL;
process.thresh = mb->thresh;
if (process.thresh < 0.001f) process.converge_res = 16;
@@ -1301,3 +1313,336 @@ void BKE_mball_polygonize(EvaluationContext *eval_ctx, Scene *scene, Object *ob,
freepolygonize(&process);
}
static void init_meta_dm(PROCESS* process, DerivedMesh *dm, float stiffness, float radius, float size[3],
bool override_size, int defgrp_size)
{
float quat[4];
unsigned int i;
int totvert = dm->getNumVerts(dm), j;
MVert* mvert = dm->getVertArray(dm);
float* psize = CustomData_get_layer_named(&dm->vertData, CD_PROP_FLT, "psize");
MDeformVert *dvert = CustomData_get_layer(&dm->vertData, CD_MDEFORMVERT);
unit_qt(quat);
/* make main array */
for (j = 0; j < totvert; j++, mvert++)
{
MetaElem *new_ml;
//float size[3] = {1.0f, 1.0f, 1.0f};
float expx, expy, expz;
float tempmin[3], tempmax[3];
float sz[3];
if (psize != NULL && psize[j] > 0.0f && override_size)
{
mul_v3_v3fl(sz, size, psize[j]);
}
else {
copy_v3_v3(sz, size);
}
/* make a copy because of duplicates */
new_ml = BLI_memarena_alloc(process->pgn_elements, sizeof(MetaElem));
new_ml->bb = BLI_memarena_alloc(process->pgn_elements, sizeof(BoundBox));
new_ml->mat = BLI_memarena_alloc(process->pgn_elements, 4 * 4 * sizeof(float));
new_ml->imat = BLI_memarena_alloc(process->pgn_elements, 4 * 4 * sizeof(float));
//init new_ml
new_ml->type = MB_BALL;
new_ml->flag = MB_SCALE_RAD;
/* too big stiffness seems only ugly due to linear interpolation
* no need to have possibility for too big stiffness */
//if (ml->s > 10.0f) new_ml->s = 10.0f;
//else new_ml->s = ml->s;
new_ml->s = stiffness;
/* if metaball is negative, set stiffness negative */
//if (new_ml->flag & MB_NEGATIVE) new_ml->s = -new_ml->s;
if (dvert && defgrp_size > -1)
{
MDeformVert *dv = dvert + j;
if (dv && dv->dw)
{
float w = dv->dw[defgrp_size].weight - 0.5f;
//map 0..1 weights to -0.5f ... + 0.5f size factor, to allow also negative sizes... 0.5f weight is 0 size
mul_v3_fl(sz, w);
/* if metaball is negative, set stiffness negative, indicated by weight < 0.5f here */
if (w < 0.5f)
{
new_ml->s = -new_ml->s;
}
}
}
/* Translation of MetaElem */
/*unit_m4(pos);
pos[3][0] = mvert->co[0];
pos[3][1] = mvert->co[1];
pos[3][2] = mvert->co[2];*/
new_ml->x = mvert->co[0];
new_ml->y = mvert->co[1];
new_ml->z = mvert->co[2];
/* Rotation of MetaElem is stored in quat */
//quat_to_mat4(rot, quat);
loc_quat_size_to_mat4((float(*)[4])new_ml->mat, mvert->co, quat, sz);
invert_m4_m4((float(*)[4])new_ml->imat,(float(*)[4])new_ml->mat);
#if 0
/* basis object space -> world -> ml object space -> position -> rotation -> ml local space */
mul_m4_series((float(*)[4])new_ml->mat, obinv, bob->obmat, pos, rot);
/* ml local space -> basis object space */
invert_m4_m4((float(*)[4])new_ml->imat, (float(*)[4])new_ml->mat);
#endif
/* rad2 is inverse of squared radius */
new_ml->rad = radius;
new_ml->rad2 = 1 / (radius * radius);
/* initial dimensions = radius */
expx = radius;
expy = radius;
expz = radius;
new_ml->expx = expx;
new_ml->expy = expy;
new_ml->expz = expz;
#if 0
switch (ml->type) {
case MB_BALL:
break;
case MB_CUBE: /* cube is "expanded" by expz, expy and expx */
expz += ml->expz;
ATTR_FALLTHROUGH;
case MB_PLANE: /* plane is "expanded" by expy and expx */
expy += ml->expy;
ATTR_FALLTHROUGH;
case MB_TUBE: /* tube is "expanded" by expx */
expx += ml->expx;
break;
case MB_ELIPSOID: /* ellipsoid is "stretched" by exp* */
expx *= ml->expx;
expy *= ml->expy;
expz *= ml->expz;
break;
}
#endif
/* untransformed Bounding Box of MetaElem */
/* TODO, its possible the elem type has been changed and the exp* values can use a fallback */
copy_v3_fl3(new_ml->bb->vec[0], -expx, -expy, -expz); /* 0 */
copy_v3_fl3(new_ml->bb->vec[1], +expx, -expy, -expz); /* 1 */
copy_v3_fl3(new_ml->bb->vec[2], +expx, +expy, -expz); /* 2 */
copy_v3_fl3(new_ml->bb->vec[3], -expx, +expy, -expz); /* 3 */
copy_v3_fl3(new_ml->bb->vec[4], -expx, -expy, +expz); /* 4 */
copy_v3_fl3(new_ml->bb->vec[5], +expx, -expy, +expz); /* 5 */
copy_v3_fl3(new_ml->bb->vec[6], +expx, +expy, +expz); /* 6 */
copy_v3_fl3(new_ml->bb->vec[7], -expx, +expy, +expz); /* 7 */
/* transformation of Metalem bb */
for (i = 0; i < 8; i++)
mul_m4_v3((float(*)[4])new_ml->mat, new_ml->bb->vec[i]);
/* find max and min of transformed bb */
INIT_MINMAX(tempmin, tempmax);
for (i = 0; i < 8; i++) {
DO_MINMAX(new_ml->bb->vec[i], tempmin, tempmax);
}
/* set only point 0 and 6 - AABB of Metaelem */
copy_v3_v3(new_ml->bb->vec[0], tempmin);
copy_v3_v3(new_ml->bb->vec[6], tempmax);
/* add new_ml to mainb[] */
if (UNLIKELY(process->totelem == process->mem)) {
process->mem = process->mem * 2 + 10;
process->mainb = MEM_reallocN(process->mainb, sizeof(MetaElem *) * process->mem);
}
process->mainb[process->totelem++] = new_ml;
}
/* compute AABB of all Metaelems */
if (process->totelem > 0) {
copy_v3_v3(process->allbb.min, process->mainb[0]->bb->vec[0]);
copy_v3_v3(process->allbb.max, process->mainb[0]->bb->vec[6]);
for (i = 1; i < process->totelem; i++)
make_box_union(process->mainb[i]->bb, &process->allbb, &process->allbb);
}
}
void BKE_dm_from_metaball(DispList *dl, DerivedMesh *dm, DerivedMesh *odm, int *orig_index)
{
MVert *mvert;
MLoop *mloop, *allloop;
MPoly *mpoly;
const float *nors, *verts;
float *velX, *velY, *velZ, *ovX = NULL, *ovY = NULL, *ovZ = NULL;
int a, *index;
int totvert = 0;
if (dl == NULL) return;
if (dl->type == DL_INDEX4) {
//mvert = CustomData_add_layer(&dm->vertData, CD_MVERT, CD_CALLOC, NULL, dl->nr);
//allloop = mloop = CustomData_add_layer(&dm->loopData, CD_MLOOP, CD_CALLOC, NULL, dl->parts * 4);
//mpoly = CustomData_add_layer(&dm->polyData, CD_MPOLY, CD_CALLOC, NULL, dl->parts);
//dm->numVertData = dl->nr;
//dm->numPolyData = dl->parts;
totvert = dm->getNumVerts(dm);
mvert = dm->getVertArray(dm);
allloop = mloop = dm->getLoopArray(dm);
mpoly = dm->getPolyArray(dm);
velX = CustomData_add_layer_named(&dm->vertData, CD_PROP_FLT, CD_CALLOC, NULL, totvert, "velX");
velY = CustomData_add_layer_named(&dm->vertData, CD_PROP_FLT, CD_CALLOC, NULL, totvert, "velY");
velZ = CustomData_add_layer_named(&dm->vertData, CD_PROP_FLT, CD_CALLOC, NULL, totvert, "velZ");
ovX = CustomData_get_layer_named(&odm->vertData, CD_PROP_FLT, "velX");
ovY = CustomData_get_layer_named(&odm->vertData, CD_PROP_FLT, "velY");
ovZ = CustomData_get_layer_named(&odm->vertData, CD_PROP_FLT, "velZ");
//this will be recalculated here
dm->numLoopData = 0;
a = dl->nr;
nors = dl->nors;
verts = dl->verts;
while (a--) {
copy_v3_v3(mvert->co, verts);
normal_float_to_short_v3(mvert->no, nors);
mvert++;
nors += 3;
verts += 3;
}
a = dl->parts;
index = dl->index;
while (a--) {
int k = 0;
int count = index[2] != index[3] ? 4 : 3;
mloop[0].v = (unsigned int)index[0];
mloop[1].v = (unsigned int)index[1];
mloop[2].v = (unsigned int) index[2];
if (count == 4)
mloop[3].v = (unsigned int)index[3];
mpoly->totloop = count;
mpoly->loopstart = (int)(mloop - allloop);
//mpoly->flag = ME_SMOOTH;
for (k = 0; k < count; k++)
{
if (ovX && ovY && ovZ)
{
int v = index[k];
velX[v] = ovX[orig_index[v]];
velY[v] = ovY[orig_index[v]];
velZ[v] = ovZ[orig_index[v]];
//printf("Vel %f %f %f/n", velX[a], velY[a], velZ[a]);
}
}
mpoly++;
mloop += count;
dm->numLoopData += count;
index += 4;
}
CDDM_calc_normals(dm);
CDDM_calc_edges(dm);
CDDM_recalc_tessellation(dm);
CDDM_recalc_looptri(dm);
dm->dirty |= DM_DIRTY_NORMALS;
}
}
DerivedMesh* BKE_repolygonize_dm(DerivedMesh *dm, float thresh, float basesize[3], float wiresize, float rendersize,
bool render, bool override_size, int defgrp_size)
{
DerivedMesh *result = NULL;
DispList *dl;
unsigned int a;
PROCESS process = {0};
process.thresh = thresh;
if (process.thresh < 0.001f) process.converge_res = 16;
else if (process.thresh < 0.01f) process.converge_res = 8;
else if (process.thresh < 0.1f) process.converge_res = 4;
else process.converge_res = 2;
//if ((!render) && (mb->flag == MB_UPDATE_NEVER)) return;
//if ((G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_FAST) return;
if (render) {
process.size = rendersize;
}
else {
process.size = wiresize;
/*if ((G.moving & (G_TRANSFORM_OBJ | G_TRANSFORM_EDIT)) && mb->flag == MB_UPDATE_HALFRES) {
process.size *= 2.0f;
}*/
}
process.delta = process.size * 0.001f;
process.pgn_elements = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "Metaball memarena");
/* initialize from DM */
init_meta_dm(&process, dm, 2.0f, 2.0f, basesize, override_size, defgrp_size);
if (process.totelem > 0) {
build_bvh_spatial(&process, &process.metaball_bvh, 0, process.totelem, &process.allbb);
process.orig_index = MEM_callocN(process.totelem * sizeof(int), "process origindex");
/* don't polygonize metaballs with too high resolution (base mball to small)
* note: Eps was 0.0001f but this was giving problems for blood animation for durian, using 0.00001f */
if (basesize[0] > 0.00001f * (process.allbb.max[0] - process.allbb.min[0]) ||
basesize[1] > 0.00001f * (process.allbb.max[1] - process.allbb.min[1]) ||
basesize[2] > 0.00001f * (process.allbb.max[2] - process.allbb.min[2]))
{
polygonize(&process);
/* add resulting surface to displist */
if (process.curindex) {
dl = MEM_callocN(sizeof(DispList), "mballdisp");
dl->type = DL_INDEX4;
dl->nr = (int)process.curvertex;
dl->parts = (int)process.curindex;
dl->index = (int *)process.indices;
for (a = 0; a < process.curvertex; a++) {
normalize_v3(process.no[a]);
}
dl->verts = (float *)process.co;
dl->nors = (float *)process.no;
result = CDDM_new(dl->nr, 0, 0, dl->parts * 4, dl->parts);
BKE_dm_from_metaball(dl, result, dm, process.orig_index);
BKE_displist_elem_free(dl);
}
}
}
if (!result)
result = CDDM_new(0, 0, 0, 0, 0); //return an empty mesh
freepolygonize(&process);
return result;
}

View File

@@ -902,6 +902,7 @@ void BKE_mesh_assign_object(Object *ob, Mesh *me)
}
void BKE_mesh_material_index_remove(Mesh *me, short index)
{
MPoly *mp;

View File

@@ -683,9 +683,7 @@ Object *BKE_object_add_only_object(Main *bmain, int type, const char *name)
/* general add: to scene, with layer from area and default name */
/* creates minimum required data, but without vertices etc. */
Object *BKE_object_add(
Main *bmain, Scene *scene,
int type, const char *name)
Object *BKE_object_add(Main *bmain, Scene *scene, int type, const char *name)
{
Object *ob;
Base *base;
@@ -3197,6 +3195,7 @@ int BKE_object_is_deform_modified(Scene *scene, Object *ob)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
bool can_deform = mti->type == eModifierTypeType_OnlyDeform ||
md->type == eModifierType_Fracture ||
is_modifier_animated;
if (!can_deform) {

View File

@@ -1053,7 +1053,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
}
}
if (totmapped == 0) {
if (totmapped < 1) {
/* We are not allowed to distribute particles anywhere... */
return 0;
}
@@ -1196,7 +1196,7 @@ static void psys_task_init_distribute(ParticleTask *task, ParticleSimulationData
task->rng = BLI_rng_new(seed);
}
static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
static int distribute_particles_on_dm(ParticleSimulationData *sim, int from)
{
TaskScheduler *task_scheduler;
TaskPool *task_pool;
@@ -1207,7 +1207,7 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
/* create a task pool for distribution tasks */
if (!psys_thread_context_init_distribute(&ctx, sim, from))
return;
return 0;
task_scheduler = BLI_task_scheduler_get();
task_pool = BLI_task_pool_create(task_scheduler, &ctx);
@@ -1235,6 +1235,8 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
psys_tasks_free(tasks, numtasks);
psys_thread_context_free(&ctx);
return 1;
}
/* ready for future use, to emit particles without geometry */
@@ -1245,14 +1247,15 @@ static void distribute_particles_on_shape(ParticleSimulationData *sim, int UNUSE
fprintf(stderr,"Shape emission not yet possible!\n");
}
void distribute_particles(ParticleSimulationData *sim, int from)
int distribute_particles(ParticleSimulationData *sim, int from)
{
PARTICLE_PSMD;
int distr_error=0;
int ret = 0;
if (psmd) {
if (psmd->dm_final)
distribute_particles_on_dm(sim, from);
ret = distribute_particles_on_dm(sim, from);
else
distr_error=1;
}
@@ -1264,6 +1267,8 @@ void distribute_particles(ParticleSimulationData *sim, int from)
fprintf(stderr,"Particle distribution error!\n");
}
return ret;
}
/* ======== Simplify ======== */

View File

@@ -3905,7 +3905,8 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra),
#endif // WITH_MOD_FLUID
}
static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNUSED(cfra))
static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNUSED(cfra),
ParticleSettings *part)
{
ParticleSystem *psys = sim->psys;
int oldtotpart = psys->totpart;
@@ -3914,7 +3915,12 @@ static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNU
if (totpart != oldtotpart)
realloc_particles(sim, totpart);
return totpart - oldtotpart;
//always allow redistribution of particles, except on grid and hair systems !
if (part->distr == PART_DISTR_GRID || part->type == PART_HAIR) {
return totpart - oldtotpart;
}
return totpart;
}
/* Calculates the next state for all particles of the system
@@ -3931,7 +3937,8 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_
PTCacheID ptcacheid, *pid = NULL;
PARTICLE_P;
float disp, cache_cfra = cfra; /*, *vg_vel= 0, *vg_tan= 0, *vg_rot= 0, *vg_size= 0; */
int startframe = 0, endframe = 100, oldtotpart = 0;
int startframe = 0, endframe = 100, oldtotpart = 0, emitcount = 0;
bool suppressed = false;
/* cache shouldn't be used for hair or "continue physics" */
if (part->type != PART_HAIR) {
@@ -3958,12 +3965,29 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_
/* 1. emit particles and redo particles if needed */
oldtotpart = psys->totpart;
if (emit_particles(sim, pid, cfra) || psys->recalc & PSYS_RECALC_RESET) {
distribute_particles(sim, part->from);
initialize_all_particles(sim);
/* reset only just created particles (on startframe all particles are recreated) */
reset_all_particles(sim, 0.0, cfra, oldtotpart);
free_unexisting_particles(sim);
emitcount = emit_particles(sim, pid, cfra, part);
if (emitcount || psys->recalc & PSYS_RECALC_RESET)
{
if (distribute_particles(sim, part->from) || part->distr == PART_DISTR_GRID) {
initialize_all_particles(sim);
/* reset only just created particles (on startframe all particles are recreated) */
reset_all_particles(sim, 0.0, cfra, oldtotpart);
}
else if (emitcount == oldtotpart || oldtotpart == 0){
//throw away...
int i;
suppressed = true;
for (i = 0; i < sim->psys->totpart; i++)
{
if (sim->psys->particles[i].state.time <= 0)
{
sim->psys->particles[i].flag |= PARS_UNEXIST;
}
}
}
if (!suppressed)
free_unexisting_particles(sim);
if (psys->fluid_springs) {
MEM_freeN(psys->fluid_springs);
@@ -3975,11 +3999,13 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_
/* flag for possible explode modifiers after this system */
sim->psmd->flag |= eParticleSystemFlag_Pars;
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, cfra);
if (psys->recalc & PSYS_RECALC_RESET) {
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, cfra);
}
}
/* 2. try to read from the cache */
if (pid) {
if (pid && !suppressed) {
int cache_result = BKE_ptcache_read(pid, cache_cfra, true);
if (ELEM(cache_result, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED)) {
@@ -4076,6 +4102,11 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_
end_latt_deform(psys->lattice_deform_data);
psys->lattice_deform_data = NULL;
}
if (suppressed) {
//need dummy cache data, so free suppressed particles later
free_unexisting_particles(sim);
}
}
/* system type has changed so set sensible defaults and clear non applicable flags */
@@ -4318,10 +4349,22 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys, cons
if (psys->recalc & PSYS_RECALC_RESET)
psys_reset(psys, PSYS_RESET_ALL);
if (emit_particles(&sim, NULL, cfra) || (psys->recalc & PSYS_RECALC_RESET)) {
if (emit_particles(&sim, NULL, cfra, part) || (psys->recalc & PSYS_RECALC_RESET)) {
free_keyed_keys(psys);
distribute_particles(&sim, part->from);
initialize_all_particles(&sim);
if (distribute_particles(&sim, part->from) || part->distr == PART_DISTR_GRID) {
initialize_all_particles(&sim);
}
else {
//throw away...
int i;
for (i = 0; i < sim.psys->totpart; i++)
{
if (sim.psys->particles[i].alive == PARS_UNBORN) {
sim.psys->particles[i].flag |= PARS_UNEXIST;
}
}
}
free_unexisting = true;
/* flag for possible explode modifiers after this system */

View File

@@ -69,6 +69,8 @@
#include "BKE_scene.h"
#include "BKE_smoke.h"
#include "BKE_softbody.h"
#include "BKE_rigidbody.h"
#include "BKE_fracture.h"
#include "BIK_api.h"
@@ -1277,43 +1279,189 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
return 1;
}
static MeshIsland *find_meshisland(FractureModifierData *fmd, int id)
{
MeshIsland *mi = (MeshIsland*)fmd->meshIslands.first;
while (mi)
{
if (mi->rigidbody->meshisland_index == id)
{
return mi;
}
mi = mi->next;
}
return NULL;
}
/* Rigid Body functions */
static int ptcache_rigidbody_write(int index, void *rb_v, void **data, int UNUSED(cfra))
static int ptcache_rigidbody_write(int index, void *rb_v, void **data, int cfra)
{
RigidBodyWorld *rbw = rb_v;
Object *ob = NULL;
RigidBodyOb *rbo = NULL;
/* clumsy, clumsy, but we need to access our own (meshisland based) cache here in case of dynamic fracture*/
Object* ob = NULL;
FractureModifierData *fmd = NULL;
float linvel[3] = {0.0f, 0.0f, 0.0f};
float angvel[3] = {0.0f, 0.0f, 0.0f};
if (!rbw->cache_index_map || !rbw->cache_offset_map)
return 1;
rbo = rbw->cache_index_map[index];
if (rbw->objects)
ob = rbw->objects[index];
if (ob && ob->rigidbody_object) {
RigidBodyOb *rbo = ob->rigidbody_object;
if (rbo == NULL) {
float dummyloc[3] = {FLT_MIN, FLT_MIN, FLT_MIN};
float dummyrot[4] = {FLT_MIN, FLT_MIN, FLT_MIN, FLT_MIN};
if (rbo->type == RBO_TYPE_ACTIVE) {
//need to write dummy data obviously... hmm
PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, dummyloc);
PTCACHE_DATA_FROM(data, BPHYS_DATA_ROTATION, dummyrot);
return 1;
}
ob = rbw->objects[rbw->cache_offset_map[index]];
fmd = (FractureModifierData*)modifiers_findByType(ob, eModifierType_Fracture);
if (rbo && rbo->physics_object)
{
if ((!fmd || fmd->fracture_mode != MOD_FRACTURE_DYNAMIC) && rbo->type == RBO_TYPE_ACTIVE)
{
MeshIsland *mi = NULL;
if (fmd && fmd->acceleration_defgrp_name[0])
{
mi = find_meshisland(fmd, rbo->meshisland_index);
if (cfra >= mi->start_frame && cfra <= mi->frame_count) {
float lastvel = 0.0f;
float vel = 0.0f;
float acc = 0.0f;
//rough framewise estimate of total force
if (mi->rigidbody->physics_object)
{
RB_body_get_linear_velocity(mi->rigidbody->physics_object, linvel);
RB_body_get_angular_velocity(mi->rigidbody->physics_object, angvel);
vel = len_v3(linvel) + len_v3(angvel);
}
if (cfra >= mi->start_frame + 1 && cfra == rbw->ltime + 1)
{
lastvel = mi->acc_sequence[cfra - mi->start_frame - 1];
acc = fabsf(vel - lastvel);
BKE_update_acceleration_map(fmd, mi, ob, cfra, acc, rbw);
mi->acc_sequence[cfra - mi->start_frame] = vel;
}
}
}
#ifdef WITH_BULLET
RB_body_get_position(rbo->physics_object, rbo->pos);
RB_body_get_orientation(rbo->physics_object, rbo->orn);
if (!(fmd && fmd->use_animated_mesh && fmd->anim_mesh_ob && (rbo->flag & RBO_FLAG_KINEMATIC)))
{
RB_body_get_position(rbo->physics_object, rbo->pos);
RB_body_get_orientation(rbo->physics_object, rbo->orn);
}
RB_body_get_linear_velocity(rbo->physics_object, rbo->lin_vel);
RB_body_get_angular_velocity(rbo->physics_object, rbo->ang_vel);
//this is only for motionblur, so its enough to be updated when rendering
if (fmd && G.is_rendering)
{
mi = find_meshisland(fmd, rbo->meshisland_index);
BKE_update_velocity_layer(fmd, mi);
}
/*if (cfra > rbw->pointcache->startframe)
{
sub_v3_v3v3(rbo->lin_vel, linvel, rbo->lin_vel);
sub_v3_v3v3(rbo->ang_vel, angvel, rbo->ang_vel);
}
else if (cfra == rbw->pointcache->startframe)
{
zero_v3(rbo->lin_vel);
zero_v3(rbo->ang_vel);
}*/
#endif
PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, rbo->pos);
PTCACHE_DATA_FROM(data, BPHYS_DATA_ROTATION, rbo->orn);
PTCACHE_DATA_FROM(data, BPHYS_DATA_VELOCITY, rbo->lin_vel);
PTCACHE_DATA_FROM(data, BPHYS_DATA_AVELOCITY, rbo->ang_vel);
}
else if (fmd && fmd->fracture_mode == MOD_FRACTURE_DYNAMIC)
{
//MeshIsland *mi = BLI_findlink(&fmd->meshIslands, rbo->meshisland_index);
MeshIsland *mi = find_meshisland(fmd, rbo->meshisland_index);
int frame = cfra;
// if (!mi)
// return 0;
rbo = mi->rigidbody;
#ifdef WITH_BULLET
RB_body_get_position(rbo->physics_object, rbo->pos);
RB_body_get_orientation(rbo->physics_object, rbo->orn);
RB_body_get_linear_velocity(rbo->physics_object, rbo->lin_vel);
RB_body_get_angular_velocity(rbo->physics_object, rbo->ang_vel);
#endif
frame = frame - mi->start_frame;
//printf("Writing frame %d %d %d %d\n", (int)cfra, mi->start_frame, frame, fmd->last_frame);
// if (frame < 0) // GAAAAH!
// frame = 0;
//grow array if necessary...
if (frame >= mi->frame_count) {
mi->frame_count = frame+1;
mi->locs = MEM_reallocN(mi->locs, sizeof(float) * 3 * mi->frame_count);
mi->rots = MEM_reallocN(mi->rots, sizeof(float) * 4 * mi->frame_count);
}
mi->locs[3*frame] = rbo->pos[0];
mi->locs[3*frame+1] = rbo->pos[1];
mi->locs[3*frame+2] = rbo->pos[2];
mi->rots[4*frame] = rbo->orn[0];
mi->rots[4*frame+1] = rbo->orn[1];
mi->rots[4*frame+2] = rbo->orn[2];
mi->rots[4*frame+3] = rbo->orn[3];
//dummy data
PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, rbo->pos);
PTCACHE_DATA_FROM(data, BPHYS_DATA_ROTATION, rbo->orn);
PTCACHE_DATA_FROM(data, BPHYS_DATA_VELOCITY, rbo->lin_vel);
PTCACHE_DATA_FROM(data, BPHYS_DATA_AVELOCITY, rbo->ang_vel);
}
}
return 1;
}
static void ptcache_rigidbody_read(int index, void *rb_v, void **data, float UNUSED(cfra), float *old_data)
static void ptcache_rigidbody_read(int index, void *rb_v, void **data, float cfra, float *old_data)
{
RigidBodyWorld *rbw = rb_v;
Object *ob = NULL;
RigidBodyOb *rbo = NULL;
/* clumsy, clumsy, but we need to access our own (meshisland based) cache here in case of dynamic fracture*/
Object* ob = NULL;
FractureModifierData *fmd;
if (rbw->objects)
ob = rbw->objects[index];
rbo = rbw->cache_index_map[index];
if (ob && ob->rigidbody_object) {
RigidBodyOb *rbo = ob->rigidbody_object;
if (rbo->type == RBO_TYPE_ACTIVE) {
if (rbo == NULL) {
return;
}
ob = rbw->objects[rbw->cache_offset_map[index]];
fmd = (FractureModifierData*)modifiers_findByType(ob, eModifierType_Fracture);
if (!fmd || (fmd && fmd->fracture_mode != MOD_FRACTURE_DYNAMIC))
{
if (rbo && rbo->type == RBO_TYPE_ACTIVE) {
MeshIsland *mi = NULL;
if (old_data) {
memcpy(rbo->pos, data, 3 * sizeof(float));
memcpy(rbo->orn, data + 3, 4 * sizeof(float));
@@ -1321,47 +1469,163 @@ static void ptcache_rigidbody_read(int index, void *rb_v, void **data, float UNU
else {
PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, 0, rbo->pos);
PTCACHE_DATA_TO(data, BPHYS_DATA_ROTATION, 0, rbo->orn);
PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, 0, rbo->lin_vel);
PTCACHE_DATA_TO(data, BPHYS_DATA_AVELOCITY,0, rbo->ang_vel);
}
if (fmd && fmd->acceleration_defgrp_name[0])
{
int frame = (int)floor(cfra);
mi = find_meshisland(fmd, rbo->meshisland_index);
if (frame >= mi->start_frame && frame <= mi->frame_count) {
float vel = mi->acc_sequence[frame - mi->start_frame];
float lastvel = 0.0f;
float acc = 0.0f;
if (frame >= mi->start_frame + 1)
{
lastvel = mi->acc_sequence[frame - mi->start_frame - 1];
acc = fabsf(vel - lastvel);
BKE_update_acceleration_map(fmd, mi, ob, frame, acc, rbw);
}
}
}
//this is only for motionblur, so its enough to be updated when rendering
if (fmd && G.is_rendering)
{
mi = find_meshisland(fmd, rbo->meshisland_index);
BKE_update_velocity_layer(fmd, mi);
}
}
}
else if (fmd && fmd->fracture_mode == MOD_FRACTURE_DYNAMIC)
{
if (rbo /*&& rbo->type == RBO_TYPE_ACTIVE*/)
{
//damn, slow listbase based lookup
//TODO, need to speed this up.... array, hash ?
//modifier should have "switched" this to current set of meshislands already.... so access it
MeshIsland *mi = NULL;
int frame = (int)floor(cfra);
mi = find_meshisland(fmd, rbo->meshisland_index);
// if (!mi)
// return;
frame = frame - mi->start_frame;
//if (frame < 0)
//{
// frame = 0; //grrr, why does this happen ?!
//}
//printf("Reading frame %d %d %d %d\n", (int)cfra, mi->start_frame, frame, fmd->last_frame);
rbo->pos[0] = mi->locs[3*frame];
rbo->pos[1] = mi->locs[3*frame+1];
rbo->pos[2] = mi->locs[3*frame+2];
rbo->orn[0] = mi->rots[4*frame];
rbo->orn[1] = mi->rots[4*frame+1];
rbo->orn[2] = mi->rots[4*frame+2];
rbo->orn[3] = mi->rots[4*frame+3];
}
}
}
static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, float cfra, float cfra1, float cfra2, float *old_data)
{
RigidBodyWorld *rbw = rb_v;
Object *ob = NULL;
RigidBodyOb *rbo = NULL;
ParticleKey keys[4];
float dfra;
Object* ob;
FractureModifierData *fmd;
MeshIsland *mi = NULL;
if (rbw->objects)
ob = rbw->objects[index];
if (ob && ob->rigidbody_object) {
RigidBodyOb *rbo = ob->rigidbody_object;
if (rbo->type == RBO_TYPE_ACTIVE) {
ParticleKey keys[4];
ParticleKey result;
float dfra;
memset(keys, 0, sizeof(keys));
copy_v3_v3(keys[1].co, rbo->pos);
copy_qt_qt(keys[1].rot, rbo->orn);
rbo = rbw->cache_index_map[index];
if (rbo == NULL) {
return;
}
ob = rbw->objects[rbw->cache_offset_map[index]];
fmd = (FractureModifierData*)modifiers_findByType(ob, eModifierType_Fracture);
if (fmd)
mi = find_meshisland(fmd, rbo->meshisland_index);
if (rbo->type == RBO_TYPE_ACTIVE || (fmd && fmd->fracture_mode == MOD_FRACTURE_DYNAMIC)) {
copy_v3_v3(keys[1].co, rbo->pos);
copy_qt_qt(keys[1].rot, rbo->orn);
copy_v3_v3(keys[1].vel, rbo->lin_vel);
copy_v3_v3(keys[1].ave, rbo->ang_vel);
if (!fmd || fmd->fracture_mode != MOD_FRACTURE_DYNAMIC)
{
if (old_data) {
memcpy(keys[2].co, data, 3 * sizeof(float));
memcpy(keys[2].rot, data + 3, 4 * sizeof(float));
memcpy(keys[2].vel, data + 7, 3 * sizeof(float));
memcpy(keys[2].ave, data + 10, 3 * sizeof(float));
}
else {
BKE_ptcache_make_particle_key(&keys[2], 0, data, cfra2);
if (fmd)
{
//MeshIsland *mi = find_meshisland(fmd, rbo->meshisland_index);
float acc = mi->acc_sequence[((int)cfra)-mi->start_frame];
/*float acc1 = mi->acc_sequence[((int)cfra1)-mi->start_frame];
float acc2 = mi->acc_sequence[((int)cfra2)-mi->start_frame];
float t = (cfra - cfra1) / (cfra2 - cfra1);
const float s = 1.0f - t;
float acc = s * acc1 + t * acc2;*/
BKE_update_acceleration_map(fmd, mi, ob, (int)cfra, acc, rbw);
}
BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2);
}
dfra = cfra2 - cfra1;
/* note: keys[0] and keys[3] unused for type < 1 (crappy) */
psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, &result, true);
interp_qt_qtqt(result.rot, keys[1].rot, keys[2].rot, (cfra - cfra1) / dfra);
copy_v3_v3(rbo->pos, result.co);
copy_qt_qt(rbo->orn, result.rot);
}
else if (fmd && fmd->fracture_mode == MOD_FRACTURE_DYNAMIC)
{
float loc[3], rot[4];
//MeshIsland *mi = find_meshisland(fmd, rbo->meshisland_index);
int frame = (int)floor(cfra);
frame = frame - mi->start_frame;
loc[0] = mi->locs[3*frame];
loc[1] = mi->locs[3*frame+1];
loc[2] = mi->locs[3*frame+2];
rot[0] = mi->rots[4*frame];
rot[1] = mi->rots[4*frame+1];
rot[2] = mi->rots[4*frame+2];
rot[3] = mi->rots[4*frame+3];
copy_v3_v3(keys[2].co, loc);
copy_qt_qt(keys[2].rot, rot);
}
dfra = cfra2 - cfra1;
/*psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, keys, 1) */
/* XXX temporary deform motion blur fix */
interp_v3_v3v3(keys->co, keys[1].co, keys[2].co, (cfra - cfra1) / dfra);
interp_qt_qtqt(keys->rot, keys[1].rot, keys[2].rot, (cfra - cfra1) / dfra);
interp_v3_v3v3(keys->vel, keys[1].vel, keys[2].vel, (cfra - cfra1) / dfra);
interp_v3_v3v3(keys->ave, keys[1].ave, keys[2].ave, (cfra - cfra1) / dfra);
copy_v3_v3(rbo->pos, keys->co);
copy_qt_qt(rbo->orn, keys->rot);
copy_v3_v3(rbo->lin_vel, keys->vel);
copy_v3_v3(rbo->ang_vel, keys->ave);
if (fmd && mi && G.is_rendering)
{
BKE_update_velocity_layer(fmd, mi);
}
}
}
@@ -1638,7 +1902,8 @@ void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *r
pid->write_header = ptcache_basic_header_write;
pid->read_header = ptcache_basic_header_read;
pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_ROTATION);
pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_ROTATION) |
(1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_AVELOCITY);
pid->info_types= 0;
pid->stack_index = pid->cache->index;
@@ -3347,11 +3612,27 @@ int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode)
}
if (scene->rigidbody_world && (ob->rigidbody_object || ob->rigidbody_constraint)) {
if (ob->rigidbody_object)
ob->rigidbody_object->flag |= RBO_FLAG_NEEDS_RESHAPE;
BKE_ptcache_id_from_rigidbody(&pid, ob, scene->rigidbody_world);
/* only flag as outdated, resetting should happen on start frame */
pid.cache->flag |= PTCACHE_OUTDATED;
ModifierData *md = modifiers_findByType(ob, eModifierType_Fracture);
if (md && md->type == eModifierType_Fracture)
{
FractureModifierData *fmd = (FractureModifierData*)md;
if (!fmd->refresh_autohide)
{
if (ob->rigidbody_object)
ob->rigidbody_object->flag |= RBO_FLAG_NEEDS_RESHAPE;
BKE_ptcache_id_from_rigidbody(&pid, ob, scene->rigidbody_world);
/* only flag as outdated, resetting should happen on start frame */
pid.cache->flag |= PTCACHE_OUTDATED;
}
}
else
{
if (ob->rigidbody_object)
ob->rigidbody_object->flag |= RBO_FLAG_NEEDS_RESHAPE;
BKE_ptcache_id_from_rigidbody(&pid, ob, scene->rigidbody_world);
/* only flag as outdated, resetting should happen on start frame */
pid.cache->flag |= PTCACHE_OUTDATED;
}
}
if (ob->type == OB_ARMATURE)

File diff suppressed because it is too large Load Diff

View File

@@ -1439,7 +1439,7 @@ static void scene_rebuild_rbw_recursive(Scene *scene, float ctime)
scene_rebuild_rbw_recursive(scene->set, ctime);
if (BKE_scene_check_rigidbody_active(scene))
BKE_rigidbody_rebuild_world(scene, ctime);
BKE_rigidbody_rebuild_world(scene, ctime, false);
}
static void scene_do_rb_simulation_recursive(Scene *scene, float ctime)

View File

@@ -663,9 +663,9 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
}
if (codec_id == AV_CODEC_ID_QTRLE) {
if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
// if (rd->im_format.planes == R_IMF_PLANES_RGBA) {
c->pix_fmt = AV_PIX_FMT_ARGB;
}
// }
}
if (codec_id == AV_CODEC_ID_PNG) {

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