1
1

Compare commits

..

607 Commits

Author SHA1 Message Date
ca7079a44e Merge branch 'master' into outliner-cpp-refactor 2020-11-11 17:35:26 +01:00
5b5ec0a2e9 Fix T82521: Bump OpenImageIO minimum version 1.8 > 2.2.1 for install_deps.sh
Since rB6fdcca8de64cd70f, we need at least OpenImageIO 2.1.12 to build
Blender.
2020-11-11 15:10:01 +01:00
e47ea9fbc7 GPencil: Fix unreported crash when style is NULL 2020-11-11 12:16:22 +01:00
7b6d76f387 Cleanup: correct argument order to callback
Currently the callback isn't used,
found when testing a new enum callback.
2020-11-11 20:40:42 +11:00
251b7d77b3 Merge branch 'blender-v2.91-release' into master 2020-11-11 10:27:44 +01:00
7ba971d6d8 Fix T82553: Outliner F2 renaming issue when item is out of view
- scrolling would be restricted (usually, if the object to be renamed is
in view, this prevents scrolling away without finishing the rename
operation)
- renaming by typing and confirming with Enter was not possible (you
would have to escape, scroll to the object and use F2 again)
- other shortcuts like A and H are still active instead of being handled
as text input

Avoid all these issue by forcing the item into view using
outliner_show_active / outliner_scroll_view.

Maniphest Tasks: T82553

Differential Revision: https://developer.blender.org/D9521
2020-11-11 10:18:47 +01:00
9b3dabacbc Cleanup: Use NDEBUG define, DEBUG one is not reliable. 2020-11-11 10:15:58 +01:00
2d48f3e445 Fix 'outliner_scroll_view()' not reaching wanted element
Scrolling to an item after opening relevant parents can go wrong if said
parent e.g. the last in the list [as in: then the Outliner does not
scroll down all the way]
It stems from the fact that 'region->v2d.tot.ymin' is not up-to-date in
outliner_scroll_view after outliner_show_active opens up parents, 'tot'
will only update on a redraw.

Now calculate the trees height on the fly using
'outliner_tree_dimensions()'.

ref D9521
ref T82553

Maniphest Tasks: T82553

Differential Revision: https://developer.blender.org/D9523
2020-11-11 10:12:28 +01:00
15ffda3bcd Fix T82602: checking image header reads past buffer bounds
Use the size argument to ensure checking the header doesn't read
past the buffer bounds when reading corrupt/truncated headers
from image files.
2020-11-11 16:14:09 +11:00
2d60845786 Cleanup: pass header size to 'is_a' callbacks
No functional changes, prepare for fixing out-of-bounds access
when reading headers.
2020-11-11 16:14:06 +11:00
99f56b4c16 Cleanup: use 'filepath' instead of 'name' for ImBuf utilities 2020-11-11 16:14:06 +11:00
a5f8071bdf Cleanup: use bool for imbuf save callbacks 2020-11-11 16:14:05 +11:00
e9c19b2820 Cleanup: avoid boolean literals for functions that return int 2020-11-11 16:14:05 +11:00
11bf3b7035 Cleanup: use define for targa header size 2020-11-11 15:05:30 +11:00
75c18b989c Cleanup: remove redundant NULL checks in ImFileType.is_a callback
Most of these callbacks don't do a NULL check,
so there is no need to do this for bmp/png.

Also correct radiance_hdr comments.
2020-11-11 14:54:04 +11:00
36e5c9e026 Merge branch 'blender-v2.91-release' 2020-11-11 14:44:27 +11:00
12168ccf18 ImBuf: replace incorrect strstr use with memcmp
Besides being incorrect as only the first two bytes should be tested,
searching binary data using `strstr` can easily read past buffer bounds.
2020-11-11 14:41:04 +11:00
eeeb2c1967 Merge branch 'blender-v2.91-release' 2020-11-10 17:34:29 -07:00
8953485f56 Fix: Selection not possible from outliner gutter
Selection should be possible from the left gutter in object mode. When
in other modes the mode column displays icon buttons which should be
prioritized for selection only in those modes.

Introduced in rB2110af20f5e6.
2020-11-10 17:29:32 -07:00
c4d8f6a4a8 Cleanup: clang-format 2020-11-11 09:11:43 +11:00
cd9acfed4f Cleanup: use preprocessor version check for PyTypeObject declaration
While `tp_print` was deprecated, Python 3.8+ uses this for
'tp_vectorcall_offset' which wasn't stated in the comment from
efd71aad4f.

Instead of suppressing clang-tidy, use preprocessor a check since
this properly represents the difference between Python versions.
2020-11-11 09:11:21 +11:00
86bdd2acc6 Windows: Fix build issue with VCPKG
For blender we disable VCPKG to prevent it from picking
up the wrong libraries from VCPKG rather than our lib folder
some of the cycles tests needed this to link correctly.

reported by @alef on chat
2020-11-10 13:23:55 -07:00
b980cd163a Cycles: fix compilation of OSL shaders following API change
The names of the parameters are based on those of those of the sockets, so they also need to be updated. This was forgotten about in the previous commit (rBa284e559b90e).

Ref T82561.
2020-11-10 18:59:30 +01:00
a63208823c Fix NanoVDB compile errors with recent NanoVDB versions
There were some changes to the NanoVDB API that broke the way Cycles was previously using it.
With these changes it compiles successfully again and also still compiles with the NanoVDB revision
that is currently part of the Blender dependencies. Ref T81454.
2020-11-10 18:28:14 +01:00
339f442a93 Fix (unreported) potential assert in viewlayer synchronization.
Some operations, like remapping and ID (Object) to another, can lead to
having the same object in more than one base.

While this is not a valid state, this is being taken care of by the
`BKE_layer_collection_sync` call, so the object-to-base GHash generation
itself should be resilient to such issue.

Note: another way to fix this would be to make remapping post-process
code check explicitely for such doublons, but I would rather avoid
adding even more 'specialized' code there, it already has to deal with
too many of those corner cases.
2020-11-10 17:16:28 +01:00
626a79204e MSVC: Fix build warning
If a define of NOMINMAX was made before BLI_task.hh was included,
the compiler would emit a

warning C4005: 'NOMINMAX': macro redefinition

warning, to work around this only define it if it is not already
defined, and only undefine it if we were the ones that made the
define earlier.
2020-11-10 08:48:18 -07:00
bd6bfba64d Cycles: Enable NanoVDB usage by default
As discussed during the Rendering Metting. Ref T81454.
2020-11-10 16:20:15 +01:00
Germano Cavalcante
23614c49e9 Fix T81951: Add Cube new tool surface snaping not working
For the `plane_depth` of type `PLACE_DEPTH_SURFACE` to take effect, a `snap_context` is needed.

But, even if a temporary `snap_context` was created for `plane_orient == PLACE_ORIENT_SURFACE`,
this context was not used for `plane_depth`.

So, use a temporary `snap_context` for `PLACE_DEPTH_SURFACE` (as it is done for `PLACE_ORIENT_SURFACE`).

Differential Revision: https://developer.blender.org/D9345
Differential Revision: https://developer.blender.org/D9435
2020-11-10 12:18:19 -03:00
2ecab4c8a6 LibOverride: Optimize deletion of overrides in liboverride delete. 2020-11-10 16:14:16 +01:00
de8d7003bc Cleanup/Update comments in liboverride code. 2020-11-10 16:14:16 +01:00
a284e559b9 Fix T82561: shader compilation crashes in OSL
The "type" sockets on shader nodes were renamed in rB31a620b9420cab to
avoid clashes with the `NodeType type` member from the Node base class,
but the OSL shader compilation was missing those changes.
2020-11-10 16:05:47 +01:00
feb71f1d71 Animation: Expand unit tests for BKE_fcurve_active_keyframe_index()
Expand unit test for `BKE_fcurve_active_keyframe_index()` to test edge
cases better.

This also introduces a new test macro `EXPECT_BLI_ASSERT()`, which can be
used to test that an assertion fails successfully.

No functional changes to actual Blender code.
2020-11-10 15:36:21 +01:00
75a2db5d97 Multires: Cleanup, clarify comment 2020-11-10 15:32:06 +01:00
11c19c24bd Cleanup/Update comments in liboverride code. 2020-11-10 15:30:36 +01:00
01c7a94cdd install_deps: fix a typo in argument handling of new nanovdb option.
Spotted by  Patrick Mours (@pmoursnv), thanks!
2020-11-10 14:11:13 +01:00
2a2bc09096 Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-10 14:02:28 +01:00
4960780d76 Animation: More explicit boundary checks when setting active keyframe
Fix unit test failing in debug mode by having more explicit boundary checks
when setting an FCurve's active keyframe.

No functional changes.
2020-11-10 13:44:47 +01:00
23c71a5fab ImBuf: support detecting the file format from in-memory images
Add `IMB_ispic_type_from_memory` so we can detect the file format
of in-memory images.

This removes `is_a_filepath` callback and uses a magic check for
photo-shop files that's compatible with OIIO.

Even though OIIO doesn't support packed images, we can still use the
file magic for detecting the format.

This change allows D9500 (a fix for unpacking images),
to be implemented without a significant performance penalty,
although the actual performance cost would depend heavily on the
blend file.

Reviewed By: dfelinto, sergey

Ref D9517
2020-11-10 22:25:05 +11:00
d2ab9b568e Merge branch 'blender-v2.91-release' 2020-11-10 19:09:04 +11:00
05a2382c08 Fix T82540: Smart UV project ignores seams
Functionality was lost in the Python to C conversion from
850234c1b1
2020-11-10 19:05:07 +11:00
291473bb3e Merge branch 'blender-v2.91-release' 2020-11-10 17:50:15 +11:00
476a0d2311 Fix T82555: Crash using copied object from Python
Also clear `gpd_eval` as this wasn't being copied either.
2020-11-10 17:44:56 +11:00
3bb6902235 Merge branch 'blender-v2.91-release' 2020-11-10 16:30:10 +11:00
b902edae75 Fix T65585: Knife fails when cursor away from the object
Zeroed mouse coordinates were being used making projection fail.
2020-11-10 16:25:58 +11:00
bff1707aae Cleanup: remove hard coded file format check in IMB_ispic_type
This is already being checked in the 'is_a' callback.
2020-11-10 11:58:56 +11:00
b5d310b569 Cleanup: clang-format 2020-11-10 09:42:03 +11:00
efd71aad4f Cleanup: clang-tidy suppress warnings for PyTypeObject.tp_print
Clang-tidy behavior changes from Python 3.7 to 3.8+ so it's simplest
to suppress the warning in this instance.
2020-11-10 09:40:20 +11:00
3a764c3e6d Cleanup: suppress clang-tidy warnings without FFMPEG/AVI/AUDASPACE 2020-11-10 09:40:20 +11:00
6faba2db08 Merge branch 'blender-v2.91-release' 2020-11-09 21:18:28 +01:00
f923b6faa9 Fix assert in the sculpt pen tilt code
Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9422
2020-11-09 21:17:17 +01:00
850f9452a4 Fix wrong DNA flag for hide face sets
It was using the same flag as SCULPT_DYNTOPO_DETAIL_MANUAL

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9484
2020-11-09 21:15:33 +01:00
716b7a60df install_deps: add support for NanoVDB.
re T81454.
2020-11-09 19:08:01 +01:00
cdb1da6bf6 Install_deps: update URLS for OpenVDB repo/sources. 2020-11-09 19:08:01 +01:00
cf751e3914 Merge branch 'blender-v2.91-release' 2020-11-09 18:50:56 +01:00
60c4d0b5fb Fix T78028: crash with grease pencil and save buffers
Perform grease pencil rendering delayed in this case, as there are no render
buffers available for compositing. This keeps memory usage lower, but does
involve multiple depsgraph evaluation. This seems in line with the intent of
the save buffers feature, to use minimal memory.
2020-11-09 18:49:28 +01:00
cc5294bd91 Fix potential crash closing Blender with persistent data option enabled
Found by address sanitizer.
2020-11-09 18:49:28 +01:00
cde2bd1828 Merge branch 'blender-v2.91-release' 2020-11-09 17:37:21 +01:00
ec6a9322e8 Fix T78956: banding artifacts of vertex colors in Cycles
Byte colors must be encoded in sRGB and converted to linear on lookup,
to avoid precision loss.
2020-11-09 17:30:34 +01:00
bd2dda90b6 Cleanup: Clang-tidy, inconsistent parameter name
readability-inconsistent-declaration-parameter-name
2020-11-09 21:31:13 +05:30
94b44a5228 Cleanup: Clang-tidy, modernize-use-nullptr. 2020-11-09 21:31:13 +05:30
880b0f981d Cleanup: more renaming in the render/ module for consistency 2020-11-09 16:19:49 +01:00
4f66cf3b8b Pointclouds: move blenkernel code to c++ 2020-11-09 15:47:16 +01:00
dfe50ef2d8 Fluid: Fix strict compiler warning
Proper way to check for DEBUG_PRINT is to do `if defined` check rather
than `if`: this is because in non-debug builds the symbol is not defined.
2020-11-09 15:43:22 +01:00
6507449e54 Cleanup: fix wrong merge, remove extra unique_ptr.
Mistakes added in 3cb4c51308 and
bec1765340

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9514
2020-11-09 19:32:16 +05:30
4d544d6ae7 Fix T80068: skin modifier not working with motion blur
The skin modifier did not output consistent results, causing failure to find
corresponding vertices across frames.

Remove unnecessary use of GSet, all we need is an array.
2020-11-09 14:54:50 +01:00
021c40167d Cycles: fix Node::tag_modified not setting modified flag's upper bits
Previous code was flipping the bits on a 32-bit number and doing a zero extension to cast to 64-bit, so mark the constant as long to begin with.

This would also erase previously set bits in this part the flag.
2020-11-09 14:52:48 +01:00
ed75a50119 Cycles: Fix function inline attributes
forceinline attribute is only applicable for function which are
marked inline. Interestingly, it can be used for class methods
without explicit inline statement. But for functions it is another
story.
2020-11-09 14:41:00 +01:00
1f4062cf6e Fluid: Fix strict compiler warning
Proper way to check for DEBUG_PRINT is to do `if defined` check rather
than `if`: this is because in non-debug builds the symbol is not defined.
2020-11-09 14:35:20 +01:00
fdd9cb713e Merge branch 'master' into outliner-cpp-refactor 2020-11-09 13:56:13 +01:00
8c4f121492 Cleanup: Split header for Outliner tree building into C and C++ headers
It's odd to include a C++ header (".hh") in C code, we should avoid that. All
of the Outliner code should be moved to C++, I don't expect this C header to
stay for long.
2020-11-09 13:54:30 +01:00
Yevgeny Makarov
055ed335a1 macOS: follow system preference for natural trackpad scroll direction
And remove Blender preference, which was expected to be set to match the system
preference for correct behavior. Instead just handle this automatically.

Differential Revision: https://developer.blender.org/D9402
2020-11-09 13:51:08 +01:00
c796364f05 Cleanup: Rename Outliner "tree-view" types to "tree-display" & update comments
"View" leads to weird names like `TreeViewViewLayer` and after all they are
specific to what we call a "display mode", so "display" is more appropriate.

Also add, update and correct comments.
2020-11-09 13:37:28 +01:00
0c4d12986a Merge branch 'blender-v2.91-release' 2020-11-09 12:54:26 +01:00
0e6820cc5d Fix T82488: Mantaflow - force fields have very low influence compare to 2.90.1
Removed 0.2f factor when setting forces. Why this factor has been used when forces should only be clamped, nobody knows ..
2020-11-09 12:53:27 +01:00
5da05dd627 Fix T82210: Animation, Bake Action cleanup
Make post-bake cleanup of the Bake Action operator optional, and disable
by default.

Previously Bake Action would do two things:
- Bake the Action
- Clean up the FCurves

It is now possible (and even the default) to only perform the baking
operation.

Reviewed By: #animation_rigging, looch, sybren

Maniphest Tasks: T82210

Differential Revision: https://developer.blender.org/D9453
2020-11-09 12:41:51 +01:00
118e31a0a9 Cycles: Fix tricubic sampling with NanoVDB
Volumes using tricubic sampling were producing different results with NanoVDB compared
to dense textures. This fixes that by using the same tricubic sampling algorithm in both
cases. It also fixes some remaining offset issues and some minor things that broke OpenCL
kernel compilation on NVIDIA.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9491
2020-11-09 12:37:47 +01:00
4a572f06e9 Cleanup: Follow C++ code style for new Outliner building code
* Use C++17 nested namespaces.
* Use `_` suffix rather than prefix for private member variables.

Also: Simplify code visually in `tree_view.cc` with `using namespace`.
2020-11-09 12:21:51 +01:00
92083772e7 Libmv: Fix warning about unused parameter in Ceres
Ceres is an external library, so consider it a system header which
makes it so all strict flags are properly ignored for them.
2020-11-09 12:12:00 +01:00
f26e267770 CMake: Extend supported strict flags cancelation for Clang 2020-11-09 12:12:00 +01:00
525a042c5c Cleanup: fix some clang tidy issues 2020-11-09 12:05:07 +01:00
5837ffc143 Merge branch 'blender-v2.91-release' into master 2020-11-09 11:49:44 +01:00
29693c7b07 Sculpt: Fix off-by-one error when creating bitmap for lasso gesture
Reviewers: pablodp606

Differential Revision: https://developer.blender.org/D9472
2020-11-09 11:48:55 +01:00
ad85256e71 Animation: move group colors switch to user preferences
Move the "Show Group Colors" toggle from a per-editor option to a single
user preference in the Animation preferences. The Grease Pencil
animation channel side panel allows picking a channel color; this now
shows a message when channel colors are disabled.

The old "Show Group Colors" toggle had to be set per editor, and was on
by default. This meant that disabling group colors would require an
action for every file, for every editor. It is very hard to select a
color that works both as bone color in the 3D Viewport (needs to be
bright there) as well as the channel list (needs to be dark there), most
animators turn channel list colors off.

Differential Revision: https://developer.blender.org/D9391
2020-11-09 11:11:05 +01:00
25375c769a Cleanup: Sequencer, remove unused function
Remove `static int clear_scene_in_allseqs_fn(...)`. It was a utility
function for `BKE_sequencer_clear_scene_in_allseqs()`, which was removed
in c063813c30.

No functional changes.
2020-11-09 11:11:05 +01:00
c356a3654d Merge branch 'blender-v2.91-release' 2020-11-09 20:37:03 +11:00
3c04a06178 Merge branch 'blender-v2.91-release' 2020-11-09 20:36:34 +11:00
ba179e3dd5 Merge branch 'blender-v2.91-release' 2020-11-09 20:36:31 +11:00
71ff935fd6 Revert "Fix T80742: curve bevel fails with zero length handles at end-point"
This reverts commit 4987b7d347.

This introduced a slight change in curve direction at end-points
(while correct), it caused tests to fail.

Keep this change for 2.92, revert for 2.91.
2020-11-09 20:33:27 +11:00
067e200564 Fix T82495: assert with cast modifier in edit-mode 2020-11-09 19:01:48 +11:00
af4c389f99 Cleanup: imbuf callback naming
Use `is_a` & `is_a_filepath` in callback names.
2020-11-09 17:03:28 +11:00
e118426e46 Fix T82520: error building freestyle with Python3.8
Caused by 16732def37,
This is a 'Py_ssize_t' in Python 3.8,
replace with zero as this works in both 3.7 and 3.8.
2020-11-09 16:08:29 +11:00
8c846cccd6 Cleanup: clang-format 2020-11-09 15:47:08 +11:00
fa91f90287 Cleanup: General cleanup of Outliner Blender File display mode building
* Turn functions into member functions (makes API for a type more obvious &
  local, allows implicitly sharing data through member variables, enables order
  independend definition of functions, allows more natural language for
  function names because of the obvious context).
* Prefer references over pointers for passing by reference (makes clear that
  NULL is not a valid value and that the current scope is not the owner).
* Reduce indentation levels, use `continue` in loops to ensure preconditions
  are met.
* Add asserts for sanity checks.
2020-11-09 00:37:41 +01:00
39012146e1 Fix T81651, exact boolean modifier incorrect if operand hidden.
The code was trying to ignore hidden geometry when doing boolean,
which is correct when used as a tool, but not when a modifier.
Added a "keep_hidden" argument to bmesh_boolean to distinguish the
two cases.
Also fixed a bug when the tool is used with hidden geometry that
is attached to unhidden geometry that is deleted by the operation.
2020-11-08 10:12:53 -05:00
06dac0a453 Fix T81651, exact boolean modifier incorrect if operand hidden.
The code was trying to ignore hidden geometry when doing boolean,
which is correct when used as a tool, but not when a modifier.
Added a "keep_hidden" argument to bmesh_boolean to distinguish the
two cases.
Also fixed a bug when the tool is used with hidden geometry that
is attached to unhidden geometry that is deleted by the operation.
2020-11-08 08:39:01 -05:00
2d60f64960 UI Code Quality: Convert Outliner Blender File mode to new tree buiding design
See https://developer.blender.org/D9499.

Also:
* Add `space_outliner/tree/common.cc` for functions shared between display
  modes.
* Had to add a cast to `ListBaseWrapper` to make it work with ID lists.
* Cleanup: Remove internal `Tree` alias for `ListBase`. That was more confusing
  than helpful.
2020-11-07 22:46:51 +01:00
7be47dadea Cleanup: Clang-tidy, readability-else-after-return 2020-11-07 21:52:53 +05:30
4429b4b77e Cleanup: Clang-tidy, readability-non-const-parameter. 2020-11-07 21:52:53 +05:30
9cd9ea591f Cleanup: NULL to nullptr. 2020-11-07 21:52:53 +05:30
bec1765340 Merge new boolean fix from blender-v2.91-release. 2020-11-07 09:33:56 -05:00
46da8e9eb9 Fix T82301, exact boolean fail on cube with bump.
The code for determining coplanar clusters had a bug where it would
miss some triangles. The fix for now is to just put triangles in
the cluster if their bounding boxes overlap. This works but maybe
makes clusters bigger then they have to be. I'll follow this commit
with work on making the CDT routine faster when using exact arithmetic.
Also removed a lot of unused code, and added some new intersect
performance tests.
2020-11-07 09:02:58 -05:00
fc6338d863 Cleanup: Put Outliner C++ namespace into blender::ed namespace, add comments
Also remove unnecessary forward declaration.
2020-11-07 14:23:06 +01:00
40d4a4cb1a Cleanup: Clang-format. 2020-11-07 18:48:13 +05:30
6e6b5e147c Noise: fix uninitialized variable warning.
Mistake in 74188e6502
2020-11-07 18:48:13 +05:30
ae342ed451 Cleanup: Clang-tidy else-after-return 2020-11-07 18:48:13 +05:30
4525049aa0 Cleanup: Clang-tidy, modernize-concat-nested-namespaces 2020-11-07 18:48:13 +05:30
a452fcb9a5 View3D: take clipping into account for Frame All
Clamp the min/max used for Frame All/Selected
by the clipping region if it's set.

Resolve T81050
2020-11-07 21:20:57 +11:00
19a0df25e3 Cleanup: move plane array intersection into a function
Also add check to ensure a point isn't occluded by it's own plane,
which could happen if a small epsilon values are passed in.
2020-11-07 21:01:42 +11:00
Yevgeny Makarov
d7b0ec9cb5 Fix for T78211: Trackpad Zoom to Mouse Position Error
When using a trackpad Zoom to Mouse Position would always zoom to center of canvas.

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

Reviewed by Brecht Van Lommel
2020-11-06 17:56:45 -08:00
Yevgeny Makarov
c87b7fdd8a Fix for T65714: Pinch Zooming Crash using Mac Trackpad
Ensure that Zoom does not crash on Mac Trackpad by checking for existence of Continuous Zoom timer.

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

Reviewed by Julian Eisel
2020-11-06 17:43:11 -08:00
d962ca7387 Fix possible null-pointer dereference in new Outliner tree building code 2020-11-07 01:24:18 +01:00
e1a361d287 Cleanup: Remove redundant parameter from new Outliner tree building code 2020-11-07 01:21:47 +01:00
8b787089b3 Merge branch 'master' into outliner-cpp-refactor 2020-11-07 01:09:59 +01:00
126b6f8cc7 Cleanup: Comments & style improvements for new Outliner C++ code
* Add comments to explain the design ideas better.
* Follow code style guide for class layout.
* Avoid uninitialized value after construction (general good practice).
2020-11-07 01:04:17 +01:00
86fe1ec968 UI Code Quality: Use C++ data-structures for Outliner object hierarchy building
* Use `blender::Map` over `GHash`
* Use `blender::Vector` over allocated `ListBase *`

Benefits:
* Significantly reduces the amount of heap allocations in large trees (e.g.
  from O(n) to O(log(n)), where n is number of objects).
* Higher type safety (no `void *`, virtually no casts).
* More optimized (e.g. small buffer optimization).
* More practicable, const-correct APIs with well-defined exception behavior.

Code generally becomes more readable (less lines of code, less boilerplate,
more logic-focused APIs because of greater language flexibility).
2020-11-07 00:15:09 +01:00
6f87489536 UI Code Quality: General refactor of Outliner View Layer display mode creation
* Turn functions into member functions (makes API for a type more obvious &
  local, allows implicitly sharing data through member variables, enables order
  independend definition of functions, allows more natural language for
  function names because of the obvious context).
* Move important variables to classes rather than passing around all the time
  (shorter, more task-focused code, localizes important data names).
* Add helper class for adding object children sub-trees (smaller, more focused
  units are easier to reason about, have higher coherence, better testability,
  can manage own resources easily with RAII).
* Use C++ iterators over C-macros (arguably more readable, less macros is
  generally preferred)
* Add doxygen groups (visually emphasizes the coherence of code sections,
  provide place for higher level comments on sections).
* Prefer references over pointers for passing by reference (makes clear that
  NULL is not a valid value and that the current scope is not the owner).
2020-11-06 22:55:36 +01:00
cf94571762 UI Code Quality: Start refactoring Outliner tree creation (using C++)
The Outliner tree creation was very messy and hard to follow. Hardcoded display
type checks are scattered over many places.
This introduces a new abstraction "tree-view" to help constructing and managing
the tree for the different display types (View Layer, Scene, Blender file,
etc.).

Idea is to have an abstract base class to define an interface
(`AbstractTreeView`), and then subclasses with the implementation of each
display type (e.g. `TreeViewViewLayer`, `TreeViewBlenderFile`, etc). The
tree-viewer is kept alive until tree-rebuild as runtime data of the space, so
that further queries based on the display type can be executed (e.g. "does the
view support selection syncing?", "does it support restriction toggle
columns?", etc.).

I may still change the names a bit, not sure yet if "tree-view" is the right
term for this helper.
2020-11-06 20:54:20 +01:00
d2c102060d Cleanup: Rename render texture files to texture_* 2020-11-06 14:20:44 -05:00
b3e71ee098 Cleanup: Remove unused variable 2020-11-06 12:50:03 -06:00
c2b7e83fae Cleanup: remove unused includes in readfile.c and writefile.c 2020-11-06 19:11:53 +01:00
2d26057751 Fix missing include warning
Caused by rB580ff2cb937daf43699908afe1190baea8d117aa
2020-11-06 12:48:13 -05:00
b0dcabdf65 Cleanup: fix naming and remove unnecessary code 2020-11-06 18:41:03 +01:00
992b8f6f5f Refactor: move Screen .blend data read to blenkernel
Ref T76372.
2020-11-06 18:37:52 +01:00
1762d5f43a Refactor: move Ipo .blend I/O to IDTypeInfo callbacks 2020-11-06 18:33:33 +01:00
638913a3c0 Refactor: move Object .blend I/O to IDTypeInfo callbacks 2020-11-06 18:25:51 +01:00
16732def37 Cleanup: Clang-Tidy modernize-use-nullptr
Replace `NULL` with `nullptr` in C++ code.

No functional changes.
2020-11-06 18:08:25 +01:00
88926375a0 Clang-Tidy: error out when executable not found
Stop with an error when the Clang-Tidy executable cannot be found.

Without this check, CMake will happily report "Found Clang-Tidy" but with
the fallback version (0, 0, 0), when `CLANG_TIDY_EXECUTABLE` points to a
non-existing executable.
2020-11-06 18:08:25 +01:00
2acf01ec62 Refactor: move Pose .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:58:25 +01:00
Yevgeny Makarov
60ad4a761a UI: Improved macOS Application Icon Progress Bar
Nicer appearance for the progress bar that is drawn over the application icon during long processes on macOS.

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

Reviewed by Brecht Van Lommel
2020-11-06 08:55:05 -08:00
58e9b51f95 Refactor: move Constraint .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:45:29 +01:00
37ef37711d Refactor: move MotionPath .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:33:13 +01:00
a3a6443bfd Merge branch 'blender-v2.91-release' into master 2020-11-06 17:29:18 +01:00
42980abf8d Fix T81997: Subsurf Optimal Display sticks after object conversion
When using Optimal Display, some edges are not flagged `ME_EDGEDRAW` |
`ME_EDGERENDER`.
When the modifier is applied through the UI in the modifier stack this is
not an issue because the `modifyMesh` callback is run with
`MOD_APPLY_TO_BASE_MESH` (this will effectively turn of Optimal
Display).
When converting to mesh though, this will just get an evaluated mesh
(where the edge flags are still the same as with the subdivision
modifier).
Now ensure every edge is flagged to draw after conversion.

Maniphest Tasks: T81997

Differential Revision: https://developer.blender.org/D9331
2020-11-06 17:25:52 +01:00
57414e6d1d Refactor: move gpencil modifier .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:22:20 +01:00
019407810b Refactor: move modifier .blend I/O to blenkernel
Ref T76372.
2020-11-06 17:13:16 +01:00
f6ad56b1bc Merge branch 'blender-v2.91-release' into master 2020-11-06 16:58:06 +01:00
1019df81ff Fix T82251: Outliner Material Drag&Drop missing tree update
Caused by rBb077de086e14.

Not entirely sure why this was rebuilding the tree prior to above
commit, but sending an ND_OB_SHADING notifier is appropriate (and also
what the Outliners listener listens to).

Maniphest Tasks: T82251

Differential Revision: https://developer.blender.org/D9396
2020-11-06 16:55:04 +01:00
3cb4c51308 Cleanup: Clang-Tidy, modernize-make-unique 2020-11-06 16:47:16 +01:00
ce70f2e1e0 Cleanup: Sort includes after recent render module cleanup 2020-11-06 10:45:18 -05:00
998ae29549 Fix T82220 Missing viewport update after manual "HDRI Preview Size" input
This is caused by the TAA being reset after the init phase, leading to
1 sample being kept as valid when it is clearly not.

To fix this, we run the lookdev validation before TAA init.

Reviewed By: Jeroen Bakker

Differential Revision: https://developer.blender.org/D9452
2020-11-06 16:44:15 +01:00
c063813c30 Cleanup: remove unused functions 2020-11-06 16:43:48 +01:00
af24532612 Refactor: move ShaderFx .blend I/O to blenkernel
Ref T76372.
2020-11-06 16:42:50 +01:00
580ff2cb93 Cleanup: Render Module: combine intern/ source & include 2020-11-06 10:37:40 -05:00
90ac9770a4 Cleanup: whitespace 2020-11-06 16:16:14 +01:00
e15076b22f Cleanup: Render Module: move header files to main directory
Move headers files from `render/extern/` to `render/`

Part of T73586
2020-11-06 10:10:41 -05:00
Paul Melis
235c309e5f Add background rectangle option to video sequencer Text strip
This adds a Box option to the Text strip's style properties, plus related Box Margin value:

{F9208309}

When enabled the text is placed on top of a solid-filled rectangle of a chosen color, as shown below:

{F9208324}

When the box option is disabled the text strip works the same as it does now. When the box option is enabled the meaning of the Shadow option changes to provide a drop-shadow on the rectangle (and not on the text itself). The latter made more sense to me.

The box margin is specified as a fraction of the image width. The offset of the drop-down box shadow is fixed to a specific fraction of the image width as well.

I tested this feature on a movie of a couple of minutes containing dozens of text strips (all with box background), edge cases like multi-line strings and text overlapping the image edges.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D9468
2020-11-06 16:05:50 +01:00
f6524aaa80 Refactor: move ParticleSystem .blend I/O to blenkernel
Ref T76372.
2020-11-06 15:58:39 +01:00
ba4da217ce Sequencer: Make naming consistent in header and implementation files 2020-11-06 15:46:56 +01:00
c74086376f VSE: Don't store proxy images in cache
Proxies are expected to be fast to read. Storing them in cache has
little to no effect on performance.

This change also allows to omit invalidation of cache when user switch
between proxies and original media.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9473
2020-11-06 15:38:44 +01:00
958ceaf5bf Refactor: move Scene .blend expand to IDTypeInfo callback 2020-11-06 15:37:56 +01:00
2f3181d0f2 Refactor: move Scene .blend lib reading to IDTypeInfo callback 2020-11-06 15:21:57 +01:00
1e7d29b012 Cleanup: rename time related variables
Variables renaned:
 - cfra -> timeline_frame
 - nr -> frame index
 - cfra_over -> overlap_frame

Function seq_give_stripelem_index was renamed to seq_give_frame_index.
2020-11-06 15:13:53 +01:00
e91d2ee777 Blenloader: access report list via api 2020-11-06 15:13:31 +01:00
0c26a44c76 Blenloader: expose BLO_reportf_wrap in api
This function is used by a couple of functions that are moved out of blenloader.
2020-11-06 15:07:10 +01:00
6ab0bd4798 Refactor: move Scene .blend data reading to IDTypeInfo callback 2020-11-06 14:57:36 +01:00
140d6cc4a2 Refactor: move Scene .blend writing to IDTypeInfo callback 2020-11-06 14:49:30 +01:00
a83fcf2b35 CMake: Fix wrong library used for dependency
Was causing compilation failure on fresh builds.
2020-11-06 14:47:46 +01:00
7dd76329e1 Refactor: move PointCache .blend I/O to blenkernel
Ref T76372.
2020-11-06 14:40:54 +01:00
6bca9d8c11 Cleanup: Fluid engine API return types
Use bool return type where possible instead of int (the return values from fluid object are already boolean instead of int).

Also removed several if guards in API functions. If one of the arguments is in fact invalid / nullptr (should not happen though), it better to catch them directly where they failed and not silently escape them.
2020-11-06 14:35:40 +01:00
af35ada2f3 Cleanup: Clang-Tidy, modernize-use-bool-literals 2020-11-06 14:32:51 +01:00
dfa027fe09 Refactor: move sequencer modifier .blend I/O to sequencer module
Ref T76372.
2020-11-06 14:28:33 +01:00
94ce248b30 Cleanup: Alembic, simplify expression
Change `1 + current_mat++` to `++current_mat`.

No functional changes.
2020-11-06 14:24:50 +01:00
047819e728 Cleanup: Alembic, simplify material assignment code
Refactor material assignment code such that:
- `build_mat_map()` just returns the built map (instead of relying on
  modifying a map passed as parameter),
- `LISTBASE_FOREACH` is used to loop over a `ListBase` (instead of a
  hand-crafted for-loop),
- just `return` when not enough material slots can be created (instead
  of setting a boolean to false, then doing some useless work, then
  checking the boolean),
- reorder some code for clarity, and
- rename `mat_map` to `matname_to_material` so that the semantics are
  clearer.

No functional changes.
2020-11-06 14:24:50 +01:00
c32a5ce17c Refactor: move Paint lib linking to blenkernel
Ref T76372.
2020-11-06 14:10:31 +01:00
62223e9851 Refactor: move color settings .blend I/O to blenkernel
Ref T76372.
2020-11-06 14:10:31 +01:00
8d5073345d Cleanup: Clang-Tidy, modernize-use-emplace 2020-11-06 14:06:52 +01:00
cee5a41518 Fix compilation error of bf_draw
Similar to previous commit, missing build dependency.
2020-11-06 13:53:47 +01:00
187adc64b4 Fix compilation error when building from scratch
Make sure the DNA offset files is ready at a time bf_windowmanager
need it.
2020-11-06 13:49:56 +01:00
a331d5c992 Cleanup: Clang-Tidy, modernize-redundant-void-arg 2020-11-06 13:40:46 +01:00
41db8f2fce Refactor: move LightCache .blend I/O to eevee_lightcache.c
Ref T76372.
2020-11-06 13:35:19 +01:00
da96389dcb Refactor: move remaining ViewLayer .blend I/O to blenkernel
Ref T76372.
2020-11-06 13:22:10 +01:00
3ee9e3a04f Cleanup: remove unnecessary function 2020-11-06 13:17:31 +01:00
9ad2965921 Refactor: move Paint .blend I/O to blenkernel
Ref T76372.
2020-11-06 13:16:17 +01:00
e810a16d75 Refactor: move wmWindowManager .blend I/O to IDTypeInfo callbacks 2020-11-06 13:04:56 +01:00
2de454c514 Merge branch 'blender-v2.91-release' into master 2020-11-06 12:57:27 +01:00
8df84f7be4 Fix T82364: Widget anim state not updated when deleting channel in Graph Editor
So a keyframed e.g. location slider would stay yellow/green even if its
corresponding channel was removed.

Needs a appropriate notifier so the listeners (e.g.
buttons_area_listener, view3d_buttons_region_listener) would cause a
redraw.

Maniphest Tasks: T82364

Differential Revision: https://developer.blender.org/D9438
2020-11-06 12:52:52 +01:00
3310e6d63e Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-06 12:29:45 +01:00
b35e3f2460 Fix T82457: Python error when clicking on a tool in the viewport
Ths variable was initialized for false, while it was expected to be
true.
2020-11-06 12:29:19 +01:00
3b77c670f0 Clang Tidy: Expand modernize category
Gives an idea of which warnings are affecting Blender code base.
2020-11-06 12:16:02 +01:00
311031ecd0 Cleanup: Use nullptr everywhere in fluid code
Switched from NULL to nullptr.
2020-11-06 12:06:05 +01:00
37b155420b Merge branch 'blender-v2.91-release' into master 2020-11-06 12:00:50 +01:00
390a0d5624 Fix T82387: Crash loading file saved with recent master in old versions
This fix makes sure new files save `wmWindow.global_areas` under a different
name, so old Blender versions don't recognize and 0-initialize it.

Since enabling global area writing (ef4aa42ea4), loading a file in old
Blender versions would cause `wmWindow.global_areas` to be read, because there
was already reading code for it and `ScrAreaMap` was in SDNA.
However the `ScrArea.global` of the global areas would be NULL, because it was
*not* in SDNA (`ScrGlobalAreaData` was excluded).
Now, issue is that the code assumes that areas in the global area-map have a
valid ScrArea.global pointer.

Think this was a mistake in rB5f6c45498c92. We should have cleared all this data
on reading, until the global area writing was enabled.

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

Reviewed by: Brecht Van Lommel
2020-11-06 11:58:06 +01:00
e6739ed91d Fix T82407: Negative number input gives syntax error for velocities and
accelerations

Caused by rB45dbc38a8b15.

Above commit would place parentheses surrounding a block until the next
operator was found.
For velocities and accelerations though, the '/' in 'm/s' or 'ft/s'
should not be considered an operator.

Maniphest Tasks: T82407

Differential Revision: https://developer.blender.org/D9467
2020-11-06 11:56:57 +01:00
190170d4cc Cleanup: Clang-Tidy, readability-redundant-member-init 2020-11-06 11:54:53 +01:00
dae004557a Merge branch 'blender-v2.91-release' into master 2020-11-06 10:45:39 +01:00
28e703b0a1 Fix Outliner editbone selection with 'Sync Selection'
When editbones were selected from the Outliner (and they were connected
to a parent) with the 'Sync Selection' option turned ON, they could not
get duplicated.

For duplication to work, the (connected) parent bone's tip also has to
be selected [which was not the case when selection is done from the
Outliner under above circumstances]. The reason being that
armature_duplicate_selected_exec ->
ED_armature_edit_sync_selection clears the BONE_ROOTSEL flag if the
parent bone's BONE_TIPSEL is not set.

Caused by rB71eb65328078 btw.

The correct "parent-tip-selection" would actually happen in activation
- `tree_element_active_ebone`
-- `tree_element_active_ebone__sel`
but for 'Sync Selection' this happens [also] in
- `outliner_sync_selection_from_outliner`
-- `outliner_select_sync_to_edit_bone`
which did not do the "flushing" to the parent bone's tip

Now use existing dedicated function for this.

ref. T82347

Reviewers: Zachman

Differential Revision: https://developer.blender.org/D9470
2020-11-06 10:42:14 +01:00
0573f86587 Cleanup: Clang-Tidy warnings 2020-11-06 09:54:02 +01:00
9c34391e0c Fix compilation error in GHOST
ELEM macro isn't available in GHOST library.
2020-11-06 08:23:13 +01:00
84bbdfb8af Cleanup: Fix the order of info_cfg_option. 2020-11-06 12:46:58 +05:30
ec9241cd59 Cleanup: add missing doxygen group 2020-11-06 01:46:50 -05:00
df4935b29b Cleanup: Fix wrong doxygen groups
Was missed in rB9b6088cb9da4df1a893361997fc1a22986bf6f2e
2020-11-06 01:46:50 -05:00
9762a0992b CMake: configue_file() to pass strings for build-info
Using configue_file(..) would have avoided the breakage from
1daa3c3f0a, caused by buildinfo not properly escaping quotes.

Rely on CMake to escaping strings instead using configure_file().
2020-11-06 17:26:29 +11:00
9a7da1242d Fix uninitialized value
Own mistake in rB74188e65028d268af887ab2140e4253087410c1e
2020-11-06 01:10:51 -05:00
d9e7a42640 Cleanup: use 'BKE_' prefix for initialization functions 2020-11-06 16:43:09 +11:00
3c097af51f Cleanup: use doxy sections for node_group.c 2020-11-06 16:25:09 +11:00
2f58535b78 Cleanup: use if/else check for property poll 2020-11-06 16:02:42 +11:00
f38ad4c66b Cleanup: replace STREQLEN with STRPREFIX for constant strings 2020-11-06 15:56:03 +11:00
2d803d3f6d Cleanup: use STR_ELEM macro 2020-11-06 15:42:03 +11:00
4f140ec7cc Cleanup: Use LISTBASE_FOREACH macro 2020-11-05 22:39:30 -06:00
06c030eaa4 Cleanup: Use descriptive variable names 2020-11-05 22:33:01 -06:00
a51455918c Cleanup: de-duplicate code for instancing objects when linking
Ref D8843
2020-11-06 15:00:07 +11:00
605425c006 Cleanup: doxygen comments 2020-11-06 14:35:38 +11:00
eed6bf22a4 Cleanup: doxygen comments in ghost
Use colon after parameters, use hash to reference symbols.
2020-11-06 14:25:44 +11:00
f11f7ce08e Cleanup: use ELEM macro (>2 args) 2020-11-06 12:54:19 +11:00
d89fedf266 Cleanup: clang-format
Missed this last commit.
2020-11-06 12:46:17 +11:00
aa3a4973a3 Cleanup: use ELEM macro 2020-11-06 12:32:54 +11:00
7cb20d841d Cleanup: follow our code style for float literals 2020-11-06 12:32:54 +11:00
4a78a2774b Cleanup: use bool argument in BLI_noise 2020-11-06 12:32:54 +11:00
29401f8ca2 Cleanup: BLI_noise
Use common prefix as this collided with existing API's (eg BLI_voronoi).

Also expand some non-obvious abbreviations:

- 'g'  -> 'generic'
- 'vl' -> 'variable_lacunarity'
- 'V'  -> 'v3'
2020-11-06 12:32:54 +11:00
155f42a12f Cleanup: remove unused BLI_turbulence1
A slightly modified version of BLI_turbulence1, unused for years.
2020-11-06 12:32:54 +11:00
548b351647 Cleanup: use snake case for BLI_args API 2020-11-06 12:32:54 +11:00
c8f2ad0ab9 Cleanup: remove unused BLI_argsArgv 2020-11-06 12:32:54 +11:00
2bd8f7e059 Cleanup: use string APPEND/PREPEND
Replace 'set' with 'string(APPEND/PREPEND ...)'.
This avoids duplicating the variable name.
2020-11-06 12:32:54 +11:00
7160682b0d Cleanup: transform.h comments, use doxy sections 2020-11-06 12:32:54 +11:00
262eeb3e95 Cleanup: sort structs, files 2020-11-06 12:32:54 +11:00
c19e4b706e Cleanup: clang-format 2020-11-06 12:32:54 +11:00
73ea68d0ca Cleanup: unused variable 2020-11-06 12:32:53 +11:00
Yevgeny Makarov
c99c02d3ba UI: Tweaks to the Warning Icon
Warning Sign Alert Icon given a more rounded border.

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

Reviewed by Pablo Vazquez
2020-11-05 16:11:59 -08:00
1682a47876 Merge branch 'blender-v2.91-release' 2020-11-05 23:42:11 +01:00
02677ec4e0 Fix T81915: Draw Face Sets not working with deformed sculpt mesh
The draw face sets brush uses the poly center when used in meshes to increase
its precision when working in low poly geometry. For this to work with deformed
meshes, the deformed coordinates from the PBVH should be used instead.

Reviewed By: sergey

Maniphest Tasks: T81915

Differential Revision: https://developer.blender.org/D9424
2020-11-05 23:40:30 +01:00
e041d0fc02 Fix memory leaks in sculpt mode trimming tools
BKE_mesh_free() seems to not free the meshes correctly, so using BKE_id_free() instead.
The looptri array was also not freed.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9426
2020-11-05 23:31:58 +01:00
057f9caac6 Fix T82400: Dyntopo detail size edit operator visual glitch
Just a missing immUnbindProgram

Reviewed By: sergey

Maniphest Tasks: T82400

Differential Revision: https://developer.blender.org/D9459
2020-11-05 23:28:16 +01:00
e2b3681f09 Fix Dyntopo detail size preview orientation not matching the cursor
Used the sampled cursor normal when available instead of the raycast face normal.
This makes the preview match the previous orientation of the cursor.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9460
2020-11-05 23:26:18 +01:00
00374fbde2 Move "Camera Parent Lock" from preferences to Object Relations
"Camera Parent Lock" can be useful when rigging cameras, but it is not
intuitive, and has also generated a lot of confusion (bug reports).
This is because it breaks the fundamental parent <-> child relationship
conventions in Blender, and there is no indication that it's intended
without diving into the preferences.

This commit moves the setting to the object level, and exposes it in
the relations panel in the property editor. It is exposed for every
object type because any object type can be "View Locked" in the 3D view.
The property description is also updated to reflect this change and be
more specific without getting too long.

In the future this could become a more general feature of the transform
system, but for now it is limited to "Lock Camera to View".

Differential Revision: https://developer.blender.org/D9239
2020-11-05 16:08:00 -06:00
ad481bdd35 Fix T82423: Add modifier key back into keymap
Commit rBf5080c82dd915db6c7b9dd68a52aaaccf2600137
accidentally remove the Shift modifier key from
the `AUTOCONSTRAINPLANE` shortcut.

Differential Revision: https://developer.blender.org/D9480
2020-11-05 23:03:41 +01:00
1b9d9cb1ed Fix T82164: Knife tool draws huge vertices after using bgl.glPointSize
Since it is possible to have multiple draw callbacks, (some of which
use bgl and others gpu), check and force the reset of the drawing status
at the end of each callback.

Differential Revision: https://developer.blender.org/D9476
2020-11-05 18:34:47 -03:00
69e567cfe8 Merge branch 'blender-v2.91-release' 2020-11-05 21:35:27 +01:00
Robert Guetzkow
7fed420877 Fix T82423: Replace duplicate name in keymap
The two entries `TFM_MODAL_AUTOCONSTRAINT` and
`TFM_MODAL_AUTOCONSTRAINTPLANE` had the same name
displayed in the UI. The latter is now includes
"plane" in it's name.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D9474
2020-11-05 21:29:15 +01:00
74188e6502 Cleanup: Reduce variable scope
Differential Revision: https://developer.blender.org/D9475
2020-11-05 14:11:32 -05:00
b053312bdd Fix T80043: missing Cycles displacement update when relinking output sockets 2020-11-05 19:35:39 +01:00
60859d8912 Fluid: Potential fix for T74559: Adaptive Domain creates lines in smoke
This commit corrects the maximum resolution field in Fluid objects. The field should be set to the maximum possible resolution, i.e. it should not adjust with adaptive domains and stay constant all the time.

The reason for this is that this resolution value will be used to scale gravity. And this gravity should be constant for adaptive domains too.

It remains to be shown if this issue was the only reason for line-artifacts as seen in T74559.
2020-11-05 18:55:08 +01:00
6a2a6fa514 Fix T82428: Cycles crashes when building volume meshes
The Volume Node did not have all of the sockets from its Mesh base class
which are now required due to the recent socket API change.
2020-11-05 18:46:26 +01:00
d9dd408b42 Merge branch 'blender-v2.91-release' into master 2020-11-05 18:00:48 +01:00
c3e832144b GPU: Fix valgrind warnings about branching on uninitialized variables 2020-11-05 18:00:27 +01:00
aae60f0fec Fix T81752 EEVEE: Camera Motion Blur is not blending steps properly
This was due to improper calculation of velocity factor and an
error in the camera data swapping between two steps.
2020-11-05 18:00:27 +01:00
15eec7f8b9 Fix T80842 Grease Pencil: Subtract mode is not working as expected
The blend equation was not set correctly inside the GL Module
since the refactor.
2020-11-05 18:00:27 +01:00
8819a4dce8 Spelling: Predefined, Look Up, No One
Fixes 18 misspellings of 'predefined', 'Look Up', 'Lookup', and 'No One'.

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

Reviewed by Hans Goudey
2020-11-05 07:52:58 -08:00
d837923a56 VSE: cache performance optimization
Map frame for cached raw images to strip input media frame range. This
means that static images or extended frame range of movies will only
generate one cache entry.

timeline_frame is stored in cache key as a reference - on what frame
was this entry created, so we don't have to reverse lookup frame range.

Since each media frame corresponds to one cache frame with same frame
index key, there is no need to invalidate raw cache when changing time
remapping properties like use_reverse_frames or strobe

No changes are needed for disk cache, since invalidating raw entry
assumes all data will be invalidated.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9462
2020-11-05 15:55:17 +01:00
8720c66009 Fluid: Potential fix for T74559: Adaptive Domain creates lines in smoke
This commit corrects the maximum resolution field in Fluid objects. The field should be set to the maximum possible resolution, i.e. it should not adjust with adaptive domains and stay constant all the time.

The reason for this is that this resolution value will be used to scale gravity. And this gravity should be constant for adaptive domains too.

It remains to be shown if this issue was the only reason for line-artifacts as seen in T74559.
2020-11-05 15:06:01 +01:00
cba6b4f4a1 Cleanup: add commits to .git-blame-ignore-revs.
Quick python script to print commit messages, and finding
duplicates: P1736
2020-11-05 19:24:07 +05:30
2a6a26bbd7 Rename extern rendering and proxy functions
Replace BKE_sequencer wirh SEQ_render or SEQ_proxy prefixes.
In cases where function is very generic, only SEQ prefix is used.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9439
2020-11-05 14:05:25 +01:00
0f43fe7fa6 Cleanup: split sequencer.c file
Move functions closely related to rendering images and proxies into
render.c and proxy.c files. render.h and proxy.h are created for
functions used internally.

There should be no functional changes.
2020-11-05 13:33:27 +01:00
4988f5f39c Fix T82292: Set encoding for keymap export to UTF-8
Keymaps have previously been exported with an encoding dependent
on the current system locale. This caused issues when the
keymap contained non-ASCII characters, for instance in a string
property for an operator.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9449
2020-11-05 09:50:51 +01:00
7bc7b7da2d Merge branch 'blender-v2.91-release' 2020-11-05 18:27:47 +11:00
4987b7d347 Fix T80742: curve bevel fails with zero length handles at end-point
Initialize the direction on the first/last points of the curve.

The fix from 23a4149778 exposed this error.
2020-11-05 18:15:45 +11:00
e0db650483 Merge branch 'blender-v2.91-release' 2020-11-05 16:13:16 +11:00
60c3ef3d61 Fix T81136: Mesh.loop_triangles kept after applying modifiers 2020-11-05 16:10:30 +11:00
9ac0541563 Merge branch 'blender-v2.91-release' 2020-11-05 15:48:37 +11:00
a88b9a4e00 Merge branch 'blender-v2.91-release' 2020-11-05 15:48:24 +11:00
52a2d5cbd2 Transform: support individual origins for "To Sphere" 2020-11-05 15:45:48 +11:00
8d88d9fd33 Fix T65205: "To Sphere" radius too large with proportional editing
The radius is now calculated based on the vertices being transformed
by proportional editing, updated when the falloff changes.
2020-11-05 15:39:04 +11:00
63f7e69829 UI: Fix Support for Anonymous Menu Separators
Re-enables support for menus to have items without identifier or name that can be used to separate sections.

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

Reviewed by Hans Goudey
2020-11-04 17:19:46 -08:00
c23ee2a293 Cleanup: Use const for function arguments 2020-11-04 18:53:17 -06:00
86bdc959a3 Fix T82417: Panels draw below others while animating after drag
This adds a new runtime flag for panels that is set during the entire
drag and animation operation. The flag is set recursively so that
sub-panels know to draw on top too.

Note that this also replaces most of the fixes in 1960b8a361 and
8e08d80e52 (D7462) with a more "built-in" solution.
2020-11-04 18:02:27 -06:00
6c3849ea08 Cleanup: Simplify panel collapse handler logic 2020-11-04 16:35:54 -06:00
4572428e86 Cleanup: Remove unused Panel.snap from DNA and handler code
This was a remnant of floating panels from the horizontal layout in
pre 2.5 horizontal panels.
2020-11-04 16:25:38 -06:00
bf36080501 Cleanup: Remove unused drag scaling code for panels
This is done more universally now, and this implementation of this is
no longer used.
2020-11-04 16:05:23 -06:00
f888f3aa1f Cleanup: Make panel function static
These functions were not used elsewhere, and the handling for the panel
tabs should be kept local to this file where possible. Also remove
another unused function and removed an unecessary "_ex" function.
2020-11-04 15:54:56 -06:00
76416f336a Cleanup: Move function to proper file
This lower level drawing function didn't make sense in the panel code,
especially when it is used in multiple other places.
2020-11-04 15:38:11 -06:00
7ee518cf70 Fix T80313: Fix clipped text in splash screen on hiDPI monitors
The current layout gave too little space for the full "Search" string inside
the button.
Fix this by making sure radio-buttons have their text center aligned by default
in pop-ups too, like they do anywhere else.

This does affect a few other cases, e.g. the "RGB"/"HSV"/"Hex" radio-toggles
for color pickers. But this should be fine, I don't think they were ever
intentionally using left-aligned text (while similar buttons outside of pop-ups
didn't).
2020-11-04 22:32:26 +01:00
f9fbe4efd6 Cleanup: Improve property search related comments panel code
The comments related to property search changes should be generally
more correct and more helpful.
2020-11-04 15:30:56 -06:00
4d7ad82347 Cleanup: Use LISTBASE_FOREACH 2020-11-04 14:14:16 -06:00
f45d79f180 UI: Replace uses of "loc/rot" with full words
Use "Rotation" in place of "Rot" for the rotation header text.
Cleanup various RNA titles and tooltips.

Differential Revision: https://developer.blender.org/D9457
2020-11-04 12:36:59 -07:00
eca8cd8449 Cleanup: Remove incorrect comment
This function for replacing a button pointer in button groups is
needed by the block update from old code, so it cannot be removed
like its layout equivalent.
2020-11-04 13:30:59 -06:00
10914987a2 Merge branch 'blender-v2.91-release' 2020-11-04 13:27:13 -06:00
29780b8101 Remove incorrect assert in button group code
Even after the last commit to fix this assert, it still fails in the
case where a button was added before there was a button group
added to the block. Another fix for this would be to always create
a button group in UI_block_begin, but this assert has no particular
purpose, so it's simpler to just remove it.
2020-11-04 13:21:26 -06:00
568dc2665e Fix T73126 Eevee: light probe baking ignores indirect bounces from SSS 2020-11-04 19:36:48 +01:00
eb21222e64 Transform: Disable snap to plane-face intersection
This feature was added in D5608.
But in practice this confuses more than it helps.
This fixes T82386.
2020-11-04 15:23:08 -03:00
331614e09b Fix T82384: Custom Properties for ShaderNodeTree do not save in blend files.
Not sure why those were excluded, there is no reason not to write ID
data itself for embedded IDs...
2020-11-04 18:16:07 +01:00
afe5345a3f Fix (unreported) memory leak when freeing Master collections.
Potential ID properties there (or any other ID data itself) would not be
freed.
2020-11-04 18:16:07 +01:00
7a8c8ec5e9 Merge branch 'blender-v2.91-release' 2020-11-04 18:13:57 +01:00
fd110291a5 Fix T81794: ColorRampElement step regression
Set step in RNA property definition.

There was a hardcoded setting of a1 for this specific button, which
used to be the variable to store the step size of number buttons until
rBe6f0b60c2e91. hardcoded value is removed in rBe29206f86a5f.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D9277
2020-11-04 18:09:21 +01:00
96e8dadda0 Fix T82385 EEVEE: Alpha Clip shadows actually using Alpha Hashed shadows
The shadow path was not using the alpha threshold.
2020-11-04 17:16:20 +01:00
c937f9c4e7 Cycles: fix another race condition in Geometry synchronization
This was forgotten in the previous fix, we should not modify sockets
updated in a separated thread.
2020-11-04 16:35:00 +01:00
0802e9cf54 Use compiler check for -fmacro-prefix-map
Use a more reliable method to check the availability of the flag than
compiler versions. Some compilers have different behaviors for
C and C++.

Reviewed By: campbellbarton, ChrisLend

Differential Revision: https://developer.blender.org/D9446
2020-11-04 21:00:29 +05:30
78234eb214 Fix T82197: Freestyle settings not visible for Workbench render engine
These had an effect but were not exposed in the UI.
2020-11-04 16:20:44 +01:00
abc5e7d596 Annotations: Set as visible when use the annotation tool
If the annotation draw operator is used, enable the annotations in the current area.

Before this change, some editors had the annotation flag set to OFF, but this could be solved with a versioning code, but this did not solve the root problem. The user can disable annotation visibility in the overlay or side panel, depending on the editor. If the user uses the annotation tool and this flag is OFF, the annotation is not visible, and this is not correct. With this patch, every time the user uses the tool, the annotation visibility flag is set to ON to ensure the annotation is visible.

This solves the problem of T82273, T79578 and T80294

Maniphest Tasks: T82273

Differential Revision: https://developer.blender.org/D9409
2020-11-04 16:13:39 +01:00
b63490bc4b Merge branch 'blender-v2.91-release' 2020-11-04 16:07:03 +01:00
cf9ea111bf macOS: remove deprecated touch event API call
Now that the minimum version is macOS 10.13, we can use the new API.

This reverts commit f97a64aa9b.
2020-11-04 16:01:03 +01:00
4dddd54393 Fix T82016: Cycles assert with empty OpenVDB volumes 2020-11-04 15:51:39 +01:00
fd9124ed6b Fix Cycles volume render differences with NanoVDB when using linear sampling
The NanoVDB sampling implementation behaves different from dense texture sampling, so this
adds a small offset to the voxel indices to correct for that.
Also removes the need to modify the sampling coordinates by moving all the necessary
transformations into the image transform. See also T81454.
2020-11-04 15:09:06 +01:00
43ceb0f047 UI: avoid using "loc/rot", use full words instead. 2020-11-04 14:27:18 +01:00
5af9b9f45b Merge branch 'blender-v2.91-release' 2020-11-04 14:14:38 +01:00
3ffa0452af Fix T67832: Camera Background Images View Transform
This patch will apply the view transform when a movie clip is used as
camera background image. It does this by rendering the image in the
color buffer when it needs the view transform. For other images it uses
the overlay buffer.

Reviewed By: Clément Foucault

Differential Revision: https://developer.blender.org/D7067
2020-11-04 14:13:24 +01:00
7a7f294940 Fix T81775: Object Disappears During Texture Painting
Issue was that the `tris_per_mat` are not created when the first batch is drawn
during select operator and then is not created when needed by the workbench pass
since they are not tracked by mesh_buffer_cache_create_requested.

This change will create the `tris_per_mat` just in case they are needed later.
Solution by Clément Foucault

Differential Revision: https://developer.blender.org/D9430
2020-11-04 14:08:03 +01:00
17ccda4fe1 Cycles: fix multithreading issue introduced in previous commit
The issue is that the shaders are stolen from the original Geometry by
the temporary Geometry used to accumulate data, but the main thread
still needs them for syncing the attributes.

So make a copy of the shader array to preserve the data on the original
Geometry.
2020-11-04 14:03:35 +01:00
ed4855ecb4 Modifiers: Fix wrong object when setting error in modifier
This was introduced in rBe4facbbea54019abe257787a7e9e8594a6ce3609.
2020-11-04 13:43:00 +01:00
25a718aa90 Merge branch 'blender-v2.91-release' into master 2020-11-04 13:34:41 +01:00
27648ed537 Modifiers: return empty mesh in case of error in Volume to Mesh modifier
Passing on the original mesh does not really make sense.
For that one should simply disable the modifier.
2020-11-04 13:31:23 +01:00
cfcdae5549 Fix T82393: Volume to Mesh modifier with sequence fails during rendering
The issue was that the volume for the current frame
might not have been loaded already by the time the
modifier runs.

The solution is simply to make sure that the volume
is loaded. This is similar to the Volume Displace modifier.
2020-11-04 13:21:43 +01:00
f7320c3bf1 Fix T82292: Set encoding for keymap export to UTF-8
Keymaps have previously been exported with an encoding dependent
on the current system locale. This caused issues when the
keymap contained non-ASCII characters, for instance in a string
property for an operator.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9449
2020-11-04 13:20:10 +01:00
31a620b942 Cycles API: encapsulate Node socket members
This encapsulates Node socket members behind a set of specific methods;
as such it is no longer possible to directly access Node class members
from exporters and parts of Cycles.

The methods are defined via the NODE_SOCKET_API macros in `graph/
node.h`, and are for getting or setting a specific socket's value, as
well as querying or modifying the state of its update flag.

The setters will check whether the value has changed and tag the socket
as modified appropriately. This will let us know how a Node has changed
and what to update, which is the first concrete step toward a more
granular scene update system.

Since the setters will tag the Node sockets as modified when passed
different data, this patch also removes the various modified methods
on Nodes in favor of Node::is_modified which checks the sockets'
update flags status.

Reviewed By: brecht

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D8544
2020-11-04 13:03:33 +01:00
ba6977cb8b Fix assert on mouseover of blocks not using the layout system
When there was an active button in the "old" block from the last redraw,
this code tried to replace its pointer in the new block's button groups.
But in cases like the outliner or file browser, there are no groups
because the block doesn't use the layout system at all. This commit
just tweaks the assert to check whether there are any button groups.
2020-11-04 12:46:05 +01:00
a4a848d01b Merge branch 'blender-v2.91-release' 2020-11-04 22:17:29 +11:00
a0db971acf UI: disable add-object tool for 2.91 2020-11-04 22:16:03 +11:00
febfe436b9 Merge branch 'blender-v2.91-release' 2020-11-04 21:59:14 +11:00
e6a940a9b6 Merge branch 'blender-v2.91-release' 2020-11-04 21:59:10 +11:00
819a9622e9 CMake: remove -fmacro-prefix-map from build-info
Quotes caused build-info to fail,
remove these flags since they're not necessary.
2020-11-04 18:41:40 +11:00
9af147b5d3 Cleanup: make format 2020-11-04 02:14:48 -05:00
0523994687 Fix T63495: Add torus changes size each time when unit scale != 1.0
This matches behavior in WM_operator_view3d_unit_defaults.
2020-11-04 18:11:04 +11:00
029e1f066e Cleanup: Add BLI prefix to some BLI_noise functions 2020-11-04 02:07:21 -05:00
d3bcbe10c2 PyAPI: add Struct.is_property_set(..., ghost) option
This exposes the use_ghost argument to RNA_property_is_set_ex.
2020-11-04 18:06:34 +11:00
72f8a08880 CMake: use path_ensure_trailing_slash for fmacro-prefix-map
Use the native system slash so this can work on windows.
2020-11-04 16:00:37 +11:00
43a2494058 CMake: add path_ensure_trailing_slash utility macro 2020-11-04 15:59:55 +11:00
2f7ec507f4 Cleanup: spelling in curve.c 2020-11-04 15:59:51 +11:00
18729aff27 Merge branch 'blender-v2.91-release' 2020-11-04 15:47:06 +11:00
d3b85af6ca Fix T49850: Detailed curves are heavily reduced
Divide the threshold by the resolution to prevent duplicates
being detected in high resolution curves.
2020-11-04 15:39:41 +11:00
0511640815 Fix assert on mouseover of blocks not using the layout system
When there was an active button in the "old" block from the last redraw,
this code tried to replace its pointer in the new block's button groups.
But in cases like the outliner or file browser, there are no groups
because the block doesn't use the layout system at all. This commit
just tweaks the assert to check whether there are any button groups.
2020-11-03 22:03:08 -06:00
293cc70e4f Update RNA to Manual mapping 2020-11-03 22:56:57 -05:00
a31039e1ed Merge branch 'blender-v2.91-release' 2020-11-04 14:54:11 +11:00
0eb1cceea1 Fix T65449: Rip wire edges show error even when it works
Thanks to @zeddb for finding the root cause.
2020-11-04 14:52:45 +11:00
11843e7c29 UI: set the message for disabled vertex weight operators 2020-11-04 11:36:55 +11:00
951758c01f Merge branch 'blender-v2.91-release' 2020-11-04 11:33:12 +11:00
4d358855b8 Cleanup: avoid back-slash line continuations 2020-11-04 11:31:43 +11:00
ffa7bfdda5 Cleanup: unused argument 2020-11-04 11:28:31 +11:00
Jesse Y
c861517ca6 UI: Swap order of "Fade Inactive Geometry" in overlays popover
This simply makes the panel a bit nicer given how things are layed out--
the items with larger visual weight are grouped at the top.

Differential Revision: https://developer.blender.org/D9366
2020-11-03 18:21:02 -06:00
101c3d4ce4 Fix T60517: "Fix Deforms" crashes for meshes without vgroup data 2020-11-04 11:13:39 +11:00
564f3be20a Merge branch 'blender-v2.91-release' 2020-11-04 00:04:15 +01:00
c9fb25342b Fix T81799: Enable use self in trimming tool booleans
This enables self intersections in the sculpt trimming tools boolean operations.
This should fix wrong booleans results after using the operator to add new disconnected
geometry with the join mode.

Reviewed By: sergey

Maniphest Tasks: T81799

Differential Revision: https://developer.blender.org/D9423
2020-11-04 00:03:09 +01:00
e836c806e4 Fix T81842: Cloth brush not creating simulation areas for each tiling symmetry pass
The cloth brush fixed simulation areas are created using the initial_location variable in the
 StrokeCache. This variable was not being updated by tiling symmetry, so all symmetry passes
were using the same simulation area location.

Reviewed By: sergey

Maniphest Tasks: T81842

Differential Revision: https://developer.blender.org/D9421
2020-11-04 00:01:33 +01:00
a5aa56cd71 Fix mask extract and slice not preserving mesh symmetry options
When extracting new objects from a mesh in sculpt mode, it makes sense to keep
the current symmetry options and settings in the new mesh. In previous versions symmetry
options were stored in the tool settings, so this bug was not that obvious.

This also preserves the remember settings in the new object, which is also the desired
behaviour.

Reviewed By: sergey, mont29

Differential Revision: https://developer.blender.org/D9417
2020-11-03 23:59:24 +01:00
0dd599f916 Fix mask slice to new object preserving the mask
If the new object contains the mask it always needs to be cleared before starting
sculpting on it.

This fix was also committed before in the mask extract operator.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9416
2020-11-03 23:57:12 +01:00
dc3fb012e7 Fix T82297: Brush alpha not affecting smear tools strength
The strength of this brush needs to take alpha into account

Reviewed By: sergey

Maniphest Tasks: T82297

Differential Revision: https://developer.blender.org/D9419
2020-11-03 23:55:39 +01:00
4413f481be Merge branch 'blender-v2.91-release' 2020-11-03 16:31:17 -06:00
9e8a488af2 Fix T81691: Use-after-free with property search and hovered button
The list of buttons in the button group needs to be updated to take into
account the old button inserted into the button list for the new block.

Differential Revision: https://developer.blender.org/D9428
2020-11-03 16:30:58 -06:00
47876e9c5e Merge branch 'blender-v2.91-release' 2020-11-03 16:25:47 -06:00
5650468c84 Property Search: Fix missing update switching tabs after search
What I thought was an "optimization" was really a bug. The "use search
for expansion" value needs to be set for every panel, even panels in
other tabs. Otherwise it won't be properly set when switching back to
a tab that was visited during search.

Differential Revision: https://developer.blender.org/D9427
2020-11-03 16:24:22 -06:00
e29206f86a Cleanup: Remove broken/deprecated setting of color-ramp button step size
Setting the button's step size like this wouldn't work anymore after
e6f0b60c2e, which is reported in T81794. Instead, the step size should be set
for the RNA property, as proposed in D9277. That will be committed separately
as bug fix.
2020-11-03 22:31:46 +01:00
db7cf3652c Fix for previous cleanup commit 2020-11-03 15:26:23 -06:00
cabec08253 Cleanup: Clang tidy 2020-11-03 15:12:50 -06:00
f109b63431 Merge branch 'blender-v2.91-release' into master 2020-11-04 01:58:10 +05:30
Ankit Meel
8f2ebcf93f macOS: find Jack framework in system directories
Until it is decided whether to ship JACK with pre-compiled libraries,
search for the same in system directories.

Ref T79261
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D9436
2020-11-04 01:53:33 +05:30
fe7093fae4 Cleanup: Remove dead code in bevel operator
The `poll_property` callback is only used when the `ui` callback isn't
defined.
2020-11-03 14:10:20 -06:00
76683af38c Cleanup: Declare variables where initialized 2020-11-03 13:57:20 -06:00
e3858f4716 Fluid: Updated APIC plugin
Updated version of APIC plugin in order to resolve ASAN issues.
2020-11-03 19:34:31 +01:00
57d1aea64f Cycles: add support for BVH refit in OptiX
This avoids recomputing the BVH for geometries that do not have changes in topology but whose vertices are modified (like a simple character animation), and gives up to 40% speedup for BVH building.

This is only available for viewport renders at the moment.

Reviewed By: pmoursnv, brecht

Differential Revision: https://developer.blender.org/D9353
2020-11-03 18:05:29 +01:00
216880bb47 GPencil: Reorganize Cleanup menu
Reviewed by @mendio
2020-11-03 17:22:03 +01:00
7567086276 GPencil: Add Recalculate Geometry operator to Cleanup menu
This operators was only accesible using the search menu.
2020-11-03 17:22:03 +01:00
ed4540b799 Fix paste f-curve modifiers default "Only Active" value
The tooltip implies that this option should be off per default instead
of on. Some talking with the animators at the studio and in the
animation module confirmed that this seems to be the most logical
default.
2020-11-03 17:21:14 +01:00
5deb2d42d9 Merge branch 'blender-v2.91-release' 2020-11-03 16:39:27 +01:00
0cf46631e1 Fix T82356: Gpencil merge freezes Blender
The `gps_next` variable had a typo error and was wrongly used as `gps->next`
2020-11-03 16:38:43 +01:00
e699546bde Fix T81756: relinking multiple links to group input removes links
The links where added to the socket one after the other. However,
the virtual socket had a link limit of 1, so whenever a new link was
added, the previously added one was removed.

There is not really a reason for why the link limit should be 1 instead
of something higher. I'm setting it to the max value: `0xFFF`.

I'm also setting the `input_link_limit` to that value. Blender does not
need this currently, but addons might have input sockets that allow
more than one incident link.
2020-11-03 15:11:40 +01:00
313086e212 GL: Fix default framebuffers being bound using srgb
Default backbuffers needs not to be bound with sRGB encoding
enabled. This works when using `GPU_framebuffer_restore` but
using `GPU_framebuffer_bind` would trigger the wrong behavior.

This fix T81969 UI turns whiteish when playing video sequence
based on a scene and moving in the image editor after saving
2020-11-03 14:44:28 +01:00
6fdcca8de6 Materials: add custom object properties as uniform attributes.
This patch allows the user to type a property name into the
Attribute node, which will then output the value of the property
for each individual object, allowing to e.g. customize shaders
by object without duplicating the shader.

In order to make supporting this easier for Eevee, it is necessary
to explicitly choose whether the attribute is varying or uniform
via a dropdown option of the Attribute node. The dropdown also
allows choosing whether instancing should be taken into account.

The Cycles design treats all attributes as one common namespace,
so the Blender interface converts the enum to a name prefix that
can't be entered using keyboard.

In Eevee, the attributes are provided to the shader via a UBO indexed
with resource_id, similar to the existing Object Info data. Unlike it,
however, it is necessary to maintain a separate buffer for every
requested combination of attributes.

This is done using a hash table with the attribute set as the key,
as it is expected that technically different but similar materials
may use the same set of attributes. In addition, in order to minimize
wasted memory, a sparse UBO pool is implemented, so that chunks that
don't contain any data don't have to be allocated.

The back-end Cycles code is already refactored and committed by Brecht.

Differential Revision: https://developer.blender.org/D2057
2020-11-03 16:35:44 +03:00
91d320edc3 Cycles: immediately store the used_shader list in Blender interface.
Uniform attributes require immediate access to the shader list
in object update code, so setting the field can't be deferred
to a background task. This required adding a parameter to the
clear method of Geometry.

Ref D2057
2020-11-03 16:35:43 +03:00
9bc177d8de Materials: support true float4 attributes in the Attribute node.
Add a new Alpha socket to the Attribute node that outputs the
fourth component of the attribute. Currently the only such
attribute is vertex color, but there may be more in the future.
If the attribute has no alpha channel, the expected value is 1.

The Cycles code is already refactored and committed by Brecht.

Ref D2057
2020-11-03 16:35:43 +03:00
da93da45ee Docs: add comments to some surface deform internal structures 2020-11-04 00:04:48 +11:00
3c953a1b09 Fix T82074: Volume to Mesh normals are inverted
OpenVDB seems to have a different winding order convention.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D9434
2020-11-03 14:01:07 +01:00
7ceb622fd3 Cleanup: doxy param syntax 2020-11-04 00:01:00 +11:00
f278d814fd Cleanup: spelling 2020-11-03 23:59:24 +11:00
b1efea986d Fix sequence tests writing HTML report to wrong directory
It was missing from tests/report.html that gathers all tests reports.
2020-11-03 13:31:31 +01:00
c21ba10e0b Merge branch 'blender-v2.91-release' 2020-11-03 13:22:22 +01:00
df2a0cd6f4 Fluid: Fix crash with viewport display options
Overlay extras should not be drawn outside of the fluid domain cache range.
2020-11-03 13:21:07 +01:00
c32bee0099 Cleanup: Use recently added helper function to find File Browser UI data
`ED_fileselect_handler_area_find()` was added in a750acab78 and makes this
case more readable and avoids code duplication as well.
2020-11-03 12:27:20 +01:00
bc0a6b0400 Fix T71759: Sculpt/Vertex/Weight Paint Brush Size Gets Undone After Undoing a Stroke.
Add code preserving scene's toolsettings accross undo.

IDPointers are dealt with special care, we try to keep existing ones for
some (like brushes) when possible.

Note that this covers ToolSettings, Brushes and Palettes currently.

I'm not especially happy about how this new code mixes with existing
'foreach_id' one, in particular in scene. But cannot think of a better,
more generic way to do it currently.

Maniphest Tasks: T71759

Differential Revision: https://developer.blender.org/D9311
2020-11-03 12:09:00 +01:00
5610ccdc08 Add a callback to IDTypeInfo to allow preservation of some data accross memfile undos
This is essentially adding that new callback, and using it only for already
existing Scene's 3DCursor.

Note that the place where this is called has been moved again, after all
have been lib-linked, such that those callbacks may also work on ID pointers.

Maniphest Tasks: T71759

Differential Revision: https://developer.blender.org/D9237
2020-11-03 11:40:29 +01:00
da03eb854b Merge branch 'blender-v2.91-release' 2020-11-03 20:54:26 +11:00
e03575768f Merge branch 'blender-v2.91-release' 2020-11-03 20:54:22 +11:00
fc9f1b1754 Fix T81988: Surface Deform "Bind" causes vertices to spike
Surface deform weight calculation assigned weights in a non-uniform
way that caused vertices to deform upon binding.

This was caused by the face-corner angle being used in
calculations which where squared & scaled.
Causing a triangle fan of many thin faces to have a much greater
influence compared to the same shape made from a single triangle.

Change the calculation of the weight so each face-corner is scaled
by it's angle.
2020-11-03 20:52:53 +11:00
d93a6cdf00 DrawManager: Cleanup unneeded memory allocation
`tris_per_mat` is only valid for the final buffer cache. It was
allocated for every buffer cache.
2020-11-03 10:44:56 +01:00
093dfdfc94 Merge branch 'blender-v2.91-release' 2020-11-02 22:59:00 -07:00
Manuel Castilla
20e982e78d Fix T77161: Outliner - Hiding a Collection does not gray out children objects
Ensure that When checking "Hide in Viewport" option for a collection
that child objects are drawn grayed out for consistency with the
"Disable in Viewports" toggle.

For checking an object visibility in the viewport the flag
BASE_VISIBLE_VIEWLAYER should be used instead of BASE_VISIBLE_DEPSGRAPH
because the latter ignores viewport visibility.

Manifest Task: T77161

Differential Revision: https://developer.blender.org/D7904
2020-11-02 22:56:44 -07:00
Jaggz H
fbf2908674 Outliner: Add "Selectable" object filter
This addition to the filters allows the user to enable the
outliner tree to restrict the listing to only Selectable objects.

Differential Revision: https://developer.blender.org/D7310
2020-11-02 22:09:47 -07:00
084db58fbd Cleanup: Use typedef for bevel angle kind enum
This makes debugging slightly easier, and makes the code slightly more
explicit about its intentions.
2020-11-02 23:05:15 -06:00
6290bc4a37 Merge branch 'blender-v2.91-release' 2020-11-02 22:35:15 -06:00
c6d8300823 Fix T82120: Arc miter bevel creates miters on straight edges
In some situations where two beveled edges were very close to in-line
but not quite straight, bevel would build a miter when it shouldn't.
The code that chose whether to use a miter at each vertex was slightly
incorrect.

For outer miters there is a check for 3 or more selected edges, but an
inner miter can still be useful with only two beveled edges at a vertex,
so we can't use that here. Instead I changed the check for in-line edges
to run before determining whether the angle is reflex or not. The logic
ends up a bit more straightforward as well. This doesn't completely
remove the rather strange looking triangle vertex meshes at each corner,
but it does make it stable when locations are slightly adjusted.

The only other place this `edges_angle_kind` function was used is for
profile=1.0 vertex meshes. I tested and made sure that still works well.

Differential Revision: https://developer.blender.org/D9420
2020-11-02 22:34:57 -06:00
23f3c30b58 Fix T64138: Windows Ink continuous grab at window edge.
WM_POINTERLEAVE occurs when the pen goes out of range or when a
hovering pen leaves the window's boundary. When leaving the window
boundary the xy position is invalid for some Wacom devices.

This change removes creation of GHOST_EventCursor during
WM_POINTERLEAVE events. This prevents unexpected jumping behavior
during continuous grab.
2020-11-02 19:02:16 -08:00
3049704b15 Cleanup: Remove unused parameter in panel code
This is no longer used after rB54da72d3cd546ecb, but passing it to a
recursive call hid the warning.
2020-11-02 18:00:46 -06:00
c067b7460a Fix C operators can't set default display or sort type for File Browser
`WM_operator_properties_filesel()` allows C operators to set a display or sort
type for the File Browser to use. But the File Browser would always override
that because of an invalid `_is_set()` check. (The operators don't actually set
the value, they only set the property's default value.)

The only operator affected by this is "Recover Auto Save". It is supposed to
show a vertical list ordered chronologically. It used settings from the
previous File Browser usage before this patch.

Operators using the File Browser should generally use
`FILE_DEFAULTDISPLAY`/`FILE_SORT_DEFAULT` now, except if they have a reason not
to. See comments at their definition.

----

This makes it so operators that set a different display or sort type
don't change the sort or display type for the next File Browser operation.
So using "Recover Auto Save" entirely isolates display and sort type from other
operations.

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

Reviewed by: Bastien Montagne
2020-11-03 00:00:41 +01:00
a750acab78 Fix possible use-after-free when closing Blender with File Browser open
I think there wasn't actually any issue currently, but only by luck. We still
passed around and NULL-checked a pointer to freed memory (the file operator,
`SpaceFile.op`) which is easy to break and should be avoided.
Noticed while testing D8598.
2020-11-03 00:00:41 +01:00
9cfcc27319 Cleanup: Mark arguments as const 2020-11-02 16:25:59 -06:00
e1665c3d31 VSE: Media transform redesign
This patch changes behavior of strip transform and crop feature.

Purpose of this change is to allow display arbitrary portion of input
image, simplify user interface and workflow.
Offset and Crop values in old files are converted in versioning.
Offset animation is also converted. Crop animation and animation of
crop or offset enable properties is not taken into account

Changes in behavior and interface:
- If image is added to timeline it is scaled to fit inside preview area
while maintaining aspect ratio. Image is centered. This is considered
as a baseline for further transformation.
- Scale and rotation was added, so it is possible to transform image at
it's original resolution.
- Crop will not affect image transformation (does not move image).
- Values of Crop and Transform Position are in pixels, these values are
corrected if preview is fraction of project resolution.
- Transform and Mirror panel has been removed and new Transform panel
and Crop panel is moved to Adjust panel. Mirror is now part of new
Transform panel.

Technical changes:
- Preprocessing stage must work on duplicated image, because original is
cached. Previously Crop and Offset could run at once and required only
one duplication of image. This is not the case with new algorithms, so
duplication on demand is implemented. Transformation can read original
image and will output new image that is safe to modify. It should be
possible to add crop step to transform algorithm, so that Crop won't
require previous duplication though.
- Use Crop and Use Translation checkboxes were removed. Individual
values are compared to default values to check if image needs to be
processed. In case of transform this will be done also if resolution of
source.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8393
2020-11-02 22:15:52 +01:00
6b3eca661d Revert "VSE: Media transform redesign"
This reverts commit 0277579b28.

This commit caused build errors on Linux.
2020-11-02 20:59:21 +01:00
b9ec6c305c Revert "Cleanup: store results of function calls in const values."
This reverts commit 20c4aa13de.

Wrong buggy commit breaking tests, and not actually adding anything to
code quality.
2020-11-02 20:31:12 +01:00
0277579b28 VSE: Media transform redesign
This patch changes behavior of strip transform and crop feature.

Purpose of this change is to allow display arbitrary portion of input
image, simplify user interface and workflow.
Offset and Crop values in old files are converted in versioning.
Offset animation is also converted. Crop animation and animation of
crop or offset enable properties is not taken into account

Changes in behavior and interface:
- If image is added to timeline it is scaled to fit inside preview area
while maintaining aspect ratio. Image is centered. This is considered
as a baseline for further transformation.
- Scale and rotation was added, so it is possible to transform image at
it's original resolution.
- Crop will not affect image transformation (does not move image).
- Values of Crop and Transform Position are in pixels, these values are
corrected if preview is fraction of project resolution.
- Transform and Mirror panel has been removed and new Transform panel
and Crop panel is moved to Adjust panel. Mirror is now part of new
Transform panel.

Technical changes:
- Preprocessing stage must work on duplicated image, because original is
cached. Previously Crop and Offset could run at once and required only
one duplication of image. This is not the case with new algorithms, so
duplication on demand is implemented. Transformation can read original
image and will output new image that is safe to modify. It should be
possible to add crop step to transform algorithm, so that Crop won't
require previous duplication though.
- Use Crop and Use Translation checkboxes were removed. Individual
values are compared to default values to check if image needs to be
processed. In case of transform this will be done also if resolution of
source.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8393
2020-11-02 20:19:16 +01:00
5ed4e1e23a Fix T77819: Snap Incremental does not match grid in all cases
The behavior of the incremental snap did not take into account the
relative dimensions of the window, which resulted in a different behavior
if the area height was greater than the width.
2020-11-02 16:14:03 -03:00
ef4aa42ea4 UI: Enable writing global area data (top-bar, status-bar) to .blend's
There should not be much user visible here (other than T73668 being addressed).

I added the writing code already for the initial implementation of workspaces,
but we decided to keep it disabled until the top-bar design is more clear. It
was never planned to keep this disabled for so long.

Fixes T73668.
2020-11-02 18:35:13 +01:00
cf7343a355 Fix Cycles kernel compile error with NanoVDB because of type redefinition
Cycles defines some basic integer types since it cannot use the standard headers when
compiling with NVRTC. NanoVDB however only does this when the "__CUDACC_RTC__" define
is set and otherwise includes the standard "stdint.h" header which clashes with those typedefs.
So for compatibility do the same thing in the Cycles kernel headers. See also T81454.
2020-11-02 18:00:13 +01:00
1408052781 LibOverride: make some pose options overridable.
Request from the studio.
2020-11-02 17:29:04 +01:00
576bd98622 Grease Pencil UI code: use row for rows in the UI
Rename `col` to `row` when it's actually a row (and not a column).

No functional changes.
2020-11-02 17:18:55 +01:00
aee1e4fc6a UI: Simplify some tool icon geometry
Removing interior vertices can remove some complexity from the final
exports. Also improved the topology slightly in some cases.
2020-11-02 10:10:49 -06:00
20c4aa13de Cleanup: store results of function calls in const values. 2020-11-02 17:08:10 +01:00
db18ba07b5 Fix py-defined pointer properties wrong tag re ID ownership.
This fixes critical bug with liboverride when soe add-ons add some
RNA ID Pointer properties.

ID pointers should **never** have ownership of their ID when defined
from python.

(As a reminder, RNA properties owning their ID pointers are extremely
rare even from C code, only embedded IDs (root node trees, master
collections) and the shape keys snowflakes are concerned.)
2020-11-02 17:08:10 +01:00
4c460a2dbd Fix incorrect colors in grease pencil strength tool icon 2020-11-02 09:52:23 -06:00
7872bcafa0 Cleanup: Document output of BKE_object_where_is_calc and friends
Add a comment to the declaration of the `BKE_object_where_is_calc...()`
functions to explain where the result of the calculation is stored.

No functional changes.
2020-11-02 15:36:18 +01:00
7887e91d31 Cleanup: Sanitise return value of ED_object_parent_set()
Consistently return `false` from `ED_object_parent_set()` when parenting
is not possible. Before, when parent and child were the same object, the
function would return `true` even though the parent-child relation was
not made.

Just returning `false` in the `parent == child` case would break the
parenting operator, as `false` stops its loop over all selected objects.
This tight coupling caused T82312. The loop now has its own check for
this, so that it properly continues, and the implementation of
`ED_object_parent_set()` is decoupled from its surrounding code.

No functional changes.
2020-11-02 15:36:18 +01:00
417ba6aa1c GPencil: Cleanup comments typo error 2020-11-02 15:27:33 +01:00
b1213e8cf9 Add comment about size of generated previews of filebrowser thumnails. 2020-11-02 15:10:38 +01:00
42f6aada98 Fix crash opening some 2.4x .blend files with drivers or NLA editor
For example, outlinertest.blend from test240.zip.
2020-11-02 14:28:10 +01:00
dca65390f0 Another attempt at fixing T81963: Random rare crashes in override code.
Adding another pass of ensuring valid up-to-date pose data in RNA
function itself...
2020-11-02 11:58:01 +01:00
2b98a9269b LibOverride: Do not assert on missing operands in apply function.
This can happen after some changes in lib file and resync in user file
e.g..
2020-11-02 11:58:01 +01:00
f2c7b4a1c5 Re-enable WITH_COMPILER_SHORT_FILE_MACRO, fix build error.
The issue was in `buildinfo.c`:
  char build_c[xx]flags[] = BUILD_C[XX]FLAGS;

Non-escaped double-quotes were terminating the string early, and
causing the compile error. So use single-quotes.
2020-11-02 16:11:10 +05:30
19dec6c8a7 Turn off WITH_COMPILER_SHORT_FILE_MACRO temporarily.
It's causing build errors on compilers that I don't have. Turn it off
while I fix them.

Added in {rB1daa3c3f0a1cfd74bef527e0207f38154e591d46}.
2020-11-02 15:45:59 +05:30
b801369c8e Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-11-02 11:06:22 +01:00
9e736fc984 Revert "Parenting: fix return value when parenting object to itself"
This reverts commit ad35fa1993, it had
unintended side-effects (T82312).
2020-11-02 11:00:52 +01:00
1daa3c3f0a Clang/GCC: use relative path in __FILE__ macro
This change removes the user-specific information from
macros like `__FILE__` and keeps it relative to top level
source or build (for generated files) directory.
It makes traces concise.

Added option `WITH_COMPILER_SHORT_FILE_MACRO` enabled by default.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9386
2020-11-02 15:12:10 +05:30
cc09c0d048 Revert "Parenting: fix return value when parenting object to itself"
This reverts commit ad35fa1993, it had
unintended side-effects (T82312).
2020-11-02 10:11:46 +01:00
d49c71e96e Cleanup: use logging for "Found bundled Python" message
This was added when Python was initially bundled so any problems
finding Python could be investigated.

Move this to use logging so we can show this information when needed.
2020-11-02 19:33:32 +11:00
27acf8ced8 Cleanup: remove unused FileList.prv_w/h 2020-11-02 17:09:08 +11:00
0d10621630 Fix incompatible pointer types warning with GCC 2020-11-02 16:49:12 +11:00
Richard Antalik
c887a50f62 Add sequencer transform tests
Tests files are based on test from D8393

Test files should be in `lib\tests\sequence_editing`
These are files, I will add few more tests including animation test.
{F9155273}

Using generic tool to compare rendered vs reference image as other render engines.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9394
2020-11-01 21:34:18 +01:00
Richard Antalik
ea1c5a6c15 Rename BKE_sequencer.h
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9349
2020-11-01 21:10:36 +01:00
a1f46ac9dc Revert "PyAPI: remove bpy.app.binary_path_python"
This reverts commit 6527a14cd2.

Some 3rd party scripts made use of this so scripts can work with
2.90 to 2.92, although eventually this can still be removed.
2020-11-01 19:11:08 +11:00
4012c6e86f Merge branch 'blender-v2.91-release' 2020-11-01 18:22:19 +11:00
f4d6823fd6 Merge branch 'blender-v2.91-release' 2020-11-01 18:22:16 +11:00
f2fb26575c Merge branch 'blender-v2.91-release' 2020-11-01 18:22:12 +11:00
276d19f63b PyAPI: set sys.executable to None when Python can't be found
Without this, sys.executable may be set to Blender's
executable instead.
2020-11-01 18:12:26 +11:00
9de42337c8 Cleanup: Fix typo in comment 2020-10-31 22:54:13 -05:00
c271600101 Fix T82089 Boolean on empty mesh with collection fails.
For the fast solver, there was an optimization carried over
from the non-collection case for empty meshes which did not
work in the chained boolean code for collection operands.
Removed that optimization in the collection case.
2020-10-31 20:48:24 -04:00
4158b7f674 Fix T82089 Boolean on empty mesh with collection fails.
For the fast solver, there was an optimization carried over
from the non-collection case for empty meshes which did not
work in the chained boolean code for collection operands.
Removed that optimization in the collection case.
2020-10-31 20:07:00 -04:00
c249eb7a8d Fix new boolean performance bug.
The code that decided to use a faster double version of plane
side testing forgot to take an absolute value, so half the time
the exact code was being used when it was unnecessary.
2020-10-31 17:21:18 -04:00
30826a5e49 Fix new boolean performance bug.
The code that decided to use a faster double version of plane
side testing forgot to take an absolute value, so half the time
the exact code was being used when it was unnecessary.
2020-10-31 16:46:11 -04:00
64faa59846 Cycles: Fix debug compilation after tile stealing commit 2020-10-31 14:04:30 +01:00
e7dc3c91ab GPencil: Change maximum limit of Join stroke
Also, clarify comments.
2020-10-31 09:37:10 +01:00
fe90bb86c0 Merge branch 'blender-v2.91-release' 2020-10-31 09:25:13 +01:00
9af6c041e8 Fix T82265: GPencil interpolate crash when next frame was NULL
If the next frame of the layer was NULL and it was not the active layer crashed.
2020-10-31 09:24:43 +01:00
517ff40b12 Cycles: Implement tile stealing to improve CPU+GPU rendering performance
While Cycles already supports using both CPU and GPU at the same time, there
currently is a large problem with it: Since the CPU grabs one tile per thread,
at the end of the render the GPU runs out of new work but the CPU still needs
quite some time to finish its current times.

Having smaller tiles helps somewhat, but especially OpenCL rendering tends to
lose performance with smaller tiles.

Therefore, this commit adds support for tile stealing: When a GPU device runs
out of new tiles, it can signal the CPU to release one of its tiles.
This way, at the end of the render, the GPU quickly finishes the remaining
tiles instead of having to wait for the CPU.

Thanks to AMD for sponsoring this work!

Differential Revision: https://developer.blender.org/D9324
2020-10-31 01:57:39 +01:00
523414dda2 Cleanup: clang-format 2020-10-31 01:57:39 +01:00
316a5914bc Previous check seems to have a race condition, resulting in Wintab not being enabled. 2020-10-30 16:29:04 -07:00
af7b0003cb Add explanation for dequing Wintab PACKETs during WT_PACKET event into a local queue to consume during WM_* mouse events. 2020-10-30 16:29:04 -07:00
50558416b9 Commented assumption was incorrect, using tickCountToMillis causes underflow when compared to current time. 2020-10-30 16:29:04 -07:00
792e145c22 Cleanup: rename functions for consistency with other process*Events functions. 2020-10-30 16:29:04 -07:00
2b01c5a148 Cleanup: Use C style comments, punctuation, and capitalization.
Added missing function documentation.
2020-10-30 16:29:04 -07:00
632b345d35 Update tooltip, Tablet API can now be changed at runtime. 2020-10-30 16:29:04 -07:00
cbc1c83154 Remove Wintab logging. 2020-10-30 16:29:04 -07:00
a9d6eb8f0b Add Wintab debug logging as a CMake option WITH_WINTAB_DEBUG.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:04 -07:00
d9b0ef2de4 Finish the comment's thought explaining pessimistic button ups events for
Wintab.
2020-10-30 16:29:04 -07:00
5badaa8390 Return of the Wintab refactor.
Previously Wintab was handled by saving the most recent tablet pressure and tilt information and deferred appending tablet infromation to Windows mouse events. This caused synchronization issues evident at the beginning and ending of strokes where pressure and tilt were either ahead or behind in time from mouse button up or down events. This also dicarded swaths of data which resulted in blockly grease pencil lines most apparent when a context switch resulted in several coalesced mouse events.

This patch changes the behavior of Wintab to instead rely entirely on Wintab information for pressure, tilt, position, and button input.

Wintab has several design decisions and conventions which complicate relying soley on it's input while retaining current workflows reliant on non-API behavior. For example, many device optionally allow the user to map barrel buttons to non-mouse actions. These mappings may or may not modify the intended behavior when touching the stylus down, such as scroll vs alt mappings. This behavior is not exposed in the Wintab API, but Wintab will continue updating button state sans this necessary context.

To work around the problem, this refactor synchronizations tablet input to Windows mouse down and up events, this captures events which should result in pen input while allowing events such as pen scrolling. Until a Windows mouse down event fires Wintab input is left unprocessed; when a Windows up event occurs Wintab is processed until a corresponding button up event is found.

Wintab allows for either button state or changes to be reported, but not both. An earlier refactor tried to use button changes to let state to be managed by Wintab. This was replaced when it was found that button change events were unreliable at corner cases such as switching windows. It was also found that with Wacom drivers Wintab peek functions would modify events in the queue causing errant and loss of button events.

For the latter stated reason this patch opts to read all Wintab events into a queue as they arrive, removing events as they become stale. This was chosen over using Wintab peek functions due to the afformentioned issue. As a bonus this seems to work better as it prevents the queue in Wintab from filling, thus neither a flood of events need to be handled when Wintab processing begins and a Wintab implementation need not be trusted to overwrite old events in it's queue.

Maniphest Tasks: T75566

Differential Revision: https://developer.blender.org/D7840
2020-10-30 16:29:04 -07:00
0ee4b0b965 Before a wintab button event is generated, generate a GHOST mouse move
event to the button down location as this should be a more accurate point
of contact than the last mouse move event.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:04 -07:00
7599571904 Adding explanitory comment to explain why tablet API check is necessary
for Pointer input even when Wintab should be preventing Pointer events.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:04 -07:00
a080accdb6 When there are not associated button events, assume there is no button
events until one is found. This prevents errant cursor moves that occur
before the Wintab button event is reported. We need to skip these events
because if no button event exists, we generate one assuming it will either
arrive later in the Wintab queue or that the button was from a non-Wintab
device. For the case that this was generated by a non-wintab device, such
as buttons mapped to mouse on the tablet pad, these cursor move events can
significantly move the cursor from the intended click position.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
1f25235ec3 Clarify comment to be more specific so that in the future someone knows
the issue with Wintab button events are more significant than simply
setting what buttons should receive button up/down events during context
initialization.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
efe3e4f023 Save Wintab packets to a local queue as WT_PACKET events arrive or when
handling mouse input. This Wintab to mouse synchronization issues, and
likely prevents queue exhaustion for some Wintab implmenetations.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
d58387cdda Correcting the type for indexing Wintab buttons.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
14cddad034 Change updateWintab interface to include whether window is visible so that
window intitialization can specify whether it will be visible regardless
of whether it is yet visible.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
b98ea1b268 Revert "Mask all button down/up and switch back to using relative button input."
This reverts commit 045aaf6f78f1fbb6e2bbefd234b7bae04844d42b.
2020-10-30 16:29:03 -07:00
c4821079b7 Fix type for physicalButton in wintabMouseToGhost.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
a6e31482e9 Fix return value of WTPacketsGet.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
a5f3c0e563 Move assignments into initializer list for GHOST_EventButton
and GHOST_EventCursor.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
1b535e8719 Mask all button down/up and switch back to using relative button input.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
3281507f7b Document inline that PACKETDATA and PACKETMODE modify external headers to
discourage reducing their scope to the only place they're used internally.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
538a2ac58f Allow double button up, otherwise there may be a trailing 0 pressure line.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
7c84f25453 Fix T75566
Button events now include tabletdata, so move is unnecessary.

Generate mouse button events when the system has an event but Wintab did not find a correlated event.

Only filter mouse button events, not Win32 Pointer events.

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>

Maniphest Tasks: T75566

Differential Revision: https://developer.blender.org/D7404
2020-10-30 16:29:03 -07:00
70ca48b67f Button events now include tabletdata, so move is unnecessary.
Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2020-10-30 16:29:03 -07:00
abbdfc8bf7 Revert "Revert "Windows: support high resolution tablet pen events for Wintab""
This reverts commit e90d8422d0.
2020-10-30 16:29:03 -07:00
c503c5f756 Fix T82244: Crash when trying to use the rotate operator on the timeline
Some tranform modes are not expected to be used in the `SPACE_ACTION`.
2020-10-30 20:13:05 -03:00
81090ded0d Fluid: Removed binary_python from fluid script
This hack is no longer required. It was fixed in rB52b38d9c3d84 and temporarily disabled in rBa877248ac203.
2020-10-30 18:36:21 +01:00
99a7c917ea Sculpt: Dyntopo detail size edit operator
This introduces a new operator to edit the detail size of constant
detail mode in dyntopo. The way this operator works and the
functionality it provides is similar to the "Voxel size edit" operator
for the voxel remesher.

It also includes a sample mode. When pressing Ctrl, the detail size
will be sampled from the surface under the cursor, updating the
preview in real time. This allows quick resolution changes without
using the operator multiple times.

The operator is set to Shift + D, replacing the old way to change
the constant detail size of dyntopo. Shift + R will remain available to
be enabled when the voxel remesher works with dyntopo. Deciding
if both detail sizes can be unified needs a separate discussion as the
new dyntopo can work with detail sizes in parts of the mesh that can
easily crash the remesher.

The structure of these operators is similar, but the data they control,
ranges, drawing and setup functions are completely different, making it
hard to merge them into one.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9355
2020-10-30 18:13:25 +01:00
39be996452 Sculpt: Add pie menu for global automasking options
Global automasking options are usually turned on/off for quick
adjustments both in brushes and filters, so it is convenient to have them
in a pie menu.

This uses the Alt + A shortcut.

Reviewed By: dbystedt, HooglyBoogly

Differential Revision: https://developer.blender.org/D9282
2020-10-30 18:09:54 +01:00
15cb67e0b0 Sculpt: Add normal orientation to lasso trim tool
This adds an option to orientate the trimming shape using the surface
normal instead of the view when lasso trim is used.

Reviewed By: dbystedt, sergey

Differential Revision: https://developer.blender.org/D9231
2020-10-30 18:09:03 +01:00
492a9e4023 Fix crash when using multiple Sculpt Vertex Color layers for rendering
This line was probable left there after a bad merge.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D9367
2020-10-30 18:07:51 +01:00
0270223552 Merge branch 'blender-v2.91-release' 2020-10-30 17:37:23 +01:00
8b806c86e1 Fix T82027, T81718: Cycles crash with volume animation playback 2020-10-30 17:36:41 +01:00
62e532785d Refactor: move WorkSpace .blend I/O to IDTypeInfo callbacks 2020-10-30 16:32:55 +01:00
a877248ac2 Fluid: Switch to binary_python
This change is required since rB52b38d9c3d84. Why a bpy reference is there in the first place is to be investigated.
2020-10-30 16:25:43 +01:00
12c92433d8 Refactor: move bScreen .blend I/O to IDTypeInfo callbacks
I could not easily move `direct_link_screen` yet, because it
has a return value. That has to be solved differently at some point.
2020-10-30 16:01:26 +01:00
e6f61a4a37 GPencil: New material parameter to rotate texture
Add a parameter to rotate the texture for Dots and Squares

Differential Revision: https://developer.blender.org/D9369
2020-10-30 15:45:00 +01:00
aacdc39958 Merge branch 'blender-v2.91-release' into master 2020-10-30 15:34:12 +01:00
8b836f6894 Fix (unreported) buffer-overflow in new lattice code.
Follow-up to rBc0beeeb5de0cbc, fixing overflow accesses on arrays
introduced by rB042143440d76.

It's never 'OK' to access invalid memory...
2020-10-30 15:33:25 +01:00
fc9ec1b9d8 Refactor: move Area .blend I/O to blenkernel
There should be no functional changes.
Eventually, it would be good to handle the different space types
using callbacks.

Ref T76372.
2020-10-30 15:28:17 +01:00
a8c165f2a4 Merge branch 'blender-v2.91-release' 2020-10-30 15:16:04 +01:00
a1d8559a42 Fix Cycles map range node missing clamp socket
No effect on the Blender integration yet, but needs to be solved for the
upcoming change to encapsulate sockets.
2020-10-30 14:58:34 +01:00
c0beeeb5de Fix buffer-overflow in lattice deform evaluation
Caused Victor.blend from the cloud to crash with ASan. Four floats are
fetched from the stack, but the buffer was only three wide.

Caused by 042143440d. Issue was probably harmless since the fourth
element wasn't actually touched.
2020-10-30 14:56:32 +01:00
bcb612e361 Refactor: move view3dshading .blend I/O to blenkernel
Ref T76372.
2020-10-30 14:44:03 +01:00
ada45463b3 Refactor: move ParticleSettings .blend I/O to IDTypeInfo callbacks 2020-10-30 13:43:34 +01:00
f6d9a36534 Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-10-30 13:17:49 +01:00
ad35fa1993 Parenting: fix return value when parenting object to itself
Ensure parenting an object to itself is seen as error, by returning
`false`.

This error was introduced as part of a supposed-to-be-non-functional
cleanup rBb8d4a2aff8069dd7d6fb91ad0d9427eed489b68f.
2020-10-30 12:40:03 +01:00
4c7b1766a7 Fix undo steps not allowing re-using old BMain in non-global undo.
Non-memfile undo steps never properly initialized the flag allowing to
re-use old Main data during undo/redo. This lead to doing a complete
full re-reading of data when undoing/redoing mode switches e.g.

Note that current undo system is supposed to support any kind of mode
switch across those steps, however this needs to be properly deeply
tested, so only comitting this to master. It would be way too risky for
2.91 release.
2020-10-30 11:51:48 +01:00
30b17e30f8 Fluid: Cleanup for APIC debug build setup
Fixes build issue
2020-10-30 11:15:24 +01:00
57d77bd922 Cleanup: malformed doxygen sections 2020-10-30 21:10:09 +11:00
9333f660d0 Docs: note the purpose of UserDef_Runtime.is_dirty 2020-10-30 21:00:43 +11:00
08d40ecbd8 Merge branch 'blender-v2.91-release' 2020-10-30 20:56:55 +11:00
62b68745fd Merge branch 'blender-v2.91-release' 2020-10-30 20:56:52 +11:00
ebb8f8fffc Merge branch 'blender-v2.91-release' 2020-10-30 20:56:48 +11:00
841517ca81 Merge branch 'blender-v2.91-release' 2020-10-30 20:56:45 +11:00
ff73dc244c Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-10-30 10:52:25 +01:00
9ab4536218 Outliner: use undo-group for outliner mode switching
Switching modes no longer adds multiple undo steps
from a user perspective.
2020-10-30 20:50:27 +11:00
3cc6b423b1 Object: use undo-group for object.switch_object
object.switch_object no longer adds multiple undo steps
from a user perspective.
2020-10-30 20:50:22 +11:00
8d2576fd29 Undo System: support for grouping steps with begin/end calls
This adds support for treating multiple undo steps as a single step
from the user perspective.

This is needed for outliner mode switching and `object.switch_object`
operator which change active object and mode in a single action.
2020-10-30 20:48:15 +11:00
3624c06007 Fix outliner mode toggling with multi-object pose/edit mode
For edit/pose modes clicking in the mode-column would include other
selected objects (besides the active object), causing other objects to
remain in the mode even though Control wasn't held.

Also replace `ED_object_mode_generic_exit(...)` on all objects with a
single call to `ED_object_mode_set(...)` so switching modes will only
exit the current mode, leaving objects in other modes unchanged.
2020-10-30 20:48:10 +11:00
8bdf191461 Fluid: Added APIC simulation method
Basic support for velocity updates with the APIC method.

This commit adds APIC to the already existing dropdown menu for the simulation method. The APIC plugin within Mantaflow has been updated to the latest version.
2020-10-30 09:52:05 +01:00
e3e5d595f6 Outliner: Remove "ID" from tooltip
The concept of IDs shouldn't be exposed to the user.
2020-10-29 21:50:47 -06:00
b018582cd3 Cleanup: parse '--thread' as part of ARG_PASS_ENVIRONMENT
While this isn't needed at the moment, it's possible
the animation player uses the scheduler in the future.
2020-10-30 13:30:16 +11:00
6ab8cbc68c Text: support "Text to 3D Object" for read-only data
Add poll function for read-only text data,
for operators that don't require the text to be editable.
2020-10-30 12:51:38 +11:00
6250a8725e Cleanup: Use an enum to set instanced panel expansion
This commit uses an enum to access expansion for specific panels for
each modifier, constraint, etc. Even though these values are quite simple,
 this can help make the code more explicit when the ui_expand_flag is
accessed directly. Also update comments about this bitfield to make
them consistent.
2020-10-29 19:34:29 -05:00
81a0fffb2d Fix T82205: Curve Hooks not working
Caused by my own cleanup commit rBa308607a5334. Just a simple copy-paste
error. Here the difference between `curve` and `editnurb` makes quite a bit
of difference.
2020-10-29 18:21:48 -05:00
d35cd32d56 Cleanup: Use doxygen sections
After the changes in D7997, this whole file will use doxygen sections.
2020-10-29 17:37:44 -05:00
e997eb8bf7 GPencil: Fix compiler warnings
These warnings were not vivible in MSVSC
2020-10-29 23:32:19 +01:00
9e85812acc Fix macOS mouse positions inaccuracy
Don't use the current mouse position at the time the event is handled, but
rather the position at the time of the event. This should make e.g. brush
stroke paths more accurate.

In addition, this may solve issues with other software that does mouse
position smoothing. Ref T82143.

Use of the current mouse position was added in 12b642062c as part of a
large commit that also made continuous grab work. But it appears to still
work getting the mouse position from the event.
2020-10-29 22:28:28 +01:00
21f201e25e GPencil: Improve join operator
Now the strokes join the points near, not always end with start.

Differential Revision: https://developer.blender.org/D9359
2020-10-29 20:15:00 +01:00
b85504337e Refactor: move Collection .blend I/O to IDTypeInfo callbacks
This one was a bit more tricky, because the file loading is
mixed with versioning code and because collections are
embedded into scenes.

All tests that passed before, still pass.
2020-10-29 19:34:15 +01:00
7bf0682aa9 GPencil: Add interpolate operators in Draw mode
Now the interpolate is available in draw mode (except the option of selected strokes).

Differential Revision: https://developer.blender.org/D9325
2020-10-29 19:22:42 +01:00
4a8146eb8f Cycles: silence unused variable warning 2020-10-29 18:33:29 +01:00
d9b22b8094 Merge branch 'blender-v2.91-release' 2020-10-29 17:41:46 +01:00
8c3d42bd0f Fix T82129: Cycles "Persistent Images" incorrectly retains scene data
The issue stems from the fact that scene arrays are not cleared when rendering is done. This was not really an issue before the introduction of the ownership system (rB429afe0c626a) as the id_map would recreate scene data arrays based on their new content. However, now that the id_maps do not have access to the scene data anymore the arrays are never created.

Another related issue is that the BlenderSync instance is never freed when the persistent data option is activated.

To fix this, we delete nodes created by the id_maps in their destructors, and delete the BlenderSync instance before creating a new one, so the id_maps destructors are actually called.

Reviewed By: brecht

Maniphest Tasks: T82129

Differential Revision: https://developer.blender.org/D9378
2020-10-29 17:39:21 +01:00
4bf565460d Merge branch 'blender-v2.91-release' 2020-10-29 17:27:21 +01:00
2e41db5277 Fix Zoom to Mouse Position ignored when zooming out
Own mistake in rB3a1cf838ca09. Thanks to @jenkm for pointing this out.
2020-10-29 17:24:34 +01:00
Yevgeny Makarov
dfc576426b Allow Trackpad Ctrl-Pan to Cycle Enum Values
Allow Trackpad Ctrl-Pan to cycle enum values. Also allows cycling in more button types.

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

Reviewed by Brecht Van Lommel
2020-10-29 09:03:49 -07:00
c26ad42ea4 Simplify and enable NanoVDB dependency installation
Changes NanoVDB to be a standalone dependency that is independent of the OpenVDB one.
It works by downloading the "feature/nanovdb" branch of OpenVDB, but using the NanoVDB
CMake in the "nanovdb" subdirectory. Since it is header-only, only the install target is used.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9383
2020-10-29 17:02:12 +01:00
Yevgeny Makarov
c1b30e0ed1 Fix for T78211: Trackpad Zoom to Mouse Position Error
When using a trackpad Zoom to Mouse Position would always zoom to center of canvas.

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

Reviewed by Brecht Van Lommel
2020-10-29 08:27:48 -07:00
Yevgeny Makarov
962a0a6c66 Allow Building Without UI_PROP_DECORATE
Allow project to build without definition of optional UI_PROP_DECORATE.

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

Reviewed by Julian Eisel
2020-10-29 08:16:34 -07:00
f75b09e7e6 Cycles: abort rendering when --cycles-device not found
Rather than just printing a message and falling back to the CPU. For render
farms it's better to avoid a potentially slow render on the CPU if the intent
was to render on the GPU.

Ref T82193, D9086
2020-10-29 16:01:38 +01:00
09be2a8358 BLI: use forwarding reference in Map
The is necessary when Map.add_or_modify is called with callbacks that
return a reference.
2020-10-29 15:19:43 +01:00
569b7c2821 Cleanup: remove unused Blender Internal render stats code 2020-10-29 14:23:06 +01:00
f4e8c0c104 Anim UI: Playback Sync menu improvement
Relabel the Playback Synchronisation menu so that it's clear:
- what does happen (instead of describing what does //not// happen), and
- that the synchronisation options don't just affect audio.

The changes are:
- Change label from "Audio" to "Sync"
- Change the labels of the sync enum:
    - No Sync → Play Every Frame
    - Frame Dropping stays the same
    - AV-sync → Sync to Audio

The "Audio" label has moved one option down, as that option does
actually relate to audio.

Reviewed By: looch, Severin, HooglyBoogly, campbellbarton

Differential Revision: https://developer.blender.org/D9269
2020-10-29 12:31:53 +01:00
b866100c1f Cleanup: spelling 2020-10-29 21:38:40 +11:00
Yevgeny Makarov
d26b746e36 UI: use "Save As" when saving un-saved image/text files
Now the behaviors are consistent for blend, image and text files:

- If the file is not writable, will report it.
- If the file is new (without a path), save as will be used.
- If the file was deleted, will try to recreate it.

Ref D6755
2020-10-29 21:11:23 +11:00
Ivan Perevala
cf78053027 Libmv: Fix clang inconsistent-missing-override warnings.
Reviewed By: sergey, ankitm

Differential Revision: https://developer.blender.org/D9377
2020-10-29 10:19:50 +01:00
e652ea5ab3 Merge branch 'blender-v2.91-release' 2020-10-29 10:05:29 +01:00
ee4cdef4e3 RNA properties subtypes enum: sync definitions everywhere
Some subtypes never made it to all neccessary places when they were
introduced. This was throwing warnings when accessing such a properties
subtype from python.

The sub_type enums were also defined in 4 different places:
- RNA_types.h 'PropertySubType'
- rna_rna.c 'rna_enum_property_subtype_items'
- rna_rna.c 'subtype_items'
- bpy_props.c as multiple enums

This patch syncs the definitions across all places so that they are the
same everywhere. It also looks redundant to define these twice in
rna_rna.c, now just use 'rna_enum_property_subtype_items' there (and get
rid off 'subtype_items').

Also moved 'POWER' & 'TEMPERATURE' to number enum in bpy_props (these
were defined in the array enum).

Fixes T82167.

Maniphest Tasks: T82167

Differential Revision: https://developer.blender.org/D9371
2020-10-29 10:03:56 +01:00
440ed3ade8 Fix T82188: Sculpt Grab Silhouette and symmetry fails
Wasnt checking the symmetrized 'grab_delta_symmetry' so result could
flip around.

Maniphest Tasks: T82188

Differential Revision: https://developer.blender.org/D9373
2020-10-29 09:47:05 +01:00
110d6a5130 Merge branch 'blender-v2.91-release' 2020-10-29 09:45:28 +01:00
3fc97727df CustomData color copying: use interpolated alpha
The alpha of the first layer was always used
here since introduction in rBee4453f08369 and was not updated when
customdata support for alpha was added.

Now also use the interpolated alpha.

thx @brecht noticing!

ref T81914

Reviewers: brecht, mont29

Maniphest Tasks: T81914

Differential Revision: https://developer.blender.org/D9358
2020-10-29 09:41:26 +01:00
6a5d2f4ea2 Fix blend_color_interpolate_byte returning wrong alpha in certain case
When the combined alpha [the 'tmp' variable having the mixfactor applied
already] - reached zero it was handled like a no-op (for the alpha as
well) and just copied the first color.

So e.g mixing 255/255/255/255 with 0/0/0/0 with a factor of 1.0 gave
alpha of 255, which looks wrong.

cases where tmp gets zero:
src1 alpha:0 src2 alpha:whatever mixfactor 0.0
src1 alpha:whatever src2 alpha:0 mixfactor 1.0
src1 alpha:0 src2 alpha:0 mixfactor whatever

Now set alpha to zero in that case.

ref T81914

Maniphest Tasks: T81914

Differential Revision: https://developer.blender.org/D9357
2020-10-29 09:27:10 +01:00
e78ded8b0f Merge branch 'blender-v2.91-release' 2020-10-29 13:15:49 +11:00
Erik Abrahamsson
01d02e78b5 Fix 3D smooth-view ignoring lens when exiting camera view
Add NULL checks for `sview->ofs`, while it's currently never NULL
when a camera is set. The API allows for each member
to be set independently.
2020-10-29 12:45:52 +11:00
83f369a0b9 Merge branch 'blender-v2.91-release' 2020-10-29 11:29:13 +11:00
52b38d9c3d PyAPI: point sys.executable to the Python binary
`sys.executable` is documented to be a Python interpreter or None.

This was set to Blender's executable which caused the multiprocessing
module to spawn new instances of Blender instead of Python on WIN32.
See issue described in D7815.

Deprecate 'bpy.app.binary_path_python' & warn when using.

Blender's executable remains accessible via `bpy.app.binary_path`.

Modified 04c5471cee, setting `sys.executable` instead of using
Py_SetProgramName, which is needed for a bundled Python installation.
2020-10-29 11:22:39 +11:00
Yevgeny Makarov
cac8a7cddb Fix for T65714: Pinch Zooming Crash using Mac Trackpad
Ensure that Zoom does not crash on Mac Trackpad by checking for existence of Continuous Zoom timer.

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

Reviewed by Julian Eisel
2020-10-28 16:40:28 -07:00
Yevgeny Makarov
b0a9a04f62 UI: Improvements to Close File Dialog
Improved alignment of items on the File Close Dialog.

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

Reviewed by Hans Goudey
2020-10-28 16:22:37 -07:00
Yevgeny Makarov
6bf043ac94 UI: Improved alignment of labels and buttons
Improved alignment of labels with other buttons.

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

Reviewed by Julian Eisel
2020-10-28 16:01:51 -07:00
d32188b85b Mesh: Fix BKE_mesh_translate changes referenced layer
This is the same fix that is implemented in rB3791dbea1e79.
2020-10-28 20:15:50 +01:00
911f9e00d1 Animation: Improve labels on Snap menu in NLA & Dopesheet
Add "Selection to" as prefix for those menu items that move the selected
keyframes to something, for both the Key → Snap menu and the Shift+S pie
menu.

No functional changes.

This was missed in rB477d983c2e8ab298cbf638d5aadd77fad9c2f677

Differential Revision: https://developer.blender.org/D9304
2020-10-28 14:06:26 -04:00
0e47e57eb7 Outliner: Properties editor sync on selection
When outliner datablocks are selected, switch to the corresponding tab
for that datablock in properties editors. Only properties editors
that share an edge with the outliner will change tabs.

Additionally, when modifiers, constraints, and shader effects are
selected from the outliner, the panel will be expanded in all properties
editors.

Part of T77408

Manifest Task: https://developer.blender.org/T63991

Differential Revision: https://developer.blender.org/D8638
2020-10-28 11:54:29 -06:00
Yevgeny Makarov
5af8fc8192 UI: Improved Checkbox Width Calculation
Improved calculation of checkbox width to include line width preference.

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

Reviewed by Hans Goudey
2020-10-28 10:21:18 -07:00
Yevgeny Makarov
f7e4b209e2 UI: Misc Label and Description Changes
Various changes to some labels and descriptions to be more accurate, clear, or less confusing.

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

Reviewed by Hans Goudey
2020-10-28 10:10:41 -07:00
9f8acce3ab Cleanup: name parameters instead of commenting them.
It generates warning C4138 in MSVC:
> '*/' found outside of comment

Old code added in {rBafd13710b897}
2020-10-28 21:48:33 +05:30
Yevgeny Makarov
683dc71c3c UI: Improve Text on 'Color Grid' Image
Change the sequence of characters shown on the 'Color Grid' generated image.

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

Reviewed by Hans Goudey
2020-10-28 09:03:42 -07:00
Yevgeny Makarov
1ebb7afe1d UI: Popover Position Change
Move popover down a very slight amount to fix clipping of its arrow tip.

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

Reviewed by Julian Eisel
2020-10-28 08:53:41 -07:00
8c04337231 Merge branch 'blender-v2.91-release' into master 2020-10-28 21:18:55 +05:30
30ec0753c7 Revert "Fix T81077 id_management test on macOS"
This reverts commit 2ddecfffc3.

The correct fix is to compile with -fno-strict-aliasing on
release/relwithdebinfo builds also.

See the last commit/ {D9372}.

Maniphest Task T81077
2020-10-28 20:54:10 +05:30
fc6a1f44d2 macOS: use -fno-strict-aliasing for all build types.
The old code was added in {rBbaa4a9c7d4dd}

While the hotfix committed in {rB2ddecfffc3d3a3a1db4ae45e8665ca} fixed
the id_management test, the correct reason was found at
https://bugs.llvm.org/show_bug.cgi?id=47984

This matches the behavior on Linux.
2020-10-28 20:53:32 +05:30
a087196a45 GPencil: Change trace tooltip for Threshold 2020-10-28 16:07:33 +01:00
abdd0198c0 GPencil: Change Trace tooltips 2020-10-28 15:41:16 +01:00
a5d237ac85 GPencil: New support to trace sequence images
Now it's possible to trace a sequence of images and not just a single one

When the trace is for more than one image, a bacth job is started to process all frames.

Note: All trace data is generated by Potrace library.

Differential revision: https://developer.blender.org/D9316
2020-10-28 15:36:01 +01:00
73378c2ba2 BLI: improve Map.add_new
Now it is possible to use Map.add_new_as which supports different types
for the key and value.
2020-10-28 13:57:53 +01:00
322b6ac52b UI: Save Preferences Button Not Translating
Ref D9338
2020-10-28 23:04:50 +11:00
4921b5d1c9 UI: Save Preferences Button Not Translating
Ref D9338
2020-10-28 22:57:54 +11:00
70040e7b0b Cycles: internal support for alpha output for attribute node
Not exposed in Blender yet.

Ref D2057
2020-10-28 12:43:42 +01:00
b7558e3c9c Cycles: internal support for per-instance and per-geometry attributes
The existing code for this was incomplete. Each instance can now have a set
of attributes stored separately from geometry attributes. Geometry attributes
take precedence over instance attributes.

Ref D2057
2020-10-28 12:43:42 +01:00
0767683496 Cycles: refactor to make attribute lookup slightly more efficient
Ref D2057
2020-10-28 12:43:42 +01:00
d58b55b55a Cycles: internal support for float4 geometry attributes
Previously only float3 and byte4 was supported.

Ref D2057
2020-10-28 12:43:42 +01:00
ee6b989f8e Cycles: refactor to split surface and volume attribute lookup more
This avoids OpenCL inlining heavy volume interpolation code once for every
data type, which could cause a performance regression when we add a float4
data type in the next commit.

Ref D2057
2020-10-28 12:43:42 +01:00
fb88d4eda8 Add a Un-Bake FCurves operator
We already had the ability to bake fcurves but no way to convert the
baked result back without using python. This patch adds and operator
that is available now next to the bake operator in the drop down menu,

Reviewed By: Sybren

Differential Revision: http://developer.blender.org/D6379
2020-10-28 11:45:24 +01:00
2f7c6149fc Merge branch 'blender-v2.91-release' into master 2020-10-28 11:08:42 +01:00
Bastien Montagne
0d772221c6 Fix T82149: Blender crash when using collection user_id remapping (python).
Not sure why Collection was the only ID for which depsgraph building did
not check for potential recursion?

Reviewed By: sergey

Maniphest Tasks: T82149

Differential Revision: https://developer.blender.org/D9365
2020-10-28 11:05:25 +01:00
2468635174 Tracking: Move optical center to lens panel
Optical center is in fact a property of lens rather than a camera body.
2020-10-28 10:39:37 +01:00
0269f0c574 Tracking: Simplify configuration of intrinsics to refine
Previously, only predefined and limited set of intrinsics combinations
could have been refined. This was caused by a bundle adjustment library
used in the early days of the solver.

Now it is possible to fully customize which intrinsics are to be refined
during camera solving. Internally solver supports per-parameter settings
but in the interface they are grouped as following:

* Focal length
* Optical center
* Radial distortion coefficients (which includes k1, k2, k3, k4)
* Tangential distortion coefficients (which includes p1, p2)

Differential Revision: https://developer.blender.org/D9294
2020-10-28 10:21:07 +01:00
1b1f46a98c Libmv: Fix typo in packed intrinsics
Was using doing an implicit cast of floating point value to boolean.
Was not noticed before because the boolean value was never never used.
2020-10-28 10:13:08 +01:00
283c7fecf9 Tracking: Decouple refine settings
Historically the refine options had a hardcoded list of possibilities.
This was caused by an old bundle adjustment code which did not support
all possible combinations.

Now the bundle adjuster is based on Ceres solver, allowing to refine
anything in any combination.
2020-10-28 10:13:08 +01:00
02ecf29d05 Merge branch 'blender-v2.91-release' 2020-10-28 19:43:58 +11:00
a8ca79cbe6 Revert "PyAPI: point sys.executable to the Python binary"
This reverts commit 04c5471cee.

This causes Blender not to start on some systems.
2020-10-28 19:40:52 +11:00
6527a14cd2 PyAPI: remove bpy.app.binary_path_python
This is deprecated in 2.91,
remove for 2.92 in favor of 'sys.executable'.
2020-10-28 17:40:07 +11:00
fb3f0d3cf0 Merge branch 'blender-v2.91-release' 2020-10-28 17:33:17 +11:00
4f24808d08 Fix T82049: material select button now only works for active object
Include edit-mode objects from space-properties context
unless there is a pinned object.

Regression caused by change in 12bc34b0b8.
2020-10-28 17:30:12 +11:00
1be819ea66 Cleanup: update comments
Some references to argument levels were still in comments.
2020-10-28 16:00:26 +11:00
a0f2866a8e Cleanup: update old comment for why we can't use PySys_SetArgv 2020-10-28 14:04:44 +11:00
58fc155976 Cleanup: move WM_init & arg parsing out of if/else branch 2020-10-28 14:04:44 +11:00
6445caa9b5 BLI_args: disallow zero to be used as a pass value
Introduced recently in 09139e41ed.
While this worked in the cases it was used, '--threads' for example
was failing to parse the number when it's pass was set to 0.

Increase the enum values to start at 1 &
add asserts so this wont happen again.
2020-10-28 14:04:44 +11:00
c518cd73cd Cleanup: use enum for command line argument passes 2020-10-28 14:04:44 +11:00
6ac46c9708 BLI_args: refactor argument passes
Avoid passing the pass argument to BLI_argsAdd, instead set this
once for each group of passes.

This means we can add new passes without having to bump the arguments
to BLI_argsAdd.
2020-10-28 14:04:41 +11:00
5711b85147 Cleanup: Remove unused IDProperty function
This function from 2017 came with a comment: "TODO Nuke this once its
only user has been correctly converted to use generic IDmanagement"
Since it is unused after rB91462fbb31ba, now is time to remove it.

Differential Revision: https://developer.blender.org/D9368
2020-10-27 20:12:42 -05:00
9dac5456b9 Merge branch 'blender-v2.91-release' 2020-10-28 11:52:15 +11:00
04c5471cee PyAPI: point sys.executable to the Python binary
`sys.executable` is documented to be a Python interpreter or None.

This was set to Blender's executable which caused the multiprocessing
module to spawn new instances of Blender instead of Python on WIN32.
See issue described in D7815.

Deprecate 'bpy.app.binary_path_python' & warn when using.

Blender's executable remains accessible via `bpy.app.binary_path`.
2020-10-28 11:49:29 +11:00
Yevgeny Makarov
d28676d89a UI: Move the 'Resolve Conflict' button closer to the text data-block
Moves the Text Editor 'Resolve Conflict' button closer to data-block selector and with 'Question' icon.

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

Reviewed by Hans Goudey
2020-10-27 16:30:37 -07:00
024b65b5e5 Cleanup: Update comment
This comment has to be updated since it was moved
from the header file to the source file.
2020-10-27 17:14:40 -05:00
1504ed99e6 Fix use after free in interface handler
ASAN reported a use after free in after rB15d78ea85b602c. This commit
removed a reassignment of the `data` variable here that was actually
required because it may have been freed earlier in the function. This
sort of error would be avoided if the same variable wasn't reused for
different purposes.
2020-10-27 13:44:47 -05:00
c80594f57f GPencil: New parameter in Texture modifier to rotate Dot textures
This new parameter allows to rotate the texture of any Dot or Square stroke.

Differential Revision:  https://developer.blender.org/D9343
2020-10-27 17:59:48 +01:00
3a7a936525 Merge branch 'blender-v2.91-release' 2020-10-27 17:39:59 +01:00
bee5921e82 GPencil: Fix unreported Fill when use boundary and Visble layers
The new option to filter the layers used by the Fill tool was not using the boundary strokes. The problem was the layers were skipped and any boundary stroke was not used.

Now, the layer is not skipped, but the strokes that are not boundary are skipped.
2020-10-27 17:38:44 +01:00
471c0bcd44 git blame: add file to help ignore cleanup commits
wiki.blender.org/wiki/Tools/Git#Tips has been updated.

A follow up to
lists.blender.org/pipermail/bf-committers/2020-October/050698.html
will be sent after commit.

Reviewed By: brecht, campbellbarton

Differential Revision: https://developer.blender.org/D9234
2020-10-27 20:20:39 +05:30
90e12e823f Fix T81854: crash when undoing switch between sculpt and edit mode.
The logic of `BKE_sculpt_update_object_for_edit` was not correct. such
low-level functions should typically never preform depsgraph evaluation
themselves, they should be able to rely on getting a fully evaluated
depsgraph and just get needed data from there.

Supporting that required fixing other broken code higher in the
callstack, namely:
* `ED_object_sculptmode_enter_ex` was freeing evaluated data, for no
  valid reason it would seem.
* `sculpt_undosys_step_decode` was ensuring an evaluated depsgraph
  **before** calling `ED_object_mode_generic_exit`, which would
  invalidate a lot of evaluated data.

Note that it is fairly difficult to track down all code paths leading to
`BKE_sculpt_update_object_for_edit`, so there may be still cases where
this gets called with improperly evaluated depsgraph.

Reviewed By: sergey

Maniphest Tasks: T81854

Differential Revision: https://developer.blender.org/D9270
2020-10-27 15:27:07 +01:00
f6990c235a Merge branch 'blender-v2.91-release' 2020-10-27 15:13:39 +01:00
4975aa410c Fix T81844: Change Bone Layers fails in Pose Mode
When selecting multiple layers, the redo operator might not correctly
update the pose data. To make sure it is in a good state we have to
ensure that the pose data is good.

Reviewed By: Bastien

Differential Revision: http://developer.blender.org/D9354
2020-10-27 15:10:44 +01:00
4b188bb08c Cleanup: use over-line for doxy comments
Follow our code style for doxygen sections.
2020-10-27 21:45:55 +11:00
30f626fe4c Revert "Cycles API: encapsulate Node socket members"
This reverts commit 527f8b32b3. It is causing
motion blur test failures and crashes in some renders, reverting until this is
fixed.
2020-10-27 11:40:42 +01:00
17381c7b90 Multires: Remove simple subdivision type
The simple subdivision as a type only causes issues like no-continuous
normals across edges, inability to reliably switch the type and things
like this.

The new subdivision operators supports wider variety of how to add
details to the model, which are more powerful than a single one-time
decision on the subdivision type.

The versioning code is adjusting topology converter to specify all
edges as infinitely sharp. The reason for this (instead of using
settings.is_simple) is because in a longer term the simple subdivision
will be removed from Subsurf modifier as well, and will be replaced
with more efficient bmesh-based modifier.

This is finished up version of D8436.

Differential Revision: https://developer.blender.org/D9350
2020-10-27 10:31:48 +01:00
09139e41ed Cleanup: simplify order of initialization with argument parsing
Sub-systems that use directories from BKE_appdir needed to be
initialized after parsing '--env-system-datafiles'.

This meant the animation player needed to call IMB_init it's self.

Avoid this complication by having a pass that can be used to setup
the environment before Blender's resources are accessed.

This reverts the workaround from 9ea345d1cf
2020-10-27 18:45:42 +11:00
Ivan Perevala
eebe274312 RNA: remove duplicate of Brush.tex_paint_map_mode
Use Brush.map_mode instead.

Ref D9290
2020-10-27 17:38:29 +11:00
4d15f4ac5b Cleanup: Use const for PointCloud variable 2020-10-26 23:12:22 -05:00
c686951233 Cleanup: improve comment about shape keys, correct spelling 2020-10-27 14:16:26 +11:00
6133159311 Merge branch 'blender-v2.91-release' 2020-10-27 14:13:39 +11:00
5e8c135540 Merge branch 'blender-v2.91-release' 2020-10-27 14:13:35 +11:00
Erik Abrahamsson
77a6b6fb1a Fix T80819: Border zoom is isn't accurate in perspective view
Improved user experience by using viewport focal length
to calculate the new camera distance.

Also resizing the border to the same aspect ratio as
the window will help not zooming in more than expected.

Ref D9341
2020-10-27 14:10:58 +11:00
66800a1deb BLI_rect: add resize_x/y functions
Without this, it's inconvenient to resize a single axis
and doesn't read very well.
2020-10-27 14:07:34 +11:00
Erik Abrahamsson
716af6a470 Modifier: apply modifier now works for lattice
Ref D9337
2020-10-27 13:27:08 +11:00
527f8b32b3 Cycles API: encapsulate Node socket members
This encapsulates Node socket members behind a set of specific methods;
as such it is no longer possible to directly access Node class members
from exporters and parts of Cycles.

The methods are defined via the NODE_SOCKET_API macros in `graph/
node.h`, and are for getting or setting a specific socket's value, as
well as querying or modifying the state of its update flag.

The setters will check whether the value has changed and tag the socket
as modified appropriately. This will let us know how a Node has changed
and what to update, which is the first concrete step toward a more
granular scene update system.

Since the setters will tag the Node sockets as modified when passed
different data, this patch also removes the various `modified` methods
on Nodes in favor of `Node::is_modified` which checks the sockets'
update flags status.

Reviewed By: brecht

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D8544
2020-10-26 23:11:14 +01:00
Pablo Dobarro
d6180dd2f7 Sculpt/Paint: Add Paint Studio Light preset
This studio light preset is designed for color painting tasks. As color
are multiplied on top of the current studio light/matcap, this should be
as white as possible and with very soft speculars to avoid color
distorsion while showing the volume of the mesh.

Reviewed By: jbakker, JulienKaspar

Differential Revision: https://developer.blender.org/D8209
2020-10-26 20:35:37 +01:00
45e8218f90 Merge branch 'blender-v2.91-release' into master 2020-10-26 18:35:34 +01:00
edf4378c44 Fix own previous commit re testing of BLI_rel_path.
Windows would need its own version of those tests, for now just
disabling them on that platform.
2020-10-26 18:29:54 +01:00
183c2fe031 Merge branch 'blender-v2.91-release' into master 2020-10-26 17:37:16 +01:00
01d3fbc496 Fix T81421: "Saving As..." a blend file with a Script node file path filled with 1023 symbols crashes Blender.
Usual lack of protection against buffer overflows when manipulating
strings.

Also add some basic tests for `BLI_path_rel`.
2020-10-26 17:36:53 +01:00
501854e4ee Fix T81421: "Saving As..." a blend file with a Script node file path filled with 1023 symbols crashes Blender.
Usual lack of protection against buffer overflows when manipulating
strings.

Also add some basic tests for `BLI_path_rel`.
2020-10-26 17:22:34 +01:00
253ae3d3f0 Merge branch 'blender-v2.91-release' 2020-10-26 16:33:54 +01:00
47eabae951 UI: Datatransfer modifier: set mix factor inactive when not in use
For Customdata layer copying, interpolation with the mixfactor is only
done for certain mix modes, now set the UI inactive if the mixfactor is
not in use.

Namely, the modes are the "Above / Below Threshold" which are only used
for flags, colors and normals and mixing is not supported in these cases.

Spotted while looking into T81914.

Differential Revision: https://developer.blender.org/D9327
2020-10-26 16:24:22 +01:00
841eaebfa4 Cycles: Add support for OptiX 7.2 SDK 2020-10-26 15:43:55 +01:00
9d24d1b20c Merge branch 'blender-v2.91-release' 2020-10-26 14:34:03 +01:00
5365409ec0 Fix T82079: Missing viewport redraw changing volume slicing axis
Send appropriate notifiers (via rna_Volume_update_display).

Maniphest Tasks: T82079

Differential Revision: https://developer.blender.org/D9351
2020-10-26 14:31:30 +01:00
786e160aff Merge remote-tracking branch 'origin/blender-v2.91-release' 2020-10-26 13:52:36 +01:00
8a51178df9 Fix: Animation, Draw active keyframe handles only when Bézier
Draw the handles for the active keyframe only when the interpolation type
is set to Bézier. This now matches the behaviour of handles of regular
(non-active) keyframes.
2020-10-26 13:52:12 +01:00
d62309a20e Fix T81890: Active keyframe changes on deselect of keyframe
Activate an FCurve only on selecting, and not on deselecting a keyframe
or a handle.

Reviewed By: HooglyBoogly, Severin, looch, #animation_rigging

Differential Revision: https://developer.blender.org/D9328
2020-10-26 13:52:12 +01:00
4d5e0a8520 Merge branch 'blender-v2.91-release' 2020-10-26 13:07:00 +01:00
Philipp Oeser
f76f48c3d3 Fix T69911: Adaptive subdivision offscreen dicing does not work correctly if the camera is shifted
Code was assuming frustrum planes are symmetrical which is not the case
for shifting. This lead to a shrinking region if shift was negative (and
a growing region if shift was positive)

So instead of only keeping track of plane on one side (and mirroring
over in code) get the actual planes after shifting and use these
instead.

This code corrects this for ortho and perspective cameras, it does not
touch panoramic cameras.

Reviewed By: brecht

Maniphest Tasks: T69911

Differential Revision: https://developer.blender.org/D9342
2020-10-26 12:52:25 +01:00
ae5fd92228 Fix T81893: Cycles viewport crash changing mesh to smoke domain
Now that volume is a dedicated geometry type in Cycles, we need to re-allocate
the geometry when a mesh changes into a volume.
2020-10-26 12:31:01 +01:00
6fc0d743f1 Cleanup: compiler warnings 2020-10-26 12:31:01 +01:00
57fc44de6c Merge branch 'blender-v2.91-release' 2020-10-26 22:06:57 +11:00
9969c2dd16 Fix custom-normal support for mesh editing operations
Account for custom normals for edit-mesh tools:

- Limited Dissolve
- Split
- Split (Edges/Vertices)
- Triangulate
2020-10-26 22:02:31 +11:00
1585 changed files with 37696 additions and 31123 deletions

View File

@@ -15,7 +15,6 @@ Checks: >
-readability-misleading-indentation,
-readability-redundant-member-init,
-readability-use-anyofallof,
-readability-function-cognitive-complexity,
@@ -33,4 +32,20 @@ Checks: >
-bugprone-exception-escape,
-bugprone-redundant-branch-condition,
modernize-*,
-modernize-use-auto,
-modernize-use-trailing-return-type,
-modernize-deprecated-headers,
-modernize-avoid-c-arrays,
-modernize-use-equals-default,
-modernize-use-nodiscard,
-modernize-use-using,
-modernize-loop-convert,
-modernize-pass-by-value,
-modernize-use-default-member-init,
-modernize-raw-string-literal,
-modernize-avoid-bind,
-modernize-use-override,
-modernize-use-transparent-functors,
WarningsAsErrors: '*'

93
.git-blame-ignore-revs Normal file
View File

@@ -0,0 +1,93 @@
# git config blame.ignoreRevsFile .git-blame-ignore-revs
#
# After running the above, commits listed in this file will be
# ignored by git blame. The blame will be shifted to the person
# who edited the line(s) before the ignored commit.
#
# To disable this ignorance for a command, run as follows
# git blame --ignore-revs-file="" <other options>
#
# Changes that belong here:
# - Massive comment, doxy-sections, or spelling corrections.
# - Clang-format, PEP8 or other automated changes which are *strictly* "no functional change".
# - Several smaller commits should be added to this list at once, because adding
# one extra commit (to edit this file) after every small cleanup is noisy.
#
# Note:
# - The comment above the SHA should be the first line of the commit.
# - It is fine to pack together similar commits if they have the same explanatory comment.
# - Use only 40 character git SHAs; not smaller ones, not prefixed with rB.
#
# https://git-scm.com/docs/git-blame/2.23.0
# white space commit. (2 spaces -> tab).
0a3694cd6ebec710da7110e9f168a72d47c71ee0
# Cycles: Cleanup, spacing after preprocessor
cb4b5e12abf1fc6cf9ffc0944e0a1bc406286c63
# ClangFormat: apply to source, most of intern
e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1
# Code Style: use "#pragma once" in source directory
91694b9b58ab953f3b313be9389cc1303e472fc2
# Code Style: use "#pragma once" in some newer headers
8198dbb888856b8c11757586df02aca15f132f90
# Code Style: use "#pragma once" in intern/ghost
1b1129f82a9cf316b54fbc025f8cfcc1a74b8589
# Cleanup: mostly comments, use doxy syntax & typos
e0cb02587012b4b2f4b18363dc7d0a7da2c02093
# Cleanup: use C comments for descriptive text
2abfcebb0eb7989e3d1e7d03f37ecf5c088210af
# use lowercase for cmake builtin names and macros, remove contents in else() and endif() which is no longer needed.
afacd184982e58a9c830a3d5366e25983939a7ba
# Spelling: It's Versus Its
3a7fd309fce89213b0224b3c6807adb2d1fe7ca8
# Spelling: Then Versus Than
d1eefc421544e2ea632fb35cb6bcaade4c39ce6b
# Spelling: Miscellaneous
84ef3b80de4915a24a9fd2fd214d0fa44e59b854
# Spelling: Loose Versus Lose
c0a6bc19794c69843c38451c762e91bc10136e0f
# Spelling: Apart Versus A Part
3d26cd01b9ba6381eb165e11536345ae652dfb41
# Cleanup: use 2 space indentation for CMake
3076d95ba441cd32706a27d18922a30f8fd28b8a
# Cleanup: use over-line for doxy comments
4b188bb08cf5aaae3c68ab57bbcfa037eef1ac10
# Cleanup: General comment style clean up of graph_edit.c and fcurve.c
0105f146bb40bd609ccbda3d3f6aeb8e14ad3f9e
# Cleanup: pep8 (indentation, spacing, long lines)
41d2d6da0c96d351b47acb64d3e0decdba16cb16
# Cleanup: pep8, blank lines
bab9de2a52929fe2b45ecddb1eb09da3378e303b
# Cleanup: PEP8 for python changes
1e7e94588daa66483190f45a9de5e98228f80e05
# GPencil: Cleanup pep8
a09cc3ee1a99f2cd5040bbf30c8ab8c588bb2bb1
# Cleanup: trailing space, remove tabs, pep8
c42a6b77b52560d257279de2cb624b4ef2c0d24c
# Cleanup: use C style doxygen comments
8c1726918374e1d2d2123e17bae8db5aadde3433
# Cleanup: use doxy sections for imbuf
c207f7c22e1439e0b285fba5d2c072bdae23f981

View File

@@ -203,7 +203,7 @@ option(WITH_OPENVDB "Enable features relying on OpenVDB" ON)
option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" ON)
option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled with version 3 ABI compatibility" OFF)
mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
option(WITH_NANOVDB "Enable usage of NanoVDB data structure for accelerated rendering on the GPU" OFF)
option(WITH_NANOVDB "Enable usage of NanoVDB data structure for rendering on the GPU" ON)
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
@@ -526,10 +526,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
# Silence the warning that object-size is not effective in -O0.
set(_asan_defaults "${_asan_defaults}")
else()
set(_asan_defaults "${_asan_defaults} -fsanitize=object-size")
string(APPEND _asan_defaults " -fsanitize=object-size")
endif()
else()
set(_asan_defaults "${_asan_defaults} -fsanitize=leak -fsanitize=object-size")
string(APPEND _asan_defaults " -fsanitize=leak -fsanitize=object-size")
endif()
set(COMPILER_ASAN_CFLAGS "${_asan_defaults}" CACHE STRING "C flags for address sanitizer")
@@ -570,6 +570,11 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
option(WITH_COMPILER_SHORT_FILE_MACRO "Make paths in macros like __FILE__ relative to top level source and build directories." ON)
mark_as_advanced(WITH_COMPILER_SHORT_FILE_MACRO)
endif()
if(WIN32)
# Use hardcoded paths or find_package to find externals
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
@@ -858,11 +863,11 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Release")
# Since linker flags are not set, all compiler checks and `find_package`
# calls that rely on `try_compile` will fail.
# See CMP0066 also.
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CFLAGS}")
string(APPEND CMAKE_C_FLAGS_DEBUG " ${COMPILER_ASAN_CFLAGS}")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " ${COMPILER_ASAN_CFLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMPILER_ASAN_CXXFLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${COMPILER_ASAN_CXXFLAGS}")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${COMPILER_ASAN_CXXFLAGS}")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " ${COMPILER_ASAN_CXXFLAGS}")
endif()
if(MSVC)
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
@@ -941,11 +946,11 @@ endif()
# Do it globally, SSE2 is required for quite some time now.
# Doing it now allows to use SSE/SSE2 in inline headers.
if(SUPPORT_SSE_BUILD)
set(PLATFORM_CFLAGS " ${COMPILER_SSE_FLAG} ${PLATFORM_CFLAGS}")
string(PREPEND PLATFORM_CFLAGS "${COMPILER_SSE_FLAG} ")
add_definitions(-D__SSE__ -D__MMX__)
endif()
if(SUPPORT_SSE2_BUILD)
set(PLATFORM_CFLAGS " ${PLATFORM_CFLAGS} ${COMPILER_SSE2_FLAG}")
string(APPEND PLATFORM_CFLAGS " ${COMPILER_SSE2_FLAG}")
add_definitions(-D__SSE2__)
if(NOT SUPPORT_SSE_BUILD) # don't double up
add_definitions(-D__MMX__)
@@ -1157,8 +1162,8 @@ if(WITH_OPENMP)
if(OPENMP_FOUND)
if(NOT WITH_OPENMP_STATIC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
string(APPEND CMAKE_C_FLAGS " ${OpenMP_C_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${OpenMP_CXX_FLAGS}")
else()
# Typically avoid adding flags as defines but we can't
# pass OpenMP flags to the linker for static builds, meaning
@@ -1517,6 +1522,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
@@ -1527,6 +1533,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
@@ -1536,6 +1543,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNDEFINED_VAR_TEMPLATE -Wno-undefined-var-template)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_INSTANTIATION_AFTER_SPECIALIZATION -Wno-instantiation-after-specialization)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
@@ -1548,8 +1556,8 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
# disable numbered, false positives
set(C_WARNINGS "${C_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
set(CXX_WARNINGS "${CXX_WARNINGS} -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
string(APPEND C_WARNINGS " -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
string(APPEND CXX_WARNINGS " -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
# most msvc warnings are C & C++
set(_WARNINGS
@@ -1580,7 +1588,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
if(MSVC_VERSION GREATER_EQUAL 1911)
# see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038?view=vs-2017
set(_WARNINGS "${_WARNINGS} /w35038") # order of initialization in c++ constructors
string(APPEND _WARNINGS " /w35038") # order of initialization in c++ constructors
endif()
string(REPLACE ";" " " _WARNINGS "${_WARNINGS}")
@@ -1621,19 +1629,19 @@ if(WITH_PYTHON)
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
string(APPEND CMAKE_CXX_FLAGS " /std:c++17")
# Make MSVC properly report the value of the __cplusplus preprocessor macro
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
# of the C++ standard chosen above
if(MSVC_VERSION GREATER 1913)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
endif()
elseif(
CMAKE_COMPILER_IS_GNUCC OR
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
CMAKE_C_COMPILER_ID MATCHES "Intel"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
string(APPEND CMAKE_CXX_FLAGS " -std=c++17")
else()
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++17 build")
endif()
@@ -1646,12 +1654,47 @@ if(
(CMAKE_C_COMPILER_ID MATCHES "Intel")
)
# Use C11 + GNU extensions, works with GCC, Clang, ICC
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
string(APPEND CMAKE_C_FLAGS " -std=gnu11")
endif()
if(UNIX AND NOT APPLE)
if(NOT WITH_CXX11_ABI)
set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
string(APPEND PLATFORM_CFLAGS " -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
endif()
if(WITH_COMPILER_SHORT_FILE_MACRO)
# Use '-fmacro-prefix-map' for Clang and GCC (MSVC doesn't support this).
ADD_CHECK_C_COMPILER_FLAG(C_PREFIX_MAP_FLAGS C_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_PREFIX_MAP_FLAGS CXX_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
if(C_MACRO_PREFIX_MAP AND CXX_MACRO_PREFIX_MAP)
if(APPLE)
if(XCODE AND ${XCODE_VERSION} VERSION_LESS 12.0)
# Developers may have say LLVM Clang-10.0.1 toolchain (which supports the flag)
# with Xcode-11 (the Clang of which doesn't support the flag).
message(WARNING
"-fmacro-prefix-map flag is NOT supported by Clang shipped with Xcode-${XCODE_VERSION}."
" Some Xcode functionality in Product menu may not work. Disabling WITH_COMPILER_SHORT_FILE_MACRO."
)
set(WITH_COMPILER_SHORT_FILE_MACRO OFF)
endif()
endif()
if(WITH_COMPILER_SHORT_FILE_MACRO)
path_ensure_trailing_slash(_src_dir "${CMAKE_SOURCE_DIR}")
path_ensure_trailing_slash(_bin_dir "${CMAKE_BINARY_DIR}")
# Keep this variable so it can be stripped from build-info.
set(PLATFORM_CFLAGS_FMACRO_PREFIX_MAP
"-fmacro-prefix-map=\"${_src_dir}\"=\"\" -fmacro-prefix-map=\"${_bin_dir}\"=\"\"")
string(APPEND PLATFORM_CFLAGS " ${PLATFORM_CFLAGS_FMACRO_PREFIX_MAP}")
unset(_src_dir)
unset(_bin_dir)
endif()
else()
message(WARNING
"-fmacro-prefix-map flag is NOT supported by C/C++ compiler."
" Disabling WITH_COMPILER_SHORT_FILE_MACRO."
)
set(WITH_COMPILER_SHORT_FILE_MACRO OFF)
endif()
endif()
@@ -1755,7 +1798,7 @@ if(FIRST_RUN)
set(_msg " - ${_setting}")
string(LENGTH "${_msg}" _len)
while("32" GREATER "${_len}")
set(_msg "${_msg} ")
string(APPEND _msg " ")
math(EXPR _len "${_len} + 1")
endwhile()
@@ -1773,24 +1816,24 @@ if(FIRST_RUN)
message(STATUS "C++ Compiler: \"${CMAKE_CXX_COMPILER_ID}\"")
info_cfg_text("Build Options:")
info_cfg_option(WITH_ALEMBIC)
info_cfg_option(WITH_BULLET)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_FFTW3)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_INPUT_NDOF)
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_FFTW3)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_GMP)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_INPUT_NDOF)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_OPENCOLORIO)
info_cfg_option(WITH_XR_OPENXR)
info_cfg_option(WITH_OPENIMAGEDENOISE)
info_cfg_option(WITH_OPENVDB)
info_cfg_option(WITH_ALEMBIC)
info_cfg_option(WITH_QUADRIFLOW)
info_cfg_option(WITH_USD)
info_cfg_option(WITH_TBB)
info_cfg_option(WITH_GMP)
info_cfg_option(WITH_USD)
info_cfg_option(WITH_XR_OPENXR)
info_cfg_text("Compiler Options:")
info_cfg_option(WITH_BUILDINFO)
@@ -1798,58 +1841,58 @@ if(FIRST_RUN)
info_cfg_text("System Options:")
info_cfg_option(WITH_INSTALL_PORTABLE)
info_cfg_option(WITH_MEM_JEMALLOC)
info_cfg_option(WITH_MEM_VALGRIND)
info_cfg_option(WITH_SYSTEM_GLEW)
info_cfg_option(WITH_X11_ALPHA)
info_cfg_option(WITH_X11_XF86VMODE)
info_cfg_option(WITH_X11_XFIXES)
info_cfg_option(WITH_X11_XINPUT)
info_cfg_option(WITH_MEM_JEMALLOC)
info_cfg_option(WITH_MEM_VALGRIND)
info_cfg_option(WITH_SYSTEM_GLEW)
info_cfg_text("Image Formats:")
info_cfg_option(WITH_OPENIMAGEIO)
info_cfg_option(WITH_IMAGE_CINEON)
info_cfg_option(WITH_IMAGE_DDS)
info_cfg_option(WITH_IMAGE_HDR)
info_cfg_option(WITH_IMAGE_OPENEXR)
info_cfg_option(WITH_IMAGE_OPENJPEG)
info_cfg_option(WITH_IMAGE_TIFF)
info_cfg_option(WITH_OPENIMAGEIO)
info_cfg_text("Audio:")
info_cfg_option(WITH_OPENAL)
info_cfg_option(WITH_SDL)
info_cfg_option(WITH_SDL_DYNLOAD)
info_cfg_option(WITH_JACK)
info_cfg_option(WITH_JACK_DYNLOAD)
info_cfg_option(WITH_CODEC_AVI)
info_cfg_option(WITH_CODEC_FFMPEG)
info_cfg_option(WITH_CODEC_SNDFILE)
info_cfg_option(WITH_JACK)
info_cfg_option(WITH_JACK_DYNLOAD)
info_cfg_option(WITH_OPENAL)
info_cfg_option(WITH_SDL)
info_cfg_option(WITH_SDL_DYNLOAD)
info_cfg_text("Compression:")
info_cfg_option(WITH_LZMA)
info_cfg_option(WITH_LZO)
info_cfg_text("Python:")
if(APPLE)
info_cfg_option(WITH_PYTHON_FRAMEWORK)
endif()
info_cfg_option(WITH_PYTHON_INSTALL)
info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
info_cfg_option(WITH_PYTHON_MODULE)
info_cfg_option(WITH_PYTHON_SAFETY)
if(APPLE)
info_cfg_option(WITH_PYTHON_FRAMEWORK)
endif()
info_cfg_text("Modifiers:")
info_cfg_option(WITH_MOD_REMESH)
info_cfg_option(WITH_MOD_FLUID)
info_cfg_option(WITH_MOD_OCEANSIM)
info_cfg_option(WITH_MOD_REMESH)
info_cfg_text("OpenGL:")
info_cfg_option(WITH_GLEW_ES)
info_cfg_option(WITH_GL_EGL)
info_cfg_option(WITH_GL_PROFILE_ES20)
if(WIN32)
info_cfg_option(WITH_GL_ANGLE)
endif()
info_cfg_option(WITH_GL_EGL)
info_cfg_option(WITH_GL_PROFILE_ES20)
info_cfg_option(WITH_GLEW_ES)
info_cfg_text("")

View File

@@ -85,6 +85,7 @@ include(cmake/flexbison.cmake)
include(cmake/osl.cmake)
include(cmake/tbb.cmake)
include(cmake/openvdb.cmake)
include(cmake/nanovdb.cmake)
include(cmake/python.cmake)
include(cmake/python_site_packages.cmake)
include(cmake/package_python.cmake)

View File

@@ -43,7 +43,7 @@ if(UNIX)
if(APPLE)
if(NOT EXISTS "/usr/local/opt/bison/bin/bison")
set(_software_missing "${_software_missing} bison")
string(APPEND _software_missing " bison")
endif()
endif()

View File

@@ -146,10 +146,8 @@ harvest(openjpeg/lib openjpeg/lib "*.a")
harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
if(WITH_NANOVDB)
harvest(openvdb/nanovdb nanovdb/include/nanovdb "*.h")
endif()
harvest(openvdb/lib openvdb/lib "*.a")
harvest(nanovdb/nanovdb nanovdb/include/nanovdb "*.h")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
harvest(osl/bin osl/bin "oslc")

View File

@@ -0,0 +1,54 @@
# ***** 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 *****
set(NANOVDB_EXTRA_ARGS
# NanoVDB is header-only, so only need the install target
-DNANOVDB_BUILD_UNITTESTS=OFF
-DNANOVDB_BUILD_EXAMPLES=OFF
-DNANOVDB_BUILD_BENCHMARK=OFF
-DNANOVDB_BUILD_DOCS=OFF
-DNANOVDB_BUILD_TOOLS=OFF
-DNANOVDB_CUDA_KEEP_PTX=OFF
# Do not need to include any of the dependencies because of this
-DNANOVDB_USE_OPENVDB=OFF
-DNANOVDB_USE_OPENGL=OFF
-DNANOVDB_USE_OPENCL=OFF
-DNANOVDB_USE_CUDA=OFF
-DNANOVDB_USE_TBB=OFF
-DNANOVDB_USE_BLOSC=OFF
-DNANOVDB_USE_ZLIB=OFF
-DNANOVDB_USE_OPTIX=OFF
-DNANOVDB_ALLOW_FETCHCONTENT=OFF
)
ExternalProject_Add(nanovdb
URL ${NANOVDB_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${NANOVDB_HASH}
PREFIX ${BUILD_DIR}/nanovdb
SOURCE_SUBDIR nanovdb
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/nanovdb ${DEFAULT_CMAKE_FLAGS} ${NANOVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/nanovdb
)
if(WIN32)
ExternalProject_Add_Step(nanovdb after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/nanovdb/nanovdb ${HARVEST_TARGET}/nanovdb/include/nanovdb
DEPENDEES install
)
endif()

View File

@@ -54,20 +54,6 @@ set(OPENVDB_EXTRA_ARGS
-DOPENVDB_CORE_STATIC=${OPENVDB_STATIC}
-DOPENVDB_BUILD_BINARIES=Off
-DCMAKE_DEBUG_POSTFIX=_d
# NanoVDB is header-only, so only need the install target
-DNANOVDB_BUILD_UNITTESTS=OFF
-DNANOVDB_BUILD_EXAMPLES=OFF
-DNANOVDB_BUILD_BENCHMARK=OFF
-DNANOVDB_BUILD_DOCS=OFF
-DNANOVDB_BUILD_TOOLS=OFF
-DNANOVDB_CUDA_KEEP_PTX=OFF
-DNANOVDB_USE_OPENGL=OFF
-DNANOVDB_USE_OPENGL=OFF
-DNANOVDB_USE_CUDA=OFF
-DNANOVDB_USE_TBB=OFF
-DNANOVDB_USE_OPTIX=OFF
-DNANOVDB_USE_OPENVDB=OFF
-DNANOVDB_ALLOW_FETCHCONTENT=OFF
)
if(WIN32)
@@ -88,18 +74,12 @@ else()
)
endif()
if(WITH_NANOVDB)
set(OPENVDB_PATCH_FILE openvdb_nanovdb.diff)
else()
set(OPENVDB_PATCH_FILE openvdb.diff)
endif()
ExternalProject_Add(openvdb
URL ${OPENVDB_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${OPENVDB_HASH}
PREFIX ${BUILD_DIR}/openvdb
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/${OPENVDB_PATCH_FILE}
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openvdb ${DEFAULT_CMAKE_FLAGS} ${OPENVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openvdb
)
@@ -121,12 +101,6 @@ if(WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll
DEPENDEES install
)
if(WITH_NANOVDB)
ExternalProject_Add_Step(openvdb nanovdb_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/nanovdb ${HARVEST_TARGET}/nanovdb/include/nanovdb
DEPENDEES after_install
)
endif()
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(openvdb after_install

View File

@@ -21,7 +21,6 @@ if(WIN32)
endif()
option(WITH_WEBP "Enable building of oiio with webp support" OFF)
option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF)
option(WITH_NANOVDB "Enable building of OpenVDB with NanoVDB included" OFF)
set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with")
if(NOT BUILD_MODE)
@@ -57,7 +56,7 @@ if(WIN32)
if(MSVC_VERSION GREATER 1909)
set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings.
endif()
set(COMMON_MSVC_FLAGS "${COMMON_MSVC_FLAGS} /bigobj")
string(APPEND COMMON_MSVC_FLAGS " /bigobj")
if(WITH_OPTIMIZED_DEBUG)
set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MDd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
else()

View File

@@ -145,15 +145,13 @@ set(TBB_VERSION 2019_U9)
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
set(TBB_HASH 26263622e9187212ec240dcf01b66207)
if(WITH_NANOVDB)
set(OPENVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${OPENVDB_GIT_UID}.tar.gz)
set(OPENVDB_HASH 90919510bc6ccd630fedc56f748cb199)
else()
set(OPENVDB_VERSION 7.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH fd6c4f168282f7e0e494d290cd531fa8)
endif()
set(OPENVDB_VERSION 7.0.0)
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
set(OPENVDB_HASH fd6c4f168282f7e0e494d290cd531fa8)
set(NANOVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
set(NANOVDB_HASH 90919510bc6ccd630fedc56f748cb199)
set(IDNA_VERSION 2.9)
set(CHARDET_VERSION 3.0.4)

View File

@@ -51,7 +51,7 @@ ARGS=$( \
getopt \
-o s:i:t:h \
--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,\
with-all,with-opencollada,with-jack,with-embree,with-oidn,\
with-all,with-opencollada,with-jack,with-embree,with-oidn,with-nanovdb,\
ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,\
force-all,force-python,force-numpy,force-boost,force-tbb,\
force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
@@ -151,6 +151,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--with-oidn
Build and install the OpenImageDenoise libraries.
--with-nanovdb
Build and install the NanoVDB branch of OpenVDB (instead of official release of OpenVDB).
--with-jack
Install the jack libraries.
@@ -435,7 +438,7 @@ _with_built_openexr=false
OIIO_VERSION="2.1.15.0"
OIIO_VERSION_SHORT="2.1"
OIIO_VERSION_MIN="1.8"
OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MAX="3.0"
OIIO_FORCE_BUILD=false
OIIO_FORCE_REBUILD=false
@@ -676,6 +679,10 @@ while true; do
--with-oidn)
WITH_OIDN=true; shift; continue
;;
--with-nanovdb)
WITH_NANOVDB=true;
shift; continue
;;
--with-jack)
WITH_JACK=true; shift; continue;
;;
@@ -957,6 +964,11 @@ if [ "$WITH_ALL" = true -a "$OIDN_SKIP" = false ]; then
fi
if [ "$WITH_ALL" = true ]; then
WITH_JACK=true
WITH_NANOVDB=true
fi
if [ "$WITH_NANOVDB" = true ]; then
OPENVDB_FORCE_BUILD=true
fi
@@ -1029,11 +1041,15 @@ OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD
OPENVDB_USE_REPO=false
OPENVDB_BLOSC_SOURCE=( "https://github.com/Blosc/c-blosc/archive/v${OPENVDB_BLOSC_VERSION}.tar.gz" )
OPENVDB_SOURCE=( "https://github.com/dreamworksanimation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz" )
#~ OPENVDB_SOURCE_REPO=( "https:///dreamworksanimation/openvdb.git" )
OPENVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz" )
#~ OPENVDB_SOURCE_REPO=( "https://github.com/AcademySoftwareFoundation/openvdb.git" )
#~ OPENVDB_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
NANOVDB_USE_REPO=false
NANOVDB_SOURCE_REPO_UID="e62f7a0bf1e27397223c61ddeaaf57edf111b77f"
NANOVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_SOURCE_REPO_UID}.tar.gz" )
ALEMBIC_USE_REPO=false
ALEMBIC_SOURCE=( "https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.tar.gz" )
# ALEMBIC_SOURCE_REPO=( "https://github.com/alembic/alembic.git" )
@@ -2594,11 +2610,115 @@ compile_BLOSC() {
# ----------------------------------------------------------------------------
# Build OpenVDB
_init_nanovdb() {
_src=$SRC/openvdb-$OPENVDB_VERSION/nanovdb
_inst=$INST/nanovdb-$OPENVDB_VERSION_SHORT
_inst_shortcut=$INST/nanovdb
}
_update_deps_nanovdb() {
:
}
clean_nanovdb() {
_init_nanovdb
if [ -d $_inst ]; then
_update_deps_nanovdb
fi
_git=true # Mere trick to prevent clean from removing $_src...
_clean
}
install_NanoVDB() {
# To be changed each time we make edits that would modify the compiled results!
nanovdb_magic=1
_init_nanovdb
# Clean install if needed!
magic_compile_check nanovdb-$OPENVDB_VERSION $nanovdb_magic
if [ $? -eq 1 ]; then
clean_nanovdb
fi
if [ ! -d $_inst ]; then
INFO "Installing NanoVDB v$OPENVDB_VERSION"
_is_building=true
# Rebuild dependencies as well!
_update_deps_nanovdb
prepare_inst
if [ ! -d $_src ]; then
ERROR "NanoVDB not found in openvdb-$OPENVDB_VERSION ($_src), exiting"
exit 1
fi
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
# NanoVDB is header-only, so only need the install target
cmake_d="$cmake_d -D NANOVDB_BUILD_UNITTESTS=OFF"
cmake_d="$cmake_d -D NANOVDB_BUILD_EXAMPLES=OFF"
cmake_d="$cmake_d -D NANOVDB_BUILD_BENCHMARK=OFF"
cmake_d="$cmake_d -D NANOVDB_BUILD_DOCS=OFF"
cmake_d="$cmake_d -D NANOVDB_BUILD_TOOLS=OFF"
cmake_d="$cmake_d -D NANOVDB_CUDA_KEEP_PTX=OFF"
# Do not need to include any of the dependencies because of this
cmake_d="$cmake_d -D NANOVDB_USE_OPENVDB=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_OPENGL=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_OPENCL=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_CUDA=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_TBB=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_BLOSC=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_ZLIB=OFF"
cmake_d="$cmake_d -D NANOVDB_USE_OPTIX=OFF"
cmake_d="$cmake_d -D NANOVDB_ALLOW_FETCHCONTENT=OFF"
cmake $cmake_d $_src
make -j$THREADS install
make clean
#~ mkdir -p $_inst
#~ cp -r $_src/include $_inst/include
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "NanoVDB-v$OPENVDB_VERSION failed to install, exiting"
exit 1
fi
magic_compile_set nanovdb-$OPENVDB_VERSION $nanovdb_magic
cd $CWD
INFO "Done compiling NanoVDB-v$OPENVDB_VERSION!"
_is_building=false
else
INFO "Own NanoVDB-v$OPENVDB_VERSION is up to date, nothing to do!"
fi
}
_init_openvdb() {
_src=$SRC/openvdb-$OPENVDB_VERSION
_git=false
_inst=$INST/openvdb-$OPENVDB_VERSION_SHORT
_inst_shortcut=$INST/openvdb
_openvdb_source=$OPENVDB_SOURCE
if [ "$WITH_NANOVDB" = true ]; then
_openvdb_source=$NANOVDB_SOURCE
fi
}
_update_deps_openvdb() {
@@ -2623,7 +2743,7 @@ compile_OPENVDB() {
PRINT ""
# To be changed each time we make edits that would modify the compiled result!
openvdb_magic=1
openvdb_magic=2
_init_openvdb
# Clean install if needed!
@@ -2633,7 +2753,7 @@ compile_OPENVDB() {
fi
if [ ! -d $_inst ]; then
INFO "Building OpenVDB-$OPENVDB_VERSION"
INFO "Building OpenVDB-$OPENVDB_VERSION (with NanoVDB: $WITH_NANOVDB)"
_is_building=true
# Rebuild dependencies as well!
@@ -2641,12 +2761,17 @@ compile_OPENVDB() {
prepare_inst
if [ ! -d $_src -o true ]; then
if [ ! -d $_src ]; then
mkdir -p $SRC
download OPENVDB_SOURCE[@] "$_src.tar.gz"
download _openvdb_source[@] "$_src.tar.gz"
INFO "Unpacking OpenVDB-$OPENVDB_VERSION"
tar -C $SRC -xf $_src.tar.gz
if [ "$WITH_NANOVDB" = true ]; then
tar -C $SRC --transform "s,(.*/?)openvdb-$NANOVDB_SOURCE_REPO_UID[^/]*(.*),\1openvdb-$OPENVDB_VERSION\2,x" \
-xf $_src.tar.gz
else
tar -C $SRC -xf $_src.tar.gz
fi
fi
cd $_src
@@ -2660,33 +2785,40 @@ compile_OPENVDB() {
#~ git reset --hard
#~ fi
# Source builds here
cd openvdb
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
make_d="DESTDIR=$_inst"
make_d="$make_d HDSO=/usr"
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D USE_STATIC_DEPENDENCIES=OFF"
cmake_d="$cmake_d -D OPENVDB_BUILD_BINARIES=OFF"
if [ -d $INST/boost ]; then
make_d="$make_d BOOST_INCL_DIR=$INST/boost/include BOOST_LIB_DIR=$INST/boost/lib"
cmake_d="$cmake_d -D BOOST_ROOT=$INST/boost"
cmake_d="$cmake_d -D Boost_USE_MULTITHREADED=ON"
cmake_d="$cmake_d -D Boost_NO_SYSTEM_PATHS=ON"
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
fi
if [ -d $INST/tbb ]; then
make_d="$make_d TBB_ROOT=$INST/tbb TBB_USE_STATIC_LIBS=OFF"
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
fi
if [ "$_with_built_openexr" = true ]; then
make_d="$make_d ILMBASE_INCL_DIR=$INST/openexr/include ILMBASE_LIB_DIR=$INST/openexr/lib"
make_d="$make_d EXR_INCL_DIR=$INST/openexr/include EXR_LIB_DIR=$INST/openexr/lib"
INFO "ILMBASE_HOME=$INST/openexr"
cmake_d="$cmake_d -D IlmBase_ROOT=$INST/openexr"
cmake_d="$cmake_d -D OpenEXR_ROOT=$INST/openexr"
fi
if [ -d $INST/blosc ]; then
make_d="$make_d BLOSC_INCL_DIR=$INST/blosc/include BLOSC_LIB_DIR=$INST/blosc/lib"
cmake_d="$cmake_d -D Blosc_ROOT=$INST/blosc"
fi
cmake $cmake_d ..
# Build without log4cplus, glfw, python module & docs
make_d="$make_d LOG4CPLUS_INCL_DIR= GLFW_INCL_DIR= PYTHON_VERSION= DOXYGEN="
make -j$THREADS lib $make_d install
make -j$THREADS install
make clean
if [ -d $_inst ]; then
@@ -2707,6 +2839,10 @@ compile_OPENVDB() {
fi
run_ldconfig "openvdb"
if [ "$WITH_NANOVDB" = true ]; then
install_NanoVDB
fi
}
# ----------------------------------------------------------------------------
@@ -5691,6 +5827,13 @@ print_info() {
PRINT " $_1"
_buildargs="$_buildargs $_1"
fi
if [ -d $INST/nanovdb ]; then
_1="-D WITH_NANOVDB=ON"
_2="-D NANOVDB_ROOT_DIR=$INST/nanovdb"
PRINT " $_1"
PRINT " $_2"
_buildargs="$_buildargs $_1 $_2"
fi
fi
if [ "$WITH_OPENCOLLADA" = true ]; then

View File

@@ -1,135 +0,0 @@
diff -Naur orig/cmake/FindIlmBase.cmake openvdb/cmake/FindIlmBase.cmake
--- orig/cmake/FindIlmBase.cmake 2019-12-06 12:11:33 -0700
+++ openvdb/cmake/FindIlmBase.cmake 2020-08-12 12:48:44 -0600
@@ -217,6 +217,8 @@
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
endif()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_IlmBase_Version_Suffix}.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s_d.lib")
else()
if(ILMBASE_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
diff -Naur orig/cmake/FindOpenEXR.cmake openvdb/cmake/FindOpenEXR.cmake
--- orig/cmake/FindOpenEXR.cmake 2019-12-06 12:11:33 -0700
+++ openvdb/cmake/FindOpenEXR.cmake 2020-08-12 12:48:44 -0600
@@ -210,6 +210,8 @@
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
endif()
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_OpenEXR_Version_Suffix}.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s.lib")
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s_d.lib")
else()
if(OPENEXR_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
diff -Naur orig/openvdb/openvdb/CMakeLists.txt openvdb/openvdb/openvdb/CMakeLists.txt
--- orig/openvdb/openvdb/CMakeLists.txt 2019-12-06 12:11:33 -0700
+++ openvdb/openvdb/openvdb/CMakeLists.txt 2020-08-12 14:12:26 -0600
@@ -105,7 +105,9 @@
# http://boost.2283326.n4.nabble.com/CMake-config-scripts-broken-in-1-70-td4708957.html
# https://github.com/boostorg/boost_install/commit/160c7cb2b2c720e74463865ef0454d4c4cd9ae7c
set(BUILD_SHARED_LIBS ON)
- set(Boost_USE_STATIC_LIBS OFF)
+ if(NOT WIN32) # blender links boost statically on windows
+ set(Boost_USE_STATIC_LIBS OFF)
+ endif()
endif()
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams system)
@@ -193,6 +195,7 @@
if(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING)
add_definitions(-DBOOST_ALL_NO_LIB)
endif()
+ add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE -DOPENVDB_OPENEXR_STATICLIB)
endif()
# @todo Should be target definitions
@@ -383,7 +386,12 @@
# imported targets.
if(OPENVDB_CORE_SHARED)
- add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES})
+ if(WIN32)
+ configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
+ add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
+ else()
+ add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES})
+ endif()
endif()
if(OPENVDB_CORE_STATIC)
diff -Naur orig/openvdb/openvdb/version.rc.in openvdb/openvdb/openvdb/version.rc.in
--- orig/openvdb/openvdb/version.rc.in 1969-12-31 17:00:00 -0700
+++ openvdb/openvdb/openvdb/version.rc.in 2020-08-12 14:15:01 -0600
@@ -0,0 +1,48 @@
+#include <winver.h>
+
+#define VER_FILEVERSION @OpenVDB_MAJOR_VERSION@,@OpenVDB_MINOR_VERSION@,@OpenVDB_PATCH_VERSION@,0
+#define VER_FILEVERSION_STR "@OpenVDB_MAJOR_VERSION@.@OpenVDB_MINOR_VERSION@.@OpenVDB_PATCH_VERSION@.0\0"
+
+#define VER_PRODUCTVERSION @OpenVDB_MAJOR_VERSION@,@OpenVDB_MINOR_VERSION@,@OpenVDB_PATCH_VERSION@,0
+#define VER_PRODUCTVERSION_STR "@OpenVDB_MAJOR_VERSION@.@OpenVDB_MINOR_VERSION@\0"
+
+#ifndef DEBUG
+#define VER_DEBUG 0
+#else
+#define VER_DEBUG VS_FF_DEBUG
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION VER_FILEVERSION
+PRODUCTVERSION VER_PRODUCTVERSION
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+FILEFLAGS (VER_DEBUG)
+FILEOS VOS__WINDOWS32
+FILETYPE VFT_DLL
+FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "FileDescription", "OpenVDB"
+ VALUE "FileVersion", VER_FILEVERSION_STR
+ VALUE "InternalName", "OpenVDB"
+ VALUE "ProductName", "OpenVDB"
+ VALUE "ProductVersion", VER_PRODUCTVERSION_STR
+ END
+ END
+
+ BLOCK "VarFileInfo"
+ BEGIN
+ /* The following line should only be modified for localized versions. */
+ /* It consists of any number of WORD,WORD pairs, with each pair */
+ /* describing a language,codepage combination supported by the file. */
+ /* */
+ /* For example, a file might have values "0x409,1252" indicating that it */
+ /* supports English language (0x409) in the Windows ANSI codepage (1252). */
+
+ VALUE "Translation", 0x409, 1252
+
+ END
+END
diff -Naur openvdb-original/CMakeLists.txt openvdb/CMakeLists.txt
--- openvdb-original/CMakeLists.txt 2020-08-27 03:34:02.000000000 +0200
+++ openvdb/CMakeLists.txt 2020-09-02 10:56:21.665735244 +0200
@@ -68,6 +68,7 @@
option(OPENVDB_INSTALL_HOUDINI_PYTHONRC [=[Install a Houdini startup script that sets
the visibilty of OpenVDB nodes and their native equivalents.]=] OFF)
option(OPENVDB_BUILD_MAYA_PLUGIN "Build the Maya plugin" OFF)
+option(OPENVDB_BUILD_NANOVDB "Build nanovdb" ON)
option(OPENVDB_ENABLE_RPATH "Build with RPATH information" ON)
option(OPENVDB_CXX_STRICT "Enable or disable pre-defined compiler warnings" OFF)
option(OPENVDB_CODE_COVERAGE "Enable code coverage. This also overrides CMAKE_BUILD_TYPE to Debug" OFF)
@@ -740,6 +741,10 @@
add_subdirectory(openvdb_maya)
endif()
+if(OPENVDB_BUILD_NANOVDB)
+ add_subdirectory(nanovdb)
+endif()
+
##########################################################################
add_custom_target(uninstall

View File

@@ -43,7 +43,10 @@ find_program(CLANG_TIDY_EXECUTABLE
${_clang_tidy_SEARCH_DIRS}
)
if(CLANG_TIDY_EXECUTABLE)
if(CLANG_TIDY_EXECUTABLE AND NOT EXISTS ${CLANG_TIDY_EXECUTABLE})
message(WARNING "Cached or directly specified Clang-Tidy executable does not exist.")
set(CLANG_TIDY_FOUND FALSE)
elseif(CLANG_TIDY_EXECUTABLE)
# Mark clang-tidy as found.
set(CLANG_TIDY_FOUND TRUE)

View File

@@ -97,6 +97,7 @@ macro(BLENDER_SRC_GTEST_EX)
set_tests_properties(${TARGET_NAME} PROPERTIES ENVIRONMENT LSAN_OPTIONS=exitcode=0)
endif()
if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES VS_GLOBAL_VcpkgEnabled "false")
unset(MANIFEST)
endif()
unset(TEST_INC)

View File

@@ -128,7 +128,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT _git_changed_files STREQUAL "")
set(MY_WC_BRANCH "${MY_WC_BRANCH} (modified)")
string(APPEND MY_WC_BRANCH " (modified)")
else()
# Unpushed commits are also considered local modifications
execute_process(COMMAND git log @{u}..
@@ -137,7 +137,7 @@ if(EXISTS ${SOURCE_DIR}/.git)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if(NOT _git_unpushed_log STREQUAL "")
set(MY_WC_BRANCH "${MY_WC_BRANCH} (modified)")
string(APPEND MY_WC_BRANCH " (modified)")
endif()
unset(_git_unpushed_log)
endif()
@@ -161,6 +161,7 @@ file(WRITE buildinfo.h.txt
"#define BUILD_BRANCH \"${MY_WC_BRANCH}\"\n"
"#define BUILD_DATE \"${BUILD_DATE}\"\n"
"#define BUILD_TIME \"${BUILD_TIME}\"\n"
"#include \"buildinfo_static.h\"\n"
)
# cleanup

View File

@@ -0,0 +1,8 @@
/* CMake expanded values that won't change between CMake execution (unlike date/time).
* This is included by `buildinfo.h` generated by `buildinfo.cmake`. */
#define BUILD_PLATFORM "@BUILD_PLATFORM@"
#define BUILD_TYPE "@BUILD_TYPE@"
#define BUILD_CFLAGS "@BUILD_CFLAGS@"
#define BUILD_CXXFLAGS "@BUILD_CXXFLAGS@"
#define BUILD_LINKFLAGS "@BUILD_LINKFLAGS@"
#define BUILD_SYSTEM "@BUILD_SYSTEM@"

View File

@@ -60,6 +60,19 @@ function(list_assert_duplicates
unset(_len_after)
endfunction()
# Adds a native path separator to the end of the path:
#
# - 'example' -> 'example/'
# - '/example///' -> '/example/'
#
macro(path_ensure_trailing_slash
path_new path_input
)
file(TO_NATIVE_PATH "/" _path_sep)
string(REGEX REPLACE "[${_path_sep}]+$" "" ${path_new} ${path_input})
set(${path_new} "${${path_new}}${_path_sep}")
unset(_path_sep)
endmacro()
# foo_bar.spam --> foo_barMySuffix.spam
macro(file_suffix
@@ -183,7 +196,7 @@ function(blender_user_header_search_paths
foreach(_INC ${includes})
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
# _ALL_INCS is a space-separated string of file paths in quotes.
set(_ALL_INCS "${_ALL_INCS} \"${_ABS_INC}\"")
string(APPEND _ALL_INCS " \"${_ABS_INC}\"")
endforeach()
set_target_properties(${name} PROPERTIES XCODE_ATTRIBUTE_USER_HEADER_SEARCH_PATHS "${_ALL_INCS}")
endif()
@@ -250,11 +263,11 @@ macro(add_cc_flags_custom_test
string(TOUPPER ${name} _name_upper)
if(DEFINED CMAKE_C_FLAGS_${_name_upper})
message(STATUS "Using custom CFLAGS: CMAKE_C_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${_name_upper}}" ${ARGV1})
string(APPEND CMAKE_C_FLAGS " ${CMAKE_C_FLAGS_${_name_upper}}" ${ARGV1})
endif()
if(DEFINED CMAKE_CXX_FLAGS_${_name_upper})
message(STATUS "Using custom CXXFLAGS: CMAKE_CXX_FLAGS_${_name_upper} in \"${CMAKE_CURRENT_SOURCE_DIR}\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${_name_upper}}" ${ARGV1})
string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS_${_name_upper}}" ${ARGV1})
endif()
unset(_name_upper)
@@ -675,14 +688,14 @@ endmacro()
macro(add_c_flag
flag)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
string(APPEND CMAKE_C_FLAGS " ${flag}")
string(APPEND CMAKE_CXX_FLAGS " ${flag}")
endmacro()
macro(add_cxx_flag
flag)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
string(APPEND CMAKE_CXX_FLAGS " ${flag}")
endmacro()
macro(remove_strict_flags)

View File

@@ -60,6 +60,17 @@ if(WITH_OPENAL)
endif()
endif()
if(WITH_JACK)
find_library(JACK_FRAMEWORK
NAMES jackmp
)
if(NOT JACK_FRAMEWORK)
set(WITH_JACK OFF)
else()
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
endif()
endif()
if(NOT DEFINED LIBDIR)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
# Prefer lib directory paths
@@ -94,17 +105,6 @@ if(WITH_OPENSUBDIV)
find_package(OpenSubdiv)
endif()
if(WITH_JACK)
find_library(JACK_FRAMEWORK
NAMES jackmp
)
if(NOT JACK_FRAMEWORK)
set(WITH_JACK OFF)
else()
set(JACK_INCLUDE_DIRS ${JACK_FRAMEWORK}/headers)
endif()
endif()
if(WITH_CODEC_SNDFILE)
find_package(SndFile)
find_library(_sndfile_FLAC_LIBRARY NAMES flac HINTS ${LIBDIR}/sndfile/lib)
@@ -194,7 +194,7 @@ if(SYSTEMSTUBS_LIBRARY)
list(APPEND PLATFORM_LINKLIBS SystemStubs)
endif()
set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -pipe -funsigned-char")
string(APPEND PLATFORM_CFLAGS " -pipe -funsigned-char -fno-strict-aliasing")
set(PLATFORM_LINKFLAGS
"-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework Metal -framework QuartzCore"
)
@@ -202,12 +202,12 @@ set(PLATFORM_LINKFLAGS
list(APPEND PLATFORM_LINKLIBS c++)
if(WITH_JACK)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -F/Library/Frameworks -weak_framework jackmp")
string(APPEND PLATFORM_LINKFLAGS " -F/Library/Frameworks -weak_framework jackmp")
endif()
if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
# force cmake to link right framework
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
string(APPEND PLATFORM_LINKFLAGS " /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
endif()
if(WITH_OPENCOLLADA)
@@ -222,7 +222,7 @@ if(WITH_SDL)
find_package(SDL2)
set(SDL_INCLUDE_DIR ${SDL2_INCLUDE_DIRS})
set(SDL_LIBRARY ${SDL2_LIBRARIES})
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback")
string(APPEND PLATFORM_LINKFLAGS " -framework ForceFeedback")
endif()
set(PNG_ROOT ${LIBDIR}/png)
@@ -266,7 +266,7 @@ if(WITH_BOOST)
endif()
if(WITH_INTERNATIONAL OR WITH_CODEC_FFMPEG)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -liconv") # boost_locale and ffmpeg needs it !
string(APPEND PLATFORM_LINKFLAGS " -liconv") # boost_locale and ffmpeg needs it !
endif()
if(WITH_OPENIMAGEIO)
@@ -337,7 +337,7 @@ if(WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)
# Increase stack size for Embree, only works for executables.
if(NOT WITH_PYTHON_MODULE)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000")
string(APPEND PLATFORM_LINKFLAGS " -Xlinker -stack_size -Xlinker 0x100000")
endif()
# Embree static library linking can mix up SSE and AVX symbols, causing
@@ -381,7 +381,7 @@ if(WITH_OPENMP)
set(OPENMP_FOUND ON)
set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L'${LIBDIR}/openmp/lib' -lomp")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -L'${LIBDIR}/openmp/lib' -lomp")
# Copy libomp.dylib to allow executables like datatoc and tests to work.
# `@executable_path/../Resources/lib/` is a default dylib search path.
@@ -428,23 +428,23 @@ endif()
set(EXETYPE MACOSX_BUNDLE)
set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
set(CMAKE_CXX_FLAGS_DEBUG "-fno-strict-aliasing -g")
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "i386")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -msse -msse2 -msse3 -mssse3")
if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize -fvariable-expansion-in-unroller")
string(APPEND CMAKE_C_FLAGS_RELEASE " -ftree-vectorize -fvariable-expansion-in-unroller")
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -ftree-vectorize -fvariable-expansion-in-unroller")
endif()
else()
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic -fno-strict-aliasing")
set(CMAKE_C_FLAGS_RELEASE "-O2 -mdynamic-no-pic")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic")
endif()
if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
# Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024")
endif()
# Avoid conflicts with Luxrender, and other plug-ins that may use the same
@@ -453,8 +453,8 @@ set(PLATFORM_LINKFLAGS
"${PLATFORM_LINKFLAGS} -Xlinker -unexported_symbols_list -Xlinker '${CMAKE_SOURCE_DIR}/source/creator/osx_locals.map'"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -stdlib=libc++")
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++")
string(APPEND PLATFORM_LINKFLAGS " -stdlib=libc++")
# Suppress ranlib "has no symbols" warnings (workaround for T48250)
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")

View File

@@ -150,7 +150,7 @@ endif()
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
# Force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else (CMake bug?)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
string(APPEND CMAKE_C_FLAGS " -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
string(APPEND CMAKE_CXX_FLAGS " -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()

View File

@@ -73,7 +73,7 @@ if(EXISTS ${LIBDIR})
endif()
if(WITH_STATIC_LIBS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -static-libstdc++")
endif()
# Wrapper to prefer static libraries
@@ -620,7 +620,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS_RELEASE "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
set(CMAKE_CXX_FLAGS_RELEASE "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${GCC_EXTRA_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(PREPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO "${GCC_EXTRA_FLAGS_RELEASE} ")
unset(GCC_EXTRA_FLAGS_RELEASE)
if(WITH_LINKER_GOLD)
@@ -628,8 +628,8 @@ if(CMAKE_COMPILER_IS_GNUCC)
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
string(APPEND CMAKE_C_FLAGS " -fuse-ld=gold")
string(APPEND CMAKE_CXX_FLAGS " -fuse-ld=gold")
else()
message(STATUS "GNU gold linker isn't available, using the default system linker.")
endif()
@@ -641,8 +641,8 @@ if(CMAKE_COMPILER_IS_GNUCC)
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=lld -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if("${LD_VERSION}" MATCHES "LLD")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=lld")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=lld")
string(APPEND CMAKE_C_FLAGS " -fuse-ld=lld")
string(APPEND CMAKE_CXX_FLAGS " -fuse-ld=lld")
else()
message(STATUS "LLD linker isn't available, using the default system linker.")
endif()
@@ -667,12 +667,12 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
endif()
mark_as_advanced(XILD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp-model precise -prec_div -parallel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model precise -prec_div -parallel")
string(APPEND CMAKE_C_FLAGS " -fp-model precise -prec_div -parallel")
string(APPEND CMAKE_CXX_FLAGS " -fp-model precise -prec_div -parallel")
# set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -diag-enable sc3")
# string(APPEND PLATFORM_CFLAGS " -diag-enable sc3")
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-intel")
string(APPEND PLATFORM_LINKFLAGS " -static-intel")
endif()
# Avoid conflicts with Mesa llvmpipe, Luxrender, and other plug-ins that may
@@ -685,5 +685,5 @@ set(PLATFORM_LINKFLAGS
# browsers can't properly detect blender as an executable then. Still enabled
# for non-portable installs as typically used by Linux distributions.
if(WITH_INSTALL_PORTABLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -no-pie")
endif()

View File

@@ -49,7 +49,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
if(NOT EXISTS "${CLANG_OPENMP_DLL}")
message(FATAL_ERROR "Clang OpenMP library (${CLANG_OPENMP_DLL}) not found.")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \"${CLANG_OPENMP_LIB}\"")
string(APPEND CMAKE_EXE_LINKER_FLAGS " \"${CLANG_OPENMP_LIB}\"")
endif()
if(WITH_WINDOWS_STRIPPED_PDB)
message(WARNING "stripped pdb not supported with clang, disabling..")
@@ -112,9 +112,9 @@ unset(_min_ver)
# needed for some MSVC installations
# 4099 : PDB 'filename' was not found with 'object/library'
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /ignore:4099")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO /ignore:4099")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO /ignore:4099")
string(APPEND CMAKE_EXE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " /SAFESEH:NO /ignore:4099")
string(APPEND CMAKE_MODULE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099")
list(APPEND PLATFORM_LINKLIBS
ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32 version
@@ -154,18 +154,18 @@ if(WITH_WINDOWS_PDB)
endif()
if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
string(APPEND CMAKE_CXX_FLAGS " ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /nologo /J /Gd /MP /EHsc /bigobj")
string(APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj")
endif()
# C++ standards conformace (/permissive-) is available on msvc 15.5 (1912) and up
if(MSVC_VERSION GREATER 1911 AND NOT MSVC_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-")
string(APPEND CMAKE_CXX_FLAGS " /permissive-")
# Two-phase name lookup does not place nicely with OpenMP yet, so disable for now
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:twoPhase-")
string(APPEND CMAKE_CXX_FLAGS " /Zc:twoPhase-")
endif()
if(WITH_WINDOWS_SCCACHE AND CMAKE_VS_MSBUILD_COMMAND)
@@ -183,33 +183,33 @@ else()
set(SYMBOL_FORMAT /ZI)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd ${SYMBOL_FORMAT}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd ${SYMBOL_FORMAT}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD ${SYMBOL_FORMAT}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD ${SYMBOL_FORMAT}")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}")
string(APPEND CMAKE_C_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}")
string(APPEND CMAKE_CXX_FLAGS_RELEASE " /MD ${PDB_INFO_OVERRIDE_FLAGS}")
string(APPEND CMAKE_C_FLAGS_RELEASE " /MD ${PDB_INFO_OVERRIDE_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " /MD ${PDB_INFO_OVERRIDE_FLAGS}")
string(APPEND CMAKE_C_FLAGS_MINSIZEREL " /MD ${PDB_INFO_OVERRIDE_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /MD ${SYMBOL_FORMAT}")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " /MD ${SYMBOL_FORMAT}")
unset(SYMBOL_FORMAT)
# JMC is available on msvc 15.8 (1915) and up
if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /JMC")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /JMC")
endif()
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /SUBSYSTEM:CONSOLE /STACK:2097152")
string(APPEND PLATFORM_LINKFLAGS " /SUBSYSTEM:CONSOLE /STACK:2097152")
set(PLATFORM_LINKFLAGS_RELEASE "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcmtd.lib")
string(APPEND PLATFORM_LINKFLAGS_DEBUG " /IGNORE:4099 /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcmtd.lib")
# Ignore meaningless for us linker warnings.
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221")
string(APPEND PLATFORM_LINKFLAGS " /ignore:4049 /ignore:4217 /ignore:4221")
set(PLATFORM_LINKFLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${PDB_INFO_OVERRIDE_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
string(APPEND CMAKE_STATIC_LINKER_FLAGS " /ignore:4221")
if(CMAKE_CL_64)
set(PLATFORM_LINKFLAGS "/MACHINE:X64 ${PLATFORM_LINKFLAGS}")
string(PREPEND PLATFORM_LINKFLAGS "/MACHINE:X64 ")
else()
set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
string(PREPEND PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ")
endif()
if(NOT DEFINED LIBDIR)

View File

@@ -31,7 +31,7 @@ if(WITH_WINDOWS_BUNDLE_CRT)
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
get_filename_component(filename ${lib} NAME)
file(SHA1 "${lib}" sha1_file)
set(CRTLIBS "${CRTLIBS} <file name=\"${filename}\" hash=\"${sha1_file}\" hashalg=\"SHA1\" />\n")
string(APPEND CRTLIBS " <file name=\"${filename}\" hash=\"${sha1_file}\" hashalg=\"SHA1\" />\n")
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.crt.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/blender.crt.manifest @ONLY)
file(TOUCH ${manifest_trigger_file})

View File

@@ -423,7 +423,7 @@ set(LIB
if(CMAKE_COMPILER_IS_GNUCXX)
# needed for gcc 4.6+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
string(APPEND CMAKE_CXX_FLAGS " -fpermissive")
endif()
if(MSVC)

View File

@@ -23,9 +23,9 @@ macro (add_c_flag_if_supported c_flag)
message("Checking C compiler flag support for: " ${c_flag})
check_c_compiler_flag("${c_flag}" C_FLAG_SUPPORTED)
if (${C_FLAG_SUPPORTED})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${c_flag}" CACHE STRING "")
string(APPEND CMAKE_C_FLAGS " ${c_flag}" CACHE STRING "")
else ()
set(DRACO_FAILED_C_FLAGS "${DRACO_FAILED_C_FLAGS} ${c_flag}" CACHE STRING
string(APPEND DRACO_FAILED_C_FLAGS " ${c_flag}" CACHE STRING
"" FORCE)
endif ()
endif ()
@@ -45,9 +45,9 @@ macro (add_cxx_flag_if_supported cxx_flag)
message("Checking CXX compiler flag support for: " ${cxx_flag})
check_cxx_compiler_flag("${cxx_flag}" CXX_FLAG_SUPPORTED)
if (${CXX_FLAG_SUPPORTED})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxx_flag}" CACHE STRING "")
string(APPEND CMAKE_CXX_FLAGS " ${cxx_flag}" CACHE STRING "")
else()
set(DRACO_FAILED_CXX_FLAGS "${DRACO_FAILED_CXX_FLAGS} ${cxx_flag}" CACHE
string(APPEND DRACO_FAILED_CXX_FLAGS " ${cxx_flag}" CACHE
STRING "" FORCE)
endif ()
endif ()
@@ -138,7 +138,7 @@ macro (append_as_flag flag)
string(FIND "${DRACO_AS_FLAGS}" "${flag}" AS_FLAG_FOUND)
if (${AS_FLAG_FOUND} EQUAL -1)
set(DRACO_AS_FLAGS "${DRACO_AS_FLAGS} ${flag}")
string(APPEND DRACO_AS_FLAGS " ${flag}")
endif ()
endmacro ()
@@ -148,7 +148,7 @@ macro (append_c_flag flag)
string(FIND "${CMAKE_C_FLAGS}" "${flag}" C_FLAG_FOUND)
if (${C_FLAG_FOUND} EQUAL -1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
string(APPEND CMAKE_C_FLAGS " ${flag}")
endif ()
endmacro ()
@@ -158,7 +158,7 @@ macro (append_cxx_flag flag)
string(FIND "${CMAKE_CXX_FLAGS}" "${flag}" CXX_FLAG_FOUND)
if (${CXX_FLAG_FOUND} EQUAL -1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
string(APPEND CMAKE_CXX_FLAGS " ${flag}")
endif ()
endmacro ()
@@ -174,7 +174,7 @@ macro (append_exe_linker_flag flag)
string(FIND "${CMAKE_EXE_LINKER_FLAGS}" "${flag}" LINKER_FLAG_FOUND)
if (${LINKER_FLAG_FOUND} EQUAL -1)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}")
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${flag}")
endif ()
endmacro ()
@@ -191,7 +191,7 @@ function (append_link_flag_to_target target flags)
return()
endif ()
set(target_link_flags "${target_link_flags} ${flags}")
string(APPEND target_link_flags " ${flags}")
else ()
set(target_link_flags "${flags}")
endif ()

View File

@@ -41,9 +41,9 @@ macro(draco_check_c_compiles test_name test_source result_var)
set(${result_var} ${C_TEST_COMPILED})
if (${C_TEST_COMPILED})
set(DRACO_C_PASSED_TESTS "${DRACO_C_PASSED_TESTS} ${test_name}")
string(APPEND DRACO_C_PASSED_TESTS " ${test_name}")
else ()
set(DRACO_C_FAILED_TESTS "${DRACO_C_FAILED_TESTS} ${test_name}")
string(APPEND DRACO_C_FAILED_TESTS " ${test_name}")
message("C Compiler test ${test_name} failed.")
endif ()
elseif (NOT ${C_TEST_PASSED} EQUAL -1)
@@ -71,9 +71,9 @@ macro(draco_check_cxx_compiles test_name test_source result_var)
set(${result_var} ${CXX_TEST_COMPILED})
if (${CXX_TEST_COMPILED})
set(DRACO_CXX_PASSED_TESTS "${DRACO_CXX_PASSED_TESTS} ${test_name}")
string(APPEND DRACO_CXX_PASSED_TESTS " ${test_name}")
else ()
set(DRACO_CXX_FAILED_TESTS "${DRACO_CXX_FAILED_TESTS} ${test_name}")
string(APPEND DRACO_CXX_FAILED_TESTS " ${test_name}")
message("CXX Compiler test ${test_name} failed.")
endif ()
elseif (NOT ${CXX_TEST_PASSED} EQUAL -1)

View File

@@ -37,8 +37,8 @@ endif()
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
string(APPEND CMAKE_C_FLAGS " -fvisibility=hidden")
string(APPEND CMAKE_CXX_FLAGS " -fvisibility=hidden")
endif()
endif()

View File

@@ -94,7 +94,7 @@ void PyArrayContainer::ExtractData(void *_pParentPyArray)
template<> PyArrayContainer fromPy<PyArrayContainer>(PyObject *obj)
{
if (PyArray_API == NULL) {
if (PyArray_API == nullptr) {
// python 3 uses the return value
#if PY_VERSION_HEX >= 0x03000000
import_array();
@@ -109,12 +109,12 @@ template<> PyArrayContainer fromPy<PyArrayContainer>(PyObject *obj)
PyArrayObject *obj_p = reinterpret_cast<PyArrayObject *>(
PyArray_CheckFromAny(obj,
NULL,
nullptr,
0,
0,
/*NPY_ARRAY_ENSURECOPY*/ NPY_ARRAY_C_CONTIGUOUS |
NPY_ARRAY_ENSUREARRAY | NPY_ARRAY_NOTSWAPPED,
NULL));
nullptr));
PyArrayContainer container = PyArrayContainer(obj_p);
return container;

View File

@@ -98,13 +98,13 @@ string PbType::str() const
vector<PbClass *> PbClass::mInstances;
PbClass::PbClass(FluidSolver *parent, const string &name, PyObject *obj)
: mMutex(NULL), mParent(parent), mPyObject(obj), mName(name), mHidden(false)
: mMutex(nullptr), mParent(parent), mPyObject(obj), mName(name), mHidden(false)
{
mMutex = new QMutex();
}
PbClass::PbClass(const PbClass &a)
: mMutex(NULL), mParent(a.mParent), mPyObject(0), mName("_unnamed"), mHidden(false)
: mMutex(nullptr), mParent(a.mParent), mPyObject(0), mName("_unnamed"), mHidden(false)
{
mMutex = new QMutex();
}
@@ -180,7 +180,7 @@ PbClass *PbClass::createPyObject(const string &classname,
void PbClass::checkParent()
{
if (getParent() == NULL) {
if (getParent() == nullptr) {
errMsg("New class " + mName + ": no parent given -- specify using parent=xxx !");
}
}

View File

@@ -43,7 +43,7 @@ struct PbTypeVec {
//! Base class for all classes exposed to Python
class PbClass {
public:
PbClass(FluidSolver *parent, const std::string &name = "", PyObject *obj = NULL);
PbClass(FluidSolver *parent, const std::string &name = "", PyObject *obj = nullptr);
PbClass(const PbClass &a);
virtual ~PbClass();

View File

@@ -491,7 +491,7 @@ template<> bool isPy<std::vector<float>>(PyObject *obj)
//******************************************************************************
// PbArgs class defs
PbArgs PbArgs::EMPTY(NULL, NULL);
PbArgs PbArgs::EMPTY(nullptr, nullptr);
PbArgs::PbArgs(PyObject *linarg, PyObject *dict) : mLinArgs(0), mKwds(0)
{
@@ -577,7 +577,7 @@ void PbArgs::check()
FluidSolver *PbArgs::obtainParent()
{
FluidSolver *solver = getPtrOpt<FluidSolver>("solver", -1, NULL);
FluidSolver *solver = getPtrOpt<FluidSolver>("solver", -1, nullptr);
if (solver != 0)
return solver;
@@ -585,7 +585,7 @@ FluidSolver *PbArgs::obtainParent()
PbClass *obj = Pb::objFromPy(it->second.obj);
if (obj) {
if (solver == NULL)
if (solver == nullptr)
solver = obj->getParent();
}
}
@@ -593,7 +593,7 @@ FluidSolver *PbArgs::obtainParent()
PbClass *obj = Pb::objFromPy(it->obj);
if (obj) {
if (solver == NULL)
if (solver == nullptr)
solver = obj->getParent();
}
}
@@ -616,7 +616,7 @@ PyObject *PbArgs::getItem(const std::string &key, bool strict, ArgLocker *lk)
if (lu == mData.end()) {
if (strict)
errMsg("Argument '" + key + "' is not defined.");
return NULL;
return nullptr;
}
PbClass *pbo = Pb::objFromPy(lu->second.obj);
// try to lock
@@ -629,7 +629,7 @@ PyObject *PbArgs::getItem(size_t number, bool strict, ArgLocker *lk)
{
if (number >= mLinData.size()) {
if (!strict)
return NULL;
return nullptr;
stringstream s;
s << "Argument number #" << number << " not specified.";
errMsg(s.str());

View File

@@ -139,9 +139,9 @@ template<> bool isPy<std::vector<float>>(PyObject *obj);
//! Encapsulation of python arguments
class PbArgs {
public:
PbArgs(PyObject *linargs = NULL, PyObject *dict = NULL);
PbArgs(PyObject *linargs = nullptr, PyObject *dict = nullptr);
~PbArgs();
void setup(PyObject *linargs = NULL, PyObject *dict = NULL);
void setup(PyObject *linargs = nullptr, PyObject *dict = nullptr);
void check();
FluidSolver *obtainParent();
@@ -153,7 +153,7 @@ class PbArgs {
inline bool has(const std::string &key)
{
return getItem(key, false) != NULL;
return getItem(key, false) != nullptr;
}
inline void deleteItem(const std::string &key)
{
@@ -177,7 +177,7 @@ class PbArgs {
DataElement el = {toPy(arg), false};
mData[key] = el;
}
template<class T> inline T get(const std::string &key, int number = -1, ArgLocker *lk = NULL)
template<class T> inline T get(const std::string &key, int number = -1, ArgLocker *lk = nullptr)
{
visit(number, key);
PyObject *o = getItem(key, false, lk);
@@ -189,7 +189,7 @@ class PbArgs {
errMsg("Argument '" + key + "' is not defined.");
}
template<class T>
inline T getOpt(const std::string &key, int number, T defarg, ArgLocker *lk = NULL)
inline T getOpt(const std::string &key, int number, T defarg, ArgLocker *lk = nullptr)
{
visit(number, key);
PyObject *o = getItem(key, false, lk);
@@ -200,7 +200,7 @@ class PbArgs {
return (o) ? fromPy<T>(o) : defarg;
}
template<class T>
inline T *getPtrOpt(const std::string &key, int number, T *defarg, ArgLocker *lk = NULL)
inline T *getPtrOpt(const std::string &key, int number, T *defarg, ArgLocker *lk = nullptr)
{
visit(number, key);
PyObject *o = getItem(key, false, lk);
@@ -210,7 +210,8 @@ class PbArgs {
o = getItem(number, false, lk);
return o ? fromPyPtr<T>(o, &mTmpStorage) : defarg;
}
template<class T> inline T *getPtr(const std::string &key, int number = -1, ArgLocker *lk = NULL)
template<class T>
inline T *getPtr(const std::string &key, int number = -1, ArgLocker *lk = nullptr)
{
visit(number, key);
PyObject *o = getItem(key, false, lk);
@@ -239,8 +240,8 @@ class PbArgs {
static PbArgs EMPTY;
protected:
PyObject *getItem(const std::string &key, bool strict, ArgLocker *lk = NULL);
PyObject *getItem(size_t number, bool strict, ArgLocker *lk = NULL);
PyObject *getItem(const std::string &key, bool strict, ArgLocker *lk = nullptr);
PyObject *getItem(size_t number, bool strict, ArgLocker *lk = nullptr);
struct DataElement {
PyObject *obj;

View File

@@ -77,13 +77,13 @@ static PyMemberDef PbVec3Members[] = {
{(char *)"x", T_FLOAT, offsetof(PbVec3, data), 0, (char *)"X"},
{(char *)"y", T_FLOAT, offsetof(PbVec3, data) + sizeof(float), 0, (char *)"Y"},
{(char *)"z", T_FLOAT, offsetof(PbVec3, data) + sizeof(float) * 2, 0, (char *)"Z"},
{NULL} // Sentinel
{nullptr} // Sentinel
};
static PyMethodDef PbVec3Methods[] = {
//{"name", (PyCFunction)Noddy_name, METH_NOARGS, "Return the name, combining the first and last
//name" },
{NULL} // Sentinel
{nullptr} // Sentinel
};
// operator overloads
@@ -240,24 +240,24 @@ static PyNumberMethods PbVec3NumberMethods = {
#endif
PyTypeObject PbVec3Type = {
PyVarObject_HEAD_INIT(NULL, 0) "manta.vec3", /* tp_name */
sizeof(PbVec3), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)PbVec3Dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
(reprfunc)PbVec3Repr, /* tp_repr */
&PbVec3NumberMethods, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
PyVarObject_HEAD_INIT(nullptr, 0) "manta.vec3", /* tp_name */
sizeof(PbVec3), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)PbVec3Dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
(reprfunc)PbVec3Repr, /* tp_repr */
&PbVec3NumberMethods, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION >= 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
#else
@@ -297,7 +297,7 @@ struct PbVec4 {
};
static PyMethodDef PbVec4Methods[] = {
{NULL} // Sentinel
{nullptr} // Sentinel
};
static PyMemberDef PbVec4Members[] = {
@@ -305,7 +305,7 @@ static PyMemberDef PbVec4Members[] = {
{(char *)"y", T_FLOAT, offsetof(PbVec4, data) + sizeof(float) * 1, 0, (char *)"Y"},
{(char *)"z", T_FLOAT, offsetof(PbVec4, data) + sizeof(float) * 2, 0, (char *)"Z"},
{(char *)"t", T_FLOAT, offsetof(PbVec4, data) + sizeof(float) * 3, 0, (char *)"T"},
{NULL} // Sentinel
{nullptr} // Sentinel
};
static void PbVec4Dealloc(PbVec4 *self)
@@ -352,24 +352,24 @@ static PyObject *PbVec4Repr(PbVec4 *self)
}
PyTypeObject PbVec4Type = {
PyVarObject_HEAD_INIT(NULL, 0) "manta.vec4", /* tp_name */
sizeof(PbVec4), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)PbVec4Dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
(reprfunc)PbVec4Repr, /* tp_repr */
NULL, // &PbVec4NumberMethods, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
PyVarObject_HEAD_INIT(nullptr, 0) "manta.vec4", /* tp_name */
sizeof(PbVec4), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)PbVec4Dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_reserved */
(reprfunc)PbVec4Repr, /* tp_repr */
nullptr, // &PbVec4NumberMethods, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
#if PY_MAJOR_VERSION >= 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
#else

View File

@@ -52,7 +52,7 @@ struct GetSet {
PyGetSetDef def()
{
PyGetSetDef def = {&name[0], getter, setter, &doc[0], NULL};
PyGetSetDef def = {&name[0], getter, setter, &doc[0], nullptr};
return def;
}
};
@@ -175,10 +175,10 @@ void cbDealloc(PbObject *self)
PyObject *cbNew(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PbObject *self = (PbObject *)type->tp_alloc(type, 0);
if (self != NULL) {
if (self != nullptr) {
// lookup and link classdef
self->classdef = WrapperRegistry::instance().lookup(type->tp_name);
self->instance = NULL;
self->instance = nullptr;
// cout << "creating " << self->classdef->cName << endl;
}
else
@@ -233,7 +233,7 @@ ClassData *WrapperRegistry::getOrConstructClass(const string &classname)
data->cPureName = classname.substr(0, tplIdx);
data->cTemplate = classname.substr(tplIdx + 1, classname.find('>') - tplIdx - 1);
}
data->baseclass = NULL;
data->baseclass = nullptr;
data->constructor = cbDisableConstructor;
mClasses[classname] = data;
mClassList.push_back(data);
@@ -435,7 +435,7 @@ ClassData *WrapperRegistry::lookup(const string &name)
if (it->first == name || it->second->cName == name)
return it->second;
}
return NULL;
return nullptr;
}
void WrapperRegistry::cleanup()
@@ -510,7 +510,7 @@ void WrapperRegistry::runPreInit()
PyObject *sys_path = PySys_GetObject((char *)"path");
for (size_t i = 0; i < mPaths.size(); i++) {
PyObject *path = Manta::toPy(mPaths[i]);
if (sys_path == NULL || path == NULL || PyList_Append(sys_path, path) < 0) {
if (sys_path == nullptr || path == nullptr || PyList_Append(sys_path, path) < 0) {
errMsg("unable to set python path");
}
Py_DECREF(path);
@@ -531,7 +531,7 @@ PyObject *WrapperRegistry::createPyObject(const string &classname,
errMsg("Class " + classname + " doesn't exist.");
// create object
PyObject *obj = cbNew(&classdef->typeInfo, NULL, NULL);
PyObject *obj = cbNew(&classdef->typeInfo, nullptr, nullptr);
PbObject *self = (PbObject *)obj;
PyObject *nkw = 0;
@@ -578,8 +578,8 @@ inline PyObject *castPy(PyTypeObject *p)
PyObject *WrapperRegistry::initModule()
{
// generate and terminate all method lists
PyMethodDef sentinelFunc = {NULL, NULL, 0, NULL};
PyGetSetDef sentinelGetSet = {NULL, NULL, NULL, NULL, NULL};
PyMethodDef sentinelFunc = {nullptr, nullptr, 0, nullptr};
PyGetSetDef sentinelGetSet = {nullptr, nullptr, nullptr, nullptr, nullptr};
for (int i = 0; i < (int)mClassList.size(); i++) {
ClassData *cls = mClassList[i];
cls->genMethods.clear();
@@ -599,11 +599,11 @@ PyObject *WrapperRegistry::initModule()
gDefaultModuleName.c_str(),
"Bridge module to the C++ solver",
-1,
NULL,
NULL,
NULL,
NULL,
NULL};
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
// get generic methods (plugin functions)
MainModule.m_methods = &mClasses["__modclass__"]->genMethods[0];
@@ -613,8 +613,8 @@ PyObject *WrapperRegistry::initModule()
PyObject *module = Py_InitModule(gDefaultModuleName.c_str(),
&mClasses["__modclass__"]->genMethods[0]);
#endif
if (module == NULL)
return NULL;
if (module == nullptr)
return nullptr;
// load classes
for (vector<ClassData *>::iterator it = mClassList.begin(); it != mClassList.end(); ++it) {
@@ -631,43 +631,43 @@ PyObject *WrapperRegistry::initModule()
// define python classinfo
PyTypeObject t = {
PyVarObject_HEAD_INIT(NULL, 0)(char *) data.pyName.c_str(), // tp_name
sizeof(PbObject), // tp_basicsize
0, // tp_itemsize
(destructor)cbDealloc, // tp_dealloc
0, // tp_print
0, // tp_getattr
0, // tp_setattr
0, // tp_reserved
0, // tp_repr
num, // tp_as_number
0, // tp_as_sequence
0, // tp_as_mapping
0, // tp_hash
0, // tp_call
0, // tp_str
0, // tp_getattro
0, // tp_setattro
0, // tp_as_buffer
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, // tp_flags
nameptr, // tp_doc
0, // tp_traverse
0, // tp_clear
0, // tp_richcompare
0, // tp_weaklistoffset
0, // tp_iter
0, // tp_iternext
&data.genMethods[0], // tp_methods
0, // tp_members
&data.genGetSet[0], // tp_getset
0, // tp_base
0, // tp_dict
0, // tp_descr_get
0, // tp_descr_set
0, // tp_dictoffset
(initproc)(data.constructor), // tp_init
0, // tp_alloc
cbNew // tp_new
PyVarObject_HEAD_INIT(nullptr, 0)(char *) data.pyName.c_str(), // tp_name
sizeof(PbObject), // tp_basicsize
0, // tp_itemsize
(destructor)cbDealloc, // tp_dealloc
0, // tp_print
0, // tp_getattr
0, // tp_setattr
0, // tp_reserved
0, // tp_repr
num, // tp_as_number
0, // tp_as_sequence
0, // tp_as_mapping
0, // tp_hash
0, // tp_call
0, // tp_str
0, // tp_getattro
0, // tp_setattro
0, // tp_as_buffer
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, // tp_flags
nameptr, // tp_doc
0, // tp_traverse
0, // tp_clear
0, // tp_richcompare
0, // tp_weaklistoffset
0, // tp_iter
0, // tp_iternext
&data.genMethods[0], // tp_methods
0, // tp_members
&data.genGetSet[0], // tp_getset
0, // tp_base
0, // tp_dict
0, // tp_descr_get
0, // tp_descr_set
0, // tp_dictoffset
(initproc)(data.constructor), // tp_init
0, // tp_alloc
cbNew // tp_new
};
data.typeInfo = t;
@@ -722,7 +722,7 @@ bool canConvert(PyObject *obj, const string &classname)
Manta::PbClass *objFromPy(PyObject *obj)
{
if (Py_TYPE(obj)->tp_dealloc != (destructor)cbDealloc) // not a manta object
return NULL;
return nullptr;
return ((PbObject *)obj)->instance;
}

View File

@@ -270,7 +270,7 @@ inline void MTRand::seed()
}
// Was not successful, so use time() and clock() instead
seed(hash(time(NULL), clock()));
seed(hash(time(nullptr), clock()));
}
inline void MTRand::initialize(const uint32 intseed)

View File

@@ -157,18 +157,18 @@ template<class N, class T> struct RCMatrix {
{
for (N i = 0; i < n; i++) {
dealloc_row(i);
matrix[i] = NULL;
matrix[i] = nullptr;
if (offsets.size())
offsets[i] = 0;
}
};
bool empty(N i) const
{
return matrix[i] == NULL;
return matrix[i] == nullptr;
}
N row_nonzero_size(N i) const
{
return matrix[i] == NULL ? 0 : matrix[i]->index.size();
return matrix[i] == nullptr ? 0 : matrix[i]->index.size();
}
void resize(N size, N expected_none_zeros = 0)
{
@@ -185,7 +185,7 @@ template<class N, class T> struct RCMatrix {
// Expanding
matrix.resize(size);
for (N i = n; i < size; i++) {
matrix[i] = NULL;
matrix[i] = nullptr;
if (offsets.size())
offsets[i] = 0;
}
@@ -209,7 +209,7 @@ template<class N, class T> struct RCMatrix {
if (matrix[i]) {
if (offsets.empty() || !offsets[i])
delete matrix[i];
matrix[i] = NULL;
matrix[i] = nullptr;
if (offsets.size())
offsets[i] = 0;
}
@@ -426,7 +426,7 @@ template<class N, class T> struct RCMatrix {
}
operator bool() const
{
return rowEntry != NULL && k < (N)rowEntry->index.size();
return rowEntry != nullptr && k < (N)rowEntry->index.size();
}
Iterator &operator++()
{
@@ -447,7 +447,7 @@ template<class N, class T> struct RCMatrix {
}
N size() const
{
return rowEntry == NULL ? 0 : rowEntry->index.size();
return rowEntry == nullptr ? 0 : rowEntry->index.size();
}
protected:

View File

@@ -35,7 +35,7 @@ bool SimpleImage::writePpm(
}
FILE *fp = fopen(filename.c_str(), "wb");
if (fp == NULL) {
if (fp == nullptr) {
errMsg("SimpleImage::WritePPM Unable to open '" << filename << "' for writing");
return false;
}
@@ -96,7 +96,7 @@ bool SimpleImage::initFromPpm(std::string filename)
}
// 1st line: PPM or PGM
if (fgets(line, MAXLINE, fp) == NULL) {
if (fgets(line, MAXLINE, fp) == nullptr) {
if (mAbortOnError)
debMsg("SimpleImage::initFromPpm fgets failed", 1);
return 0;
@@ -114,7 +114,7 @@ bool SimpleImage::initFromPpm(std::string filename)
// Read in width and height, & allocate space
// 2nd line: width height
if (fgets(line, MAXLINE, fp) == NULL) {
if (fgets(line, MAXLINE, fp) == nullptr) {
if (mAbortOnError)
errMsg("SimpleImage::initFromPpm fgets failed");
return 0;
@@ -156,14 +156,14 @@ bool SimpleImage::initFromPpm(std::string filename)
// Read in maximum value (ignore) , could be scanned with sscanf as well, but this should be
// 255... 3rd line
if (fgets(line, MAXLINE, fp) == NULL) {
if (fgets(line, MAXLINE, fp) == nullptr) {
if (mAbortOnError)
errMsg("SimpleImage::initFromPpm fgets failed");
return 0;
}
// Read in the pixel array row-by-row: 1st row = top scanline */
unsigned char *ptr = NULL;
unsigned char *ptr = nullptr;
ptr = &pic[(windH - 1) * rowsize];
for (int i = windH; i > 0; i--) {
assertMsg(fread((void *)ptr, 1, rowsize, fp) == rowsize,

View File

@@ -29,7 +29,7 @@ namespace Manta {
class SimpleImage {
public:
// cons/des
SimpleImage() : mSize(-1), mpData(NULL), mAbortOnError(true){};
SimpleImage() : mSize(-1), mpData(nullptr), mAbortOnError(true){};
virtual ~SimpleImage()
{
if (mpData)

View File

@@ -688,7 +688,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "cgSolveDiffusion", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);

View File

@@ -617,7 +617,7 @@ struct knUnprojectNormalComp : public KernelBase {
void extrapolateMACSimple(FlagGrid &flags,
MACGrid &vel,
int distance = 4,
LevelsetGrid *phiObs = NULL,
LevelsetGrid *phiObs = nullptr,
bool intoObs = false)
{
Grid<int> tmp(flags.getParent());
@@ -669,13 +669,13 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "extrapolateMACSimple", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 1, &_lock);
int distance = _args.getOpt<int>("distance", 2, 4, &_lock);
LevelsetGrid *phiObs = _args.getPtrOpt<LevelsetGrid>("phiObs", 3, NULL, &_lock);
LevelsetGrid *phiObs = _args.getPtrOpt<LevelsetGrid>("phiObs", 3, nullptr, &_lock);
bool intoObs = _args.getOpt<bool>("intoObs", 4, false, &_lock);
_retval = getPyNone();
extrapolateMACSimple(flags, vel, distance, phiObs, intoObs);
@@ -839,7 +839,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "extrapolateMACFromWeight", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
@@ -1092,7 +1092,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "extrapolateLsSimple", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &phi = *_args.getPtr<Grid<Real>>("phi", 0, &_lock);
@@ -1170,7 +1170,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "extrapolateVec3Simple", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &vel = *_args.getPtr<Grid<Vec3>>("vel", 0, &_lock);

View File

@@ -181,7 +181,7 @@ template<class T, int TDIR> class FastMarch {
Grid<int> &fmFlags,
Grid<Real> &levelset,
Real maxTime,
MACGrid *velTransport = NULL);
MACGrid *velTransport = nullptr);
~FastMarch()
{
}

View File

@@ -440,7 +440,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getUniFileSize", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const string &name = _args.get<string>("name", 0, &_lock);
@@ -479,7 +479,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "printUniFileInfoString", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const string &name = _args.get<string>("name", 0, &_lock);
@@ -715,7 +715,7 @@ template<> int writeGridVol<Real>(const string &name, Grid<Real> *grid)
header.bboxMax = Vec3(0.5);
FILE *fp = fopen(name.c_str(), "wb");
if (fp == NULL) {
if (fp == nullptr) {
errMsg("writeGridVol: Cannot open '" << name << "'");
return 0;
}
@@ -749,7 +749,7 @@ template<> int readGridVol<Real>(const string &name, Grid<Real> *grid)
volHeader header;
FILE *fp = fopen(name.c_str(), "rb");
if (fp == NULL) {
if (fp == nullptr) {
errMsg("readGridVol: Cannot open '" << name << "'");
return 0;
}
@@ -844,11 +844,11 @@ int readGrid4dUni(
1);
#if NO_ZLIB != 1
gzFile gzf = NULL;
gzFile gzf = nullptr;
char ID[5] = {0, 0, 0, 0, 0};
// optionally - reuse file handle, if valid one is passed in fileHandle pointer...
if ((!fileHandle) || (fileHandle && (*fileHandle == NULL))) {
if ((!fileHandle) || (fileHandle && (*fileHandle == nullptr))) {
gzf = (gzFile)safeGzopen(name.c_str(), "rb");
if (!gzf) {
errMsg("readGrid4dUni: can't open file " << name);
@@ -969,11 +969,11 @@ int readGrid4dUni(
void readGrid4dUniCleanup(void **fileHandle)
{
#if NO_ZLIB != 1
gzFile gzf = NULL;
gzFile gzf = nullptr;
if (fileHandle) {
gzf = (gzFile)(*fileHandle);
gzclose(gzf);
*fileHandle = NULL;
*fileHandle = nullptr;
}
#else
debMsg("file format not supported without zlib", 1);
@@ -1171,7 +1171,7 @@ int readGridsNumpy(const string &name, std::vector<PbClass *> *grids)
// adopted from getUniFileSize
void getNpzFileSize(
const string &name, int &x, int &y, int &z, int *t = NULL, std::string *info = NULL)
const string &name, int &x, int &y, int &z, int *t = nullptr, std::string *info = nullptr)
{
x = y = z = 0;
@@ -1207,7 +1207,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getNpzFileSize", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const string &name = _args.get<string>("name", 0, &_lock);
@@ -1289,7 +1289,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "quantizeGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &grid = *_args.getPtr<Grid<Real>>("grid", 0, &_lock);
@@ -1365,7 +1365,7 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "quantizeGridVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &grid = *_args.getPtr<Grid<Vec3>>("grid", 0, &_lock);

View File

@@ -40,7 +40,7 @@ namespace Manta {
#if defined(WIN32) || defined(_WIN32)
static wstring stringToWstring(const char *str)
{
const int length_wc = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0);
const int length_wc = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), nullptr, 0);
wstring strWide(length_wc, 0);
MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), &strWide[0], length_wc);
return strWide;

View File

@@ -51,7 +51,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "load", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const string &name = _args.get<string>("name", 0, &_lock);
@@ -118,7 +118,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "save", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const string &name = _args.get<string>("name", 0, &_lock);

View File

@@ -93,8 +93,8 @@ template<class T>
int readGrid4dUni(const std::string &name,
Grid4d<T> *grid,
int readTslice = -1,
Grid4d<T> *slice = NULL,
void **fileHandle = NULL);
Grid4d<T> *slice = nullptr,
void **fileHandle = nullptr);
void readGrid4dUniCleanup(void **fileHandle);
template<class T> int writeGrid4dRaw(const std::string &name, Grid4d<T> *grid);
template<class T> int readGrid4dRaw(const std::string &name, Grid4d<T> *grid);
@@ -111,8 +111,12 @@ template<class T> int writeMdataUni(const std::string &name, MeshDataImpl<T> *md
template<class T> int readMdataUni(const std::string &name, MeshDataImpl<T> *mdata);
// Helpers
void getUniFileSize(
const std::string &name, int &x, int &y, int &z, int *t = NULL, std::string *info = NULL);
void getUniFileSize(const std::string &name,
int &x,
int &y,
int &z,
int *t = nullptr,
std::string *info = nullptr);
void *safeGzopen(const char *filename, const char *mode);
#if OPENVDB == 1
template<class S, class T> void convertFrom(S &in, T *out);

View File

@@ -172,7 +172,7 @@ PbClass *FluidSolver::create(PbType t, PbTypeVec T, const string &name)
PbClass *ret = PbClass::createPyObject(t.str() + T.str(), name, _args, this);
#else
PbClass *ret = NULL;
PbClass *ret = nullptr;
#endif
return ret;
}
@@ -259,7 +259,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "mantaMsg", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const std::string &out = _args.get<std::string>("out", 0, &_lock);
@@ -297,7 +297,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "printBuildInfo", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
_retval = toPy(printBuildInfo());
@@ -331,7 +331,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setDebugLevel", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int level = _args.getOpt<int>("level", 0, 1, &_lock);
@@ -371,7 +371,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "assertNumpy", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
_retval = getPyNone();

View File

@@ -73,7 +73,7 @@ class FluidSolver : public PbClass {
FluidSolver *pbo = dynamic_cast<FluidSolver *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "FluidSolver::getGridSize", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -121,7 +121,7 @@ class FluidSolver : public PbClass {
FluidSolver *pbo = dynamic_cast<FluidSolver *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "FluidSolver::printMemInfo", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -147,7 +147,7 @@ class FluidSolver : public PbClass {
FluidSolver *pbo = dynamic_cast<FluidSolver *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "FluidSolver::step", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -173,7 +173,7 @@ class FluidSolver : public PbClass {
FluidSolver *pbo = dynamic_cast<FluidSolver *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "FluidSolver::adaptTimestep", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real maxVel = _args.get<Real>("maxVel", 0, &_lock);
@@ -200,7 +200,7 @@ class FluidSolver : public PbClass {
FluidSolver *pbo = dynamic_cast<FluidSolver *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "FluidSolver::create", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
PbType type = _args.get<PbType>("type", 0, &_lock);

View File

@@ -1,3 +1,3 @@
#define MANTA_GIT_VERSION "commit dffc3481b835dfa048effcbb8a9e613294ecae14"
#define MANTA_GIT_VERSION "commit 73990a8a5b876e2b136a646258f714c08c5828da"

View File

@@ -1290,7 +1290,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "gridMaxDiff", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &g1 = *_args.getPtr<Grid<Real>>("g1", 0, &_lock);
@@ -1330,7 +1330,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "gridMaxDiffInt", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<int> &g1 = *_args.getPtr<Grid<int>>("g1", 0, &_lock);
@@ -1377,7 +1377,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "gridMaxDiffVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &g1 = *_args.getPtr<Grid<Vec3>>("g1", 0, &_lock);
@@ -1470,7 +1470,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "copyMacToVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &source = *_args.getPtr<MACGrid>("source", 0, &_lock);
@@ -1507,7 +1507,7 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "convertMacToVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &source = *_args.getPtr<MACGrid>("source", 0, &_lock);
@@ -1604,7 +1604,7 @@ static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "resampleVec3ToMac", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &source = *_args.getPtr<Grid<Vec3>>("source", 0, &_lock);
@@ -1697,7 +1697,7 @@ static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "resampleMacToVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &source = *_args.getPtr<MACGrid>("source", 0, &_lock);
@@ -1789,7 +1789,7 @@ static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "copyLevelsetToReal", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
LevelsetGrid &source = *_args.getPtr<LevelsetGrid>("source", 0, &_lock);
@@ -1911,7 +1911,7 @@ static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "copyVec3ToReal", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &source = *_args.getPtr<Grid<Vec3>>("source", 0, &_lock);
@@ -2035,7 +2035,7 @@ static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "copyRealToVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &sourceX = *_args.getPtr<Grid<Real>>("sourceX", 0, &_lock);
@@ -2074,7 +2074,7 @@ static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "convertLevelsetToReal", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
LevelsetGrid &source = *_args.getPtr<LevelsetGrid>("source", 0, &_lock);
@@ -2139,7 +2139,7 @@ static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "swapComponents", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &vel = *_args.getPtr<Grid<Vec3>>("vel", 0, &_lock);
@@ -2181,7 +2181,7 @@ static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getUvWeight", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &uv = *_args.getPtr<Grid<Vec3>>("uv", 0, &_lock);
@@ -2280,7 +2280,7 @@ struct knResetUvGrid : public KernelBase {
const Vec3 *offset;
};
void resetUvGrid(Grid<Vec3> &target, const Vec3 *offset = NULL)
void resetUvGrid(Grid<Vec3> &target, const Vec3 *offset = nullptr)
{
knResetUvGrid reset(target,
offset); // note, llvm complains about anonymous declaration here... ?
@@ -2292,11 +2292,11 @@ static PyObject *_W_13(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "resetUvGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &target = *_args.getPtr<Grid<Vec3>>("target", 0, &_lock);
const Vec3 *offset = _args.getPtrOpt<Vec3>("offset", 1, NULL, &_lock);
const Vec3 *offset = _args.getPtrOpt<Vec3>("offset", 1, nullptr, &_lock);
_retval = getPyNone();
resetUvGrid(target, offset);
_args.check();
@@ -2318,7 +2318,7 @@ void PbRegister_resetUvGrid()
}
void updateUvWeight(
Real resetTime, int index, int numUvs, Grid<Vec3> &uv, const Vec3 *offset = NULL)
Real resetTime, int index, int numUvs, Grid<Vec3> &uv, const Vec3 *offset = nullptr)
{
const Real t = uv.getParent()->getTime();
Real timeOff = resetTime / (Real)numUvs;
@@ -2357,14 +2357,14 @@ static PyObject *_W_14(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "updateUvWeight", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real resetTime = _args.get<Real>("resetTime", 0, &_lock);
int index = _args.get<int>("index", 1, &_lock);
int numUvs = _args.get<int>("numUvs", 2, &_lock);
Grid<Vec3> &uv = *_args.getPtr<Grid<Vec3>>("uv", 3, &_lock);
const Vec3 *offset = _args.getPtrOpt<Vec3>("offset", 4, NULL, &_lock);
const Vec3 *offset = _args.getPtrOpt<Vec3>("offset", 4, nullptr, &_lock);
_retval = getPyNone();
updateUvWeight(resetTime, index, numUvs, uv, offset);
_args.check();
@@ -2812,7 +2812,7 @@ struct knCountFluidCells : public KernelBase {
//! averaged value for all cells (if flags are given, only for fluid cells)
Real getGridAvg(Grid<Real> &source, FlagGrid *flags = NULL)
Real getGridAvg(Grid<Real> &source, FlagGrid *flags = nullptr)
{
double sum = knGridTotalSum(source, flags);
@@ -2837,11 +2837,11 @@ static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getGridAvg", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &source = *_args.getPtr<Grid<Real>>("source", 0, &_lock);
FlagGrid *flags = _args.getPtrOpt<FlagGrid>("flags", 1, NULL, &_lock);
FlagGrid *flags = _args.getPtrOpt<FlagGrid>("flags", 1, nullptr, &_lock);
_retval = toPy(getGridAvg(source, flags));
_args.check();
}
@@ -2920,7 +2920,7 @@ static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getComponent", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<Vec3> &source = *_args.getPtr<Grid<Vec3>>("source", 0, &_lock);
@@ -3003,7 +3003,7 @@ static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setComponent", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<Real> &source = *_args.getPtr<Grid<Real>>("source", 0, &_lock);
@@ -3373,7 +3373,7 @@ static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "markIsolatedFluidCell", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -3427,7 +3427,7 @@ static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "copyMACData", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MACGrid &source = *_args.getPtr<MACGrid>("source", 0, &_lock);

View File

@@ -79,7 +79,7 @@ class GridBase : public PbClass {
GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "GridBase::getSizeX", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -107,7 +107,7 @@ class GridBase : public PbClass {
GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "GridBase::getSizeY", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -135,7 +135,7 @@ class GridBase : public PbClass {
GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "GridBase::getSizeZ", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -163,7 +163,7 @@ class GridBase : public PbClass {
GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "GridBase::getSize", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -233,7 +233,7 @@ class GridBase : public PbClass {
GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "GridBase::is3D", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -274,7 +274,7 @@ class GridBase : public PbClass {
GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "GridBase::is4D", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -301,7 +301,7 @@ class GridBase : public PbClass {
GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "GridBase::getSizeT", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -328,7 +328,7 @@ class GridBase : public PbClass {
GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "GridBase::getStrideT", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -367,7 +367,7 @@ class GridBase : public PbClass {
GridBase *pbo = dynamic_cast<GridBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "GridBase::setName", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const std::string &name = _args.get<std::string>("name", 0, &_lock);
@@ -447,7 +447,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::save", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -472,7 +472,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::load", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -498,7 +498,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::clear", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -625,7 +625,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::copyFrom", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<T> &a = *_args.getPtr<Grid<T>>("a", 0, &_lock);
@@ -655,7 +655,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::getGridType", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -680,7 +680,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::add", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<T> &a = *_args.getPtr<Grid<T>>("a", 0, &_lock);
@@ -706,7 +706,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::sub", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<T> &a = *_args.getPtr<Grid<T>>("a", 0, &_lock);
@@ -733,7 +733,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::setConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -760,7 +760,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::addConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -787,7 +787,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::addScaled", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<T> &a = *_args.getPtr<Grid<T>>("a", 0, &_lock);
@@ -815,7 +815,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::mult", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<T> &a = *_args.getPtr<Grid<T>>("a", 0, &_lock);
@@ -842,7 +842,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::multConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -869,7 +869,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::safeDivide", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<T> &a = *_args.getPtr<Grid<T>>("a", 0, &_lock);
@@ -895,7 +895,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::clamp", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real min = _args.get<Real>("min", 0, &_lock);
@@ -923,7 +923,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::stomp", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const T &threshold = *_args.getPtr<T>("threshold", 0, &_lock);
@@ -950,7 +950,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::permuteAxes", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int axis0 = _args.get<int>("axis0", 0, &_lock);
@@ -979,7 +979,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::permuteAxesCopyToGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int axis0 = _args.get<int>("axis0", 0, &_lock);
@@ -1009,7 +1009,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::join", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<T> &a = *_args.getPtr<Grid<T>>("a", 0, &_lock);
@@ -1038,7 +1038,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::getMaxAbs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1063,7 +1063,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::getMax", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1088,7 +1088,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::getMin", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1113,7 +1113,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::getL1", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int bnd = _args.getOpt<int>("bnd", 0, 0, &_lock);
@@ -1139,7 +1139,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::getL2", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int bnd = _args.getOpt<int>("bnd", 0, 0, &_lock);
@@ -1165,7 +1165,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::setBound", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T value = _args.get<T>("value", 0, &_lock);
@@ -1193,7 +1193,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::setBoundNeumann", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int boundaryWidth = _args.getOpt<int>("boundaryWidth", 0, 1, &_lock);
@@ -1220,7 +1220,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::getDataPointer", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1245,7 +1245,7 @@ template<class T> class Grid : public GridBase {
Grid *pbo = dynamic_cast<Grid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid::printGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int zSlice = _args.getOpt<int>("zSlice", 0, -1, &_lock);
@@ -1395,7 +1395,7 @@ class MACGrid : public Grid<Vec3> {
MACGrid *pbo = dynamic_cast<MACGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MACGrid::setBoundMAC", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Vec3 value = _args.get<Vec3>("value", 0, &_lock);
@@ -1616,7 +1616,7 @@ class FlagGrid : public Grid<int> {
FlagGrid *pbo = dynamic_cast<FlagGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "FlagGrid::initDomain", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const int &boundaryWidth = _args.getOpt<int>("boundaryWidth", 0, 0, &_lock);
@@ -1650,7 +1650,7 @@ class FlagGrid : public Grid<int> {
FlagGrid *pbo = dynamic_cast<FlagGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "FlagGrid::updateFromLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
LevelsetGrid &levelset = *_args.getPtr<LevelsetGrid>("levelset", 0, &_lock);
@@ -1677,7 +1677,7 @@ class FlagGrid : public Grid<int> {
FlagGrid *pbo = dynamic_cast<FlagGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "FlagGrid::fillGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int type = _args.getOpt<int>("type", 0, TypeFluid, &_lock);
@@ -1698,7 +1698,7 @@ class FlagGrid : public Grid<int> {
//! count no. of cells matching flags via "AND"
//! warning for large grids! only regular int returned (due to python interface)
//! optionally creates mask in RealGrid (1 where flag matches, 0 otherwise)
int countCells(int flag, int bnd = 0, Grid<Real> *mask = NULL);
int countCells(int flag, int bnd = 0, Grid<Real> *mask = nullptr);
static PyObject *_W_44(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
@@ -1706,12 +1706,12 @@ class FlagGrid : public Grid<int> {
FlagGrid *pbo = dynamic_cast<FlagGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "FlagGrid::countCells", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int flag = _args.get<int>("flag", 0, &_lock);
int bnd = _args.getOpt<int>("bnd", 1, 0, &_lock);
Grid<Real> *mask = _args.getPtrOpt<Grid<Real>>("mask", 2, NULL, &_lock);
Grid<Real> *mask = _args.getPtrOpt<Grid<Real>>("mask", 2, nullptr, &_lock);
pbo->_args.copy(_args);
_retval = toPy(pbo->countCells(flag, bnd, mask));
pbo->_args.check();

View File

@@ -888,7 +888,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getComp4d", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid4d<Vec4> &src = *_args.getPtr<Grid4d<Vec4>>("src", 0, &_lock);
@@ -926,7 +926,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setComp4d", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid4d<Real> &src = *_args.getPtr<Grid4d<Real>>("src", 0, &_lock);
@@ -1170,7 +1170,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "grid4dMaxDiff", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid4d<Real> &g1 = *_args.getPtr<Grid4d<Real>>("g1", 0, &_lock);
@@ -1210,7 +1210,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "grid4dMaxDiffInt", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid4d<int> &g1 = *_args.getPtr<Grid4d<int>>("g1", 0, &_lock);
@@ -1254,7 +1254,7 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "grid4dMaxDiffVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid4d<Vec3> &g1 = *_args.getPtr<Grid4d<Vec3>>("g1", 0, &_lock);
@@ -1298,7 +1298,7 @@ static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "grid4dMaxDiffVec4", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid4d<Vec4> &g1 = *_args.getPtr<Grid4d<Vec4>>("g1", 0, &_lock);
@@ -1422,7 +1422,7 @@ static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setRegion4d", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid4d<Real> &dst = *_args.getPtr<Grid4d<Real>>("dst", 0, &_lock);
@@ -1461,7 +1461,7 @@ static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setRegion4dVec4", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid4d<Vec4> &dst = *_args.getPtr<Grid4d<Vec4>>("dst", 0, &_lock);
@@ -1510,7 +1510,7 @@ static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getSliceFrom4d", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid4d<Real> &src = *_args.getPtr<Grid4d<Real>>("src", 0, &_lock);
@@ -1537,7 +1537,7 @@ void PbRegister_getSliceFrom4d()
}
//! slow helper to visualize tests, get a 3d slice of a 4d vec4 grid
void getSliceFrom4dVec(Grid4d<Vec4> &src, int srct, Grid<Vec3> &dst, Grid<Real> *dstt = NULL)
void getSliceFrom4dVec(Grid4d<Vec4> &src, int srct, Grid<Vec3> &dst, Grid<Real> *dstt = nullptr)
{
const int bnd = 0;
if (!src.isInBounds(Vec4i(bnd, bnd, bnd, srct)))
@@ -1561,13 +1561,13 @@ static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getSliceFrom4dVec", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid4d<Vec4> &src = *_args.getPtr<Grid4d<Vec4>>("src", 0, &_lock);
int srct = _args.get<int>("srct", 1, &_lock);
Grid<Vec3> &dst = *_args.getPtr<Grid<Vec3>>("dst", 2, &_lock);
Grid<Real> *dstt = _args.getPtrOpt<Grid<Real>>("dstt", 3, NULL, &_lock);
Grid<Real> *dstt = _args.getPtrOpt<Grid<Real>>("dstt", 3, nullptr, &_lock);
_retval = getPyNone();
getSliceFrom4dVec(src, srct, dst, dstt);
_args.check();
@@ -1716,7 +1716,7 @@ static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "interpolateGrid4d", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid4d<Real> &target = *_args.getPtr<Grid4d<Real>>("target", 0, &_lock);
@@ -1763,7 +1763,7 @@ static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "interpolateGrid4dVec", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid4d<Vec4> &target = *_args.getPtr<Grid4d<Vec4>>("target", 0, &_lock);

View File

@@ -69,7 +69,7 @@ class Grid4dBase : public PbClass {
Grid4dBase *pbo = dynamic_cast<Grid4dBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4dBase::getSizeX", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -97,7 +97,7 @@ class Grid4dBase : public PbClass {
Grid4dBase *pbo = dynamic_cast<Grid4dBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4dBase::getSizeY", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -125,7 +125,7 @@ class Grid4dBase : public PbClass {
Grid4dBase *pbo = dynamic_cast<Grid4dBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4dBase::getSizeZ", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -153,7 +153,7 @@ class Grid4dBase : public PbClass {
Grid4dBase *pbo = dynamic_cast<Grid4dBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4dBase::getSizeT", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -181,7 +181,7 @@ class Grid4dBase : public PbClass {
Grid4dBase *pbo = dynamic_cast<Grid4dBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4dBase::getSize", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -256,7 +256,7 @@ class Grid4dBase : public PbClass {
Grid4dBase *pbo = dynamic_cast<Grid4dBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4dBase::is3D", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -283,7 +283,7 @@ class Grid4dBase : public PbClass {
Grid4dBase *pbo = dynamic_cast<Grid4dBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4dBase::is4D", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -380,7 +380,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::save", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -405,7 +405,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::load", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -431,7 +431,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::clear", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -535,7 +535,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::copyFrom", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid4d<T> &a = *_args.getPtr<Grid4d<T>>("a", 0, &_lock);
@@ -565,7 +565,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::add", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid4d<T> &a = *_args.getPtr<Grid4d<T>>("a", 0, &_lock);
@@ -591,7 +591,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::sub", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid4d<T> &a = *_args.getPtr<Grid4d<T>>("a", 0, &_lock);
@@ -618,7 +618,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::setConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -645,7 +645,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::addConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -672,7 +672,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::addScaled", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid4d<T> &a = *_args.getPtr<Grid4d<T>>("a", 0, &_lock);
@@ -700,7 +700,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::mult", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid4d<T> &a = *_args.getPtr<Grid4d<T>>("a", 0, &_lock);
@@ -727,7 +727,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::multConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -754,7 +754,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::clamp", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real min = _args.get<Real>("min", 0, &_lock);
@@ -783,7 +783,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::getMaxAbs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -808,7 +808,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::getMax", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -833,7 +833,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::getMin", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -858,7 +858,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::setBound", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T value = _args.get<T>("value", 0, &_lock);
@@ -886,7 +886,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::setBoundNeumann", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int boundaryWidth = _args.getOpt<int>("boundaryWidth", 0, 1, &_lock);
@@ -913,7 +913,7 @@ template<class T> class Grid4d : public Grid4dBase {
Grid4d *pbo = dynamic_cast<Grid4d *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Grid4d::printGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int zSlice = _args.getOpt<int>("zSlice", 0, -1, &_lock);

View File

@@ -510,7 +510,7 @@ static void doReinitMarch(Grid<Real> &phi,
const int dim = (phi.is3D() ? 3 : 2);
Grid<int> fmFlags(phi.getParent());
FastMarch<FmHeapEntryIn, -1> marchIn(flags, fmFlags, phi, maxTime, NULL);
FastMarch<FmHeapEntryIn, -1> marchIn(flags, fmFlags, phi, maxTime, nullptr);
// march inside
InitFmIn(flags, fmFlags, phi, ignoreWalls, obstacleType);

View File

@@ -60,7 +60,7 @@ class LevelsetGrid : public Grid<Real> {
void reinitMarching(const FlagGrid &flags,
Real maxTime = 4.0,
MACGrid *velTransport = NULL,
MACGrid *velTransport = nullptr,
bool ignoreWalls = false,
bool correctOuterLayer = true,
int obstacleType = FlagGrid::TypeObstacle);
@@ -71,12 +71,12 @@ class LevelsetGrid : public Grid<Real> {
LevelsetGrid *pbo = dynamic_cast<LevelsetGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "LevelsetGrid::reinitMarching", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
Real maxTime = _args.getOpt<Real>("maxTime", 1, 4.0, &_lock);
MACGrid *velTransport = _args.getPtrOpt<MACGrid>("velTransport", 2, NULL, &_lock);
MACGrid *velTransport = _args.getPtrOpt<MACGrid>("velTransport", 2, nullptr, &_lock);
bool ignoreWalls = _args.getOpt<bool>("ignoreWalls", 3, false, &_lock);
bool correctOuterLayer = _args.getOpt<bool>("correctOuterLayer", 4, true, &_lock);
int obstacleType = _args.getOpt<int>("obstacleType", 5, FlagGrid::TypeObstacle, &_lock);
@@ -104,7 +104,7 @@ class LevelsetGrid : public Grid<Real> {
LevelsetGrid *pbo = dynamic_cast<LevelsetGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "LevelsetGrid::createMesh", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Mesh &mesh = *_args.getPtr<Mesh>("mesh", 0, &_lock);
@@ -131,7 +131,7 @@ class LevelsetGrid : public Grid<Real> {
LevelsetGrid *pbo = dynamic_cast<LevelsetGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "LevelsetGrid::join", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const LevelsetGrid &o = *_args.getPtr<LevelsetGrid>("o", 0, &_lock);
@@ -149,7 +149,9 @@ class LevelsetGrid : public Grid<Real> {
}
}
void subtract(const LevelsetGrid &o, const FlagGrid *flags = NULL, const int subtractType = 0);
void subtract(const LevelsetGrid &o,
const FlagGrid *flags = nullptr,
const int subtractType = 0);
static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
@@ -157,11 +159,11 @@ class LevelsetGrid : public Grid<Real> {
LevelsetGrid *pbo = dynamic_cast<LevelsetGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "LevelsetGrid::subtract", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const LevelsetGrid &o = *_args.getPtr<LevelsetGrid>("o", 0, &_lock);
const FlagGrid *flags = _args.getPtrOpt<FlagGrid>("flags", 1, NULL, &_lock);
const FlagGrid *flags = _args.getPtrOpt<FlagGrid>("flags", 1, nullptr, &_lock);
const int subtractType = _args.getOpt<int>("subtractType", 2, 0, &_lock);
pbo->_args.copy(_args);
_retval = getPyNone();
@@ -186,7 +188,7 @@ class LevelsetGrid : public Grid<Real> {
LevelsetGrid *pbo = dynamic_cast<LevelsetGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "LevelsetGrid::initFromFlags", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -215,7 +217,7 @@ class LevelsetGrid : public Grid<Real> {
LevelsetGrid *pbo = dynamic_cast<LevelsetGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "LevelsetGrid::fillHoles", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int maxDepth = _args.getOpt<int>("maxDepth", 0, 10, &_lock);
@@ -243,7 +245,7 @@ class LevelsetGrid : public Grid<Real> {
LevelsetGrid *pbo = dynamic_cast<LevelsetGrid *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "LevelsetGrid::floodFill", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Real value = _args.getOpt<Real>("value", 0, -0.5, &_lock);

View File

@@ -39,7 +39,7 @@ Mesh::Mesh(FluidSolver *parent) : PbClass(parent)
Mesh::~Mesh()
{
for (IndexInt i = 0; i < (IndexInt)mMeshData.size(); ++i)
mMeshData[i]->setMesh(NULL);
mMeshData[i]->setMesh(nullptr);
if (mFreeMdata) {
for (IndexInt i = 0; i < (IndexInt)mMeshData.size(); ++i)
@@ -88,7 +88,7 @@ PbClass *Mesh::create(PbType t, PbTypeVec T, const string &name)
"Unable to get mesh data pointer from newly created object. Only create MeshData type "
"with a Mesh.creat() call, eg, MdataReal, MdataVec3 etc.");
delete pyObj;
return NULL;
return nullptr;
}
else {
this->registerMdata(mdata);
@@ -97,7 +97,7 @@ PbClass *Mesh::create(PbType t, PbTypeVec T, const string &name)
// directly init size of new mdata field:
mdata->resize(this->getSizeSlow());
#else
PbClass *pyObj = NULL;
PbClass *pyObj = nullptr;
#endif
return pyObj;
}
@@ -1279,7 +1279,7 @@ std::string Mesh::getTrisDataPointer()
// mesh data
MeshDataBase::MeshDataBase(FluidSolver *parent) : PbClass(parent), mMesh(NULL)
MeshDataBase::MeshDataBase(FluidSolver *parent) : PbClass(parent), mMesh(nullptr)
{
}
@@ -1294,13 +1294,13 @@ MeshDataBase::~MeshDataBase()
template<class T>
MeshDataImpl<T>::MeshDataImpl(FluidSolver *parent)
: MeshDataBase(parent), mpGridSource(NULL), mGridSourceMAC(false)
: MeshDataBase(parent), mpGridSource(nullptr), mGridSourceMAC(false)
{
}
template<class T>
MeshDataImpl<T>::MeshDataImpl(FluidSolver *parent, MeshDataImpl<T> *other)
: MeshDataBase(parent), mpGridSource(NULL), mGridSourceMAC(false)
: MeshDataBase(parent), mpGridSource(nullptr), mGridSourceMAC(false)
{
this->mData = other->mData;
setName(other->getName());

View File

@@ -223,7 +223,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::clear", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -248,7 +248,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::fromShape", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Shape &shape = *_args.getPtr<Shape>("shape", 0, &_lock);
@@ -275,7 +275,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::advectInGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -303,7 +303,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::scale", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Vec3 s = _args.get<Vec3>("s", 0, &_lock);
@@ -329,7 +329,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::offset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Vec3 o = _args.get<Vec3>("o", 0, &_lock);
@@ -355,7 +355,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::rotate", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Vec3 thetas = _args.get<Vec3>("thetas", 0, &_lock);
@@ -381,7 +381,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::computeVelocity", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Mesh &oldMesh = *_args.getPtr<Mesh>("oldMesh", 0, &_lock);
@@ -409,7 +409,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::load", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -435,7 +435,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::save", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -460,7 +460,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::computeLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
LevelsetGrid &levelset = *_args.getPtr<LevelsetGrid>("levelset", 0, &_lock);
@@ -488,7 +488,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::getLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real sigma = _args.get<Real>("sigma", 0, &_lock);
@@ -518,7 +518,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::applyMeshToGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
GridBase *grid = _args.getPtr<GridBase>("grid", 0, &_lock);
@@ -548,7 +548,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::getNodesDataPointer", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -573,7 +573,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::getTrisDataPointer", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -734,7 +734,7 @@ class Mesh : public PbClass {
Mesh *pbo = dynamic_cast<Mesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Mesh::create", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
PbType type = _args.get<PbType>("type", 0, &_lock);
@@ -852,7 +852,7 @@ class MeshDataBase : public PbClass {
virtual MeshDataBase *clone()
{
assertMsg(false, "Dont use, override...");
return NULL;
return nullptr;
}
virtual MdataType getType() const
{
@@ -952,7 +952,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::clear", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -978,7 +978,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::setSource", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<T> *grid = _args.getPtr<Grid<T>>("grid", 0, &_lock);
@@ -1026,7 +1026,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::setConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -1052,7 +1052,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::setConstRange", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -1080,7 +1080,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::copyFrom", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MeshDataImpl<T> &a = *_args.getPtr<MeshDataImpl<T>>("a", 0, &_lock);
@@ -1105,7 +1105,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::add", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MeshDataImpl<T> &a = *_args.getPtr<MeshDataImpl<T>>("a", 0, &_lock);
@@ -1131,7 +1131,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::sub", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MeshDataImpl<T> &a = *_args.getPtr<MeshDataImpl<T>>("a", 0, &_lock);
@@ -1157,7 +1157,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::addConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -1183,7 +1183,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::addScaled", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MeshDataImpl<T> &a = *_args.getPtr<MeshDataImpl<T>>("a", 0, &_lock);
@@ -1210,7 +1210,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::mult", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MeshDataImpl<T> &a = *_args.getPtr<MeshDataImpl<T>>("a", 0, &_lock);
@@ -1236,7 +1236,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::multConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -1262,7 +1262,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::safeDiv", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MeshDataImpl<T> &a = *_args.getPtr<MeshDataImpl<T>>("a", 0, &_lock);
@@ -1288,7 +1288,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::clamp", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real min = _args.get<Real>("min", 0, &_lock);
@@ -1315,7 +1315,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::clampMin", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real vmin = _args.get<Real>("vmin", 0, &_lock);
@@ -1341,7 +1341,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::clampMax", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real vmax = _args.get<Real>("vmax", 0, &_lock);
@@ -1367,7 +1367,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::getMaxAbs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1391,7 +1391,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::getMax", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1415,7 +1415,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::getMin", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1431,7 +1431,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
}
}
T sum(const MeshDataImpl<int> *t = NULL, const int itype = 0) const;
T sum(const MeshDataImpl<int> *t = nullptr, const int itype = 0) const;
static PyObject *_W_36(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
@@ -1439,10 +1439,10 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::sum", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MeshDataImpl<int> *t = _args.getPtrOpt<MeshDataImpl<int>>("t", 0, NULL, &_lock);
const MeshDataImpl<int> *t = _args.getPtrOpt<MeshDataImpl<int>>("t", 0, nullptr, &_lock);
const int itype = _args.getOpt<int>("itype", 1, 0, &_lock);
pbo->_args.copy(_args);
_retval = toPy(pbo->sum(t, itype));
@@ -1465,7 +1465,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::sumSquare", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1489,7 +1489,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::sumMagnitude", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1514,7 +1514,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::setConstIntFlag", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
T s = _args.get<T>("s", 0, &_lock);
@@ -1542,7 +1542,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::printMdata", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
IndexInt start = _args.getOpt<IndexInt>("start", 0, -1, &_lock);
@@ -1571,7 +1571,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::save", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -1596,7 +1596,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::load", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -1622,7 +1622,7 @@ template<class T> class MeshDataImpl : public MeshDataBase {
MeshDataImpl *pbo = dynamic_cast<MeshDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MeshDataImpl::getDataPointer", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);

View File

@@ -62,7 +62,7 @@ class MovingObstacle : public PbClass {
MovingObstacle *pbo = dynamic_cast<MovingObstacle *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MovingObstacle::add", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Shape *shape = _args.getPtr<Shape>("shape", 0, &_lock);
@@ -96,7 +96,7 @@ class MovingObstacle : public PbClass {
MovingObstacle *pbo = dynamic_cast<MovingObstacle *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MovingObstacle::moveLinear", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real t = _args.get<Real>("t", 0, &_lock);
@@ -130,7 +130,7 @@ class MovingObstacle : public PbClass {
MovingObstacle *pbo = dynamic_cast<MovingObstacle *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "MovingObstacle::projectOutside", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);

View File

@@ -34,7 +34,7 @@ using namespace std;
namespace Manta {
int WaveletNoiseField::randomSeed = 13322223;
Real *WaveletNoiseField::mNoiseTile = NULL;
Real *WaveletNoiseField::mNoiseTile = nullptr;
std::atomic<int> WaveletNoiseField::mNoiseReferenceCount(0);
static Real _aCoeffs[32] = {

View File

@@ -64,7 +64,7 @@ class WaveletNoiseField : public PbClass {
{
if (mNoiseTile && !mNoiseReferenceCount) {
delete mNoiseTile;
mNoiseTile = NULL;
mNoiseTile = nullptr;
}
};

View File

@@ -37,7 +37,7 @@ ParticleBase::~ParticleBase()
{
// make sure data fields now parent system is deleted
for (IndexInt i = 0; i < (IndexInt)mPartData.size(); ++i)
mPartData[i]->setParticleSys(NULL);
mPartData[i]->setParticleSys(nullptr);
if (mFreePdata) {
for (IndexInt i = 0; i < (IndexInt)mPartData.size(); ++i)
@@ -93,7 +93,7 @@ PbClass *ParticleBase::create(PbType t, PbTypeVec T, const string &name)
"Unable to get particle data pointer from newly created object. Only create ParticleData "
"type with a ParticleSys.creat() call, eg, PdataReal, PdataVec3 etc.");
delete pyObj;
return NULL;
return nullptr;
}
else {
this->registerPdata(pdata);
@@ -102,7 +102,7 @@ PbClass *ParticleBase::create(PbType t, PbTypeVec T, const string &name)
// directly init size of new pdata field:
pdata->resize(this->getSizeSlow());
#else
PbClass *pyObj = NULL;
PbClass *pyObj = nullptr;
#endif
return pyObj;
}
@@ -297,7 +297,7 @@ void BasicParticleSystem::readParticles(BasicParticleSystem *from)
// particle data
ParticleDataBase::ParticleDataBase(FluidSolver *parent) : PbClass(parent), mpParticleSys(NULL)
ParticleDataBase::ParticleDataBase(FluidSolver *parent) : PbClass(parent), mpParticleSys(nullptr)
{
}
@@ -312,13 +312,13 @@ ParticleDataBase::~ParticleDataBase()
template<class T>
ParticleDataImpl<T>::ParticleDataImpl(FluidSolver *parent)
: ParticleDataBase(parent), mpGridSource(NULL), mGridSourceMAC(false)
: ParticleDataBase(parent), mpGridSource(nullptr), mGridSourceMAC(false)
{
}
template<class T>
ParticleDataImpl<T>::ParticleDataImpl(FluidSolver *parent, ParticleDataImpl<T> *other)
: ParticleDataBase(parent), mpGridSource(NULL), mGridSourceMAC(false)
: ParticleDataBase(parent), mpGridSource(nullptr), mGridSourceMAC(false)
{
this->mData = other->mData;
setName(other->getName());

View File

@@ -86,7 +86,7 @@ class ParticleBase : public PbClass {
virtual ParticleBase *clone()
{
assertMsg(false, "Dont use, override...");
return NULL;
return nullptr;
}
//! slow virtual function to query size, do not use in kernels! use size() instead
@@ -122,7 +122,7 @@ class ParticleBase : public PbClass {
ParticleBase *pbo = dynamic_cast<ParticleBase *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleBase::create", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
PbType type = _args.get<PbType>("type", 0, &_lock);
@@ -274,7 +274,7 @@ template<class S> class ParticleSystem : public ParticleBase {
ParticleSystem *pbo = dynamic_cast<ParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleSystem::pySize", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -342,7 +342,7 @@ template<class S> class ParticleSystem : public ParticleBase {
ParticleSystem *pbo = dynamic_cast<ParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleSystem::setPos", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const IndexInt idx = _args.get<IndexInt>("idx", 0, &_lock);
@@ -373,7 +373,7 @@ template<class S> class ParticleSystem : public ParticleBase {
ParticleSystem *pbo = dynamic_cast<ParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleSystem::getPos", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const IndexInt idx = _args.get<IndexInt>("idx", 0, &_lock);
@@ -399,7 +399,7 @@ template<class S> class ParticleSystem : public ParticleBase {
ParticleSystem *pbo = dynamic_cast<ParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleSystem::getPosPdata", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
ParticleDataImpl<Vec3> &target = *_args.getPtr<ParticleDataImpl<Vec3>>(
@@ -426,7 +426,7 @@ template<class S> class ParticleSystem : public ParticleBase {
ParticleSystem *pbo = dynamic_cast<ParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleSystem::setPosPdata", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<Vec3> &source = *_args.getPtr<ParticleDataImpl<Vec3>>(
@@ -477,7 +477,7 @@ template<class S> class ParticleSystem : public ParticleBase {
ParticleSystem *pbo = dynamic_cast<ParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleSystem::clear", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -501,7 +501,7 @@ template<class S> class ParticleSystem : public ParticleBase {
const bool deleteInObstacle = true,
const bool stopInObstacle = true,
const bool skipNew = false,
const ParticleDataImpl<int> *ptype = NULL,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0);
static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -510,7 +510,7 @@ template<class S> class ParticleSystem : public ParticleBase {
ParticleSystem *pbo = dynamic_cast<ParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleSystem::advectInGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -520,7 +520,7 @@ template<class S> class ParticleSystem : public ParticleBase {
const bool stopInObstacle = _args.getOpt<bool>("stopInObstacle", 4, true, &_lock);
const bool skipNew = _args.getOpt<bool>("skipNew", 5, false, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 6, NULL, &_lock);
"ptype", 6, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 7, 0, &_lock);
pbo->_args.copy(_args);
_retval = getPyNone();
@@ -552,7 +552,7 @@ template<class S> class ParticleSystem : public ParticleBase {
ParticleSystem *pbo = dynamic_cast<ParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleSystem::projectOutside", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &gradient = *_args.getPtr<Grid<Vec3>>("gradient", 0, &_lock);
@@ -573,7 +573,7 @@ template<class S> class ParticleSystem : public ParticleBase {
void projectOutOfBnd(const FlagGrid &flags,
const Real bnd,
const std::string &plane = "xXyYzZ",
const ParticleDataImpl<int> *ptype = NULL,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0);
static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -582,14 +582,14 @@ template<class S> class ParticleSystem : public ParticleBase {
ParticleSystem *pbo = dynamic_cast<ParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleSystem::projectOutOfBnd", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
const Real bnd = _args.get<Real>("bnd", 1, &_lock);
const std::string &plane = _args.getOpt<std::string>("plane", 2, "xXyYzZ", &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 3, NULL, &_lock);
"ptype", 3, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 4, 0, &_lock);
pbo->_args.copy(_args);
_retval = getPyNone();
@@ -685,7 +685,7 @@ class BasicParticleSystem : public ParticleSystem<BasicParticleData> {
BasicParticleSystem *pbo = dynamic_cast<BasicParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "BasicParticleSystem::save", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -710,7 +710,7 @@ class BasicParticleSystem : public ParticleSystem<BasicParticleData> {
BasicParticleSystem *pbo = dynamic_cast<BasicParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "BasicParticleSystem::load", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -742,7 +742,7 @@ class BasicParticleSystem : public ParticleSystem<BasicParticleData> {
BasicParticleSystem *pbo = dynamic_cast<BasicParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "BasicParticleSystem::readParticles", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
BasicParticleSystem *from = _args.getPtr<BasicParticleSystem>("from", 0, &_lock);
@@ -772,7 +772,7 @@ class BasicParticleSystem : public ParticleSystem<BasicParticleData> {
BasicParticleSystem *pbo = dynamic_cast<BasicParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "BasicParticleSystem::addParticle", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Vec3 pos = _args.get<Vec3>("pos", 0, &_lock);
@@ -804,7 +804,7 @@ class BasicParticleSystem : public ParticleSystem<BasicParticleData> {
BasicParticleSystem *pbo = dynamic_cast<BasicParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "BasicParticleSystem::printParts", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
IndexInt start = _args.getOpt<IndexInt>("start", 0, -1, &_lock);
@@ -833,7 +833,7 @@ class BasicParticleSystem : public ParticleSystem<BasicParticleData> {
BasicParticleSystem *pbo = dynamic_cast<BasicParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "BasicParticleSystem::getDataPointer", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1028,7 +1028,7 @@ class ParticleDataBase : public PbClass {
virtual ParticleDataBase *clone()
{
assertMsg(false, "Dont use, override...");
return NULL;
return nullptr;
}
virtual PdataType getType() const
{
@@ -1139,7 +1139,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::clear", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1165,7 +1165,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::setSource", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<T> *grid = _args.getPtr<Grid<T>>("grid", 0, &_lock);
@@ -1213,7 +1213,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::copyFrom", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<T> &a = *_args.getPtr<ParticleDataImpl<T>>("a", 0, &_lock);
@@ -1238,7 +1238,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::setConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const T &s = *_args.getPtr<T>("s", 0, &_lock);
@@ -1264,7 +1264,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::setConstRange", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const T &s = *_args.getPtr<T>("s", 0, &_lock);
@@ -1292,7 +1292,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::add", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<T> &a = *_args.getPtr<ParticleDataImpl<T>>("a", 0, &_lock);
@@ -1318,7 +1318,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::sub", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<T> &a = *_args.getPtr<ParticleDataImpl<T>>("a", 0, &_lock);
@@ -1344,7 +1344,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::addConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const T &s = *_args.getPtr<T>("s", 0, &_lock);
@@ -1370,7 +1370,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::addScaled", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<T> &a = *_args.getPtr<ParticleDataImpl<T>>("a", 0, &_lock);
@@ -1397,7 +1397,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::mult", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<T> &a = *_args.getPtr<ParticleDataImpl<T>>("a", 0, &_lock);
@@ -1423,7 +1423,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::multConst", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const T &s = *_args.getPtr<T>("s", 0, &_lock);
@@ -1449,7 +1449,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::safeDiv", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<T> &a = *_args.getPtr<ParticleDataImpl<T>>("a", 0, &_lock);
@@ -1475,7 +1475,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::clamp", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Real vmin = _args.get<Real>("vmin", 0, &_lock);
@@ -1502,7 +1502,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::clampMin", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Real vmin = _args.get<Real>("vmin", 0, &_lock);
@@ -1528,7 +1528,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::clampMax", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Real vmax = _args.get<Real>("vmax", 0, &_lock);
@@ -1554,7 +1554,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::getMaxAbs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1578,7 +1578,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::getMax", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1602,7 +1602,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::getMin", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1618,7 +1618,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
}
}
T sum(const ParticleDataImpl<int> *t = NULL, const int itype = 0) const;
T sum(const ParticleDataImpl<int> *t = nullptr, const int itype = 0) const;
static PyObject *_W_41(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
try {
@@ -1626,11 +1626,11 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::sum", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<int> *t = _args.getPtrOpt<ParticleDataImpl<int>>(
"t", 0, NULL, &_lock);
"t", 0, nullptr, &_lock);
const int itype = _args.getOpt<int>("itype", 1, 0, &_lock);
pbo->_args.copy(_args);
_retval = toPy(pbo->sum(t, itype));
@@ -1653,7 +1653,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::sumSquare", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1677,7 +1677,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::sumMagnitude", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -1702,7 +1702,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::setConstIntFlag", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const T &s = *_args.getPtr<T>("s", 0, &_lock);
@@ -1730,7 +1730,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::printPdata", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
IndexInt start = _args.getOpt<IndexInt>("start", 0, -1, &_lock);
@@ -1759,7 +1759,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::save", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -1784,7 +1784,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::load", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const std::string name = _args.get<std::string>("name", 0, &_lock);
@@ -1810,7 +1810,7 @@ template<class T> class ParticleDataImpl : public ParticleDataBase {
ParticleDataImpl *pbo = dynamic_cast<ParticleDataImpl *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "ParticleDataImpl::getDataPointer", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -2152,9 +2152,9 @@ static inline Vec3 bisectBacktracePos(const FlagGrid &flags, const Vec3 &oldp, c
template<class S> struct KnClampPositions : public KernelBase {
KnClampPositions(std::vector<S> &p,
const FlagGrid &flags,
ParticleDataImpl<Vec3> *posOld = NULL,
ParticleDataImpl<Vec3> *posOld = nullptr,
bool stopInObstacle = true,
const ParticleDataImpl<int> *ptype = NULL,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0)
: KernelBase(p.size()),
p(p),
@@ -2170,9 +2170,9 @@ template<class S> struct KnClampPositions : public KernelBase {
inline void op(IndexInt idx,
std::vector<S> &p,
const FlagGrid &flags,
ParticleDataImpl<Vec3> *posOld = NULL,
ParticleDataImpl<Vec3> *posOld = nullptr,
bool stopInObstacle = true,
const ParticleDataImpl<int> *ptype = NULL,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0) const
{
if (p[idx].flag & ParticleBase::PDELETE)
@@ -2255,7 +2255,7 @@ void ParticleSystem<S>::advectInGrid(const FlagGrid &flags,
const int exclude)
{
// position clamp requires old positions, backup
ParticleDataImpl<Vec3> *posOld = NULL;
ParticleDataImpl<Vec3> *posOld = nullptr;
if (!deleteInObstacle) {
posOld = new ParticleDataImpl<Vec3>(this->getParent());
posOld->resize(mData.size());

View File

@@ -1336,7 +1336,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "resetPhiInObs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -1476,7 +1476,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "advectSemiLagrange", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid *flags = _args.getPtr<FlagGrid>("flags", 0, &_lock);

View File

@@ -6,7 +6,7 @@
// ----------------------------------------------------------------------------
//
// MantaFlow fluid solver framework
// Copyright 2016-2017 Kiwon Um, Nils Thuerey
// Copyright 2016-2020 Kiwon Um, Nils Thuerey
//
// This program is free software, distributed under the terms of the
// Apache License, Version 2.0
@@ -21,6 +21,52 @@
namespace Manta {
#define FOR_INT_IJK(num) \
for (int i = 0; i < num; ++i) \
for (int j = 0; j < num; ++j) \
for (int k = 0; k < num; ++k)
static inline IndexInt indexUFace(const Vec3 &pos, const MACGrid &ref)
{
const Vec3i f = toVec3i(pos), c = toVec3i(pos - 0.5);
const IndexInt index = f.x * ref.getStrideX() + c.y * ref.getStrideY() + c.z * ref.getStrideZ();
assertDeb(ref.isInBounds(index),
"U face index out of bounds for particle position [" << pos.x << ", " << pos.y << ", "
<< pos.z << "]");
return (ref.isInBounds(index)) ? index : -1;
}
static inline IndexInt indexVFace(const Vec3 &pos, const MACGrid &ref)
{
const Vec3i f = toVec3i(pos), c = toVec3i(pos - 0.5);
const IndexInt index = c.x * ref.getStrideX() + f.y * ref.getStrideY() + c.z * ref.getStrideZ();
assertDeb(ref.isInBounds(index),
"V face index out of bounds for particle position [" << pos.x << ", " << pos.y << ", "
<< pos.z << "]");
return (ref.isInBounds(index)) ? index : -1;
}
static inline IndexInt indexWFace(const Vec3 &pos, const MACGrid &ref)
{
const Vec3i f = toVec3i(pos), c = toVec3i(pos - 0.5);
const IndexInt index = c.x * ref.getStrideX() + c.y * ref.getStrideY() + f.z * ref.getStrideZ();
assertDeb(ref.isInBounds(index),
"W face index out of bounds for particle position [" << pos.x << ", " << pos.y << ", "
<< pos.z << "]");
return (ref.isInBounds(index)) ? index : -1;
}
static inline IndexInt indexOffset(
const IndexInt gidx, const int i, const int j, const int k, const MACGrid &ref)
{
const IndexInt dX[2] = {0, ref.getStrideX()};
const IndexInt dY[2] = {0, ref.getStrideY()};
const IndexInt dZ[2] = {0, ref.getStrideZ()};
const IndexInt index = gidx + dX[i] + dY[j] + dZ[k];
assertDeb(ref.isInBounds(index), "Offset index " << index << " is out of bounds");
return (ref.isInBounds(index)) ? index : -1;
}
struct knApicMapLinearVec3ToMACGrid : public KernelBase {
knApicMapLinearVec3ToMACGrid(const BasicParticleSystem &p,
MACGrid &mg,
@@ -30,7 +76,8 @@ struct knApicMapLinearVec3ToMACGrid : public KernelBase {
const ParticleDataImpl<Vec3> &cpy,
const ParticleDataImpl<Vec3> &cpz,
const ParticleDataImpl<int> *ptype,
const int exclude)
const int exclude,
const int boundaryWidth)
: KernelBase(p.size()),
p(p),
mg(mg),
@@ -40,7 +87,8 @@ struct knApicMapLinearVec3ToMACGrid : public KernelBase {
cpy(cpy),
cpz(cpz),
ptype(ptype),
exclude(exclude)
exclude(exclude),
boundaryWidth(boundaryWidth)
{
runMessage();
run();
@@ -54,73 +102,91 @@ struct knApicMapLinearVec3ToMACGrid : public KernelBase {
const ParticleDataImpl<Vec3> &cpy,
const ParticleDataImpl<Vec3> &cpz,
const ParticleDataImpl<int> *ptype,
const int exclude)
const int exclude,
const int boundaryWidth)
{
if (!p.isActive(idx) || (ptype && ((*ptype)[idx] & exclude)))
return;
const IndexInt dX[2] = {0, vg.getStrideX()};
const IndexInt dY[2] = {0, vg.getStrideY()};
const IndexInt dZ[2] = {0, vg.getStrideZ()};
if (!vg.isInBounds(p.getPos(idx), boundaryWidth)) {
debMsg("Skipping particle at index " << idx
<< ". Is out of bounds and cannot be applied to grid.",
1);
return;
}
const Vec3 &pos = p.getPos(idx), &vel = vp[idx];
const Vec3i f = toVec3i(pos);
const Vec3i c = toVec3i(pos - 0.5);
const Vec3 wf = clamp(pos - toVec3(f), Vec3(0.), Vec3(1.));
const Vec3 wc = clamp(pos - toVec3(c) - 0.5, Vec3(0.), Vec3(1.));
const Vec3 &pos = p[idx].pos, &vel = vp[idx];
const IndexInt fi = static_cast<IndexInt>(pos.x), fj = static_cast<IndexInt>(pos.y),
fk = static_cast<IndexInt>(pos.z);
const IndexInt ci = static_cast<IndexInt>(pos.x - 0.5),
cj = static_cast<IndexInt>(pos.y - 0.5),
ck = static_cast<IndexInt>(pos.z - 0.5);
const Real wfi = clamp(pos.x - fi, Real(0), Real(1)),
wfj = clamp(pos.y - fj, Real(0), Real(1)),
wfk = clamp(pos.z - fk, Real(0), Real(1));
const Real wci = clamp(Real(pos.x - ci - 0.5), Real(0), Real(1)),
wcj = clamp(Real(pos.y - cj - 0.5), Real(0), Real(1)),
wck = clamp(Real(pos.z - ck - 0.5), Real(0), Real(1));
// TODO: check index for safety
{ // u-face
const IndexInt gidx = fi * dX[1] + cj * dY[1] + ck * dZ[1];
const Vec3 gpos(fi, cj + 0.5, ck + 0.5);
const Real wi[2] = {Real(1) - wfi, wfi};
const Real wj[2] = {Real(1) - wcj, wcj};
const Real wk[2] = {Real(1) - wck, wck};
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
for (int k = 0; k < 2; ++k) {
const Real w = wi[i] * wj[j] * wk[k];
mg[gidx + dX[i] + dY[j] + dZ[k]].x += w;
vg[gidx + dX[i] + dY[j] + dZ[k]].x += w * vel.x;
vg[gidx + dX[i] + dY[j] + dZ[k]].x += w * dot(cpx[idx], gpos + Vec3(i, j, k) - pos);
}
const IndexInt gidx = indexUFace(pos, vg);
if (gidx < 0)
return; // debug will fail before
const Vec3 gpos(f.x, c.y + 0.5, c.z + 0.5);
const Real wi[2] = {Real(1) - wf.x, wf.x};
const Real wj[2] = {Real(1) - wc.y, wc.y};
const Real wk[2] = {Real(1) - wc.z, wc.z};
FOR_INT_IJK(2)
{
const Real w = wi[i] * wj[j] * wk[k];
const IndexInt vidx = indexOffset(gidx, i, j, k, vg);
if (vidx < 0)
continue; // debug will fail before
mg[vidx].x += w;
vg[vidx].x += w * vel.x;
vg[vidx].x += w * dot(cpx[idx], gpos + Vec3(i, j, k) - pos);
}
}
{ // v-face
const IndexInt gidx = ci * dX[1] + fj * dY[1] + ck * dZ[1];
const Vec3 gpos(ci + 0.5, fj, ck + 0.5);
const Real wi[2] = {Real(1) - wci, wci};
const Real wj[2] = {Real(1) - wfj, wfj};
const Real wk[2] = {Real(1) - wck, wck};
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
for (int k = 0; k < 2; ++k) {
const Real w = wi[i] * wj[j] * wk[k];
mg[gidx + dX[i] + dY[j] + dZ[k]].y += w;
vg[gidx + dX[i] + dY[j] + dZ[k]].y += w * vel.y;
vg[gidx + dX[i] + dY[j] + dZ[k]].y += w * dot(cpy[idx], gpos + Vec3(i, j, k) - pos);
}
const IndexInt gidx = indexVFace(pos, vg);
if (gidx < 0)
return;
const Vec3 gpos(c.x + 0.5, f.y, c.z + 0.5);
const Real wi[2] = {Real(1) - wc.x, wc.x};
const Real wj[2] = {Real(1) - wf.y, wf.y};
const Real wk[2] = {Real(1) - wc.z, wc.z};
FOR_INT_IJK(2)
{
const Real w = wi[i] * wj[j] * wk[k];
const IndexInt vidx = indexOffset(gidx, i, j, k, vg);
if (vidx < 0)
continue;
mg[vidx].y += w;
vg[vidx].y += w * vel.y;
vg[vidx].y += w * dot(cpy[idx], gpos + Vec3(i, j, k) - pos);
}
}
if (!vg.is3D())
return;
{ // w-face
const IndexInt gidx = ci * dX[1] + cj * dY[1] + fk * dZ[1];
const Vec3 gpos(ci + 0.5, cj + 0.5, fk);
const Real wi[2] = {Real(1) - wci, wci};
const Real wj[2] = {Real(1) - wcj, wcj};
const Real wk[2] = {Real(1) - wfk, wfk};
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
for (int k = 0; k < 2; ++k) {
const Real w = wi[i] * wj[j] * wk[k];
mg[gidx + dX[i] + dY[j] + dZ[k]].z += w;
vg[gidx + dX[i] + dY[j] + dZ[k]].z += w * vel.z;
vg[gidx + dX[i] + dY[j] + dZ[k]].z += w * dot(cpz[idx], gpos + Vec3(i, j, k) - pos);
}
const IndexInt gidx = indexWFace(pos, vg);
if (gidx < 0)
return;
const Vec3 gpos(c.x + 0.5, c.y + 0.5, f.z);
const Real wi[2] = {Real(1) - wc.x, wc.x};
const Real wj[2] = {Real(1) - wc.y, wc.y};
const Real wk[2] = {Real(1) - wf.z, wf.z};
FOR_INT_IJK(2)
{
const Real w = wi[i] * wj[j] * wk[k];
const IndexInt vidx = indexOffset(gidx, i, j, k, vg);
if (vidx < 0)
continue;
mg[vidx].z += w;
vg[vidx].z += w * vel.z;
vg[vidx].z += w * dot(cpz[idx], gpos + Vec3(i, j, k) - pos);
}
}
}
inline const BasicParticleSystem &getArg0()
@@ -168,6 +234,11 @@ struct knApicMapLinearVec3ToMACGrid : public KernelBase {
return exclude;
}
typedef int type8;
inline const int &getArg9()
{
return boundaryWidth;
}
typedef int type9;
void runMessage()
{
debMsg("Executing kernel knApicMapLinearVec3ToMACGrid ", 3);
@@ -179,7 +250,7 @@ struct knApicMapLinearVec3ToMACGrid : public KernelBase {
{
const IndexInt _sz = size;
for (IndexInt i = 0; i < _sz; i++)
op(i, p, mg, vg, vp, cpx, cpy, cpz, ptype, exclude);
op(i, p, mg, vg, vp, cpx, cpy, cpz, ptype, exclude, boundaryWidth);
}
const BasicParticleSystem &p;
MACGrid &mg;
@@ -190,6 +261,7 @@ struct knApicMapLinearVec3ToMACGrid : public KernelBase {
const ParticleDataImpl<Vec3> &cpz;
const ParticleDataImpl<int> *ptype;
const int exclude;
const int boundaryWidth;
};
void apicMapPartsToMAC(const FlagGrid &flags,
@@ -199,25 +271,24 @@ void apicMapPartsToMAC(const FlagGrid &flags,
const ParticleDataImpl<Vec3> &cpx,
const ParticleDataImpl<Vec3> &cpy,
const ParticleDataImpl<Vec3> &cpz,
MACGrid *mass = NULL,
const ParticleDataImpl<int> *ptype = NULL,
const int exclude = 0)
MACGrid *mass = nullptr,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0,
const int boundaryWidth = 0)
{
// affine map
// let's assume that the particle mass is constant, 1.0
const bool freeMass = !mass;
if (!mass)
mass = new MACGrid(flags.getParent());
else
mass->clear();
// affine map: let's assume that the particle mass is constant, 1.0
MACGrid tmpmass(vel.getParent());
tmpmass.clear();
vel.clear();
knApicMapLinearVec3ToMACGrid(parts, *mass, vel, partVel, cpx, cpy, cpz, ptype, exclude);
mass->stomp(VECTOR_EPSILON);
vel.safeDivide(*mass);
if (freeMass)
delete mass;
knApicMapLinearVec3ToMACGrid(
parts, tmpmass, vel, partVel, cpx, cpy, cpz, ptype, exclude, boundaryWidth);
tmpmass.stomp(VECTOR_EPSILON);
vel.safeDivide(tmpmass);
if (mass)
(*mass).swap(tmpmass);
}
static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -226,7 +297,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "apicMapPartsToMAC", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -237,12 +308,14 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const ParticleDataImpl<Vec3> &cpx = *_args.getPtr<ParticleDataImpl<Vec3>>("cpx", 4, &_lock);
const ParticleDataImpl<Vec3> &cpy = *_args.getPtr<ParticleDataImpl<Vec3>>("cpy", 5, &_lock);
const ParticleDataImpl<Vec3> &cpz = *_args.getPtr<ParticleDataImpl<Vec3>>("cpz", 6, &_lock);
MACGrid *mass = _args.getPtrOpt<MACGrid>("mass", 7, NULL, &_lock);
MACGrid *mass = _args.getPtrOpt<MACGrid>("mass", 7, nullptr, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 8, NULL, &_lock);
"ptype", 8, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 9, 0, &_lock);
const int boundaryWidth = _args.getOpt<int>("boundaryWidth", 10, 0, &_lock);
_retval = getPyNone();
apicMapPartsToMAC(flags, vel, parts, partVel, cpx, cpy, cpz, mass, ptype, exclude);
apicMapPartsToMAC(
flags, vel, parts, partVel, cpx, cpy, cpz, mass, ptype, exclude, boundaryWidth);
_args.check();
}
pbFinalizePlugin(parent, "apicMapPartsToMAC", !noTiming);
@@ -270,7 +343,8 @@ struct knApicMapLinearMACGridToVec3 : public KernelBase {
const MACGrid &vg,
const FlagGrid &flags,
const ParticleDataImpl<int> *ptype,
const int exclude)
const int exclude,
const int boundaryWidth)
: KernelBase(vp.size()),
vp(vp),
cpx(cpx),
@@ -280,7 +354,8 @@ struct knApicMapLinearMACGridToVec3 : public KernelBase {
vg(vg),
flags(flags),
ptype(ptype),
exclude(exclude)
exclude(exclude),
boundaryWidth(boundaryWidth)
{
runMessage();
run();
@@ -294,78 +369,94 @@ struct knApicMapLinearMACGridToVec3 : public KernelBase {
const MACGrid &vg,
const FlagGrid &flags,
const ParticleDataImpl<int> *ptype,
const int exclude) const
const int exclude,
const int boundaryWidth) const
{
if (!p.isActive(idx) || (ptype && ((*ptype)[idx] & exclude)))
return;
if (!vg.isInBounds(p.getPos(idx), boundaryWidth)) {
debMsg("Skipping particle at index " << idx
<< ". Is out of bounds and cannot get value from grid.",
1);
return;
}
vp[idx] = cpx[idx] = cpy[idx] = cpz[idx] = Vec3(Real(0));
const IndexInt dX[2] = {0, vg.getStrideX()}, dY[2] = {0, vg.getStrideY()},
dZ[2] = {0, vg.getStrideZ()};
const Real gw[2] = {-Real(1), Real(1)};
const Vec3 &pos = p[idx].pos;
const IndexInt fi = static_cast<IndexInt>(pos.x), fj = static_cast<IndexInt>(pos.y),
fk = static_cast<IndexInt>(pos.z);
const IndexInt ci = static_cast<IndexInt>(pos.x - 0.5),
cj = static_cast<IndexInt>(pos.y - 0.5),
ck = static_cast<IndexInt>(pos.z - 0.5);
const Real wfi = clamp(pos.x - fi, Real(0), Real(1)),
wfj = clamp(pos.y - fj, Real(0), Real(1)),
wfk = clamp(pos.z - fk, Real(0), Real(1));
const Real wci = clamp(Real(pos.x - ci - 0.5), Real(0), Real(1)),
wcj = clamp(Real(pos.y - cj - 0.5), Real(0), Real(1)),
wck = clamp(Real(pos.z - ck - 0.5), Real(0), Real(1));
// TODO: check index for safety
{ // u
const IndexInt gidx = fi * dX[1] + cj * dY[1] + ck * dZ[1];
const Real wx[2] = {Real(1) - wfi, wfi};
const Real wy[2] = {Real(1) - wcj, wcj};
const Real wz[2] = {Real(1) - wck, wck};
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
for (int k = 0; k < 2; ++k) {
const IndexInt vidx = gidx + dX[i] + dY[j] + dZ[k];
Real vgx = vg[vidx].x;
vp[idx].x += wx[i] * wy[j] * wz[k] * vgx;
cpx[idx].x += gw[i] * wy[j] * wz[k] * vgx;
cpx[idx].y += wx[i] * gw[j] * wz[k] * vgx;
cpx[idx].z += wx[i] * wy[j] * gw[k] * vgx;
}
const Vec3 &pos = p.getPos(idx);
const Vec3i f = toVec3i(pos);
const Vec3i c = toVec3i(pos - 0.5);
const Vec3 wf = clamp(pos - toVec3(f), Vec3(0.), Vec3(1.));
const Vec3 wc = clamp(pos - toVec3(c) - 0.5, Vec3(0.), Vec3(1.));
{ // u-face
const IndexInt gidx = indexUFace(pos, vg);
if (gidx < 0)
return; // debug will fail before
const Real wx[2] = {Real(1) - wf.x, wf.x};
const Real wy[2] = {Real(1) - wc.y, wc.y};
const Real wz[2] = {Real(1) - wc.z, wc.z};
FOR_INT_IJK(2)
{
const IndexInt vidx = indexOffset(gidx, i, j, k, vg);
if (vidx < 0)
continue; // debug will fail before
const Real vgx = vg[vidx].x;
vp[idx].x += wx[i] * wy[j] * wz[k] * vgx;
cpx[idx].x += gw[i] * wy[j] * wz[k] * vgx;
cpx[idx].y += wx[i] * gw[j] * wz[k] * vgx;
cpx[idx].z += wx[i] * wy[j] * gw[k] * vgx;
}
}
{ // v
const IndexInt gidx = ci * dX[1] + fj * dY[1] + ck * dZ[1];
const Real wx[2] = {Real(1) - wci, wci};
const Real wy[2] = {Real(1) - wfj, wfj};
const Real wz[2] = {Real(1) - wck, wck};
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
for (int k = 0; k < 2; ++k) {
const IndexInt vidx = gidx + dX[i] + dY[j] + dZ[k];
Real vgy = vg[vidx].y;
vp[idx].y += wx[i] * wy[j] * wz[k] * vgy;
cpy[idx].x += gw[i] * wy[j] * wz[k] * vgy;
cpy[idx].y += wx[i] * gw[j] * wz[k] * vgy;
cpy[idx].z += wx[i] * wy[j] * gw[k] * vgy;
}
{ // v-face
const IndexInt gidx = indexVFace(pos, vg);
if (gidx < 0)
return;
const Real wx[2] = {Real(1) - wc.x, wc.x};
const Real wy[2] = {Real(1) - wf.y, wf.y};
const Real wz[2] = {Real(1) - wc.z, wc.z};
FOR_INT_IJK(2)
{
const IndexInt vidx = indexOffset(gidx, i, j, k, vg);
if (vidx < 0)
continue;
const Real vgy = vg[vidx].y;
vp[idx].y += wx[i] * wy[j] * wz[k] * vgy;
cpy[idx].x += gw[i] * wy[j] * wz[k] * vgy;
cpy[idx].y += wx[i] * gw[j] * wz[k] * vgy;
cpy[idx].z += wx[i] * wy[j] * gw[k] * vgy;
}
}
if (!vg.is3D())
return;
{ // w
const IndexInt gidx = ci * dX[1] + cj * dY[1] + fk * dZ[1];
const Real wx[2] = {Real(1) - wci, wci};
const Real wy[2] = {Real(1) - wcj, wcj};
const Real wz[2] = {Real(1) - wfk, wfk};
for (int i = 0; i < 2; ++i)
for (int j = 0; j < 2; ++j)
for (int k = 0; k < 2; ++k) {
const IndexInt vidx = gidx + dX[i] + dY[j] + dZ[k];
Real vgz = vg[vidx].z;
vp[idx].z += wx[i] * wy[j] * wz[k] * vgz;
cpz[idx].x += gw[i] * wy[j] * wz[k] * vgz;
cpz[idx].y += wx[i] * gw[j] * wz[k] * vgz;
cpz[idx].z += wx[i] * wy[j] * gw[k] * vgz;
}
{ // w-face
const IndexInt gidx = indexWFace(pos, vg);
if (gidx < 0)
return;
const Real wx[2] = {Real(1) - wc.x, wc.x};
const Real wy[2] = {Real(1) - wc.y, wc.y};
const Real wz[2] = {Real(1) - wf.z, wf.z};
FOR_INT_IJK(2)
{
const IndexInt vidx = indexOffset(gidx, i, j, k, vg);
if (vidx < 0)
continue;
const Real vgz = vg[vidx].z;
vp[idx].z += wx[i] * wy[j] * wz[k] * vgz;
cpz[idx].x += gw[i] * wy[j] * wz[k] * vgz;
cpz[idx].y += wx[i] * gw[j] * wz[k] * vgz;
cpz[idx].z += wx[i] * wy[j] * gw[k] * vgz;
}
}
}
inline ParticleDataImpl<Vec3> &getArg0()
@@ -413,6 +504,11 @@ struct knApicMapLinearMACGridToVec3 : public KernelBase {
return exclude;
}
typedef int type8;
inline const int &getArg9()
{
return boundaryWidth;
}
typedef int type9;
void runMessage()
{
debMsg("Executing kernel knApicMapLinearMACGridToVec3 ", 3);
@@ -423,7 +519,7 @@ struct knApicMapLinearMACGridToVec3 : public KernelBase {
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++)
op(idx, vp, cpx, cpy, cpz, p, vg, flags, ptype, exclude);
op(idx, vp, cpx, cpy, cpz, p, vg, flags, ptype, exclude, boundaryWidth);
}
void run()
{
@@ -438,6 +534,7 @@ struct knApicMapLinearMACGridToVec3 : public KernelBase {
const FlagGrid &flags;
const ParticleDataImpl<int> *ptype;
const int exclude;
const int boundaryWidth;
};
void apicMapMACGridToParts(ParticleDataImpl<Vec3> &partVel,
@@ -447,10 +544,12 @@ void apicMapMACGridToParts(ParticleDataImpl<Vec3> &partVel,
const BasicParticleSystem &parts,
const MACGrid &vel,
const FlagGrid &flags,
const ParticleDataImpl<int> *ptype = NULL,
const int exclude = 0)
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0,
const int boundaryWidth = 0)
{
knApicMapLinearMACGridToVec3(partVel, cpx, cpy, cpz, parts, vel, flags, ptype, exclude);
knApicMapLinearMACGridToVec3(
partVel, cpx, cpy, cpz, parts, vel, flags, ptype, exclude, boundaryWidth);
}
static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -459,7 +558,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "apicMapMACGridToParts", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
ParticleDataImpl<Vec3> &partVel = *_args.getPtr<ParticleDataImpl<Vec3>>(
@@ -471,10 +570,12 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const MACGrid &vel = *_args.getPtr<MACGrid>("vel", 5, &_lock);
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 6, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 7, NULL, &_lock);
"ptype", 7, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 8, 0, &_lock);
const int boundaryWidth = _args.getOpt<int>("boundaryWidth", 9, 0, &_lock);
_retval = getPyNone();
apicMapMACGridToParts(partVel, cpx, cpy, cpz, parts, vel, flags, ptype, exclude);
apicMapMACGridToParts(
partVel, cpx, cpy, cpz, parts, vel, flags, ptype, exclude, boundaryWidth);
_args.check();
}
pbFinalizePlugin(parent, "apicMapMACGridToParts", !noTiming);

View File

@@ -248,7 +248,7 @@ struct KnApplyForce : public KernelBase {
void addGravity(const FlagGrid &flags,
MACGrid &vel,
Vec3 gravity,
const Grid<Real> *exclude = NULL,
const Grid<Real> *exclude = nullptr,
bool scale = true)
{
float gridScale = (scale) ? flags.getDx() : 1;
@@ -262,13 +262,13 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "addGravity", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 1, &_lock);
Vec3 gravity = _args.get<Vec3>("gravity", 2, &_lock);
const Grid<Real> *exclude = _args.getPtrOpt<Grid<Real>>("exclude", 3, NULL, &_lock);
const Grid<Real> *exclude = _args.getPtrOpt<Grid<Real>>("exclude", 3, nullptr, &_lock);
bool scale = _args.getOpt<bool>("scale", 4, true, &_lock);
_retval = getPyNone();
addGravity(flags, vel, gravity, exclude, scale);
@@ -294,7 +294,7 @@ void PbRegister_addGravity()
void addGravityNoScale(const FlagGrid &flags,
MACGrid &vel,
const Vec3 &gravity,
const Grid<Real> *exclude = NULL)
const Grid<Real> *exclude = nullptr)
{
addGravity(flags, vel, gravity, exclude, false);
}
@@ -305,13 +305,13 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "addGravityNoScale", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 1, &_lock);
const Vec3 &gravity = _args.get<Vec3>("gravity", 2, &_lock);
const Grid<Real> *exclude = _args.getPtrOpt<Grid<Real>>("exclude", 3, NULL, &_lock);
const Grid<Real> *exclude = _args.getPtrOpt<Grid<Real>>("exclude", 3, nullptr, &_lock);
_retval = getPyNone();
addGravityNoScale(flags, vel, gravity, exclude);
_args.check();
@@ -434,7 +434,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "addBuoyancy", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -537,7 +537,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setOpenBound", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -567,11 +567,11 @@ void PbRegister_setOpenBound()
//! delete fluid and ensure empty flag in outflow cells, delete particles and density and set phi
//! to 0.5
void resetOutflow(FlagGrid &flags,
Grid<Real> *phi = 0,
BasicParticleSystem *parts = 0,
Grid<Real> *real = 0,
Grid<int> *index = 0,
ParticleIndexSystem *indexSys = 0)
Grid<Real> *phi = nullptr,
BasicParticleSystem *parts = nullptr,
Grid<Real> *real = nullptr,
Grid<int> *index = nullptr,
ParticleIndexSystem *indexSys = nullptr)
{
// check if phi and parts -> pindex and gpi already created -> access particles from cell index,
// avoid extra looping over particles
@@ -623,16 +623,17 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "resetOutflow", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 1, 0, &_lock);
BasicParticleSystem *parts = _args.getPtrOpt<BasicParticleSystem>("parts", 2, 0, &_lock);
Grid<Real> *real = _args.getPtrOpt<Grid<Real>>("real", 3, 0, &_lock);
Grid<int> *index = _args.getPtrOpt<Grid<int>>("index", 4, 0, &_lock);
Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 1, nullptr, &_lock);
BasicParticleSystem *parts = _args.getPtrOpt<BasicParticleSystem>(
"parts", 2, nullptr, &_lock);
Grid<Real> *real = _args.getPtrOpt<Grid<Real>>("real", 3, nullptr, &_lock);
Grid<int> *index = _args.getPtrOpt<Grid<int>>("index", 4, nullptr, &_lock);
ParticleIndexSystem *indexSys = _args.getPtrOpt<ParticleIndexSystem>(
"indexSys", 5, 0, &_lock);
"indexSys", 5, nullptr, &_lock);
_retval = getPyNone();
resetOutflow(flags, phi, parts, real, index, indexSys);
_args.check();
@@ -747,7 +748,7 @@ static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setInflowBcs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
@@ -1064,13 +1065,13 @@ struct KnSetWallBcsFrac : public KernelBase {
};
//! set zero normal velocity boundary condition on walls
// (optionally with second order accuracy using the obstacle SDF , fractions grid currentlyl not
// (optionally with second order accuracy using the obstacle SDF , fractions grid currently not
// needed)
void setWallBcs(const FlagGrid &flags,
MACGrid &vel,
const MACGrid *obvel = 0,
const MACGrid *fractions = 0,
const Grid<Real> *phiObs = 0,
const MACGrid *obvel = nullptr,
const MACGrid *fractions = nullptr,
const Grid<Real> *phiObs = nullptr,
int boundaryWidth = 0)
{
if (!phiObs || !fractions) {
@@ -1089,14 +1090,14 @@ static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setWallBcs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 1, &_lock);
const MACGrid *obvel = _args.getPtrOpt<MACGrid>("obvel", 2, 0, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 3, 0, &_lock);
const Grid<Real> *phiObs = _args.getPtrOpt<Grid<Real>>("phiObs", 4, 0, &_lock);
const MACGrid *obvel = _args.getPtrOpt<MACGrid>("obvel", 2, nullptr, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 3, nullptr, &_lock);
const Grid<Real> *phiObs = _args.getPtrOpt<Grid<Real>>("phiObs", 4, nullptr, &_lock);
int boundaryWidth = _args.getOpt<int>("boundaryWidth", 5, 0, &_lock);
_retval = getPyNone();
setWallBcs(flags, vel, obvel, fractions, phiObs, boundaryWidth);
@@ -1219,7 +1220,7 @@ static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setInitialVelocity", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -1342,7 +1343,7 @@ struct KnConfForce : public KernelBase {
void vorticityConfinement(MACGrid &vel,
const FlagGrid &flags,
Real strength = 0,
const Grid<Real> *strengthCell = NULL)
const Grid<Real> *strengthCell = nullptr)
{
Grid<Vec3> velCenter(flags.getParent()), curl(flags.getParent()), force(flags.getParent());
Grid<Real> norm(flags.getParent());
@@ -1351,7 +1352,7 @@ void vorticityConfinement(MACGrid &vel,
CurlOp(velCenter, curl);
GridNorm(norm, curl);
KnConfForce(force, norm, curl, strength, strengthCell);
KnApplyForceField(flags, vel, force, NULL, true, false);
KnApplyForceField(flags, vel, force, nullptr, true, false);
}
static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1360,14 +1361,14 @@ static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "vorticityConfinement", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 1, &_lock);
Real strength = _args.getOpt<Real>("strength", 2, 0, &_lock);
const Grid<Real> *strengthCell = _args.getPtrOpt<Grid<Real>>(
"strengthCell", 3, NULL, &_lock);
"strengthCell", 3, nullptr, &_lock);
_retval = getPyNone();
vorticityConfinement(vel, flags, strength, strengthCell);
_args.check();
@@ -1391,7 +1392,7 @@ void PbRegister_vorticityConfinement()
void addForceField(const FlagGrid &flags,
MACGrid &vel,
const Grid<Vec3> &force,
const Grid<Real> *region = NULL,
const Grid<Real> *region = nullptr,
bool isMAC = false)
{
KnApplyForceField(flags, vel, force, region, true, isMAC);
@@ -1403,13 +1404,13 @@ static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "addForceField", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 1, &_lock);
const Grid<Vec3> &force = *_args.getPtr<Grid<Vec3>>("force", 2, &_lock);
const Grid<Real> *region = _args.getPtrOpt<Grid<Real>>("region", 3, NULL, &_lock);
const Grid<Real> *region = _args.getPtrOpt<Grid<Real>>("region", 3, nullptr, &_lock);
bool isMAC = _args.getOpt<bool>("isMAC", 4, false, &_lock);
_retval = getPyNone();
addForceField(flags, vel, force, region, isMAC);
@@ -1434,7 +1435,7 @@ void PbRegister_addForceField()
void setForceField(const FlagGrid &flags,
MACGrid &vel,
const Grid<Vec3> &force,
const Grid<Real> *region = NULL,
const Grid<Real> *region = nullptr,
bool isMAC = false)
{
KnApplyForceField(flags, vel, force, region, false, isMAC);
@@ -1446,13 +1447,13 @@ static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setForceField", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 1, &_lock);
const Grid<Vec3> &force = *_args.getPtr<Grid<Vec3>>("force", 2, &_lock);
const Grid<Real> *region = _args.getPtrOpt<Grid<Real>>("region", 3, NULL, &_lock);
const Grid<Real> *region = _args.getPtrOpt<Grid<Real>>("region", 3, nullptr, &_lock);
bool isMAC = _args.getOpt<bool>("isMAC", 4, false, &_lock);
_retval = getPyNone();
setForceField(flags, vel, force, region, isMAC);
@@ -1645,10 +1646,10 @@ struct KnDissolveSmoke : public KernelBase {
void dissolveSmoke(const FlagGrid &flags,
Grid<Real> &density,
Grid<Real> *heat = NULL,
Grid<Real> *red = NULL,
Grid<Real> *green = NULL,
Grid<Real> *blue = NULL,
Grid<Real> *heat = nullptr,
Grid<Real> *red = nullptr,
Grid<Real> *green = nullptr,
Grid<Real> *blue = nullptr,
int speed = 5,
bool logFalloff = true)
{
@@ -1663,15 +1664,15 @@ static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "dissolveSmoke", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
Grid<Real> &density = *_args.getPtr<Grid<Real>>("density", 1, &_lock);
Grid<Real> *heat = _args.getPtrOpt<Grid<Real>>("heat", 2, NULL, &_lock);
Grid<Real> *red = _args.getPtrOpt<Grid<Real>>("red", 3, NULL, &_lock);
Grid<Real> *green = _args.getPtrOpt<Grid<Real>>("green", 4, NULL, &_lock);
Grid<Real> *blue = _args.getPtrOpt<Grid<Real>>("blue", 5, NULL, &_lock);
Grid<Real> *heat = _args.getPtrOpt<Grid<Real>>("heat", 2, nullptr, &_lock);
Grid<Real> *red = _args.getPtrOpt<Grid<Real>>("red", 3, nullptr, &_lock);
Grid<Real> *green = _args.getPtrOpt<Grid<Real>>("green", 4, nullptr, &_lock);
Grid<Real> *blue = _args.getPtrOpt<Grid<Real>>("blue", 5, nullptr, &_lock);
int speed = _args.getOpt<int>("speed", 6, 5, &_lock);
bool logFalloff = _args.getOpt<bool>("logFalloff", 7, true, &_lock);
_retval = getPyNone();

View File

@@ -258,10 +258,10 @@ struct KnProcessBurn : public KernelBase {
void processBurn(Grid<Real> &fuel,
Grid<Real> &density,
Grid<Real> &react,
Grid<Real> *red = NULL,
Grid<Real> *green = NULL,
Grid<Real> *blue = NULL,
Grid<Real> *heat = NULL,
Grid<Real> *red = nullptr,
Grid<Real> *green = nullptr,
Grid<Real> *blue = nullptr,
Grid<Real> *heat = nullptr,
Real burningRate = 0.75f,
Real flameSmoke = 1.0f,
Real ignitionTemp = 1.25f,
@@ -290,16 +290,16 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "processBurn", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &fuel = *_args.getPtr<Grid<Real>>("fuel", 0, &_lock);
Grid<Real> &density = *_args.getPtr<Grid<Real>>("density", 1, &_lock);
Grid<Real> &react = *_args.getPtr<Grid<Real>>("react", 2, &_lock);
Grid<Real> *red = _args.getPtrOpt<Grid<Real>>("red", 3, NULL, &_lock);
Grid<Real> *green = _args.getPtrOpt<Grid<Real>>("green", 4, NULL, &_lock);
Grid<Real> *blue = _args.getPtrOpt<Grid<Real>>("blue", 5, NULL, &_lock);
Grid<Real> *heat = _args.getPtrOpt<Grid<Real>>("heat", 6, NULL, &_lock);
Grid<Real> *red = _args.getPtrOpt<Grid<Real>>("red", 3, nullptr, &_lock);
Grid<Real> *green = _args.getPtrOpt<Grid<Real>>("green", 4, nullptr, &_lock);
Grid<Real> *blue = _args.getPtrOpt<Grid<Real>>("blue", 5, nullptr, &_lock);
Grid<Real> *heat = _args.getPtrOpt<Grid<Real>>("heat", 6, nullptr, &_lock);
Real burningRate = _args.getOpt<Real>("burningRate", 7, 0.75f, &_lock);
Real flameSmoke = _args.getOpt<Real>("flameSmoke", 8, 1.0f, &_lock);
Real ignitionTemp = _args.getOpt<Real>("ignitionTemp", 9, 1.25f, &_lock);
@@ -407,7 +407,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "updateFlame", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<Real> &react = *_args.getPtr<Grid<Real>>("react", 0, &_lock);

View File

@@ -69,7 +69,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "sampleFlagsWithParticles", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -156,7 +156,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "sampleLevelsetWithParticles", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const LevelsetGrid &phi = *_args.getPtr<LevelsetGrid>("phi", 0, &_lock);
@@ -200,7 +200,7 @@ void sampleShapeWithParticles(const Shape &shape,
const Real randomness,
const bool reset = false,
const bool refillEmpty = false,
const LevelsetGrid *exclude = NULL)
const LevelsetGrid *exclude = nullptr)
{
const bool is3D = flags.is3D();
const Real jlen = randomness / discretization;
@@ -243,7 +243,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "sampleShapeWithParticles", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Shape &shape = *_args.getPtr<Shape>("shape", 0, &_lock);
@@ -253,7 +253,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const Real randomness = _args.get<Real>("randomness", 4, &_lock);
const bool reset = _args.getOpt<bool>("reset", 5, false, &_lock);
const bool refillEmpty = _args.getOpt<bool>("refillEmpty", 6, false, &_lock);
const LevelsetGrid *exclude = _args.getPtrOpt<LevelsetGrid>("exclude", 7, NULL, &_lock);
const LevelsetGrid *exclude = _args.getPtrOpt<LevelsetGrid>("exclude", 7, nullptr, &_lock);
_retval = getPyNone();
sampleShapeWithParticles(
shape, flags, parts, discretization, randomness, reset, refillEmpty, exclude);
@@ -418,8 +418,8 @@ struct knSetNbObstacle : public KernelBase {
};
void markFluidCells(const BasicParticleSystem &parts,
FlagGrid &flags,
const Grid<Real> *phiObs = NULL,
const ParticleDataImpl<int> *ptype = NULL,
const Grid<Real> *phiObs = nullptr,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0)
{
// remove all fluid cells
@@ -448,14 +448,14 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "markFluidCells", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 1, &_lock);
const Grid<Real> *phiObs = _args.getPtrOpt<Grid<Real>>("phiObs", 2, NULL, &_lock);
const Grid<Real> *phiObs = _args.getPtrOpt<Grid<Real>>("phiObs", 2, nullptr, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 3, NULL, &_lock);
"ptype", 3, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 4, 0, &_lock);
_retval = getPyNone();
markFluidCells(parts, flags, phiObs, ptype, exclude);
@@ -492,7 +492,7 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "testInitGridWithPos", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &grid = *_args.getPtr<Grid<Real>>("grid", 0, &_lock);
@@ -534,7 +534,7 @@ void adjustNumber(BasicParticleSystem &parts,
const LevelsetGrid &phi,
Real radiusFactor = 1.,
Real narrowBand = -1.,
const Grid<Real> *exclude = NULL)
const Grid<Real> *exclude = nullptr)
{
// which levelset to use as threshold
const Real SURFACE_LS = -1.0 * calculateRadiusFactor(phi, radiusFactor);
@@ -610,7 +610,7 @@ static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "adjustNumber", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -621,7 +621,7 @@ static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const LevelsetGrid &phi = *_args.getPtr<LevelsetGrid>("phi", 5, &_lock);
Real radiusFactor = _args.getOpt<Real>("radiusFactor", 6, 1., &_lock);
Real narrowBand = _args.getOpt<Real>("narrowBand", 7, -1., &_lock);
const Grid<Real> *exclude = _args.getPtrOpt<Grid<Real>>("exclude", 8, NULL, &_lock);
const Grid<Real> *exclude = _args.getPtrOpt<Grid<Real>>("exclude", 8, nullptr, &_lock);
_retval = getPyNone();
adjustNumber(
parts, vel, flags, minParticles, maxParticles, phi, radiusFactor, narrowBand, exclude);
@@ -660,7 +660,7 @@ static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "debugIntToReal", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<int> &source = *_args.getPtr<Grid<int>>("source", 0, &_lock);
@@ -694,7 +694,7 @@ void gridParticleIndex(const BasicParticleSystem &parts,
ParticleIndexSystem &indexSys,
const FlagGrid &flags,
Grid<int> &index,
Grid<int> *counter = NULL)
Grid<int> *counter = nullptr)
{
bool delCounter = false;
if (!counter) {
@@ -761,14 +761,14 @@ static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "gridParticleIndex", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
ParticleIndexSystem &indexSys = *_args.getPtr<ParticleIndexSystem>("indexSys", 1, &_lock);
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 2, &_lock);
Grid<int> &index = *_args.getPtr<Grid<int>>("index", 3, &_lock);
Grid<int> *counter = _args.getPtrOpt<Grid<int>>("counter", 4, NULL, &_lock);
Grid<int> *counter = _args.getPtrOpt<Grid<int>>("counter", 4, nullptr, &_lock);
_retval = getPyNone();
gridParticleIndex(parts, indexSys, flags, index, counter);
_args.check();
@@ -932,7 +932,7 @@ void unionParticleLevelset(const BasicParticleSystem &parts,
const Grid<int> &index,
LevelsetGrid &phi,
const Real radiusFactor = 1.,
const ParticleDataImpl<int> *ptype = NULL,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0)
{
// use half a cell diagonal as base radius
@@ -949,7 +949,7 @@ static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "unionParticleLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -960,7 +960,7 @@ static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
LevelsetGrid &phi = *_args.getPtr<LevelsetGrid>("phi", 4, &_lock);
const Real radiusFactor = _args.getOpt<Real>("radiusFactor", 5, 1., &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 6, NULL, &_lock);
"ptype", 6, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 7, 0, &_lock);
_retval = getPyNone();
unionParticleLevelset(parts, indexSys, flags, index, phi, radiusFactor, ptype, exclude);
@@ -992,8 +992,8 @@ struct ComputeAveragedLevelsetWeight : public KernelBase {
const Real radius,
const ParticleDataImpl<int> *ptype,
const int exclude,
Grid<Vec3> *save_pAcc = NULL,
Grid<Real> *save_rAcc = NULL)
Grid<Vec3> *save_pAcc = nullptr,
Grid<Real> *save_rAcc = nullptr)
: KernelBase(&index, 0),
parts(parts),
index(index),
@@ -1018,8 +1018,8 @@ struct ComputeAveragedLevelsetWeight : public KernelBase {
const Real radius,
const ParticleDataImpl<int> *ptype,
const int exclude,
Grid<Vec3> *save_pAcc = NULL,
Grid<Real> *save_rAcc = NULL) const
Grid<Vec3> *save_pAcc = nullptr,
Grid<Real> *save_rAcc = nullptr) const
{
const Vec3 gridPos = Vec3(i, j, k) + Vec3(0.5); // shifted by half cell
Real phiv = radius * 1.0; // outside
@@ -1312,7 +1312,7 @@ void averagedParticleLevelset(const BasicParticleSystem &parts,
const Real radiusFactor = 1.,
const int smoothen = 1,
const int smoothenNeg = 1,
const ParticleDataImpl<int> *ptype = NULL,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0)
{
// use half a cell diagonal as base radius
@@ -1340,7 +1340,7 @@ static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "averagedParticleLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -1353,7 +1353,7 @@ static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const int smoothen = _args.getOpt<int>("smoothen", 6, 1, &_lock);
const int smoothenNeg = _args.getOpt<int>("smoothenNeg", 7, 1, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 8, NULL, &_lock);
"ptype", 8, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 9, 0, &_lock);
_retval = getPyNone();
averagedParticleLevelset(
@@ -1523,7 +1523,7 @@ void improvedParticleLevelset(const BasicParticleSystem &parts,
const int smoothenNeg = 1,
const Real t_low = 0.4,
const Real t_high = 3.5,
const ParticleDataImpl<int> *ptype = NULL,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0)
{
// create temporary grids to store values from levelset weight computation
@@ -1557,7 +1557,7 @@ static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "improvedParticleLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -1572,7 +1572,7 @@ static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const Real t_low = _args.getOpt<Real>("t_low", 8, 0.4, &_lock);
const Real t_high = _args.getOpt<Real>("t_high", 9, 3.5, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 10, NULL, &_lock);
"ptype", 10, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 11, 0, &_lock);
_retval = getPyNone();
improvedParticleLevelset(parts,
@@ -1714,7 +1714,7 @@ void pushOutofObs(BasicParticleSystem &parts,
const Grid<Real> &phiObs,
const Real shift = 0,
const Real thresh = 0,
const ParticleDataImpl<int> *ptype = NULL,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0)
{
knPushOutofObs(parts, flags, phiObs, shift, thresh, ptype, exclude);
@@ -1726,7 +1726,7 @@ static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "pushOutofObs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -1735,7 +1735,7 @@ static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const Real shift = _args.getOpt<Real>("shift", 3, 0, &_lock);
const Real thresh = _args.getOpt<Real>("thresh", 4, 0, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 5, NULL, &_lock);
"ptype", 5, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 6, 0, &_lock);
_retval = getPyNone();
pushOutofObs(parts, flags, phiObs, shift, thresh, ptype, exclude);
@@ -1917,8 +1917,8 @@ void mapPartsToMAC(const FlagGrid &flags,
MACGrid &velOld,
const BasicParticleSystem &parts,
const ParticleDataImpl<Vec3> &partVel,
Grid<Vec3> *weight = NULL,
const ParticleDataImpl<int> *ptype = NULL,
Grid<Vec3> *weight = nullptr,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0)
{
// interpol -> grid. tmpgrid for particle contribution weights
@@ -1949,7 +1949,7 @@ static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "mapPartsToMAC", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -1958,9 +1958,9 @@ static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 3, &_lock);
const ParticleDataImpl<Vec3> &partVel = *_args.getPtr<ParticleDataImpl<Vec3>>(
"partVel", 4, &_lock);
Grid<Vec3> *weight = _args.getPtrOpt<Grid<Vec3>>("weight", 5, NULL, &_lock);
Grid<Vec3> *weight = _args.getPtrOpt<Grid<Vec3>>("weight", 5, nullptr, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 6, NULL, &_lock);
"ptype", 6, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 7, 0, &_lock);
_retval = getPyNone();
mapPartsToMAC(flags, vel, velOld, parts, partVel, weight, ptype, exclude);
@@ -2076,7 +2076,7 @@ static PyObject *_W_13(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "mapPartsToGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -2118,7 +2118,7 @@ static PyObject *_W_14(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "mapPartsToGridVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -2215,7 +2215,7 @@ static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "mapGridToParts", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<Real> &source = *_args.getPtr<Grid<Real>>("source", 0, &_lock);
@@ -2254,7 +2254,7 @@ static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "mapGridToPartsVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<Vec3> &source = *_args.getPtr<Grid<Vec3>>("source", 0, &_lock);
@@ -2371,7 +2371,7 @@ void mapMACToParts(const FlagGrid &flags,
const MACGrid &vel,
const BasicParticleSystem &parts,
ParticleDataImpl<Vec3> &partVel,
const ParticleDataImpl<int> *ptype = NULL,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0)
{
knMapLinearMACGridToVec3_PIC(parts, flags, vel, partVel, ptype, exclude);
@@ -2383,7 +2383,7 @@ static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "mapMACToParts", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -2392,7 +2392,7 @@ static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
ParticleDataImpl<Vec3> &partVel = *_args.getPtr<ParticleDataImpl<Vec3>>(
"partVel", 3, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 4, NULL, &_lock);
"ptype", 4, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 5, 0, &_lock);
_retval = getPyNone();
mapMACToParts(flags, vel, parts, partVel, ptype, exclude);
@@ -2526,7 +2526,7 @@ void flipVelocityUpdate(const FlagGrid &flags,
const BasicParticleSystem &parts,
ParticleDataImpl<Vec3> &partVel,
const Real flipRatio,
const ParticleDataImpl<int> *ptype = NULL,
const ParticleDataImpl<int> *ptype = nullptr,
const int exclude = 0)
{
knMapLinearMACGridToVec3_FLIP(parts, flags, vel, velOld, partVel, flipRatio, ptype, exclude);
@@ -2538,7 +2538,7 @@ static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "flipVelocityUpdate", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -2549,7 +2549,7 @@ static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
"partVel", 4, &_lock);
const Real flipRatio = _args.get<Real>("flipRatio", 5, &_lock);
const ParticleDataImpl<int> *ptype = _args.getPtrOpt<ParticleDataImpl<int>>(
"ptype", 6, NULL, &_lock);
"ptype", 6, nullptr, &_lock);
const int exclude = _args.getOpt<int>("exclude", 7, 0, &_lock);
_retval = getPyNone();
flipVelocityUpdate(flags, vel, velOld, parts, partVel, flipRatio, ptype, exclude);
@@ -2700,7 +2700,7 @@ struct knCombineVels : public KernelBase {
void combineGridVel(MACGrid &vel,
const Grid<Vec3> &weight,
MACGrid &combineVel,
const LevelsetGrid *phi = NULL,
const LevelsetGrid *phi = nullptr,
Real narrowBand = 0.0,
Real thresh = 0.0)
{
@@ -2713,13 +2713,13 @@ static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "combineGridVel", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
const Grid<Vec3> &weight = *_args.getPtr<Grid<Vec3>>("weight", 1, &_lock);
MACGrid &combineVel = *_args.getPtr<MACGrid>("combineVel", 2, &_lock);
const LevelsetGrid *phi = _args.getPtrOpt<LevelsetGrid>("phi", 3, NULL, &_lock);
const LevelsetGrid *phi = _args.getPtrOpt<LevelsetGrid>("phi", 3, nullptr, &_lock);
Real narrowBand = _args.getOpt<Real>("narrowBand", 4, 0.0, &_lock);
Real thresh = _args.getOpt<Real>("thresh", 5, 0.0, &_lock);
_retval = getPyNone();
@@ -2754,7 +2754,7 @@ static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getLaplacian", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &laplacian = *_args.getPtr<Grid<Real>>("laplacian", 0, &_lock);
@@ -2790,7 +2790,7 @@ static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getCurvature", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &curv = *_args.getPtr<Grid<Real>>("curv", 0, &_lock);

View File

@@ -404,7 +404,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getSpiralVelocity", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -454,7 +454,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setGradientYWeight", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &W = *_args.getPtr<Grid<Real>>("W", 0, &_lock);
@@ -574,10 +574,10 @@ void solvePressure(MACGrid &vel,
Grid<Real> &pressure,
const FlagGrid &flags,
Real cgAccuracy = 1e-3,
const Grid<Real> *phi = 0,
const Grid<Real> *perCellCorr = 0,
const MACGrid *fractions = 0,
const MACGrid *obvel = 0,
const Grid<Real> *phi = nullptr,
const Grid<Real> *perCellCorr = nullptr,
const MACGrid *fractions = nullptr,
const MACGrid *obvel = nullptr,
Real gfClamp = 1e-04,
Real cgMaxIterFac = 1.5,
bool precondition = true,
@@ -585,9 +585,9 @@ void solvePressure(MACGrid &vel,
bool enforceCompatibility = false,
bool useL2Norm = false,
bool zeroPressureFixing = false,
const Grid<Real> *curv = NULL,
const Grid<Real> *curv = nullptr,
const Real surfTens = 0.0,
Grid<Real> *retRhs = NULL);
Grid<Real> *retRhs = nullptr);
//! Main function for fluid guiding , includes "regular" pressure solve
@@ -603,16 +603,16 @@ void PD_fluid_guiding(MACGrid &vel,
Real epsRel = 1e-3,
Real epsAbs = 1e-3,
int maxIters = 200,
Grid<Real> *phi = 0,
Grid<Real> *perCellCorr = 0,
MACGrid *fractions = 0,
MACGrid *obvel = 0,
Grid<Real> *phi = nullptr,
Grid<Real> *perCellCorr = nullptr,
MACGrid *fractions = nullptr,
MACGrid *obvel = nullptr,
Real gfClamp = 1e-04,
Real cgMaxIterFac = 1.5,
Real cgAccuracy = 1e-3,
int preconditioner = 1,
bool zeroPressureFixing = false,
const Grid<Real> *curv = NULL,
const Grid<Real> *curv = nullptr,
const Real surfTens = 0.)
{
FluidSolver *parent = vel.getParent();
@@ -693,7 +693,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "PD_fluid_guiding", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
@@ -708,16 +708,16 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
Real epsRel = _args.getOpt<Real>("epsRel", 9, 1e-3, &_lock);
Real epsAbs = _args.getOpt<Real>("epsAbs", 10, 1e-3, &_lock);
int maxIters = _args.getOpt<int>("maxIters", 11, 200, &_lock);
Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 12, 0, &_lock);
Grid<Real> *perCellCorr = _args.getPtrOpt<Grid<Real>>("perCellCorr", 13, 0, &_lock);
MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 14, 0, &_lock);
MACGrid *obvel = _args.getPtrOpt<MACGrid>("obvel", 15, 0, &_lock);
Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 12, nullptr, &_lock);
Grid<Real> *perCellCorr = _args.getPtrOpt<Grid<Real>>("perCellCorr", 13, nullptr, &_lock);
MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 14, nullptr, &_lock);
MACGrid *obvel = _args.getPtrOpt<MACGrid>("obvel", 15, nullptr, &_lock);
Real gfClamp = _args.getOpt<Real>("gfClamp", 16, 1e-04, &_lock);
Real cgMaxIterFac = _args.getOpt<Real>("cgMaxIterFac", 17, 1.5, &_lock);
Real cgAccuracy = _args.getOpt<Real>("cgAccuracy", 18, 1e-3, &_lock);
int preconditioner = _args.getOpt<int>("preconditioner", 19, 1, &_lock);
bool zeroPressureFixing = _args.getOpt<bool>("zeroPressureFixing", 20, false, &_lock);
const Grid<Real> *curv = _args.getPtrOpt<Grid<Real>>("curv", 21, NULL, &_lock);
const Grid<Real> *curv = _args.getPtrOpt<Grid<Real>>("curv", 21, nullptr, &_lock);
const Real surfTens = _args.getOpt<Real>("surfTens", 22, 0., &_lock);
_retval = getPyNone();
PD_fluid_guiding(vel,
@@ -775,7 +775,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "releaseBlurPrecomp", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
_retval = getPyNone();

View File

@@ -154,7 +154,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "densityInflow", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -273,7 +273,7 @@ struct KnAddNoise : public KernelBase {
void addNoise(const FlagGrid &flags,
Grid<Real> &density,
const WaveletNoiseField &noise,
const Grid<Real> *sdf = NULL,
const Grid<Real> *sdf = nullptr,
Real scale = 1.0)
{
KnAddNoise(flags, density, noise, sdf, scale);
@@ -285,13 +285,13 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "addNoise", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
Grid<Real> &density = *_args.getPtr<Grid<Real>>("density", 1, &_lock);
const WaveletNoiseField &noise = *_args.getPtr<WaveletNoiseField>("noise", 2, &_lock);
const Grid<Real> *sdf = _args.getPtrOpt<Grid<Real>>("sdf", 3, NULL, &_lock);
const Grid<Real> *sdf = _args.getPtrOpt<Grid<Real>>("sdf", 3, nullptr, &_lock);
Real scale = _args.getOpt<Real>("scale", 4, 1.0, &_lock);
_retval = getPyNone();
addNoise(flags, density, noise, sdf, scale);
@@ -448,7 +448,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setNoisePdata", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -489,7 +489,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setNoisePdataVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -530,7 +530,7 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setNoisePdataInt", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -592,7 +592,7 @@ static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "obstacleGradient", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -636,7 +636,7 @@ static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "obstacleLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -777,7 +777,7 @@ struct KnApplyEmission : public KernelBase {
void applyEmission(FlagGrid &flags,
Grid<Real> &target,
Grid<Real> &source,
Grid<Real> *emissionTexture = NULL,
Grid<Real> *emissionTexture = nullptr,
bool isAbsolute = true,
int type = 0)
{
@@ -790,14 +790,14 @@ static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "applyEmission", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
Grid<Real> &target = *_args.getPtr<Grid<Real>>("target", 1, &_lock);
Grid<Real> &source = *_args.getPtr<Grid<Real>>("source", 2, &_lock);
Grid<Real> *emissionTexture = _args.getPtrOpt<Grid<Real>>(
"emissionTexture", 3, NULL, &_lock);
"emissionTexture", 3, nullptr, &_lock);
bool isAbsolute = _args.getOpt<bool>("isAbsolute", 4, true, &_lock);
int type = _args.getOpt<int>("type", 5, 0, &_lock);
_retval = getPyNone();
@@ -925,7 +925,7 @@ static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "densityInflowMeshNoise", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -974,7 +974,7 @@ static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "densityInflowMesh", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -1161,12 +1161,12 @@ struct KnResetInObstacle : public KernelBase {
void resetInObstacle(FlagGrid &flags,
MACGrid &vel,
Grid<Real> *density,
Grid<Real> *heat = NULL,
Grid<Real> *fuel = NULL,
Grid<Real> *flame = NULL,
Grid<Real> *red = NULL,
Grid<Real> *green = NULL,
Grid<Real> *blue = NULL,
Grid<Real> *heat = nullptr,
Grid<Real> *fuel = nullptr,
Grid<Real> *flame = nullptr,
Grid<Real> *red = nullptr,
Grid<Real> *green = nullptr,
Grid<Real> *blue = nullptr,
Real resetValue = 0)
{
KnResetInObstacle(flags, vel, density, heat, fuel, flame, red, green, blue, resetValue);
@@ -1178,18 +1178,18 @@ static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "resetInObstacle", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 1, &_lock);
Grid<Real> *density = _args.getPtr<Grid<Real>>("density", 2, &_lock);
Grid<Real> *heat = _args.getPtrOpt<Grid<Real>>("heat", 3, NULL, &_lock);
Grid<Real> *fuel = _args.getPtrOpt<Grid<Real>>("fuel", 4, NULL, &_lock);
Grid<Real> *flame = _args.getPtrOpt<Grid<Real>>("flame", 5, NULL, &_lock);
Grid<Real> *red = _args.getPtrOpt<Grid<Real>>("red", 6, NULL, &_lock);
Grid<Real> *green = _args.getPtrOpt<Grid<Real>>("green", 7, NULL, &_lock);
Grid<Real> *blue = _args.getPtrOpt<Grid<Real>>("blue", 8, NULL, &_lock);
Grid<Real> *heat = _args.getPtrOpt<Grid<Real>>("heat", 3, nullptr, &_lock);
Grid<Real> *fuel = _args.getPtrOpt<Grid<Real>>("fuel", 4, nullptr, &_lock);
Grid<Real> *flame = _args.getPtrOpt<Grid<Real>>("flame", 5, nullptr, &_lock);
Grid<Real> *red = _args.getPtrOpt<Grid<Real>>("red", 6, nullptr, &_lock);
Grid<Real> *green = _args.getPtrOpt<Grid<Real>>("green", 7, nullptr, &_lock);
Grid<Real> *blue = _args.getPtrOpt<Grid<Real>>("blue", 8, nullptr, &_lock);
Real resetValue = _args.getOpt<Real>("resetValue", 9, 0, &_lock);
_retval = getPyNone();
resetInObstacle(flags, vel, density, heat, fuel, flame, red, green, blue, resetValue);
@@ -1216,7 +1216,7 @@ void PbRegister_resetInObstacle()
//! check for symmetry , optionally enfore by copying
void checkSymmetry(
Grid<Real> &a, Grid<Real> *err = NULL, bool symmetrize = false, int axis = 0, int bound = 0)
Grid<Real> &a, Grid<Real> *err = nullptr, bool symmetrize = false, int axis = 0, int bound = 0)
{
const int c = axis;
const int s = a.getSize()[c];
@@ -1241,11 +1241,11 @@ static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "checkSymmetry", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &a = *_args.getPtr<Grid<Real>>("a", 0, &_lock);
Grid<Real> *err = _args.getPtrOpt<Grid<Real>>("err", 1, NULL, &_lock);
Grid<Real> *err = _args.getPtrOpt<Grid<Real>>("err", 1, nullptr, &_lock);
bool symmetrize = _args.getOpt<bool>("symmetrize", 2, false, &_lock);
int axis = _args.getOpt<int>("axis", 3, 0, &_lock);
int bound = _args.getOpt<int>("bound", 4, 0, &_lock);
@@ -1272,7 +1272,7 @@ void PbRegister_checkSymmetry()
//! check for symmetry , mac grid version
void checkSymmetryVec3(Grid<Vec3> &a,
Grid<Real> *err = NULL,
Grid<Real> *err = nullptr,
bool symmetrize = false,
int axis = 0,
int bound = 0,
@@ -1359,11 +1359,11 @@ static PyObject *_W_12(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "checkSymmetryVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &a = *_args.getPtr<Grid<Vec3>>("a", 0, &_lock);
Grid<Real> *err = _args.getPtrOpt<Grid<Real>>("err", 1, NULL, &_lock);
Grid<Real> *err = _args.getPtrOpt<Grid<Real>>("err", 1, nullptr, &_lock);
bool symmetrize = _args.getOpt<bool>("symmetrize", 2, false, &_lock);
int axis = _args.getOpt<int>("axis", 3, 0, &_lock);
int bound = _args.getOpt<int>("bound", 4, 0, &_lock);
@@ -1407,7 +1407,7 @@ static PyObject *_W_13(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "projectPpmFull", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<Real> &val = *_args.getPtr<Grid<Real>>("val", 0, &_lock);
@@ -1453,7 +1453,7 @@ static PyObject *_W_14(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "addTestParts", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -1504,7 +1504,7 @@ static PyObject *_W_15(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "pdataMaxDiff", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<Real> *a = _args.getPtr<ParticleDataImpl<Real>>("a", 0, &_lock);
@@ -1539,7 +1539,7 @@ static PyObject *_W_16(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "pdataMaxDiffInt", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<int> *a = _args.getPtr<ParticleDataImpl<int>>("a", 0, &_lock);
@@ -1574,7 +1574,7 @@ static PyObject *_W_17(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "pdataMaxDiffVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const ParticleDataImpl<Vec3> *a = _args.getPtr<ParticleDataImpl<Vec3>>("a", 0, &_lock);
@@ -1620,7 +1620,7 @@ static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "calcCenterOfMass", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<Real> &density = *_args.getPtr<Grid<Real>>("density", 0, &_lock);
@@ -1842,7 +1842,7 @@ static PyObject *_W_19(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "updateFractions", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -2007,9 +2007,9 @@ struct KnUpdateFlagsObs : public KernelBase {
//! optionally uses fill fractions for obstacle
void setObstacleFlags(FlagGrid &flags,
const Grid<Real> &phiObs,
const MACGrid *fractions = NULL,
const Grid<Real> *phiOut = NULL,
const Grid<Real> *phiIn = NULL,
const MACGrid *fractions = nullptr,
const Grid<Real> *phiOut = nullptr,
const Grid<Real> *phiIn = nullptr,
int boundaryWidth = 1)
{
KnUpdateFlagsObs(flags, fractions, phiObs, phiOut, phiIn, boundaryWidth);
@@ -2021,14 +2021,14 @@ static PyObject *_W_20(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setObstacleFlags", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
const Grid<Real> &phiObs = *_args.getPtr<Grid<Real>>("phiObs", 1, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 2, NULL, &_lock);
const Grid<Real> *phiOut = _args.getPtrOpt<Grid<Real>>("phiOut", 3, NULL, &_lock);
const Grid<Real> *phiIn = _args.getPtrOpt<Grid<Real>>("phiIn", 4, NULL, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 2, nullptr, &_lock);
const Grid<Real> *phiOut = _args.getPtrOpt<Grid<Real>>("phiOut", 3, nullptr, &_lock);
const Grid<Real> *phiIn = _args.getPtrOpt<Grid<Real>>("phiIn", 4, nullptr, &_lock);
int boundaryWidth = _args.getOpt<int>("boundaryWidth", 5, 1, &_lock);
_retval = getPyNone();
setObstacleFlags(flags, phiObs, fractions, phiOut, phiIn, boundaryWidth);
@@ -2166,7 +2166,7 @@ static PyObject *_W_21(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "initVortexVelocity", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<Real> &phiObs = *_args.getPtr<Grid<Real>>("phiObs", 0, &_lock);
@@ -2203,10 +2203,10 @@ struct GaussianKernelCreator {
int mDim;
float *mMat1D;
GaussianKernelCreator() : mSigma(0.0f), mDim(0), mMat1D(NULL)
GaussianKernelCreator() : mSigma(0.0f), mDim(0), mMat1D(nullptr)
{
}
GaussianKernelCreator(float sigma, int dim = 0) : mSigma(0.0f), mDim(0), mMat1D(NULL)
GaussianKernelCreator(float sigma, int dim = 0) : mSigma(0.0f), mDim(0), mMat1D(nullptr)
{
setGaussianSigma(sigma, dim);
}
@@ -2518,7 +2518,7 @@ static PyObject *_W_22(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "blurMacGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &oG = *_args.getPtr<MACGrid>("oG", 0, &_lock);
@@ -2554,7 +2554,7 @@ static PyObject *_W_23(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "blurRealGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &oG = *_args.getPtr<Grid<Real>>("oG", 0, &_lock);

View File

@@ -305,7 +305,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "KEpsilonComputeProduction", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
@@ -420,7 +420,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "KEpsilonSources", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &k = *_args.getPtr<Grid<Real>>("k", 0, &_lock);
@@ -469,7 +469,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "KEpsilonBcs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -547,7 +547,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "KEpsilonGradientDiffusion", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &k = *_args.getPtr<Grid<Real>>("k", 0, &_lock);

View File

@@ -118,7 +118,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "smoothMesh", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Mesh &mesh = *_args.getPtr<Mesh>("mesh", 0, &_lock);
@@ -657,7 +657,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "subdivideMesh", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Mesh &mesh = *_args.getPtr<Mesh>("mesh", 0, &_lock);
@@ -752,7 +752,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "killSmallComponents", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Mesh &mesh = *_args.getPtr<Mesh>("mesh", 0, &_lock);

View File

@@ -912,7 +912,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "releaseMG", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FluidSolver *solver = _args.getPtrOpt<FluidSolver>("solver", 0, nullptr, &_lock);
@@ -949,10 +949,10 @@ void computePressureRhs(Grid<Real> &rhs,
const Grid<Real> &pressure,
const FlagGrid &flags,
Real cgAccuracy = 1e-3,
const Grid<Real> *phi = 0,
const Grid<Real> *perCellCorr = 0,
const MACGrid *fractions = 0,
const MACGrid *obvel = 0,
const Grid<Real> *phi = nullptr,
const Grid<Real> *perCellCorr = nullptr,
const MACGrid *fractions = nullptr,
const MACGrid *obvel = nullptr,
Real gfClamp = 1e-04,
Real cgMaxIterFac = 1.5,
bool precondition = true,
@@ -960,7 +960,7 @@ void computePressureRhs(Grid<Real> &rhs,
bool enforceCompatibility = false,
bool useL2Norm = false,
bool zeroPressureFixing = false,
const Grid<Real> *curv = NULL,
const Grid<Real> *curv = nullptr,
const Real surfTens = 0.)
{
// compute divergence and init right hand side
@@ -977,7 +977,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "computePressureRhs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &rhs = *_args.getPtr<Grid<Real>>("rhs", 0, &_lock);
@@ -985,10 +985,11 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const Grid<Real> &pressure = *_args.getPtr<Grid<Real>>("pressure", 2, &_lock);
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 3, &_lock);
Real cgAccuracy = _args.getOpt<Real>("cgAccuracy", 4, 1e-3, &_lock);
const Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 5, 0, &_lock);
const Grid<Real> *perCellCorr = _args.getPtrOpt<Grid<Real>>("perCellCorr", 6, 0, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 7, 0, &_lock);
const MACGrid *obvel = _args.getPtrOpt<MACGrid>("obvel", 8, 0, &_lock);
const Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 5, nullptr, &_lock);
const Grid<Real> *perCellCorr = _args.getPtrOpt<Grid<Real>>(
"perCellCorr", 6, nullptr, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 7, nullptr, &_lock);
const MACGrid *obvel = _args.getPtrOpt<MACGrid>("obvel", 8, nullptr, &_lock);
Real gfClamp = _args.getOpt<Real>("gfClamp", 9, 1e-04, &_lock);
Real cgMaxIterFac = _args.getOpt<Real>("cgMaxIterFac", 10, 1.5, &_lock);
bool precondition = _args.getOpt<bool>("precondition", 11, true, &_lock);
@@ -996,7 +997,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
bool enforceCompatibility = _args.getOpt<bool>("enforceCompatibility", 13, false, &_lock);
bool useL2Norm = _args.getOpt<bool>("useL2Norm", 14, false, &_lock);
bool zeroPressureFixing = _args.getOpt<bool>("zeroPressureFixing", 15, false, &_lock);
const Grid<Real> *curv = _args.getPtrOpt<Grid<Real>>("curv", 16, NULL, &_lock);
const Grid<Real> *curv = _args.getPtrOpt<Grid<Real>>("curv", 16, nullptr, &_lock);
const Real surfTens = _args.getOpt<Real>("surfTens", 17, 0., &_lock);
_retval = getPyNone();
computePressureRhs(rhs,
@@ -1050,9 +1051,9 @@ void solvePressureSystem(Grid<Real> &rhs,
Grid<Real> &pressure,
const FlagGrid &flags,
Real cgAccuracy = 1e-3,
const Grid<Real> *phi = 0,
const Grid<Real> *perCellCorr = 0,
const MACGrid *fractions = 0,
const Grid<Real> *phi = nullptr,
const Grid<Real> *perCellCorr = nullptr,
const MACGrid *fractions = nullptr,
Real gfClamp = 1e-04,
Real cgMaxIterFac = 1.5,
bool precondition = true,
@@ -1060,7 +1061,7 @@ void solvePressureSystem(Grid<Real> &rhs,
const bool enforceCompatibility = false,
const bool useL2Norm = false,
const bool zeroPressureFixing = false,
const Grid<Real> *curv = NULL,
const Grid<Real> *curv = nullptr,
const Real surfTens = 0.)
{
if (precondition == false)
@@ -1221,7 +1222,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "solvePressureSystem", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &rhs = *_args.getPtr<Grid<Real>>("rhs", 0, &_lock);
@@ -1229,9 +1230,10 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
Grid<Real> &pressure = *_args.getPtr<Grid<Real>>("pressure", 2, &_lock);
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 3, &_lock);
Real cgAccuracy = _args.getOpt<Real>("cgAccuracy", 4, 1e-3, &_lock);
const Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 5, 0, &_lock);
const Grid<Real> *perCellCorr = _args.getPtrOpt<Grid<Real>>("perCellCorr", 6, 0, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 7, 0, &_lock);
const Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 5, nullptr, &_lock);
const Grid<Real> *perCellCorr = _args.getPtrOpt<Grid<Real>>(
"perCellCorr", 6, nullptr, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 7, nullptr, &_lock);
Real gfClamp = _args.getOpt<Real>("gfClamp", 8, 1e-04, &_lock);
Real cgMaxIterFac = _args.getOpt<Real>("cgMaxIterFac", 9, 1.5, &_lock);
bool precondition = _args.getOpt<bool>("precondition", 10, true, &_lock);
@@ -1240,7 +1242,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
"enforceCompatibility", 12, false, &_lock);
const bool useL2Norm = _args.getOpt<bool>("useL2Norm", 13, false, &_lock);
const bool zeroPressureFixing = _args.getOpt<bool>("zeroPressureFixing", 14, false, &_lock);
const Grid<Real> *curv = _args.getPtrOpt<Grid<Real>>("curv", 15, NULL, &_lock);
const Grid<Real> *curv = _args.getPtrOpt<Grid<Real>>("curv", 15, nullptr, &_lock);
const Real surfTens = _args.getOpt<Real>("surfTens", 16, 0., &_lock);
_retval = getPyNone();
solvePressureSystem(rhs,
@@ -1284,9 +1286,9 @@ void correctVelocity(MACGrid &vel,
Grid<Real> &pressure,
const FlagGrid &flags,
Real cgAccuracy = 1e-3,
const Grid<Real> *phi = 0,
const Grid<Real> *perCellCorr = 0,
const MACGrid *fractions = 0,
const Grid<Real> *phi = nullptr,
const Grid<Real> *perCellCorr = nullptr,
const MACGrid *fractions = nullptr,
Real gfClamp = 1e-04,
Real cgMaxIterFac = 1.5,
bool precondition = true,
@@ -1294,7 +1296,7 @@ void correctVelocity(MACGrid &vel,
bool enforceCompatibility = false,
bool useL2Norm = false,
bool zeroPressureFixing = false,
const Grid<Real> *curv = NULL,
const Grid<Real> *curv = nullptr,
const Real surfTens = 0.)
{
knCorrectVelocity(flags, vel, pressure);
@@ -1311,16 +1313,17 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "correctVelocity", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
Grid<Real> &pressure = *_args.getPtr<Grid<Real>>("pressure", 1, &_lock);
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 2, &_lock);
Real cgAccuracy = _args.getOpt<Real>("cgAccuracy", 3, 1e-3, &_lock);
const Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 4, 0, &_lock);
const Grid<Real> *perCellCorr = _args.getPtrOpt<Grid<Real>>("perCellCorr", 5, 0, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 6, 0, &_lock);
const Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 4, nullptr, &_lock);
const Grid<Real> *perCellCorr = _args.getPtrOpt<Grid<Real>>(
"perCellCorr", 5, nullptr, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 6, nullptr, &_lock);
Real gfClamp = _args.getOpt<Real>("gfClamp", 7, 1e-04, &_lock);
Real cgMaxIterFac = _args.getOpt<Real>("cgMaxIterFac", 8, 1.5, &_lock);
bool precondition = _args.getOpt<bool>("precondition", 9, true, &_lock);
@@ -1328,7 +1331,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
bool enforceCompatibility = _args.getOpt<bool>("enforceCompatibility", 11, false, &_lock);
bool useL2Norm = _args.getOpt<bool>("useL2Norm", 12, false, &_lock);
bool zeroPressureFixing = _args.getOpt<bool>("zeroPressureFixing", 13, false, &_lock);
const Grid<Real> *curv = _args.getPtrOpt<Grid<Real>>("curv", 14, NULL, &_lock);
const Grid<Real> *curv = _args.getPtrOpt<Grid<Real>>("curv", 14, nullptr, &_lock);
const Real surfTens = _args.getOpt<Real>("surfTens", 15, 0., &_lock);
_retval = getPyNone();
correctVelocity(vel,
@@ -1372,10 +1375,10 @@ void solvePressure(MACGrid &vel,
Grid<Real> &pressure,
const FlagGrid &flags,
Real cgAccuracy = 1e-3,
const Grid<Real> *phi = 0,
const Grid<Real> *perCellCorr = 0,
const MACGrid *fractions = 0,
const MACGrid *obvel = 0,
const Grid<Real> *phi = nullptr,
const Grid<Real> *perCellCorr = nullptr,
const MACGrid *fractions = nullptr,
const MACGrid *obvel = nullptr,
Real gfClamp = 1e-04,
Real cgMaxIterFac = 1.5,
bool precondition = true,
@@ -1383,9 +1386,9 @@ void solvePressure(MACGrid &vel,
bool enforceCompatibility = false,
bool useL2Norm = false,
bool zeroPressureFixing = false,
const Grid<Real> *curv = NULL,
const Grid<Real> *curv = nullptr,
const Real surfTens = 0.,
Grid<Real> *retRhs = NULL)
Grid<Real> *retRhs = nullptr)
{
Grid<Real> rhs(vel.getParent());
@@ -1455,17 +1458,18 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "solvePressure", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
Grid<Real> &pressure = *_args.getPtr<Grid<Real>>("pressure", 1, &_lock);
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 2, &_lock);
Real cgAccuracy = _args.getOpt<Real>("cgAccuracy", 3, 1e-3, &_lock);
const Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 4, 0, &_lock);
const Grid<Real> *perCellCorr = _args.getPtrOpt<Grid<Real>>("perCellCorr", 5, 0, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 6, 0, &_lock);
const MACGrid *obvel = _args.getPtrOpt<MACGrid>("obvel", 7, 0, &_lock);
const Grid<Real> *phi = _args.getPtrOpt<Grid<Real>>("phi", 4, nullptr, &_lock);
const Grid<Real> *perCellCorr = _args.getPtrOpt<Grid<Real>>(
"perCellCorr", 5, nullptr, &_lock);
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 6, nullptr, &_lock);
const MACGrid *obvel = _args.getPtrOpt<MACGrid>("obvel", 7, nullptr, &_lock);
Real gfClamp = _args.getOpt<Real>("gfClamp", 8, 1e-04, &_lock);
Real cgMaxIterFac = _args.getOpt<Real>("cgMaxIterFac", 9, 1.5, &_lock);
bool precondition = _args.getOpt<bool>("precondition", 10, true, &_lock);
@@ -1473,9 +1477,9 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
bool enforceCompatibility = _args.getOpt<bool>("enforceCompatibility", 12, false, &_lock);
bool useL2Norm = _args.getOpt<bool>("useL2Norm", 13, false, &_lock);
bool zeroPressureFixing = _args.getOpt<bool>("zeroPressureFixing", 14, false, &_lock);
const Grid<Real> *curv = _args.getPtrOpt<Grid<Real>>("curv", 15, NULL, &_lock);
const Grid<Real> *curv = _args.getPtrOpt<Grid<Real>>("curv", 15, nullptr, &_lock);
const Real surfTens = _args.getOpt<Real>("surfTens", 16, 0., &_lock);
Grid<Real> *retRhs = _args.getPtrOpt<Grid<Real>>("retRhs", 17, NULL, &_lock);
Grid<Real> *retRhs = _args.getPtrOpt<Grid<Real>>("retRhs", 17, nullptr, &_lock);
_retval = getPyNone();
solvePressure(vel,
pressure,

View File

@@ -98,7 +98,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "addForcePvel", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
ParticleDataImpl<Vec3> &vel = *_args.getPtr<ParticleDataImpl<Vec3>>("vel", 0, &_lock);
@@ -227,7 +227,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "updateVelocityFromDeltaPos", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -342,7 +342,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "eulerStep", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);
@@ -470,7 +470,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setPartType", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);

View File

@@ -392,7 +392,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "flipComputeSecondaryParticlePotentials", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &potTA = *_args.getPtr<Grid<Real>>("potTA", 0, &_lock);
@@ -1041,7 +1041,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "flipSampleSecondaryParticles", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const std::string mode = _args.get<std::string>("mode", 0, &_lock);
@@ -1760,7 +1760,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "flipUpdateSecondaryParticles", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const std::string mode = _args.get<std::string>("mode", 0, &_lock);
@@ -1895,7 +1895,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "flipDeleteParticlesInObstacle", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
BasicParticleSystem &pts = *_args.getPtr<BasicParticleSystem>("pts", 0, &_lock);
@@ -1963,7 +1963,7 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "debugGridInfo", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -2069,7 +2069,7 @@ static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setFlagsFromLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -2170,7 +2170,7 @@ static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "setMACFromLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &v = *_args.getPtr<MACGrid>("v", 0, &_lock);
@@ -2382,7 +2382,7 @@ static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "flipComputePotentialTrappedAir", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &pot = *_args.getPtr<Grid<Real>>("pot", 0, &_lock);
@@ -2555,7 +2555,7 @@ static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "flipComputePotentialKineticEnergy", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &pot = *_args.getPtr<Grid<Real>>("pot", 0, &_lock);
@@ -2791,7 +2791,7 @@ static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "flipComputePotentialWaveCrest", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &pot = *_args.getPtr<Grid<Real>>("pot", 0, &_lock);
@@ -2883,7 +2883,7 @@ static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "flipComputeSurfaceNormals", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &normal = *_args.getPtr<Grid<Vec3>>("normal", 0, &_lock);
@@ -3040,7 +3040,7 @@ static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "flipUpdateNeighborRatio", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);

View File

@@ -2055,7 +2055,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "particleSurfaceTurbulence", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -2159,7 +2159,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "debugCheckParts", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const BasicParticleSystem &parts = *_args.getPtr<BasicParticleSystem>("parts", 0, &_lock);

View File

@@ -48,7 +48,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "markAsFixed", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Mesh &mesh = *_args.getPtr<Mesh>("mesh", 0, &_lock);
@@ -111,7 +111,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "texcoordInflow", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
VortexSheetMesh &mesh = *_args.getPtr<VortexSheetMesh>("mesh", 0, &_lock);
@@ -155,7 +155,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "meshSmokeInflow", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
VortexSheetMesh &mesh = *_args.getPtr<VortexSheetMesh>("mesh", 0, &_lock);
@@ -239,8 +239,8 @@ struct KnAcceleration : public KernelBase {
void vorticitySource(VortexSheetMesh &mesh,
Vec3 gravity,
const MACGrid *vel = NULL,
const MACGrid *velOld = NULL,
const MACGrid *vel = nullptr,
const MACGrid *velOld = nullptr,
Real scale = 0.1,
Real maxAmount = 0,
Real mult = 1.0)
@@ -289,13 +289,13 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "vorticitySource", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
VortexSheetMesh &mesh = *_args.getPtr<VortexSheetMesh>("mesh", 0, &_lock);
Vec3 gravity = _args.get<Vec3>("gravity", 1, &_lock);
const MACGrid *vel = _args.getPtrOpt<MACGrid>("vel", 2, NULL, &_lock);
const MACGrid *velOld = _args.getPtrOpt<MACGrid>("velOld", 3, NULL, &_lock);
const MACGrid *vel = _args.getPtrOpt<MACGrid>("vel", 2, nullptr, &_lock);
const MACGrid *velOld = _args.getPtrOpt<MACGrid>("velOld", 3, nullptr, &_lock);
Real scale = _args.getOpt<Real>("scale", 4, 0.1, &_lock);
Real maxAmount = _args.getOpt<Real>("maxAmount", 5, 0, &_lock);
Real mult = _args.getOpt<Real>("mult", 6, 1.0, &_lock);
@@ -373,7 +373,7 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "smoothVorticity", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
VortexSheetMesh &mesh = *_args.getPtr<VortexSheetMesh>("mesh", 0, &_lock);
@@ -437,7 +437,7 @@ static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "VPseedK41", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
VortexParticleSystem &system = *_args.getPtr<VortexParticleSystem>("system", 0, &_lock);
@@ -473,7 +473,7 @@ void VICintegration(VortexSheetMesh &mesh,
Real sigma,
Grid<Vec3> &vel,
const FlagGrid &flags,
Grid<Vec3> *vorticity = NULL,
Grid<Vec3> *vorticity = nullptr,
Real cgMaxIterFac = 1.5,
Real cgAccuracy = 1e-3,
Real scale = 0.01,
@@ -604,14 +604,14 @@ static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "VICintegration", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
VortexSheetMesh &mesh = *_args.getPtr<VortexSheetMesh>("mesh", 0, &_lock);
Real sigma = _args.get<Real>("sigma", 1, &_lock);
Grid<Vec3> &vel = *_args.getPtr<Grid<Vec3>>("vel", 2, &_lock);
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 3, &_lock);
Grid<Vec3> *vorticity = _args.getPtrOpt<Grid<Vec3>>("vorticity", 4, NULL, &_lock);
Grid<Vec3> *vorticity = _args.getPtrOpt<Grid<Vec3>>("vorticity", 4, nullptr, &_lock);
Real cgMaxIterFac = _args.getOpt<Real>("cgMaxIterFac", 5, 1.5, &_lock);
Real cgAccuracy = _args.getOpt<Real>("cgAccuracy", 6, 1e-3, &_lock);
Real scale = _args.getOpt<Real>("scale", 7, 0.01, &_lock);
@@ -665,7 +665,7 @@ static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "densityFromLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const LevelsetGrid &phi = *_args.getPtr<LevelsetGrid>("phi", 0, &_lock);

View File

@@ -69,7 +69,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "interpolateGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &target = *_args.getPtr<Grid<Real>>("target", 0, &_lock);
@@ -116,7 +116,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "interpolateGridVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Vec3> &target = *_args.getPtr<Grid<Vec3>>("target", 0, &_lock);
@@ -263,7 +263,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "interpolateMACGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
MACGrid &target = *_args.getPtr<MACGrid>("target", 0, &_lock);
@@ -395,7 +395,7 @@ void applySimpleNoiseVec3(const FlagGrid &flags,
Grid<Vec3> &target,
const WaveletNoiseField &noise,
Real scale = 1.0,
const Grid<Real> *weight = NULL)
const Grid<Real> *weight = nullptr)
{
// note - passing a MAC grid here is slightly inaccurate, we should evaluate each component
// separately
@@ -408,14 +408,14 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "applySimpleNoiseVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
Grid<Vec3> &target = *_args.getPtr<Grid<Vec3>>("target", 1, &_lock);
const WaveletNoiseField &noise = *_args.getPtr<WaveletNoiseField>("noise", 2, &_lock);
Real scale = _args.getOpt<Real>("scale", 3, 1.0, &_lock);
const Grid<Real> *weight = _args.getPtrOpt<Grid<Real>>("weight", 4, NULL, &_lock);
const Grid<Real> *weight = _args.getPtrOpt<Grid<Real>>("weight", 4, nullptr, &_lock);
_retval = getPyNone();
applySimpleNoiseVec3(flags, target, noise, scale, weight);
_args.check();
@@ -537,7 +537,7 @@ void applySimpleNoiseReal(const FlagGrid &flags,
Grid<Real> &target,
const WaveletNoiseField &noise,
Real scale = 1.0,
const Grid<Real> *weight = NULL)
const Grid<Real> *weight = nullptr)
{
knApplySimpleNoiseReal(flags, target, noise, scale, weight);
}
@@ -548,14 +548,14 @@ static PyObject *_W_4(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "applySimpleNoiseReal", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
Grid<Real> &target = *_args.getPtr<Grid<Real>>("target", 1, &_lock);
const WaveletNoiseField &noise = *_args.getPtr<WaveletNoiseField>("noise", 2, &_lock);
Real scale = _args.getOpt<Real>("scale", 3, 1.0, &_lock);
const Grid<Real> *weight = _args.getPtrOpt<Grid<Real>>("weight", 4, NULL, &_lock);
const Grid<Real> *weight = _args.getPtrOpt<Grid<Real>>("weight", 4, nullptr, &_lock);
_retval = getPyNone();
applySimpleNoiseReal(flags, target, noise, scale, weight);
_args.check();
@@ -763,8 +763,8 @@ void applyNoiseVec3(const FlagGrid &flags,
const WaveletNoiseField &noise,
Real scale = 1.0,
Real scaleSpatial = 1.0,
const Grid<Real> *weight = NULL,
const Grid<Vec3> *uv = NULL)
const Grid<Real> *weight = nullptr,
const Grid<Vec3> *uv = nullptr)
{
// check whether the uv grid has a different resolution
bool uvInterpol = false;
@@ -794,7 +794,7 @@ static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "applyNoiseVec3", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -802,8 +802,8 @@ static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const WaveletNoiseField &noise = *_args.getPtr<WaveletNoiseField>("noise", 2, &_lock);
Real scale = _args.getOpt<Real>("scale", 3, 1.0, &_lock);
Real scaleSpatial = _args.getOpt<Real>("scaleSpatial", 4, 1.0, &_lock);
const Grid<Real> *weight = _args.getPtrOpt<Grid<Real>>("weight", 5, NULL, &_lock);
const Grid<Vec3> *uv = _args.getPtrOpt<Grid<Vec3>>("uv", 6, NULL, &_lock);
const Grid<Real> *weight = _args.getPtrOpt<Grid<Real>>("weight", 5, nullptr, &_lock);
const Grid<Vec3> *uv = _args.getPtrOpt<Grid<Vec3>>("uv", 6, nullptr, &_lock);
_retval = getPyNone();
applyNoiseVec3(flags, target, noise, scale, scaleSpatial, weight, uv);
_args.check();
@@ -905,7 +905,7 @@ static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "computeEnergy", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -943,7 +943,7 @@ static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "computeWaveletCoeffs", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &input = *_args.getPtr<Grid<Real>>("input", 0, &_lock);
@@ -968,7 +968,7 @@ void PbRegister_computeWaveletCoeffs()
}
// note - alomst the same as for vorticity confinement
void computeVorticity(const MACGrid &vel, Grid<Vec3> &vorticity, Grid<Real> *norm = NULL)
void computeVorticity(const MACGrid &vel, Grid<Vec3> &vorticity, Grid<Real> *norm = nullptr)
{
Grid<Vec3> velCenter(vel.getParent());
GetCentered(velCenter, vel);
@@ -983,12 +983,12 @@ static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "computeVorticity", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
Grid<Vec3> &vorticity = *_args.getPtr<Grid<Vec3>>("vorticity", 1, &_lock);
Grid<Real> *norm = _args.getPtrOpt<Grid<Real>>("norm", 2, NULL, &_lock);
Grid<Real> *norm = _args.getPtrOpt<Grid<Real>>("norm", 2, nullptr, &_lock);
_retval = getPyNone();
computeVorticity(vel, vorticity, norm);
_args.check();
@@ -1104,7 +1104,7 @@ static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "computeStrainRateMag", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
@@ -1219,7 +1219,7 @@ static PyObject *_W_10(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "extrapolateSimpleFlags", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -1263,7 +1263,7 @@ static PyObject *_W_11(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "getCurl", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);

View File

@@ -101,7 +101,7 @@ static PyObject *_W_0(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "calcSecDeriv2d", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Grid<Real> &v = *_args.getPtr<Grid<Real>>("v", 0, &_lock);
@@ -206,7 +206,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "totalSum", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &height = *_args.getPtr<Grid<Real>>("height", 0, &_lock);
@@ -243,7 +243,7 @@ static PyObject *_W_2(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "normalizeSumTo", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Grid<Real> &height = *_args.getPtr<Grid<Real>>("height", 0, &_lock);
@@ -449,7 +449,7 @@ static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
FluidSolver *parent = _args.obtainParent();
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(parent, "cgSolveWE", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);

View File

@@ -74,7 +74,7 @@ class Shape : public PbClass {
Shape *pbo = dynamic_cast<Shape *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Shape::applyToGrid", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
GridBase *grid = _args.getPtr<GridBase>("grid", 0, &_lock);
@@ -104,7 +104,7 @@ class Shape : public PbClass {
Shape *pbo = dynamic_cast<Shape *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Shape::applyToGridSmooth", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
GridBase *grid = _args.getPtr<GridBase>("grid", 0, &_lock);
@@ -133,7 +133,7 @@ class Shape : public PbClass {
Shape *pbo = dynamic_cast<Shape *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Shape::computeLevelset", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -157,7 +157,7 @@ class Shape : public PbClass {
Shape *pbo = dynamic_cast<Shape *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Shape::collideMesh", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Mesh &mesh = *_args.getPtr<Mesh>("mesh", 0, &_lock);
@@ -186,7 +186,7 @@ class Shape : public PbClass {
Shape *pbo = dynamic_cast<Shape *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Shape::getCenter", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -212,7 +212,7 @@ class Shape : public PbClass {
Shape *pbo = dynamic_cast<Shape *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Shape::setCenter", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
const Vec3 &center = _args.get<Vec3>("center", 0, &_lock);
@@ -241,7 +241,7 @@ class Shape : public PbClass {
Shape *pbo = dynamic_cast<Shape *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Shape::getExtent", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -504,7 +504,7 @@ class Cylinder : public Shape {
Cylinder *pbo = dynamic_cast<Cylinder *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Cylinder::setRadius", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real r = _args.get<Real>("r", 0, &_lock);
@@ -534,7 +534,7 @@ class Cylinder : public Shape {
Cylinder *pbo = dynamic_cast<Cylinder *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Cylinder::setZ", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Vec3 z = _args.get<Vec3>("z", 0, &_lock);

View File

@@ -101,7 +101,7 @@ class Timings : public PbClass {
Timings *pbo = dynamic_cast<Timings *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Timings::display", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -128,7 +128,7 @@ class Timings : public PbClass {
Timings *pbo = dynamic_cast<Timings *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "Timings::saveMean", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
std::string file = _args.get<std::string>("file", 0, &_lock);

View File

@@ -82,7 +82,7 @@ class TurbulenceParticleSystem : public ParticleSystem<TurbulenceParticleData> {
Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "TurbulenceParticleSystem::resetTexCoords", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
int num = _args.get<int>("num", 0, &_lock);
@@ -110,7 +110,7 @@ class TurbulenceParticleSystem : public ParticleSystem<TurbulenceParticleData> {
Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "TurbulenceParticleSystem::seed", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Shape *source = _args.getPtr<Shape>("source", 0, &_lock);
@@ -144,7 +144,7 @@ class TurbulenceParticleSystem : public ParticleSystem<TurbulenceParticleData> {
Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "TurbulenceParticleSystem::synthesize", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);
@@ -177,7 +177,7 @@ class TurbulenceParticleSystem : public ParticleSystem<TurbulenceParticleData> {
Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "TurbulenceParticleSystem::deleteInObstacle", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 0, &_lock);

View File

@@ -79,7 +79,7 @@ class VortexParticleSystem : public ParticleSystem<VortexParticleData> {
VortexParticleSystem *pbo = dynamic_cast<VortexParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "VortexParticleSystem::advectSelf", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Real scale = _args.getOpt<Real>("scale", 0, 1.0, &_lock);
@@ -106,7 +106,7 @@ class VortexParticleSystem : public ParticleSystem<VortexParticleData> {
VortexParticleSystem *pbo = dynamic_cast<VortexParticleSystem *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "VortexParticleSystem::applyToMesh", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
Mesh &mesh = *_args.getPtr<Mesh>("mesh", 0, &_lock);

View File

@@ -168,7 +168,7 @@ class VortexSheetMesh : public Mesh {
VortexSheetMesh *pbo = dynamic_cast<VortexSheetMesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "VortexSheetMesh::calcCirculation", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -193,7 +193,7 @@ class VortexSheetMesh : public Mesh {
VortexSheetMesh *pbo = dynamic_cast<VortexSheetMesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "VortexSheetMesh::calcVorticity", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);
@@ -218,7 +218,7 @@ class VortexSheetMesh : public Mesh {
VortexSheetMesh *pbo = dynamic_cast<VortexSheetMesh *>(Pb::objFromPy(_self));
bool noTiming = _args.getOpt<bool>("notiming", -1, 0);
pbPreparePlugin(pbo->getParent(), "VortexSheetMesh::reinitTexCoords", !noTiming);
PyObject *_retval = 0;
PyObject *_retval = nullptr;
{
ArgLocker _lock;
pbo->_args.copy(_args);

View File

@@ -45,7 +45,7 @@ if(WITH_CYCLES_NATIVE_ONLY)
)
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
string(APPEND CMAKE_CXX_FLAGS " -march=native")
set(CYCLES_KERNEL_FLAGS "-march=native")
else()
if(NOT MSVC_NATIVE_ARCH_FLAGS)
@@ -101,10 +101,10 @@ elseif(WIN32 AND MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CYCLES_AVX2_KERNEL_FLAGS "${CYCLES_AVX2_ARCH_FLAGS} ${CYCLES_KERNEL_FLAGS}")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CYCLES_KERNEL_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Ox")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Ox")
string(APPEND CMAKE_CXX_FLAGS " ${CYCLES_KERNEL_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS_RELEASE " /Ox")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /Ox")
string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " /Ox")
elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
check_cxx_compiler_flag(-msse CXX_HAS_SSE)
check_cxx_compiler_flag(-mavx CXX_HAS_AVX)
@@ -113,20 +113,20 @@ elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
# Assume no signal trapping for better code generation.
set(CYCLES_KERNEL_FLAGS "-fno-trapping-math")
# Avoid overhead of setting errno for NaNs.
set(CYCLES_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS} -fno-math-errno")
string(APPEND CYCLES_KERNEL_FLAGS " -fno-math-errno")
# Let compiler optimize 0.0 - x without worrying about signed zeros.
set(CYCLES_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS} -fno-signed-zeros")
string(APPEND CYCLES_KERNEL_FLAGS " -fno-signed-zeros")
if(CMAKE_COMPILER_IS_GNUCC)
# Assume no signal trapping for better code generation.
set(CYCLES_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS} -fno-signaling-nans")
string(APPEND CYCLES_KERNEL_FLAGS " -fno-signaling-nans")
# Assume a fixed rounding mode for better constant folding.
set(CYCLES_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS} -fno-rounding-math")
string(APPEND CYCLES_KERNEL_FLAGS " -fno-rounding-math")
endif()
if(CXX_HAS_SSE)
if(CMAKE_COMPILER_IS_GNUCC)
set(CYCLES_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS} -mfpmath=sse")
string(APPEND CYCLES_KERNEL_FLAGS " -mfpmath=sse")
endif()
set(CYCLES_SSE2_KERNEL_FLAGS "${CYCLES_KERNEL_FLAGS} -msse -msse2")
@@ -140,7 +140,7 @@ elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CYCLES_KERNEL_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${CYCLES_KERNEL_FLAGS}")
elseif(WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "Intel")
check_cxx_compiler_flag(/QxSSE2 CXX_HAS_SSE)
check_cxx_compiler_flag(/arch:AVX CXX_HAS_AVX)

View File

@@ -130,7 +130,7 @@ blender_add_lib(bf_intern_cycles "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# avoid link failure with clang 3.4 debug
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS '3.4')
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -gline-tables-only")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gline-tables-only")
endif()
add_dependencies(bf_intern_cycles bf_rna)

View File

@@ -388,18 +388,19 @@ static void blender_camera_sync(Camera *cam,
const char *viewname,
PointerRNA *cscene)
{
/* copy camera to compare later */
Camera prevcam = *cam;
float aspectratio, sensor_size;
/* viewplane */
blender_camera_viewplane(bcam, width, height, &cam->viewplane, &aspectratio, &sensor_size);
BoundBox2D viewplane;
blender_camera_viewplane(bcam, width, height, &viewplane, &aspectratio, &sensor_size);
cam->width = bcam->full_width;
cam->height = bcam->full_height;
cam->set_viewplane_left(viewplane.left);
cam->set_viewplane_right(viewplane.right);
cam->set_viewplane_top(viewplane.top);
cam->set_viewplane_bottom(viewplane.bottom);
cam->full_width = width;
cam->full_height = height;
cam->set_full_width(width);
cam->set_full_height(height);
/* panorama sensor */
if (bcam->type == CAMERA_PANORAMA && bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID) {
@@ -422,85 +423,91 @@ static void blender_camera_sync(Camera *cam,
}
if (horizontal_fit) {
cam->sensorwidth = sensor_size;
cam->sensorheight = sensor_size * fit_yratio / fit_xratio;
cam->set_sensorwidth(sensor_size);
cam->set_sensorheight(sensor_size * fit_yratio / fit_xratio);
}
else {
cam->sensorwidth = sensor_size * fit_xratio / fit_yratio;
cam->sensorheight = sensor_size;
cam->set_sensorwidth(sensor_size * fit_xratio / fit_yratio);
cam->set_sensorheight(sensor_size);
}
}
/* clipping distances */
cam->nearclip = bcam->nearclip;
cam->farclip = bcam->farclip;
cam->set_nearclip(bcam->nearclip);
cam->set_farclip(bcam->farclip);
/* type */
cam->type = bcam->type;
cam->set_camera_type(bcam->type);
/* panorama */
cam->panorama_type = bcam->panorama_type;
cam->fisheye_fov = bcam->fisheye_fov;
cam->fisheye_lens = bcam->fisheye_lens;
cam->latitude_min = bcam->latitude_min;
cam->latitude_max = bcam->latitude_max;
cam->set_panorama_type(bcam->panorama_type);
cam->set_fisheye_fov(bcam->fisheye_fov);
cam->set_fisheye_lens(bcam->fisheye_lens);
cam->set_latitude_min(bcam->latitude_min);
cam->set_latitude_max(bcam->latitude_max);
cam->longitude_min = bcam->longitude_min;
cam->longitude_max = bcam->longitude_max;
cam->set_longitude_min(bcam->longitude_min);
cam->set_longitude_max(bcam->longitude_max);
/* panorama stereo */
cam->interocular_distance = bcam->interocular_distance;
cam->convergence_distance = bcam->convergence_distance;
cam->use_spherical_stereo = bcam->use_spherical_stereo;
cam->set_interocular_distance(bcam->interocular_distance);
cam->set_convergence_distance(bcam->convergence_distance);
cam->set_use_spherical_stereo(bcam->use_spherical_stereo);
if (cam->use_spherical_stereo) {
if (cam->get_use_spherical_stereo()) {
if (strcmp(viewname, "left") == 0)
cam->stereo_eye = Camera::STEREO_LEFT;
cam->set_stereo_eye(Camera::STEREO_LEFT);
else if (strcmp(viewname, "right") == 0)
cam->stereo_eye = Camera::STEREO_RIGHT;
cam->set_stereo_eye(Camera::STEREO_RIGHT);
else
cam->stereo_eye = Camera::STEREO_NONE;
cam->set_stereo_eye(Camera::STEREO_NONE);
}
cam->use_pole_merge = bcam->use_pole_merge;
cam->pole_merge_angle_from = bcam->pole_merge_angle_from;
cam->pole_merge_angle_to = bcam->pole_merge_angle_to;
cam->set_use_pole_merge(bcam->use_pole_merge);
cam->set_pole_merge_angle_from(bcam->pole_merge_angle_from);
cam->set_pole_merge_angle_to(bcam->pole_merge_angle_to);
/* anamorphic lens bokeh */
cam->aperture_ratio = bcam->aperture_ratio;
cam->set_aperture_ratio(bcam->aperture_ratio);
/* perspective */
cam->fov = 2.0f * atanf((0.5f * sensor_size) / bcam->lens / aspectratio);
cam->focaldistance = bcam->focaldistance;
cam->aperturesize = bcam->aperturesize;
cam->blades = bcam->apertureblades;
cam->bladesrotation = bcam->aperturerotation;
cam->set_fov(2.0f * atanf((0.5f * sensor_size) / bcam->lens / aspectratio));
cam->set_focaldistance(bcam->focaldistance);
cam->set_aperturesize(bcam->aperturesize);
cam->set_blades(bcam->apertureblades);
cam->set_bladesrotation(bcam->aperturerotation);
/* transform */
cam->matrix = blender_camera_matrix(bcam->matrix, bcam->type, bcam->panorama_type);
cam->motion.clear();
cam->motion.resize(bcam->motion_steps, cam->matrix);
cam->use_perspective_motion = false;
cam->shuttertime = bcam->shuttertime;
cam->fov_pre = cam->fov;
cam->fov_post = cam->fov;
cam->motion_position = bcam->motion_position;
cam->set_matrix(blender_camera_matrix(bcam->matrix, bcam->type, bcam->panorama_type));
cam->rolling_shutter_type = bcam->rolling_shutter_type;
cam->rolling_shutter_duration = bcam->rolling_shutter_duration;
array<Transform> motion;
motion.resize(bcam->motion_steps, cam->get_matrix());
cam->set_motion(motion);
cam->set_use_perspective_motion(false);
cam->shutter_curve = bcam->shutter_curve;
cam->set_shuttertime(bcam->shuttertime);
cam->set_fov_pre(cam->get_fov());
cam->set_fov_post(cam->get_fov());
cam->set_motion_position(bcam->motion_position);
cam->set_rolling_shutter_type(bcam->rolling_shutter_type);
cam->set_rolling_shutter_duration(bcam->rolling_shutter_duration);
cam->set_shutter_curve(bcam->shutter_curve);
/* border */
cam->border = bcam->border;
cam->viewport_camera_border = bcam->viewport_camera_border;
cam->set_border_left(bcam->border.left);
cam->set_border_right(bcam->border.right);
cam->set_border_top(bcam->border.top);
cam->set_border_bottom(bcam->border.bottom);
cam->set_viewport_camera_border_left(bcam->viewport_camera_border.left);
cam->set_viewport_camera_border_right(bcam->viewport_camera_border.right);
cam->set_viewport_camera_border_top(bcam->viewport_camera_border.top);
cam->set_viewport_camera_border_bottom(bcam->viewport_camera_border.bottom);
bcam->offscreen_dicing_scale = RNA_float_get(cscene, "offscreen_dicing_scale");
cam->offscreen_dicing_scale = bcam->offscreen_dicing_scale;
/* set update flag */
if (cam->modified(prevcam))
cam->tag_update();
cam->set_offscreen_dicing_scale(bcam->offscreen_dicing_scale);
}
/* Sync Render Camera */
@@ -582,22 +589,24 @@ void BlenderSync::sync_camera_motion(
Camera *cam = scene->camera;
BL::Array<float, 16> b_ob_matrix;
b_engine.camera_model_matrix(b_ob, cam->use_spherical_stereo, b_ob_matrix);
b_engine.camera_model_matrix(b_ob, cam->get_use_spherical_stereo(), b_ob_matrix);
Transform tfm = get_transform(b_ob_matrix);
tfm = blender_camera_matrix(tfm, cam->type, cam->panorama_type);
tfm = blender_camera_matrix(tfm, cam->get_camera_type(), cam->get_panorama_type());
if (motion_time == 0.0f) {
/* When motion blur is not centered in frame, cam->matrix gets reset. */
cam->matrix = tfm;
cam->set_matrix(tfm);
}
/* Set transform in motion array. */
int motion_step = cam->motion_step(motion_time);
if (motion_step >= 0) {
cam->motion[motion_step] = tfm;
array<Transform> motion = cam->get_motion();
motion[motion_step] = tfm;
cam->set_motion(motion);
}
if (cam->type == CAMERA_PERSPECTIVE) {
if (cam->get_camera_type() == CAMERA_PERSPECTIVE) {
BlenderCamera bcam;
float aspectratio, sensor_size;
blender_camera_init(&bcam, b_render);
@@ -610,18 +619,18 @@ void BlenderSync::sync_camera_motion(
blender_camera_viewplane(&bcam, width, height, NULL, &aspectratio, &sensor_size);
/* TODO(sergey): De-duplicate calculation with camera sync. */
float fov = 2.0f * atanf((0.5f * sensor_size) / bcam.lens / aspectratio);
if (fov != cam->fov) {
if (fov != cam->get_fov()) {
VLOG(1) << "Camera " << b_ob.name() << " FOV change detected.";
if (motion_time == 0.0f) {
cam->fov = fov;
cam->set_fov(fov);
}
else if (motion_time == -1.0f) {
cam->fov_pre = fov;
cam->use_perspective_motion = true;
cam->set_fov_pre(fov);
cam->set_use_perspective_motion(true);
}
else if (motion_time == 1.0f) {
cam->fov_post = fov;
cam->use_perspective_motion = true;
cam->set_fov_post(fov);
cam->set_use_perspective_motion(true);
}
}
}

View File

@@ -77,7 +77,7 @@ static bool ObtainCacheParticleData(
if ((b_part.render_type() == BL::ParticleSettings::render_type_PATH) &&
(b_part.type() == BL::ParticleSettings::type_HAIR)) {
int shader = clamp(b_part.material() - 1, 0, hair->used_shaders.size() - 1);
int shader = clamp(b_part.material() - 1, 0, hair->get_used_shaders().size() - 1);
int display_step = background ? b_part.render_step() : b_part.display_step();
int totparts = b_psys.particles.length();
int totchild = background ? b_psys.child_particles.length() :
@@ -307,7 +307,7 @@ static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CDa
VLOG(1) << "Exporting curve segments for mesh " << hair->name;
}
hair->reserve_curves(hair->num_curves() + num_curves, hair->curve_keys.size() + num_keys);
hair->reserve_curves(hair->num_curves() + num_curves, hair->get_curve_keys().size() + num_keys);
num_keys = 0;
num_curves = 0;
@@ -350,9 +350,9 @@ static void ExportCurveSegments(Scene *scene, Hair *hair, ParticleCurveData *CDa
}
/* check allocation */
if ((hair->curve_keys.size() != num_keys) || (hair->num_curves() != num_curves)) {
if ((hair->get_curve_keys().size() != num_keys) || (hair->num_curves() != num_curves)) {
VLOG(1) << "Allocation failed, clearing data";
hair->clear();
hair->clear(true);
}
}
@@ -402,7 +402,7 @@ static void export_hair_motion_validate_attribute(Hair *hair,
bool have_motion)
{
Attribute *attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
const int num_keys = hair->curve_keys.size();
const int num_keys = hair->get_curve_keys().size();
if (num_motion_keys != num_keys || !have_motion) {
/* No motion or hair "topology" changed, remove attributes again. */
@@ -423,8 +423,8 @@ static void export_hair_motion_validate_attribute(Hair *hair,
float4 *mP = attr_mP->data_float4() + step * num_keys;
for (int key = 0; key < num_keys; key++) {
mP[key] = float3_to_float4(hair->curve_keys[key]);
mP[key].w = hair->curve_radius[key];
mP[key] = float3_to_float4(hair->get_curve_keys()[key]);
mP[key].w = hair->get_curve_radius()[key];
}
}
}
@@ -447,7 +447,7 @@ static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, int
}
/* export motion vectors for curve keys */
size_t numkeys = hair->curve_keys.size();
size_t numkeys = hair->get_curve_keys().size();
float4 *mP = attr_mP->data_float4() + motion_step * numkeys;
bool have_motion = false;
int i = 0;
@@ -458,24 +458,24 @@ static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, int
curve < CData->psys_firstcurve[sys] + CData->psys_curvenum[sys];
curve++) {
/* Curve lengths may not match! Curves can be clipped. */
int curve_key_end = (num_curves + 1 < (int)hair->curve_first_key.size() ?
hair->curve_first_key[num_curves + 1] :
(int)hair->curve_keys.size());
const int num_center_curve_keys = curve_key_end - hair->curve_first_key[num_curves];
int curve_key_end = (num_curves + 1 < (int)hair->get_curve_first_key().size() ?
hair->get_curve_first_key()[num_curves + 1] :
(int)hair->get_curve_keys().size());
const int num_center_curve_keys = curve_key_end - hair->get_curve_first_key()[num_curves];
const int is_num_keys_different = CData->curve_keynum[curve] - num_center_curve_keys;
if (!is_num_keys_different) {
for (int curvekey = CData->curve_firstkey[curve];
curvekey < CData->curve_firstkey[curve] + CData->curve_keynum[curve];
curvekey++) {
if (i < hair->curve_keys.size()) {
if (i < hair->get_curve_keys().size()) {
mP[i] = CurveSegmentMotionCV(CData, sys, curve, curvekey);
if (!have_motion) {
/* unlike mesh coordinates, these tend to be slightly different
* between frames due to particle transforms into/out of object
* space, so we use an epsilon to detect actual changes */
float4 curve_key = float3_to_float4(hair->curve_keys[i]);
curve_key.w = hair->curve_radius[i];
float4 curve_key = float3_to_float4(hair->get_curve_keys()[i]);
curve_key.w = hair->get_curve_radius()[i];
if (len_squared(mP[i] - curve_key) > 1e-5f * 1e-5f)
have_motion = true;
}
@@ -560,7 +560,7 @@ void BlenderSync::sync_particle_hair(
float3 *generated = attr_generated->data_float3();
for (size_t i = 0; i < hair->num_curves(); i++) {
float3 co = hair->curve_keys[hair->get_curve(i).first_key];
float3 co = hair->get_curve_keys()[hair->get_curve(i).first_key];
generated[i] = co * size - loc;
}
}
@@ -742,7 +742,7 @@ static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_st
}
/* Export motion keys. */
const int num_keys = hair->curve_keys.size();
const int num_keys = hair->get_curve_keys().size();
float4 *mP = attr_mP->data_float4() + motion_step * num_keys;
bool have_motion = false;
int num_motion_keys = 0;
@@ -769,8 +769,8 @@ static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_st
if (!have_motion) {
/* TODO: use epsilon for comparison? Was needed for particles due to
* transform, but ideally should not happen anymore. */
float4 curve_key = float3_to_float4(hair->curve_keys[i]);
curve_key.w = hair->curve_radius[i];
float4 curve_key = float3_to_float4(hair->get_curve_keys()[i]);
curve_key.w = hair->get_curve_radius()[i];
have_motion = !(mP[i] == curve_key);
}
}
@@ -817,42 +817,53 @@ void BlenderSync::sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motio
}
#endif
void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Hair *hair,
const vector<Shader *> &used_shaders)
void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Hair *hair)
{
/* Compares curve_keys rather than strands in order to handle quick hair
* adjustments in dynamic BVH - other methods could probably do this better. */
array<float3> oldcurve_keys;
array<float> oldcurve_radius;
oldcurve_keys.steal_data(hair->curve_keys);
oldcurve_radius.steal_data(hair->curve_radius);
/* make a copy of the shaders as the caller in the main thread still need them for syncing the
* attributes */
array<Node *> used_shaders = hair->get_used_shaders();
hair->clear();
hair->used_shaders = used_shaders;
Hair new_hair;
new_hair.set_used_shaders(used_shaders);
if (view_layer.use_hair) {
if (b_ob.type() == BL::Object::type_HAIR) {
/* Hair object. */
sync_hair(hair, b_ob, false);
sync_hair(&new_hair, b_ob, false);
}
else {
/* Particle hair. */
bool need_undeformed = hair->need_attribute(scene, ATTR_STD_GENERATED);
bool need_undeformed = new_hair.need_attribute(scene, ATTR_STD_GENERATED);
BL::Mesh b_mesh = object_to_mesh(
b_data, b_ob, b_depsgraph, need_undeformed, Mesh::SUBDIVISION_NONE);
if (b_mesh) {
sync_particle_hair(hair, b_mesh, b_ob, false);
sync_particle_hair(&new_hair, b_mesh, b_ob, false);
free_object_to_mesh(b_data, b_ob, b_mesh);
}
}
}
/* update original sockets */
for (const SocketType &socket : new_hair.type->inputs) {
/* Those sockets are updated in sync_object, so do not modify them. */
if (socket.name == "use_motion_blur" || socket.name == "motion_steps" ||
socket.name == "used_shaders") {
continue;
}
hair->set_value(socket, new_hair, socket);
}
foreach (Attribute &attr, new_hair.attributes.attributes) {
hair->attributes.attributes.push_back(std::move(attr));
}
/* tag update */
const bool rebuild = ((oldcurve_keys != hair->curve_keys) ||
(oldcurve_radius != hair->curve_radius));
/* Compares curve_keys rather than strands in order to handle quick hair
* adjustments in dynamic BVH - other methods could probably do this better. */
const bool rebuild = (hair->curve_keys_is_modified() || hair->curve_radius_is_modified());
hair->tag_update(scene, rebuild);
}

View File

@@ -47,8 +47,7 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scen
vector<DeviceInfo> devices = Device::available_devices(BlenderSession::device_override);
if (devices.empty()) {
printf("Found no Cycles device of the specified type, falling back to CPU...\n");
return Device::available_devices(DEVICE_MASK_CPU).front();
return Device::dummy_device("Found no Cycles device of the specified type");
}
int threads = blender_device_threads(b_scene);

View File

@@ -52,14 +52,14 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
/* Test if we can instance or if the object is modified. */
BL::ID b_ob_data = b_ob.data();
BL::ID b_key_id = (BKE_object_is_modified(b_ob)) ? b_ob_instance : b_ob_data;
GeometryKey key(b_key_id.ptr.data, use_particle_hair);
BL::Material material_override = view_layer.material_override;
Shader *default_shader = (b_ob.type() == BL::Object::type_VOLUME) ? scene->default_volume :
scene->default_surface;
Geometry::Type geom_type = determine_geom_type(b_ob, use_particle_hair);
GeometryKey key(b_key_id.ptr.data, geom_type);
/* Find shader indices. */
vector<Shader *> used_shaders;
array<Node *> used_shaders;
BL::Object::material_slots_iterator slot;
for (b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) {
@@ -76,7 +76,7 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
if (material_override)
find_shader(material_override, used_shaders, default_shader);
else
used_shaders.push_back(default_shader);
used_shaders.push_back_slow(default_shader);
}
/* Ensure we only sync instanced geometry once. */
@@ -114,7 +114,7 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
}
/* Test if shaders changed, these can be object level so geometry
* does not get tagged for recalc. */
else if (geom->used_shaders != used_shaders) {
else if (geom->get_used_shaders() != used_shaders) {
;
}
else {
@@ -122,7 +122,8 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
* because the shader needs different geometry attributes. */
bool attribute_recalc = false;
foreach (Shader *shader, geom->used_shaders) {
foreach (Node *node, geom->get_used_shaders()) {
Shader *shader = static_cast<Shader *>(node);
if (shader->need_update_geometry) {
attribute_recalc = true;
}
@@ -138,6 +139,9 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
geom->name = ustring(b_ob_data.name().c_str());
/* Store the shaders immediately for the object attribute code. */
geom->set_used_shaders(used_shaders);
auto sync_func = [=]() mutable {
if (progress.get_cancel())
return;
@@ -146,15 +150,15 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
if (geom_type == Geometry::HAIR) {
Hair *hair = static_cast<Hair *>(geom);
sync_hair(b_depsgraph, b_ob, hair, used_shaders);
sync_hair(b_depsgraph, b_ob, hair);
}
else if (geom_type == Geometry::VOLUME) {
Volume *volume = static_cast<Volume *>(geom);
sync_volume(b_ob, volume, used_shaders);
sync_volume(b_ob, volume);
}
else {
Mesh *mesh = static_cast<Mesh *>(geom);
sync_mesh(b_depsgraph, b_ob, mesh, used_shaders);
sync_mesh(b_depsgraph, b_ob, mesh);
}
};
@@ -177,7 +181,7 @@ void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
TaskPool *task_pool)
{
/* Ensure we only sync instanced geometry once. */
Geometry *geom = object->geometry;
Geometry *geom = object->get_geometry();
if (geometry_motion_synced.find(geom) != geometry_motion_synced.end())
return;

View File

@@ -19,6 +19,7 @@
#include <string.h>
#include "render/geometry.h"
#include "render/scene.h"
#include "util/util_map.h"
@@ -34,10 +35,22 @@ CCL_NAMESPACE_BEGIN
template<typename K, typename T> class id_map {
public:
id_map()
id_map(Scene *scene_) : scene(scene_)
{
}
~id_map()
{
set<T *> nodes;
typename map<K, T *>::iterator jt;
for (jt = b_map.begin(); jt != b_map.end(); jt++) {
nodes.insert(jt->second);
}
scene->delete_nodes(nodes);
}
T *find(const BL::ID &id)
{
return find(id.ptr.owner_id);
@@ -97,16 +110,15 @@ template<typename K, typename T> class id_map {
}
/* Combined add and update as needed. */
bool add_or_update(Scene *scene, T **r_data, const BL::ID &id)
bool add_or_update(T **r_data, const BL::ID &id)
{
return add_or_update(scene, r_data, id, id, id.ptr.owner_id);
return add_or_update(r_data, id, id, id.ptr.owner_id);
}
bool add_or_update(Scene *scene, T **r_data, const BL::ID &id, const K &key)
bool add_or_update(T **r_data, const BL::ID &id, const K &key)
{
return add_or_update(scene, r_data, id, id, key);
return add_or_update(r_data, id, id, key);
}
bool add_or_update(
Scene *scene, T **r_data, const BL::ID &id, const BL::ID &parent, const K &key)
bool add_or_update(T **r_data, const BL::ID &id, const BL::ID &parent, const K &key)
{
T *data = find(key);
bool recalc;
@@ -145,7 +157,7 @@ template<typename K, typename T> class id_map {
b_map[NULL] = data;
}
void post_sync(Scene *scene, bool do_delete = true)
void post_sync(bool do_delete = true)
{
map<K, T *> new_map;
typedef pair<const K, T *> TMapPair;
@@ -176,6 +188,7 @@ template<typename K, typename T> class id_map {
map<K, T *> b_map;
set<T *> used_set;
set<void *> b_recalc;
Scene *scene;
};
/* Object Key
@@ -230,9 +243,9 @@ struct ObjectKey {
struct GeometryKey {
void *id;
bool use_particle_hair;
Geometry::Type geometry_type;
GeometryKey(void *id, bool use_particle_hair) : id(id), use_particle_hair(use_particle_hair)
GeometryKey(void *id, Geometry::Type geometry_type) : id(id), geometry_type(geometry_type)
{
}
@@ -242,7 +255,7 @@ struct GeometryKey {
return true;
}
else if (id == k.id) {
if (use_particle_hair < k.use_particle_hair) {
if (geometry_type < k.geometry_type) {
return true;
}
}

View File

@@ -39,10 +39,10 @@ void BlenderSync::sync_light(BL::Object &b_parent,
BL::Light b_light(b_ob.data());
/* Update if either object or light data changed. */
if (!light_map.add_or_update(scene, &light, b_ob, b_parent, key)) {
if (!light_map.add_or_update(&light, b_ob, b_parent, key)) {
Shader *shader;
if (!shader_map.add_or_update(scene, &shader, b_light)) {
if (light->is_portal)
if (!shader_map.add_or_update(&shader, b_light)) {
if (light->get_is_portal())
*use_portal = true;
return;
}
@@ -52,16 +52,16 @@ void BlenderSync::sync_light(BL::Object &b_parent,
switch (b_light.type()) {
case BL::Light::type_POINT: {
BL::PointLight b_point_light(b_light);
light->size = b_point_light.shadow_soft_size();
light->type = LIGHT_POINT;
light->set_size(b_point_light.shadow_soft_size());
light->set_light_type(LIGHT_POINT);
break;
}
case BL::Light::type_SPOT: {
BL::SpotLight b_spot_light(b_light);
light->size = b_spot_light.shadow_soft_size();
light->type = LIGHT_SPOT;
light->spot_angle = b_spot_light.spot_size();
light->spot_smooth = b_spot_light.spot_blend();
light->set_size(b_spot_light.shadow_soft_size());
light->set_light_type(LIGHT_SPOT);
light->set_spot_angle(b_spot_light.spot_size());
light->set_spot_smooth(b_spot_light.spot_blend());
break;
}
/* Hemi were removed from 2.8 */
@@ -72,88 +72,88 @@ void BlenderSync::sync_light(BL::Object &b_parent,
// }
case BL::Light::type_SUN: {
BL::SunLight b_sun_light(b_light);
light->angle = b_sun_light.angle();
light->type = LIGHT_DISTANT;
light->set_angle(b_sun_light.angle());
light->set_light_type(LIGHT_DISTANT);
break;
}
case BL::Light::type_AREA: {
BL::AreaLight b_area_light(b_light);
light->size = 1.0f;
light->axisu = transform_get_column(&tfm, 0);
light->axisv = transform_get_column(&tfm, 1);
light->sizeu = b_area_light.size();
light->set_size(1.0f);
light->set_axisu(transform_get_column(&tfm, 0));
light->set_axisv(transform_get_column(&tfm, 1));
light->set_sizeu(b_area_light.size());
switch (b_area_light.shape()) {
case BL::AreaLight::shape_SQUARE:
light->sizev = light->sizeu;
light->round = false;
light->set_sizev(light->get_sizeu());
light->set_round(false);
break;
case BL::AreaLight::shape_RECTANGLE:
light->sizev = b_area_light.size_y();
light->round = false;
light->set_sizev(b_area_light.size_y());
light->set_round(false);
break;
case BL::AreaLight::shape_DISK:
light->sizev = light->sizeu;
light->round = true;
light->set_sizev(light->get_sizeu());
light->set_round(true);
break;
case BL::AreaLight::shape_ELLIPSE:
light->sizev = b_area_light.size_y();
light->round = true;
light->set_sizev(b_area_light.size_y());
light->set_round(true);
break;
}
light->type = LIGHT_AREA;
light->set_light_type(LIGHT_AREA);
break;
}
}
/* strength */
light->strength = get_float3(b_light.color());
light->strength *= BL::PointLight(b_light).energy();
float3 strength = get_float3(b_light.color()) * BL::PointLight(b_light).energy();
light->set_strength(strength);
/* location and (inverted!) direction */
light->co = transform_get_column(&tfm, 3);
light->dir = -transform_get_column(&tfm, 2);
light->tfm = tfm;
light->set_co(transform_get_column(&tfm, 3));
light->set_dir(-transform_get_column(&tfm, 2));
light->set_tfm(tfm);
/* shader */
vector<Shader *> used_shaders;
array<Node *> used_shaders;
find_shader(b_light, used_shaders, scene->default_light);
light->shader = used_shaders[0];
light->set_shader(static_cast<Shader *>(used_shaders[0]));
/* shadow */
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
PointerRNA clight = RNA_pointer_get(&b_light.ptr, "cycles");
light->cast_shadow = get_boolean(clight, "cast_shadow");
light->use_mis = get_boolean(clight, "use_multiple_importance_sampling");
light->set_cast_shadow(get_boolean(clight, "cast_shadow"));
light->set_use_mis(get_boolean(clight, "use_multiple_importance_sampling"));
int samples = get_int(clight, "samples");
if (get_boolean(cscene, "use_square_samples"))
light->samples = samples * samples;
light->set_samples(samples * samples);
else
light->samples = samples;
light->set_samples(samples);
light->max_bounces = get_int(clight, "max_bounces");
light->set_max_bounces(get_int(clight, "max_bounces"));
if (b_ob != b_ob_instance) {
light->random_id = random_id;
light->set_random_id(random_id);
}
else {
light->random_id = hash_uint2(hash_string(b_ob.name().c_str()), 0);
light->set_random_id(hash_uint2(hash_string(b_ob.name().c_str()), 0));
}
if (light->type == LIGHT_AREA)
light->is_portal = get_boolean(clight, "is_portal");
if (light->get_light_type() == LIGHT_AREA)
light->set_is_portal(get_boolean(clight, "is_portal"));
else
light->is_portal = false;
light->set_is_portal(false);
if (light->is_portal)
if (light->get_is_portal())
*use_portal = true;
/* visibility */
uint visibility = object_ray_visibility(b_ob);
light->use_diffuse = (visibility & PATH_RAY_DIFFUSE) != 0;
light->use_glossy = (visibility & PATH_RAY_GLOSSY) != 0;
light->use_transmission = (visibility & PATH_RAY_TRANSMIT) != 0;
light->use_scatter = (visibility & PATH_RAY_VOLUME_SCATTER) != 0;
light->set_use_diffuse((visibility & PATH_RAY_DIFFUSE) != 0);
light->set_use_glossy((visibility & PATH_RAY_GLOSSY) != 0);
light->set_use_transmission((visibility & PATH_RAY_TRANSMIT) != 0);
light->set_use_scatter((visibility & PATH_RAY_VOLUME_SCATTER) != 0);
/* tag */
light->tag_update(scene);
@@ -176,27 +176,27 @@ void BlenderSync::sync_background_light(BL::SpaceView3D &b_v3d, bool use_portal)
Light *light;
ObjectKey key(b_world, 0, b_world, false);
if (light_map.add_or_update(scene, &light, b_world, b_world, key) || world_recalc ||
if (light_map.add_or_update(&light, b_world, b_world, key) || world_recalc ||
b_world.ptr.data != world_map) {
light->type = LIGHT_BACKGROUND;
light->set_light_type(LIGHT_BACKGROUND);
if (sampling_method == SAMPLING_MANUAL) {
light->map_resolution = get_int(cworld, "sample_map_resolution");
light->set_map_resolution(get_int(cworld, "sample_map_resolution"));
}
else {
light->map_resolution = 0;
light->set_map_resolution(0);
}
light->shader = scene->default_background;
light->use_mis = sample_as_light;
light->max_bounces = get_int(cworld, "max_bounces");
light->set_shader(scene->default_background);
light->set_use_mis(sample_as_light);
light->set_max_bounces(get_int(cworld, "max_bounces"));
/* force enable light again when world is resynced */
light->is_enabled = true;
light->set_is_enabled(true);
int samples = get_int(cworld, "samples");
if (get_boolean(cscene, "use_square_samples"))
light->samples = samples * samples;
light->set_samples(samples * samples);
else
light->samples = samples;
light->set_samples(samples);
light->tag_update(scene);
light_map.set_recalc(b_world);

View File

@@ -48,8 +48,8 @@ struct MikkUserData {
float *tangent_sign)
: mesh(mesh), texface(NULL), orco(NULL), tangent(tangent), tangent_sign(tangent_sign)
{
const AttributeSet &attributes = (mesh->subd_faces.size()) ? mesh->subd_attributes :
mesh->attributes;
const AttributeSet &attributes = (mesh->get_num_subd_faces()) ? mesh->subd_attributes :
mesh->attributes;
Attribute *attr_vN = attributes.find(ATTR_STD_VERTEX_NORMAL);
vertex_normal = attr_vN->data_float3();
@@ -85,8 +85,8 @@ struct MikkUserData {
static int mikk_get_num_faces(const SMikkTSpaceContext *context)
{
const MikkUserData *userdata = (const MikkUserData *)context->m_pUserData;
if (userdata->mesh->subd_faces.size()) {
return userdata->mesh->subd_faces.size();
if (userdata->mesh->get_num_subd_faces()) {
return userdata->mesh->get_num_subd_faces();
}
else {
return userdata->mesh->num_triangles();
@@ -96,9 +96,9 @@ static int mikk_get_num_faces(const SMikkTSpaceContext *context)
static int mikk_get_num_verts_of_face(const SMikkTSpaceContext *context, const int face_num)
{
const MikkUserData *userdata = (const MikkUserData *)context->m_pUserData;
if (userdata->mesh->subd_faces.size()) {
if (userdata->mesh->get_num_subd_faces()) {
const Mesh *mesh = userdata->mesh;
return mesh->subd_faces[face_num].num_corners;
return mesh->get_subd_num_corners()[face_num];
}
else {
return 3;
@@ -107,19 +107,19 @@ static int mikk_get_num_verts_of_face(const SMikkTSpaceContext *context, const i
static int mikk_vertex_index(const Mesh *mesh, const int face_num, const int vert_num)
{
if (mesh->subd_faces.size()) {
const Mesh::SubdFace &face = mesh->subd_faces[face_num];
return mesh->subd_face_corners[face.start_corner + vert_num];
if (mesh->get_num_subd_faces()) {
const Mesh::SubdFace &face = mesh->get_subd_face(face_num);
return mesh->get_subd_face_corners()[face.start_corner + vert_num];
}
else {
return mesh->triangles[face_num * 3 + vert_num];
return mesh->get_triangles()[face_num * 3 + vert_num];
}
}
static int mikk_corner_index(const Mesh *mesh, const int face_num, const int vert_num)
{
if (mesh->subd_faces.size()) {
const Mesh::SubdFace &face = mesh->subd_faces[face_num];
if (mesh->get_num_subd_faces()) {
const Mesh::SubdFace &face = mesh->get_subd_face(face_num);
return face.start_corner + vert_num;
}
else {
@@ -135,7 +135,7 @@ static void mikk_get_position(const SMikkTSpaceContext *context,
const MikkUserData *userdata = (const MikkUserData *)context->m_pUserData;
const Mesh *mesh = userdata->mesh;
const int vertex_index = mikk_vertex_index(mesh, face_num, vert_num);
const float3 vP = mesh->verts[vertex_index];
const float3 vP = mesh->get_verts()[vertex_index];
P[0] = vP.x;
P[1] = vP.y;
P[2] = vP.z;
@@ -178,8 +178,8 @@ static void mikk_get_normal(const SMikkTSpaceContext *context,
const MikkUserData *userdata = (const MikkUserData *)context->m_pUserData;
const Mesh *mesh = userdata->mesh;
float3 vN;
if (mesh->subd_faces.size()) {
const Mesh::SubdFace &face = mesh->subd_faces[face_num];
if (mesh->get_num_subd_faces()) {
const Mesh::SubdFace &face = mesh->get_subd_face(face_num);
if (face.smooth) {
const int vertex_index = mikk_vertex_index(mesh, face_num, vert_num);
vN = userdata->vertex_normal[vertex_index];
@@ -189,13 +189,13 @@ static void mikk_get_normal(const SMikkTSpaceContext *context,
}
}
else {
if (mesh->smooth[face_num]) {
if (mesh->get_smooth()[face_num]) {
const int vertex_index = mikk_vertex_index(mesh, face_num, vert_num);
vN = userdata->vertex_normal[vertex_index];
}
else {
const Mesh::Triangle tri = mesh->get_triangle(face_num);
vN = tri.compute_normal(&mesh->verts[0]);
vN = tri.compute_normal(&mesh->get_verts()[0]);
}
}
N[0] = vN.x;
@@ -222,7 +222,8 @@ static void mikk_compute_tangents(
const BL::Mesh &b_mesh, const char *layer_name, Mesh *mesh, bool need_sign, bool active_render)
{
/* Create tangent attributes. */
AttributeSet &attributes = (mesh->subd_faces.size()) ? mesh->subd_attributes : mesh->attributes;
AttributeSet &attributes = (mesh->get_num_subd_faces()) ? mesh->subd_attributes :
mesh->attributes;
Attribute *attr;
ustring name;
if (layer_name != NULL) {
@@ -346,7 +347,7 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
for (int i = 0; i < n; i++) {
float4 color = get_float4(l->data[p->loop_start() + i].color());
/* Compress/encode vertex color using the sRGB curve. */
*(cdata++) = color_float4_to_uchar4(color_srgb_to_linear_v4(color));
*(cdata++) = color_float4_to_uchar4(color);
}
}
}
@@ -368,9 +369,10 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
float4 c3 = get_float4(l->data[li[2]].color());
/* Compress/encode vertex color using the sRGB curve. */
cdata[0] = color_float4_to_uchar4(color_srgb_to_linear_v4(c1));
cdata[1] = color_float4_to_uchar4(color_srgb_to_linear_v4(c2));
cdata[2] = color_float4_to_uchar4(color_srgb_to_linear_v4(c3));
cdata[0] = color_float4_to_uchar4(c1);
cdata[1] = color_float4_to_uchar4(c2);
cdata[2] = color_float4_to_uchar4(c3);
cdata += 3;
}
}
@@ -554,7 +556,7 @@ static void attr_create_pointiness(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, b
for (int vert_index = 0; vert_index < num_verts; ++vert_index) {
sorted_vert_indeices[vert_index] = vert_index;
}
VertexAverageComparator compare(mesh->verts);
VertexAverageComparator compare(mesh->get_verts());
sort(sorted_vert_indeices.begin(), sorted_vert_indeices.end(), compare);
/* This array stores index of the original vertex for the given vertex
* index.
@@ -562,12 +564,12 @@ static void attr_create_pointiness(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, b
vector<int> vert_orig_index(num_verts);
for (int sorted_vert_index = 0; sorted_vert_index < num_verts; ++sorted_vert_index) {
const int vert_index = sorted_vert_indeices[sorted_vert_index];
const float3 &vert_co = mesh->verts[vert_index];
const float3 &vert_co = mesh->get_verts()[vert_index];
bool found = false;
for (int other_sorted_vert_index = sorted_vert_index + 1; other_sorted_vert_index < num_verts;
++other_sorted_vert_index) {
const int other_vert_index = sorted_vert_indeices[other_sorted_vert_index];
const float3 &other_vert_co = mesh->verts[other_vert_index];
const float3 &other_vert_co = mesh->get_verts()[other_vert_index];
/* We are too far away now, we wouldn't have duplicate. */
if ((other_vert_co.x + other_vert_co.y + other_vert_co.z) -
(vert_co.x + vert_co.y + vert_co.z) >
@@ -732,7 +734,7 @@ static void attr_create_random_per_island(Scene *scene,
static void create_mesh(Scene *scene,
Mesh *mesh,
BL::Mesh &b_mesh,
const vector<Shader *> &used_shaders,
const array<Node *> &used_shaders,
bool subdivision = false,
bool subdivide_uvs = true)
{
@@ -743,7 +745,7 @@ static void create_mesh(Scene *scene,
int numcorners = 0;
int numngons = 0;
bool use_loop_normals = b_mesh.use_auto_smooth() &&
(mesh->subdivision_type != Mesh::SUBDIVISION_CATMULL_CLARK);
(mesh->get_subdivision_type() != Mesh::SUBDIVISION_CATMULL_CLARK);
/* If no faces, create empty mesh. */
if (numfaces == 0) {
@@ -762,8 +764,11 @@ static void create_mesh(Scene *scene,
}
/* allocate memory */
if (subdivision) {
mesh->reserve_subd_faces(numfaces, numngons, numcorners);
}
mesh->reserve_mesh(numverts, numtris);
mesh->reserve_subd_faces(numfaces, numngons, numcorners);
/* create vertex coordinates and normals */
BL::Mesh::vertices_iterator v;
@@ -875,7 +880,7 @@ static void create_subd_mesh(Scene *scene,
Mesh *mesh,
BL::Object &b_ob,
BL::Mesh &b_mesh,
const vector<Shader *> &used_shaders,
const array<Node *> &used_shaders,
float dicing_rate,
int max_subdivisions)
{
@@ -894,31 +899,21 @@ static void create_subd_mesh(Scene *scene,
}
}
mesh->subd_creases.resize(num_creases);
mesh->reserve_subd_creases(num_creases);
Mesh::SubdEdgeCrease *crease = mesh->subd_creases.data();
for (b_mesh.edges.begin(e); e != b_mesh.edges.end(); ++e) {
if (e->crease() != 0.0f) {
crease->v[0] = e->vertices()[0];
crease->v[1] = e->vertices()[1];
crease->crease = e->crease();
crease++;
mesh->add_crease(e->vertices()[0], e->vertices()[1], e->crease());
}
}
/* set subd params */
if (!mesh->subd_params) {
mesh->subd_params = new SubdParams(mesh);
}
SubdParams &sdparams = *mesh->subd_params;
PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles");
float subd_dicing_rate = max(0.1f, RNA_float_get(&cobj, "dicing_rate") * dicing_rate);
sdparams.dicing_rate = max(0.1f, RNA_float_get(&cobj, "dicing_rate") * dicing_rate);
sdparams.max_level = max_subdivisions;
sdparams.objecttoworld = get_transform(b_ob.matrix_world());
mesh->set_subd_dicing_rate(subd_dicing_rate);
mesh->set_subd_max_level(max_subdivisions);
mesh->set_subd_objecttoworld(get_transform(b_ob.matrix_world()));
}
/* Sync */
@@ -955,14 +950,14 @@ static void sync_mesh_cached_velocities(BL::Object &b_ob, Scene *scene, Mesh *me
return;
}
const size_t numverts = mesh->verts.size();
const size_t numverts = mesh->get_verts().size();
if (b_mesh_cache.vertex_velocities.length() != numverts) {
return;
}
/* Find or add attribute */
float3 *P = &mesh->verts[0];
float3 *P = &mesh->get_verts()[0];
Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
if (!attr_mP) {
@@ -996,11 +991,11 @@ static void sync_mesh_fluid_motion(BL::Object &b_ob, Scene *scene, Mesh *mesh)
return;
/* If the mesh has modifiers following the fluid domain we can't export motion. */
if (b_fluid_domain.mesh_vertices.length() != mesh->verts.size())
if (b_fluid_domain.mesh_vertices.length() != mesh->get_verts().size())
return;
/* Find or add attribute */
float3 *P = &mesh->verts[0];
float3 *P = &mesh->get_verts()[0];
Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
if (!attr_mP) {
@@ -1011,7 +1006,7 @@ static void sync_mesh_fluid_motion(BL::Object &b_ob, Scene *scene, Mesh *mesh)
float motion_times[2] = {-1.0f, 1.0f};
for (int step = 0; step < 2; step++) {
float relative_time = motion_times[step] * scene->motion_shutter_time() * 0.5f;
float3 *mP = attr_mP->data_float3() + step * mesh->verts.size();
float3 *mP = attr_mP->data_float3() + step * mesh->get_verts().size();
BL::FluidDomainSettings::mesh_vertices_iterator svi;
int i = 0;
@@ -1023,56 +1018,77 @@ static void sync_mesh_fluid_motion(BL::Object &b_ob, Scene *scene, Mesh *mesh)
}
}
void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Mesh *mesh,
const vector<Shader *> &used_shaders)
void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh)
{
array<int> oldtriangles;
array<Mesh::SubdFace> oldsubd_faces;
array<int> oldsubd_face_corners;
oldtriangles.steal_data(mesh->triangles);
oldsubd_faces.steal_data(mesh->subd_faces);
oldsubd_face_corners.steal_data(mesh->subd_face_corners);
/* make a copy of the shaders as the caller in the main thread still need them for syncing the
* attributes */
array<Node *> used_shaders = mesh->get_used_shaders();
mesh->clear();
mesh->used_shaders = used_shaders;
mesh->subdivision_type = Mesh::SUBDIVISION_NONE;
Mesh new_mesh;
new_mesh.set_used_shaders(used_shaders);
if (view_layer.use_surfaces) {
/* Adaptive subdivision setup. Not for baking since that requires
* exact mapping to the Blender mesh. */
if (!scene->bake_manager->get_baking()) {
mesh->subdivision_type = object_subdivision_type(b_ob, preview, experimental);
new_mesh.set_subdivision_type(object_subdivision_type(b_ob, preview, experimental));
}
/* For some reason, meshes do not need this... */
bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED);
bool need_undeformed = new_mesh.need_attribute(scene, ATTR_STD_GENERATED);
BL::Mesh b_mesh = object_to_mesh(
b_data, b_ob, b_depsgraph, need_undeformed, mesh->subdivision_type);
b_data, b_ob, b_depsgraph, need_undeformed, new_mesh.get_subdivision_type());
if (b_mesh) {
/* Sync mesh itself. */
if (mesh->subdivision_type != Mesh::SUBDIVISION_NONE)
create_subd_mesh(
scene, mesh, b_ob, b_mesh, mesh->used_shaders, dicing_rate, max_subdivisions);
if (new_mesh.get_subdivision_type() != Mesh::SUBDIVISION_NONE)
create_subd_mesh(scene,
&new_mesh,
b_ob,
b_mesh,
new_mesh.get_used_shaders(),
dicing_rate,
max_subdivisions);
else
create_mesh(scene, mesh, b_mesh, mesh->used_shaders, false);
create_mesh(scene, &new_mesh, b_mesh, new_mesh.get_used_shaders(), false);
free_object_to_mesh(b_data, b_ob, b_mesh);
}
}
/* cached velocities (e.g. from alembic archive) */
sync_mesh_cached_velocities(b_ob, scene, mesh);
sync_mesh_cached_velocities(b_ob, scene, &new_mesh);
/* mesh fluid motion mantaflow */
sync_mesh_fluid_motion(b_ob, scene, mesh);
sync_mesh_fluid_motion(b_ob, scene, &new_mesh);
/* update original sockets */
for (const SocketType &socket : new_mesh.type->inputs) {
/* Those sockets are updated in sync_object, so do not modify them. */
if (socket.name == "use_motion_blur" || socket.name == "motion_steps" ||
socket.name == "used_shaders") {
continue;
}
mesh->set_value(socket, new_mesh, socket);
}
foreach (Attribute &attr, new_mesh.attributes.attributes) {
mesh->attributes.attributes.push_back(std::move(attr));
}
foreach (Attribute &attr, new_mesh.subd_attributes.attributes) {
mesh->subd_attributes.attributes.push_back(std::move(attr));
}
mesh->set_num_subd_faces(new_mesh.get_num_subd_faces());
/* tag update */
bool rebuild = (oldtriangles != mesh->triangles) || (oldsubd_faces != mesh->subd_faces) ||
(oldsubd_face_corners != mesh->subd_face_corners);
bool rebuild = (mesh->triangles_is_modified()) || (mesh->subd_num_corners_is_modified()) ||
(mesh->subd_shader_is_modified()) || (mesh->subd_smooth_is_modified()) ||
(mesh->subd_ptex_offset_is_modified()) ||
(mesh->subd_start_corner_is_modified()) ||
(mesh->subd_face_corners_is_modified());
mesh->tag_update(scene, rebuild);
}
@@ -1095,7 +1111,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
}
/* Skip if no vertices were exported. */
size_t numverts = mesh->verts.size();
size_t numverts = mesh->get_verts().size();
if (numverts == 0) {
return;
}
@@ -1140,7 +1156,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
if (new_attribute) {
/* In case of new attribute, we verify if there really was any motion. */
if (b_mesh.vertices.length() != numverts ||
memcmp(mP, &mesh->verts[0], sizeof(float3) * numverts) == 0) {
memcmp(mP, &mesh->get_verts()[0], sizeof(float3) * numverts) == 0) {
/* no motion, remove attributes again */
if (b_mesh.vertices.length() != numverts) {
VLOG(1) << "Topology differs, disabling motion blur for object " << b_ob.name();
@@ -1156,7 +1172,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
VLOG(1) << "Filling deformation motion for object " << b_ob.name();
/* motion, fill up previous steps that we might have skipped because
* they had no motion, but we need them anyway now */
float3 *P = &mesh->verts[0];
float3 *P = &mesh->get_verts()[0];
float3 *N = (attr_N) ? attr_N->data_float3() : NULL;
for (int step = 0; step < motion_step; step++) {
memcpy(attr_mP->data_float3() + step * numverts, P, sizeof(float3) * numverts);
@@ -1169,7 +1185,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
if (b_mesh.vertices.length() != numverts) {
VLOG(1) << "Topology differs, discarding motion blur for object " << b_ob.name()
<< " at time " << motion_step;
memcpy(mP, &mesh->verts[0], sizeof(float3) * numverts);
memcpy(mP, &mesh->get_verts()[0], sizeof(float3) * numverts);
if (mN != NULL) {
memcpy(mN, attr_N->data_float3(), sizeof(float3) * numverts);
}

View File

@@ -199,11 +199,13 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* Set transform at matching motion time step. */
int time_index = object->motion_step(motion_time);
if (time_index >= 0) {
object->motion[time_index] = tfm;
array<Transform> motion = object->get_motion();
motion[time_index] = tfm;
object->set_motion(motion);
}
/* mesh deformation */
if (object->geometry)
if (object->get_geometry())
sync_geometry_motion(b_depsgraph,
b_ob_instance,
object,
@@ -218,45 +220,40 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* test if we need to sync */
bool object_updated = false;
if (object_map.add_or_update(scene, &object, b_ob, b_parent, key))
if (object_map.add_or_update(&object, b_ob, b_parent, key))
object_updated = true;
/* mesh sync */
/* b_ob is owned by the iterator and will go out of scope at the end of the block.
* b_ob_instance is the original object and will remain valid for deferred geometry
* sync. */
object->geometry = sync_geometry(b_depsgraph,
b_ob_instance,
b_ob_instance,
object_updated,
use_particle_hair,
object_geom_task_pool);
Geometry *geometry = sync_geometry(b_depsgraph,
b_ob_instance,
b_ob_instance,
object_updated,
use_particle_hair,
object_geom_task_pool);
object->set_geometry(geometry);
/* special case not tracked by object update flags */
/* holdout */
if (use_holdout != object->use_holdout) {
object->use_holdout = use_holdout;
scene->object_manager->tag_update(scene);
if (sync_object_attributes(b_instance, object)) {
object_updated = true;
}
if (visibility != object->visibility) {
object->visibility = visibility;
object_updated = true;
/* holdout */
object->set_use_holdout(use_holdout);
if (object->use_holdout_is_modified()) {
scene->object_manager->tag_update(scene);
}
object->set_visibility(visibility);
bool is_shadow_catcher = get_boolean(cobject, "is_shadow_catcher");
if (is_shadow_catcher != object->is_shadow_catcher) {
object->is_shadow_catcher = is_shadow_catcher;
object_updated = true;
}
object->set_is_shadow_catcher(is_shadow_catcher);
float shadow_terminator_offset = get_float(cobject, "shadow_terminator_offset");
if (shadow_terminator_offset != object->shadow_terminator_offset) {
object->shadow_terminator_offset = shadow_terminator_offset;
object_updated = true;
}
object->set_shadow_terminator_offset(shadow_terminator_offset);
/* sync the asset name for Cryptomatte */
BL::Object parent = b_ob.parent();
@@ -270,48 +267,49 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
else {
parent_name = b_ob.name();
}
if (object->asset_name != parent_name) {
object->asset_name = parent_name;
object_updated = true;
}
object->set_asset_name(parent_name);
/* object sync
* transform comparison should not be needed, but duplis don't work perfect
* in the depsgraph and may not signal changes, so this is a workaround */
if (object_updated || (object->geometry && object->geometry->need_update) ||
tfm != object->tfm) {
if (object->is_modified() || object_updated ||
(object->get_geometry() && object->get_geometry()->is_modified()) ||
tfm != object->get_tfm()) {
object->name = b_ob.name().c_str();
object->pass_id = b_ob.pass_index();
object->color = get_float3(b_ob.color());
object->tfm = tfm;
object->motion.clear();
object->set_pass_id(b_ob.pass_index());
object->set_color(get_float3(b_ob.color()));
object->set_tfm(tfm);
array<Transform> motion;
object->set_motion(motion);
/* motion blur */
Scene::MotionType need_motion = scene->need_motion();
if (need_motion != Scene::MOTION_NONE && object->geometry) {
Geometry *geom = object->geometry;
geom->use_motion_blur = false;
geom->motion_steps = 0;
if (need_motion != Scene::MOTION_NONE && object->get_geometry()) {
Geometry *geom = object->get_geometry();
geom->set_use_motion_blur(false);
geom->set_motion_steps(0);
uint motion_steps;
if (need_motion == Scene::MOTION_BLUR) {
motion_steps = object_motion_steps(b_parent, b_ob, Object::MAX_MOTION_STEPS);
geom->motion_steps = motion_steps;
geom->set_motion_steps(motion_steps);
if (motion_steps && object_use_deform_motion(b_parent, b_ob)) {
geom->use_motion_blur = true;
geom->set_use_motion_blur(true);
}
}
else {
motion_steps = 3;
geom->motion_steps = motion_steps;
geom->set_motion_steps(motion_steps);
}
object->motion.clear();
object->motion.resize(motion_steps, transform_empty());
motion.resize(motion_steps, transform_empty());
if (motion_steps) {
object->motion[motion_steps / 2] = tfm;
motion[motion_steps / 2] = tfm;
/* update motion socket before trying to access object->motion_time */
object->set_motion(motion);
for (size_t step = 0; step < motion_steps; step++) {
motion_times.insert(object->motion_time(step));
@@ -321,15 +319,15 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* dupli texture coordinates and random_id */
if (is_instance) {
object->dupli_generated = 0.5f * get_float3(b_instance.orco()) -
make_float3(0.5f, 0.5f, 0.5f);
object->dupli_uv = get_float2(b_instance.uv());
object->random_id = b_instance.random_id();
object->set_dupli_generated(0.5f * get_float3(b_instance.orco()) -
make_float3(0.5f, 0.5f, 0.5f));
object->set_dupli_uv(get_float2(b_instance.uv()));
object->set_random_id(b_instance.random_id());
}
else {
object->dupli_generated = make_float3(0.0f, 0.0f, 0.0f);
object->dupli_uv = make_float2(0.0f, 0.0f);
object->random_id = hash_uint2(hash_string(object->name.c_str()), 0);
object->set_dupli_generated(make_float3(0.0f, 0.0f, 0.0f));
object->set_dupli_uv(make_float2(0.0f, 0.0f));
object->set_random_id(hash_uint2(hash_string(object->name.c_str()), 0));
}
object->tag_update(scene);
@@ -343,6 +341,132 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
return object;
}
/* This function mirrors drw_uniform_property_lookup in draw_instance_data.cpp */
static bool lookup_property(BL::ID b_id, const string &name, float4 *r_value)
{
PointerRNA ptr;
PropertyRNA *prop;
if (!RNA_path_resolve(&b_id.ptr, name.c_str(), &ptr, &prop)) {
return false;
}
PropertyType type = RNA_property_type(prop);
int arraylen = RNA_property_array_length(&ptr, prop);
if (arraylen == 0) {
float value;
if (type == PROP_FLOAT)
value = RNA_property_float_get(&ptr, prop);
else if (type == PROP_INT)
value = RNA_property_int_get(&ptr, prop);
else
return false;
*r_value = make_float4(value, value, value, 1.0f);
return true;
}
else if (type == PROP_FLOAT && arraylen <= 4) {
*r_value = make_float4(0.0f, 0.0f, 0.0f, 1.0f);
RNA_property_float_get_array(&ptr, prop, &r_value->x);
return true;
}
return false;
}
/* This function mirrors drw_uniform_attribute_lookup in draw_instance_data.cpp */
static float4 lookup_instance_property(BL::DepsgraphObjectInstance &b_instance,
const string &name,
bool use_instancer)
{
string idprop_name = string_printf("[\"%s\"]", name.c_str());
float4 value;
/* If requesting instance data, check the parent particle system and object. */
if (use_instancer && b_instance.is_instance()) {
BL::ParticleSystem b_psys = b_instance.particle_system();
if (b_psys) {
if (lookup_property(b_psys.settings(), idprop_name, &value) ||
lookup_property(b_psys.settings(), name, &value)) {
return value;
}
}
if (lookup_property(b_instance.parent(), idprop_name, &value) ||
lookup_property(b_instance.parent(), name, &value)) {
return value;
}
}
/* Check the object and mesh. */
BL::Object b_ob = b_instance.object();
BL::ID b_data = b_ob.data();
if (lookup_property(b_ob, idprop_name, &value) || lookup_property(b_ob, name, &value) ||
lookup_property(b_data, idprop_name, &value) || lookup_property(b_data, name, &value)) {
return value;
}
return make_float4(0.0f);
}
bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance, Object *object)
{
/* Find which attributes are needed. */
AttributeRequestSet requests = object->get_geometry()->needed_attributes();
/* Delete attributes that became unnecessary. */
vector<ParamValue> &attributes = object->attributes;
bool changed = false;
for (int i = attributes.size() - 1; i >= 0; i--) {
if (!requests.find(attributes[i].name())) {
attributes.erase(attributes.begin() + i);
changed = true;
}
}
/* Update attribute values. */
foreach (AttributeRequest &req, requests.requests) {
ustring name = req.name;
std::string real_name;
BlenderAttributeType type = blender_attribute_name_split_type(name, &real_name);
if (type != BL::ShaderNodeAttribute::attribute_type_GEOMETRY) {
bool use_instancer = (type == BL::ShaderNodeAttribute::attribute_type_INSTANCER);
float4 value = lookup_instance_property(b_instance, real_name, use_instancer);
/* Try finding the existing attribute value. */
ParamValue *param = NULL;
for (size_t i = 0; i < attributes.size(); i++) {
if (attributes[i].name() == name) {
param = &attributes[i];
break;
}
}
/* Replace or add the value. */
ParamValue new_param(name, TypeDesc::TypeFloat4, 1, &value);
assert(new_param.datasize() == sizeof(value));
if (!param) {
changed = true;
attributes.push_back(new_param);
}
else if (memcmp(param->data(), &value, sizeof(value)) != 0) {
changed = true;
*param = new_param;
}
}
}
return changed;
}
/* Object Loop */
void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
@@ -435,10 +559,10 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
sync_background_light(b_v3d, use_portal);
/* handle removed data and modified pointers */
light_map.post_sync(scene);
geometry_map.post_sync(scene);
object_map.post_sync(scene);
particle_system_map.post_sync(scene);
light_map.post_sync();
geometry_map.post_sync();
object_map.post_sync();
particle_system_map.post_sync();
}
if (motion)
@@ -461,20 +585,18 @@ void BlenderSync::sync_motion(BL::RenderSettings &b_render,
if (b_override)
b_cam = b_override;
Camera prevcam = *(scene->camera);
int frame_center = b_scene.frame_current();
float subframe_center = b_scene.frame_subframe();
float frame_center_delta = 0.0f;
if (scene->need_motion() != Scene::MOTION_PASS &&
scene->camera->motion_position != Camera::MOTION_POSITION_CENTER) {
float shuttertime = scene->camera->shuttertime;
if (scene->camera->motion_position == Camera::MOTION_POSITION_END) {
scene->camera->get_motion_position() != Camera::MOTION_POSITION_CENTER) {
float shuttertime = scene->camera->get_shuttertime();
if (scene->camera->get_motion_position() == Camera::MOTION_POSITION_END) {
frame_center_delta = -shuttertime * 0.5f;
}
else {
assert(scene->camera->motion_position == Camera::MOTION_POSITION_START);
assert(scene->camera->get_motion_position() == Camera::MOTION_POSITION_START);
frame_center_delta = shuttertime * 0.5f;
}
@@ -535,10 +657,6 @@ void BlenderSync::sync_motion(BL::RenderSettings &b_render,
python_thread_state_restore(python_thread_state);
b_engine.frame_set(frame_center, subframe_center);
python_thread_state_save(python_thread_state);
/* tag camera for motion update */
if (scene->camera->motion_modified(prevcam))
scene->camera->tag_update();
}
CCL_NAMESPACE_END

View File

@@ -34,10 +34,10 @@ BlenderObjectCulling::BlenderObjectCulling(Scene *scene, BL::Scene &b_scene)
if (b_scene.render().use_simplify()) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
use_scene_camera_cull_ = scene->camera->type != CAMERA_PANORAMA &&
use_scene_camera_cull_ = scene->camera->get_camera_type() != CAMERA_PANORAMA &&
!b_scene.render().use_multiview() &&
get_boolean(cscene, "use_camera_cull");
use_scene_distance_cull_ = scene->camera->type != CAMERA_PANORAMA &&
use_scene_distance_cull_ = scene->camera->get_camera_type() != CAMERA_PANORAMA &&
!b_scene.render().use_multiview() &&
get_boolean(cscene, "use_distance_cull");
@@ -123,7 +123,7 @@ bool BlenderObjectCulling::test_camera(Scene *scene, float3 bb[8])
bool BlenderObjectCulling::test_distance(Scene *scene, float3 bb[8])
{
float3 camera_position = transform_get_column(&scene->camera->matrix, 3);
float3 camera_position = transform_get_column(&scene->camera->get_matrix(), 3);
float3 bb_min = make_float3(FLT_MAX, FLT_MAX, FLT_MAX),
bb_max = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX);

View File

@@ -36,10 +36,10 @@ bool BlenderSync::sync_dupli_particle(BL::Object &b_ob,
if (!b_psys)
return false;
object->hide_on_missing_motion = true;
object->set_hide_on_missing_motion(true);
/* test if we need particle data */
if (!object->geometry->need_attribute(scene, ATTR_STD_PARTICLE))
if (!object->get_geometry()->need_attribute(scene, ATTR_STD_PARTICLE))
return false;
/* don't handle child particles yet */
@@ -53,11 +53,11 @@ bool BlenderSync::sync_dupli_particle(BL::Object &b_ob,
ParticleSystem *psys;
bool first_use = !particle_system_map.is_used(key);
bool need_update = particle_system_map.add_or_update(
scene, &psys, b_ob, b_instance.object(), key);
bool need_update = particle_system_map.add_or_update(&psys, b_ob, b_instance.object(), key);
/* no update needed? */
if (!need_update && !object->geometry->need_update && !scene->object_manager->need_update)
if (!need_update && !object->get_geometry()->is_modified() &&
!scene->object_manager->need_update)
return true;
/* first time used in this sync loop? clear and tag update */
@@ -81,10 +81,11 @@ bool BlenderSync::sync_dupli_particle(BL::Object &b_ob,
psys->particles.push_back_slow(pa);
if (object->particle_index != psys->particles.size() - 1)
object->set_particle_system(psys);
object->set_particle_index(psys->particles.size() - 1);
if (object->particle_index_is_modified())
scene->object_manager->tag_update(scene);
object->particle_system = psys;
object->particle_index = psys->particles.size() - 1;
/* return that this object has particle data */
return true;

View File

@@ -238,6 +238,7 @@ void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsg
* See note on create_session().
*/
/* sync object should be re-created */
delete sync;
sync = new BlenderSync(b_engine, b_data, b_scene, scene, !background, session->progress);
BL::SpaceView3D b_null_space_view3d(PointerRNA_NULL);
@@ -441,17 +442,17 @@ void BlenderSession::stamp_view_layer_metadata(Scene *scene, const string &view_
}
/* Write cryptomatte metadata. */
if (scene->film->cryptomatte_passes & CRYPT_OBJECT) {
if (scene->film->get_cryptomatte_passes() & CRYPT_OBJECT) {
add_cryptomatte_layer(b_rr,
view_layer_name + ".CryptoObject",
scene->object_manager->get_cryptomatte_objects(scene));
}
if (scene->film->cryptomatte_passes & CRYPT_MATERIAL) {
if (scene->film->get_cryptomatte_passes() & CRYPT_MATERIAL) {
add_cryptomatte_layer(b_rr,
view_layer_name + ".CryptoMaterial",
scene->shader_manager->get_cryptomatte_materials(scene));
}
if (scene->film->cryptomatte_passes & CRYPT_ASSET) {
if (scene->film->get_cryptomatte_passes() & CRYPT_ASSET) {
add_cryptomatte_layer(b_rr,
view_layer_name + ".CryptoAsset",
scene->object_manager->get_cryptomatte_assets(scene));
@@ -472,6 +473,11 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
{
b_depsgraph = b_depsgraph_;
if (session->progress.get_cancel()) {
update_status_progress();
return;
}
/* set callback to write out render results */
session->write_render_tile_cb = function_bind(&BlenderSession::write_render_tile, this, _1);
session->update_render_tile_cb = function_bind(
@@ -502,9 +508,9 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
/* Set buffer params, using film settings from sync_render_passes. */
buffer_params.passes = passes;
buffer_params.denoising_data_pass = scene->film->denoising_data_pass;
buffer_params.denoising_clean_pass = scene->film->denoising_clean_pass;
buffer_params.denoising_prefiltered_pass = scene->film->denoising_prefiltered_pass;
buffer_params.denoising_data_pass = scene->film->get_denoising_data_pass();
buffer_params.denoising_clean_pass = scene->film->get_denoising_clean_pass();
buffer_params.denoising_prefiltered_pass = scene->film->get_denoising_prefiltered_pass();
BL::RenderResult::views_iterator b_view_iter;
@@ -541,8 +547,9 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
/* Make sure all views have different noise patterns. - hardcoded value just to make it random
*/
if (view_index != 0) {
scene->integrator->seed += hash_uint2(scene->integrator->seed,
hash_uint2(view_index * 0xdeadbeef, 0));
int seed = scene->integrator->get_seed();
seed += hash_uint2(seed, hash_uint2(view_index * 0xdeadbeef, 0));
scene->integrator->set_seed(seed);
scene->integrator->tag_update(scene);
}
@@ -714,7 +721,7 @@ void BlenderSession::do_write_update_render_result(BL::RenderLayer &b_rlay,
if (!buffers->copy_from_device())
return;
float exposure = scene->film->exposure;
float exposure = scene->film->get_exposure();
vector<float> pixels(rtile.w * rtile.h * 4);
@@ -831,10 +838,7 @@ void BlenderSession::synchronize(BL::Depsgraph &b_depsgraph_)
session->set_denoising(session_params.denoising);
/* Update film if denoising data was enabled or disabled. */
if (scene->film->denoising_data_pass != buffer_params.denoising_data_pass) {
scene->film->denoising_data_pass = buffer_params.denoising_data_pass;
scene->film->tag_update(scene);
}
scene->film->set_denoising_data_pass(buffer_params.denoising_data_pass);
/* reset if needed */
if (scene->need_reset()) {
@@ -893,7 +897,7 @@ bool BlenderSession::draw(int w, int h)
sync->sync_view(b_v3d, b_rv3d, width, height);
if (scene->camera->need_update)
if (scene->camera->is_modified())
reset = true;
session->scene->mutex.unlock();
@@ -1108,8 +1112,11 @@ void BlenderSession::update_resumable_tile_manager(int num_samples)
VLOG(1) << "Samples range start is " << range_start_sample << ", "
<< "number of samples to render is " << range_num_samples;
scene->integrator->start_sample = rounded_range_start_sample;
scene->integrator->tag_update(scene);
scene->integrator->set_start_sample(rounded_range_start_sample);
if (scene->integrator->is_modified()) {
scene->integrator->tag_update(scene);
}
session->tile_manager.range_start_sample = rounded_range_start_sample;
session->tile_manager.range_num_samples = rounded_range_num_samples;

View File

@@ -42,11 +42,11 @@ typedef map<string, ConvertNode *> ProxyMap;
/* Find */
void BlenderSync::find_shader(BL::ID &id, vector<Shader *> &used_shaders, Shader *default_shader)
void BlenderSync::find_shader(BL::ID &id, array<Node *> &used_shaders, Shader *default_shader)
{
Shader *shader = (id) ? shader_map.find(id) : default_shader;
used_shaders.push_back(shader);
used_shaders.push_back_slow(shader);
shader->tag_used(scene);
}
@@ -97,6 +97,53 @@ static ImageAlphaType get_image_alpha_type(BL::Image &b_image)
return (ImageAlphaType)validate_enum_value(value, IMAGE_ALPHA_NUM_TYPES, IMAGE_ALPHA_AUTO);
}
/* Attribute name translation utilities */
/* Since Eevee needs to know whether the attribute is uniform or varying
* at the time it compiles the shader for the material, Blender had to
* introduce different namespaces (types) in its attribute node. However,
* Cycles already has object attributes that form a uniform namespace with
* the more common varying attributes. Without completely reworking the
* attribute handling in Cycles to introduce separate namespaces (this could
* be especially hard for OSL which directly uses the name string), the
* space identifier has to be added to the attribute name as a prefix.
*
* The prefixes include a control character to ensure the user specified
* name can't accidentally include a special prefix.
*/
static const string_view object_attr_prefix("\x01object:");
static const string_view instancer_attr_prefix("\x01instancer:");
static ustring blender_attribute_name_add_type(const string &name, BlenderAttributeType type)
{
switch (type) {
case BL::ShaderNodeAttribute::attribute_type_OBJECT:
return ustring::concat(object_attr_prefix, name);
case BL::ShaderNodeAttribute::attribute_type_INSTANCER:
return ustring::concat(instancer_attr_prefix, name);
default:
return ustring(name);
}
}
BlenderAttributeType blender_attribute_name_split_type(ustring name, string *r_real_name)
{
string_view sname(name);
if (sname.substr(0, object_attr_prefix.size()) == object_attr_prefix) {
*r_real_name = sname.substr(object_attr_prefix.size());
return BL::ShaderNodeAttribute::attribute_type_OBJECT;
}
if (sname.substr(0, instancer_attr_prefix.size()) == instancer_attr_prefix) {
*r_real_name = sname.substr(instancer_attr_prefix.size());
return BL::ShaderNodeAttribute::attribute_type_INSTANCER;
}
return BL::ShaderNodeAttribute::attribute_type_GEOMETRY;
}
/* Graph */
static BL::NodeSocket get_node_output(BL::Node &b_node, const string &name)
@@ -194,19 +241,19 @@ static void set_default_value(ShaderInput *input,
}
}
static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping &b_mapping)
static void get_tex_mapping(TextureNode *mapping, BL::TexMapping &b_mapping)
{
if (!b_mapping)
return;
mapping->translation = get_float3(b_mapping.translation());
mapping->rotation = get_float3(b_mapping.rotation());
mapping->scale = get_float3(b_mapping.scale());
mapping->type = (TextureMapping::Type)b_mapping.vector_type();
mapping->set_tex_mapping_translation(get_float3(b_mapping.translation()));
mapping->set_tex_mapping_rotation(get_float3(b_mapping.rotation()));
mapping->set_tex_mapping_scale(get_float3(b_mapping.scale()));
mapping->set_tex_mapping_type((TextureMapping::Type)b_mapping.vector_type());
mapping->x_mapping = (TextureMapping::Mapping)b_mapping.mapping_x();
mapping->y_mapping = (TextureMapping::Mapping)b_mapping.mapping_y();
mapping->z_mapping = (TextureMapping::Mapping)b_mapping.mapping_z();
mapping->set_tex_mapping_x_mapping((TextureMapping::Mapping)b_mapping.mapping_x());
mapping->set_tex_mapping_y_mapping((TextureMapping::Mapping)b_mapping.mapping_y());
mapping->set_tex_mapping_z_mapping((TextureMapping::Mapping)b_mapping.mapping_z());
}
static ShaderNode *add_node(Scene *scene,
@@ -225,34 +272,48 @@ static ShaderNode *add_node(Scene *scene,
BL::ShaderNodeRGBCurve b_curve_node(b_node);
BL::CurveMapping mapping(b_curve_node.mapping());
RGBCurvesNode *curves = graph->create_node<RGBCurvesNode>();
curvemapping_color_to_array(mapping, curves->curves, RAMP_TABLE_SIZE, true);
curvemapping_minmax(mapping, true, &curves->min_x, &curves->max_x);
array<float3> curve_mapping_curves;
float min_x, max_x;
curvemapping_color_to_array(mapping, curve_mapping_curves, RAMP_TABLE_SIZE, true);
curvemapping_minmax(mapping, true, &min_x, &max_x);
curves->set_min_x(min_x);
curves->set_max_x(max_x);
curves->set_curves(curve_mapping_curves);
node = curves;
}
if (b_node.is_a(&RNA_ShaderNodeVectorCurve)) {
BL::ShaderNodeVectorCurve b_curve_node(b_node);
BL::CurveMapping mapping(b_curve_node.mapping());
VectorCurvesNode *curves = graph->create_node<VectorCurvesNode>();
curvemapping_color_to_array(mapping, curves->curves, RAMP_TABLE_SIZE, false);
curvemapping_minmax(mapping, false, &curves->min_x, &curves->max_x);
array<float3> curve_mapping_curves;
float min_x, max_x;
curvemapping_color_to_array(mapping, curve_mapping_curves, RAMP_TABLE_SIZE, false);
curvemapping_minmax(mapping, false, &min_x, &max_x);
curves->set_min_x(min_x);
curves->set_max_x(max_x);
curves->set_curves(curve_mapping_curves);
node = curves;
}
else if (b_node.is_a(&RNA_ShaderNodeValToRGB)) {
RGBRampNode *ramp = graph->create_node<RGBRampNode>();
BL::ShaderNodeValToRGB b_ramp_node(b_node);
BL::ColorRamp b_color_ramp(b_ramp_node.color_ramp());
colorramp_to_array(b_color_ramp, ramp->ramp, ramp->ramp_alpha, RAMP_TABLE_SIZE);
ramp->interpolate = b_color_ramp.interpolation() != BL::ColorRamp::interpolation_CONSTANT;
array<float3> ramp_values;
array<float> ramp_alpha;
colorramp_to_array(b_color_ramp, ramp_values, ramp_alpha, RAMP_TABLE_SIZE);
ramp->set_ramp(ramp_values);
ramp->set_ramp_alpha(ramp_alpha);
ramp->set_interpolate(b_color_ramp.interpolation() != BL::ColorRamp::interpolation_CONSTANT);
node = ramp;
}
else if (b_node.is_a(&RNA_ShaderNodeRGB)) {
ColorNode *color = graph->create_node<ColorNode>();
color->value = get_node_output_rgba(b_node, "Color");
color->set_value(get_node_output_rgba(b_node, "Color"));
node = color;
}
else if (b_node.is_a(&RNA_ShaderNodeValue)) {
ValueNode *value = graph->create_node<ValueNode>();
value->value = get_node_output_value(b_node, "Value");
value->set_value(get_node_output_value(b_node, "Value"));
node = value;
}
else if (b_node.is_a(&RNA_ShaderNodeCameraData)) {
@@ -270,8 +331,8 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeMixRGB)) {
BL::ShaderNodeMixRGB b_mix_node(b_node);
MixNode *mix = graph->create_node<MixNode>();
mix->type = (NodeMix)b_mix_node.blend_type();
mix->use_clamp = b_mix_node.use_clamp();
mix->set_mix_type((NodeMix)b_mix_node.blend_type());
mix->set_use_clamp(b_mix_node.use_clamp());
node = mix;
}
else if (b_node.is_a(&RNA_ShaderNodeSeparateRGB)) {
@@ -301,43 +362,45 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeMapRange)) {
BL::ShaderNodeMapRange b_map_range_node(b_node);
MapRangeNode *map_range_node = graph->create_node<MapRangeNode>();
map_range_node->clamp = b_map_range_node.clamp();
map_range_node->type = (NodeMapRangeType)b_map_range_node.interpolation_type();
map_range_node->set_clamp(b_map_range_node.clamp());
map_range_node->set_range_type((NodeMapRangeType)b_map_range_node.interpolation_type());
node = map_range_node;
}
else if (b_node.is_a(&RNA_ShaderNodeClamp)) {
BL::ShaderNodeClamp b_clamp_node(b_node);
ClampNode *clamp_node = graph->create_node<ClampNode>();
clamp_node->type = (NodeClampType)b_clamp_node.clamp_type();
clamp_node->set_clamp_type((NodeClampType)b_clamp_node.clamp_type());
node = clamp_node;
}
else if (b_node.is_a(&RNA_ShaderNodeMath)) {
BL::ShaderNodeMath b_math_node(b_node);
MathNode *math_node = graph->create_node<MathNode>();
math_node->type = (NodeMathType)b_math_node.operation();
math_node->use_clamp = b_math_node.use_clamp();
math_node->set_math_type((NodeMathType)b_math_node.operation());
math_node->set_use_clamp(b_math_node.use_clamp());
node = math_node;
}
else if (b_node.is_a(&RNA_ShaderNodeVectorMath)) {
BL::ShaderNodeVectorMath b_vector_math_node(b_node);
VectorMathNode *vector_math_node = graph->create_node<VectorMathNode>();
vector_math_node->type = (NodeVectorMathType)b_vector_math_node.operation();
vector_math_node->set_math_type((NodeVectorMathType)b_vector_math_node.operation());
node = vector_math_node;
}
else if (b_node.is_a(&RNA_ShaderNodeVectorRotate)) {
BL::ShaderNodeVectorRotate b_vector_rotate_node(b_node);
VectorRotateNode *vector_rotate_node = graph->create_node<VectorRotateNode>();
vector_rotate_node->type = (NodeVectorRotateType)b_vector_rotate_node.rotation_type();
vector_rotate_node->invert = b_vector_rotate_node.invert();
vector_rotate_node->set_rotate_type(
(NodeVectorRotateType)b_vector_rotate_node.rotation_type());
vector_rotate_node->set_invert(b_vector_rotate_node.invert());
node = vector_rotate_node;
}
else if (b_node.is_a(&RNA_ShaderNodeVectorTransform)) {
BL::ShaderNodeVectorTransform b_vector_transform_node(b_node);
VectorTransformNode *vtransform = graph->create_node<VectorTransformNode>();
vtransform->type = (NodeVectorTransformType)b_vector_transform_node.vector_type();
vtransform->convert_from = (NodeVectorTransformConvertSpace)
b_vector_transform_node.convert_from();
vtransform->convert_to = (NodeVectorTransformConvertSpace)b_vector_transform_node.convert_to();
vtransform->set_transform_type((NodeVectorTransformType)b_vector_transform_node.vector_type());
vtransform->set_convert_from(
(NodeVectorTransformConvertSpace)b_vector_transform_node.convert_from());
vtransform->set_convert_to(
(NodeVectorTransformConvertSpace)b_vector_transform_node.convert_to());
node = vtransform;
}
else if (b_node.is_a(&RNA_ShaderNodeNormal)) {
@@ -345,13 +408,13 @@ static ShaderNode *add_node(Scene *scene,
b_node.outputs.begin(out_it);
NormalNode *norm = graph->create_node<NormalNode>();
norm->direction = get_node_output_vector(b_node, "Normal");
norm->set_direction(get_node_output_vector(b_node, "Normal"));
node = norm;
}
else if (b_node.is_a(&RNA_ShaderNodeMapping)) {
BL::ShaderNodeMapping b_mapping_node(b_node);
MappingNode *mapping = graph->create_node<MappingNode>();
mapping->type = (NodeMappingType)b_mapping_node.vector_type();
mapping->set_mapping_type((NodeMappingType)b_mapping_node.vector_type());
node = mapping;
}
else if (b_node.is_a(&RNA_ShaderNodeFresnel)) {
@@ -369,7 +432,8 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeAttribute)) {
BL::ShaderNodeAttribute b_attr_node(b_node);
AttributeNode *attr = graph->create_node<AttributeNode>();
attr->attribute = b_attr_node.attribute_name();
attr->set_attribute(blender_attribute_name_add_type(b_attr_node.attribute_name(),
b_attr_node.attribute_type()));
node = attr;
}
else if (b_node.is_a(&RNA_ShaderNodeBackground)) {
@@ -384,16 +448,16 @@ static ShaderNode *add_node(Scene *scene,
switch (b_aniso_node.distribution()) {
case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN:
aniso->distribution = CLOSURE_BSDF_MICROFACET_BECKMANN_ID;
aniso->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_ID);
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_GGX:
aniso->distribution = CLOSURE_BSDF_MICROFACET_GGX_ID;
aniso->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_ID);
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_MULTI_GGX:
aniso->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID;
aniso->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID);
break;
case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY:
aniso->distribution = CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID;
aniso->set_distribution(CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID);
break;
}
@@ -409,16 +473,16 @@ static ShaderNode *add_node(Scene *scene,
switch (b_subsurface_node.falloff()) {
case BL::ShaderNodeSubsurfaceScattering::falloff_CUBIC:
subsurface->falloff = CLOSURE_BSSRDF_CUBIC_ID;
subsurface->set_falloff(CLOSURE_BSSRDF_CUBIC_ID);
break;
case BL::ShaderNodeSubsurfaceScattering::falloff_GAUSSIAN:
subsurface->falloff = CLOSURE_BSSRDF_GAUSSIAN_ID;
subsurface->set_falloff(CLOSURE_BSSRDF_GAUSSIAN_ID);
break;
case BL::ShaderNodeSubsurfaceScattering::falloff_BURLEY:
subsurface->falloff = CLOSURE_BSSRDF_BURLEY_ID;
subsurface->set_falloff(CLOSURE_BSSRDF_BURLEY_ID);
break;
case BL::ShaderNodeSubsurfaceScattering::falloff_RANDOM_WALK:
subsurface->falloff = CLOSURE_BSSRDF_RANDOM_WALK_ID;
subsurface->set_falloff(CLOSURE_BSSRDF_RANDOM_WALK_ID);
break;
}
@@ -430,19 +494,19 @@ static ShaderNode *add_node(Scene *scene,
switch (b_glossy_node.distribution()) {
case BL::ShaderNodeBsdfGlossy::distribution_SHARP:
glossy->distribution = CLOSURE_BSDF_REFLECTION_ID;
glossy->set_distribution(CLOSURE_BSDF_REFLECTION_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_BECKMANN:
glossy->distribution = CLOSURE_BSDF_MICROFACET_BECKMANN_ID;
glossy->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_GGX:
glossy->distribution = CLOSURE_BSDF_MICROFACET_GGX_ID;
glossy->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_ASHIKHMIN_SHIRLEY:
glossy->distribution = CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID;
glossy->set_distribution(CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID);
break;
case BL::ShaderNodeBsdfGlossy::distribution_MULTI_GGX:
glossy->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID;
glossy->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID);
break;
}
node = glossy;
@@ -452,16 +516,16 @@ static ShaderNode *add_node(Scene *scene,
GlassBsdfNode *glass = graph->create_node<GlassBsdfNode>();
switch (b_glass_node.distribution()) {
case BL::ShaderNodeBsdfGlass::distribution_SHARP:
glass->distribution = CLOSURE_BSDF_SHARP_GLASS_ID;
glass->set_distribution(CLOSURE_BSDF_SHARP_GLASS_ID);
break;
case BL::ShaderNodeBsdfGlass::distribution_BECKMANN:
glass->distribution = CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID;
glass->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID);
break;
case BL::ShaderNodeBsdfGlass::distribution_GGX:
glass->distribution = CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID;
glass->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID);
break;
case BL::ShaderNodeBsdfGlass::distribution_MULTI_GGX:
glass->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID;
glass->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID);
break;
}
node = glass;
@@ -471,13 +535,13 @@ static ShaderNode *add_node(Scene *scene,
RefractionBsdfNode *refraction = graph->create_node<RefractionBsdfNode>();
switch (b_refraction_node.distribution()) {
case BL::ShaderNodeBsdfRefraction::distribution_SHARP:
refraction->distribution = CLOSURE_BSDF_REFRACTION_ID;
refraction->set_distribution(CLOSURE_BSDF_REFRACTION_ID);
break;
case BL::ShaderNodeBsdfRefraction::distribution_BECKMANN:
refraction->distribution = CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
refraction->set_distribution(CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID);
break;
case BL::ShaderNodeBsdfRefraction::distribution_GGX:
refraction->distribution = CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
refraction->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID);
break;
}
node = refraction;
@@ -487,10 +551,10 @@ static ShaderNode *add_node(Scene *scene,
ToonBsdfNode *toon = graph->create_node<ToonBsdfNode>();
switch (b_toon_node.component()) {
case BL::ShaderNodeBsdfToon::component_DIFFUSE:
toon->component = CLOSURE_BSDF_DIFFUSE_TOON_ID;
toon->set_component(CLOSURE_BSDF_DIFFUSE_TOON_ID);
break;
case BL::ShaderNodeBsdfToon::component_GLOSSY:
toon->component = CLOSURE_BSDF_GLOSSY_TOON_ID;
toon->set_component(CLOSURE_BSDF_GLOSSY_TOON_ID);
break;
}
node = toon;
@@ -500,10 +564,10 @@ static ShaderNode *add_node(Scene *scene,
HairBsdfNode *hair = graph->create_node<HairBsdfNode>();
switch (b_hair_node.component()) {
case BL::ShaderNodeBsdfHair::component_Reflection:
hair->component = CLOSURE_BSDF_HAIR_REFLECTION_ID;
hair->set_component(CLOSURE_BSDF_HAIR_REFLECTION_ID);
break;
case BL::ShaderNodeBsdfHair::component_Transmission:
hair->component = CLOSURE_BSDF_HAIR_TRANSMISSION_ID;
hair->set_component(CLOSURE_BSDF_HAIR_TRANSMISSION_ID);
break;
}
node = hair;
@@ -511,11 +575,11 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeBsdfHairPrincipled)) {
BL::ShaderNodeBsdfHairPrincipled b_principled_hair_node(b_node);
PrincipledHairBsdfNode *principled_hair = graph->create_node<PrincipledHairBsdfNode>();
principled_hair->parametrization = (NodePrincipledHairParametrization)get_enum(
b_principled_hair_node.ptr,
"parametrization",
NODE_PRINCIPLED_HAIR_NUM,
NODE_PRINCIPLED_HAIR_REFLECTANCE);
principled_hair->set_parametrization(
(NodePrincipledHairParametrization)get_enum(b_principled_hair_node.ptr,
"parametrization",
NODE_PRINCIPLED_HAIR_NUM,
NODE_PRINCIPLED_HAIR_REFLECTANCE));
node = principled_hair;
}
else if (b_node.is_a(&RNA_ShaderNodeBsdfPrincipled)) {
@@ -523,18 +587,18 @@ static ShaderNode *add_node(Scene *scene,
PrincipledBsdfNode *principled = graph->create_node<PrincipledBsdfNode>();
switch (b_principled_node.distribution()) {
case BL::ShaderNodeBsdfPrincipled::distribution_GGX:
principled->distribution = CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID;
principled->set_distribution(CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID);
break;
case BL::ShaderNodeBsdfPrincipled::distribution_MULTI_GGX:
principled->distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID;
principled->set_distribution(CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID);
break;
}
switch (b_principled_node.subsurface_method()) {
case BL::ShaderNodeBsdfPrincipled::subsurface_method_BURLEY:
principled->subsurface_method = CLOSURE_BSSRDF_PRINCIPLED_ID;
principled->set_subsurface_method(CLOSURE_BSSRDF_PRINCIPLED_ID);
break;
case BL::ShaderNodeBsdfPrincipled::subsurface_method_RANDOM_WALK:
principled->subsurface_method = CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID;
principled->set_subsurface_method(CLOSURE_BSSRDF_PRINCIPLED_RANDOM_WALK_ID);
break;
}
node = principled;
@@ -554,9 +618,9 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeAmbientOcclusion)) {
BL::ShaderNodeAmbientOcclusion b_ao_node(b_node);
AmbientOcclusionNode *ao = graph->create_node<AmbientOcclusionNode>();
ao->samples = b_ao_node.samples();
ao->inside = b_ao_node.inside();
ao->only_local = b_ao_node.only_local();
ao->set_samples(b_ao_node.samples());
ao->set_inside(b_ao_node.inside());
ao->set_only_local(b_ao_node.only_local());
node = ao;
}
else if (b_node.is_a(&RNA_ShaderNodeVolumeScatter)) {
@@ -575,7 +639,7 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeWireframe)) {
BL::ShaderNodeWireframe b_wireframe_node(b_node);
WireframeNode *wire = graph->create_node<WireframeNode>();
wire->use_pixel_size = b_wireframe_node.use_pixel_size();
wire->set_use_pixel_size(b_wireframe_node.use_pixel_size());
node = wire;
}
else if (b_node.is_a(&RNA_ShaderNodeWavelength)) {
@@ -605,13 +669,13 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeVertexColor)) {
BL::ShaderNodeVertexColor b_vertex_color_node(b_node);
VertexColorNode *vertex_color_node = graph->create_node<VertexColorNode>();
vertex_color_node->layer_name = b_vertex_color_node.layer_name();
vertex_color_node->set_layer_name(ustring(b_vertex_color_node.layer_name()));
node = vertex_color_node;
}
else if (b_node.is_a(&RNA_ShaderNodeBump)) {
BL::ShaderNodeBump b_bump_node(b_node);
BumpNode *bump = graph->create_node<BumpNode>();
bump->invert = b_bump_node.invert();
bump->set_invert(b_bump_node.invert());
node = bump;
}
else if (b_node.is_a(&RNA_ShaderNodeScript)) {
@@ -644,25 +708,26 @@ static ShaderNode *add_node(Scene *scene,
BL::ImageUser b_image_user(b_image_node.image_user());
ImageTextureNode *image = graph->create_node<ImageTextureNode>();
image->interpolation = get_image_interpolation(b_image_node);
image->extension = get_image_extension(b_image_node);
image->projection = (NodeImageProjection)b_image_node.projection();
image->projection_blend = b_image_node.projection_blend();
image->set_interpolation(get_image_interpolation(b_image_node));
image->set_extension(get_image_extension(b_image_node));
image->set_projection((NodeImageProjection)b_image_node.projection());
image->set_projection_blend(b_image_node.projection_blend());
BL::TexMapping b_texture_mapping(b_image_node.texture_mapping());
get_tex_mapping(&image->tex_mapping, b_texture_mapping);
get_tex_mapping(image, b_texture_mapping);
if (b_image) {
PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr;
image->colorspace = get_enum_identifier(colorspace_ptr, "name");
image->set_colorspace(ustring(get_enum_identifier(colorspace_ptr, "name")));
image->animated = b_image_node.image_user().use_auto_refresh();
image->alpha_type = get_image_alpha_type(b_image);
image->set_animated(b_image_node.image_user().use_auto_refresh());
image->set_alpha_type(get_image_alpha_type(b_image));
image->tiles.clear();
array<int> tiles;
BL::Image::tiles_iterator b_iter;
for (b_image.tiles.begin(b_iter); b_iter != b_image.tiles.end(); ++b_iter) {
image->tiles.push_back(b_iter->number());
tiles.push_back_slow(b_iter->number());
}
image->set_tiles(tiles);
/* builtin images will use callback-based reading because
* they could only be loaded correct from blender side
@@ -684,8 +749,9 @@ static ShaderNode *add_node(Scene *scene,
new BlenderImageLoader(b_image, image_frame), image->image_params());
}
else {
image->filename = image_user_file_path(
b_image_user, b_image, b_scene.frame_current(), true);
ustring filename = ustring(
image_user_file_path(b_image_user, b_image, b_scene.frame_current(), true));
image->set_filename(filename);
}
}
node = image;
@@ -696,17 +762,17 @@ static ShaderNode *add_node(Scene *scene,
BL::ImageUser b_image_user(b_env_node.image_user());
EnvironmentTextureNode *env = graph->create_node<EnvironmentTextureNode>();
env->interpolation = get_image_interpolation(b_env_node);
env->projection = (NodeEnvironmentProjection)b_env_node.projection();
env->set_interpolation(get_image_interpolation(b_env_node));
env->set_projection((NodeEnvironmentProjection)b_env_node.projection());
BL::TexMapping b_texture_mapping(b_env_node.texture_mapping());
get_tex_mapping(&env->tex_mapping, b_texture_mapping);
get_tex_mapping(env, b_texture_mapping);
if (b_image) {
PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr;
env->colorspace = get_enum_identifier(colorspace_ptr, "name");
env->set_colorspace(ustring(get_enum_identifier(colorspace_ptr, "name")));
env->animated = b_env_node.image_user().use_auto_refresh();
env->alpha_type = get_image_alpha_type(b_image);
env->set_animated(b_env_node.image_user().use_auto_refresh());
env->set_alpha_type(get_image_alpha_type(b_image));
bool is_builtin = b_image.packed_file() || b_image.source() == BL::Image::source_GENERATED ||
b_image.source() == BL::Image::source_MOVIE ||
@@ -719,8 +785,8 @@ static ShaderNode *add_node(Scene *scene,
env->image_params());
}
else {
env->filename = image_user_file_path(
b_image_user, b_image, b_scene.frame_current(), false);
env->set_filename(
ustring(image_user_file_path(b_image_user, b_image, b_scene.frame_current(), false)));
}
}
node = env;
@@ -728,103 +794,103 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeTexGradient)) {
BL::ShaderNodeTexGradient b_gradient_node(b_node);
GradientTextureNode *gradient = graph->create_node<GradientTextureNode>();
gradient->type = (NodeGradientType)b_gradient_node.gradient_type();
gradient->set_gradient_type((NodeGradientType)b_gradient_node.gradient_type());
BL::TexMapping b_texture_mapping(b_gradient_node.texture_mapping());
get_tex_mapping(&gradient->tex_mapping, b_texture_mapping);
get_tex_mapping(gradient, b_texture_mapping);
node = gradient;
}
else if (b_node.is_a(&RNA_ShaderNodeTexVoronoi)) {
BL::ShaderNodeTexVoronoi b_voronoi_node(b_node);
VoronoiTextureNode *voronoi = graph->create_node<VoronoiTextureNode>();
voronoi->dimensions = b_voronoi_node.voronoi_dimensions();
voronoi->feature = (NodeVoronoiFeature)b_voronoi_node.feature();
voronoi->metric = (NodeVoronoiDistanceMetric)b_voronoi_node.distance();
voronoi->set_dimensions(b_voronoi_node.voronoi_dimensions());
voronoi->set_feature((NodeVoronoiFeature)b_voronoi_node.feature());
voronoi->set_metric((NodeVoronoiDistanceMetric)b_voronoi_node.distance());
BL::TexMapping b_texture_mapping(b_voronoi_node.texture_mapping());
get_tex_mapping(&voronoi->tex_mapping, b_texture_mapping);
get_tex_mapping(voronoi, b_texture_mapping);
node = voronoi;
}
else if (b_node.is_a(&RNA_ShaderNodeTexMagic)) {
BL::ShaderNodeTexMagic b_magic_node(b_node);
MagicTextureNode *magic = graph->create_node<MagicTextureNode>();
magic->depth = b_magic_node.turbulence_depth();
magic->set_depth(b_magic_node.turbulence_depth());
BL::TexMapping b_texture_mapping(b_magic_node.texture_mapping());
get_tex_mapping(&magic->tex_mapping, b_texture_mapping);
get_tex_mapping(magic, b_texture_mapping);
node = magic;
}
else if (b_node.is_a(&RNA_ShaderNodeTexWave)) {
BL::ShaderNodeTexWave b_wave_node(b_node);
WaveTextureNode *wave = graph->create_node<WaveTextureNode>();
wave->type = (NodeWaveType)b_wave_node.wave_type();
wave->bands_direction = (NodeWaveBandsDirection)b_wave_node.bands_direction();
wave->rings_direction = (NodeWaveRingsDirection)b_wave_node.rings_direction();
wave->profile = (NodeWaveProfile)b_wave_node.wave_profile();
wave->set_wave_type((NodeWaveType)b_wave_node.wave_type());
wave->set_bands_direction((NodeWaveBandsDirection)b_wave_node.bands_direction());
wave->set_rings_direction((NodeWaveRingsDirection)b_wave_node.rings_direction());
wave->set_profile((NodeWaveProfile)b_wave_node.wave_profile());
BL::TexMapping b_texture_mapping(b_wave_node.texture_mapping());
get_tex_mapping(&wave->tex_mapping, b_texture_mapping);
get_tex_mapping(wave, b_texture_mapping);
node = wave;
}
else if (b_node.is_a(&RNA_ShaderNodeTexChecker)) {
BL::ShaderNodeTexChecker b_checker_node(b_node);
CheckerTextureNode *checker = graph->create_node<CheckerTextureNode>();
BL::TexMapping b_texture_mapping(b_checker_node.texture_mapping());
get_tex_mapping(&checker->tex_mapping, b_texture_mapping);
get_tex_mapping(checker, b_texture_mapping);
node = checker;
}
else if (b_node.is_a(&RNA_ShaderNodeTexBrick)) {
BL::ShaderNodeTexBrick b_brick_node(b_node);
BrickTextureNode *brick = graph->create_node<BrickTextureNode>();
brick->offset = b_brick_node.offset();
brick->offset_frequency = b_brick_node.offset_frequency();
brick->squash = b_brick_node.squash();
brick->squash_frequency = b_brick_node.squash_frequency();
brick->set_offset(b_brick_node.offset());
brick->set_offset_frequency(b_brick_node.offset_frequency());
brick->set_squash(b_brick_node.squash());
brick->set_squash_frequency(b_brick_node.squash_frequency());
BL::TexMapping b_texture_mapping(b_brick_node.texture_mapping());
get_tex_mapping(&brick->tex_mapping, b_texture_mapping);
get_tex_mapping(brick, b_texture_mapping);
node = brick;
}
else if (b_node.is_a(&RNA_ShaderNodeTexNoise)) {
BL::ShaderNodeTexNoise b_noise_node(b_node);
NoiseTextureNode *noise = graph->create_node<NoiseTextureNode>();
noise->dimensions = b_noise_node.noise_dimensions();
noise->set_dimensions(b_noise_node.noise_dimensions());
BL::TexMapping b_texture_mapping(b_noise_node.texture_mapping());
get_tex_mapping(&noise->tex_mapping, b_texture_mapping);
get_tex_mapping(noise, b_texture_mapping);
node = noise;
}
else if (b_node.is_a(&RNA_ShaderNodeTexMusgrave)) {
BL::ShaderNodeTexMusgrave b_musgrave_node(b_node);
MusgraveTextureNode *musgrave_node = graph->create_node<MusgraveTextureNode>();
musgrave_node->type = (NodeMusgraveType)b_musgrave_node.musgrave_type();
musgrave_node->dimensions = b_musgrave_node.musgrave_dimensions();
musgrave_node->set_musgrave_type((NodeMusgraveType)b_musgrave_node.musgrave_type());
musgrave_node->set_dimensions(b_musgrave_node.musgrave_dimensions());
BL::TexMapping b_texture_mapping(b_musgrave_node.texture_mapping());
get_tex_mapping(&musgrave_node->tex_mapping, b_texture_mapping);
get_tex_mapping(musgrave_node, b_texture_mapping);
node = musgrave_node;
}
else if (b_node.is_a(&RNA_ShaderNodeTexCoord)) {
BL::ShaderNodeTexCoord b_tex_coord_node(b_node);
TextureCoordinateNode *tex_coord = graph->create_node<TextureCoordinateNode>();
tex_coord->from_dupli = b_tex_coord_node.from_instancer();
tex_coord->set_from_dupli(b_tex_coord_node.from_instancer());
if (b_tex_coord_node.object()) {
tex_coord->use_transform = true;
tex_coord->ob_tfm = get_transform(b_tex_coord_node.object().matrix_world());
tex_coord->set_use_transform(true);
tex_coord->set_ob_tfm(get_transform(b_tex_coord_node.object().matrix_world()));
}
node = tex_coord;
}
else if (b_node.is_a(&RNA_ShaderNodeTexSky)) {
BL::ShaderNodeTexSky b_sky_node(b_node);
SkyTextureNode *sky = graph->create_node<SkyTextureNode>();
sky->type = (NodeSkyType)b_sky_node.sky_type();
sky->sun_direction = normalize(get_float3(b_sky_node.sun_direction()));
sky->turbidity = b_sky_node.turbidity();
sky->ground_albedo = b_sky_node.ground_albedo();
sky->sun_disc = b_sky_node.sun_disc();
sky->sun_size = b_sky_node.sun_size();
sky->sun_intensity = b_sky_node.sun_intensity();
sky->sun_elevation = b_sky_node.sun_elevation();
sky->sun_rotation = b_sky_node.sun_rotation();
sky->altitude = 1000.0f * b_sky_node.altitude();
sky->air_density = b_sky_node.air_density();
sky->dust_density = b_sky_node.dust_density();
sky->ozone_density = b_sky_node.ozone_density();
sky->set_sky_type((NodeSkyType)b_sky_node.sky_type());
sky->set_sun_direction(normalize(get_float3(b_sky_node.sun_direction())));
sky->set_turbidity(b_sky_node.turbidity());
sky->set_ground_albedo(b_sky_node.ground_albedo());
sky->set_sun_disc(b_sky_node.sun_disc());
sky->set_sun_size(b_sky_node.sun_size());
sky->set_sun_intensity(b_sky_node.sun_intensity());
sky->set_sun_elevation(b_sky_node.sun_elevation());
sky->set_sun_rotation(b_sky_node.sun_rotation());
sky->set_altitude(1000.0f * b_sky_node.altitude());
sky->set_air_density(b_sky_node.air_density());
sky->set_dust_density(b_sky_node.dust_density());
sky->set_ozone_density(b_sky_node.ozone_density());
BL::TexMapping b_texture_mapping(b_sky_node.texture_mapping());
get_tex_mapping(&sky->tex_mapping, b_texture_mapping);
get_tex_mapping(sky, b_texture_mapping);
node = sky;
}
else if (b_node.is_a(&RNA_ShaderNodeTexIES)) {
@@ -832,13 +898,14 @@ static ShaderNode *add_node(Scene *scene,
IESLightNode *ies = graph->create_node<IESLightNode>();
switch (b_ies_node.mode()) {
case BL::ShaderNodeTexIES::mode_EXTERNAL:
ies->filename = blender_absolute_path(b_data, b_ntree, b_ies_node.filepath());
ies->set_filename(ustring(blender_absolute_path(b_data, b_ntree, b_ies_node.filepath())));
break;
case BL::ShaderNodeTexIES::mode_INTERNAL:
ies->ies = get_text_datablock_content(b_ies_node.ies().ptr);
if (ies->ies.empty()) {
ies->ies = "\n";
ustring ies_content = ustring(get_text_datablock_content(b_ies_node.ies().ptr));
if (ies_content.empty()) {
ies_content = "\n";
}
ies->set_ies(ies_content);
break;
}
node = ies;
@@ -846,36 +913,36 @@ static ShaderNode *add_node(Scene *scene,
else if (b_node.is_a(&RNA_ShaderNodeTexWhiteNoise)) {
BL::ShaderNodeTexWhiteNoise b_tex_white_noise_node(b_node);
WhiteNoiseTextureNode *white_noise_node = graph->create_node<WhiteNoiseTextureNode>();
white_noise_node->dimensions = b_tex_white_noise_node.noise_dimensions();
white_noise_node->set_dimensions(b_tex_white_noise_node.noise_dimensions());
node = white_noise_node;
}
else if (b_node.is_a(&RNA_ShaderNodeNormalMap)) {
BL::ShaderNodeNormalMap b_normal_map_node(b_node);
NormalMapNode *nmap = graph->create_node<NormalMapNode>();
nmap->space = (NodeNormalMapSpace)b_normal_map_node.space();
nmap->attribute = b_normal_map_node.uv_map();
nmap->set_space((NodeNormalMapSpace)b_normal_map_node.space());
nmap->set_attribute(ustring(b_normal_map_node.uv_map()));
node = nmap;
}
else if (b_node.is_a(&RNA_ShaderNodeTangent)) {
BL::ShaderNodeTangent b_tangent_node(b_node);
TangentNode *tangent = graph->create_node<TangentNode>();
tangent->direction_type = (NodeTangentDirectionType)b_tangent_node.direction_type();
tangent->axis = (NodeTangentAxis)b_tangent_node.axis();
tangent->attribute = b_tangent_node.uv_map();
tangent->set_direction_type((NodeTangentDirectionType)b_tangent_node.direction_type());
tangent->set_axis((NodeTangentAxis)b_tangent_node.axis());
tangent->set_attribute(ustring(b_tangent_node.uv_map()));
node = tangent;
}
else if (b_node.is_a(&RNA_ShaderNodeUVMap)) {
BL::ShaderNodeUVMap b_uvmap_node(b_node);
UVMapNode *uvm = graph->create_node<UVMapNode>();
uvm->attribute = b_uvmap_node.uv_map();
uvm->from_dupli = b_uvmap_node.from_instancer();
uvm->set_attribute(ustring(b_uvmap_node.uv_map()));
uvm->set_from_dupli(b_uvmap_node.from_instancer());
node = uvm;
}
else if (b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
BL::ShaderNodeTexPointDensity b_point_density_node(b_node);
PointDensityTextureNode *point_density = graph->create_node<PointDensityTextureNode>();
point_density->space = (NodeTexVoxelSpace)b_point_density_node.space();
point_density->interpolation = get_image_interpolation(b_point_density_node);
point_density->set_space((NodeTexVoxelSpace)b_point_density_node.space());
point_density->set_interpolation(get_image_interpolation(b_point_density_node));
point_density->handle = scene->image_manager->add_image(
new BlenderPointDensityLoader(b_depsgraph, b_point_density_node),
point_density->image_params());
@@ -892,33 +959,33 @@ static ShaderNode *add_node(Scene *scene,
if (b_ob) {
float3 loc, size;
point_density_texture_space(b_depsgraph, b_point_density_node, loc, size);
point_density->tfm = transform_translate(-loc) * transform_scale(size) *
transform_inverse(get_transform(b_ob.matrix_world()));
point_density->set_tfm(transform_translate(-loc) * transform_scale(size) *
transform_inverse(get_transform(b_ob.matrix_world())));
}
}
else if (b_node.is_a(&RNA_ShaderNodeBevel)) {
BL::ShaderNodeBevel b_bevel_node(b_node);
BevelNode *bevel = graph->create_node<BevelNode>();
bevel->samples = b_bevel_node.samples();
bevel->set_samples(b_bevel_node.samples());
node = bevel;
}
else if (b_node.is_a(&RNA_ShaderNodeDisplacement)) {
BL::ShaderNodeDisplacement b_disp_node(b_node);
DisplacementNode *disp = graph->create_node<DisplacementNode>();
disp->space = (NodeNormalMapSpace)b_disp_node.space();
disp->set_space((NodeNormalMapSpace)b_disp_node.space());
node = disp;
}
else if (b_node.is_a(&RNA_ShaderNodeVectorDisplacement)) {
BL::ShaderNodeVectorDisplacement b_disp_node(b_node);
VectorDisplacementNode *disp = graph->create_node<VectorDisplacementNode>();
disp->space = (NodeNormalMapSpace)b_disp_node.space();
disp->attribute = "";
disp->set_space((NodeNormalMapSpace)b_disp_node.space());
disp->set_attribute(ustring(""));
node = disp;
}
else if (b_node.is_a(&RNA_ShaderNodeOutputAOV)) {
BL::ShaderNodeOutputAOV b_aov_node(b_node);
OutputAOVNode *aov = graph->create_node<OutputAOVNode>();
aov->name = b_aov_node.name();
aov->set_name(ustring(b_aov_node.name()));
node = aov;
}
@@ -1241,11 +1308,11 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
Shader *shader;
/* test if we need to sync */
if (shader_map.add_or_update(scene, &shader, b_mat) || update_all) {
if (shader_map.add_or_update(&shader, b_mat) || update_all) {
ShaderGraph *graph = new ShaderGraph();
shader->name = b_mat.name().c_str();
shader->pass_id = b_mat.pass_index();
shader->set_pass_id(b_mat.pass_index());
/* create nodes */
if (b_mat.use_nodes() && b_mat.node_tree()) {
@@ -1255,7 +1322,7 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
}
else {
DiffuseBsdfNode *diffuse = graph->create_node<DiffuseBsdfNode>();
diffuse->color = get_float3(b_mat.diffuse_color());
diffuse->set_color(get_float3(b_mat.diffuse_color()));
graph->add(diffuse);
ShaderNode *out = graph->output();
@@ -1264,13 +1331,13 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
/* settings */
PointerRNA cmat = RNA_pointer_get(&b_mat.ptr, "cycles");
shader->use_mis = get_boolean(cmat, "sample_as_light");
shader->use_transparent_shadow = get_boolean(cmat, "use_transparent_shadow");
shader->heterogeneous_volume = !get_boolean(cmat, "homogeneous_volume");
shader->volume_sampling_method = get_volume_sampling(cmat);
shader->volume_interpolation_method = get_volume_interpolation(cmat);
shader->volume_step_rate = get_float(cmat, "volume_step_rate");
shader->displacement_method = get_displacement_method(cmat);
shader->set_use_mis(get_boolean(cmat, "sample_as_light"));
shader->set_use_transparent_shadow(get_boolean(cmat, "use_transparent_shadow"));
shader->set_heterogeneous_volume(!get_boolean(cmat, "homogeneous_volume"));
shader->set_volume_sampling_method(get_volume_sampling(cmat));
shader->set_volume_interpolation_method(get_volume_interpolation(cmat));
shader->set_volume_step_rate(get_float(cmat, "volume_step_rate"));
shader->set_displacement_method(get_displacement_method(cmat));
shader->set_graph(graph);
@@ -1311,7 +1378,6 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, bool update_all)
{
Background *background = scene->background;
Background prevbackground = *background;
BL::World b_world = b_scene.world();
@@ -1331,14 +1397,14 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
/* volume */
PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
shader->heterogeneous_volume = !get_boolean(cworld, "homogeneous_volume");
shader->volume_sampling_method = get_volume_sampling(cworld);
shader->volume_interpolation_method = get_volume_interpolation(cworld);
shader->volume_step_rate = get_float(cworld, "volume_step_size");
shader->set_heterogeneous_volume(!get_boolean(cworld, "homogeneous_volume"));
shader->set_volume_sampling_method(get_volume_sampling(cworld));
shader->set_volume_interpolation_method(get_volume_interpolation(cworld));
shader->set_volume_step_rate(get_float(cworld, "volume_step_size"));
}
else if (new_viewport_parameters.use_scene_world && b_world) {
BackgroundNode *background = graph->create_node<BackgroundNode>();
background->color = get_float3(b_world.color());
background->set_color(get_float3(b_world.color()));
graph->add(background);
ShaderNode *out = graph->output();
@@ -1360,29 +1426,32 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
graph->add(light_path);
MixNode *mix_scene_with_background = graph->create_node<MixNode>();
mix_scene_with_background->color2 = world_color;
mix_scene_with_background->set_color2(world_color);
graph->add(mix_scene_with_background);
EnvironmentTextureNode *texture_environment = graph->create_node<EnvironmentTextureNode>();
texture_environment->tex_mapping.type = TextureMapping::VECTOR;
texture_environment->tex_mapping.rotation[2] = new_viewport_parameters.studiolight_rotate_z;
texture_environment->filename = new_viewport_parameters.studiolight_path;
texture_environment->set_tex_mapping_type(TextureMapping::VECTOR);
float3 rotation_z = texture_environment->get_tex_mapping_rotation();
rotation_z[2] = new_viewport_parameters.studiolight_rotate_z;
texture_environment->set_tex_mapping_rotation(rotation_z);
texture_environment->set_filename(new_viewport_parameters.studiolight_path);
graph->add(texture_environment);
MixNode *mix_intensity = graph->create_node<MixNode>();
mix_intensity->type = NODE_MIX_MUL;
mix_intensity->fac = 1.0f;
mix_intensity->color2 = make_float3(new_viewport_parameters.studiolight_intensity,
new_viewport_parameters.studiolight_intensity,
new_viewport_parameters.studiolight_intensity);
mix_intensity->set_mix_type(NODE_MIX_MUL);
mix_intensity->set_fac(1.0f);
mix_intensity->set_color2(make_float3(new_viewport_parameters.studiolight_intensity,
new_viewport_parameters.studiolight_intensity,
new_viewport_parameters.studiolight_intensity));
graph->add(mix_intensity);
TextureCoordinateNode *texture_coordinate = graph->create_node<TextureCoordinateNode>();
graph->add(texture_coordinate);
MixNode *mix_background_with_environment = graph->create_node<MixNode>();
mix_background_with_environment->fac = new_viewport_parameters.studiolight_background_alpha;
mix_background_with_environment->color1 = world_color;
mix_background_with_environment->set_fac(
new_viewport_parameters.studiolight_background_alpha);
mix_background_with_environment->set_color1(world_color);
graph->add(mix_background_with_environment);
ShaderNode *out = graph->output();
@@ -1404,9 +1473,9 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
/* AO */
BL::WorldLighting b_light = b_world.light_settings();
background->use_ao = b_light.use_ambient_occlusion();
background->ao_factor = b_light.ao_factor();
background->ao_distance = b_light.distance();
background->set_use_ao(b_light.use_ambient_occlusion());
background->set_ao_factor(b_light.ao_factor());
background->set_ao_distance(b_light.distance());
/* visibility */
PointerRNA cvisibility = RNA_pointer_get(&b_world.ptr, "cycles_visibility");
@@ -1418,12 +1487,12 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
visibility |= get_boolean(cvisibility, "transmission") ? PATH_RAY_TRANSMIT : 0;
visibility |= get_boolean(cvisibility, "scatter") ? PATH_RAY_VOLUME_SCATTER : 0;
background->visibility = visibility;
background->set_visibility(visibility);
}
else {
background->use_ao = false;
background->ao_factor = 0.0f;
background->ao_distance = FLT_MAX;
background->set_use_ao(false);
background->set_ao_factor(0.0f);
background->set_ao_distance(FLT_MAX);
}
shader->set_graph(graph);
@@ -1432,22 +1501,23 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
}
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
background->transparent = b_scene.render().film_transparent();
background->set_transparent(b_scene.render().film_transparent());
if (background->transparent) {
background->transparent_glass = get_boolean(cscene, "film_transparent_glass");
background->transparent_roughness_threshold = get_float(cscene, "film_transparent_roughness");
if (background->get_transparent()) {
background->set_transparent_glass(get_boolean(cscene, "film_transparent_glass"));
background->set_transparent_roughness_threshold(
get_float(cscene, "film_transparent_roughness"));
}
else {
background->transparent_glass = false;
background->transparent_roughness_threshold = 0.0f;
background->set_transparent_glass(false);
background->set_transparent_roughness_threshold(0.0f);
}
background->use_shader = view_layer.use_background_shader |
viewport_parameters.custom_viewport_parameters();
background->use_ao = background->use_ao && view_layer.use_background_ao;
background->set_use_shader(view_layer.use_background_shader |
viewport_parameters.custom_viewport_parameters());
background->set_use_ao(background->get_use_ao() && view_layer.use_background_ao);
if (background->modified(prevbackground))
if (background->is_modified())
background->tag_update(scene);
}
@@ -1467,7 +1537,7 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all)
Shader *shader;
/* test if we need to sync */
if (shader_map.add_or_update(scene, &shader, b_light) || update_all) {
if (shader_map.add_or_update(&shader, b_light) || update_all) {
ShaderGraph *graph = new ShaderGraph();
/* create nodes */
@@ -1480,8 +1550,8 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all)
}
else {
EmissionNode *emission = graph->create_node<EmissionNode>();
emission->color = make_float3(1.0f, 1.0f, 1.0f);
emission->strength = 1.0f;
emission->set_color(make_float3(1.0f, 1.0f, 1.0f));
emission->set_strength(1.0f);
graph->add(emission);
ShaderNode *out = graph->output();

View File

@@ -56,11 +56,11 @@ BlenderSync::BlenderSync(BL::RenderEngine &b_engine,
: b_engine(b_engine),
b_data(b_data),
b_scene(b_scene),
shader_map(),
object_map(),
geometry_map(),
light_map(),
particle_system_map(),
shader_map(scene),
object_map(scene),
geometry_map(scene),
light_map(scene),
particle_system_map(scene),
world_map(NULL),
world_recalc(false),
scene(scene),
@@ -118,9 +118,9 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
if (dicing_prop_changed) {
for (const pair<const GeometryKey, Geometry *> &iter : geometry_map.key_to_scene_data()) {
Geometry *geom = iter.second;
if (geom->type == Geometry::MESH) {
if (geom->is_mesh()) {
Mesh *mesh = static_cast<Mesh *>(geom);
if (mesh->subdivision_type != Mesh::SUBDIVISION_NONE) {
if (mesh->get_subdivision_type() != Mesh::SUBDIVISION_NONE) {
PointerRNA id_ptr;
RNA_id_pointer_create((::ID *)iter.first.id, &id_ptr);
geometry_map.set_recalc(BL::ID(id_ptr));
@@ -238,7 +238,7 @@ void BlenderSync::sync_data(BL::RenderSettings &b_render,
geometry_synced.clear(); /* use for objects and motion sync */
if (scene->need_motion() == Scene::MOTION_PASS || scene->need_motion() == Scene::MOTION_NONE ||
scene->camera->motion_position == Camera::MOTION_POSITION_CENTER) {
scene->camera->get_motion_position() == Camera::MOTION_POSITION_CENTER) {
sync_objects(b_depsgraph, b_v3d);
}
sync_motion(b_render, b_depsgraph, b_v3d, b_override, width, height, python_thread_state);
@@ -247,7 +247,7 @@ void BlenderSync::sync_data(BL::RenderSettings &b_render,
/* Shader sync done at the end, since object sync uses it.
* false = don't delete unused shaders, not supported. */
shader_map.post_sync(scene, false);
shader_map.post_sync(false);
free_data_after_sync(b_depsgraph);
@@ -264,70 +264,75 @@ void BlenderSync::sync_integrator()
experimental = (get_enum(cscene, "feature_set") != 0);
Integrator *integrator = scene->integrator;
Integrator previntegrator = *integrator;
integrator->min_bounce = get_int(cscene, "min_light_bounces");
integrator->max_bounce = get_int(cscene, "max_bounces");
integrator->set_min_bounce(get_int(cscene, "min_light_bounces"));
integrator->set_max_bounce(get_int(cscene, "max_bounces"));
integrator->max_diffuse_bounce = get_int(cscene, "diffuse_bounces");
integrator->max_glossy_bounce = get_int(cscene, "glossy_bounces");
integrator->max_transmission_bounce = get_int(cscene, "transmission_bounces");
integrator->max_volume_bounce = get_int(cscene, "volume_bounces");
integrator->set_max_diffuse_bounce(get_int(cscene, "diffuse_bounces"));
integrator->set_max_glossy_bounce(get_int(cscene, "glossy_bounces"));
integrator->set_max_transmission_bounce(get_int(cscene, "transmission_bounces"));
integrator->set_max_volume_bounce(get_int(cscene, "volume_bounces"));
integrator->transparent_min_bounce = get_int(cscene, "min_transparent_bounces");
integrator->transparent_max_bounce = get_int(cscene, "transparent_max_bounces");
integrator->set_transparent_min_bounce(get_int(cscene, "min_transparent_bounces"));
integrator->set_transparent_max_bounce(get_int(cscene, "transparent_max_bounces"));
integrator->volume_max_steps = get_int(cscene, "volume_max_steps");
integrator->volume_step_rate = (preview) ? get_float(cscene, "volume_preview_step_rate") :
get_float(cscene, "volume_step_rate");
integrator->set_volume_max_steps(get_int(cscene, "volume_max_steps"));
float volume_step_rate = (preview) ? get_float(cscene, "volume_preview_step_rate") :
get_float(cscene, "volume_step_rate");
integrator->set_volume_step_rate(volume_step_rate);
integrator->caustics_reflective = get_boolean(cscene, "caustics_reflective");
integrator->caustics_refractive = get_boolean(cscene, "caustics_refractive");
integrator->filter_glossy = get_float(cscene, "blur_glossy");
integrator->set_caustics_reflective(get_boolean(cscene, "caustics_reflective"));
integrator->set_caustics_refractive(get_boolean(cscene, "caustics_refractive"));
integrator->set_filter_glossy(get_float(cscene, "blur_glossy"));
integrator->seed = get_int(cscene, "seed");
int seed = get_int(cscene, "seed");
if (get_boolean(cscene, "use_animated_seed")) {
integrator->seed = hash_uint2(b_scene.frame_current(), get_int(cscene, "seed"));
seed = hash_uint2(b_scene.frame_current(), get_int(cscene, "seed"));
if (b_scene.frame_subframe() != 0.0f) {
/* TODO(sergey): Ideally should be some sort of hash_merge,
* but this is good enough for now.
*/
integrator->seed += hash_uint2((int)(b_scene.frame_subframe() * (float)INT_MAX),
get_int(cscene, "seed"));
seed += hash_uint2((int)(b_scene.frame_subframe() * (float)INT_MAX),
get_int(cscene, "seed"));
}
}
integrator->sampling_pattern = (SamplingPattern)get_enum(
integrator->set_seed(seed);
integrator->set_sample_clamp_direct(get_float(cscene, "sample_clamp_direct"));
integrator->set_sample_clamp_indirect(get_float(cscene, "sample_clamp_indirect"));
if (!preview) {
if (integrator->get_motion_blur() != r.use_motion_blur()) {
scene->object_manager->tag_update(scene);
scene->camera->tag_modified();
}
integrator->set_motion_blur(r.use_motion_blur());
}
integrator->set_method((Integrator::Method)get_enum(
cscene, "progressive", Integrator::NUM_METHODS, Integrator::PATH));
integrator->set_sample_all_lights_direct(get_boolean(cscene, "sample_all_lights_direct"));
integrator->set_sample_all_lights_indirect(get_boolean(cscene, "sample_all_lights_indirect"));
integrator->set_light_sampling_threshold(get_float(cscene, "light_sampling_threshold"));
SamplingPattern sampling_pattern = (SamplingPattern)get_enum(
cscene, "sampling_pattern", SAMPLING_NUM_PATTERNS, SAMPLING_PATTERN_SOBOL);
integrator->sample_clamp_direct = get_float(cscene, "sample_clamp_direct");
integrator->sample_clamp_indirect = get_float(cscene, "sample_clamp_indirect");
if (!preview) {
if (integrator->motion_blur != r.use_motion_blur()) {
scene->object_manager->tag_update(scene);
scene->camera->tag_update();
}
integrator->motion_blur = r.use_motion_blur();
}
integrator->method = (Integrator::Method)get_enum(
cscene, "progressive", Integrator::NUM_METHODS, Integrator::PATH);
integrator->sample_all_lights_direct = get_boolean(cscene, "sample_all_lights_direct");
integrator->sample_all_lights_indirect = get_boolean(cscene, "sample_all_lights_indirect");
integrator->light_sampling_threshold = get_float(cscene, "light_sampling_threshold");
int adaptive_min_samples = INT_MAX;
if (RNA_boolean_get(&cscene, "use_adaptive_sampling")) {
integrator->sampling_pattern = SAMPLING_PATTERN_PMJ;
integrator->adaptive_min_samples = get_int(cscene, "adaptive_min_samples");
integrator->adaptive_threshold = get_float(cscene, "adaptive_threshold");
sampling_pattern = SAMPLING_PATTERN_PMJ;
adaptive_min_samples = get_int(cscene, "adaptive_min_samples");
integrator->set_adaptive_threshold(get_float(cscene, "adaptive_threshold"));
}
else {
integrator->adaptive_min_samples = INT_MAX;
integrator->adaptive_threshold = 0.0f;
integrator->set_adaptive_threshold(0.0f);
}
integrator->set_sampling_pattern(sampling_pattern);
int diffuse_samples = get_int(cscene, "diffuse_samples");
int glossy_samples = get_int(cscene, "glossy_samples");
int transmission_samples = get_int(cscene, "transmission_samples");
@@ -337,39 +342,40 @@ void BlenderSync::sync_integrator()
int volume_samples = get_int(cscene, "volume_samples");
if (get_boolean(cscene, "use_square_samples")) {
integrator->diffuse_samples = diffuse_samples * diffuse_samples;
integrator->glossy_samples = glossy_samples * glossy_samples;
integrator->transmission_samples = transmission_samples * transmission_samples;
integrator->ao_samples = ao_samples * ao_samples;
integrator->mesh_light_samples = mesh_light_samples * mesh_light_samples;
integrator->subsurface_samples = subsurface_samples * subsurface_samples;
integrator->volume_samples = volume_samples * volume_samples;
integrator->adaptive_min_samples = min(
integrator->adaptive_min_samples * integrator->adaptive_min_samples, INT_MAX);
integrator->set_diffuse_samples(diffuse_samples * diffuse_samples);
integrator->set_glossy_samples(glossy_samples * glossy_samples);
integrator->set_transmission_samples(transmission_samples * transmission_samples);
integrator->set_ao_samples(ao_samples * ao_samples);
integrator->set_mesh_light_samples(mesh_light_samples * mesh_light_samples);
integrator->set_subsurface_samples(subsurface_samples * subsurface_samples);
integrator->set_volume_samples(volume_samples * volume_samples);
adaptive_min_samples = min(adaptive_min_samples * adaptive_min_samples, INT_MAX);
}
else {
integrator->diffuse_samples = diffuse_samples;
integrator->glossy_samples = glossy_samples;
integrator->transmission_samples = transmission_samples;
integrator->ao_samples = ao_samples;
integrator->mesh_light_samples = mesh_light_samples;
integrator->subsurface_samples = subsurface_samples;
integrator->volume_samples = volume_samples;
integrator->set_diffuse_samples(diffuse_samples);
integrator->set_glossy_samples(glossy_samples);
integrator->set_transmission_samples(transmission_samples);
integrator->set_ao_samples(ao_samples);
integrator->set_mesh_light_samples(mesh_light_samples);
integrator->set_subsurface_samples(subsurface_samples);
integrator->set_volume_samples(volume_samples);
}
integrator->set_adaptive_min_samples(adaptive_min_samples);
if (b_scene.render().use_simplify()) {
if (preview) {
integrator->ao_bounces = get_int(cscene, "ao_bounces");
integrator->set_ao_bounces(get_int(cscene, "ao_bounces"));
}
else {
integrator->ao_bounces = get_int(cscene, "ao_bounces_render");
integrator->set_ao_bounces(get_int(cscene, "ao_bounces_render"));
}
}
else {
integrator->ao_bounces = 0;
integrator->set_ao_bounces(0);
}
if (integrator->modified(previntegrator))
if (integrator->is_modified())
integrator->tag_update(scene);
}
@@ -380,46 +386,42 @@ void BlenderSync::sync_film(BL::SpaceView3D &b_v3d)
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
Film *film = scene->film;
Film prevfilm = *film;
vector<Pass> prevpasses = scene->passes;
if (b_v3d) {
film->display_pass = update_viewport_display_passes(b_v3d, scene->passes);
film->set_display_pass(update_viewport_display_passes(b_v3d, scene->passes));
}
film->exposure = get_float(cscene, "film_exposure");
film->filter_type = (FilterType)get_enum(
cscene, "pixel_filter_type", FILTER_NUM_TYPES, FILTER_BLACKMAN_HARRIS);
film->filter_width = (film->filter_type == FILTER_BOX) ? 1.0f :
get_float(cscene, "filter_width");
film->set_exposure(get_float(cscene, "film_exposure"));
film->set_filter_type(
(FilterType)get_enum(cscene, "pixel_filter_type", FILTER_NUM_TYPES, FILTER_BLACKMAN_HARRIS));
float filter_width = (film->get_filter_type() == FILTER_BOX) ? 1.0f :
get_float(cscene, "filter_width");
film->set_filter_width(filter_width);
if (b_scene.world()) {
BL::WorldMistSettings b_mist = b_scene.world().mist_settings();
film->mist_start = b_mist.start();
film->mist_depth = b_mist.depth();
film->set_mist_start(b_mist.start());
film->set_mist_depth(b_mist.depth());
switch (b_mist.falloff()) {
case BL::WorldMistSettings::falloff_QUADRATIC:
film->mist_falloff = 2.0f;
film->set_mist_falloff(2.0f);
break;
case BL::WorldMistSettings::falloff_LINEAR:
film->mist_falloff = 1.0f;
film->set_mist_falloff(1.0f);
break;
case BL::WorldMistSettings::falloff_INVERSE_QUADRATIC:
film->mist_falloff = 0.5f;
film->set_mist_falloff(0.5f);
break;
}
}
if (film->modified(prevfilm)) {
film->tag_update(scene);
}
if (!Pass::equals(prevpasses, scene->passes)) {
film->tag_passes_update(scene, prevpasses, false);
film->tag_update(scene);
film->tag_modified();
}
}
@@ -585,7 +587,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
BL::RenderPass b_pass(*b_pass_iter);
PassType pass_type = get_pass_type(b_pass);
if (pass_type == PASS_MOTION && scene->integrator->motion_blur)
if (pass_type == PASS_MOTION && scene->integrator->get_motion_blur())
continue;
if (pass_type != PASS_NONE)
Pass::add(pass_type, passes, b_pass.name().c_str());
@@ -593,12 +595,12 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
PointerRNA crl = RNA_pointer_get(&b_view_layer.ptr, "cycles");
scene->film->denoising_flags = 0;
int denoising_flags = 0;
if (denoising.use || denoising.store_passes) {
if (denoising.type == DENOISER_NLM) {
#define MAP_OPTION(name, flag) \
if (!get_boolean(crl, name)) { \
scene->film->denoising_flags |= flag; \
denoising_flags |= flag; \
} \
((void)0)
MAP_OPTION("denoising_diffuse_direct", DENOISING_CLEAN_DIFFUSE_DIR);
@@ -611,6 +613,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
}
b_engine.add_pass("Noisy Image", 4, "RGBA", b_view_layer.name().c_str());
}
scene->film->set_denoising_flags(denoising_flags);
if (denoising.store_passes) {
b_engine.add_pass("Denoising Normal", 3, "XYZ", b_view_layer.name().c_str());
@@ -622,7 +625,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
b_engine.add_pass("Denoising Intensity", 1, "X", b_view_layer.name().c_str());
}
if (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES) {
if (scene->film->get_denoising_flags() & DENOISING_CLEAN_ALL_PASSES) {
b_engine.add_pass("Denoising Clean", 3, "RGB", b_view_layer.name().c_str());
}
}
@@ -665,16 +668,15 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
/* Cryptomatte stores two ID/weight pairs per RGBA layer.
* User facing parameter is the number of pairs. */
int crypto_depth = divide_up(min(16, get_int(crl, "pass_crypto_depth")), 2);
scene->film->cryptomatte_depth = crypto_depth;
scene->film->cryptomatte_passes = CRYPT_NONE;
scene->film->set_cryptomatte_depth(crypto_depth);
CryptomatteType cryptomatte_passes = CRYPT_NONE;
if (get_boolean(crl, "use_pass_crypto_object")) {
for (int i = 0; i < crypto_depth; i++) {
string passname = cryptomatte_prefix + string_printf("Object%02d", i);
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
}
scene->film->cryptomatte_passes = (CryptomatteType)(scene->film->cryptomatte_passes |
CRYPT_OBJECT);
cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_OBJECT);
}
if (get_boolean(crl, "use_pass_crypto_material")) {
for (int i = 0; i < crypto_depth; i++) {
@@ -682,8 +684,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
}
scene->film->cryptomatte_passes = (CryptomatteType)(scene->film->cryptomatte_passes |
CRYPT_MATERIAL);
cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_MATERIAL);
}
if (get_boolean(crl, "use_pass_crypto_asset")) {
for (int i = 0; i < crypto_depth; i++) {
@@ -691,13 +692,12 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
b_engine.add_pass(passname.c_str(), 4, "RGBA", b_view_layer.name().c_str());
Pass::add(PASS_CRYPTOMATTE, passes, passname.c_str());
}
scene->film->cryptomatte_passes = (CryptomatteType)(scene->film->cryptomatte_passes |
CRYPT_ASSET);
cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_ASSET);
}
if (get_boolean(crl, "pass_crypto_accurate") && scene->film->cryptomatte_passes != CRYPT_NONE) {
scene->film->cryptomatte_passes = (CryptomatteType)(scene->film->cryptomatte_passes |
CRYPT_ACCURATE);
if (get_boolean(crl, "pass_crypto_accurate") && cryptomatte_passes != CRYPT_NONE) {
cryptomatte_passes = (CryptomatteType)(cryptomatte_passes | CRYPT_ACCURATE);
}
scene->film->set_cryptomatte_passes(cryptomatte_passes);
if (adaptive_sampling) {
Pass::add(PASS_ADAPTIVE_AUX_BUFFER, passes);
@@ -721,14 +721,14 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
}
RNA_END;
scene->film->denoising_data_pass = denoising.use || denoising.store_passes;
scene->film->denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES);
scene->film->denoising_prefiltered_pass = denoising.store_passes &&
denoising.type == DENOISER_NLM;
scene->film->set_denoising_data_pass(denoising.use || denoising.store_passes);
scene->film->set_denoising_clean_pass(scene->film->get_denoising_flags() &
DENOISING_CLEAN_ALL_PASSES);
scene->film->set_denoising_prefiltered_pass(denoising.store_passes &&
denoising.type == DENOISER_NLM);
scene->film->pass_alpha_threshold = b_view_layer.pass_alpha_threshold();
scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold());
scene->film->tag_passes_update(scene, passes);
scene->film->tag_update(scene);
scene->integrator->tag_update(scene);
return passes;

View File

@@ -149,21 +149,17 @@ class BlenderSync {
bool *use_portal,
TaskPool *geom_task_pool);
bool sync_object_attributes(BL::DepsgraphObjectInstance &b_instance, Object *object);
/* Volume */
void sync_volume(BL::Object &b_ob, Volume *volume, const vector<Shader *> &used_shaders);
void sync_volume(BL::Object &b_ob, Volume *volume);
/* Mesh */
void sync_mesh(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Mesh *mesh,
const vector<Shader *> &used_shaders);
void sync_mesh(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh);
void sync_mesh_motion(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh, int motion_step);
/* Hair */
void sync_hair(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Hair *hair,
const vector<Shader *> &used_shaders);
void sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Hair *hair);
void sync_hair_motion(BL::Depsgraph b_depsgraph, BL::Object b_ob, Hair *hair, int motion_step);
void sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motion_step = 0);
void sync_particle_hair(
@@ -211,7 +207,7 @@ class BlenderSync {
void free_data_after_sync(BL::Depsgraph &b_depsgraph);
/* util */
void find_shader(BL::ID &id, vector<Shader *> &used_shaders, Shader *default_shader);
void find_shader(BL::ID &id, array<Node *> &used_shaders, Shader *default_shader);
bool BKE_object_is_modified(BL::Object &b_ob);
bool object_is_geometry(BL::Object &b_ob);
bool object_is_light(BL::Object &b_ob);

View File

@@ -40,6 +40,9 @@ float *BKE_image_get_float_pixels_for_frame(void *image, int frame, int tile);
CCL_NAMESPACE_BEGIN
typedef BL::ShaderNodeAttribute::attribute_type_enum BlenderAttributeType;
BlenderAttributeType blender_attribute_name_split_type(ustring name, string *r_real_name);
void python_thread_state_save(void **python_thread_state);
void python_thread_state_restore(void **python_thread_state);

View File

@@ -202,7 +202,7 @@ static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Volume *volume, fl
continue;
}
volume->clipping = b_domain.clipping();
volume->set_clipping(b_domain.clipping());
Attribute *attr = volume->attributes.add(std);
@@ -262,9 +262,9 @@ static void sync_volume_object(BL::BlendData &b_data,
BL::VolumeRender b_render(b_volume.render());
volume->clipping = b_render.clipping();
volume->step_size = b_render.step_size();
volume->object_space = (b_render.space() == BL::VolumeRender::space_OBJECT);
volume->set_clipping(b_render.clipping());
volume->set_step_size(b_render.step_size());
volume->set_object_space((b_render.space() == BL::VolumeRender::space_OBJECT));
/* Find grid with matching name. */
BL::Volume::grids_iterator b_grid_iter;
@@ -320,14 +320,11 @@ static vector<int> get_voxel_image_slots(Mesh *mesh)
return slots;
}
void BlenderSync::sync_volume(BL::Object &b_ob,
Volume *volume,
const vector<Shader *> &used_shaders)
void BlenderSync::sync_volume(BL::Object &b_ob, Volume *volume)
{
vector<int> old_voxel_slots = get_voxel_image_slots(volume);
volume->clear();
volume->used_shaders = used_shaders;
volume->clear(true);
if (view_layer.use_volumes) {
if (b_ob.type() == BL::Object::type_VOLUME) {

View File

@@ -108,6 +108,7 @@ BVH *BVH::create(const BVHParams &params,
#ifdef WITH_EMBREE
return new BVHEmbree(params, geometry, objects, device);
#else
(void)device;
break;
#endif
case BVH_LAYOUT_OPTIX:
@@ -208,30 +209,30 @@ void BVH::refit_primitives(int start, int end, BoundBox &bbox, uint &visibility)
/* Primitives. */
if (pack.prim_type[prim] & PRIMITIVE_ALL_CURVE) {
/* Curves. */
const Hair *hair = static_cast<const Hair *>(ob->geometry);
const Hair *hair = static_cast<const Hair *>(ob->get_geometry());
int prim_offset = (params.top_level) ? hair->prim_offset : 0;
Hair::Curve curve = hair->get_curve(pidx - prim_offset);
int k = PRIMITIVE_UNPACK_SEGMENT(pack.prim_type[prim]);
curve.bounds_grow(k, &hair->curve_keys[0], &hair->curve_radius[0], bbox);
curve.bounds_grow(k, &hair->get_curve_keys()[0], &hair->get_curve_radius()[0], bbox);
/* Motion curves. */
if (hair->use_motion_blur) {
if (hair->get_use_motion_blur()) {
Attribute *attr = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
if (attr) {
size_t hair_size = hair->curve_keys.size();
size_t steps = hair->motion_steps - 1;
size_t hair_size = hair->get_curve_keys().size();
size_t steps = hair->get_motion_steps() - 1;
float3 *key_steps = attr->data_float3();
for (size_t i = 0; i < steps; i++)
curve.bounds_grow(k, key_steps + i * hair_size, &hair->curve_radius[0], bbox);
curve.bounds_grow(k, key_steps + i * hair_size, &hair->get_curve_radius()[0], bbox);
}
}
}
else {
/* Triangles. */
const Mesh *mesh = static_cast<const Mesh *>(ob->geometry);
const Mesh *mesh = static_cast<const Mesh *>(ob->get_geometry());
int prim_offset = (params.top_level) ? mesh->prim_offset : 0;
Mesh::Triangle triangle = mesh->get_triangle(pidx - prim_offset);
const float3 *vpos = &mesh->verts[0];
@@ -263,7 +264,7 @@ void BVH::pack_triangle(int idx, float4 tri_verts[3])
{
int tob = pack.prim_object[idx];
assert(tob >= 0 && tob < objects.size());
const Mesh *mesh = static_cast<const Mesh *>(objects[tob]->geometry);
const Mesh *mesh = static_cast<const Mesh *>(objects[tob]->get_geometry());
int tidx = pack.prim_index[idx];
Mesh::Triangle t = mesh->get_triangle(tidx);
@@ -328,7 +329,7 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
*/
for (size_t i = 0; i < pack.prim_index.size(); i++) {
if (pack.prim_index[i] != -1) {
pack.prim_index[i] += objects[pack.prim_object[i]]->geometry->prim_offset;
pack.prim_index[i] += objects[pack.prim_object[i]]->get_geometry()->prim_offset;
}
}
@@ -389,7 +390,7 @@ void BVH::pack_instances(size_t nodes_size, size_t leaf_nodes_size)
/* merge */
foreach (Object *ob, objects) {
Geometry *geom = ob->geometry;
Geometry *geom = ob->get_geometry();
/* We assume that if mesh doesn't need own BVH it was already included
* into a top-level BVH and no packing here is needed.

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