1
1

Compare commits

..

1122 Commits

Author SHA1 Message Date
7769b89bab EEVEE: Depth of Field: Improves jittered camera sampling pattern
Jittered camera now uses an hexaweb sampling pattern that covers the
bokeh area better and faster than previous pseudo random solution.

The downside is that we need to change the sample count based on the
number of rings to fill. We increase the number of samples just to fill
the largest ring.
2021-02-11 04:13:25 +01:00
cccf7387a8 EEVEE: Depth of Field: Improves denoise filter
This improve spatial stability by only clamping down pixels that
are too bright (fixing the issue of bright pixels inflating).

Also use the full 3x3 region to avoid cross shape patterns.
2021-02-10 21:53:22 +01:00
c5873c7828 Cleanup: Fix formating 2021-02-03 17:55:40 +01:00
d02e644060 Merge branch 'master' into eevee-dof-refactor 2021-02-03 17:14:04 +01:00
e49b702527 GL: Improve framebuffer error message by adding framebuffer name
Framebuffer error can be hard to track. This makes it much easier to
find the wrong framebuffer configuration.
2021-02-03 17:11:17 +01:00
54d6e071ab EEVEE: Depth of field: Cleanup eevee_shaders interface 2021-02-03 17:08:00 +01:00
7bc49f68a9 EEVEE: Depth of field: Remove studiolight related changes 2021-02-03 17:02:43 +01:00
8a6e07e42c EEVEE: Depth of field: Fix typo and wrong ownership 2021-02-03 16:56:41 +01:00
aeaa549948 EEVEE: Depth of field: Move versioning code to versioning_290.c 2021-02-03 16:56:09 +01:00
c4c1b2addc EEVEE: Depth of field: Add slight defocus bokeh shape foreground flip 2021-02-03 16:49:03 +01:00
d447a5eab3 EEVEE: Depth of field: Fix bokeh shape rotation inverted
This was comming from that the rotation was based on foreground
shape which is now the one we invert.
2021-02-03 16:47:06 +01:00
376bffae03 EEVEE: Depth of field: Fix bokeh shape not inverted for scatter
The wrong vector was negated.
2021-02-03 16:46:11 +01:00
f4f4495586 install_deps: OIIO: tweak to max version, and cleanup compile code.
OSL 1.10.10 does not build with OIIO 2.2.10.
2021-02-03 16:04:18 +01:00
8e98983945 install_deps: Upgrade Alembic to 1.17.16.
See T83246.
2021-02-03 16:04:18 +01:00
1a1aa5392d install_deps: Update Boost to 1.73.
See T83246.
2021-02-03 16:04:18 +01:00
3200a135be install_deps: update Python to 3.9.1, numpy to 1.19.5.
See T83246.
2021-02-03 16:04:18 +01:00
2b18c41c4d Merge branch 'blender-v2.92-release' 2021-02-03 15:53:55 +01:00
85fe12071a Fix T85261: Eevee passes have slight inaccurate colors
In everything in `EEVEE_renderpasses_postprocess` (or the corresponding
renderpass_postprocess_frag.glsl) colors get divided by a
'currentSample'.

This 'currentSample' is always incremented in
`EEVEE_temporal_sampling_draw` (and also one more time before we reach
`EEVEE_renderpasses_postprocess`.
This results in a "off-by-one", slightly inacurate colors and slight
inaccurate transparency (in certain passes like AOVs).

Now decrement the currentSample `EEVEE_renderpasses_postprocess` again
by one to compensate.

Maniphest Tasks: T85261

Differential Revision: https://developer.blender.org/D10286
2021-02-03 15:50:17 +01:00
3a446f2d9f Merge branch 'blender-v2.92-release' 2021-02-03 15:30:15 +01:00
487fe5abfc Cryptomatte: Incorrect Coverage with Volumetrics
Related to {D10286}. When volumetrics are used in the scene the coverage
is incorrect. The reason is that the current sample is 1 over the num
samples that are calculated.
2021-02-03 15:30:03 +01:00
10e3b2dc8e Cryptomatte: Incorrect Coverage with Volumetrics
Related to {D10286}. When volumetrics are used in the scene the coverage
is incorrect. The reason is that the current sample is 1 over the num
samples that are calculated.
2021-02-03 15:27:52 +01:00
e1f38b2169 Fix incorrect mesh selection duplication in internal utility function
`BKE_mesh_new_nomain_from_template_ex()` would duplicate the mesh selection
storage of the destination mesh to the destination mesh. Since that mesh was
default initialized at this point, the selection was `NULL`, so the duplication
call is essentially a no-op.

Mistake in 7efc75c709.

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

Reviewed by: Sybren Stüvel
2021-02-03 15:09:06 +01:00
e69217b283 UI: Improve tooltip for continuous grab
Attempt to explain the feature better follow a better writing style.
2021-02-03 15:07:37 +01:00
c9d6737e3e BKE UndoSys refactor: deduplicate and simplify code, sanitize naming.
Now we only use 'undo' or 'redo' in function names when the direction is
clear (and we assert about it). Otherwise, use 'load' instead.

When passing an undo step to BKE functions, consider calling code has
done its work and is actually passing the target step (i.e. the final
step intended to be loaded), instead of assuming we have to load the
step before/after it.

Also deduplicate and simplify a lot of core undo code in BKE, now
`BKE_undosys_step_load_data_ex` is the only place where all the complex
logic of undo/redo loop (to handle several steps in a row) is placed. We also
only use a single loop there, instead of the two existing ones in
previous code.

Note that here we consider that when we are loading the current active
step, we are undoing. This makes sense in that doing so //may// undo
some changes (ideally it should never do so), but should never, ever
redo anything.

`BKE_undosys_step_load_from_index` also gets heavily simplified, it's
not basically a shallow wrapper around
`BKE_undosys_step_load_from_index`.

And some general update of variable names, commenting, etc.

Part of T83806.

Differential Revision: https://developer.blender.org/D10227
2021-02-03 11:11:12 +01:00
4884153823 BPY: allow bpy.data.libraries.load() to filter out non-asset data-blocks.
Differential Revision: https://developer.blender.org/D10237
2021-02-03 09:53:56 +01:00
2ce1400297 Merge branch 'blender-v2.92-release' 2021-02-03 00:17:52 +01:00
0fc456f091 Fix T85314 GPU: Drawlist submit data overflows.
This was caused by an incorrect bound check. Since we now use different
data type for indexed and non-indexed drawcalls, we need to check if the
next drawcall is going to overflow the buffer.
2021-02-03 00:15:52 +01:00
78ff852680 Force Fields: implement early filtering by the Affect flags.
Most fields have Affect Location and Rotation options that switch
off their effect, but they are only checked as the last step after
the force is already computed. It is more efficient to check it
when building the list of field objects, just like zero weight.
It is also possible to check the strength-related fields for 0.

As an aside, this adds Location to Texture fields (they don't
handle rotation) and both Location & Rotation checkboxes to
Fluid Flow. Boid and Curve Guide remain without options for
now as they are completely different from others.

Differential Revision: https://developer.blender.org/D10087
2021-02-02 23:03:16 +03:00
64a963486f Merge branch 'blender-v2.92-release' 2021-02-02 20:42:54 +01:00
Robert Guetzkow
4a80c0e275 Fix T85225: Variable scope in ridged multi-fractal noise
This patch fixes a bug introduced in
rB74188e65028d268af887ab2140e4253087410c1e.
The commit incorrectly moved the declaration and intialization of the
variable `pwr` inside the loop. Since the value was originally modified
in each iteration based on it's previous value and `pwHL` through
`pwr *= pwHL`, this change in scope was wrong. It resetted the value in
each iteration. This patch moves the declaration of `pwr` outside the
loop again.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D10258
2021-02-02 20:37:28 +01:00
f2781e1c7c Fix for T82459 - Input Language Independent of Display Language
Allow OS input language to initiate IME, regardless of Blender output language.

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

Reviewed by Julian Eisel
2021-02-02 10:58:02 -08:00
b3f9895ab0 Fix build error on windows after recent commit
rB198ff4703f84d0c3267 neglected to remove designated initializers,
which are not supported in the C++ 17 standard.
2021-02-02 11:26:17 -06:00
1a5b988509 Merge branch 'blender-v2.92-release' 2021-02-02 17:51:18 +01:00
8c36f6becf Fix T84649: Quick liquid causing crash on scale operation
This commit makes use of the updated fluid sources files (previous commit rB9ad828dbad94d279521875db47a3472a38cc9b29)
2021-02-02 17:50:08 +01:00
9ad828dbad Fluid: Updated Mantaflow source files
Includes improvements for the file IO. Namely, more meta data will be written from now on.

This change is required to prevent IO issues (e.g. T84649) that arised through the use of sparse grids caching (introduced in 2.92).
2021-02-02 17:46:48 +01:00
4ff5051ffc BKE BMain relations: add utils to (re)set tags of the entries. 2021-02-02 17:26:59 +01:00
2262e18269 Cleanup: LibOverride: group logically utils static functions. 2021-02-02 17:26:59 +01:00
198ff4703f Blenkernel: Move node.c to C++
Required changes to compile `node.cc` with clang tidy:
* Use c++ includes like (e.g. climits instead limits.h).
* Insert type casts when casting from `void *`.
* Replace `NULL` with `nullptr`.
* Replace typedef statements.

This change is in order to use the `blender::Map` data structure
for node error messages.
2021-02-02 09:51:38 -06:00
d0aa7d5562 Merge branch 'blender-v2.92-release' 2021-02-02 16:47:21 +01:00
f8359b5f52 Fix freestyle render pass not being created when there are no strokes
It could lead to missing images when outputing the pass to an image
sequence.
2021-02-02 16:45:23 +01:00
326102f498 Merge branch 'blender-v2.92-release' 2021-02-02 08:26:21 -07:00
56bccd2395 Fix T83450: Missing 4th studio light in preview icon
Due to an off-by-one error the generated studio light icons did not show
the influence of the 4th light. This fix changes the loop to iterate
over all of the lights when computing the lighting.

Differential Revision: https://developer.blender.org/D10283
2021-02-02 08:23:13 -07:00
b7865f77c3 Merge branch 'blender-v2.92-release' 2021-02-02 09:21:14 -06:00
a1c7cab06c Fix T85155: Vertex groups from object don't transfer to next nodes modifier
Because the the vertex group name-to-index map is stored in the object
rather than object data, the object info node has to replace the
map when it replaces the mesh component on the geometry set with mesh
data from another object.

This normally works fine as a way to use the vertex groups from the
input mesh, but when passing this mesh to the next modifier, the entire
mesh component was replaced, removing the vertex group name map.

This commit adds a function to replace only the mesh data in mesh
component, uses it in the modifier code, and updates the relevant
comments.

Note that the fact that vertex group names are stored in object data
is a legacy design decision that should be reevaluated at some point.

Differential Revision: https://developer.blender.org/D10256
2021-02-02 09:20:54 -06:00
ed00f7c65e Merge branch 'blender-v2.92-release' 2021-02-02 15:34:39 +01:00
9e0c876aad Fix T85301: Eevee does not respect collection instance offset for hair
This resulted in hair drawing with an offset if an instance_offset was
set.

note: Usually the instance_offset gets combined with the objects obmat
in 'make_duplis_collection' / 'make_dupli', see
> /* Combine collection offset and `obmat`. */
Using the resulting DupliObject->mat instead does include the
instance_offset, but this results in double-transforms (something that I
have not investigated further), so now reconstruct the correct matrix
from scratch.

Maniphest Tasks: T85301

Differential Revision: https://developer.blender.org/D10285
2021-02-02 15:32:35 +01:00
Miguel Pozo
1428544528 Python API: option for render engines to delegate Freestyle render to Eevee
Eevee is now used for Freestyle rendering by default, since other engines are
unlikely to have support for this. Workbench and Cycles do their own rendering.

RenderEngine add-ons can do their own Freestyle rendering by setting
bl_use_custom_freestyle = True.

Differential Revision: https://developer.blender.org/D8335
2021-02-02 14:19:04 +01:00
e3c8363ce0 Fix T83064: Missing tooltips, caused by string property search button
When a searchbox-button for string properties (e.g. to reference a vertex
group) was created, and a value was set, the tooltip timer would constantly get
cancelled.
That was because the code to validate the current value
(`ui_but_search_refresh()` - early exists for non-string properties) would call
a helper function to update the search results (`ui_searchbox_update_fn()`),
which always reset tooltips. Resetting them in the helper makes sense, for as
long as the searchbox is open. But while it's not, and we just validate the
current value, it shouldn't do this.

This was also noticable in the output settings of dynamic paint, and probably a
number of other cases (especially with script UIs which tend to use string
properties more often).

Likely caused by de53c039ad.
2021-02-02 13:54:18 +01:00
f3a2434bb6 Cleanup: Use bool instead of int 2021-02-02 13:54:18 +01:00
fed191fd89 Cleanup: take grid reference instead of shared pointer as parameter
This makes the function usable in more contexts.
2021-02-02 13:17:51 +01:00
Brecht Van Lommel
886486615b macOS: use precompiled libraries for arm64 build
Standard wiki build instructions for building Blender on macOS can now be used
on Macs with ARM processors.

This contains all libraries except for Embree and OpenImageDenoise, so Cycles
performance does not yet have full performance and features in this build. An
x86-64 build is likely to still render faster than arm64 until Embree is added.

Uses the new lib/darwin_arm64 folder. For simplicity and to keep download size
under control, both for end users and builders, we are not planning to ship
universal binaries. So this is a separate folder from lib/darwin.

Ref T78710

Differential Revision: https://developer.blender.org/D10276
2021-02-02 12:08:23 +01:00
62419975b7 macOS: fix warning about unkown GPU with Apple M1 chip 2021-02-02 12:08:23 +01:00
d19aaad0bc Fix regression: Crash garbage collecting VBOs on never evaluated scenes
Committing fix again, since it is somehow got lost when merging release
branch into master.
2021-02-02 11:10:56 +01:00
356c62fe32 Merge branch 'blender-v2.92-release' 2021-02-02 19:36:18 +11:00
1d77302fd9 creator: add missing '--debug-*' arguments under debugging options
Only print "Other Options" when the heading has content to show.
2021-02-02 19:34:47 +11:00
bde797c172 Merge branch 'blender-v2.92-release' 2021-02-02 09:33:05 +01:00
d917d7cf94 Fix T85194: Smart UV does not respect "Correct Aspect" correctly
This lead to wrong, stretched UVs regardless of the ON/OFF state of
"Correct Aspect" option (some code in the operator respected this
setting properly, whereas it was hardcoded in another part).

Before rB9296ba867462, `uvedit_pack_islands_multi` was always called
with `correct_aspect` = false for the UnwrapOptions.
After rB9296ba867462, `ED_uvedit_pack_islands_multi` was always called
with `correct_aspect` = true for the UVPackIsland_Params.

Both seem wrong [in that they do not take the operator setting into
account]. Now respect that setting [same as the following
`uv_map_clip_correct_multi` does as well btw.]

Now results match 2.90 [where this was still python] perfectly.

Maniphest Tasks: T85194

Differential Revision: https://developer.blender.org/D10246
2021-02-02 09:30:58 +01:00
1422c28ef1 Merge branch 'blender-v2.92-release' 2021-02-02 19:18:20 +11:00
3ae74bcd29 cmake/deps: remove 'tcl' language support from sqlite
Build sqlite without `tcl` support, as it's causes an error on
installation when `tcl` is installed into the systems `/usr/lib/` and
install isn't running as root.

This could be resolves by adding `tcl` as a dependency
however it's not needed for Python's sqlite integration.

Linux distributions (Debian & Arch at least) split this off
into a separate package (which Python doesn't depend on),
so there is no need for Blender to include sqlite's `tcl`
integration either.

Reviewed By: brecht, LazyDodo

Ref D10281
2021-02-02 19:12:45 +11:00
33b8063b1f CMake: Remove duplicated code for Haru-TIFF dependency. 2021-02-02 02:15:40 +05:30
038d72752d CMake/Windows: Fix build issue in lite+haru
Haru depends on some symbols defined in libtiff
which will cause linker errors if not enabled.
Disable haru if WITH_IMAGE_TIFF is off.
2021-02-01 11:35:23 -07:00
59054d906f CMake/Windows/macOS: Add Libharu
Decision: https://lists.blender.org/pipermail/bf-committers/2020-December/050836.html
Adds CMake dependency builder support. Tested on
macOS and Windows (Thanks @LazyDodo).

Reviewed By: #platform_macos, LazyDodo, sebbas
Maniphest Task: T84836
Differential Revision: https://developer.blender.org/D9928
2021-02-01 21:58:57 +05:30
84dddf641e Merge branch 'blender-v2.92-release' 2021-02-01 16:40:43 +01:00
d5d8655ca1 Fix T81843 Bones invisible using Weight Paint + Wireframe shading + Bone X-Ray
This was caused by the paint overlay drawing after the infront pass.

Moving the paint overlay before it fixes the issue. We might even do
that for more mode overlays.
2021-02-01 16:40:23 +01:00
bc41aaaaaa Overlay: Fix Z axis planes rendered even if not needed
This remove some drawn completely transparent pixels.
2021-02-01 16:40:23 +01:00
5ec9e3a26e Merge branch 'blender-v2.92-release' 2021-02-01 16:27:42 +01:00
006e70dbd7 Fix T85203: GPencil: Drawing on locked axis plane
Drawing on e.g. the X-Z plane was broken due to an earlier
commit (rBef28da262342). This was causing the projection when drawing
on an axis plane to fail.

The fix checks that the user is in view plane projection mode.

Reviewed By: antoniov

Maniphest Tasks: T85203

Differential Revision: https://developer.blender.org/D10252
2021-02-01 16:26:31 +01:00
82e2d70024 Merge branch 'blender-v2.92-release' 2021-02-01 15:20:01 +01:00
a69983f30e Fix T85229: Transform operator saving a different orientation than the chosen one
Some orientations are not possible to be calculated for certain scenes.

In these cases, others are chosen and informed by the operator.

However, the user may prefer that the chosen one be displayed (even if it
is not actually used).

This corresponds to older versions of Blender.
2021-02-01 11:16:58 -03:00
c02f2d7371 Fix T81177 EEVEE: Missing shadow if last material has no shadow
This was caused by the boolean not being a union of all the material
slots.
2021-02-01 14:54:08 +01:00
9e9ebaba8d Fix crash when creating lib overrides.
Own mistake in recent commit rB2a81d948ad00c50.
2021-02-01 14:09:49 +01:00
88d9eb14d1 Merge branch 'blender-v2.92-release' 2021-02-01 14:01:33 +01:00
d1ee8a0502 DRW: Fix render wrong orthographic depth conversion
Fix for both workbench and Gpencil.

Fixes T78574 GPencil: Z pass combine not work
2021-02-01 14:00:08 +01:00
f04ddd398f Merge branch 'blender-v2.92-release' 2021-02-01 13:41:21 +01:00
03c1c5f3a4 GPU: Fix performance regression on AMD GPU
This was caused by a missing check left over during the GL isolation.

Fix T84277 Solid and Wireframe viewport performance hit on AMD Radeon GPUs
2021-02-01 13:41:07 +01:00
5c72a4d452 Fix T84780: Corrupt screen layout when loading file with area full-screen
This could happen with files saved before ef4aa42ea4, so before global areas
were written to .blend files.
We would just always add the top- and status-bar, even though the screen wasn't
supposed to have them. I'm not entirely sure what caused the further issues
observed there, most code should probably handle the case fine still. But
apparently something didn't.

Steps to reproduce were:
* Open Blender from before ef4aa42ea4 (e.g 2.91 release)
* In 3D View, View > Area > Toggle Fullscreen Area
* Save the file
* Open the saved file (can be in newer version too)
The fullscreen is corrupt now, especially noticable after duplicating the
workspace.
2021-02-01 12:48:05 +01:00
fa2ffb1a2f Merge branch 'blender-v2.92-release' 2021-02-01 12:01:23 +01:00
5e117b1226 Usual UI messages fix... 2021-02-01 12:00:32 +01:00
f4cb93b55d Merge branch 'blender-v2.92-release' 2021-02-01 11:03:13 +01:00
d857892553 VSE: Fix proxy images have incorrect size
This bug happens when media size doesn't match scene size and proxies
are enabled. This is because some strips are rendered in preview size
already -  effects, mask or strips using proxies.
If strip input is prescaled it needs to be known when transforming
images, which does also scaling to preview size as one operation.

whether image needs prescaling is defined in function
`seq_need_scale_to_render_size()`

Problem was introduced in 5713626422. Previously all images were
scaled to fit into preview, and this was considered as baseline for
further image transformation.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10183
2021-02-01 11:02:25 +01:00
e94c38e005 Merge branch 'blender-v2.92-release' 2021-02-01 11:01:29 +01:00
54ac63f06b Fix T85252: Gpencil interpolate sequence crash in new scenes
The value of the step was not initializated for new scenes.
2021-02-01 11:00:50 +01:00
1e55d28a4e Fix T85035: Gpencil render in background render wrong frame
Due a thread priority, the calculation of the current frame is not done before the frames are available. This produces wrong render frames.

The solution is verify the current frame before doing the real render. This adds only a few milliseconds, but it assures the frame is correct.

As the problem is only when render in background, the recalculation of the frame is only necessary when do real render and not a viewport render, so there is no impact in the animation FPS.
2021-02-01 10:27:03 +01:00
9c244820d1 Merge branch 'blender-v2.92-release' 2021-02-01 10:00:45 +01:00
30ac21bf33 Fix regression: Crash garbage collecting VBOs on never evaluated scenes
Introduced in rB087777f2b9b8.

Fixes issues with scene from T82808.
2021-02-01 09:59:09 +01:00
b10fac0432 Docs: Remove wrong debug flag info
Removed the `--debug-gpu-shaders` argument in bc94036a76 but forgot to amend
these changes.
2021-01-31 15:53:09 +01:00
d4aa5b2166 Merge branch 'blender-v2.92-release'
# Conflicts:
#	source/blender/editors/transform/transform_constraints.c
2021-01-31 10:36:01 -03:00
a9b53daf23 Fix T83092: Direction of rotation with View orientation changed in 2.91
This solution replaces {rBf9e994d0f463}.

That commit created an inverted orientation matrix but the 'Align to
Transform Orientation' operator doesn't work well with inverted matrices.

This new solution makes the rotate operator use the negative vector of the
axis.
2021-01-31 10:31:15 -03:00
c828a505c2 Revert "Fix T83092: Direction of rotation with View orientation changed in 2.91"
This reverts commit f9e994d0f4.
And fixes T85227.

That commit created an inverted orientation matrix but the 'Align to
Transform Orientation' operator doesn't work well with inverted matrices.
2021-01-31 10:30:02 -03:00
419c67c851 Fix error in recent commit
Unused argument in rB216ebe0b7392d6
2021-01-31 10:26:54 -03:00
a80c0ee167 Revert "Cleanup: remove unused argument"
This reverts commit 780857f8e8.

The `axismtx` argument was supposed to be used.
2021-01-31 10:26:36 -03:00
194f6c7880 Merge branch 'blender-v2.92-release' 2021-01-31 19:45:15 +11:00
fecce5dc09 Fix T85236: "Zoom to Mouse Position" inverts "Dolly View" direction 2021-01-31 19:44:01 +11:00
088fbc0286 Cleanup: remove unused BMesh.currentop struct member 2021-01-31 18:20:12 +11:00
e6a5e548d5 Cleanup: correct and update comments for bmesh walkers
- Correct variable names which were missed when refactoring.
- Use full sentences.
2021-01-31 17:42:42 +11:00
6b8f28a6b5 Cleanup: use doxygen for transform_constraints 2021-01-31 17:23:46 +11:00
1939911c54 Merge branch 'blender-v2.92-release' 2021-01-31 17:16:16 +11:00
780857f8e8 Cleanup: remove unused argument 2021-01-31 17:15:58 +11:00
cdf01f7750 Cleanup: use switch for Add Object Tool event handling 2021-01-31 17:05:12 +11:00
2e84edea97 Add Object Tool: make automatic axis selection an option
While useful in some cases, this meant it wasn't possible to use the
"Floor" for object placement without looking top-down or bottom up.
2021-01-31 17:05:12 +11:00
ae3fee3f47 Merge branch 'blender-v2.92-release' 2021-01-30 21:54:10 -07:00
7a64e93761 Fix T79797: Compositor backdrop gizmo not updating after zoom
The gizmo for the compositor backdrop image did not redraw when zooming
in and out with the backimage_zoom operator. This adds the missing
notifier.
2021-01-30 21:49:56 -07:00
016bd284fb Fix T84465 Bevel Percent and Absolute when limit type is Weight.
The previous fix to the width modes Percent and Absolute did
not take into account that with limit mode Weight, the amount
needs to be scaled by the bevel weight of the beveled edge in
question. (Sometimes there are two beveled edges in question,
in which case an average is used.)
2021-01-30 15:58:08 -05:00
40061911d2 Fix T84465 Bevel Percent and Absolute when limit type is Weight.
The previous fix to the width modes Percent and Absolute did
not take into account that with limit mode Weight, the amount
needs to be scaled by the bevel weight of the beveled edge in
question. (Sometimes there are two beveled edges in question,
in which case an average is used.)
2021-01-30 15:50:58 -05:00
38bb263422 Fix T81193 EEVEE: Crash when motion blur is aborted at cache finish
This was caused by a use after free. The issue was that the motion steps
were successfully gathered but failling the last vertex count check,
discarding the copied VBOs but not removing the reference of the first
VBO which was passing the test.
2021-01-30 16:56:38 +01:00
216ebe0b73 Fix T83092: Direction of rotation with View orientation changed in 2.91
This solution replaces {rBf9e994d0f463}.

That commit created an inverted orientation matrix but the 'Align to
Transform Orientation' operator doesn't work well with inverted matrices.

This new solution makes the rotate operator use the negative vector of the
axis.
2021-01-30 12:55:07 -03:00
acc662ea5a Revert "Fix T83092: Direction of rotation with View orientation changed in 2.91"
This reverts commit f9e994d0f4.
And fixes T85227.

That commit created an inverted orientation matrix but the 'Align to
Transform Orientation' operator doesn't work well with inverted matrices.
2021-01-30 12:51:03 -03:00
3a954af862 EEVEE: Fix crash when using animated visibility with motion blur steps
This was caused by the same VBO being remapped twice by
`EEVEE_motion_blur_cache_finish`. Leading to memory corruption.
2021-01-30 16:35:52 +01:00
036b65d778 Fix T85149: Wrong reroute position when adding with quick gesture
In the operation of adding reroute node to the intersection with the
gesture segment, each rerount was added to the middle of two points that
are part of the segment.

Now add the reroute point to the intersection position.

Maniphest Tasks: T85149

Differential Revision: https://developer.blender.org/D10247
2021-01-30 10:46:05 -03:00
c96b1e4cda EEVEE: Depth of field: Fix incorrect prediction for holefill tiles
Holefill is only needed if having foreground elements in the tile.
2021-01-30 00:14:45 +01:00
f12338f3ce EEVEE: Depth of field: Improve slight defocus opacity estimation
This correct the opacity estimate (for some reason the number of samples
returned by dof_gather_total_sample_count is wrong and ring_count needs
to be incremented).

Also adds a bias towards the focused area to improve the transition to
fully opaque.
2021-01-29 23:46:05 +01:00
e6d0a5be0e EEVEE: Depth of field: Bleed more background over in-focus area
Improves water-tightness.
2021-01-29 23:34:05 +01:00
d0f59d3842 Fix T85144: Cycles crashes when editing render properties in viewport
rendering

Issue was caused by the sample pattern LUT always being freed and not
rebuilt when properties driving its dimensions were modified.
2021-01-29 17:35:28 +01:00
171f2e4949 Merge branch 'blender-v2.92-release' 2021-01-29 17:09:58 +01:00
Michael Möller
5d215d5225 EEVEE: Fix GPUNodeLink memory leak for displacement nodes using SHD_SPACE_WORLD
When the displacement space is set to SHD_SPACE_WORLD, the GLSL method
"node_displacement_world" is used instead of the "node_displacement_object" method. The two GLSL methods:
```
void node_displacement_object(
    float height, float midlevel, float scale, vec3 N, mat4 obmat, out vec3 result)
{
  N = (vec4(N, 0.0) * obmat).xyz;
  result = (height - midlevel) * scale * normalize(N);
  result = (obmat * vec4(result, 0.0)).xyz;
}

void node_displacement_world(float height, float midlevel, float scale, vec3 N, out vec3 result)
{
  result = (height - midlevel) * scale * normalize(N);
}
```
In contrast to the "node_displacement_object" method, the "node_displacement_world"
does not require an "obmat" parameter. Attempting to still pass "GPU_builtin(GPU_OBJECT_MATRIX)"
as additional parameter will result in a memory leak. The "GPUNodeLink" allocated in
the "GPU_builtin" method will never get released.

Fixes T83941 Memory leak when using the Displacement shader node in Eevee with the displacement
space set to "World Space"
2021-01-29 17:08:46 +01:00
c7d75a6616 Merge branch 'blender-v2.92-release' 2021-01-29 16:06:11 +01:00
b3fc885544 Depsgraph: Remove redundant copy-on-write operations
This change removes copy-on-write operations from ID nodes which do not
need copy-on-write.

Should be no functional changes, as before the copy-on-write operation
would do nothing for those nodes anyway.
2021-01-29 15:52:53 +01:00
876fd40643 Fix T83411: Crash when using a workspace/layout data path in a driver
Building IDs which are not covered by copy-on-write process was not
implemented, which was causing parameters block not present, and, hence
causing crashes in areas which expected parameters to present.

First part of this change is related on making it so Copy-on-Write is
optional for ID nodes in the dependency graph.

Second part is related on using a generic builder for all ID types
which were not covered by Copy-on-Write before.

The final part is related on making it so build_id() is properly
handling ParticleSettings and Grease Pencil Data. Before they were not
covered there at all, and they need special handling because they do
have own build functions.

Not sure it worth trying to split those parts, as they are related to
each other and are not really possible to be tested standalone. Open
for a second opinion though.

Possible nut-tightening is to re-organize build_id() function so
that every branch does return and have an assert at the end, so that
missing ID type in the switch statement is easier to spot even when
using compilers which do not report missing switch cases.

As for question "why not use default" the answer is: to make it more
explicit and clear what is a decision when adding new ID types. We do
not want to quietly fall-back to a non-copy-on-write case for a newly
added ID types.

Differential Revision: https://developer.blender.org/D10075
2021-01-29 15:52:53 +01:00
0e37d3efc0 Fix T84717: missing 3D viewport updates when changing shading settings
Previously this relied on the dependency graph to detect changes in the screen
datablock, which would then notify the renderers. This was rather indirect an
not even really by design. Instead use notifiers to tag specific 3D viewports
to be updated.

Includes changes to BKE_scene_get_depsgraph to accept a const Scene pointer.

Testing if this works correctly requires adding back commits 81d444c and 088904d,
since those have been temporarily reverted.

Differential Revision: https://developer.blender.org/D10235
2021-01-29 15:52:53 +01:00
087777f2b9 Cleanup: accept const pointer for BKE_scene_get_depsgraph 2021-01-29 15:52:53 +01:00
7d6f58271b EEVEE: Depth of field: Fix tile prediction and fast gather threshold
Tile prediction wasn't using the correct threshold and fast gathering
wasn't taking layer weight into consideration.

Both were making tilling artifacts.
2021-01-29 15:29:54 +01:00
cacc1d723c Fix T81169: Grease Pencil Z-depth drawing issue on OSX + AMD Graphic Cards
The grease pencil merge depth shader is designed to only work correctly
in octographic mode. The uv coordinates used `noperspective` attribute.
Somehow this doesn't lead to render artifacts on most platforms and was
only detected on OSX + AMD cards.

This fix would calculate the uv coordinate inside the fragment shader
and isn't passed along from the vertex shader.

Thanks to Sebastián Barschkis for providing the hardware and time and
Clément Foucault for helping out with the final fix.
2021-01-29 15:19:01 +01:00
bc94036a76 GPU: Remove unused GPU debugging command line options
Removes two unused --debug-gpu command line flags (unused as in, does nothing):
* `--debug-gpumem`: Unused since c08d847488, the info is now available in
  the status-bar if enabled in the Preferences. Initially added in
  fec317de8d.
* `--debug-gpu-shaders`: Unused since 216d78687d, double checked with
  Clément, he says it's not that useful nowadays. Initially added in
  fec317de8d.

Addresses T83954 and T83953.

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

Reviewed by: Clément Foucault
2021-01-29 14:17:49 +01:00
75e8e01124 Fix wrong command line argument description for --debug--gpu-force-workarounds
Was using the same description as `--debug-gpumem`.

`--debug-gpu-shaders` actually has the same issue, but will be removed in the
next commit.
2021-01-29 14:13:30 +01:00
b2e00e8f8e Merge branch 'blender-v2.92-release' 2021-01-29 13:35:21 +01:00
9f89166b52 Fix T85148: OptiX viewport denoising regression
Commit 6e74a8b69f changed the denoiser input passes default to
include the normal pass. This does not always produce optimal images though, hence why the
default was previously set to only include the color and albedo passes. This restores that behavior, so
that viewport denoising with OptiX produces the same results as before.
2021-01-29 13:35:00 +01:00
b8feac9c81 Merge branch 'blender-v2.92-release' 2021-01-29 13:16:41 +01:00
Robert Guetzkow
821df20797 Fix T84588: Set parameter as required for uv_on_emitter
This commit fixes T84588's second issue. The `particle` parameter was
declared optional in the Python API of `bpy.types.ParticleSystem.uv_on_emitter`
due to a typo in the RNA definition. This commit marks it as required.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D10127
2021-01-29 13:10:54 +01:00
02bb3595d0 Merge branch 'blender-v2.92-release' 2021-01-29 12:58:39 +01:00
1b32679284 Fix T85169: UV scale gizmo swaps X/Y
Introduced with swapped axis in rB0d67eb277f9b.
Similar was fixed for the translate gizmo in rB567212c3434a.
Now do the same for scaling as well.

Maniphest Tasks: T85169

Differential Revision: https://developer.blender.org/D10245
2021-01-29 12:56:08 +01:00
bc794109db Merge branch 'blender-v2.92-release' 2021-01-29 22:31:24 +11:00
cf91fb347d Fix T85178: edit-mesh show_edges overlay option toggles face-dots
When this behavior was added it made sense,
since then show_edges has changed to make edge-display more subtle
(see 1a4b60c30d) instead of removing
edge-selection display entirely.
2021-01-29 22:30:02 +11:00
954af8c182 Geometry Nodes: missing null check for volume objects
The problem was found by Dalai in T84606.
2021-01-29 11:44:30 +01:00
b62e98d4e2 Merge branch 'blender-v2.92-release' 2021-01-29 11:38:33 +01:00
6f88053d85 Fix T84661: read jpg pixel density
For jpeg, an image.resolution was always based on the default 72dpi, now
read the pixel density from the jpeg_decompress_struct, convert
according to unit and store in IMBuf's ppm.

Not 100% sure of all implications tbh., files I have checked seem to work
as expected now in the context of the report.

Maniphest Tasks: T84661

Differential Revision: https://developer.blender.org/D10166
2021-01-29 11:07:58 +01:00
45d952e045 Merge branch 'blender-v2.92-release' 2021-01-29 10:21:17 +01:00
3fb5e83867 Fix T85139: Force field texture missing depsgraph relation
If a force field was of type "Texture", any changes of that texture (e.g.
its type - as reported in T85139 - or also its properties) were not
properly updating rigid bodies and particle systems.

Now ensure that texture is actually in the depsgraph and set up relation
accordingly.

Also fixes T75198.

Maniphest Tasks: T85139

Differential Revision: https://developer.blender.org/D10234
2021-01-29 10:18:53 +01:00
27e2c5ab78 Tests, docs: Use sanitizer options from environment too.
Don't overwrite environment variables that may
contain options like suppression files, symboliser etc.
It's similar to rBa181b156399a13fa429159112e30c8005d5e8a59
and rBA589d13408a60cbec34a8bc3cc798c586043743ae .
For Blender Add-ons repo, see the equivalent in D9816.

Reviewed By: Blendify
Differential Revision: https://developer.blender.org/D9815
2021-01-29 14:13:26 +05:30
16fab8ebc4 Cleanup: git-blame-ignore-revs: Update policy & commits
Discussion:
https://lists.blender.org/pipermail/bf-committers/2020-December/thread.html#50844

*Remove clang-tidy commits altogether as they have a history of
introducing bugs/ build issues.
*Remove renames.

Reviewed By: brecht
Differential Revision: https://developer.blender.org/D9986
2021-01-29 13:20:32 +05:30
ca4ac742f4 UI: clarify edit-mesh face center behavior
- Grey out in wire/xray display.
- Expand the description for when this is used.

While this is working, the intended behavior wasn't clear,
address T85177.
2021-01-29 16:41:15 +11:00
93706de594 Docs: notes on the 2.7x keymap
Note the key-map items that don't match the original 2.7x key-map,
since some of these are quite obscure.
2021-01-29 16:00:23 +11:00
cba5d38256 Merge branch 'blender-v2.92-release' 2021-01-29 11:44:13 +11:00
3e5091bb21 Merge branch 'blender-v2.92-release' 2021-01-29 11:44:08 +11:00
b2ce1b0758 Cleanup: rename variables for gizmo templates
The abbreviation was from 'manipulator',
which was changed to gizmo during development.

Also correct operator description.
2021-01-29 11:43:19 +11:00
82b06f3112 PyAPI: Add error when registering a 3D gizmo into a 2D gizmo group
Address issue raised in T85145.
2021-01-29 11:43:14 +11:00
f560dc6892 Cleanup: rename variables for gizmo templates
The abbreviation was from 'manipulator',
which was changed to gizmo during development.

Also correct operator description.
2021-01-29 11:33:54 +11:00
b0ab4b815a PyAPI: Add error when registering a 3D gizmo into a 2D gizmo group
Address issue raised in T85145.
2021-01-29 11:12:57 +11:00
213f8294b5 Fix T84906: Loop select can fail when starting from an ngon
When stepping over an ngon's edges, check the number of edges & faces,
to ensure the topology connected to the ngon would be walked along.
2021-01-29 10:06:56 +11:00
1e355b0992 Docs: add diagrams describing the purpose of BMwEdgeLoopWalker.f_hub
Without this the purpose of this feature isn't clear.

While 01b3e9cc9f linked to an image,
add inline ascii diagrams with detailed explanations.
2021-01-29 10:06:52 +11:00
92b0803f35 Merge branch 'blender-v2.92-release' 2021-01-28 16:25:59 -06:00
71cb6923f5 Fix T83988: Active modifier outline uses search theme color
The outline for the active modifier was abusing the property search
match theme color, as noted in a comment. This commit adds a new
theme color in RNA specifically for the active modifier outline.
2021-01-28 16:16:24 -06:00
323b7ad9cd Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-28 22:59:18 +01:00
2f60e5d1b5 Cleanup: Move geonodes object info RNA enum
This enum is only used by the node. So it does not need to be declared outside
the scope of its function.

Originally I thought this may be relevant to the collection info node as well,
but the patch for it is defining its own enums.
2021-01-28 22:44:20 +01:00
7a62574338 Cleanup: Reduce variable scope
Also some minimal white space changes
2021-01-28 13:52:39 -06:00
5db9a008b9 EEVEE: Depth Of Field: Fix jittered dof breaking screenspace effects
This was the case in perspective view. Seems like changing the projmat
origin was the issue. Instead we rely on window_translate_m4 to skew
the matrix and jitter the viewmat position to offset the origin.
2021-01-28 19:32:03 +01:00
099788c3e8 EEVEE: Depth Of Field: Flip bokeh shape on foreground.
This is to mimic optical phenomenon and also match jittered DOF.
2021-01-28 19:29:12 +01:00
fcb7b0adcc Fix T85157: join node not working when the second mesh is empty
The issue was that the `offset` in `dst_span[offset]` was out of bounds
when the domain size is 0. The fix is to simply skip copying attributes
in that case.
2021-01-28 17:03:34 +01:00
e58ef7db5b Merge branch 'master' into eevee-dof-refactor 2021-01-28 15:16:15 +01:00
9c4dbb592b EEVEE: Depth Of Field: UI: Change Jitter option name & tooltip 2021-01-28 15:14:55 +01:00
57fc9f6082 EEVEE: Depth Of Field: Add minimal overblur radius
This makes jittered Dof much easier to use as it scales itself
with the number of samples.
2021-01-28 15:06:35 +01:00
fc6b04d4e3 EEVEE: Depth Of Field: Add new jittered Dof
This is a new method to increase quality of the Depth of field.

This works by jittering the camera for every sample. This needs a lot of
samples to converge to something smooth. The new overblur parameter is
introduced to blur each sample to make it noisefree faster at the cost
of accuracy.
2021-01-28 14:32:02 +01:00
4b04818d79 EEVEE: Depth Of Field: Reintroduce the extra offset for convolution
This is really needed for watertighteness and avoid background leaking.
2021-01-28 14:26:40 +01:00
c8b324fe90 EEVEE: Depth Of Field: Fix orthographic view Circle of confusion
Orthographic view depth of field was broken since day one it seems.
2021-01-28 14:22:58 +01:00
133966423a Revert "Depsgraph: Remove redundant copy-on-write operations"
This reverts commit 76fd41e9db. This should have
been reverted along with 0f95f51361, since this
change by itself is causing crashes when the depsgraph accesses a non-existent
copy-on-write component.

Ref T84717
2021-01-28 13:16:49 +01:00
a51ff5208b Fix alpha transparency slider range being influenced by RGB values
For buttons that edit array properties, the soft min/max and slider ranges are
based on the range of all values in the array. However for alpha this does not
make much sense, the only reasonable range is 0..1 even when there are RGB
values larger than 1. So treat alpha as an individual property.
2021-01-28 13:16:49 +01:00
3c7d5ec829 Surface Deform: fix binding vertex artifacts causing spikes.
There are two issues here. First, like in T81988 there are cases
where the modifier would deform some vertices immediately after
bind. This is caused by wrong assumptions in the code about the
possible relative angles between various vectors, which can cause
negative weights that don't blend correctly to appear.

Specifically, it seems originally the code assumes that the
centroid-point vector in the polygon plane lies somewhere
between the mid-edge vectors. This is however not necessarily
the case for distant vertices, because the polygon is not
guaranteed to be truly planar, so normal projection may be
a bit off. The code has to use signed angles and checks to
support all possible angular arrangements.

The second issue is very thin and long triangles, which tend
to be very spatially unstable in their thin dimension, resulting
in excess deformation. The code was weighting distance using
the distances between the centroid and the mid-edge points, which
in this case end up as nearly opposite vectors of sizable length
and don't correctly represent how thin the triangle actually is.
It is thus better to use centroid-to-line distances, and an
additional even stricter value for the midpoint that will use
only 3 vertices at evaluation time.

Differential Revision: https://developer.blender.org/D10065
2021-01-28 14:42:53 +03:00
a6b31af37e Merge branch 'blender-v2.92-release' 2021-01-28 12:36:13 +01:00
Yevgeny Makarov
3726aa68c3 Fix T83935: Superimposed icon's hotspot is misaligned
Now the icon's rect are drawn wider than it should be, and with
overlapping, probably in order to compensate for the icon's offsets
inside the rect. The solution is to draw icon's rect of the correct
size and center the icon itself.

And make the hotspot exactly match the icon's rect. The last/right
button's hotspot also covers the extra padding on the right.

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

Reviewed by: Julian Eisel
2021-01-28 12:36:00 +01:00
Yevgeny Makarov
6f054f5ac7 Fix T83935: Superimposed icon's hotspot is misaligned
Now the icon's rect are drawn wider than it should be, and with
overlapping, probably in order to compensate for the icon's offsets
inside the rect. The solution is to draw icon's rect of the correct
size and center the icon itself.

And make the hotspot exactly match the icon's rect. The last/right
button's hotspot also covers the extra padding on the right.

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

Reviewed by: Julian Eisel
2021-01-28 12:33:46 +01:00
c0d2b10c59 Fix T69001: Custom icons won't load while using workbench engine
Preview icons (e.g. material preview or other data-block previews) use the same
background-job code as deferred loading of custom icons/previews. There was a
check to skip preview generation if the render engine does not support preview
rendering mode, which workbench doesn't. However this check should only be used
when actually rendering a preview, not when doing deferred loading.
2021-01-28 12:23:15 +01:00
0bd2f18a85 Merge branch 'blender-v2.92-release' 2021-01-28 22:11:20 +11:00
07e66f58cc Fix T85121: Sequencer key conflict with Lock & Select Linked
"Lock Strips" (Shift-L), conflicted with "Select Pick Linked".

Use Ctrl-H, Ctrl-Alt-H for lock & unlock since selected linked
uses bindings which are used in other parts of Blender.
2021-01-28 22:06:05 +11:00
a64a8d2b79 Cleanup: spelling
Also remove replace 'playblast' with terminology used in Blender's UI.
2021-01-28 22:02:11 +11:00
dfcfc8ee95 Merge branch 'blender-v2.92-release' 2021-01-28 21:56:10 +11:00
8948f73784 Fix T81334: Python view-port drawing depth-test regression
Since 216d78687d the depth function
(glDepthFunc) was left in an undefined state for drawing callbacks that
use the `bgl` module.

This meant enabling depth-test from Python's bgl module also needed
to set the depth function (which previously wasn't necessary).

Set the depth function as part of GPU_bgl_start
2021-01-28 21:53:56 +11:00
bf721fb679 Fix panning with Lock-to-Selection and no selection in Clip Editor
Rather self-explanatory. Never worked since the initial implementation.
It is possible to preserve lock-to-selection option with no selection
nowadays (since the fix for T84850). So now the Lock-to-Selection option
is fully under user control. Surely, the panning and zooming is also
properly supported now in the described scenario.

Differential Revision: https://developer.blender.org/D10226
2021-01-28 11:34:53 +01:00
3b66f40d40 Fix T85124: Undo assert changing property in redo panel.
Logical mistake in recent refactor (rB2a8122fb65c5).
2021-01-28 11:33:37 +01:00
573bda1fae Fix unused result from mmap() call
The unused result was reported by Clang-Tidy 11.

It does make sense to check for the failed mmap() calls rather than
quietly suppress errors.

In this change failures are reported, but application execution is
not aborted. This is a bit disputable, but it feels to be a safer
thing to do now.

It is unclear how to test the code though, as we don't have any
tools in-place to simulate read errors.

Differential Revision: https://developer.blender.org/D10223
2021-01-28 11:05:38 +01:00
92567c072a Cleanup: Fix clang format
Due a problem in the mergetool, the clang format was totally wrong in the previous commit.
2021-01-28 11:02:49 +01:00
8214a63493 Merge branch 'blender-v2.92-release' 2021-01-28 10:54:20 +01:00
Habib Gahbiche
51c8d53a7d Fix T84512: Crash if size input of Blur node is too large
Gaussian filter with a too large kernel doesn't make much sense.
This commit caps the Gaussian function radius to MAX_GAUSSTAB_RADIUS.

Reviewed By: sergey

Maniphest Tasks: T84512

Differential Revision: https://developer.blender.org/D10122
2021-01-28 10:43:46 +01:00
7000eb00f8 Merge branch 'blender-v2.92-release' 2021-01-28 10:37:19 +01:00
b379f626ce Fix T85035: Gpencil render in background render wrong frame
Due a thread priority, the calculation of the current frame is not done before the frames are available. This produces wrong render frames.

The solution is verify the current frame before doing the real render. This adds only a few milliseconds, but it assures the frame is correct.

As the problem is only when render in background, the recalculation of the frame is only necessary when do real render and not a viewport render, so there is no impact in the animation FPS.
2021-01-28 10:36:05 +01:00
9fdb32bf51 Merge branch 'blender-v2.92-release' 2021-01-28 10:34:33 +01:00
61d1fd7e2f Fix T85142: BMW scene quits Blender
Technically, the crash was caused by revert which happened in
rBcd24712c2c5: it reverted some code which is essential for
rB76fd41e9db1.

Bring back the essential code for the removal of un-needed
Copy-on-Write operations, so that the crash doesn't happen.

What was causing the crash is the ID tag assuming Copy-on-Write
operation always exists.
2021-01-28 10:34:18 +01:00
39cfc95c2c Merge branch 'blender-v2.92-release' 2021-01-28 18:54:45 +11:00
78f7377c88 Fix T85107: Active tool doesn't update when mouse is already over it 2021-01-28 18:53:03 +11:00
fcda0c7eb9 Merge branch 'blender-v2.92-release' 2021-01-28 18:27:53 +11:00
9509e18564 Fix T82785: Setting Image.alpha_mode clears generated image data 2021-01-28 18:27:25 +11:00
c1c77b7b9a Merge branch 'blender-v2.92-release' 2021-01-28 16:23:01 +11:00
10e093b30d Fix T83539: 'activate_init' fails with buttons that have popups
Activating buttons was running too early, before the popup was
positioned on the screen,
causing data-selectors to be positioned incorrectly.

As the early button activation isn't needed, remove this call.

Ensure this doesn't happen again with an assert.
2021-01-28 16:12:43 +11:00
862aa2a66b Merge branch 'blender-v2.92-release' 2021-01-28 14:59:27 +11:00
e6a5e33c09 Merge branch 'blender-v2.92-release' 2021-01-28 14:59:24 +11:00
057859620d Merge branch 'blender-v2.92-release' 2021-01-28 14:59:20 +11:00
93412cb4e7 Fix jpeg200 4k cinema preset
Used the wrong define, also remove local defines.
2021-01-28 14:50:46 +11:00
87d3f4aff3 Fix T82675: Crash on exit when Blender is built as a Python module 2021-01-28 14:38:08 +11:00
198980693b Fix T84931: Keys that open menus can also activate menu items
Disable key-accelerators for key-repeat events.

When a key was held it could open the menu and activate the menu
item associated with that key.

With the RMB select option: edit-meshes & edge-selection caused
holding W to open & activate "Edge Bevel Weight".
2021-01-28 10:50:47 +11:00
df135b74fc PyAPI: use PYTHONUTF8/Py_UTF8Mode on all platforms
System encoding issues have been a paint-point for us with Python 3,
since Blender always uses UTF-8 which might not be the case for the OS.

While the Py_SetStandardStreamEncoding was already set to utf-8,
the file-system could still have an incompatible encoding.

See PEP-540 for details.
2021-01-28 09:47:05 +11:00
e285765a6b Fix incorrect RNA enum default
Also another copy and paste error in the attribute compare node.
2021-01-27 12:48:10 -06:00
3c84851142 EEVEE: Depth Of Field: Gather: Fix tiling artifact on foreground
Was caused by wrong tile prediction.
2021-01-27 19:28:04 +01:00
1f14c0d20c EEVEE: Depth Of Field: Gather: Fix polygonal dof radius being too big
The polygonal bokeh was outputing normalized UV but not the normal one.
2021-01-27 19:05:33 +01:00
24f09b8f55 EEVEE: Depth Of Field: Lower minimal CoC radius for scattering
Makes possible to have sharper bright spots.
2021-01-27 18:56:04 +01:00
e36f3da31c EEVEE: Depth Of Field: Cleanup: Add resolve pass description 2021-01-27 18:49:13 +01:00
3bb970f75a EEVEE: Depth Of Field: Cleanup: Share more define 2021-01-27 18:49:13 +01:00
c604fd56a7 Merge branch 'blender-v2.92-release' 2021-01-27 18:44:59 +01:00
37e60289c2 Fix T85110: moving markers num input confuses time vs frames
Looks like a typo in rB66b84ad1592d.

Maniphest Tasks: T85110

Differential Revision: https://developer.blender.org/D10225
2021-01-27 18:40:07 +01:00
ff74136da9 EEVEE: Depth Of Field: Tests: update shader tests 2021-01-27 18:31:11 +01:00
81235000d4 EEVEE: Depth Of Field: Cleanup: Share defines between C and GLSL 2021-01-27 18:30:51 +01:00
4c4ccdfa36 RNA: Add warning to float percentage property definition
As a followup to rBc71a8e837616159735, add a debug-only check for
incorrect range, when the percentage and factor functions were likely
confused.
2021-01-27 11:22:55 -06:00
c71a8e8376 UI: Fix incorrect RNA percentage property definitions
In two cases the percentage property was actually used incorrectly, as
pointed out in T82070. The range was [0, 1], but the properties were still
displayed as percentages.

There is a preference to control whether to display factors or
percentages, so it usually doesn't make sense to manually define
properties as percentages.

Resolves T82070

Differential Revision: https://developer.blender.org/D9344
2021-01-27 11:19:54 -06:00
0e39c526d8 Fix RNA debug build error after recent Sky texture altitude change
Reduce step size within the allowed range.
2021-01-27 17:54:38 +01:00
61e5c665b7 EEVEE: Depth Of Field: Fix fast gather tiles bleeding color
Seems like the dilation is too small for fast gathering to not bleed.
Introduce an arbitrary factor to fix this issue.
2021-01-27 17:11:02 +01:00
e1f2db669c EEVEE: Depth Of Field: Add high quality slight defocus option
This option is needed to avoid bumping the scene samples really high to
mitigate the noise and flickering introduced by slight defocus areas.
2021-01-27 17:09:35 +01:00
ded4940901 Fix possible dereference of nullptr mask 2021-01-27 16:54:29 +01:00
Marco
0af512abdf Sky Texture: change Nishita Altitude to use unit system
Differential Revision: https://developer.blender.org/D9968
2021-01-27 16:48:50 +01:00
a6ca6f5af7 EEVEE: Depth Of Field: Cleanup: Change precision of dof parameter 2021-01-27 16:32:40 +01:00
a8e3293b81 EEVEE: Depth Of Field: Fix jump in appearance when using bokeh texture
This was caused by a missing factor of 2.
Also fix issues with scatter bokeh size.
Remove fast_sqrt because it does not give the correct bokeh size and
cause noticeable jump between ratio = 1 and ratio > 1.
2021-01-27 16:23:04 +01:00
97e646b54a Documented color management issue.
When using the viewport render animation and saving to an 8 bit
image/movie file, the color management is applied twice. Once on the GPU
and once when saving to disk. Removing this option currently leads to
incorrect Scene strip rendering so needs more research.
2021-01-27 16:07:17 +01:00
a4d07bafc6 Cleanup: Moved update ratio stretching overlay to cache_finish 2021-01-27 16:07:17 +01:00
f83aa830cd Fix T83187: Unselected UVs shows selected on linked meshes.
When uv editing objects that share the same mesh only the selection
state can get confused. The cause is that the UV editor uses a
particular order of objects and store its state in the first object of a
mesh it hasn't handled. During drawing this state is updated into the
GPU buffers. In the case of linked meshes it can happen that the GPU
buffers are updated based on the object that does not have the correct
selection state making th selection VBOs incorrect.

This patch adds a work around that uses the order that the UV editor is
also using so the GPU buffers are built with the right data.
2021-01-27 16:07:17 +01:00
cfa97fd7f7 EEVEE: Depth Of Field: Fix apparent tiles on foreground limits 2021-01-27 16:05:56 +01:00
f48adcca64 EEVEE: Depth Of Field: Add denoising pass to stabilize bokeh highlights
Alike in the reference implementation, we stabilize the convolution
input. However, instead of a fullblown TAA pass, we just do neighborhood
clamping to avoid very bright pixels. We filter only spatially and not
temporaly.
2021-01-27 15:46:33 +01:00
9b80291412 Merge branch 'blender-v2.92-release' 2021-01-27 15:29:39 +01:00
James Horsley
4fbeb3e6be Fix T85089: Crash when rendering scene that does not fit into GPU memory with CUDA/OptiX
The "cuda_mem_map_mutex" was potentially being locked recursively during the call to
"CUDADevice::move_textures_to_host", which crashed. This moves around the locking and
unlocking of "cuda_mem_map_mutex", so that it doesn't call a function that locks it while
still holding the lock.

Reviewed By: pmoursnv

Maniphest Tasks: T85089, T84734

Differential Revision: https://developer.blender.org/D10219
2021-01-27 15:27:57 +01:00
6f7e2bf170 Fix T84329: Crash when loading the blender with deprecated graphics driver
Add the driver `4.5.13467` related to `Radeon R5 Graphics` to the
workaround list.
2021-01-27 10:52:40 -03:00
9457a0faf5 EEVEE: Depth Of Field: Resolve: Fix slight focus gather radius too big
This improves performance a bit.
2021-01-27 14:27:05 +01:00
8e52d76bcd Merge branch 'blender-v2.92-release' 2021-01-27 14:25:28 +01:00
cd24712c2c Fix T84717: Missing viewport update after shading changes
Revert "Fix T83411: Crash when using a workspace/layout data path in a driver"

The fix for the crash exposed design violation in the viewport shading updates,
which is for some reason relying on dependency graph tag of interface data.

The viewport module did not respond to the issue in 2 weeks, and the architect
considered missing update for multiple users a more serious issue than a crash
in a very specific case.

This reverts commit 0f95f51361.
2021-01-27 14:20:31 +01:00
eedf6c6295 EEVEE: Depth Of Field: Scatter Add UI options
The neighbor max tooltip could be less vague.
2021-01-27 14:17:59 +01:00
6e32018499 EEVEE: Depth Of Field: Revert fix scatter power difference
Scatter only seems to have an intensity difference because gather is
only underestimating the highlights. But the scatter bokeh are correct.
2021-01-27 14:15:22 +01:00
89d9f5983c EEVEE: Depth Of Field: Fix neighborhood rejection
The samples were offseted and the difference wasn't absolute.
2021-01-27 14:15:08 +01:00
06e080c712 EEVEE: Depth Of Field: Always use RGBA16F format
Lower precision format have issues when there is too much scattered
bokeh.
2021-01-27 14:04:56 +01:00
c92b5622ad CMake: Detect Clang-Tidy 11 and 12 2021-01-27 13:01:01 +01:00
3f8816eb6a Merge branch 'blender-v2.92-release' 2021-01-27 20:26:22 +11:00
75c426a60a Merge branch 'blender-v2.92-release' 2021-01-27 20:26:19 +11:00
ea01c8c5f6 Fix T84402: Off-screen rendering works only once from Python
Off-screen drawing doesn't work once the 'bgl' workaround is enabled.
Disable this for off-screen drawing.
2021-01-27 20:23:00 +11:00
4b7b4efd5b Fix T81834: Images not properly duplicated in node_shader_utils
Oversight in fb10eaf6e8
2021-01-27 18:16:02 +11:00
fc669a4c3e Cleanup: spelling 2021-01-27 15:28:24 +11:00
6e03a66e78 Merge branch 'blender-v2.92-release' 2021-01-27 15:18:56 +11:00
abb2215061 Merge branch 'blender-v2.92-release' 2021-01-27 15:18:52 +11:00
fb10eaf6e8 UI: add ellipsis to batch rename menu item 2021-01-27 15:17:01 +11:00
b036baa60a EEVEE: Depth Of Field: Improve bokeh shape support
- Separate the LUT texture for faster access.
- Add dedicated shader for resolve with bokeh LUT.
- Add per-pixel distance to shape for slight focus gather.
2021-01-27 02:36:39 +01:00
2c948ea405 EEVEE: Depth Of Field: Improve anamorphic bokeh support for gather
Directly morph the sampling pattern instead of using the LUT for that.
This avoids the weird energy spike problem.

Also now supports ratio less than 1.0.
2021-01-27 00:55:59 +01:00
7d24aa8aa8 RNA Manual Reference: Update Mappings 2021-01-26 17:19:03 -05:00
e41a8bfabe Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-26 14:57:17 -07:00
5496d8cd36 Windows: Fix wchar_t truncation
BLI_strncpy_wchar_from_utf8 made the assumption that
wchar_t is UTF-32 bit regardless of environment, while
this holds true on both mac and linux, on windows
wchar_t is actually actually UTF-16.

This resulted in the upper 16 bits being dropped from
from some string conversions and prevented blender
from starting when installed in a path with unicode
code-points over 0xffff.

There was also a fair bit of code duplication between
BLI_strncpy_wchar_from_utf8 and BLI_str_utf8_as_unicode_and_size

this change essentially removes all logic from
BLI_strncpy_wchar_from_utf8 and calls the right function
for the right environment.

Reviewed By: brecht , Robert Guetzkow

Differential Revision: https://developer.blender.org/D9822
2021-01-26 14:56:39 -07:00
d096d9c4d6 UI: Tooltip for data-block selector menus, showing full name and library info
Long data-block names are clipped to fit into data-block selector menus. For
linked data-blocks, there's also a hint indicating the source library, which
takes further space and may get clipped too.

So this commit adds a tooltip to the menu items, which displays the full,
unclipped data-block name and the unclipped library name. Plus, the library
path is shown too, which is also useful info.

Adds helper functions for search menu item tooltips, so these are easier to add
to other search menus in future.

Part of T84188.
2021-01-26 22:17:17 +01:00
656f6ae643 Cleanup: Use const parameters for active button lookups/tests
Needed for const-correctness in the following commit.
2021-01-26 22:17:17 +01:00
733bcbed46 Cleanup: Comment formatting, grammar 2021-01-26 15:09:02 -06:00
1f81195fb9 Cleanup: Use LISTBASE_FOREACH macro 2021-01-26 14:59:03 -06:00
c32c6a5f85 UI: Current Frame Marker Cleanup
Draw current frame marker in a single pass.

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

Reviewed by Hans Goudey
2021-01-26 11:15:42 -08:00
1c4b0c47dd Geometry Nodes: Support all operations in the "Attribute Math" node
This adds the ability to use all the math operations in the regular
utility "Math" node. The code is quite similar to the attribute vector
math node, with the simplification that the result is always a float.

Differential Revision: https://developer.blender.org/D10199
2021-01-26 12:57:31 -06:00
de3f369b30 UI: Use Ellipsis for Short Truncated Text
Allow use of ellipsis to indicate truncated text down to a single character.

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

Reviewed by Hans Goudey
2021-01-26 10:17:37 -08:00
874665d5e6 EEVEE: Depth Of Field: Support anamorphic bokeh on slight focus gather
Support is kindof weak though as it makes discontinuities appear at
layers transitions.
2021-01-26 19:15:25 +01:00
cdb8209b35 Merge branch 'blender-v2.92-release' 2021-01-26 12:13:42 -06:00
d9a63d40e2 Fix build error
An extra `p->` was added for some reason in a recent commit.
Additionally, there's no reason for the flag to be kept as a pointer,
so just dereference it at the start of both functions.
2021-01-26 12:13:28 -06:00
556381c84a EEVEE: Depth Of Field: Convolution output premultiplied color
Use premultiplied color so we can easily bilinearly sample the
result in resolve pass. This fixes issue with the custom resolve
sampling that was dilating / aliasing the foreground.
2021-01-26 19:10:46 +01:00
3d7d0f1f2e Merge branch 'blender-v2.92-release' 2021-01-26 11:56:08 -06:00
a6016bf5af UI: Fix ugly alignment of timeline popover buttons
Apparently things have changed since {rB98d205508977a6f72bf55},
and putting the buttons in two separate rows is no longer enough
to keep the right-most popover button in the timeline header from
aligning with the menu buttons. This just adds a separator large
enough to avoid the alignment.
2021-01-26 11:55:36 -06:00
60d85a3e60 Merge branch 'blender-v2.92-release' 2021-01-26 18:38:07 +01:00
23e108c5b6 Fix T85082: Perspective distortion while drawing
When the drawing plane was set to view and the user would pan their
camera sideways, the drawing would be more and more distorted and
projected further back.

The fix projects the strokes to view when the user is looking through
the camera or has the drawing plane set to view.

Reviewed By: antoniov

Maniphest Tasks: T85082

Differential Revision: https://developer.blender.org/D10213
2021-01-26 18:37:08 +01:00
ef28da2623 Fix T85082: Perspective distortion while drawing
When the drawing plane was set to view and the user would pan their
camera sideways, the drawing would be more and more distorted and
projected further back.

The fix projects the strokes to view when the user is looking through
the camera or has the drawing plane set to view.

Reviewed By: antoniov

Maniphest Tasks: T85082

Differential Revision: https://developer.blender.org/D10213
2021-01-26 18:32:49 +01:00
64612d57e2 EEVEE: Depth Of Field: Scatter: Speedup: Reduce pixel shader complexity 2021-01-26 18:28:56 +01:00
18ea15cf2d EEVEE: Depth Of Field: Scatter: Speedup: Reduce pixel shader complexity 2021-01-26 18:26:28 +01:00
6157c45445 Fix T85049: Geometry Nodes: How to handle instances with shear? (part2)
Update to changes in master.

Reviewed By: JacquesLucke

Differential Revision: http://developer.blender.org/D10211
2021-01-26 18:25:16 +01:00
82523840cd Merge branch 'blender-v2.92-release' 2021-01-26 18:23:13 +01:00
abd6b1d7b2 Fix T85049: Geometry Nodes: How to handle instances with shear?
Use transform matrices instead of loc, rot, scale variables to store instance transforms.

Reviewed By: JacquesLucke

Differential Revision: http://developer.blender.org/D10211
2021-01-26 18:21:12 +01:00
9cd4618390 EEVEE: Depth Of Field: Cleanup: Use same tile prediction for gather
This use the same code to early out of gathering for a tile. This
make sure we don't do any expensive work for nothing.
2021-01-26 18:18:08 +01:00
ae5c15bb43 Merge branch 'blender-v2.92-release' 2021-01-26 17:51:51 +01:00
6d40d72189 Fix T84847: Crash after splitting effect strip
`seq->tmp` was left in invalid state after
`SEQ_sequence_base_dupli_recursive()` which is run by
`scene_copy_data()`

Ensure all strips have `seq->tmp` set to `NULL` before splitting strips.
2021-01-26 17:50:44 +01:00
c967208460 Fix T79922: Cache of meta strip not invalidated
Meta strip cache is not invalidated if strip inside of meta strip is
invalidated.

Find all metastrips that contain invalidated strip and invalidate them
recursively.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10192
2021-01-26 17:50:44 +01:00
41979fc03b Fix T84160: Wrong DOF when camera is overriden
Workbench engine used active camera to setup DOF effect even when
camera was overridden.

Store camera override in `WORKBENCH_PrivateData` and use it in
`workbench_dof_engine_init()`

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9952
2021-01-26 17:50:44 +01:00
981380cf6d VSE: Fix memory leak when building proxies
With no valid strips selected, file_list is not freed.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10191
2021-01-26 17:50:44 +01:00
20504e555e Fix T84979: No sound after changing strip datablock
Tag relations to update to load new sound.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10182
2021-01-26 17:50:44 +01:00
f22e85d721 Fix T84935: improve previous fix for boolean custom data layers
This improves the fix introduced in rBdc8b31af578bfcf9f77dbce6d7b7da1006a3c8c1.
While it did not result in other bugs afaik, I thought it would be
good to make the fix more specific, in case some other code did
expect `layer->data` to be null. This updated fix checks for the
very specific case the fix was intended for.
2021-01-26 17:49:58 +01:00
c9c79aad9e EEVEE: Depth Of Field: Resolve: Do not load layers that will not be used
Based on coc tiles we can know in advance which layers to load.
This gives a 10% boost compared to loading every layers.
2021-01-26 17:49:30 +01:00
ff7a557c67 Geometry Nodes: new Points to Volume node
This implements a new geometry node based on T84606.
It is the first node that generates a `VolumeComponent`.

Differential Revision: https://developer.blender.org/D10169
2021-01-26 17:37:58 +01:00
6fff85b2e4 EEVEE: Depth Of Field: Resolve: Fix some issues
- Half res buffers were offseted by half a pixel.
- fullres slight focus gather was giving black borders.
- Fix foreground pass having full weight when CoC is almost equal to
  layer_threshold.
2021-01-26 17:13:24 +01:00
89484e9754 Geometry Nodes: Use highest complexity attribute in join node
This just implements a todo with a utility function that didn't exist
at the time. For example, if one geometry has a "scale" attribute with
a float type and another has a "scale" attribute with a vector type,
the vector type will be used for the resulting geometry.

Differential Revision: https://developer.blender.org/D10206
2021-01-26 10:10:07 -06:00
fea585ded4 EEVEE: Depth Of Field: Scatter: Improve neighborhood rejection
This is now based on a user parameter.
2021-01-26 16:27:23 +01:00
66f8835f9c Fix T84850: "Lock to Selection" causes unwanted jumps
Adding new tracks, mask points, mask primitives, changing selection was
causing an unwanted jumps in the view.

This change makes it so those operations are preserving view offset.

Differential Revision: https://developer.blender.org/D10146
2021-01-26 16:23:09 +01:00
3d3b6d94e6 Subdiv: Use better default UV interpolation
The default one is now UVs are smoothed, boundaries are kept sharp.

After some time of experimentation seems this is better default from
interoperability point of view.

This fixes distortion reported in T83470.

Differential Revision: https://developer.blender.org/D10111
2021-01-26 16:23:09 +01:00
66151b5de3 Subsurf: Expose all UV interpolation options
Useful for interoperability, and allows to change default mode
without breaking compatibility.
2021-01-26 16:23:09 +01:00
c1d0b234fb Subdiv: Fix typo in RNA enum value name
Was duplicated from SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES value.
2021-01-26 16:23:09 +01:00
8d51c06611 Cleanup: Reduce variable scope 2021-01-26 09:21:42 -06:00
20d0bb43af GPencil: Swap positions of Pie menu options for Vertex Paint and Weight Paint
This keep the same logic used with meshes because now the Weight Paint and Vertex Paint are not in the same position for grease pencil.
2021-01-26 16:11:06 +01:00
31f568c336 Fix: incomplete integration of PugiXML and Potrace build options
Add them to the standard build configurations, disable properly when library
not found and print as part of configuration overview.
2021-01-26 15:55:27 +01:00
dde3ecc1a8 Cleanup: compiler warnings
If one method is marked as override, clang warns if others are not.
2021-01-26 15:52:05 +01:00
c51a5b204c Fix T85048: Cycles sculpt vertex color issues after recent changes
Attribute fields were not fully copied.

Ref D10208
2021-01-26 15:32:05 +01:00
e7e4b3c6af EEVEE: Depth Of Field: Fix issue with texture reuse
Also reuse the scatter occlusion texture from foreground to
background.
2021-01-26 15:20:58 +01:00
26b5760d6d Fix T85038: No curve is "active" after selecting all curves
Check for selection status beforec learing the "active" flag from an
FCurve. This allows the "Select All Curves" operator to retain what is
seen as the active curve.
2021-01-26 15:13:42 +01:00
Charles Flèche
76ab0381d1 Fix Cycles standalone compilation following API changes
The changes to the socket API were not applied to the standalone app.

Also modify Camera.compute_auto_viewplane() to use Camera.full_width and Camera.full_height as it is not possible to publicly access Camera.width and Camera.height anymore, so the aspect ratio could be computed with stale data.

Differential Revision: https://developer.blender.org/D9961
2021-01-26 14:39:32 +01:00
Charles Flèche
532d3a103a Cycles standalone: fix missing dependencies in CMake files
Also set default CYCLES_INSTALL_PATH to CMAKE_INSTALL_PREFIX.

By default with a `make cycles` this will build to ${CMAKE_BINARY_DIR}/bin

Differential Revision: https://developer.blender.org/D9961
2021-01-26 14:39:32 +01:00
84671d796d Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-26 14:38:40 +01:00
b665781808 Asset Browser: fix context properties reported to Python
Change `"active_id"` to `"id"` so that tab completion in the asset browser
context returns the correct properties.

055ef5df61 renamed the `active_id` property
to `id`, but `dir(thecontext)` still returned `"active_id"`.
2021-01-26 14:27:33 +01:00
ed809866b1 Viewport Rendering: Don't clamp when overlays are disabled.
During viewport rendering the color values were clamped in order to
apply the overlay on top of it. This clamping would show the scene
colors washed out.

This patch adds a work around to skip the clamping when the overlays are
turned off.

Parial fix for {T77909}
2021-01-26 14:25:18 +01:00
e6aece32a0 GPU: Enable HQ normals workaround for any AMD Drivers on Polaris. 2021-01-26 12:48:50 +01:00
74633c0456 Merge branch 'blender-v2.92-release' 2021-01-26 12:41:47 +01:00
Robert Guetzkow
c399651637 Fix T84708: Versioning for Set Alpha node
The versioning code introduced in rB38df935c0985 skips the composite node
tree that is used by the scene thus not correctly versioning Set Alpha
nodes outside of node groups. This fix iterates through all node trees to
version all Set Alpha nodes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D10110
2021-01-26 12:38:43 +01:00
c3a4c6c209 GPU: Enable HQ normals workaround for AMD 21.1.1 driver.
AMD 21.1.1 still has the same issues as reported in T82856.
2021-01-26 12:30:54 +01:00
4935ed6ce6 Fix T84907: incorrect dirty mask after geometry join node
Hans noticed that these dirty flags are only used for normals currently
and that the edge flag is not used at all. This patch still applies the
"entire" fix with all four flags.

Differential Revision: https://developer.blender.org/D10193
2021-01-26 12:09:44 +01:00
dc8b31af57 Fix T84935: boolean custom data layers not saved correctly
The issue was that boolean custom data layers were not written to files,
because the dna struct name `bool` does not exist. Adding a struct that
just contains a `bool/uint8_t` does not seem to be possible, it looks like
the minimum dna struct size is 4 bytes.

The proposed solution has two parts:

1. Write the custom data layer using `BLO_write_raw` instead of
   `BLO_write_struct_array_by_name`.
2. When loading a file, reinitialize any custom data layer that was
   not saved correctly (this is just a fix for existing files).

Differential Revision: https://developer.blender.org/D10194
2021-01-26 12:05:40 +01:00
f066cee92f Merge branch 'blender-v2.92-release' 2021-01-26 22:04:21 +11:00
548d8a397c Fix T85011: "Allow Execution" reloads the wrong file when recovering
Support custom revert actions, necessary for recover operations
to be able to reload the file with scripts enabled.
2021-01-26 21:56:49 +11:00
2a8122fb65 ed_undo refactor: split/remove ed_undo_step_impl.
This function was doing too many things, with behaviors fairly different
depending on its input parameters. This was making the code fragile and
hard to follow.

Split it in three:
* `ed_undo_step_pre` does the common actions before we actually undo
  data.
* `ed_undo_step_post` does the common actions after we have undone/redone
  data.

Then, `ed_undo_step_direction`, `ed_undo_step_by_name` and
`ed_undo_step_by_index` do their actual specific actions, with their own
logic.

Note: Since the actual behavior of those three funtions is fairly
different (the first only undo/redo one effective step, the second is only
supposed to **undo** //before// given named step, and the third actually
undo/redo until given indexed step become active), we could also find
better names for those. right now, it sounds like they are doing the
same thing, with just different ways to specify the target step.

Note: This is part of on-going refactor work on undo system, see T83806.

Differential Revision: https://developer.blender.org/D10112
2021-01-26 09:44:46 +01:00
0d9f79b163 Cleanup: Reduce variable scope, use LISTBASE_FOREACH macro 2021-01-25 23:47:56 -06:00
f21de01b84 Merge branch 'blender-v2.92-release' 2021-01-26 15:38:08 +11:00
7909f70f64 WM: add "use_scripts" to recover auto-save/session operators
Support recovering blend files with scripts enabled,
needed to fix T85011, can be useful in general too.

Adding this also resolves an assert in BKE_autoexec_match,
since it ran even when scripts were enabled.
2021-01-26 15:34:38 +11:00
e9e054b987 Geometry Nodes: Add float2 to attribute complexity map 2021-01-25 22:20:41 -06:00
71a8e32dc0 Merge branch 'blender-v2.92-release' 2021-01-26 15:18:10 +11:00
d55d95b04d WM: return success from WM_recover_last_session, minor cleanup
- Return success from WM_recover_last_session
- Avoid setting global variables is already called in WM_file_read.
  While it didn't cause any problems, these assignments ran even when
  recovering the session failed to load the file.
- Return OPERATOR_CANCELLED when the operator fails.

Returning success is needed to fix T85011.
2021-01-26 15:16:12 +11:00
Juanfran Matheu
7d2f746369 TEXTURE PAINT: Tools with wrong cursor
Texture paint tools were using DEFAULT cursor instead of PAINT_CROSS cursor as vertex paint, weight paint and sculpt modes.

Before
{F9591366}

After
{F9591370}

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10172
2021-01-25 22:37:14 -05:00
Zev Eisenberg
6499a2ec5c Fix typos in driver_functions.py
I'm learning how driver functions work, and I found a couple of typos in the driver_functions.py template file. Here's a quick patch to fix them up.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10149
2021-01-25 22:37:14 -05:00
d7a2e0b83c Cleanup: Use const arguments 2021-01-25 21:11:57 -06:00
Juanfran Matheu
be262cf561 TEXTURE PAINT: Tools with wrong cursor
Texture paint tools were using DEFAULT cursor instead of PAINT_CROSS cursor as vertex paint, weight paint and sculpt modes.

Before
{F9591366}

After
{F9591370}

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10172
2021-01-25 22:01:12 -05:00
Zev Eisenberg
0734b235d2 Fix typos in driver_functions.py
I'm learning how driver functions work, and I found a couple of typos in the driver_functions.py template file. Here's a quick patch to fix them up.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10149
2021-01-25 21:59:25 -05:00
5841c1d819 EEVEE: Depth Of Field: Use bilinear filtering during resolve
Instead of using stochastic resampling, use bilinear filtering to reduce
noise amount and not waste the spatial coherency we have from the
convolution passes.
2021-01-26 02:14:25 +01:00
f91aeaedb1 EEVEE: Depth Of Field: Filter weight buffer
This allows us to filter foreground buffer and have better layer masks.

This doubles the filter time but the pass is already quite inexpensive.
Also we could add an early out condition using the tile buffers.
2021-01-26 01:23:03 +01:00
d7365bfdd5 EEVEE: Depth Of Field: Tweak: Reduce fast gather random radius a bit
Seems to fit better the normal gather radius.
2021-01-26 01:07:09 +01:00
9135370633 EEVEE: Depth Of Field: Use bilinear filtering for fast gather
This reduces the noise amount a bit.
2021-01-26 01:05:49 +01:00
53ab14ffed EEVEE: Depth Of Field: Use RGB only format when alpha isn't required
This reduces the amount of VRAM needed for the effect.
2021-01-26 00:23:00 +01:00
ae1e68f514 Cleanup: Declare variables where initialized 2021-01-25 17:22:52 -06:00
0b55a9f886 EEVEE: Depth Of Field: Improve foreground gather pass performance
By tracking the max (or min absolute) intersectable Circle of confusion
radius instead of the simply dilated maximum, we can reduce the overhead
of density changing gathering.
2021-01-26 00:00:33 +01:00
70e064f111 Cleanup: Correct comments in ID type enum 2021-01-25 16:28:00 -06:00
c4f3475612 Cleanup: update comment from 77f73a9284 2021-01-26 09:23:44 +11:00
6249995c5e Fix T85054: undo/redo app handlers broken
Regression in recent commit c13383da41
which swapped undo/redo when calling the handlers.

Ref D10200
2021-01-26 09:18:26 +11:00
eaa726542e Merge branch 'blender-v2.92-release' 2021-01-25 23:12:02 +01:00
77f73a9284 Fix library name clipping most of the data-block name in data-block menus
Issue is visible here https://developer.blender.org/F8626313.

If there is enough space for both the item name and the library hint, display
both. Otherwise, clip either the item name, the library hint, or both so that
not more than 60% and 40% of the available width are used repectively.
There are further improvements we could do, as noted in T84188, this just fixes
the regression for the release.

Part of T84188. There were multiple reports about this, see merged in and
mentioned reports in T84188 and T78012.
2021-01-25 23:10:16 +01:00
a35c0fe6ce Merge branch 'blender-v2.92-release' 2021-01-26 08:16:22 +11:00
14f61c619b Fix wm.context_* operators reusing values when it's not expected
wm.context_* operators typically have their options set by menus
or key bindings.

Re-using options in this case can cause problems where two
actions that change unrelated properties will re-use a setting
from the previous execution.

For example changing the lights Power impacted
changing it's Radius afterwards.
2021-01-26 08:13:58 +11:00
4fc54ddae1 Cleanup: spelling 2021-01-26 07:50:40 +11:00
1559aa3da0 Merge branch 'blender-v2.92-release' 2021-01-25 21:11:48 +01:00
Greg Neumiller
c134d7437d Fix T84031 initialize connectivity info of the base mesh before using Displacement Smear brush.
Reviewed By: pablodp606

Maniphest Tasks: T84031

Differential Revision: https://developer.blender.org/D9956
2021-01-25 21:09:58 +01:00
55936c060b EEVEE: Depth Of Field: Fix NaNs in going through resolve pass 2021-01-25 20:02:42 +01:00
6c6431809d EEVEE: Depth Of Field: Improve scatter rejection masks
This update the rejection with smooth tests which fades the
pixels between scattering and gathering convolutions.
2021-01-25 19:41:45 +01:00
3f0213d929 EEVEE: Depth Of Field: Fix compositing issues 2021-01-25 19:00:12 +01:00
93e3aed041 Merge branch 'blender-v2.92-release' 2021-01-25 11:48:53 -06:00
aa030d3459 Fix: Unable to animate nodes modifier exposed properties
The RNA path used for animating the settings passed to the node tree
is incorrect. Currently it's just `settings.property_name`, but it's
the path from the ID, not the modifier, so it should be
`modifiers[modifier_name].settings.property_name`.

However, the "Settings" struct is separated in RNA and DNA, which means
that the callback to get the RNA path does not know about the modifier's
name in order to fill the above path, so some reference to the modifier
in the "Settings" struct would be necessary, which would create a
convoluted layout in the `ModifierData` struct.

Instead, this commit simply removes the "Settings" struct from RNA,
which isn't as elegant from the point of view of the Python API,
but otherwise it's a nice simplification. Note that we don't remove the
"Settings" struct from DNA, because it would break reading old files.

Differential Revision: https://developer.blender.org/D10175
2021-01-25 11:46:55 -06:00
bf3875d6ac EEVEE: Depth Of Field: Cleanup: Remove scatter threshold uniform...
... from scatter pass and bump minimum scatter radius.
2021-01-25 18:42:48 +01:00
e137695436 EEVEE: Depth Of Field: Make max mipmap based on maximum CoC
This make sure all levels that are going to be sampled are
filled with data. Leading to more performance.
2021-01-25 18:41:01 +01:00
8d78831fbd EEVEE: Depth Of Field: Improve slight focus gather patern
This double the sample count and change the randomization pattern.
2021-01-25 17:00:23 +01:00
51c433f1a5 Windows: Remove zero terminator from stack trace
Important lesson to be learned here, leaving comments
is great and in the moment, they usually make sense.

Many months later they may not quite make as much sense
any more and time will have to be spend to figure out
what was meant, all of this would have been averted with a
better comment.

The zero terminator in this case, I can find no evidence
of it being used or relied on at any point. It does however
break GTests's `EXPECT_EXIT` macro that stops looking in
the output as soon as it sees the zts and doesn't end up
looking at the actual assert text being thrown. Which in
turn makes the`fcurve_active_keyframe`test fail when run
in debug mode on windows.
2021-01-25 08:50:37 -07:00
8a77019474 Cycles: modernize usage of rna iterators
Using rna iterators in range-based for loops is possible since {rBc4286ddb095d32714c9d5f10751a14f5871b3844}.

This patch only updates the places that are easy to update
without more changes in surrounding code.

Differential Revision: https://developer.blender.org/D10195
2021-01-25 16:25:27 +01:00
04f91bce53 Fix build error after Cycles Amembic procedural commit 2021-01-25 16:15:35 +01:00
b64f0fab06 Cycles: internal support for Alembic procedurals
The implementation is currently optimized to load animation sequences once
and then quickly scrubbing through them. Later on an option should be added
to optimize for memory usage and only load the current frame into memory.

Currently mesh and curve objects are supported, including support for UV and
vertex color attributes. Missing still is support for arbitrary attributes and
motion blur, as well as better handling of changing topology. Shader assignments
are made using FaceSets found in the Alembic archive.

The animation (and constant) data of the objects inside the Alembic archive is
loaded at once at the beginning of the render and kept inside a cache. At each
frame change we simply update the right socket of the corresponding Cycles node
if the data is animated. This allows for fast playback in the viewport
(depending on the scene size and compute power).

Note this is not yet exposed in the Blender UI, it's a feature that is still under
development and not ready for general use.

Ref T79174, D3089
2021-01-25 15:51:42 +01:00
2e67191c86 Cycles: internal support for the concept of procedurals
Procedurals are nodes in the scene that can generate an arbitrary number of
other nodes at render time. This will be used to implement an Alembic procedural
that can load an Alembic file into Cycles nodes. In the future we also expect to
have a USD procedural.

Direct loading of such files at render time is a standard feature in other
production renderers. Reasons to support this are memory usage and performance,
delayed loading of heavy scene data until rendering, Cycles standalone rendering
using standard file formats beyond our XML files, and shared functionality for
Cycles integration in multiple 3D apps.

Ref T79174, D3089
2021-01-25 15:51:38 +01:00
3656fc3aee Cleanup: move code to find geometry shaders into own function
Ref D3089
2021-01-25 15:48:39 +01:00
3203340168 EEVEE: Depth Of Field: Fix scatter anamorphic bokeh energy conservation
Everything is in the title.
2021-01-25 15:40:50 +01:00
2a81d948ad LibOverride: refactor of relationships handling in library overrides.
First step towards a better handling of relationships between IDs in
override context, especially when a resync is needed.

First, introduce a new flag to override operations,
`IDOVERRIDE_LIBRARY_FLAG_IDPOINTER_MATCH_REFERENCE`, for ID pointers.
It keeps track of whether an RNA ID pointer has been kept to its
'natural overriden ID' (in override hierarchy context), or has actually
been re-assigned to some other data-block.

Second, refactor how we deal with relationships between IDs in override
hierarchy code, especially in resync case. This will fixe several cases
listed in T83811, especially the case where an ID pointer to an existing
override needs to be updated to a new one due to a matching change in
linked data.
2021-01-25 14:48:51 +01:00
5c490bcbc8 Fix T85027: Crash dragging a collection over empty Outliner
Filtering may make the Outliner tree empty. The function to find the drop
element should just return null then and let the caller decide how to deal with
it.
2021-01-25 14:37:24 +01:00
a9e12e50ae EEVEE: Depth Of Field: Improve Max size slider UI feel
The prop is in pixels. No need for this much accuracy.
2021-01-25 14:30:38 +01:00
e623e62d3e EEVEE: Depth Of Field: Separate scatter buffer
This adds a new texture buffer to store the scatter color.
This improve code quality and in the future will allow smoother
transition between scatter and gather.
2021-01-25 14:28:59 +01:00
ef6d652428 Fix T83344: Cycles baking with progressive refine fails on GPU 2021-01-25 14:27:01 +01:00
f226687bb9 Cleanup: Knife Tool: Remove redundant 'view3d_operator_needs_opengl' calls
This function sets the `RegionView3D` matrices to the GPU.
But the OpenGL library is not actually being used by the operator.
2021-01-25 10:07:50 -03:00
4792d988fb Fix T84964: Crash when running Knife Project in the background
Although the Knife Project operator converts 3D coordinates to screen
space, it doesn't really need opengl.

Differential Revision: https://developer.blender.org/D10178
2021-01-25 10:07:50 -03:00
e9a47223cb Merge branch 'blender-v2.92-release' 2021-01-25 23:48:00 +11:00
4bc7996e2e Merge branch 'blender-v2.92-release' 2021-01-25 23:47:56 +11:00
72a207de35 Merge branch 'blender-v2.92-release' 2021-01-25 23:47:52 +11:00
William Reynish
601b690a24 Fix T84911: Add Primitive and IC keymap - 3d navigation conflict
Ref D10176
2021-01-25 23:46:57 +11:00
William Reynish
da2955fdf6 UI: improve categorization in Grease Pencil Layers sub-panels
The "Layers" panel for Grease Pencil objects uses sub-panels to organize
their properties in categories. Currently, this isn't so clear.
This patch cleans up these sub-panels with clearer categorization.

Reviewed By: #grease_pencil, antoniov, Blendify, HooglyBoogly

Ref D10184
2021-01-25 23:41:00 +11:00
928aee934f EEVEE: Depth Of Field: Resolve pass: Fix some bugs
- Fix missing tiles when max size is under layer threshold.
- Fix infocus sampling being jittered
- Reduce intersection multiplier for smoother slight focus transition.
2021-01-25 13:32:15 +01:00
f38479f9b4 EEVEE: Depth Of Field: Add performance debugging defines 2021-01-25 13:00:26 +01:00
7a005fb7d1 Fix T84324: Crash when combining two scenes in compositor.
In the CompositorOperation::deinitExecution the viewer could be freed at
the same time it was drawn in the image editor or node editor. There is
a guard for that but wasn't added during the migration of the two
editors to the draw manager.
2021-01-25 12:44:18 +01:00
440c348323 EEVEE: Depth Of Field: Tweak layer threshold for more watertighteness 2021-01-25 12:31:16 +01:00
6650310844 EEVEE: Depth Of Field: Add back the resolve sample jitter
This time using a tweaked radius and a noise rotation (offset).
2021-01-25 12:28:41 +01:00
6a655eb871 EEVEE: Depth Of Field: Fix output weight of the gather passes 2021-01-25 12:28:02 +01:00
c8067f798f EEVEE: Depth Of Field: Change foreground occlusion threshold
This makes it a bit more relaxed to avoid too harsh transitions.

Also disable occlusion in resolve pass.
2021-01-25 12:26:34 +01:00
371312cf2c EEVEE: Depth Of Field: Correct foreground occlusion weighting
This is not perfect but at least it has less noticeable transition
issues.
2021-01-25 12:07:20 +01:00
dd2b616320 Buildbot: Fixed crash when building RC builds
Building RC builds would parse `BLENDER_VERSION_CYCLE_NUMBER` that
doesn't exist anymore. It was removed by {D7748}.

This change removes it from `buildbot_utils.py`.
2021-01-25 11:53:35 +01:00
06fdbe6664 Merge branch 'blender-v2.92-release' 2021-01-25 11:36:31 +01:00
fba35a02c6 Fix padding issue in DNA
Was introduced in the previous change in the image.
2021-01-25 11:35:29 +01:00
William Reynish
5f2c5e5bb8 UI: object context menu tweaks for consistency
Currently, the object context menu includes some inconsistencies
between object types. This is a small patch that fixes these.

- Adds the same ability to Join and Set Origin
  to all supported object types.
- Adds Set Active Camera for cameras.
- Adds Adjust Stroke Width for GP Objects.
- Adds Trace Image to Grease Pencil for Image Empties.

Reviewed By: #grease_pencil

Ref D10144
2021-01-25 21:28:39 +11:00
ebaa3fcedd Fix T84398: Multiview images show only one view.
The `image_get_gpu_texture` didn't use the iuser->view_index but
recalculated the requested view again. This lead to inconsistent
behavior when switching between multi view textures or stereo textures.

This has been fixed by ensuring that the `iuser->view_index` is always
used.

An Image has only place to store 2 view textures. This is done for
right/left eye compositing. A multi view texture can have more views.
This would lead to reading and writing to unallocated space.

When a multiview texture is requested that is larger than 1. It will
always be cached as being the first eye. The `gpu_view` of the Image is
also used as a cache key to check this.
2021-01-25 11:27:55 +01:00
7cb65a1e67 Fix T84990: Proportional Editing falloff drawing for masks in MCE is broken
This got broken in 4b1112c8c9. A fix which will be consistent with image
editor is not obviously clear, so for the time being revert the change and
go back to state which was working for a long time.
2021-01-25 11:10:42 +01:00
be8b60aa20 Merge branch 'blender-v2.92-release' 2021-01-25 11:07:08 +01:00
02404ded80 Fix UI message typo in own previous commit.
//sigh//
2021-01-25 11:06:21 +01:00
a0b85800ec Merge branch 'blender-v2.92-release' 2021-01-25 10:56:55 +01:00
3df2bea88b Fix UI messages.
Avoid sticking words together when it's not absolutely necessary.
2021-01-25 10:56:36 +01:00
4d94e2afc8 Merge branch 'blender-v2.92-release' 2021-01-25 20:37:50 +11:00
2188047d9d Merge branch 'blender-v2.92-release' 2021-01-25 20:37:46 +11:00
52022cba78 UI: increase the context menu's light power
This roughly matches the behavior when
editing this value via the buttons.

Part of D10144
2021-01-25 20:35:56 +11:00
William Reynish
5f55022276 UI: tweak object context menu labels
A number of naming changes for consistency and clarity

- Use 'Adjust...' for all entries that adjust properties
  rather than being normal operators.
- Follow naming conventions (ie Draw -> Display etc).
- Less naming ambiguity and more correctness and consistency.

Part of D10144
2021-01-25 20:12:39 +11:00
292685ea39 Fix T84878: Eevee cryptomatte broken with stereoscopy
During multiview rendering the `cryptomatte_accum_buffer` is not cleared
between the views and leaves artifacts on the next view to be rendered.
This change clears the accum buffer when it already exists and will be
reused for the next view.
2021-01-25 09:40:03 +01:00
0cb264a282 Cleanup: pass 'rctf' rectangle to 2D box drawing functions
Passing 4x arguments for the rectangle,
mixed in with round-box radius & color wasn't very readable.

Instead, pass a `rctf` as the first argument to UI box drawing functions.
2021-01-25 18:34:29 +11:00
17ac860cef Cleanup: remove redundant len() calls 2021-01-25 18:09:15 +11:00
32fd000b4b UI: Round-box drawing cleanup
The new GPU_SHADER_2D_WIDGET_BASE shader allows us to draw
many complex shapes with anti-aliasing.
One thing it can do is draw an opaque rounded rectangle with colors
that differ between its interior and outline.

In order to do the above in a single pass I recently added an "_ex"
version of UI_draw_roundbox that exposes most of that shaders features.

This simplifies interface_draw.c by removing redundancy in the calling
of this shader by using this new uber "_ex" version.

Ref D10189
2021-01-25 18:06:39 +11:00
1ac3c861fd Cleanup: remove unused UI_draw_roundbox_shade_y function
Marked unused 2017 f69678482c)

Remove since this remains unused,
split from D10189 to allow reverting if we ever need it back.
2021-01-25 17:57:59 +11:00
William Reynish
5a1cef2e76 UI: move 'Trace Image to Grease Pencil' to 'Convert' sub-menu
This operator is very specific, and may not warrant being placed in
such a prominent place. Move it together with other convert operators.

Ref D10188
2021-01-25 17:49:02 +11:00
bf329d37da Merge branch 'blender-v2.92-release' 2021-01-25 17:43:00 +11:00
7a0281914e Fix T85010: Cycles viewport not showing certain material changes when using GPU compute
Modifications to triangle shader association were not considered when checking for updates and the associated device data array was not tagged as modified so it was not resent to the device(s).
2021-01-25 07:40:49 +01:00
7f9ed0178a Cleanup: compiler warning, clang-format, spelling 2021-01-25 17:40:40 +11:00
b90ccaa067 Merge branch 'blender-v2.92-release' 2021-01-25 06:01:14 +01:00
Olivier Jolly
5501a5de32 Fix T84705: Snapping strip handle offset animation
Only offset animation if whole strip is snapped.

Bug introduced in e36c05b3d1.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D10116
2021-01-25 05:51:36 +01:00
Peter Fog
d6bbcc4f66 VSE: Inherit blend mode with single input effects
It is very likely, that after applying effect like transform or speed on
strip with certain blending, user would want to change effect blending
to match original strip.

Feature suggested on RCS:
https://blender.community/c/rightclickselect/HVgbbc/

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D10156
2021-01-25 05:42:10 +01:00
6d21703e89 Merge branch 'blender-v2.92-release' 2021-01-25 05:09:13 +01:00
e16c786022 Fix T83267: Crash prefetching scene strip in meta strip
Scene strips can't be prefetched and seq_prefetch_do_skip_frame()
should check if scene strip is in timeline. But it did not recurse into
meta strips, which resulted in crash.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9999
2021-01-25 05:03:15 +01:00
93c10797dc Fix T82698: Speed effect not working on generator strips
Generator strips with zero inputs have their length set to 1 pernamently.

In some cases it is useful to use speed effect on these strips because they
can be animated. This can be done by using their length as is on timeline as
content length.

This is very simplified and temporary solution, as cutting these strips won't
give expected results. Lot of code relies on length of these strips being fixed
to 1, resolving this properly should be done by T59540.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10026
2021-01-25 04:55:10 +01:00
744fa41e7e Fix T83266: Proxy building with meta strips fails
Building proxy with meta strip selected resulted in attempt to render
meta strip itself and save result as image as is done when building
image proxies.

Remove meta strip from list of supported strips.

Multicam, Meta and scene strip are cleared from poll function in UI as well.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10001
2021-01-25 04:42:46 +01:00
77b51d4e58 VSE: Remove skip_disk_cache argument
This argument was used to prevent infinite loop in lookups between disk
and RAM cache.

Code was refactored, so this can be handled internally in cache.

Reviewed By: sybren, sergey

Differential Revision: https://developer.blender.org/D9955
2021-01-25 04:28:13 +01:00
6623d572aa Cleanup: minor changes and comments to screen_bounds_get access 2021-01-25 13:49:32 +11:00
9708aa6341 Fix view-axis gizmo tool-tip placement
Bounding box calculation ignored the gizmo size preference.
2021-01-25 13:44:42 +11:00
c5e409b013 Merge branch 'blender-v2.92-release' 2021-01-25 13:38:02 +11:00
850115531d Merge branch 'blender-v2.92-release' 2021-01-25 13:37:54 +11:00
652dd4e27f Fix ruler end-caps not following interface scale 2021-01-25 13:34:15 +11:00
d1c6704413 UV: tweak island select behavior
Selecting inside an island no longer de-selects
when it's too far from an edge.

When edge select fails fall back to inside-face test.

This follows 908b383b7d
which made this change for face-select.

Apply to island selection since it doesn't make sense
for island select to behave differently.
2021-01-25 13:30:02 +11:00
cf6d17a6aa UI: Gizmo Tooltip Positioning
Position Gizmo tooltips below their bounds so they do not obscure the content.

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

Reviewed by Julian Eisel
2021-01-24 15:16:05 -08:00
2fec46c3e6 Asset Browser: Support dragging in object-data assets (meshes, curves, etc.)
The Asset Browser already displayed object-data assets, but you couldn't
actually drag & drop them. This is now supported.

The object-data drop poll needed access to the data-block. But with a small
tweak it doesn't need that and can just check the ID type (which is known for
asset dragging too).

Part of T82661.
2021-01-24 22:33:17 +01:00
c8d6e2dfa0 UI: Avoid showing drop hint on drag & drop if dropping won't succeed
If the poll check of the operator fails, the operator won't run. We can check
that in advance to hide the drop hint if dropping will fail anyway.
This improves feedback during dragging.
2021-01-24 21:29:14 +01:00
e90a2a3f01 Asset Browser: Avoid appending asset data-block when drop operator will fail
For assets, the copy callback of the drop-box would append the asset
data-block. Check if the operator's poll succeeds before calling the copy
callback.
Otherwise the data-block is "secretly" appended, which the user doesn't expect
and won't notice without checking the file data in the Outliner.

For masks I had to extend the poll function, it didn't check context
sufficiently.
2021-01-24 21:29:14 +01:00
f04206cbc7 Cleanup: Add/use helper to check if dragging a certain ID type or asset ID type
This check is a common pattern, avoid duplication by using a helper function.
2021-01-24 21:29:14 +01:00
b37fac5ff4 EEVEE: Depth Of Field: Cleanup remove transparency_weight 2021-01-24 19:19:01 +01:00
ec909e5d0f EEVEE: Depth Of Field: Fix sample weighting for foreground 2021-01-24 19:12:34 +01:00
e747c07156 GPencil: New option to trace current frame
Instead to trace the image of the sequence starting in first frame, now it uses the current frame by default.
2021-01-24 17:22:44 +01:00
b449da3a7d Asset Browser: Support dragging mask assets into compositors
The normal drag & drop support was already there, just needed minor tweaks to
respect asset importing. The dragged in mask will create a mask node for
compositor node editors.

Part of T82661.
2021-01-24 17:16:20 +01:00
db15df0baa Asset Browser: Support dragging image assets into node editors
The normal drag & drop support was already there, just needed minor tweaks to
respect asset importing. The dragged in image will create a image/texture node
for the internally known node-tree types (shader, texture and compositing
nodes).

Part of T82661.
2021-01-24 16:53:34 +01:00
fee0c90127 EEVEE: Depth Of Field: Various improvement
- Add compile time options for debugging.
- Reduce number of samples for slight focus gather.
- Increase/fix quality of background and foreground density change.
2021-01-24 14:20:55 +01:00
42732568d5 EEVEE: Depth Of Field: Fix slight out of focus tile dilation
It wasn't working as expected.
2021-01-24 14:19:19 +01:00
b94f1a63f1 EEVEE: Depth Of Field: Speedup: Use linearstep in scatter pass
This reduce the perf bottleneck of the pixel shader.
2021-01-24 14:15:38 +01:00
aa065a2951 Merge branch 'blender-v2.92-release' 2021-01-24 18:43:58 +11:00
d3506c86da Fix UV editor vertex/face drawing ignoring UI scale 2021-01-24 18:38:05 +11:00
9ad181a5d0 Cleanup: email address formatting
Match git style email addresses, ignored by the spell checker.
2021-01-24 16:08:17 +11:00
9c088b1b97 Cleanup: spelling 2021-01-24 16:06:58 +11:00
2b0d08961a Cleanup: remove toolbar popup release hack
This isn't needed since key-map items can ignore repeat events.
2021-01-24 15:51:05 +11:00
de9977260c Merge branch 'blender-v2.92-release' 2021-01-24 15:25:57 +11:00
e9cd3d50a7 Fix T84988: Armature symmetries crashes with action constraint
Action constraint without an action pointer set was crashing.
2021-01-24 15:24:04 +11:00
9f3c5a061d Fix outliner and animation editors exiting multi-object edit-mode
When multiple objects were in edit-mode,
only the active object would exit edit-mode.
2021-01-24 15:24:04 +11:00
e77c65f73c Cleanup: group navigation gizmo size with generic gizmo size
Also use `char` for these gizmo size & flag.
2021-01-24 13:45:17 +11:00
bd4ed5ca9a Fix "use after scope" reported by ASAN
The float array is declared inside a smaller scope, pointed to, and then
used later. This simply moves the declaration outside of the if statement.
Also remove two redundant lines.
2021-01-23 18:38:51 -06:00
ded9484925 UI: Viewport Navigate Gizmo Refactor
Simplification and changes to the Navigation gizmo. Better indication of negative axes, consistent use of color and size to indicate orientation, ability to be resized.

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

Reviewed by Campbell Barton
2021-01-23 13:10:07 -08:00
aaa1d58054 Merge branch 'blender-v2.92-release' 2021-01-22 19:30:23 +01:00
90bcd5e724 Cleanup: remove unused render camera code 2021-01-22 19:30:17 +01:00
a1f44e43a2 Fix T84745: more build errors with TBB 2021
* tbb::blocked_range moved to a different namespace and since the fix is
  non-trivial, remove some unused code that used this.
* Task group priorities are no longer supported. It's unclear if they are
  useful at all right now and even set correctly, for now all tasks are equal
  priority with TBB 2021.
2021-01-22 19:24:13 +01:00
5d6e5a9076 Fix vertex color baking using wrong color space
Now light baking should match the render.
2021-01-22 19:24:13 +01:00
e91b59b589 Merge branch 'blender-v2.92-release' 2021-01-22 11:28:59 -06:00
e845467d93 Fix: Mouse presses in some areas do not set active modifier
There are a couple of operations that are meant to set the active
modifier that currently don't. The first is a mouse press on the drag
icon on the right of the header, and the second is mouse presses on
modifier sub-panels headers.

This was an oversight in the implementation, especially the second,
because the blank space on the right of a sub-panel header often looks
just like the blank space elsewhere on the modifier's panel that
*does* set the active modifier.

Note that this purposefully doesn't include collapsing and expanding
the modifier as operations that set the active, since regardless of
whether that makes sense, it wasn't in the agreed upon design, which
would ideally not need changing for 2.92.

Differential Revision: https://developer.blender.org/D10155
2021-01-22 11:08:58 -06:00
735093dee8 Fix crashes from recent refactor rB131a758b6f88.
Much better to add a relation entry for all IDs, even if they are not
connected to any other ID.
2021-01-22 17:37:09 +01:00
3469e06c1a Fix memory leak when opening file browser
The name string of each file was duplicated but not freed. The new flag to
ensure the file-list frees the name wasn't set. Mistake in ca475479eb.
2021-01-22 16:58:23 +01:00
bbe6d44928 Cycles: optimize device updates
This optimizes device updates (during user edits or frame changes in
the viewport) by avoiding unnecessary computations. To achieve this,
we use a combination of the sockets' update flags as well as some new
flags passed to the various managers when tagging for an update to tell
exactly what the tagging is for (e.g. shader was modified, object was
removed, etc.).

Besides avoiding recomputations, we also avoid resending to the devices
unmodified data arrays, thus reducing bandwidth usage. For OptiX and
Embree, BVH packing was also multithreaded.

The performance improvements may vary depending on the used device (CPU
or GPU), and the content of the scene. Simple scenes (e.g. with no adaptive
subdivision or volumes) rendered using OptiX will benefit from this work
the most.

On average, for a variety of animated scenes, this gives a 3x speedup.

Reviewed By: #cycles, brecht

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D9555
2021-01-22 16:08:25 +01:00
131a758b6f Refactor BMain relations temp data.
`bmain.relations` is used to store temp data of relations between IDs,
to speed-up some complex processes heavily relying on such information.

Previous implementation was failry unclear/confusing, and required a
not-so-nice hack to 'tag' some ID as processed.

New code changes as such:
* Using `from`/`to` naming (instead of `user`/`used`).
* More clear separation between `to` `id_pointer` and `from` one,
  using an union instead of hacking around difference between `ID *` and
  `ID **` pointers.
* Adds storage of `session_uuid` informations (mainly useful as
  debug/ensuring proper consistency of data currently).
* Adds a structure per ID in the mapping. This enables possibility of
  storing tags (and potentially more  data in the future) per-ID,
  without polluting the IDs themselves with very short-life info.

Differential Revision: https://developer.blender.org/D10164
2021-01-22 16:05:17 +01:00
8f112af609 EEVEE: Depth Of Field: Fix issue with slight focus filtering perf.
The issue was caused by wrong tile values.
2021-01-22 15:33:44 +01:00
0c732382ae EEVEE: Depth Of Field: Fix issue with neighborhood comparison
The filter was not using the correct UVs.
2021-01-22 15:32:31 +01:00
be7106a974 LibOverride: Add an 'post apply' callback to IDTypeInfo.
Currently this is needed to properly tag PointCache's for info update
(fixes an issue reported in T82503).

Suspect we may need this in more cases in the future though, RNA
assign/update processes are not always 100% enough to deal with
complicated corner cases.
2021-01-22 15:31:15 +01:00
7e32bb8492 Merge branch 'blender-v2.92-release' 2021-01-22 14:32:01 +01:00
226eb5e366 Cycles: Fix usage of double floating precision in CNanoVDB
Double floating point precision is an extension of OpenCL, which might
not be implemented by certain drivers, such as Intel Xe graphics.

Cycles does not use double floating point precision, and there is no
need on keeping doubles unless there is an explicit decision to use
them.

This is a simple fix from Cycles side to replace double floating point
type with a type of same size and alignment rules. Inspired by Brecht
and Patrick.

Tested on NVidia Titan V, Radeon RX Vega M, and TGL laptop.

Differential Revision: https://developer.blender.org/D10143
2021-01-22 14:31:06 +01:00
18e063b69d Functions: use better conversion from float2 to float3
Previously float2 was converted to float3 by implicitly converting to a
float pointer first, which was then passed to the float3 constructor.
This leads to uninitialized memory in the z component of the new float3.

Ideally this should be solved in float2/float3 itself, but my first fix for
that resulted in a compile error: rB6ac0a3d83c8e5a39bd5356aa0d68e3166bd91e82

This is an alternative fix that can be used for now. Will have to look
into the conversion in more detail again.
2021-01-22 13:46:13 +01:00
7a07ca1f8c Merge branch 'blender-v2.92-release' 2021-01-22 13:41:35 +01:00
644976548d Revert "BLI: add conversion from float2 to float3"
This reverts commit 6ac0a3d83c.
2021-01-22 13:40:45 +01:00
9fbf3075ad Merge branch 'blender-v2.92-release' 2021-01-22 12:26:23 +01:00
2ba2d2bd9d Fix T76936: Mesh shape amended upon undoing in sculpt mode
Was happening when there are deform modifiers prior to the multires.

There are detail in the comment around sculpt_undo_refine_subdiv(),
but briefly: the subdiv was refined with wrong base mesh coordinates.

Differential Revision: https://developer.blender.org/D10158
2021-01-22 12:26:02 +01:00
7f96e6ed7e Merge branch 'blender-v2.92-release' 2021-01-22 12:17:44 +01:00
6ac0a3d83c BLI: add conversion from float2 to float3
Previously float2 was converted to float3 by implicitly converting to a
float pointer first, which was then passed to the float3 constructor.
This leads to uninitialized memory in the z component of the new float3.
2021-01-22 12:16:53 +01:00
ae4a430755 Merge branch 'blender-v2.92-release' 2021-01-22 11:54:43 +01:00
526373b897 Cleanup - Point Instance: Use own DNA struct
We will need to expand this node soon to add weight/count for different
elements inside the collection. For that it is better to have the node
to use its own DNA.
2021-01-22 11:47:47 +01:00
cd8893d446 Fix (unreported) LibOverride: hair cache settings not working.
Thanks to that same point cache being exposed in **four** different RNA
paths (twice in particle system, and twice in its embedded cloth
simulation settings).

Only way is to also make particle system overridable.
2021-01-22 11:39:56 +01:00
d179e1c6e4 Merge branch 'blender-v2.92-release' 2021-01-22 11:26:15 +01:00
0373d1b09f GPencil: Fix unreported Vertex Paint masking error
The masking was not working as expected and allowed to paint non selected strokes.
2021-01-22 11:25:32 +01:00
8eaea99d98 Merge branch 'blender-v2.92-release' 2021-01-22 20:00:14 +11:00
Stefan Werner
927d099ec0 Particles: Fixed thread work size calculation.
Dividing the workload by number of tasks in float is imprecise and
lead in some cases to particles not being calculated at all
(example: 20000 particles, 144 tasks).

Switching this calculation to integer makes sure we don't lose count.

Differential Revision: https://developer.blender.org/D10157
2021-01-22 09:30:35 +01:00
Stefan Werner
cdf564277c Particles: Fixed thread work size calculation.
Dividing the workload by number of tasks in float is imprecise and
lead in some cases to particles not being calculated at all
(example: 20000 particles, 144 tasks).

Switching this calculation to integer makes sure we don't lose count.

Differential Revision: https://developer.blender.org/D10157
2021-01-22 09:22:13 +01:00
3a9d43cf31 Fix outliner and animation editors exiting multi-object edit-mode
When multiple objects were in edit-mode,
only the active object would exit edit-mode.
2021-01-22 18:43:00 +11:00
2469ddc1a9 Cleanup: correct last spelling cleanup 2021-01-22 17:12:11 +11:00
c0bbb93b88 Cleanup: spelling, remove outdated/invalid comments 2021-01-22 16:54:35 +11:00
421c5127f4 Merge branch 'blender-v2.92-release' 2021-01-22 16:43:48 +11:00
295b21f56a Merge branch 'blender-v2.92-release' 2021-01-22 16:43:44 +11:00
ee5a4f41eb Fix the NLA setting the active object without exiting edit-mode
This is done by convention in the outliner and dope-sheet.

Missing edit-mode exit causes glitches with mixed object/edit-mode undo.
2021-01-22 16:08:12 +11:00
141f17eaf4 Fix dope-sheet exiting edit-mode when activating an object
Regression from d8992192e5
The original code relied on having a separate edit-object pointer
than the active object.
2021-01-22 16:00:31 +11:00
8d958fe685 Merge branch 'blender-v2.92-release' 2021-01-22 15:45:48 +11:00
1a30687c24 Fix undo crash on active object change without exiting edit-mode
While the previous fix for T84920 is correct, the crash could still be
triggered by changing the active object while in edit-mode.

Ensure stale data isn't used by tagging for depsgraph update when
edit-mode data is freed on undo.

While exiting edit-mode normally does this, it's possible to set the
active object to a non edit-mode mesh, skipping the mode-switch
operator and it's depsgraph tagging.
2021-01-22 15:43:25 +11:00
4f3fba2aa7 Merge branch 'blender-v2.92-release' 2021-01-22 12:42:20 +11:00
665eca85ba Merge branch 'blender-v2.92-release' 2021-01-22 12:42:15 +11:00
7b528b2a3a Fix T84920: Crash undoing object activation in the outliner
Regression from d8992192e5
The original code relied on having a separate edit-object pointer
than the active object.

Use a utility function to avoid code duplication as there are
other areas that have similar functionality.
2021-01-22 12:38:55 +11:00
99e5d5ba21 Fix marker camera switch + undo crashes in edit-mode
Selecting markers and cameras could crash when in edit-mode.

Only support this in object mode as mode-switching as part of
activating cameras doesn't seem like a priority.

This has the same root cause as T84920.
2021-01-22 12:38:55 +11:00
e391ad7bbc Merge branch 'blender-v2.92-release' 2021-01-21 23:24:19 +01:00
b9e07c1e0b Fix T84896: Boundary brush not affected by automasking
This uses the values form the stroke automasking cache to control the
falloff of all deformers in the boundary brush. Usually this is already
considered in the general brush falloff function for the rest of the
brushes, but this is one of the exceptions where the brush implements
its custom falloff.

Reviewed By: JacquesLucke

Maniphest Tasks: T84896

Differential Revision: https://developer.blender.org/D10161
2021-01-21 23:23:08 +01:00
96fa78f5b0 Fix editors showing old data-block name after renaming in Outliner
E.g. the graph editor channels list would still show the old name of a material
that was renamed in the Outliner. Same for the Asset Browser when showing
data-blocks in the "Current File" repository.

The Outliner didn't send the notifier for some data-block types that editors
listen to for data-block name changes.
2021-01-21 22:56:38 +01:00
ca475479eb Fix Asset Browser showing old name after renaming data-block
The "Current File" asset library didn't get refreshed after the data-block name
changed. But rather than entirely refreshing the file list, or doing possibly
problematic partial refreshes, reference the data-block name directly, so a
simple redraw gets the new name displayed.

Addresses T83751
2021-01-21 22:23:43 +01:00
41982af6a0 Merge branch 'blender-v2.92-release' 2021-01-21 21:59:56 +01:00
f24992d2ec GPencil: Deactivate interpolation of gpencil curves
To avoid unexpected behavior and desync issues with
stroke and curve data, the interpolation operators are deactivated
in curve edit mode.
2021-01-21 21:58:39 +01:00
b4b02eb4ff UI: Transform Arrow Cursor Refactor
Mouse cursors used during transforms made to work better with changes of user scale and line width.

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

Reviewed by Campbell Barton
2021-01-21 08:19:26 -08:00
ceb500df03 Geometry Nodes: fix losing data when attribute has incorrect type
Differential Revision: https://developer.blender.org/D10165
2021-01-21 17:02:07 +01:00
425e706921 Geometry Nodes: new Attribute Sample Texture node
This node allows sampling a texture for every vertex based on some
mapping attribute. Typical attribute names are the name of a uv map
(e.g. "UVMap") and "position". However, every attribute that can be
converted to a vector implicitly is supported.

It should be noted that as of right now, uv map attributes can only be
accessed after a Point Distribute node.

Ref T82584.

Differential Revision: https://developer.blender.org/D10121
2021-01-21 16:49:06 +01:00
a92ebab5da Windows: Add "--debug-cycles" argument to "blender_debug_gpu.bat" batch file
This extends the "blender_debug_gpu.bat" batch file to also be useful for triaging Cycles
problems. OptiX initialization errors or problem while iterating CUDA devices are only
logged when the `--debug-cycles` flag is specified, so adding that here.

Reviewed By: brecht, LazyDodo

Differential Revision: https://developer.blender.org/D10167
2021-01-21 16:47:16 +01:00
b32e8e5ba7 Gpencil: Fix missing change in previous commit
This was related to the changes for Layer and Frame duplication.
2021-01-21 16:04:12 +01:00
cfd54ad7d7 GPencil: New option to Duplicate Layers with Empty Keyframes
This option allows to duplicate the layer and keyframes but without copying the strokes. This is very handy for the cleanup and paint process.
2021-01-21 16:00:12 +01:00
9c4c3fbabc GPencil: Make Layer and Frame duplicate functions more flexible
Now it's possible to copy only part of the data. This will be used in future operators.
2021-01-21 15:57:10 +01:00
3fd92b5c22 Fix T83344: Cycles baking + progressive refine fails 2021-01-21 15:12:17 +01:00
f817a11dc6 Cleanup: variable rename.
Avoid using two or three chars names when it's not absolutely obvious
what they mean.
2021-01-21 14:59:25 +01:00
643420186c EEVEE: Depth Of Field: Add gather density change
To fix closer background undersampling, we change gathering ring
density in the middle of the convolution. We change the weighting
of the already accumulated samples accordingly.
2021-01-21 14:53:14 +01:00
1135790ad5 Asset Browser: Enable by default in alpha builds
The Asset Browser is still considered an experimental feature right now. But it
can be enabled by default for alpha builds, to get further testing and
feedback. It will hopefully be a non-experimental feature by the end of bcon1.
This is done in agreement with Dalai.
2021-01-21 14:40:13 +01:00
84702bd3d8 Fix T84242: freestyle animated camera shift lags behind in animation render 2021-01-21 14:21:49 +01:00
f4d07196bd Merge branch 'blender-v2.92-release' 2021-01-21 13:20:58 +01:00
aff7d59986 Fix T84908: Cycles GPU + CPU and denoising failure after recent fix 2021-01-21 13:20:05 +01:00
324d6d2192 Tracking: Cleanup, yet another spelling in the same line
Spotted by Jacques, thanks!
2021-01-21 12:53:14 +01:00
649c87814d Merge branch 'blender-v2.92-release' 2021-01-21 12:42:21 +01:00
9237b2019c Fix T84867: Transform node applies transforms in the wrong order 2021-01-21 12:39:30 +01:00
35f379ba26 Tracking: Actual spelling cleanup in the comment
The previous spelling cleanup did not catch this, so didn't the
review of the coming proportional editing code change.
2021-01-21 12:34:37 +01:00
793547e7d1 Geometry Nodes: initial support for volumes
For the most part, this just adds boilerplate code for volume support in geometry nodes:
* Add `VolumeComponent` next to `MeshComponent`, etc.
* Support `VolumeComponent` in depsgraph object iterator.

Furthermore, I added initial volume support in a few nodes:
* The Object Info node outputs an object instance when the input is a volume object
  (that will be the same for mesh objects soonish, to avoid copies).
* Support transforming a `VolumeComponent` in the Transform node.
* Support the `VolumeComponent` in Join Geometry nodes, but only when just one of the
  inputs has a volume component for now.

Right now, there is no way to create a `VolumeComponent`, because the Object Info node
outputs an object instance. The `VolumeComponent` will be necessary for upcoming nodes,
which will generate volumes on the fly.

Viewport selection does not work correctly with `VolumeComponent`s currently. I don't
know why that is. That can be figured out a bit later, once we can actually create
new volumes in geometry nodes.

Ref T84604.

Differential Revision: https://developer.blender.org/D10147
2021-01-21 10:32:42 +01:00
985bc08688 Merge branch 'blender-v2.92-release' 2021-01-21 16:37:52 +11:00
eb45e7be47 UI: particle tool properties layout tweaks
Adopt some of the newer layout abilities to
clean up the Particle Tool Properties a bit.

- Use in-line check-boxes next to values.
- Use text heading for Preserve toggles and mirror/topology mirror.

Reads clearer. Uses less space. Is more consistent.

Reviewed By: #user_interface, pablovazquez, Blendify, campbellbarton

Ref D10130
2021-01-21 16:08:43 +11:00
William Reynish
cd4e27a4a1 Industry Compat Keymap: Fix box/lasso selection for GP edit mode
There was a bug which which prevented box and lasso select to work
correctly in GP Edit Mode. It would select a nearby vertex before the
box selection.

This patch fixes it so it works with a click event,
like the default keymap, which fixes box and lasso selection.

Ref D10119
2021-01-21 15:11:33 +11:00
011a79215d Merge branch 'blender-v2.92-release' 2021-01-21 15:00:58 +11:00
d7cfee0b68 Fix use of uninitialized variable in image sequence detection
Uninitialized stack memory was being re-used in a loop.

Error in original commit from 04f81c8225

This happened to work as the same memory location was re-used
between iterations and not overwritten.
2021-01-21 14:59:40 +11:00
b243fab16b Merge branch 'blender-v2.92-release' 2021-01-21 14:05:59 +11:00
eaf5ee8981 Cleanup: NULL used for boolean 2021-01-21 14:05:16 +11:00
41a945d746 Docs: add note on convention for setting line-width 2021-01-21 11:12:11 +11:00
7b45850eac Cleanup: spelling 2021-01-21 10:59:50 +11:00
b303769d2e Merge branch 'blender-v2.92-release' 2021-01-20 20:01:40 +01:00
c60c30205d Fix T82966, T78152: Cycles GPU render hair ribbon artifacts and differences
Now it should match CPU rendering much more closely.
2021-01-20 19:59:43 +01:00
4f3fb67c43 EEVEE: Depth Of Field: Fix missing slight focus convolution
This was due to recent change in the accumulate_sample_pair
function.
2021-01-20 18:24:56 +01:00
c07c110467 Merge branch 'blender-v2.92-release' 2021-01-20 18:18:38 +01:00
b33d839162 Fix T84867: Transform node does not rotate/scale instances
The manipulation of rot/scale was simply not implemented.
2021-01-20 18:17:25 +01:00
a823e825c8 Fix T84569: crash when trying to bake an object with no faces
Differential Revision: https://developer.blender.org/D10125
2021-01-20 18:07:51 +01:00
e267afebf4 EEVEE: Depth Of Field: Fix early out on half res CoC
`layer_threshold` is based on fullres CoC radius. Better compare
apple to apple.
2021-01-20 18:04:27 +01:00
e69f8483ed EEVEE: Depth Of Field: Fix slight out of focus missing tile
Slight out of focus tiles needs to be expanded too at least once.
2021-01-20 17:49:38 +01:00
0d599ce95a GPencil: Fix unreported NaN value for UV Rotation in Primitives
Using primitive drawings, the point UV rotation was not initialized.
2021-01-20 16:53:42 +01:00
e12eb89f22 Fix T81429: move tool's axis constraints not drawn completely when using local orientation
In fact, the drawing was that of the local contraint axis (which is
summarized so as not to fill the screen with too much information).

Use the local contraint axis only when more than one object is selected.
2021-01-20 12:35:38 -03:00
736b0d6894 Revert "Transform: Use orientation of active object with Auto Constraint"
This reverts commit 54f248fa87.

And fixes T84259.

Apparently the ideal behavior was the previous one.
2021-01-20 12:28:00 -03:00
1f691050e5 Fix T84539: cryptomatte metadata lost when using save buffers option 2021-01-20 14:59:23 +01:00
10d2cbfa36 Fix T84872: OptiX GPU + CPU rendering uses branched path samples
Branched path tracing is not supported for OptiX, and it would still use the
number of AA samples from there when branched path was enabled by the user
earlier but auto disabled and hidden in the UI when using OptiX.

Ref D10159
2021-01-20 14:59:23 +01:00
1451f7d093 Fix T84813: enabling Cycles OpenImageDenoise during GPU viewport render fails 2021-01-20 14:59:23 +01:00
9f658822f9 EEVEE: Depth Of Field: Fix ring opacity issues
Accumulate transparency instead of occlusion to avoid precision
error an make closer objects more water tight.

Also fixed reversed occlusion ring accumulation.
2021-01-20 14:50:09 +01:00
fc5f9a8ac9 Merge branch 'blender-v2.92-release' 2021-01-20 14:40:46 +01:00
4a09907eab Fix T84049: Crash when using Cycles Progressive Refine with OptiX+CPU
Tile stealing may steal a CPU tile buffer and move it to the GPU, but next time around that
tile may be re-used on the CPU again (in progressive refinement mode). The buffer would
still be on the GPU then though, so is inaccessible to the CPU. As a result Blender crashed
when the CPU tried to write results to that tile buffer.
This fixes that by ensuring a stolen tile buffer is moved back to the device it is used on before
rendering.
2021-01-20 14:40:27 +01:00
4f6ce899d4 EEVEE: Depth Of Field: Disable filtering for foreground
This is to avoid darkening of the edges. This might be fixed if
we also filter the weight buffer (TODO).
2021-01-20 14:32:32 +01:00
6a8f4bfc60 Tracking: Fix missing average of track offset 2021-01-20 14:07:48 +01:00
b01c865687 Merge branch 'blender-v2.92-release' 2021-01-20 13:48:44 +01:00
87db3423c9 Fix Lock to Selection does not work in mask mode
A regression since 2.80: need to use evaluated mask to calculate
its bounds. Non-evaluated mask does not contain state for the
current frame, so iterating over control points of the original
mask gives points state from the time they were edited last (aka,
not affected by the animation).
2021-01-20 13:46:39 +01:00
Yevgeny Makarov
a73dfac519 Fix T73575: Zooming out a lot faster than zooming in
- Zooming out a lot faster than zooming in,
  it had the wrong aspect ratio, make all the preparations
  with the factors instead of deltas.
- Improved following the `zoom_invert`
  (should not apply to `MOUSEZOOM`) and "trackpad natural scroll"
  preferences.
- `zoomfac` adjustment, same as in `view_zoomdrag_modal`.

Ref D8686
2021-01-20 22:56:35 +11:00
Yevgeny Makarov
9425628c84 Fix T65837: Zoom Axis is not working in the Node Editor
It was already fixed for the mouse in
bcda8cc89b, T65837
now the same logic is applied for the track-pad.

Ref D8685
2021-01-20 22:56:35 +11:00
f2988543c2 Merge branch 'blender-v2.92-release' 2021-01-20 22:10:15 +11:00
8e5b6320a6 Add Object Tool: minor improvements to tool-tips 2021-01-20 21:47:52 +11:00
William Reynish
685419d6be UI: Object "Make Links" sub-menu overhaul
- Rename to "Link/Transfer Data".
- Move Mesh Data Transfer operators here from the Relations sub-menu.
- Clarify which operations links to, copies or transfers/projects
  data using Link, Copy and Transfer leading text.
- Re-order contents to fit each category and add separators.
- Add enum tool-tips.

Reviewed By: Blendify, campbellbarton pablovazquez, mont29

Ref D10090
2021-01-20 20:51:44 +11:00
91bf24dd00 Cleanup: clang-format 2021-01-20 20:43:58 +11:00
f0ab9034d9 Merge branch 'blender-v2.92-release' 2021-01-20 20:42:54 +11:00
aee7d8f411 Cleanup: clang-format 2021-01-20 20:42:15 +11:00
e69034e6d9 Merge branch 'blender-v2.92-release' 2021-01-20 10:16:30 +01:00
c082b21625 Fix typo in UI message.
Noted by Satoshi Yamasaki (@yamyam) in rBTS5522.
2021-01-20 10:15:59 +01:00
160d8c1ea6 Merge branch 'blender-v2.92-release' 2021-01-20 18:56:29 +11:00
fad8a753a9 Add Object Tool: adjust cursor alpha when near view aligned
The cursor-plane was too dense/bright when approaching view alignment.
2021-01-20 18:55:44 +11:00
2c31a84bd1 Merge branch 'blender-v2.92-release' 2021-01-20 17:08:56 +11:00
1db904d954 Merge branch 'blender-v2.92-release' 2021-01-20 17:08:53 +11:00
74c6c504b2 Merge branch 'blender-v2.92-release' 2021-01-20 17:08:49 +11:00
908b383b7d UV: tweak face select behavior
When the mouse cursor is inside the UV face,
extend the selection threshold.

This means when zoomed in, a face can always be selected when the cursor
is inside it.
In the case of multiple overlapping faces - the face with the closest
center is used.

----

Prior to 246efd7286, the UV selection
threshold was scaled by the zoom level, so selecting a face when zoomed
in close would often often select faces even when the on-screen center
was outside the intended threshold.

Having a zoom-independent threshold may require more precision than
users are used to.

This change addresses this.
2021-01-20 17:07:20 +11:00
9f337bef80 Cleanup: move UvNearestHit.ob assignment in find nearest functions
Splitting assignments between functions complicates refactoring.

Also rename 'hit_final' to 'hit', since there are no longer a local
'hit' variable defined in these functions.
2021-01-20 17:00:39 +11:00
8bd5d58860 BMesh: add function to check if a point is inside a faces UV's 2021-01-20 16:56:59 +11:00
255c850e0b Cleanup: spelling 2021-01-20 16:15:53 +11:00
b2a6e2abdb Cleanup: remove extra in trailing asterisk
Comment blocks not conforming to convention.
2021-01-20 16:14:00 +11:00
69d30c1543 Merge branch 'blender-v2.92-release' 2021-01-20 16:11:22 +11:00
41d1729148 Merge branch 'blender-v2.92-release' 2021-01-20 16:11:19 +11:00
6f47549fe5 Merge branch 'blender-v2.92-release' 2021-01-20 16:11:15 +11:00
c7f6309437 Merge branch 'blender-v2.92-release' 2021-01-20 16:11:12 +11:00
b2037464e4 CMake: add missing headers
Resolves 'cmake_consistency_check' reports.
2021-01-20 16:08:52 +11:00
be970c03c2 Cleanup: spelling & cleanup for cmake_consistency_check
Much more could be done here, some obvious corrections.
2021-01-20 16:04:03 +11:00
d3fe320b83 CMake: update checking utility to ignore nanovdb files 2021-01-20 16:03:57 +11:00
0706a756f9 Cleanup: remove unused file SEQ_util.h
Committed by accident when SEQ_utils.h was also created.
2021-01-20 16:01:40 +11:00
63e898a0ff EEVEE: Depth Of Field: Add Bokeh shape texture precomputation
To support geometric bokeh shapes, we now use a texture to guide
the gathered samples and modify the scattered pixels shapes.

This is done by a very fast precomputation pass that outputs the
bokeh shape to a texture that is then sampled by the convolution
pass.
2021-01-20 01:43:42 +01:00
6290091bac Cleanup: Store runtime space node variables in a separate struct
This commit moves runtime-only variables from the `SpaceNode`
DNA struct to a private struct in `node_intern.h`. Before, it was hard
to tell which data needed to be saved in files, this should make it
more clear.

Node that the `edittree` field is basically a runtime variable, since
it's set from the `treepath` list on read, but moving it would require
some more invasive changes that I don't think are worth it right now.
Also, not all of the moved variables were explicitly cleared on read--
`aspect` is set at the start of a redraw, `cursor` is set in a region
callback, and `recalc` was used as an update flag.

Differential Revision: https://developer.blender.org/D10141
2021-01-19 16:43:08 -06:00
da6dea5701 Cleanup: Use const arguments, explicit type 2021-01-19 16:09:34 -06:00
694032c9d1 Merge branch 'blender-v2.92-release' 2021-01-19 19:02:57 +01:00
c2e6969c56 Refactor modifier copying code.
Things like pointers to particle systems, or softbody data being stored
outside of its modifier, make it impossible for internal modifier copy
data code to be self-contained currently. It requires extra processing.

In existing code this was handled in several different places, in
several ways, and alltogether fairly inconsistently. Some cases were
even not properly handled, causing e.g. crashes as in T82945.

This commit addresses those issues by:
 * Adding comments about the hackish/unsafe parts `psys` implies when
   copying some modifier data (since we need to ensure particle system
   copying and remapping of those pointers separately).
 * Adding as-best-as-possible handling of those cases to
   `BKE_object_copy_modifier` (note that it remains fragile, but is
   expected to behave 'good enough' in any practical usecase).
 * Remove special handling for specific editor code
   (`copy_or_reuse_particle_system`). This should never have been
   accepted in ED code area, and is now handled by
   `BKE_object_copy_modifier`.
 * Factorize copying of the whole modifier stack into new
   `BKE_object_modifier_stack_copy`, now used by both `object_copy_data`
   and `BKE_object_link_modifiers`.

Note that this implies that `BKE_object_copy_modifier` and
`BKE_object_copy_gpencil_modifier` are now to be used exclusively to
copy single modifiers. Full modifier stack copy should always use
`BKE_object_modifier_stack_copy` instead.

Fix T82945: Crash when dragging modifiers in Outliner.

Maniphest Tasks: T82945

Differential Revision: https://developer.blender.org/D10148
2021-01-19 18:58:35 +01:00
bc95c249a7 Refactor modifier copying code.
Things like pointers to particle systems, or softbody data being stored
outside of its modifier, make it impossible for internal modifier copy
data code to be self-contained currently. It requires extra processing.

In existing code this was handled in several different places, in
several ways, and alltogether fairly inconsistently. Some cases were
even not properly handled, causing e.g. crashes as in T82945.

This commit addresses those issues by:
 * Adding comments about the hackish/unsafe parts `psys` implies when
   copying some modifier data (since we need to ensure particle system
   copying and remapping of those pointers separately).
 * Adding as-best-as-possible handling of those cases to
   `BKE_object_copy_modifier` (note that it remains fragile, but is
   expected to behave 'good enough' in any practical usecase).
 * Remove special handling for specific editor code
   (`copy_or_reuse_particle_system`). This should never have been
   accepted in ED code area, and is now handled by
   `BKE_object_copy_modifier`.
 * Factorize copying of the whole modifier stack into new
   `BKE_object_modifier_stack_copy`, now used by both `object_copy_data`
   and `BKE_object_link_modifiers`.

Note that this implies that `BKE_object_copy_modifier` and
`BKE_object_copy_gpencil_modifier` are now to be used exclusively to
copy single modifiers. Full modifier stack copy should always use
`BKE_object_modifier_stack_copy` instead.

Fix T82945: Crash when dragging modifiers in Outliner.

Maniphest Tasks: T82945

Differential Revision: https://developer.blender.org/D10148
2021-01-19 18:50:32 +01:00
bcdba7c34d UI: Deselect other objects when dragging into 3D View
When dragging an object into the 3D View, e.g. from the Outliner or the Asset
Browser, other objects wouldn't get deselected. That differs from what other
drop operations do, which create a new object. They deselect other objects in a
lower-level function, which happens to not be called for just dropping objects.
So I guess this is an oversight.
Old behavior was also a bit annoying because users seem to expect this to
deselect.
2021-01-19 18:47:20 +01:00
02a63115d2 Merge branch 'blender-v2.92-release' 2021-01-19 18:40:40 +01:00
c371d699ca Fix T84784: Time Remapping not displaying in the timeline
Caused by rBbbb2e0614fc3.

Oversight to not take the remapped framelength into account.

Maniphest Tasks: T84784

Differential Revision: https://developer.blender.org/D10134
2021-01-19 18:31:21 +01:00
7d114e5d87 Merge branch 'blender-v2.92-release' 2021-01-19 18:28:45 +01:00
36f0a1ead7 Fix T84823: crash rendering with unconnected input socket in File Output node
Caused by rB957e292c5864.

Now just skip unconnected sockets.

Maniphest Tasks: T84823

Differential Revision: https://developer.blender.org/D10137
2021-01-19 18:23:53 +01:00
b39ee69789 Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-19 18:23:08 +01:00
d311a76931 Fix merge from 2.92 (subversion bump 292.14) 2021-01-19 18:20:12 +01:00
c3207d88c2 Object Info: Fix tooltip for the transform space option
This was agreed outside the patch discussion. And it did not make into
the submitted code on 8b777ee6d6.
2021-01-19 18:13:50 +01:00
40e089716b Merge branch 'blender-v2.92-release' 2021-01-19 18:12:34 +01:00
05179a0ba4 Volumes: fix calling BKE_volume_load from multiple threads
`BKE_volume_is_loaded` uses `grids.filepath` to determine if the
grids are already loaded. The issue was that `grids.filepath` was
set before the grids were loaded, resulting in incorrect early
returns for other threads.

Differential Revision: https://developer.blender.org/D10150
2021-01-19 18:01:22 +01:00
8b777ee6d6 Geometry Nodes - Object Info: option to apply obj transform to the geometry
By design the modified object transformations should still work and
affect the geometry nodes results. The current behaviour, however, would
make the geometry from the object info to not be affected by the
modified object transformations. This patch changes that by default.

In a similar fashion the Location, Rotation and Scale sockets outputs
should be aware of whether the output should be in the global space or in the
space of the nodetree.

To solve this, the patch introduces a new transformation space "enum"
where users can pick "Original" or "Relative" space.

Original
--------
Output the geometry relative to the input object transform, and the
location, rotation and scale relative to the world origin.

Relative
--------
Bring the input object geometry, location, rotation and scale into the
modified object maintaining the relative position between the two objects in
the scene.

Relative space violates a bit the design of the nodetree. The geometry in this
case is transformed so that moving the modified object doesn't interfere with
the geometry. This is particularly useful for the boolean node for instance.

"Original" is the default space, but old files are set to "Relative" for
backwards compatibility.

Differential Revision: https://developer.blender.org/D10124
2021-01-19 17:30:44 +01:00
9a32c7130b Geometry Nodes: pass depsgraph to nodes during execution
The depsgraph will have to be accessed in an upcoming patch.
2021-01-19 16:58:05 +01:00
d60b128274 Merge branch 'blender-v2.92-release' 2021-01-19 12:32:07 +01:00
a9203e25a2 Fix T84642: Reassign effect-strip ignores animdata
When reassigning an effect strip to another sequence, any animation data
in the effect strip will not be offset like expected.

The fix calls `SEQ_offset_animdata` to offset the animation data after
the seqence has been moved.

Reviewed By: ISS

Maniphest Tasks: T84642

Differential Revision: https://developer.blender.org/D10096
2021-01-19 12:31:02 +01:00
089cd25982 Merge branch 'blender-v2.92-release' 2021-01-19 20:43:49 +11:00
a86bb2594f Fix T84698: error adding movie clip tracks
The movie clip's `region->v2d` was being resized by the view2d code,
causing mouse cursor to movie-clip coordinate mapping to fail.

This commit removes `UI_view2d_region_reinit`,
matching the behavior for the image editor's 2D view.

Reviewed By: sergey

Ref D10106
2021-01-19 20:39:31 +11:00
df2ed1550d Fix T74755: Cap of curve doesn't have smooth shading
Copy the smooth setting when filling in curve caps.

For drawing this doesn't change behavior as a single normal is used
for all faces.

The difference may be noticed when converting to a mesh or with
modifiers applied.
2021-01-19 17:24:25 +11:00
1cc54107a9 Merge branch 'blender-v2.92-release' 2021-01-19 17:14:47 +11:00
d26588268d Merge branch 'blender-v2.92-release' 2021-01-19 17:14:43 +11:00
418cd7c4ba Fix T84041: Bevel caps have invalid normals
Bevel caps always had incorrect normals, causing display glitches
in some cases.

It seems this never worked properly (at least 2.79 also had this bug).

Use the projection vector as the normal.
2021-01-19 17:12:01 +11:00
e25f7e33ff Fix T84568: UV loop selection marks edges sharp
Regression in 6a10e69d27
(added when testing).
2021-01-19 15:32:00 +11:00
94e9d3ca3e Merge branch 'blender-v2.92-release' 2021-01-19 13:36:53 +11:00
d31dd1da80 Fix T84824: Incorrect height using interactive add tool
When using the interactive add tool for primitives with a fixed
height and base aspect ratio, the height of the created primitive
would be incorrect (two times too small or two times too big).

When the base origin was centered, the `fixed_aspect_dimension`
was not changed even though the base length was doubled.
Additionally, when the height origin was centered but the height
aspect ratio was fixed, the height was doubled leading to an
incorrect size.

The fix doubles `fixed_aspect_dimension` when the base origin is
centered and correctly calculates the height of the primitive when
the aspect ratio is set to fixed.

Ref D10140
2021-01-19 13:20:02 +11:00
2fa7e81d9c Cleanup: use 'const' argument for parameter argument 2021-01-19 12:59:00 +11:00
d144337098 Merge branch 'blender-v2.92-release' 2021-01-19 12:45:11 +11:00
58e554a55c Fix T66681: Blender 2.7x keymap inconsistencies
Match Blender 2.7x keymap more closely.

- Image Editor: F3 for save image as.
- Node Editor: Ctrl-LMB to cut links.
- Cycle the falloff types instead of showing a pie-menu.
- Use regular menu instead of pie menu for snapping.
2021-01-19 12:20:48 +11:00
09c7c63890 UI Code Quality: Use "params" struct for area and region callbacks
These functions with many arguments can be unwieldy. Aside from the obvious issues
with rewriting the list of arguments and the opportunities for error and frustration
that presents, the long list of arguments make these systems hard to change. So when
an argument should be added, someone might skip that and add some hack instead.

So, as proposed in T73586#1037210, this patch instead uses a "params" struct for
each of these callbacks.

- Use param argument for `ARegionType.listener`
    - Remove unused window field in region listener
- Use param argument for `SpaceType.listener`
- Use params struct for `ARegionType.message_subscribe`

Differential Revision: https://developer.blender.org/D9750
2021-01-18 17:28:47 -06:00
4b4aec2884 Cleanup: Clang tidy else after return 2021-01-18 14:21:24 -06:00
bfa083f873 Cleanup: Clang tidy else after return 2021-01-18 12:48:51 -06:00
239229c390 EEVEE: Depth Of Field: Dilate CoC Tiles based on max CoC radius
This means we now supports arbitrary large CoC.
This makes sure to always covers the maximum tile radius.
2021-01-18 18:36:03 +01:00
40d6ee5304 Merge branch 'blender-v2.92-release' 2021-01-18 20:08:41 +03:00
b5c3f26cba Armature: fix B-Bone deformation blending artifacts with Preserve Volume.
The double quaternion blending method in addition to the deformation
matrix of each bone requires their rest matrices. For ordinary bones
this literally should use the bone rest matrix without any ambiguity.

However, it was also using the bone rest matrix for all of its
B-Bone segments, which is incorrect and causes strange deformation
in some cases involving extreme non-uniform scale, especially
at boundaries between different B-Bones. There is also a similar
known issue that happens with scale at bending joints, and this
fix reduces the distortion when both bones are B-Bones.

This changes both the Armature modifier and the Armature constraint
to use the actual segment rest matrices. Unlike bones, these can have
scale even in rest pose, so normalization is required.

Differential Revision: https://developer.blender.org/D10003
2021-01-18 20:08:16 +03:00
f17b26bbed Tracking: Implement tracks average operator
Average selected tracks into the new one. This can be used to improve
stability of tracking on blurry or non-very-sharp feature shapes.

Averaging happens for all position, pattern corners and search area.
Disabled markers do not take effect on averaging. Keyframed flag is
copied from source.

Gaps in the source tracks will be linearly interpolated, to reduce
result track jump. Note that this only applies to gaps "inbetween".
This means that if an input track doesn't have markers in the
beginning/end of it, there is nothing to interpolate with and the
result track will jump.

Available from the Track panel, under the Merge category.

Differential Revision: https://developer.blender.org/D6323
2021-01-18 16:38:40 +01:00
0ac8fec3be Tracking: Add interpolated accessor for markers
Allows to get marker position interpolated through out a gap.

Currently unused, but is covered with test. Aimed to be used for
track average operator.
2021-01-18 16:38:40 +01:00
0ca0d3366d Tracking: Re-write marker request function
There are two main things.

First, remove the marker index caching. Thins makes it possible to
safely use function from a threaded environment.

Second, replace linear search with binary search, which speeds up
random lookup.

There is no measurable difference in the stabilization which had a
comment about caching nature of track lookup. The random lookup
complexity changed from O(N) to O(log N). In practice this also
unlikely to be measurable, but thread-safety worth it.
2021-01-18 16:38:40 +01:00
f508292277 Fix T84719: Doversion for curve edit settings
Make sure default values for curve edit mode are filled for older files.

Reviewed By: antoniov

Maniphest Tasks: T84719

Differential Revision: https://developer.blender.org/D10136
2021-01-18 16:29:09 +01:00
5e0ef4ef85 Fix T84719: Doversion for curve edit settings
Make sure default values for curve edit mode are filled for older files.

Reviewed By: antoniov

Maniphest Tasks: T84719

Differential Revision: https://developer.blender.org/D10136
2021-01-18 16:23:13 +01:00
0145c8d484 Merge branch 'blender-v2.92-release' 2021-01-18 15:47:33 +01:00
0d8948387e Cycles: Fix missing OpenCL extensions in certain cases
If extensions string is longer than 1024 then the old code would have
reported empty string instead of extensions.

Now the code does dynamic string allocation to store result of request,
similar to what is done in `OpenCLInfo::get_hardware_id`.

The code looks a bit ugly, but it didn't really change much with this
patch. In other words, the code can become more modern and clear, but
it is considered to be outside of the scope of this change.

Differential Revision: https://developer.blender.org/D10135
2021-01-18 15:47:00 +01:00
ce0f212498 Merge branch 'blender-v2.92-release' 2021-01-18 15:30:48 +01:00
4fde594fda Fix T84650: CPU render + OptiX denoiser leaves empty tiles unprocessed
The OptiX denoiser is part of the OptiX device, so to the tile manager looks like a GPU device. As a
result the tile stealing implementation erroneously stole CPU tiles and moved them to that OptiX
device, even though in this configuration the OptiX device was only set up for denoising and not
rendering. Launching the render kernel therefore caused a crash because of a missing AS etc.
This fixes that by ensuring tiles can only be stolen by devices that support render tiles.
2021-01-18 15:30:25 +01:00
023ebb890b Merge branch 'blender-v2.92-release' 2021-01-18 15:02:24 +01:00
1c2b203795 Fix T84600: prevent bone groups operators on proxies and library
overrides

Editing bone groups is not supported on proxies/overrides [changes a re
lost on file reload], need to do proper polling (and also prevent this
from rna) for:

- adding bone groups
- removing bone groups
- renaming bone groups
- setting bone groups colors

Previously, this was hinted at by setting the layout inactive, with
preoper polls, this is now not needed anymore.

note: Selection of bone groups actually makes sense here and is
supported, so this is not prevented in this patch, but UI wise this is
not nice in the override case, because one cannot set an active_index
(aka select) in the UI list.

Maniphest Tasks: T84600

Differential Revision: https://developer.blender.org/D10131
2021-01-18 15:00:37 +01:00
a1fb3dc7ae Fix T84808: Individual projection works even when snap options don't affect the transform mode
Individual projection is a different branch of snap and always projects
the transformed elements on the surface of objects.

Perhaps this option should be limited to the Move mode due to similarity.

But in order not to change the current behavior too much, this commit only
disables this option in modes not affected by snap.
2021-01-18 10:57:45 -03:00
3584f1d224 Merge branch 'blender-v2.92-release' 2021-01-18 14:07:11 +01:00
b4530deec4 Fix T84586: missing Outliner redraws for certain NLA operators
Outliner display under 'Animation' > 'NLA Tracks' was not updating in
the following cases:
- adding strips
- removing strips
- duplicating strips (possibly to different track)
- swapping strips
- reordering tracks
- changing strip order by translating
- translating strips between tracks
- renaming tracks

In the case of deleting strips/tracks, this was also resulting in a use-
after-free error in Outliner drawing code (this was reported specifically
in T84586).

Most of these operators already sent a ND_NLA|NA_EDITED notifier, but the
Outliner is not listening to these. Listening to NA_EDITED is also not
what we want since this also happens a lot in cases irrelevant to the
Outliner. Now be a bit more specific and send ND_NLA|NA_ADDED / ND_NLA|
NA_REMOVED or a new ND_NLA_ORDER (to distinguish from NA_EDITED
'only' - where a redraw is not neccessary) and listen to these from the
Outliner.

(note: places that were listening to ND_NLA|NA_EDITED before are also
listening to NA_ADDED or NA_REMOVED, so changing NA_EDITED should not be
a problem here)

(note 2: for cases like swapping tracks/strips order, NA_ADDED or
NA_REMOVED does not make sense, neither can we use NA_EDITED [since we
dont want to listen to this], so in this case an additional ND_NLA_ORDER
is now sent)

(note 3: in nla transform code, this is now always sent on confirm. There
are cases were the notifier would not be needed, but checking exactly all
cases were it actually would be needed seems overkill [history of D10073
has example code to check if strips moved between tracks])

Maniphest Tasks: T84586

Differential Revision: https://developer.blender.org/D10073
2021-01-18 13:58:31 +01:00
e061bbadec Merge branch 'blender-v2.92-release' 2021-01-18 13:55:11 +01:00
dfdf79fb03 Fix T84250: Eevee world/material parameter animation not updating the viewport
The WORLD_UPDATE operation (needed to free the gpu material) was already
defined in DepsgraphNodeBuilder::build_world, but corresponding relation
was only set up for changes in the nodetree, not for changes in the
world/material itself in DepsgraphRelationBuilder::build_world.
Direct changes to these surface properties in the UI were updating
properly through RNA property update callbacks, but these are not called
from the animation system.

So now add these relations in the depsgraph.

Not 100% sure this is the right place for this (since e.g. eevee engine
seems to handle e.g. animated light paramters just fine through
EEVEE_cache_populate / eevee_light_setup, but properly freeing gpu
materials wont happen for worlds in e.g eevee_id_world_update and also
not for materials)

Maniphest Tasks: T84250

Differential Revision: https://developer.blender.org/D9959
2021-01-18 13:51:28 +01:00
14e6f2f4db EEVEE: Depth Of Field: Gather median filter
Filter the noisy output of the gather pass. This improves temporal
stability.
2021-01-18 12:32:21 +01:00
95af2e39f6 Merge branch 'blender-v2.92-release' 2021-01-18 12:18:31 +01:00
9f2271d354 Fix T84739: Crash with curve brush in sculpt mode.
No idea why we did not pass context to `ED_paintcurve_undo_push_end`, it
is easily availbale everywhere...
2021-01-18 12:15:46 +01:00
6251eb8bda Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-18 12:02:55 +01:00
Karthik Rangasai Sivaraman
c85317e669 Fix T83657: Pose Mode: Clearing transform doesn't respect Mirror X
Extend the pose bone "clear loc/rot/scale" functions so that they
respect the "Mirror X" option.

Reviewed By: sybren

Maniphest Tasks: T83657

Differential Revision: https://developer.blender.org/D9938
2021-01-18 11:59:45 +01:00
Karthik Rangasai Sivaraman
f7a5695676 Fix T83657: Pose Mode: Clearing transform doesn't respect Mirror X
Extend the pose bone "clear loc/rot/scale" functions so that they
respect the "Mirror X" option.

Reviewed By: sybren

Maniphest Tasks: T83657

Differential Revision: https://developer.blender.org/D9938
2021-01-18 11:59:14 +01:00
34de342257 EEVEE: Depth Of Field: Scatter optimization
Use neighborhood comparison to reject pixels from scattering pass if
they are not different enough from surrounding pixels.

Logic is here, but this needs refinement. This is mainly to
reject lots of scattering sprites on large out of focus regions
that are really bright.
2021-01-17 18:57:07 +01:00
f071e41d63 EEVEE: Depth Of Field: Fix alpha resolve 2021-01-17 17:38:56 +01:00
dacce1d07f EEVEE: Depth Of Field: Scatter Occlusion
Use VSM like occlusion texture to avoid light leaking through closer
background and foreground.
2021-01-17 17:36:35 +01:00
4ef0654449 GPencil: Fix Autojoin error using layer transform
The target stroke bounding box was not checked properly and when using layer transform the error was noticeable, but really the error was before the layer transform commit.
2021-01-17 12:35:27 +01:00
502eadb2f7 Merge branch 'blender-v2.92-release' 2021-01-17 21:40:11 +11:00
ced673c833 Merge branch 'blender-v2.92-release' 2021-01-17 21:40:07 +11:00
9fb755fe4c Merge branch 'blender-v2.92-release' 2021-01-17 21:40:03 +11:00
2ee2f87f29 Add Object Tool: move extra settings popover last
This is intended to be used when settings don't fit in the top bar,
so it makes sense to keep them last.
2021-01-17 21:36:49 +11:00
06da6e2eaf Add Object Tool: scale the cursor plane based on the depth
Draw the cursor plane smaller then further away from the view.

This makes the plane being drawn onto easier to perceive.
2021-01-17 21:21:18 +11:00
5f9358a373 Add Object Tool: split aspect & origin options for base/height
In practice it's common these settings shouldn't be linked for drawing
the initial (base) plane, compared with the height.
2021-01-17 21:16:22 +11:00
14bb9f09ab Merge branch 'blender-v2.92-release' 2021-01-17 18:30:14 +11:00
54c28e5bfb Merge branch 'blender-v2.92-release' 2021-01-17 18:30:10 +11:00
ca476a638c RNA: report an error when the name property is set twice
This helps avoid copy-paste errors which have happened a few times,
no functional changes.
2021-01-17 18:24:34 +11:00
66a87fc9f4 Fix workspace tool name property
The fallback tool was used as the tool name.

Regression in a8ce9a143a
2021-01-17 18:24:34 +11:00
1e8ed36a90 Merge branch 'blender-v2.92-release' 2021-01-16 13:11:33 -06:00
Wannes Malfait
6fb7d0f559 Fix T84713: Geometry nodes reroute sockets have incorrect type
This implements the node tree update function, which is needed so that the
reroutes get updated to the correct type. It is based on the same code in
the shader and compositor node trees.

Differential Revision: https://developer.blender.org/D10123
2021-01-16 13:09:19 -06:00
2b2e65855a EEVEE: Depth Of Field: Fix Weighting
Fix accumulation of center samples and the total sample count function.
2021-01-16 19:45:14 +01:00
ef2ed3d737 EEVEE: Depth Of Field: Improvement part 3
Add Hole Fill pass to fill missing background.
2021-01-16 19:43:34 +01:00
4e8c78245d GPencil: Hide layer if the scale is zero
When scale a layer to zero must be hidden.
2021-01-16 19:36:00 +01:00
24cdffde55 GPencil: Cleanup - Rename ED_gpencil_stroke_color_use to ED_gpencil_stroke_material_editable 2021-01-16 16:44:49 +01:00
f5ec29023d GPencil: Fix initial value for fill factor after last changes
The value has changed due a previous commit and the minimum value cannot be 0.
2021-01-16 16:36:49 +01:00
e02d84eb3b GPencil: Add new parameteres to transform layers
When using grease pencil for drawing Storyboards, it's very common to require a transform of the layers. This transform can be done using the offset modifier, but in some cases, the scene requires a lot of modifiers and makes the file hard to work.

This new feature adds a transforms Location, Rotation and Scale at Layer level, and allows to transform the layer without using a modifier, keeping the scene more clean.

{F9480695}

This feature was suggested by @pepeland after receiving feedback from several artists.

Also, done some code cleanup and rename some functions to get a better naming.

Maniphest Tasks: T83660

Differential Revision: https://developer.blender.org/D9761
2021-01-16 15:46:45 +01:00
0a44c4b594 Merge branch 'blender-v2.92-release' 2021-01-16 15:26:43 +01:00
1e193a0b56 Fix T84757: feedback loop with when modifying vertex group with nodes
The issue was that the mesh shared its vertex weights with the
original mesh (to reduce memory consumption). The solution is
to make a local copy of the vertex weights in this case.
2021-01-16 15:24:22 +01:00
79dd9fedb2 Fix T84758: Revert "LibOverride: Also consider regular embedded IDs as virtual overrides."
This made Blender considers all materials to be overridden.

This reverts commit 2aa7bc06e7.
2021-01-16 10:28:47 +01:00
3cc1bcce4f Merge branch 'blender-v2.92-release' 2021-01-16 11:39:37 +11:00
7573631d69 Merge branch 'blender-v2.92-release' 2021-01-16 11:39:34 +11:00
d4ffccbeae Merge branch 'blender-v2.92-release' 2021-01-16 11:39:31 +11:00
3adb9530bb Merge branch 'blender-v2.92-release' 2021-01-16 11:39:29 +11:00
3856c58f5d Merge branch 'blender-v2.92-release' 2021-01-16 11:39:27 +11:00
6403c8c025 Merge branch 'blender-v2.92-release' 2021-01-16 11:39:23 +11:00
39b752316d Merge branch 'blender-v2.92-release' 2021-01-16 11:39:21 +11:00
66161ba3a1 Merge branch 'blender-v2.92-release' 2021-01-16 11:39:12 +11:00
f7829961c6 Add Object Tool: include shortcuts in the tool-tip 2021-01-16 11:37:52 +11:00
ecffd231a0 Add Object Tool: add initial "Fixed Aspect" option
This makes it more convent to add many objects with a fixed aspect ratio.
2021-01-16 11:37:52 +11:00
fef7b792e7 Add Object Tool: make UI more compact
Move some of the more obscure options into a popover,
so they don't take up so much room in the top-bar.
2021-01-16 11:37:52 +11:00
cdfa3feb91 Add Object Tool: support incremental snapping
This adds a "Snap to" option that allows using all the scenes snap
settings which includes incremental & absolute grid snapping options.

This is optional because always following scene snapping would not
snap to geometry by default (which seems to be the most useful default).
2021-01-16 11:36:55 +11:00
c4bbe44e47 Add Object Tool: workaround non-orthogonal orientation matrices 2021-01-16 11:32:00 +11:00
2f0d919f89 Add Object Tool: quiet warning setting size
The size property was only used for the cube
2021-01-16 11:32:00 +11:00
8fd3ffcb31 Add Object Tool: rename keymap, expose in keymap editor
Make the name follow the convention of other View3D keymaps.
2021-01-16 11:31:35 +11:00
27c142aa29 Add Object Tool: remove from experimental
Based on feedback from @dbystedt, include this in 2.92
with some updates (coming next).
2021-01-16 11:28:02 +11:00
a8436334bd Merge branch 'blender-v2.92-release' 2021-01-15 12:23:13 -08:00
957de39191 Fix T84645 cursor moves when clicking selector.
The absolute position desktop mapping has been corrected. The correct
mapping is 0-65535 inclusive. Additionally, division by the virtual
desktop width and height needed to be subtracted by 1 as width and
height are one more than the final pixel index.
2021-01-15 12:18:13 -08:00
Aaron Carlisle
f71a7d3914 Cleanup: Remove Unused tracking properties
These properties are unused and serve no purpose.

Reviewed By: sergey, #motion_tracking

Differential Revision: https://developer.blender.org/D9803
2021-01-15 14:58:24 -05:00
fa817b8c96 Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-15 12:36:35 -07:00
de60dc84e2 Fix: Build error with MSVC 2017
BKE_cryptomatte_extract_layer_name was using std::isdigit
without including <cctype> somehow only MSVC 2017 had a
problem with that.
2021-01-15 12:36:03 -07:00
3a62ab73a3 EEVEE: Depth Of Field: Improvement part 2
Add In Focus max CoC tiles to speedup the resolve pass
2021-01-15 19:45:13 +01:00
bf7fdd0f67 Cleanup: LibOverride: Update comment. 2021-01-15 19:36:38 +01:00
2aa7bc06e7 LibOverride: Also consider regular embedded IDs as virtual overrides.
Those (aka root node trees and master collections) share same 'traits'
as the shapekeys: RNA cannot assign them, so we need to handle them as
sub-data of their owner IDs.

Not sure how much this will help in improving support of overrides for
scenes and nodetrees, but this is a mandatory step towards that goal for
sure.
2021-01-15 19:27:49 +01:00
ce317c9faa LibOverride: fix/update/re-enable ID-related debug checks in diffing code.
We should now have the tools to ensure consistency of ID pointers
diffing in `rna_property_override_diff_propptr`.

As a reminder, for most ID pointers we just check the actual pointer value,
but this is not possible for embedded IDs like root node trees or master
collections, and for fake embedded ones like shapekeys, so those should be
handled as mere sub-data of their owner IDs in override context.
2021-01-15 19:18:26 +01:00
f1a577b38a Merge branch 'blender-v2.92-release' 2021-01-15 19:00:46 +01:00
dc69ef6f3b Fix T84373: Overrides : shapes keys driven by armature don't work on second instance.
Code generating override operations would not deal properly with Pointer
RNA properties, trying by default to use and check pointers' names
properties like it does with items of a collection.

However, using name property in pointer RNA property case makes no
sense, so specialize the `no_prop_name` flag for each case (pointer or
collection).

here, since second override would generate local data-blocks with
different names than the linked data ones, name matching would fail and
breck handling of override diffing in shapekeys.

Note that shape keys are the only one concerned by that problem, since
other embedded IDs (root node trees and master collections) are fully
real ones, so they always get the same names.
2021-01-15 19:00:38 +01:00
5cf04fe2ba Fix (unreported) copying liboverride of mesh breaks overrides of shape keys.
Our beloved shapekeys are 'virtual' overrides, they need special
snowflake treatment here as well.

They do not have any override data, from override perspective they are
considered as mere sub-data from their owning ID (mesh, lattice, etc.).
Therefore, we should not copy override data from them, but instead
properly flag those new IDs as `LIB_EMBEDDED_DATA_LIB_OVERRIDE`.

Found while investigating T84373.
2021-01-15 19:00:38 +01:00
319056679b Fix T84373: Overrides : shapes keys driven by armature don't work on second instance.
Code generating override operations would not deal properly with Pointer
RNA properties, trying by default to use and check pointers' names
properties like it does with items of a collection.

However, using name property in pointer RNA property case makes no
sense, so specialize the `no_prop_name` flag for each case (pointer or
collection).

here, since second override would generate local data-blocks with
different names than the linked data ones, name matching would fail and
breck handling of override diffing in shapekeys.

Note that shape keys are the only one concerned by that problem, since
other embedded IDs (root node trees and master collections) are fully
real ones, so they always get the same names.
2021-01-15 18:51:04 +01:00
69a7015e12 Fix (unreported) copying liboverride of mesh breaks overrides of shape keys.
Our beloved shapekeys are 'virtual' overrides, they need special
snowflake treatment here as well.

They do not have any override data, from override perspective they are
considered as mere sub-data from their owning ID (mesh, lattice, etc.).
Therefore, we should not copy override data from them, but instead
properly flag those new IDs as `LIB_EMBEDDED_DATA_LIB_OVERRIDE`.

Found while investigating T84373.
2021-01-15 18:50:50 +01:00
3459f75f5b Merge branch 'blender-v2.92-release' 2021-01-15 11:04:53 -06:00
0b0e45252b Geometry Nodes: Use a default value in the point scale node
This commit adds the ability to provide a default value to
`attribute_try_get_for_output` and uses it for the `Point Scale` node,
which is important because the node uses multiplication.

The idea is to keep "name-specific" functionality in nodes rather than in
the attribute API, otherwise the complexity will be hard to keep track of.
So this fix doesn't apply to the Attribute Vector Math node, but hopfully
that is okay since that's now a lower level node for this purpose anyway.

Differential Revision: https://developer.blender.org/D10115
2021-01-15 11:04:32 -06:00
237e27e161 Cleanup: Add const in various places in node code
Also includes some various other minor cleanups, like using bool
instead of int in a couple places.
2021-01-15 10:48:22 -06:00
69b667d14e EEVEE: Depth Of Field: Improvement part 1
Add new gather algorithm.

This involve multiple passes which are well described in each shader.

Shaders have been split into multiple file for clarity sake.
2021-01-15 17:46:00 +01:00
20a54347ee Tracking: Fix transform cancel for plane tracks
Use exact marker accessor. Harmless due to the current way the
transform system is used by tracking. But for the future development
proper accessor needs to be used.
2021-01-15 17:42:13 +01:00
3732508c64 Fix T84745: build error with TBB 2021
task_group::is_canceling() was removed.
2021-01-15 17:29:36 +01:00
c4286ddb09 RNA: support range-based for loops in C++ api
Cycles has a lot of code like this:
```lang=c++
BL::Object::modifiers_iterator b_mod;
for (b_ob->modifiers.begin(b_mod); b_mod != b_ob->modifiers.end(); ++b_mod) {
```

Range-based for loops allow us to simplify this to:
```lang=c++
for (BL::Modifier &b_mod : b_ob->modifiers) {
```

In order to support this, a collection (such as `b_ob->modifiers`) must have
a `begin()` and `end()` method, that take no parameters and return an iterator.
The `end` method already exists, but the `begin` method takes the iterator as
argument currently.

This patch adds a new `begin` method that returns the iterator. The old `begin`
method is still available to avoid breaking existing code.

My assumption is that the old `begin` method took the iterator as parameter so
that the iterator is not copied or moved, i.e. its memory address is stable and
the destructor is only called once. I'm not sure if both of these requirements
are really necessary to ensure that the iterators work correctly. To be on the
safe side, I deleted the copy/move constructors/assignment operators.

Since C++17 there is "guaranteed copy elision" which basically allows us to
return a non-copyable and non-movable type from a function. To make that work,
I had to add a new constructor to `CollectionIterator` that calls `begin` on itself.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D10120
2021-01-15 16:35:22 +01:00
Piotr Barejko
340529a845 Fix Cycles build error with OSL 1.12
Differential Revision: https://developer.blender.org/D10118
2021-01-15 15:41:17 +01:00
df96a9c6ea Merge branch 'blender-v2.92-release' 2021-01-15 11:28:15 -03:00
c63442d2f2 Fix T84673: Skin resize operator always using object origin as pivot
The TransData converted to work in Skin Resize had no defined center.

Caused by rB54ee4109143b
2021-01-15 11:24:45 -03:00
cab6d5e94a Merge branch 'blender-v2.92-release' 2021-01-15 08:19:19 -06:00
6c840a2cb9 Fix "Make Instances Real" to work with nodes modifier instances
This commit changes the check at the beginning of the
"Make Instances Real" operator to account for the instances
created by nodes modifiers in the modifier stack.

Differential Revision: https://developer.blender.org/D10059
2021-01-15 08:18:52 -06:00
a51584dc70 Geometry Nodes: transfer corner and point attributes in Point Distribute node
If the mesh has any corner or point attributes (e.g. vertex weights or
uv maps), those attributes will now be available on the generated points
as well.

Other domains can be supported as well. I just did not implement those yet,
because we don't have a use case for them.

Differential Revision: https://developer.blender.org/D10114
2021-01-15 12:00:38 +01:00
04572f0899 Cleanup: spelling 2021-01-15 12:23:50 +11:00
dc59955481 Cleanup: use 'pragma once' 2021-01-15 12:17:11 +11:00
f03752b92f Nla: Rename NlaEvalChannel->valid to domain
For term consistency with usage.

The clarity is more for consistency with the nla domain() processing
function names and the core struct member name it stores the results
in, "valid". The name "domain", which implies a function can operate
on it, seems more natural than "valid", which implies something is
wrong if false.

No functional changes.

Reviewed by: sybren

Differential Revision: http://developer.blender.org/D9692
2021-01-14 19:27:46 -05:00
10ce2a1016 NLA: Redundant NlaEvalChannel Valid Mask Write
The field will already be properly written to in (anim_sys.c)
nla_eval_domain_action(). It's easier to understand the property's
usage after removing the redundancy.

No functional changes.

Reviewed by: ChrisLend, sybren

Differential Revision: http://developer.blender.org/D9689
2021-01-14 19:04:40 -05:00
32e4ded24b Nla Refactor: is_fcurve_evaluatable()
No functional changes.

Future patches {D8867} {D8296} make use of it.

Reviewed by: sybren, ChrisLend

Differential Revision: http://developer.blender.org/D9691
2021-01-14 18:47:12 -05:00
09709a7e64 Nla Refactor: Split animsys_evaluate_nla()
No intended functional changes.

Refactors animsys_evaluate_nla() into 2 versions:
animsys_evaluate_nla_for_keyframing(), animsys_evaluate_nla_for_flush()
to make it clear what data is being calculated and why.

Dummy strip creation has been refactored to two separate functions,
animsys_create_tweak_strip() and animsys_create_action_track_strip().
Both are evaluated differently from other strips and eachother. There's
no need to interweave them. A future patch D8296, generally requires
both strips.

___

XXX anim_sys.c) nlatrack_find_tweaked() is a temporary work around.
If anyone has any insight into this problem, help is appreciated.

Reviewed by: sybren

Differential Revision: http://developer.blender.org/D9696
2021-01-14 18:25:01 -05:00
b75552ebbb UI: Draw socket type colors on the left in group sockets list
Previously the colors were on the right for outputs, but this is now
unecessary because of the organization in separate panels after
rBb1d1a58c77fb1658.
2021-01-14 16:49:20 -06:00
40d391fa60 Fix T81533: NLA Properly Draw FModifiers
When NLA strips weren't time-aligned with the underlying action, then
fcurve modifiers would not be drawn anchored to the strip. Fmodifiers
were evaluating properly, they just weren't drawn with the proper
offset and scale.

To fix it in this specific case, I've chosen to undo the keyframe
remapping then remap the draw-evaluation-time from scene time to
fcurve time. Afterward, I redo the keyframe remapping so the controls
are properly drawn.

The Envelope fmodifier has special drawing code which was fixed too. In
this case, no mapping at all was happening. The solution was similar,
to remap the envelope control points from fcurve time to scene time.
2021-01-14 16:50:14 -05:00
Cody Winchester
7a4bdc3a4f Gpencil Noise - Add noise offset parameter
This patch adds a noise offset option to the grease pencil noise modifier.
It allows the user to animate the noise along the length of the stroke to create movement that is currently not possible.

It works by adding an offset to the noise table and adding the remaining floating point value to the noise table sampling.

Reviewed By: #grease_pencil

Differential Revision: https://developer.blender.org/D10021
2021-01-14 22:25:36 +01:00
Lukas Stockner
0f2ae614a1 Use mmap() IO for reading uncompressed .blends
Instead of submitting tons of tiny IO syscalls, we can speed things up
significantly by `mmap`ing the .blend file into virtual memory and directly
accessing it.

In my local testing, this speeds up loading the Dweebs file with all its
linked files from 19sec to 10sec (on Linux).

As far as I can see, this should be supported on Linux, OSX and BSD.
For Windows, a second code path uses `CreateFileMapping` and
`MapViewOfFile` to achieve the same result.

Reviewed By: mont29, brecht

Differential Revision: https://developer.blender.org/D8246
2021-01-14 22:03:29 +01:00
30dd31a7b3 Fix T81533: NLA Properly Draw FModifiers
When NLA strips weren't time-aligned with the underlying action, then
fcurve modifiers would not be drawn anchored to the strip. Fmodifiers
were evaluating properly, they just weren't drawn with the proper
offset and scale.

To fix it in this specific case, I've chosen to undo the keyframe
remapping then remap the draw-evaluation-time from scene time to
fcurve time. Afterward, I redo the keyframe remapping so the controls
are properly drawn.

The Envelope fmodifier has special drawing code which was fixed too. In
this case, no mapping at all was happening. The solution was similar,
to remap the envelope control points from fcurve time to scene time.
2021-01-14 15:13:26 -05:00
33a558bf21 Geometry Nodes: support accessing UV layers with attribute system
Note that uv layers still can't be accessed with nodes, because those
only access attributes on the point domain currently, while uv data
is stored per corner. Implicit domain conversion hasn't been
implemented yet.
2021-01-14 18:11:44 +01:00
5c1b740f1e Geometry Nodes: add implicit conversions for float2 and others
Some of these conversions are arbitrary to some degree.
However, the user experience is better when at least something
happens when converting between types, instead of just getting
zeros. I left out a few conversions that I wasn't sure about yet.

I also added conversions for float2.
2021-01-14 18:02:59 +01:00
0815e2fdb1 Fix automated tests when building with GCC and march=native
When building with more aggressive optimization flags, GCC will add FMA
(Fused Multiply Add) instructions that will slightly alter the floating
point operation results.

This causes some automated tests to fail in blender.

In clang and the intel compiler ffp-contract is set to off per default
it seems from my research.  (They do not have the exact same setting,
but the default seems to match the off behavior)

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D9047
2021-01-14 17:37:39 +01:00
406d747695 Fix automated tests when building with GCC and march=native
When building with more aggressive optimization flags, GCC will add FMA
(Fused Multiply Add) instructions that will slightly alter the floating
point operation results.

This causes some automated tests to fail in blender.

In clang and the intel compiler ffp-contract is set to off per default
it seems from my research.  (They do not have the exact same setting,
but the default seems to match the off behavior)

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D9047
2021-01-14 17:32:21 +01:00
9131c697dd Merge branch 'blender-v2.92-release' 2021-01-14 15:55:51 +01:00
e5ee7e9a2d Geometry Nodes: don't delete existing attribute before new attribute is computed
This fixes the behavior of some nodes when the same attribute
name is used for input and output. If both attributes have a
different type, they can't exist at the same time. Therefore,
the input attribute has to be removed in order to create the
output attribute.

Previously, the input attribute was remove before it was used
in any computations. Now, the output is written to a temporary
buffer and only later saved in the geometry component. This
allows both attributes to coexist within the node.

The temporary attribute is only create when necessary. The
normal case without name collisions still works the same
as before.

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

Ref T83793.
2021-01-14 15:52:08 +01:00
8795514384 Merge branch 'blender-v2.92-release' 2021-01-14 15:19:24 +01:00
8ed7ed0255 Geometry Nodes: extract function for adding attributes in distribute node
This shouldn't have any functional changes.
2021-01-14 15:16:20 +01:00
53bd58993e Fix T84167: Saving half-float EXR might result in NaN pixels
Clamp value to the -HALF_MAX .. HALF_MAX.

The non-clamped values were causing NaN and inf values saved to
the file, which was the root cause of glare node giving unexpected
result.

The nan/inf on overflow is something mentioned in the half data
type in OpenEXR header.

Differential Revision: https://developer.blender.org/D10105
2021-01-14 14:54:08 +01:00
3cc7e2ad9d Fix various issues with regions in Asset Browser
Fixes a number of glitches, e.g. the sidebar disappearing when selecting an
asset or wrong AZones (the little chevrons to indicate a hidden region).

There were a couple of issues:
* Execution region was created, but not used.
* If an execution region already existed when refreshing the area, it was
  tagged as hidden, not removed.
* The sidebar was always set to be hidden on refreshes.
* When toggling from Asset Browser to File Browser as regular editor (i.e. not
  opened temporary via Ctrl+O or such), the sidebar region wasn't removed.

Adresses T83644.
2021-01-14 13:45:22 +01:00
Sebastian Parborg
74f6b81c12 Tests: skip OSL render tests in build without OSL
Differential Revision: https://developer.blender.org/D9990
2021-01-14 13:14:43 +01:00
4e90266fd8 Tests: enable bake and shader raytracing tests for OptiX
These are now supported and so can be tested.

Also refactor the code a bit to move Cycles specific blacklist out of generic
render test code.
2021-01-14 13:14:43 +01:00
6704372f04 GPencil: Allow small resolution for Fill tool
Now the resolution can be reduced to get less details. This is very useful for doing storyboards to get a quick fill of any character.

Following UI review, the name "Resolution" has been changed to "Precision" because is more clear.

Differential Revision: https://developer.blender.org/D10076
2021-01-14 12:57:17 +01:00
10423d462a Geometry Nodes: output color from Attribute Color Ramp node
The other output types did not work currently anyway.
There is not a significant benefit in somehow deducing the output
attribute type from the existing attribute types.
2021-01-14 12:44:37 +01:00
6f28c199b3 Cleanup: ed_undo: naming of parameters, const, etc.
No behavrioral change expected here.
2021-01-14 12:02:51 +01:00
a0029a678f Cleanup/refactor: Remove logically broken code from GPencil undo.
`ED_undo_gpencil_step` only support valid undo step direction, passing
step name here is useless and only add confusion to what works or not.

Undo by step name or step index is fully not supported by GPencil undo
mode currently.

Note that since GPencil undo mode does not seem to ever be used anyway,
this is not an urgent issue in practice, but this needs to be cleaned up
at some point. See also T84703.
2021-01-14 12:02:51 +01:00
8cdd701b45 Merge remote-tracking branch 'origin/blender-v2.92-release' 2021-01-14 11:42:22 +01:00
442b6e5e09 MeshCache: add error handling to fread() calls
Handle return value of `fread()`, by showing an error message when the
file cannot be read from and stopping further processing. Not only is
error handing a good idea, it also prevents GCC from warning that the
return value of `fread()` should not be ignored.

This is similar to {D9916}.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10079
2021-01-14 11:38:14 +01:00
9e038a2c6b Tracking: Make transform cancel use explicit frame number
Before transform cancel will request marker at a current frame number
and restore transform flags to it. This worked fine if there was only
one marker from track in the transform data. This did not work correct
when multiple markers from track were added to transform data.

This allows to implement proportional editing in the clip editor.
2021-01-14 11:37:36 +01:00
4b1112c8c9 Tracking: Fix wrong projection for post-draw pass
Allows to draw proportional editing circle at a proper location.
2021-01-14 11:37:36 +01:00
5cf87b4a8e Tracking: Re-duplicate logic used to count and initialize data
Allows to easily implement more comprehensive checks about which
markers get added to the transformation context.

No user measurable changes are expected, purely house-keeping to
ease an upcoming development.
2021-01-14 11:37:36 +01:00
ab536824a6 Tracking: Simplify transform code
Reduce amount of duplicated pointer offset logic: advance transform
data pointers deep in the loop rather than have offset duplicated in
the outer loop.

Array size calculation still has duplicated, but that is another story.
2021-01-14 11:37:36 +01:00
4b0871af87 Bmesh: Deprecate deform parameter of from_object()
The deform parameter of the Bmesh from_object method is deprecated,
always assumed to be True, and will be removed in version 3.0.

That is because the cases where it is False don't work correctly and are
subject to memory leaks. One of the symptoms of the incorrect behavior
is the application of constructive modifiers twice if the input object
is an evaluated one, as demonstrated in D10053.

Reviewed By: Brecht

Differential Revision: https://developer.blender.org/D10086
2021-01-14 12:20:46 +02:00
Cody Winchester
3191b76eb5 GPencil: Noise Modifier - Move noise seed value outside of randomize subpanel
Currently the grease pencil noise modifier seed value is under the randomize subpanel.

Moved the seed value outside of this panel because it doesn't only change the noise when using the randomize option. Moving the seed value prevents it from being hidden/greyed out so the user can manually keyframe it to control the noise animation.

Reviewed By: #grease_pencil, antoniov

Differential Revision: https://developer.blender.org/D10020
2021-01-14 11:10:33 +01:00
024ac9c089 Fix T84549: Keymap presets written without repeat enabled
Key map items using TEXTINPUT didn't include the repeat setting.
2021-01-14 20:52:36 +11:00
e7c36ce43c GPencil: Disable Multiframe edition when play animation
When the multiframe is enabled, playing animation must be disabled or the animation is not visible,

{F9527854}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9930
2021-01-14 10:44:45 +01:00
3e4dd7b000 Merge branch 'blender-v2.92-release' 2021-01-14 15:55:34 +11:00
a4226a050b Fix T64518: Blender 2.7 keymap inconsistencies
- Add missing Shift-Space for toggle maximize area.
- Add missing Alt-F10 for toggle fullscreen area.
- Match 2.7x keymap for setting the pivot center.
2021-01-14 15:53:06 +11:00
646f1cc89a Merge branch 'blender-v2.92-release' 2021-01-14 11:50:55 +11:00
f64746177f Fix add-object tool snap placement when activated from tweak event
When activating add-object from from a tweak event (default keymap),
the snap gizmo could snap to a new location while dragging.

Workaround this by re-calculating the snap position where the tweak
event starts.

Reported T57210#1077747
2021-01-14 11:50:08 +11:00
0876829e7a Merge branch 'blender-v2.92-release' 2021-01-14 10:58:19 +11:00
5804bf25bd Fix uninitialized stack memory use accessing the snap normal
Using the add-object tool, snapping to object types such as
curve, armature ... etc, copied uninitialized stack memory.
2021-01-14 10:55:49 +11:00
c13383da41 Cleanup: use enum for undo step direction
The step direction was confusingly 1 for undo, -1 for redo.
This convention is from 2004 (562d6958cb).

Use enum for ed_undo.c for better readability.
2021-01-14 09:53:38 +11:00
01b9dfeab4 Fix T84684: Undo operators not working
Mistake in 2771dfd563. The commit left the new editors operator registration
in `ed_util_ops.c`, but removed the function call to it.
In other words, the ED-utils operators were not registered.
2021-01-13 23:41:14 +01:00
73169628a1 Fix T84684: Undo operators not working
Mistake in 2771dfd563. The commit left the new editors operator registration
in `ed_util_ops.c`, but removed the function call to it.
In other words, the ED-utils operators were not registered.
2021-01-13 23:39:04 +01:00
b6aa8daf49 Fix T84645 cursor moves when clicking selector.
The absolute position desktop mapping has been corrected. The correct
mapping is 0-65535 inclusive. Additionally, division by the virtual
desktop width and height needed to be subtracted by 1 as width and
height are one more than the final pixel index.
2021-01-13 14:07:49 -08:00
c4c2c4bdb8 Merge branch 'blender-v2.92-release' 2021-01-13 14:33:53 -06:00
cf9709fd1e Fix T84686: Node vector socket default values not animate-able
{rB1d3b92bdeabc} disabled animating other properties of the socket default
values, like the "min" and "max" properties, as well as the "default_value"
of the "default_value". That naming confusion lead to the commit
inadvertently removing animation for the vector socket in RNA.

I checked that the other socket types don't have the same issue.
2021-01-13 14:33:28 -06:00
21b9231d7f Transform: geodesic distances for proportional edit connected mode
Use approximate geodesic distance computatiom that crosses through triangles
rather than only along edges. Using only edges would give artifacts already
on a simple grid.

Fixes T78752, T35590, T43393, T53602

Differential Revision: https://developer.blender.org/D10068
2021-01-13 18:24:33 +01:00
00b2c7c5cc Merge branch 'blender-v2.92-release' 2021-01-13 11:21:09 -06:00
9dab489d51 Bump file subversion after recent node versioning commit 2021-01-13 11:16:11 -06:00
08ee5573a9 Fix Python warnings in node editor after revert of datablock changes
Revert was done in 2771dfd, ref T84669
2021-01-13 18:06:39 +01:00
09fe0e8aa9 Nodes: use green color again for shader sockets and shader category
The green is still distinct from the more turquoise use for geometry, and
they are never used in the same node graph. The use of red makes sense, but
would need changes to other sockets and categories to set it apart well.

Ref T82689
2021-01-13 18:00:14 +01:00
d08ec3120f Revert "2.92 splashscreen"
This reverts commit 5d826866a3.
2021-01-13 17:49:28 +01:00
84c08748d8 Revert "Blender 2.92 beta - bcon3"
This reverts commit cfc9b95abd.
2021-01-13 17:49:24 +01:00
a60e270efb Merge branch 'blender-v2.92-release' 2021-01-13 17:49:08 +01:00
8ad305382e Blender 2.93 bcon1 - alpha
Bump the version number for the new release cycle.
2021-01-13 17:33:27 +01:00
5d826866a3 2.92 splashscreen
Credit: Joanna Kobierska - artstation.com/joanna_kobierska
2021-01-13 17:33:22 +01:00
cfc9b95abd Blender 2.92 beta - bcon3
Bump the release cycle to beta. This also hides away the experimental features
from the user interface.
2021-01-13 17:33:22 +01:00
1f4c1c5fc7 Geometry Nodes: Add "Point Translate" and "Point Scale" nodes
The translate node moves every point in the geometry, and the scale
node multiplies the "scale" attribute of the input geometry by its input.
While these operations are already possible with the "Attribute" nodes,
these new nodes fit nicely with the nodes specifically for changing the
"rotation" attribute that already exist, and they provide a simpler way
to do the same thing.

Differential Revision: https://developer.blender.org/D10100
2021-01-13 10:32:06 -06:00
bae4d00e2a UI: Use gray color for float sockets in nodes
The shade is too close to RGBA sockets.

Related to T82689
2021-01-13 17:17:54 +01:00
7d749720ad UI: Use capital letters for X Y and Z axes
Also add another comma and use plural "axes".
2021-01-13 10:13:00 -06:00
8df0268e2b Geometry Nodes: Rename "Rotate Points" to "Point Rotate"
This is consistent with the other node names, giving (almost) all of the
nodes in the "Point" category the same prefix.
2021-01-13 10:10:25 -06:00
80578a9d54 Geometry Nodes: Rename boolean input sockets
"Geometry A" becomes "Geometry 1", just to be more consistent
with other nodes.
2021-01-13 10:00:20 -06:00
2771dfd563 UI: Revert design changes to data-block selector for the 2.92 release
Partially reverts 2250b5cefe.

Removing the user count and fake user count icons was controversial (which was
expected) and there are a few further changes needed, that won't make it in
time for the release, see D9946.
While there is a design to bring back the user count and fake user indicators,
a new design idea was proposed that the UI team wants to follow. This came too
late for the 2.92 release, the new design is targeted at the 2.93 release now.
Meanwhile, UI team decision was to simply revert the design changes.

The new design is being worked on in https://developer.blender.org/T84669.

Note that this commit does not revert some internal changes done in
2250b5cefe. Namely the introduction of `ed_util_ops.c` and data-block
operators in there. These will still be needed in the new design.
2021-01-13 15:31:02 +01:00
ad4202a14f Cleanup: Remove unecessary namespace prefixes 2021-01-13 08:29:03 -06:00
89f490932f Geometry Nodes: Enable exposing object and collection sockets
This patch allows connecting wires for object and collection socket
types to the "Group Input" node, which exposes them to be adjusted
in the modifier.

Thanks to @angavrilov's recent work in rB8964c02348f6, it is now
possible to edit pointer IDProperties in the interface when they are
drawn with `uiItemPointerR`.

This patch is composed of a few changes:
  - Add code to create pointer properties in the modifier settings for
    object and collection sockets, and also to draw them in the UI.
  - Also search through the modifier's `IDProperty` settings to find IDs
    used by the modifier.
  - Change the setting's UI layout to support the change.

Differential Revision: https://developer.blender.org/D10056
2021-01-13 08:13:57 -06:00
Eric Bickle
55c56f1ffb Fix T79356: Improved icons for MSIX builds
Fixed an issue that was causing the app icon to render with a
'plated' background color in the taskbar and other areas of Windows.

Updated all app icons in Microsoft Store package to match Microsoft's
design recommendations.

Added multiple scales for app icons for high resolution displays.

Added high contrast app icons.

Reviewed By: pablovazquez, jmonteath

Maniphest Tasks: T79356

Differential Revision: https://developer.blender.org/D9681
2021-01-13 14:42:05 +01:00
5f411f7f38 Revert "Fix T79356: Improved icons for MSIX builds"
This reverts commit 78011d712d.
2021-01-13 14:31:52 +01:00
Eric Bickle
78011d712d Fix T79356: Improved icons for MSIX builds
Fixed an issue that was causing the app icon to render with a
'plated' background color in the taskbar and other areas of Windows.

Updated all app icons in Microsoft Store package to match Microsoft's
design recommendations.

Added multiple scales for app icons for high resolution displays.

Added high contrast app icons.

Reviewed By: pablovazquez, jmonteath

Maniphest Tasks: T79356

Differential Revision: https://developer.blender.org/D9681
2021-01-13 13:32:00 +01:00
d985751324 Geometry Nodes: improve Point Distribute node
This greatly simplifies the Point Distribute node. For a poisson disk
distribution, it now uses a simpler dart throwing variant. This results
in a slightly lower quality poisson disk distribution, but it still
fulfills our requirements: have a max density, minimum distance input
and stability while painting the density attribute.

This new implementation has a number of benefits over the old one:
* Much less and more readable code.
* Easier to extend with other distribution algorithms.
* Easier to transfer more attributes to the generated points later on.
* More predictable output when changing the max density and min distance.
* Works in 3d, so no projection on the xy plane is necessary.

This is related to T84640.

Differential Revision: https://developer.blender.org/D10104
2021-01-13 12:44:17 +01:00
ed1042ee06 Geometry Nodes: cleanup attribute usage
Now that typed attribute wrappers don't need to own the
attribute anymore, many `std::move` calls can be removed.
2021-01-13 12:27:38 +01:00
76fd41e9db Depsgraph: Remove redundant copy-on-write operations
This change removes copy-on-write operations from ID nodes which do not
need copy-on-write.

Should be no functional changes, as before the copy-on-write operation
would do nothing for those nodes anyway.
2021-01-13 12:13:35 +01:00
0f95f51361 Fix T83411: Crash when using a workspace/layout data path in a driver
Building IDs which are not covered by copy-on-write process was not
implemented, which was causing parameters block not present, and, hence
causing crashes in areas which expected parameters to present.

First part of this change is related on making it so Copy-on-Write is
optional for ID nodes in the dependency graph.

Second part is related on using a generic builder for all ID types
which were not covered by Copy-on-Write before.

The final part is related on making it so build_id() is properly
handling ParticleSettings and Grease Pencil Data. Before they were not
covered there at all, and they need special handling because they do
have own build functions.

Not sure it worth trying to split those parts, as they are related to
each other and are not really possible to be tested standalone. Open
for a second opinion though.

Possible nut-tightening is to re-organize build_id() function so
that every branch does return and have an assert at the end, so that
missing ID type in the switch statement is easier to spot even when
using compilers which do not report missing switch cases.

As for question "why not use default" the answer is: to make it more
explicit and clear what is a decision when adding new ID types. We do
not want to quietly fall-back to a non-copy-on-write case for a newly
added ID types.

Differential Revision: https://developer.blender.org/D10075
2021-01-13 12:13:34 +01:00
2cd091e9c7 Fix Cycles not taking into account CYCLES_SHADER_PATH for finding stdcycles.h
Contributed by howetuft.

Differential Revision: https://developer.blender.org/D9973
2021-01-13 12:12:36 +01:00
Jesse Y
dc170a6d67 Fix: popout windows are sized incorrectly on high DPI screens
There should be a conversion to native pixel size as expected by GHOST at the
window manager level, the dimensions at screen level do not need a conversion.

Differential Revision: https://developer.blender.org/D9976
2021-01-13 12:12:36 +01:00
8964c02348 RNA: allow editing pointer IDProperty values from the UI.
Currently it is not possible to edit bare IDProperty pointer
values which are not explicitly defined through python via
UI fields. This is likely mostly because, unlike numeric values,
pointers aren't marked PROP_EDITABLE by default. However there
are also some bugs in the RNA code that need fixing.

The Geometry Nodes modifier uses bare properties to store
input settings for the node group it wraps, so supporting
Object and Collection sockets requires editable pointers.

This patch marks bare IDProperties editable, and ensures
that changing ID pointers rebuilds the dependency graph.
A type check is needed because an IDPROPERTY PointerPropertyRNA
can actually wrap a group value rather than an ID pointer.

Making pointers editable is not likely to accidentally
affect UI fields that were not intended to be editable,
because a simple `layout.prop` cannot determine which
datablocks to display in the menu and remains read-only.

The PROP_NEVER_UNLINK flag is also removed: it seems it
was added because the edit field that couldn't produce
a menu to set the pointer used to still display the unlink
button, but that seems not to be the case anymore.

Actual support for Object & Collection inputs in the modifier
is added in D10056, which can be used to test this code.

Differential Revision: https://developer.blender.org/D10098
2021-01-13 14:09:31 +03:00
8185d07ace RNA: fix a crash when setting bare IDProperty pointers.
The rna_idproperty_check call should be done before accessing
the prop pointer so that it can detect IDProperty values and
replace them with the actual PointerPropertyRNA object.

Ref D10098
2021-01-13 14:09:31 +03:00
38df935c09 Fix T84646: Compositor: In Blender 292 "Set Alpha" node is undefined
Incorrect version code introduced by 9dbea1db66 would not check inside
node groups.
2021-01-13 12:07:26 +01:00
aed5b88ec1 Asset System: Disable Asset Browser as experimental feature
The Asset Browser will be disabled and not available for the 2.92 release. In
alpha/beta builds, there will be an "Asset Browser" option under Preferences >
Experimental, if the developer extras are enabled.
Note that this also disables related UI elements (e.g. "Mark Asset" buttons,
Preferences settings for asset libraries, etc.).

The code is still in master of course, development and testing will continue
there. But there simply needs to be too much polishing and fixing before the
2.92 release, plus there are some design decisions to be reevaluated.

Check the milestone 1 project to follow ongoing work:
https://developer.blender.org/project/view/124/
2021-01-13 11:10:17 +01:00
Robert Guetzkow
27b78c9c94 Compositor: "Save as Render" for the file output node
This commit adds the "Save as Render" feature to the file output node,
that allows to disable the application of the configured view transform
and other color management settings on the image. If disable it uses
the standard view transform instead. This feature was originally
suggested in T83842 and is part of the color management improvements
task in T68926. With this feature it is possible to toggle the
application of the color management settings for each input socket
of the File Output node individually.

Reviewed By: brecht

Maniphest Tasks: T68926, T83842

Differential Revision: https://developer.blender.org/D9921
2021-01-13 11:04:02 +01:00
614bd239f8 Geometry Nodes: support optional ownership for typed attributes
This will simplify some code in an upcoming commit and will be
useful for T83793.
2021-01-13 10:48:39 +01:00
7b68d0679e Cleanup: rename enum for event value items
This contains all value items (with overlapping values),
name this to make it clear it contains all items.
2021-01-13 19:58:57 +11:00
7af8271c34 Fix WM_event_print error printing tweak events value 2021-01-13 19:56:49 +11:00
ba44919601 Fix Event.value RNA access with tweak event types
Accessing event.value would return unrelated values such as
PRESS, RELEASE, CLICK... etc. instead of NORTH, SOUTH... etc.
2021-01-13 19:56:40 +11:00
0b711e6758 Fluid: Updated Mantaflow source files
Includes minor fixes / cleanups from the viscosity plugin.
2021-01-13 09:49:38 +01:00
3f7c294a95 Mix modifiers test after commit to bevel modifier defaults
{rB6b5e4ad5899d} neglected to update the modifier tests to reflect
the fact that the default limit method is no longer "NONE".
2021-01-12 23:54:46 -06:00
97a6b3ceee Cleanup: use single quotes for enum literals 2021-01-13 16:41:12 +11:00
37c5552742 Fix memory leak with image drag and drop
Dragging an image from the file selector into the sequencer
was leaking memory.

Regression in b5d778a7d4.
2021-01-13 16:23:14 +11:00
Philipp Oeser
5d99199880 Fix T83084: Smart UV Project inverts the resulting UVs
Caused by 850234c1b1,

Flip the normal to avoid flipped projection.
2021-01-13 13:37:14 +11:00
92826a921c Cleanup: spelling 2021-01-13 13:21:29 +11:00
bc58425862 Cleanup: clang-format, trailing space 2021-01-13 13:15:22 +11:00
b9e02eace6 UI: Clarify the property name of "F-Curve Visibility"
"F-Curve Visibility" is a bad UI label for a property that only affects
the display of unselected F-Curves. This commit clarifies the property
name by making it more specific with the word "Unselected", and by using
the word "Opacity". "F-Curve" is redundant in the UI label anyway because
it is included in the panel title.

Resolves T82587

Differential Revision: https://developer.blender.org/D10027
2021-01-12 19:14:57 -06:00
6b5e4ad589 Bevel Modifier: Use angle limit method by default
This right click select post outlines the reasons to make "Angle" the
default limit method: https://blender.community/c/rightclickselect/BVfbbc/
In short: Beveling every single edge rather than just sharp edges is
rarely the desired behavior, and the placement of the property in the UI
makes it easy to see the property's importance and toggle it.

Differential Revision: https://developer.blender.org/D8961
2021-01-12 18:55:27 -06:00
719bea0d6d Geometry Nodes: Output the most complex attribute data type
In order to avoid losing information, it sometimes makes sense for the
output attribute type to depend on the types of the input attributes.

Such a function already exists, `attribute_data_type_highest_complexity`,
it just needs to be used in a few more places. The change for the attribute
compare node is just so the code there uses the same code style as in the
attribute mix node.

Addresses part of T83793
Differential Revision: https://developer.blender.org/D10099
2021-01-12 14:03:35 -06:00
Aaron Carlisle
6c15b70279 UI: Update Clip Tracking menus
- Add operators that previously could only be found in panels
- Re order menus to match other menus
- Organize Code

|Before|After|
|{F9493583}|{F9493584}|
|{F9493585}|{F9493586}|
|{F9493588}|{F9493590}|
|{F9493591}|{F9493592}|

Reviewed By: sergey, sebastian_k, #motion_tracking

Differential Revision: https://developer.blender.org/D9781
2021-01-12 14:45:20 -05:00
bf5d45fd99 Cleanup: Fix incorrect function name
The function used "domain" incorrectly where it meant "data type".
2021-01-12 11:47:51 -06:00
abbc43e4e4 Fix T84397: Creating and removing many objects very quickly causes a crash
The root of the issue was caused by the dependency graph using ID pointer
to map evaluated state from old depsgraph to new one upon relations update.
This was failing when IDs were re-allocated rapidly: was possible that
Object ID's evaluated state assigned to Mesh and vice versa.

Now depsgraph uses Session UUID to identify which IDs to restore evaluated
state to. The session UUID is stored in the IDNode, so that id_orig is not
dereferenced on depsgraph update since the ID might be freed.

The root of the issue is identified by Campbell, original patch was done
by Bastien, thanks! Also thanks to Oliver and Ray and everyone else for
testing!
2021-01-12 17:16:48 +01:00
957e292c58 Fix T64953: Add cryptomatte meta data to file output node.
This change will try to add meta data when using a multilayered open
exr file output node in the compositor. It adds the current scene meta
data and converts existing cryptomatte keys so it follows the
naming that is configured in the file output node.

This change supports the basic use-case where the compositor is
used to output cryptomatte layers with a different naming scheme to
support external compositors. In this case the Multilayered OpenEXR
files are used and the meta data is read from the render result.

Meta data is found when render layer node is connected with the
file output node without any other nodes in between. Redirects and empty
node groups are allowed.

The patch has been verified to work with external compositors.
See https://devtalk.blender.org/t/making-sense-of-cryptomatte-usage-in-third-party-programs/16576/17

See patch for example files.

Reviewed By: Sergey Sharybin

Differential Revision: https://developer.blender.org/D10016
2021-01-12 16:24:26 +01:00
c3b68fa7b1 Fix T81965: Library-Override Not able to edit Keyframe properties
Fix keyframe properties not being editable when animating a
library-overridden datablock.

The problem was that RNA pointers were created based on the datablock
affected by the animation (for example an Object), instead of the
datablock that contains the FCurve itself (the Action). The latter can
be local to the current blend file and should thus be editable, even
when the former is not.

Reviewed By: mont29

Maniphest Tasks: T81965

Differential Revision: https://developer.blender.org/D10091
2021-01-12 15:43:42 +01:00
c96d596f43 GPU: Remove Limited Support AMD Polaris
Removing the limited support message as the known opengl issues of the
recent drivers with polaris cards have been tackled.
2021-01-12 13:54:50 +01:00
b2ad52a763 Tests: skip unit test if built without ocean sim modifier
Disable the Ocean Sim test when building with `WITH_MOD_OCEANSIM=OFF`.
2021-01-12 13:50:29 +01:00
e0a4b392f3 Cleanup: use exact check for fread, move out of the loop
Without this, additional items could be added in the future
which wouldn't be included in the check.

Move the check out of the loop since this is such an unlikely
situation that checking every iteration isn't needed.

Also remove redundant casts.
2021-01-12 23:31:34 +11:00
28b17ef0e6 Cleanup: replace 'long long' with int64_t in imbuf indexer 2021-01-12 23:31:34 +11:00
3b77bd48f9 Geometry Nodes: new Align Rotation to Vector node
This adds a new Align Rotation to Vector node based on the mockup
in T83669.

Reviewers: HooglyBoogly, simonthommes

Differential Revision: https://developer.blender.org/D10081
2021-01-12 12:55:14 +01:00
3a254b93fd Geometry Nodes: support reading from spans of WriteAttribute
Previously, the span returned by `WriteAttribute`s might not contain the
current value of the attribute for performance reasons. To avoid some
bugs, the span now always contains the old values (they might have to
be copied over from the internal storage, dependending on how the
attribute is stored).
The old behavior is still available with the `get_span_for_write_only`
method. The span that it returns might not contain the current
attribute values. Therefore, it should only be used when you want
to overwrite an attribute without looking at the old values.
2021-01-12 12:50:29 +01:00
58dae919e5 Weight Paint: avoid creating very small values with locked weights.
When painting using Auto-Normalize or Lock Relative with some
groups locked, the locked weights may not add up precisely to
1 because of precision limitations, which results in creating
nonzero weights close to FLT_EPSILON. With Lock Relative display
mode this is very obvious and annoying (random red points amid
black or blue), so add an epsilon check to consider less than
1e-6 unlocked weight to be the same as 0.

In addition, in cases when no weight can be painted due to locks,
don't create vertex group entries at all if they don't exist yet.
Also, don't run Auto Normalize when not painting a deform group.

Differential Revision: https://developer.blender.org/D10000
2021-01-12 14:32:05 +03:00
Robert Guetzkow
f5c0ef52cf Fix T84588: Cache access in rna_Particle_uv_on_emitter
The function `rna_Particle_uv_on_emitter` did not handle the case where
`particle->num_dmcache` was `DMCACHE_ISCHILD`. This resulted in an
incorrect offset for the `mtface` pointer. The commit checks for the
case and sets the offset accordingly, similar to existing code in
e.g. `particle_calculate_parent_uvs`.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D10072
2021-01-12 12:14:34 +01:00
c56da67716 Fix: Bmesh from_object applies modifiers twice
The Bmesh from_object method applies modifiers twice when the input
deform is enabled and the input depsgraph is a render one.

The evaluated object already have modifiers applied, and
mesh_create_eval_final() applies modifiers again. To fix this, the
BKE_mesh_new_from_object() function is used instead.

Reviewed By: Brecht

Differential Revision: https://developer.blender.org/D10053
2021-01-12 13:07:12 +02:00
26fd55fad1 UndoSys: Refactor step 1: cleanup and simplify logic in main undo/redo handlers.
* Simplify and clarify logic in `BKE_undosys_step_undo/redo_with_data_ex`,
  by adding early return on invalid situations, renaming some variables,
  and adding comments.
* Add more sanity checks in those functions.

No behavioral change are expected here, besides in potential edge-case,
invalid situations.

This is a preliminary change, before some deeper modifications of
`BKE_undosys` undo/redo API.

Differential Revision: https://developer.blender.org/D10033
2021-01-12 11:58:14 +01:00
1dc9650d20 Cycles: upgrade to OptiX SDK version 7.1 on buildbot
This means that NVIDIA driver version 450 or newer is now required for Cycles
OptiX rendering. This upgrade is required to take advantage of new features and
improvements.

Ref T81431
2021-01-12 11:51:42 +01:00
89ae4a7a2a Fix NLA liboverride issues re tracks handling.
From original rBc0bd240ad0a1 commit, issues reported with suggested
fixes by Wayde Moss (@GuiltyGhost), thx.
2021-01-12 11:32:17 +01:00
Oliver Weissbarth
401279253e Fix T84515: Status bar is reporting the average solve error of the wrong tracking object
Reviewed By: sergey

Maniphest Tasks: T84515

Differential Revision: https://developer.blender.org/D10047
2021-01-12 11:02:12 +01:00
Janusch Patas
2a23addf52 Fix T83122: NURBS Extruding multiple points only moves existing points
The Surface -> Nurbs Curve behaves now like the Curve -> Nurbs Curve,
if you initially select less than all points. So, multiple points can
be selected and extruded which just moves the selected points similar
to Curve -> Nurbs Curve object.

Differential Revision: https://developer.blender.org/D9934
2021-01-12 10:56:51 +01:00
ff51afb194 Fix T84593: Operators on material (linked to local object but with
linked obdata) fail

Caused by rB1a650fdcb286.

Above commit made polling more restricitive in that it did not allow for
actions on material slots (linked to object, not object data) on objects
with liked object data. This should be allowed though.

Maniphest Tasks: T84593

https://developer.blender.org/D10078
2021-01-12 10:03:48 +01:00
55059af01d Fix T84455: Circle select tool cursor draws in overlapping regions 2021-01-12 14:19:32 +11:00
Rahul Chaudhary
acbda123ad UI: Icon for Multires Displacement Smear Tool
This commit adds the icon for the new tool.
2021-01-11 15:30:26 -06:00
b9b59aa6de UI: Update geometry icon files
None of these changes should be visible, but the files were somehow
out of sync with the blend file, so they need to be updated to reflect
those changes.
2021-01-11 15:29:20 -06:00
Lukas Stockner
688e5c6d38 Fix T82351: Cycles: Tile stealing glitches with adaptive sampling
In my testing this works, but it requires me to remove the min(start_sample...) part in the
adaptive sampling kernel, and I assume there's a reason why it was there?

Reviewed By: brecht

Maniphest Tasks: T82351

Differential Revision: https://developer.blender.org/D9445
2021-01-11 21:04:49 +01:00
b70f4a265a Fix T84496: Cycles: Tile stealing does not work with NLM
Reviewed By: brecht

Maniphest Tasks: T84496

Differential Revision: https://developer.blender.org/D10066
2021-01-11 21:04:49 +01:00
Nicholas Rishel
d5c59913de Fix T81211 Add high frequency mouse input for Windows.
Also send mouse move event instead of moving cursor via SetCursorPos.
SetCursorPos did not reliably move the mouse when it is leaving the
window quickly.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9981
2021-01-11 11:40:21 -08:00
ecdbd83a8d Geometry Nodes: Attribute Vector Math Node
This patch implements the same operations and interface as the regular
vector math node, but it runs for every element of the attribute. This
should expand what's possible with geometry nodes quite a bit.

Differential Revision: https://developer.blender.org/D9914
2021-01-11 12:06:52 -06:00
5bd822dc46 Geometry Nodes Point Distribution: Align points to face normals
This patch makes the point distribute node write to the "rotation"
attribute with the normal of each face at each distributed point.
The "normal" attribute is also created with the triangle normal
at each point.

The conversion from the triangle normal to an Euler rotation is somewhat
arbitrary, since we only have one direction vector. For a more flexible
rotation for each point, the "Align Rotation to Vector" node can be used
in the future.

Differential Revision: https://developer.blender.org/D9965
2021-01-11 11:42:16 -06:00
2a8b987e9e Fix T83422: Dimensions incorrect after undoing if it has modified geometry.
Root of the issue is that `BKE_object_eval_boundbox` (that ports back
evaluated bbox to orig object during active depsgraph evaluation) is
only called when object's geometry actually is evaluated.

However, with new undo, often Object itself can be changed by undo,
without requiring its geometry to be re-evaluated, which was leading to
the evaluated bbox not being copied back into orig object anymore.

Fixing that by moving bbox copying-to-orig code into
`BKE_object_sync_to_original` instead, which is always executed when
object is evaluated (as hinted by the comment above
`BKE_object_eval_boundbox` actually).

Also allows to cleanup code for armature eval, apparently.

Maniphest Tasks: T83422

Differential Revision: https://developer.blender.org/D9789
2021-01-11 17:59:21 +01:00
e44e0e4e78 Cloth: add a vertex group setting to exclude from object collision.
This can be useful as a workaround on the boundary with the pinned
vertices in some situations among other things, and completely copies
the existing design of the self collision vertex group setting.

Differential Revision: https://developer.blender.org/D10043
2021-01-11 19:34:33 +03:00
ac290bfbe4 Collision: allow disabling collision without removing the modifier.
The `object.collision.use` flag was treated as a redundant marker
of the existence of the modifier, going as far as adding/removing
it when the value was changed, which is not actually very useful.
Removing the modifier loses its position in the stack, and requires
a dependency graph rebuild. It feels it may be a legacy flag?

What would be useful however is the ability to toggle collisions
dynamically without removing the modifier. This patch adjusts the
code to keep the modifier when the flag is disabled, and add it
if it doesn't exist when the flag is enabled. The modifier now
checks the flag at the start and quickly exits after cleaning
up stale data. The redesigned setting is exposed in the UI.

Collisions can't be disabled by simply using the modifier enable
flags because the modifier merely saves a snapshot of the mesh at
a certain point of the modifier stack for other objects to use,
and thus has to be able to clear the stale data.

Differential Revision: https://developer.blender.org/D10064
2021-01-11 19:34:32 +03:00
b271475a9e ImBuf: Add error handling to IMB_indexer_open
Handle return value of `fread()` by printing an error and closing the
file when it cannot be read from. Not only is error handing a good idea,
it also prevents GCC from warning that the return value of `fread()`
should not be ignored:

```
.../blender/source/blender/imbuf/intern/indexer.c: In function ‘IMB_indexer_open’:
.../blender/source/blender/imbuf/intern/indexer.c:201:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  201 |     fread(&idx->entries[i].frameno, sizeof(int), 1, fp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../blender/source/blender/imbuf/intern/indexer.c:202:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  202 |     fread(&idx->entries[i].seek_pos, sizeof(unsigned long long), 1, fp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../blender/source/blender/imbuf/intern/indexer.c:203:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  203 |     fread(&idx->entries[i].seek_pos_dts, sizeof(unsigned long long), 1, fp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../blender/source/blender/imbuf/intern/indexer.c:204:5: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
  204 |     fread(&idx->entries[i].pts, sizeof(unsigned long long), 1, fp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

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

Reviewed by: campbellbarton
2021-01-11 17:29:21 +01:00
bf90fcda47 ID Creation: generate session_uuid in more cases.
Previous code would not generate a session uuid for embedded IDs (like
root node trees or master collections). While this is not a problem
currently since those are not directly stored in Main data-base, this is
conceptually wrong, since those IDs still pertain the Main data.

Further more, this is blocking using `session_uuid` more in depsgraph in
place from ID pointer itself, as identifier (related to T84397).
2021-01-11 16:44:19 +01:00
1a26d15763 Fix Embedded IDs creation bypassing ID management completely.
No ID (even remotely) related to Main database should ever be created
directly through MEM_mallocN. Using `BKE_libblock_alloc` is the bare
minimum.

Note that there is no behavior change expected here.
2021-01-11 16:44:19 +01:00
2f9073adb1 Fix missing IDType init in ViewLayer tests.
Kinda miracle this did not cause problems so far, but was breaking tests
with some upcoming changes.
2021-01-11 16:44:19 +01:00
9e1ec5033d Fix T84516: ID properties have incorrect names in Python dir() list
Caused by not going through the proper accessor function to access the
property identifier.
2021-01-11 16:10:29 +01:00
98268e5c68 Cleanup: remove trailing whitespace 2021-01-11 15:49:42 +01:00
beb5863ed4 Geometry Nodes: transform Object Info outputs to local space
Ref T83670.

Differential Revision: https://developer.blender.org/D10071
2021-01-11 15:00:29 +01:00
c083398921 BLI: fix math operation
That fixes a stupid mistake of mine that was copied a couple of times.
2021-01-11 14:59:05 +01:00
7b6e55b933 Cleanup: remove redundant UV edge selection calls
Selecting vertices and faces first checked edge selection,
this was called to set vert1 & vert2 variables which have since been
removed.

These calls should have been removed in
51f04bf7b8.
2021-01-12 00:53:33 +11:00
2a297366f0 Fix T84565: UV face select fails when zoomed in
Exposed by recent commit 246efd7286

Although this was an existing logical error causing
`uv_find_nearest_face` to only work properly when the hit distance was
initialized to FLT_MAX, which wasn't the case in multi-object edit mode.
2021-01-12 00:31:54 +11:00
fe53b6a7fb Fluid: Adjusted viscosity strength step size in UI
Step size was too small.
2021-01-11 12:55:33 +01:00
Pi Lanningham
f0ae0f490e Fix T84327: outliner_id_copy_tag was only copying from expanded nodes.
If a node was closed in the hierarchy, we would only copy that node,
even if child nodes were selected.

Reviewed By: brecht, mont29

Maniphest Tasks: T84327

Differential Revision: https://developer.blender.org/D9995
2021-01-11 12:02:06 +01:00
6e7716f32e Cleanup: Added const to RenderLayersProg methods 2021-01-11 11:46:32 +01:00
445ebcaa30 VSE: store raw images in cache
Previously raw images were not cached if image wasn't preprocessed.
This caused issue, that image had to be read from disk on every redraw.

Effect strips must be excluded, because this would cause problem with
invalidation. Effect strips can use preprocessing however. This is
mainly to allow usimg modifiers on them.

This change should follow rBf448ff2afe7a77, but I have wrongly assumed,
that it has been implemented already.

ref T80278
2021-01-11 11:38:33 +01:00
54f8a5dd73 Tests: run suites instead of individual test cases
Group all tests of a test suite into a single test command invocation.
This reduces the number of invocations by `ctest` by an order of
magnitude.

Since rB56aa5b0d8c6b663, `bin/tests/blender_test` was run for every
individual test. Having over a 1000 tests made testing slower than
necessary. Individual tests can still be run if desired by invocation of
`bin/tests/blender_test --gtest_filter=suitename.testname`.

NOTE: For this commit to have an immediate effect, it may be necessary
to remove the `tests` and `Testing` directories and some CMake files
from your build directory and rebuild. Run `ctest -N` to see the list of
tests; there should be less than 200.

Reviewed By: sergey, LazyDodo, sebbas

Maniphest Tasks: T83222

Differential Revision: https://developer.blender.org/D9649
2021-01-11 11:29:30 +01:00
63cea2b793 Fix versioning code outside of version check
Bug introduced in f448ff2afe probably due to mistake when resolving
conflicts and not checking functionality.
2021-01-11 10:55:27 +01:00
d095411002 Fix T83544: Cycles crash when rendering with Save Buffers enabled
The issue is that the "Noisy Image" pass is added even though it should not.

`use_denoising` has to be enabled on the scene and on the view layer
to actually enable it.

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

Reviewers: lukasstockner97, brecht
2021-01-11 10:21:38 +01:00
4c44a5309c Fix T84459: Face normals not displaying (AMD GPU)
This is part two of the fix for T84459.
Issue appears to be caused by AMD graphics driver later than 20.11.1 and
affects older GPUs (Polaris/FIJI cards). Drawing normals in edit mode
uses the same OpenGL data type for storing normals that is known to be
faulty.

This change fixes the face dot normals by using GPU_COMP_I16.
2021-01-11 09:52:16 +01:00
618f7df7fc Cleanup: Incorrect comment 2021-01-11 09:52:16 +01:00
9fb32b2b29 Fix T84459: Wireframe not displaying with AMD GPU
Issue appears to be caused by AMD graphics driver later than 20.11.1 and
affects older GPUs (Polaris/FIJI cards). Wireframe drawing uses the same
OpenGL data type for storing normals what is known to be faulty.

This patch enabled storing the normals using GPU_COMP_I16. It also
solves the normals drawing in edit mode for vertex and loop normals.
2021-01-11 09:52:16 +01:00
64929398fb Cleanup: skip accessing sequence strip name/source when hidden 2021-01-11 17:58:08 +11:00
a83c67c183 Fix incorrect use of BLI_snprintf in sequencer text concatenation
The start of the text was stepped over without subtracting it's length
(introduced in fad80a95fd).

Replace this logic with BLI_string_join_array to simplify construction.
2021-01-11 17:51:42 +11:00
b01e62e399 Fix missing directory separator in image/movie strip identifier 2021-01-11 17:17:10 +11:00
16aefea9fa Cleanup: use switch statement for sequence types
Also remove duplicate NULL pointer check and replace
BLI_snprintf with BLI_strncpy.
2021-01-11 17:13:27 +11:00
50104b11a1 Fix T84582: WalkNavigation.mouse_speed ignored with tablet
Scale the speed up 4x instead of clamping the value to a minimum of 4.
2021-01-11 16:33:15 +11:00
ab5986cf3a Fix T84501: Wintab button lag.
Multiple Wintab tablets do not send relative button state when
configured to do so. This causes button events to be delayed until
processed as Win32 button events.

This commit fixes the issue by configuring Wintab to use absolute
button state and tracking changes manually.
2021-01-10 21:18:46 -08:00
af88d23ffa Revert "Fix typo; Documentation; Expose layer for framebuffer attachament; Add framebuffer viewport setter; Remove framebuffer restore; Expose framebuffer push/pop stack API; Remove blend modes; Remove depth_range_set; Implement GPU_face_culling, GPU_front_facing, GPU_point_size, GPU_line_width, GPU_viewport, GPU_color_mask and GPU_depth_mask"
This reverts commit 9db3d1951d.

This was an accidental commit of the patch D8826
2021-01-10 21:07:04 -03:00
d4330ae70b Transform: In the Header, show translation value in local space only with constraint
This partially reverts commit ad15e764dd.
The local value is only useful with constraint.
2021-01-10 20:58:45 -03:00
ad15e764dd Transform: In the Header, show the translation value in local space
Showing value in the global space was an unintentional change.
2021-01-10 20:30:25 -03:00
08e44b5e3e Fix Increment Snapping Without Constraints in Non-Axis-Aligned Views
The incremental snap was always operating in the local space, which in most
cases is the VIEW type orientation.

Use only local space when the operation is affected by constraint.

Differential Revision: https://developer.blender.org/D10052
2021-01-10 20:24:46 -03:00
9db3d1951d Fix typo; Documentation; Expose layer for framebuffer attachament; Add framebuffer viewport setter; Remove framebuffer restore; Expose framebuffer push/pop stack API; Remove blend modes; Remove depth_range_set; Implement GPU_face_culling, GPU_front_facing, GPU_point_size, GPU_line_width, GPU_viewport, GPU_color_mask and GPU_depth_mask 2021-01-10 19:01:53 -03:00
1d3b92bdea UI: Improve node group input / output list interface
This commit replaces the two-column list for editing node group inputs
and outputs with a cleaner solution with two panels. The new layout
has several benefits:
 - It uses the vertical space in the node editor sidebar better.
 - It should be more familiar because of similarity with other UI lists.
 - It should look better with consistent alignment and icons.

Note that displaying the "Name" property outside of the list itself is
a bit inconsistent and could possibly be removed in the future.

Differential Revision: https://developer.blender.org/D9683
2021-01-10 13:24:37 -06:00
30310a4fc8 Fix T83777: Crash when enabling guides
Also adjusted adjusted guiding UI parameters so that guiding will not get invalidated when changing domain values.
2021-01-10 19:16:44 +01:00
5b90ed6c06 Fluid: Fix cache saving issue with OpenVDB IO
Fixes issue where files would not be written when 'resumable' option was checked.
2021-01-10 19:16:44 +01:00
Peter Fog
544e371908 Fix T84529: Crash with strip using deleted scene
If scene strip has no scene assigned, leave source string empty.
Same goes for all other strips, that use ID datablocks.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D10058
2021-01-10 17:37:07 +01:00
e45630a99f Fix sequencer disk cache not writing data
Error handling added in 512a23c3d6 caused that reading header of new
file failed, since it is empty.

Don't attempt to read header if file is empty. If header can not be read
anyway, try to delete the file. Add asserts, as this should never
happen.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9954
2021-01-10 16:50:08 +01:00
9441413cb2 VSE: Remove fit method tool setting from header
This property was intended to affect fit method for added strips prior
to running operator. However UI team did not agree with current
implementation.

ref T84535

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D10055
2021-01-10 16:37:18 +01:00
6154aa1529 Cleanup: remove redundant decorator for eevee 'overscan_size'
All eevee scene properties are not animatable due to
`RNA_define_animate_sdna(false)` so there is no need for an animation
decorator here (would not show anyways).

Not sure if setting use_property_decorate to False and then manually
adding one again was a hack in rB7fc60bff14a6 to get the alignment
right, but seems to work good now without it.

Note: there also seems to be an inconsistency here generally:
- Eevee reserves room for an animation decorator in almost every panel
(except for "Sampling" and "Indirect Lighting") even though almost none
are animatable (except for stuff in "Hair" and "Film"). This looks nice
if multiple panels are expanded (except for mentioned "Sampling" and
"Indirect Lighting" -- maybe these should also reserve the room?)
- Cycles does not use animation decorators at all (even though pretty
much everything is animatable here -- maybe these should also use
animation decorators?)
- Then there is also the 'shared' "Grease Pencil", "Freestyle" and
"Colormanagement" -- these dont use animation decorators, but some stuff
is animatable...

Regarding the note: not sure what the guidelines here are, if this is
isolated to each panel then there is lots of stuff for eevee that could
set use_property_decorate to False, if multiple open panels are
considered (for nice visual consistency between them), then there is
romm for improvement elsewhere, too.

Maniphest Tasks: T81411

Differential Revision: https://developer.blender.org/D9164
2021-01-09 15:02:14 +01:00
fa82a15676 Cleanup: remove unused struct members
Non-projection painting in the viewport is no longer supported,
remove struct members used for this.
2021-01-09 19:07:31 +11:00
e718004edf Cleanup: use bool arguments & variables 2021-01-09 19:07:14 +11:00
246efd7286 Fix UV selection threshold which ignored image aspect and zoom level
Selecting UVs wasn't properly scaling based on the zoom or image aspect.

This now matches vertex selection in the 3D view.
2021-01-09 18:42:36 +11:00
645298be29 Fix build error after last commit 2021-01-08 23:10:58 -06:00
1bb530745f Cleanup: Use bool instead of int 2021-01-08 23:09:31 -06:00
9c07454816 Keymap: Enable repeat for "Make Edge/Face" operator
The "repeat" property was turned off by default in rBf5080c82dd91, but
it's important to have repeat turned on for this operator since it can be
used to fill large areas. This commit is similar to rBaa77689f77b4.

Fixes T84531
2021-01-08 17:19:04 -06:00
69a22a70ac Geometry Nodes: Don't start with empty group nodes selected
The nodes were selected in new node groups because they are by default,
but there's no particular reason for them to be selected, and it can
be distracting.
2021-01-08 16:29:10 -06:00
7fd19c20e0 Geometry Nodes: Gray out "New" button when curve object is active
Currently curve objects aren't supported by the node modifier, so the
new node group and modifier operator shouldn't be available.
2021-01-08 15:04:38 -06:00
3c1fcec652 Fix T84517: Two geometry node trees added with "New" button
Adding the modifier itself already adds a new node tree, which is
then displayed in the node editor because of the active object and
active modifier context. So there's no need to create the node tree
in the python code in this case.
2021-01-08 12:12:43 -06:00
bc788929aa Scenes: forbid deleting last local scene
Previously, it was only forbidden to delete the last scene. This can
lead to the situation where a .blend file only contains linked scenes.
This is problematic, because linked data might not always be available
or can be removed from a .blend file without having an additional check
for remaining scenes.

Now there always has to be at least one local scene.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D10049
2021-01-08 16:39:42 +01:00
2d3f96cace Fix T84453: Crash bezier curves transfrom
The pointer allocated to the `TransData` was being incorrectly incremented,
causing misalignment and consequently `heap-buffer-overflow`.

Because of this, `TD_NOTCONNECTED` was being set in a strange way that did
not correspond to other types of `TransData`.

The solution is to not increment the `TransData` pointer and set
`TD_NOTCONNECTED` only for "unconnected" segments.

The code was also a bit deduplicated.
2021-01-08 11:22:58 -03:00
c549d736cf Icons: Update script to generate icons from SVGs for Inkscape 1.0
The command line syntax for Inkscape changed quite a bit for the 1.0 release,
see https://wiki.inkscape.org/wiki/index.php/Release_notes/1.0#Command_Line.
Think it's reasonable to expect Inkscape 1.0 or later be installed if you want
to generate the icons with the script. It's easy to get via the website, if the
distribution doesn't provide new enough packages. Only few people would use the
script anyway.

I also had to change the path for command line access on macOS which apparently
changed (https://stackoverflow.com/a/60068607). Although I didn't find a
mention of this change in the Inkscape release notes.
2021-01-08 15:07:54 +01:00
c66f00dc26 Fix Cycles rendering with OptiX after instance limit increase when building with old SDK
Commit d259e7dcfb increased the instance limit, but only provided
a fall back for the host code for older OptiX SDKs, not for kernel code. This caused a mismatch when
an old SDK was used (as is currently the case on buildbot) and subsequent rendering artifacts. This
fixes that by moving the bit that is checked to a common location that works with both old an new
SDK versions.
2021-01-08 13:38:26 +01:00
e3ae7d1f2f Fix T83942: improve error checking when trying to render high resolution volume
Reviewers: fclem

Differential Revision: https://developer.blender.org/D10032
2021-01-08 12:14:12 +01:00
c889ec916c Cleanup: clang format 2021-01-08 11:54:53 +01:00
c44a17ec4b Fix T84475: Outliner missing update when adding IDs to main via RNA
Was reported for meshes, but was true for any type.
Now add appropriate notifier to refresh the Outliner.

Maniphest Tasks: T84475

Differential Revision: https://developer.blender.org/D10030
2021-01-08 11:50:36 +01:00
1698678231 GPU: Mark AMD Polaris 20.11+ drivers with limited support.
The issue does not render wireframes correctly.
2021-01-08 11:44:31 +01:00
03f1d8acab Use the term "N-gon" instead of "Polygon" for triangulation method
This was reported for the Triangulate geometry node, but was also true
for the triangulate modifier and in exporters.

Note the modifier was introduced with "Ngon Method" in rBa7b44c82e5b9 but
was renamed to "Polygon Method" in rBf4762eb12ba5.

Since quads are also polygons (and quads have their own method), the
term "N-gon" is more appropriate here and is also described in the
glossary https://docs.blender.org/manual/en/2.92/glossary/
index.html#term-N-gon

Docs have been updated in rBM7539 (partially - the method would also
have to be renamed once this patch lands).

Note this also fixes the wrong enum used for the alembic exporter.

Fixes T83907

Maniphest Tasks: T83907

Differential Revision: https://developer.blender.org/D10022
2021-01-08 11:20:42 +01:00
4a0b8c9427 Cloth: completely exclude fully pinned triangles from collision.
Currently such triangles are effectively already excluded, because
the calculated forces are not applied to pinned vertices. However
these forces are still being computed, which is inefficient.

This adds an early check for triangles where all vertices are
pinned during BVH overlap detection, which significantly speeds
up certain use cases with big fully pinned areas that happen to
overlap a collider. In case of self collision both triangles must
be fully pinned to exclude safely, because the computation is
symmetric and handles two triangles at the same time.

Differential Revision: https://developer.blender.org/D10041
2021-01-08 12:24:50 +03:00
8877e294df Surface Deform: the Strength setting is not bind-specific.
It is used during evaluation so it shouldn't be greyed out in the UI.

Ref D10040
2021-01-08 12:24:50 +03:00
662b7c3edf Surface Deform: optimize memory allocation in the evaluation code.
Using malloc to allocate a temporary array for each vertex,
which most commonly contains just 4 elements, is not efficient.
Checking the mode with a switch is also better.

Differential Revision: https://developer.blender.org/D10040
2021-01-08 12:24:50 +03:00
ceaed47bf9 GPU: Enable HQ normal work around on Linux.
Linux does not report the driver version. It does report the OpenGL
version. This change will check the OpenGL version to enable the HQ
normal work around.
2021-01-08 10:23:20 +01:00
f448ff2afe VSE: Hide cache settings and adjust defaults
Adjust default cache settings for all files to store raw and final
images.

All settings are still available when developer extras option is
enabled in user preferences.

This is part of design task T80278

Differential Revision: https://developer.blender.org/D9745
2021-01-08 07:24:55 +01:00
09ea339a6c Cleanup: Use LISTBASE_FOREACH macro 2021-01-07 21:24:46 -06:00
15bb8f9f93 Fix file-handle leak when parsing xdg user directories 2021-01-08 13:19:11 +11:00
61f1faac3f Fix T83868: Disabled or inactive list items are not grayed out
The cause for this was quite simple-- a misplaced bitwise operation
before passing a value to the function that grayed out buttons based on
their state, caused by refactoring in rB933bf62a611f before committing.

What makes the situation a little more confusing is that the theme colors
are overridden for list buttons in UI lists, necessitating a second
call to `ui_widget_color_disabled()`. Ideally that wouldn't be necessary.
2021-01-07 16:28:26 -06:00
5530d6f86f PyAPI Docs: Terminal instructions for Windows incorrect
Fixes T84498
2021-01-07 15:58:47 -05:00
95c63babbb Cleanup: Declare variables where initialized 2021-01-07 12:30:18 -06:00
d259e7dcfb Cycles: Increase instance limit for OptiX acceleration structure building
For a while now OptiX had support for 28-bits of instance IDs, instead of the initial 24-bits (see also
value reported by OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCE_ID). This change makes use of
that and also adds an error reported when the number of instances an OptiX acceleration structure is
created with goes beyond the limit, to make this clear instead of just rendering an image with artifacts.

Manifest Tasks: T81431
2021-01-07 19:23:13 +01:00
3db2bc82aa Surface Deform: optimize handling of the vertex group weight.
There is no need to first copy weights to a separate array,
or create the data layer if it doesn't exist. The threaded
code can retrieve the weight directly from the layer.

Differential Revision: https://developer.blender.org/D10015
2021-01-07 21:08:44 +03:00
Juanfran Matheu
64277e8f3a UI: Use Eyedropper Cursor with Sample Weight Tool
While using the Sample Weight tool in Weight Paint mode, user eyedropper mouse cursor.

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

Reviewed by Pablo Vazquez
2021-01-07 09:44:48 -08:00
Juanfran Matheu
e3d9241a05 UI: Show Weight Value with Sample Weight Tool
While using the Sample Weight tool in Weight Paint mode, show weight value in tool header.

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

Reviewed by Pablo Vazquez
2021-01-07 09:29:36 -08:00
3db975f30d Fix T84326: No ID for geometry nodes instances after scattering
Instances are created with an "index" parameter used for persistence over
time through animation. Currently the geometry nodes instancer passes
the index in the array for this value, but the arrays created by the
"Point Distribution" node aren't necessarily stable  in this way when
the input mesh is deformed. In D9832 we already mostly solved this
problem with an `id` attribute. The solution here is to create instances
with this attribute as well.

It's important to note that deforming the instanced points *after*
distribution will usually be a better solution for this problem. This
solution is likely still important though.

Differential Revision: https://developer.blender.org/D10024
2021-01-07 09:27:42 -06:00
4c0fc60105 UndoSystem: Early out from core undo/redo handlers when undo step is NULL.
Also added `undosys_stack_validate` debug check to redo case.
2021-01-07 15:58:23 +01:00
044dd42a05 Cleanup: Undo system: minor simplification in non-debug code. 2021-01-07 15:58:23 +01:00
987e9e2145 Fix T84469: Online manual raises an exception with key-map options
Report an error instead of raising a Python exception.

Currently these properties aren't written to the manual
so it's best to show an error.
2021-01-07 23:36:25 +11:00
c55b578c9e Fix T84142: crash when mirroring hair emitted from vertices
The hair mirroring code seems to expect that hair is emitted from faces.
The PE_mirror_x contains the following expression: mirrorfaces[pa->num * 2].
This only makes sense when pa->num is a face index.

The simplest short term solution is to disable the mirror operator when
the particles haven't been emitted from faces.

Diffferential Revision: https://developer.blender.org/D10002
2021-01-07 13:32:36 +01:00
c26f46cb95 Fix T83497: missing relations update when group node changes
Changing which node group a group node references needs a depsgraph
relations update in some cases.

Differential Revision: https://developer.blender.org/D10018
2021-01-07 13:31:17 +01:00
0d042c8cca RNA: document Python instancing for ID's and RNA types
Document some of the less obvious implications for
re-using Python instances.
2021-01-07 21:36:39 +11:00
4a771263fd Outliner: use the scene ID for ObjectBase PointerRNA
While this didn't cause any problems, `Base` structs are part of the
scene which is being set in other uses of this type.
2021-01-07 16:20:08 +11:00
Yevgeny Makarov
dd0df3c5d2 UI: Fix various issues with UI text
- Use the name "Point Cloud" instead of "Pointcloud"
 - Fix a typo in UV_OT_smart_project.
 - Use the name "Install Light" to for the installation
   operator for MatCaps, HDRIs, and Studio Lights.

Fixes T83585, T65291, and T54921

Differential Revision: https://developer.blender.org/D9867
2021-01-06 22:54:10 -06:00
2dfd117ab5 Fix memory leak duplicating a scene with "Copy Settings" 2021-01-07 15:04:26 +11:00
a9dea9cfaa PyAPI: don't raise & clear exceptions when setting context members
BPY_context_dict_clear_members_array used PyDict_DelItemString
which raised & cleared the exception when the key didn't exist.

Even though setting/clearing the exception is supported,
it's worth avoiding where possible as it adds some overhead as well as
overwriting the previous error which can free PyObject's which are
unrelated to the code being executed.

Possible fix for T82552, crashing on Windows when setting the exception.
2021-01-07 14:41:52 +11:00
f35a38fba7 Fix BKE_blender_atexit_unregister error removing from linked list
This is an old bug exposed by having multiple atexit calls since
c65c4149c9.
2021-01-07 13:31:57 +11:00
27426c05b1 PyAPI Docs: Link to user docs instead of describing in API doc 2021-01-06 19:52:13 -05:00
b138c8f5b3 PyAPI Docs: Update Indirect Data Access docs
Fixes T84432
2021-01-06 19:34:21 -05:00
a9c607e60e PyAPI Docs: Fix wrong modifier path usage
Fixes T84430
2021-01-06 18:54:56 -05:00
133bdac306 PyAPI Docs: Clarify quick start guide tips
Some of the text here was outdated with 2.8x.
See T84427
2021-01-06 18:45:34 -05:00
211e161d76 Fix T84416: Vertex color baking checks for UVMap
Since the introduction in rB2221389d6e8e, baking to vertex colors would
still check for the existence of a valid UVMap (as if baking to image
textures).

Now check for vertex colors instead if target is
R_BAKE_TARGET_VERTEX_COLORS.

Maniphest Tasks: T84416

Differential Revision: https://developer.blender.org/D10006
2021-01-06 22:26:20 +01:00
6ea01dc509 UI: Use the 3D cursor icon for the RNA struct
Since there is a specific icon to represent the 3D cursor it makes sense
to add it to the RNA struct. This struct's icon is only displayed in the
Data API section of the outliner.
2021-01-06 14:00:44 -06:00
3028de9527 UndoType: Refactor: replace use_context boolean by a bitflag.
We will soon need more options here, sinmpler and cleaner to use a
bitflag then.
2021-01-06 18:07:09 +01:00
5cdf279ef4 Fix T84420: Linking regular materials to gpencil
When using "Make Links"->"Materials" regular materials could be linked
onto grease pencil objects. This caused a number of issues.

The fix changes the `allow_make_links_data` function to make sure that
if one object is of type `OB_GPENCIL`, the other has to be aswell.

Reviewed By: antoniov

Maniphest Tasks: T84420

Differential Revision: https://developer.blender.org/D10014
2021-01-06 17:54:44 +01:00
6672cbeb23 Fix T84202: Sculpt lasso mask crash after remesh.
'Caused'/revealed by rBd29a720c45e5: Operators that fully re-create the
mesh would previously rely on `sculpt_update_object` called from update
code to get required sculpt-specific data layers re-added to the new
mesh.

Now instead put all code adding data to orig mesh for sculpt purpose
into a new util function (`BKE_sculpt_ensure_orig_mesh_data`), and call
that function when entering sculpt mode, and from voxel remesher code.

This is contonuing effort to more clearly separate orig data from evaluated
data handling/usage in sculpt code.

TODO: there are likely other code paths that would need to call that
new function?

Reviewers: @sergey, @pablodp606

Subscribers:
2021-01-06 16:25:39 +01:00
a584aef470 Undo: Further tweak/fixes the 'use context' flag of undo types.
Note that this is fairly fragile still, especially in cases like paint
cureve undo, which actually does not use context in most cases (and can
be called with a NULL context), but do need it in one case. This will
need a proper rework at some point.
2021-01-06 15:59:23 +01:00
691c021679 Fix T82952: Crash changing mesh data block and switching scenes
Regression in 33ac3582bb.
2021-01-07 01:35:05 +11:00
f0071dfa10 Fix T79779: Pick shortest UV face-path ignores sticky setting 2021-01-07 00:37:05 +11:00
144d9b901e EEVEE: Depth of field: Improve scatter pass
This makes each sprite scatter 4 pixels instead of one.

This roughly divides the render time of the effect by two and
improve the color precision.

The single pass method was creating issues on near/far CoC
discontinuities, so we reverted to a 2 pass method even if a bit
more costly (but still is 2x faster).
2021-01-06 14:12:38 +01:00
0e4f8ed90e UndoType: Fix some incinsistencies re context usage flag.
`use_context_for_encode` was not properly set regarding actual `encode` code for a few types.
2021-01-06 14:11:25 +01:00
eb1ff4b3a4 Cleanup: CodeStyle format 2021-01-06 13:55:27 +01:00
1c72a2f47d Cleanup: CodeStyle Format 2021-01-06 13:54:12 +01:00
967cf303f3 Fix T83372: Point.select can be True when unselected 2021-01-06 23:27:03 +11:00
bc3e38ca3a Cleanup/refactor: UndoType: Clarify use_context variable.
Rename it to mark it is only for `encode` callbacks, fix `encode`
callback of text undo to early fail in case it gets a NULL context, add
an assert to `BKE_undosys_step_push_with_type` that context is not NULL
when undotype requires a valid one.

Note that in practice this should not change anything, currently it
seems that we always get a valid context in
`BKE_undosys_step_push_with_type`?
2021-01-06 12:28:06 +01:00
4e23f08807 Fix object moved to cursor when editing last operation after dropping object
Steps to reproduce were:
* Drag object icon from the Outliner into the 3D view (or an object asset from
  the Asset Browser)
* Open the "Adjust Last Operation" panel
* Edit options in there - the object would move to the mouse location

The same issue happens with collection instance and object data adding (e.g.
via drag & drop). This patch addresses them too.

The operator used the event state stored in the window. This shouldn't be
accessed from the operator execute callback generally which happened here.
Especially not if the operator supports editing properties.
2021-01-06 11:55:21 +01:00
290b6d7ef3 Fix T70316: Custom "Delete Keyframes" shortcut still requires
confirmation

Deleting keyframes in the dopesheet or graph editor always required
confirmation, even if used ouside of the "Delete" menus.

Now add a "confirm" option [same as for deleting objects], which can be
disabled for immediate keyframe deletion.

This will also change the default behavior and bring this in line with
how object deletion works so there is one shortcut for bringing up the
menu/confirmation and another shortcut to delete immediately without
requiring confirmation / another click:

- Blender Default keymap: "X" for menu, "Del" for immediate
- Industry Compatible: "Backspace" for menu, "Del" for immediate

Maniphest Tasks: T70316

Differential Revision: https://developer.blender.org/D9651
2021-01-06 11:35:06 +01:00
4b56c18290 Fix T84426: Limit dissolve ignores selection with custom normals
Regression in 9969c2dd16.

Add note that custom normal calculation functions write into to tags.
2021-01-06 19:04:53 +11:00
947dc92083 BMesh: assert when a mesh has two kinds of shake-key data
Assert with comment to avoid confusion caused by
mixing two kinds of shape-key data.

This problem was exposed when investigating T84364.
2021-01-06 18:11:46 +11:00
Yevgeny Makarov
5424b4821d Fix T83094: Alternate rows in the Sequencer are green (macOS)
The issue is that `UI_GetThemeColorBlendShade4fv()` creates a color
with alpha, but there is not any background underneath to blend in with.

The solution is just to draw an opaque background first, which also
halves the number of rects to draw. Note that the brighter rows get
very slightly darker after this change.

Differential Revision: https://developer.blender.org/D9947
2021-01-05 14:21:54 -06:00
2ed6055209 Fix T79146: Sculpt Mode lags until the entire mesh is visible
This was caused when the BKE_pbvh_draw_cb function was used with
update_only_visible set to false. In that case, all nodes with the flag
were updating, but the update flag was only cleared for visible nodes.
This was causing constant updates per redraw in no visible nodes until
they enter the view frustum and their flag was cleared.

In order to fix this and prevent it from happening again:
 - Updating the buffers, flushing the updates and clearing the flags are
now part of the same function. It does not make sense to do these in
separate places.

 - The BKE_pbvh_draw_cb function was refactored so the
pbvh_update_draw_buffers is only called once. It should now be easier to
understand what the function does when it is used to update only visible
nodes or all nodes.

Reviewed By: mont29

Maniphest Tasks: T79146

Differential Revision: https://developer.blender.org/D9935
2021-01-05 20:23:41 +01:00
c20e482714 Fix T78681: "Add Primitive" icons are cropped in tool header
The issue can be simply resolved by moving the primitives and plus
icons slightly. They still bump up against the top and bottom of the
header but it looks much better now.
2021-01-05 13:00:35 -06:00
4ade409a87 Cleanup: Reduce variable scope 2021-01-05 12:22:23 -06:00
3373d14b1b Fix T83925: Crash when rendering on the CPU with OptiX denoiser enabled
Rendering on the CPU uses the Embree BVH layout, whether the OptiX denoiser is enabled or not.
This means the "build_bvh" function gets a "BVHEmbree" object to fill and not a "BVHMulti" as it
was assuming before, which caused crashes due to memory geting overwritten incorrectly. This
fixes that by redirecting Embree BVH builds to the Embree device.

Manifest Tasks: T83925
2021-01-05 18:37:31 +01:00
491a9e9ec4 Cleanup: Undo code: poll function.
Remove obviously outdated comment, and explictely set `poll` to `NULL`
in the one case it is not actually defined (sculpt undo).
2021-01-05 18:21:09 +01:00
90a26f900c Cleanup: UndoType: use size_t for memory size of structs. 2021-01-05 18:21:09 +01:00
166c0db3f9 Fix T83915: Subdivision Surface modifier causes visual artifacts in Cycles rendered viewport - CPU and OptiX
Changing the geometry in the current scene caused the primitive offsets for all geometry to
change, but the values would not be updated in all bottom-level BVH structures. Rendering
artifacts and crashes where the result. This fixes that by ensuring all BVH structures are
updated when the primitive offsets change.
2021-01-05 17:59:38 +01:00
da9d471e1d Fix T84389: RGB Curves node shows "tone" option outside of compositor
Since the introduction in rB4de7c0c3105a, the option is only used in the
compositor, it has no effect elsewhere [texture nodes, shader nodes].

Now only show the option for the compositor.

Maniphest Tasks: T84389

Differential Revision: https://developer.blender.org/D10005
2021-01-05 17:04:56 +01:00
583006d0ef Cleanup: clang tidy 2021-01-05 17:04:02 +01:00
39f99fd05c Fix: tried to set error message on modifier that does not exist
Without this, the example file in T83730 crashes in a debug build
when deleting the hair edit bake in the particle settings.
2021-01-05 16:50:23 +01:00
9dbea1db66 Compositor: Alpha Mode
{D9211} introduced pre-multiplying the color for the keying node. This
pre-multiplication should also be done by other keying nodes and should be
the default operation for alpha node.

This patch will change the logic of keying nodes (Cryptomatte Node,
Channel Matte, Chroma Matte, Color Matte, Difference Matte, Distance
Matte, Luminance Matte) and breaks old files.

The Set alpha node has a mode parameter. This parameter changes
the logic to `Apply Mask` the alpha on the RGBA channels of the input color
or only replace the alpha channel (old behavior).

The replace mode is automatically set for older files. When adding
new files the the multiply mode is set.

Reviewed By: Sergey Sharybin

Differential Revision: https://developer.blender.org/D9630
2021-01-05 16:34:55 +01:00
357e519575 Fix T83282: division by zero when creating psys tasks 2021-01-05 16:17:37 +01:00
cffa39358f Cleanup: Compositor comment style 2021-01-05 15:50:58 +01:00
36ae6e66c1 Fix T84367: Fix crash when showing invalid/legacy constraints
Exposed by rBeaa44afe703e.

Definition for CONSTRAINT_TYPE_NULL is not totally clear (it is set for
constraints without data, see an old comment from Ton), but for these, a
TypeInfo cannot be fetched.

Avoid processing those constraints in UI code, just do nothing instead.

Maniphest Tasks: T84367

Differential Revision: https://developer.blender.org/D9987
2021-01-05 15:31:40 +01:00
Jeroen Bakker
1f41bdc6f3 Eevee Cryptomatte: Store hashes in render result meta data
Stores cryptomatte hashes as meta data to the render result. Compositors could
use this for lookup on names in stead of hashes.

Differential Revision: https://developer.blender.org/D9553
2021-01-05 15:03:05 +01:00
7cd6f667e3 Fix T84053: Mask overlay in image editor not working
The mask overlay wasn't part of the overlay engine. The reasoning nehind
this was that more editors used the mask overlay and most of them used
old drawing code. This patch adds the mask overlay drawing to the draw
overlay engine. This code path will only be used by the image editor
VSE, Compositor and Movie Clip editor will still use the previous
method.

During this patch some alternatives have been researched:
1. `ED_mask_draw_region`: this would lead to different code paths when
   drawing in the image editor, and some hacks to retrieve the correct
   framebuffer.
2. Add mask drawing to image engine: Would lead to incorrect color
   management when viewing the mask.
3. Add mask drawing to image engine and overlay engine: Would lead to
   duplicated code.
4. Add mask drawing to overlay engine and for combined overlay select
   the correct framebuffer.

Option 4 was chosen as the exception (switching framebuffers) can be
done without hacks. The code stays clean.
2021-01-05 13:53:33 +01:00
f41de6dc46 Fix T84404: Crash when using Skin Resize in mesh without Skin modifier
Caused by rB54ee4109143b

Before that commit `TD_SKIP` was marked for all vertices.

Now skip the whole operation as all vertices are skipped.
2021-01-05 09:46:07 -03:00
fab772860d Asset browser: workspace in the wrong category
Workspaces [FILTER_ID_WS] were in the `Environment` category
IDFilterBoolean, whereas they are in the `Miscellaneous` category in
`rna_def_fileselect_asset_params`.

Make this consistent ['Miscellaneous'] in both cases.

(note this was already done in rB2c317457cbf2 for the file browser case)

Spotted while looking into T83983.

Maniphest Tasks: T83983

Differential Revision: https://developer.blender.org/D9911
2021-01-05 13:30:51 +01:00
acfa7b102b Sculpt: use distance threshold for dyntopo symmetrize
This was only used for non-dyntopo symmetrize.
There is no reason to use a hard-coded value in this case.
2021-01-05 23:19:34 +11:00
1f6846fa4e Cleanup: remove UNUSED(..) from public function declarations
This doesn't serve any purpose and can become out of sync
with the function it's self without reporting warnings.
2021-01-05 23:09:50 +11:00
e4884d224c Cleanup: remove redundant RNA_types.h header from UI_interface.h 2021-01-05 23:04:51 +11:00
105d385e4b Fix T84364: Sculpt symmetrize fails with shape keys
Use the BMesh symmetrize operator instead of using the modifier code.

While we could support shape-keys with the existing code used by the
mirror modifier, we'd need to add code-paths for evaluated mesh & bmesh
conversion to handle shape-keys differently just for this one case,
since we want to avoid copying & processing shape-keys layers for
evaluated meshes in general.
2021-01-05 22:48:12 +11:00
7241104877 Enabled Physics Particle Instance test 2021-01-05 16:16:08 +05:30
c0a8dd943f Fix T84018: bulk selection (box, circle, lasso) - unwarranted selection
of islands in vertex mode if "UV Sync Selection" is on

Caused by rB72b422c1e101: UV: support select linked with sync-select in
vert/edge modes

If you had island selection mode enabled in the UV editor with UV Sync
Selection off, and switch UV Sync Selection on, then in vertex selection
mode all bulk selection ops (box, circle, lasso) will be selecting whole
islands.

Prior to culprit commit, for sync selection ON plus island selection ON,
BM_uv_vert_map_create would always return a NULL vmap (it was called
with `use_select` = True, no faces tagged selected). After said commit,
for sync selection ON plus island selection ON, BM_uv_vert_map_create
would return a valid vmap (it is now called with `use_select` = False,
no faces tagged selected - but if `use_select` is False, all UVs will be
added here).

If I am not mistaken, it is never wanted to actually select islands with
box/lasso/circle when sync selection is turned ON [after all you dont
have the UI for it showing], so solution is now to check for this
earlier and not even call uv_select_linked_multi in those cases. (Maybe
in the future this can be unified and we dont need separate selection
modes fo UV and 3D?)

Maniphest Tasks: T84018

Differential Revision: https://developer.blender.org/D9917
2021-01-05 10:26:23 +01:00
dc4014c676 Cleanup: Enum for mask overlay mode 2021-01-05 10:13:00 +01:00
7d152bedc5 Fix T84216: Drawing a paintcurve [vertexpaint / weightpaint] fails
Caused by rB35e3dc9192e7.

Above commit moved 'Weight Paint' & 'Vertex Paint' keymap also before
'Paint Curve' keymap.
This way, paintcurve.add_point_slide would be overriden by:
- paint.vertex_paint (inverted)
- paint.weight_sample

Now move 'Paint Curve' above again.

Reviewers: campbellbarton

Maniphest Tasks: T84216

Differential Revision: https://developer.blender.org/D9939
2021-01-05 10:02:03 +01:00
08f00f4f6e BMesh: Add shape-key support to edit-mesh symmetrize
Symmetrize now flips shape-keys too since using the un-flipped
locations creates an overlapping surface which isn't useful.
2021-01-05 18:03:56 +11:00
4150facd61 BMesh: add use_shapekey to BMesh transform operators
Currently unused, needed for symmetrize to support shape keys.
2021-01-05 15:51:50 +11:00
5370a7dd40 Cleanup: use scale's 'space' argument instead of two transform calls 2021-01-05 15:51:50 +11:00
d3c62b682d Fix bmesh.mirror operator
Checks for merging vertices assumed all the geometry was being mirrored.
2021-01-05 15:51:50 +11:00
a0db43cd7b Fix T84388: Invalid operator reference in the quick-start 2021-01-05 15:51:50 +11:00
6990b6ed3b Cleanup: typos (repeated words) 2021-01-05 15:51:50 +11:00
f359102589 VSE: Fix incorrect condition for skipping prefetch frames
This error was overlooked in commit be69f23b68.
2021-01-05 04:04:06 +01:00
9b17e71c23 Cleanup: Use flag type explicitly
Using the `uiButtonGroupFlag` type explicitly can avoid the need
to look up which enum should be used as an argument.
2021-01-04 17:35:14 -06:00
5a6dfb7571 Fix T78017: Broken layout in "View Lock" panel with armature
The property split layout was broken when the bone dialog appeared,
because the name field was not set. Theoretically property split should
work in this case, but it makes sense to use the label anyway.
2021-01-04 17:32:22 -06:00
9316cb33d8 Cleanup: Remove unused variables in transform mesh skin code
Differential Revision: https://developer.blender.org/D9992
2021-01-04 17:11:59 -06:00
102eff0bd4 Fix T84382: Geometry Nodes: Vertex group attributes are removed
In the report, the geometry is copied because it has two users and the
final join node needs to write to it. The join node also happens to
remove attributes apparently, because it exposed a mistake in the "copy"
method of the `MeshComponent` class. The copy is supposed to be
a deep copy, but the vertex group name map was not duplicated.

Differential Revision: https://developer.blender.org/D9991
2021-01-04 17:07:10 -06:00
ec90dda318 UI: Fix typo in operator description 2021-01-04 15:42:15 -06:00
Pi Lanningham
5a498e6a7b Fix T84183: Dark area in the bevel custom profile widget
If there was a control point at an extreme position when drawing a curve
profile (in the bottom corner), the fill's trianglulation could fail, giving
a misleading view of the curve. This is because the extra points added to
create a closed shape were exactly on the border of the view.

This commit adds a small margin to those points, so the triangulation
doesn't fail because the line overlaps itself.

Another possible solution is to use a different algorithm to fill
the polygon, such as scanfill, which is used by curve objects.
This seemed simpler, and seems to work fairly robustly.

Differential Revision: https://developer.blender.org/D9989
2021-01-04 15:13:08 -06:00
54ee410914 Fix T84376: Skin Resize(Ctrl + A) does not work in Symmetry
Since the `TransData` converted from vertices is the same used for other
transform modes (Move, Rotate, Resize), the logic used for mirroring
focused only on the position of the vertices.

The solution here is to create a specific `TansData` for `CD_MVERT_SKIN`.
2021-01-04 17:37:08 -03:00
8c80299fc4 Make mesh modifier tests not fail with optimized OSD lib
When building opensubdiv with more aggressive optimization flags
(-march=native -02) the output meshes would differ a bit from what we
expected in the current automated modifier test file.

The differences in vertex position is within the 1e-6 range, which I
would call is acceptable for floats. In addition to this, all the
modifier test that tests the subdiv modifier in particular pass without
any modifications. I've updated two tests in the modifier test file and
script to make it pass (listed below).

Updated following test categories:

1. Decimate test

Here there was a subdiv modifier applied before the actual decimate
modifier. Because the decimate modifier creates a queue of potential
vertices it can remove, it is highly sensitive to even small changes as
it drastically changes in which order the vertices are decimated in.

As this test should only be testing the decimate modifier, I pre-applied
the subdiv modifier in the test file.

2. RandomCubeModifier
For these tests I removed the subdiv modifier as well. As with decimate,
a small change in vertex position here can lead to quite different
results.

Reviewed By: Sergey, Bastien

Differential Revision: http://developer.blender.org/D9004
2021-01-04 19:30:20 +01:00
5aab7f66a0 Fix T83876: blender crashes when baking particles + smoke sim
This was introduced in rBe5c0d4613a8943c712b57fb336997ecd78e6508e.

The issue is that the new fluid system does not use the pointcache
system for caching anymore, but still relies on pointcache for
other things. For example, it uses DEG_add_collision_relations
which internally creates relations with pointcache. Not sure if
there are other issues.

Ideally, this dependence should be resolved in one way or another
at some point, but that is out of scope for this fix.

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

Reviewers: brecht
2021-01-04 15:58:51 +01:00
09c1cb8a17 Fix T84260: NURBS edit mode lines not showing
When in edit mode, the edit lines for de-selected surfaces did not
show up.

The bug was caused by the is_gpencil bool which reused another flag.
Both grease pencil and nurbs surfaces use the edit_curve_handle shader.
A dedicated flag was added to make sure the is_gpencil bool is
set correctly.

Reviewed By: fclem

Maniphest Tasks: T84260

Differential Revision: https://developer.blender.org/D9985
2021-01-04 15:34:02 +01:00
c6e5b3f42d Fix T84095: Eevee vextex color isn't working with hair
Regression introduced by {c766d9b9dc56}. When converting the vertex
buffer to a texture buffer the fetch mode wasn't checked and the short
was bitwise interpreted as a float. This change checks the fetch_mode
and select the correct texture buffer.

This could also be added to other places when needed. At this time it is
only added here to support vertex colors when used with hair particles.
2021-01-04 15:05:37 +01:00
c716b9862a Fix: Update normals when switching scene quality
Recent commits also updated normals for metaballs, curves and volumetric
objects. This change tags will tag to generate geometry for these new
types.
2021-01-04 13:04:37 +01:00
cb2517016b GPU: Enable HQ normal work around for AMD Polaris
THe high quality normals work around is enabled for Polaris cards using
the official drivers. Since driver version 2.11.2 they fail to render
using low quality normals.

The detection of polaris cards is done by matching the opengl renderer.
The renderer strings have been extracted from various reports linked to
{T82856} but isn't complete as some reports are missing the exact
renderer as users don't always report via the help menu.
2021-01-04 12:19:51 +01:00
a3fcbb54f4 GPU: Add HQ normals workaround.
This change makes it possible for platforms to only support high quality
normal rendering. This is part of {T82856} where current AMD drivers
running on the polaris architecture does not support the low quality
setting due to a driver bug.

In a next commit the work around will be enabled.
2021-01-04 12:19:51 +01:00
02d1f1482a Fix mistake in rBef90a8e12caf in data transfer code.
Old mistake from 2.80 era when we got rid of DerivedMesh...

Not critical, but could be backported to 2.90LTS too.
2021-01-04 11:30:04 +01:00
5e38384034 Fix T84362: Crash when use Vertex Paint in subdivide strokes
Maniphest Tasks: T84362

Differential Revision: https://developer.blender.org/D9983
2021-01-04 11:29:47 +01:00
c7085be6c6 Fix T84345: Transforming the cursor fails with absolute grid-snap
Absolute grid snapping was using the pivot, which doesn't make sense
when transforming the cursor.
2021-01-04 21:15:00 +11:00
d11a87b88c DrawManager: High quality normals for non meshes
This adds high quality normals for non meshes. These include

* Volumetric Object Wireframe
* Metaballs
* Extracted Curves
* Curves in edit mode

This is in preparation to fix a regression in recent AMD
drivers where the `GL_INT_2_10_10_10_REV` data type isn't
working in Polaris cards.
2021-01-04 11:09:56 +01:00
17be2149a8 Fix T84106: attribute mix node worked incorrectly on float attributes 2021-01-04 10:43:56 +01:00
b8e536f381 Fix imbuf.new & resize allowing zero & negative dimensions 2021-01-04 20:05:32 +11:00
a6285339ba Cleanup: remove unused optional argument to imbuf.new
While this didn't cause any problems, it was incorrect.
2021-01-04 20:00:27 +11:00
Philipp Oeser
80e720ee4a Fix T84191: remove python API limits for Image.scale() dimensions
Since the introduction in 2c23bb8389,
these were set to 10000 each.

This seems like an arbitrary limit (BKE_image_scale / IMB_scaleImBuf
don't have limits and I couldn't spot similar size restrictions in
image relating functions), now match what we do for creating images
(rna_Main_images_new), use INT_MAX.

Ref D9950
2021-01-04 19:05:46 +11:00
14ee48d898 Fix crash reading files with unknown modifier ID's
Missing NULL check for the modifier type.
2021-01-04 17:40:05 +11:00
f43e8cceb3 Fix early exit check in BKE_appdir_app_template_has_userpref
Logical error in 84f21c170d
This check was a no-op, replace this with a check for an empty string.
2021-01-04 17:40:05 +11:00
f17184bfeb Fix clang_array_check checking utility
Use python3 which is now supported,
only use CLANG_BIND_DIR & CLANG_LIB_DIR when they are set.

Also add immediate mode GPU API function calls.
2021-01-04 17:40:05 +11:00
3254a63218 Cleanup: correct array size in argument 2021-01-04 17:40:05 +11:00
dcdc0f177a Cleanup: use const variables 2021-01-04 17:40:05 +11:00
cd29d76ab6 Cleanup: typo in c484b54453 2021-01-04 17:38:11 +11:00
2008c24123 Cleanup: add NULL check for filename argument which could be NULL
While it's never NULL at the moment, checks elsewhere in this function
support passing in a NULL filename, so keep this working as intended
in case RNAProcessItem.filename is NULL in the future.
2021-01-04 17:38:11 +11:00
82bbe257ee Cleanup: redundant call to WM_modalkeymap_find 2021-01-04 17:38:11 +11:00
a5081896bc Cleanup: redundant code, minor inconsistencies
- Remove ternary operators when both values are the same.
- Remove break after return.
- Remove redundant NULL checks for code which handles
  those cases immediately beforehand.
2021-01-04 17:38:11 +11:00
b5c2a75d26 Cleanup: use ARRAY_SIZE when when looping over the array indicies 2021-01-04 17:38:11 +11:00
22895d0f32 Cleanup: remove self-assignment
Use CLAMP_MAX to remove redundant comparison.
2021-01-04 17:38:11 +11:00
b34eded930 Cleanup: remove redundant code
Fix for T62504 missed removing return call.
2021-01-04 17:38:11 +11:00
9ff4012711 Cleanup: sort cmake file lists 2021-01-04 17:38:11 +11:00
fea1026bb8 Cleanup: use 'pragma once'
Add explanations for cases the header-guard defines are still used.
2021-01-04 17:38:11 +11:00
dfbda59a66 Cleanup: redundant struct declarations 2021-01-04 17:38:11 +11:00
f03c25bda8 Cleanup: sort structs 2021-01-04 17:38:11 +11:00
54f89e8704 Cleanup: docy comments beginning with '/**' don't end with '**/' 2021-01-04 17:38:11 +11:00
9b10b3930b Cleanup: clang-format 2021-01-04 17:38:11 +11:00
c61c7d9926 Cleanup: spelling (use 'gimbal' instead of 'gimble') 2021-01-04 17:38:07 +11:00
613c568df2 Cleanup: use doxy sections for render_preview.c 2021-01-04 17:37:44 +11:00
12409b2069 Cleanup: rename get_brush_icon, make it a static function
Group with other icon preview API functions.
2021-01-04 17:37:44 +11:00
01f38c10cb Cleanup: use const casts in DerivedMesh.cc 2021-01-04 17:37:44 +11:00
1e8f266591 API Docs: CSS: Fix long enum list
This commit makes some adjustments to a previous fix which broke with 
new versions of sphinx/theme.

Fixes T76453
2021-01-02 20:04:25 -05:00
c7e92e379d Update RNA to manual url mappings 2021-01-02 17:51:56 -05:00
Aaron Carlisle
e1b8af9ba7 Fix Unreported: Run time error in UI code
Steps to reproduce:

1. Add clip to clip editor
2. Open the tracking settings & tracking settings extra panels

To fix this the sub panel is only drawn if a track is active.
The main panel will exit early and display a "No active track" message.
This is consistent with other panels in the clip editor.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D9727
2021-01-02 16:11:14 -05:00
0330b0552b Cleanup: Explicitly pass icon size to generation function, not just bool
* This way you don't have to look up the function declaration to know what the
  boolean value means.
* You can call the function in a loop over the available sizes and pass the
  index as size.
* Makes it easier to add a new size in future if needed.
2021-01-02 15:36:51 +01:00
057a8afb87 Fix T84024: Empty image opacity labeled transparency
This value really is the opacity, or the alpha, since a value of 1.0 means
that the image is fully visible, not invisible like "full transparency"
would suggest. Mistake in rBea4d28aea0343a.

Differential Revision: https://developer.blender.org/D9920
2021-01-01 12:07:42 -06:00
0da1fc2fc4 Fix T84029: Point Distribution node crash on mesh with no faces
This bug exposes some ugliness in the implementation in poisson disk
distribution implementation with likely incorrect resizing of vectors and
some other assumptions. However, a simple quick fix is to return early
when the input mesh has no faces. This makes sense anyway because
there is no surface to scatter on.
2020-12-31 17:01:29 -06:00
cda8979005 Fix mistake in recent rB8c135fa9a834 commit. 2020-12-31 15:12:06 +01:00
8c135fa9a8 LibOverride/RNA: refactor rna_property_override_property_real_id_owner.
Makes it more in line with more generic `RNA_find_real_ID_and_path`, and
avoids generating the rna path string if we do not need it.
2020-12-31 14:25:29 +01:00
85951f8fde Cleanup: Move functions from sequencer_edit.c
These are utility functions that are not used in this file.

No functional changes.
2020-12-31 05:22:19 +01:00
e5e57fe0a2 Cleanup: Remove unused functions from sequencer_edit.c
No functional changes.
2020-12-31 05:02:10 +01:00
8373f497bd Add regression tests for curve conversion to mesh
This adds a basic set of tests for curve sampling and bevel generation.
At the moment there are basic test cases for bevels, caps, and the
filling of 2D curves, but more tests can be added in the future.

Curves are actually converted to "DispLists" for displaying them in the
viewport, so it's much simpler to rely on the mesh conversion operator
instead of building a new test framework for another data structure.

Differential Revision: https://developer.blender.org/D9958
2020-12-30 13:12:29 -06:00
Yevgeny Makarov
2d86175bac Fix unreported: Sequencer grid lines are not drawn
By design, there should be lines between the alternating horizontal
stripes in the Sequencer. But currently they are all drawn in one place,
on top of each other. Mistake in rBfae895125efe.

Differential Revision: https://developer.blender.org/D9962
2020-12-30 12:56:24 -06:00
2be2165dd6 Cleanup: Use LISTBASE_FOREACH macro
Differential Revision: https://developer.blender.org/D9960
2020-12-30 17:03:06 +01:00
f910342c8d Outliner: Fix useless assert in new liboverride showing code.
It is perfectly 'valid' to find invalid RNA properties references in
override properties list. Data change, RNA changes, IDProperties change,
some linked ID may become unavailable, etc.

Note that those invaldi override properties are cleaned up when updating
the override info (so typically on undo step storage, and .blend file save).
2020-12-30 12:38:53 +01:00
761ef45a24 Cleanup: Fix typo in tests error message 2020-12-29 20:46:29 -06:00
c1740e9ad0 Fix T83991: Pasting sound strip not working correctly
New UUID was generated for original strip not new one.

Bug caused "invisible" sound strip playing that is impossible to
remove. Especially noticable when transforming pasted strips. In such
case, file reload was necessary.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9912
2020-12-29 19:57:56 +01:00
48e0e0e2ac Fix T83439: Sculpt: Radial symmetry combined with mirroring results in texture offsets
Looks like this has been wrong since the introduction in rB5505697ac508
10 years ago.

To get the proper texture lookup in the mirrored area, first rotate, then
translate/flip [instead of the other way around].

Maniphest Tasks: T83439

Differential Revision: https://developer.blender.org/D9897
2020-12-29 18:38:16 +01:00
ae82410329 Fix T83749: Better handling of alpha in generic Nodes material wrapper for IO add-ons.
Try to detect if a given image may have valid alpha data or not (based
on number of channels and depth). This may be a bit doggy in theory, but
in practice it should cover most fields as expected. We can always
adjust the euristic here in other wrong cases appear.

This will affect all import add-ons using that node shader wrapper (at
least OBJ and FBX ones).
2020-12-29 16:38:40 +01:00
e22a36e80a Cleanup: Use proper RNA_pointer_is_null helper.
Followup to rB7f3601e70dd and rBad63d2f60e2.
2020-12-29 12:11:18 +01:00
5428ad40e8 Test: Add utility to do near comparison for float[2] 2020-12-29 10:38:38 +01:00
81c57c9471 Fix T84144 cursor wrap broken for Windows.
Modifies WM_BUTTON processing to reuse existing mousemove logic. Fixes
case where cursor wrap was not being handled on mouse release.

Bonus: flattened mouse move logic so all paths lead to a single return.
Removed case where wrap is not handled until subsequent mousemove as
button press may rely on updated mouse move position.
2020-12-28 13:34:58 -08:00
1db27af38f Fix T84200: Rotating a paintcurve [all paintmodes] doesn’t work correctly
The transform code did not provide a 2d context to be used in 3d space.

The solution is to set all matrices for the screen space in these cases.

This commit also removes the dial3d drawing in these cases.
It was not correct anyway.
2020-12-28 16:19:37 -03:00
Erik Abrahamsson
6fbeb6e2e0 Add operator to copy a modifier to all selected objects
These two operators (one for grease pencil, one for other objects)
copy a single modifier from the active object to all selected objects.
The operators are exposed in the dropdown menus in modifier headers.

Note that It's currently possible to drag and drop modifiers between
objects in the outliner, but that only works for dragging to one object
at a time. Modifiers can also be copied with the "Make Links" operator,
but that copies *all* modifiers rather than just one. The placement
and scope of these new operators allow for more useful poll messages
and error messages as well.

Every object type that supports modifiers is supported. Although hook
and collision modifiers aren't supported because of an unexplained
comment in `BKE_object_copy_modifier`, other than that, every modifier
type is supported, including particle systems, nodes modifiers, etc.

The new modifiers are set active, which required two small tweaks to
`object.c` and `particle.c`.

Reviewed By: Hans Goudey (with additional edits)

Differential Revision: https://developer.blender.org/D9537
2020-12-28 11:18:52 -06:00
7f3601e70d Cleanup/refactor rna_idp_path code.
Factorize common processes and checks, early `continue` in invalid
cases, etc.
2020-12-28 17:40:27 +01:00
ad63d2f60e Fix T84091: IDProperties/RNA: Crash due to colliding name between custom data and static RNA property.
We have to check that the RNAProperty found in `rna_idp_path` from the
currently checked IDProperty name is actually a real runtime RNA-defined
one, and not a static C-defined RNAProperty...
2020-12-28 17:40:27 +01:00
b1d8aeeab2 Snap: Decrease the distance of the incremental snap in ortho view
This matches more the older versions (as shown in the T77819).
2020-12-28 11:44:43 -03:00
26c34a2a3a Tweak comment regarding Sculpt mode undo issues in object update code.
Original comment from rB8a9dedf82954. See also T84084.
2020-12-28 14:16:14 +01:00
823f0da702 Cleanup: UI messages fixes. 2020-12-28 10:22:02 +01:00
e6bb2cdec7 Cleanup: Typo: overriden -> overridden. 2020-12-28 10:22:02 +01:00
e0b6c8f777 Fix possible fall-through in outliner region listener
Reported as a strict compiler warning, and the need of fall-through is
not needed from just reading the code.

If it is something what must happen, the reasoning is to be explained
in the comment, and ATTR_FALLTHROUGH is to be used.
2020-12-28 09:57:59 +01:00
e590d2d167 Cleanup: Declare variables where initialized 2020-12-27 21:46:57 -06:00
57fe65b17e Cleanup: Reduce indentation
Since the if statement is just a NULL check, returning early is simpler
and makes reading the rest of the funtion easier.
2020-12-27 21:26:53 -06:00
aa64fd69e7 UI: List library overrides in the Outliner
Having a centeral place to find a list of all library overrides should be
useful for managing production scenes where library overrides are used a lot.
This change adds the individually overridden properties of a data-block under
the data-block itself. Just how we show modifiers, constraints or pose channels
there. This way we can also expose library override operations/options better
in future.

There's also a filter option for the library overrides now, so they can be
hidden. It is only available in the View Layer display mode though, like the
other filter options.

One internal change this has to do is adding more informative return values to
undo pushes and the library override functions called by it. That way we can
send a notifier when library overrides change for the Outliner to know when to
rebuild the tree.

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

Reviewed by: Andy Goralczyk, Bastien Montagne, William Reynish
2020-12-27 22:45:41 +01:00
960a0b892c Fix T84101: Duplicate operator not available for some data-block selectors
In some operators that previously allowed duplicating the selected data-block,
the operator would not be available now. 2250b5cefe split the "new" operators
into "new" and "delete" to allow clearly differentiating between the two. But I
apparently didn't amend all affected data-block selectors to use the added
"duplicate" operators.
I went over all operators that were split now and made sure all affected
data-block selectors are updated.
2020-12-27 15:55:58 +01:00
e56fe47748 Fix crash when saving render from temporarily maximized render window
Steps to reproduce were:
* Start with factory defaults
* Set "Render in" to "Maximized Area"
* Render
* Open "Save as"
* Click Cancel

Mistake in  78d2ce19c4. Was using the wrong area pointer, which I think
didn't make a difference in most cases, but here it did.
2020-12-27 15:11:26 +01:00
7916c59304 UI: Grammar: "Clean Up" vs "Cleanup" in operator name
"Cleanup" is a noun while "Clean Up" is the verb.
2020-12-26 16:50:44 -06:00
8491e4ab86 Fix unreported: Cycles CLI device override doesn't set peer memory usage flag
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9929
2020-12-25 23:13:03 +01:00
Nicholas Rishel
565ea3df60 Simplification of Wintab event handling.
Previously Wintab packets were added to a local queue to be processed
during Win32 mouse events, in order to correlate Wintab to Win32
mouse buttons. Wintab packets before Win32 mouse down events were
expired on a timer.

This commit drives mouse events during Wintab events when a device is
in range. When a Wintab button is found it is dispatched if an
equivalent event can be popped from the Win32 event queue. If a Win32
mouse button event is not associated with a Wintab event, it falls
through to WM_BUTTON handling. All Wintab packets are handled as they
are received.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D9908
2020-12-24 16:41:19 -08:00
Yevgeny Makarov
af316d2761 UI: Cleanup spelling of compound words
Approximately 138 changes in the spelling of compound words
and proper names like "Light Probe", "Shrink/Fatten", "Face Map".
In many cases, hyphens were used where they aren't correct, like
"re-fit". Other common changes include:
 - "Datablock" -> "data-block"
 - "Floating point" -> "floating-point"
 - "Ngons" -> "n-gons"

These changes help give the language used in the interface
a consistent, more professional feel.

Differential Revision: https://developer.blender.org/D9923
2020-12-24 13:11:22 -06:00
Yevgeny Makarov
2917f550ca Cleanup: Fix capitalization in various UI strings
Approximately 195 changes of capitalization to conform to MLA title style.
UI labels and property names should use MLA title case, while descriptions
should be capitalized like regular prose, generally with only the start of
a sentence capitalized.

Differential Revision: https://developer.blender.org/D9922
2020-12-24 11:07:32 -06:00
fe440a92e9 Cleanup: compiler warning 2020-12-24 14:19:21 +01:00
29cd99e7fd Cycles: remove surface area computation for meshes with OSL
This is relatively expensive and as per the OSL spec, this value is not
expected to be meaningful for non-light shaders. This makes viewport updates
a little faster.

As a side effect also fixes T82723, viewport refresh issue with volume density.
2020-12-24 13:53:33 +01:00
c4f8aedbc2 Fix T84016: Cycles baking crash with OptiX after recent changes
This worked for CPU + GPU, but not GPU only.
2020-12-24 12:59:35 +01:00
2221389d6e Bake: vertex color baking support for Cycles
In the Bake > Output panel, there is now a choice between Image Textures and
Vertex Colors. The active vertex color layer is used for baking. This works
with both existing per-corner and sculpt per-vertex vertex colors.
2020-12-24 12:40:48 +01:00
0b4fae7a51 Cleanup: refactoring of bake code in preparation of vertex color baking
Split of internal/external image bake target code off into smaller functions and
refactor associated data structures for clarity. Designed so that a vertex color
bake target is easy to fit in.

Also avoid passing in a huge number of arguments into the main baking function,
pass a struct instead.
2020-12-24 12:00:58 +01:00
58c697a9ec Audaspace: port accuracy improvement from upstream. 2020-12-24 10:42:16 +01:00
83ad35cb9c Fix T83997: Duplicated audio does not sound the same
The issue was that sounds were always faded from 0 volume when they
started and depending on the currently used buffer size, the fading took
longer or shorter.

The solution stores whether the sound has ever been played back and
consequently does not fade when starting to play back.
2020-12-24 10:42:16 +01:00
c9efb54240 Cleanup: Clang format 2020-12-23 12:13:44 -06:00
d8dc4c5b32 Geometry Nodes: new Rotate Points node
This node updates the "rotation" attribute on points.
Multiple ways to specify the rotation are supported.

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

Ref T83668.
2020-12-23 16:37:47 +01:00
8a9dedf829 Workaround T84084: Assert/crash when undoing from Sculpt mode to Object one.
Disclaimer: This workaround avoids crashing with current state of the
code and is only committed as temporary band-aid until we can assess the
full issue and decide if/how it needs to be adressed.
2020-12-23 16:03:42 +01:00
d29a720c45 Fix T84002: Sculpt: Masking operations crash if multires is in play.
This fixes the main issue there (essentially a followup to
rB90e12e823ff0: Fix T81854: crash when undoing switch between sculpt and
edit mode).

We basically remove more (hopefully all the remaining!) modifications of
orig mesh from `sculpt_update_object`, as those done here will not be
immediately available in the evaluated data (that specific bug happened
because masking data was added to orig mesh there, but not flushed to
depsgraph evaluated one).

This also goes towards a better separation between handling of evaluated
data and orig one.

Note that modification of orig mesh data can still happen, e.g. values
in some cdlayers, but at least all pointers should now be valid in the
evaluated mesh.

There are still some issues, e.g. we now get an assert/crash in
`multires_reshape_assign_final_coords_from_ccg` when undoing out of the
Sculpt mode, presumably because subdiv_ccg data remains unchanged then
(and hence still has the `has_mask` flag set), while actual mesh data do
not have that cdlayer anymore...

This commit also cleans up/simplifies some code,
`ED_object_sculptmode_enter_ex` was (indirectly) calling
`BKE_sculpt_face_sets_ensure_from_base_mesh_visibility` twice e.g.
2020-12-23 16:03:42 +01:00
9d04fa39d1 Fix T84063: crash reading pointer properties in Attribute shader node
Path resolving can find e.g. a datablock rather than a float or integer,
treat that as a failure to find a valid property.
2020-12-23 15:50:31 +01:00
635694c0ff Fluid: Added new viscosity solver
Mainly updated the Mantaflow version. It includes the new viscosity solver plugin based on the method from 'Accurate Viscous Free Surfaces for Buckling, Coiling, and Rotating Liquids' (Batty & Bridson).

In the UI, this update adds a new 'Viscosity' section to the fluid modifier UI (liquid domains only). For now, there is a single 'strength' value to control the viscosity of liquids.
2020-12-23 15:48:38 +01:00
5cfda8e7f7 Fix crash closing File Browser window after closing temporary render window
This seems to be a longer standing issue. Steps to reproduce were:
* With factory settings, Ctrl+O then F12
* Close the render window using the window close button
* Close the File Browser window using the window close button

This could be OS specific though, at least on macOS this caused a crash.
2020-12-23 15:31:31 +01:00
21cb288029 Fix incorrect debugging text in extra operator icons for buttons 2020-12-23 14:43:40 +01:00
27fcaa6173 Cleanup: Move functions to new ED (editor) operators file & general cleanup
With the new `ed_util_ops.c` introduced in 2250b5cefe, existing code can be
cleaned up to use it.

* Move new ID preview operators to `ed_util_ops.c`
* Move ED operator registration to `ed_util_ops.c`
* Use doxygen sections in `ed_util_ops.c`
* Rename ID related ED operators to use `ED_OT_lib_id_` prefix.
* Remove unused `#include`s
2020-12-23 14:34:24 +01:00
78d2ce19c4 Fix T84013: Crash closing maximized File Browser opened from Preferences
After 1e799dd26e, the logic to recognize a temporary File Browser window
didn't work correctly anymore. It would recognize a maximized File Browser
inside a temporary window as a temporary File Browser window, and attempt to
close this (rather than returning to the previous layout).
The logic there was pretty weak, and still is I think. A more stable solution
would need bigger refactoring.

With this, it's also not possible to maximize or fullscreen an area within a
temporary window (Preferences, File Browser, render window) anymore. Think that
won't make a noticable difference, since you couldn't open multiple areas there
anyway, and the area seems to be maximized already.

Cleaned up the code a bit to not become more confusing with the changes.
2020-12-23 14:34:24 +01:00
9460051c1a Sculpt Undo: Fix broken memory size and potential use of uninitialized variables.
That code looked really like a joke tbh... Random reported memory usage
is not really that important, but the uninitialized items counts was
potentially fairly severe.
2020-12-23 11:17:58 +01:00
b4b888fd2a Cleanup: Reduce Variable scope clip_buttons 2020-12-22 20:13:05 -05:00
8d3d4c8840 Cleanup: Use true and false for booleans 2020-12-22 14:58:57 -06:00
4b46afae09 WM: minor optimization for when there is a large number of notifiers
Don't add the same stats refresh notifiers multiple times, it can be slow to
search the full list of notifiers for duplicates when there are many.

Fundamentally the time complexity in searching for duplicates is still bad.

Inspired by D9901 from Erik Abrahamsson
2020-12-22 19:26:06 +01:00
ac82904c49 UI: keep image open button always visible in image editor datablock selector
Does not need to be hidden in the menu.
2020-12-22 18:18:22 +01:00
00ff3dfb23 Cleanup: Reduce variable scope in object.c 2020-12-22 10:35:18 -06:00
b2edc716c1 Fix Cycles OptiX runtime compilation broken after shader raytracing
Need to pass the appropriate flags as we do for compilation as part of the
CMake build.
2020-12-22 15:08:59 +01:00
dad5aded0c Fix T84006: Cycles AOV not written with some mix shader node set ups 2020-12-22 14:25:50 +01:00
2601501fce RNA: make bpy.data.orphans_purge() return number of deleted datablocks
Sometimes multiple calls to `bpy.data.orphans_purge()` are needed to
delete all orphans, because a call can turn previously-used datablocks
into orphans. Returning the number of deleted datablocks makes it
possible to keep looping until nothing can be deleted any more.

This patch keeps track of deletions in `id_delete()` so that it can be
returned up the call stack.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D9918
2020-12-22 14:05:49 +01:00
512a23c3d6 VSE: handle IO errors when reading disk cache header and version
Respond to return values of `fscanf()` and `fread()` to detect and
handle I/O errors. Not only is error handling a good idea, this also
prevents warnings from GCC that `fread()` and `fscanf()` return values
are ignored.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D9915
2020-12-22 11:43:33 +01:00
0e85d701c6 Animation: Bake Action, improved discontinuity filter for bones
Perform the same filtering as e5528904f1
introduced for object rotations, for bone rotations.
2020-12-22 10:04:21 +01:00
9f34f2b20d VSE: Fix animation versioning for bezier F-curves
`seq_convert_transform_animation()` converted only keyframed value, but
when bezier interpolation is used, posotion of handles was unchanged.
This caused significant difference in animation.

I have checked only linear interpolation when testing versioning originally.
2020-12-22 05:50:34 +01:00
ffacce5be4 UI: Properties editor popover and outliner sync
This adds a popover to the properties editor. Currently the only setting
is for controlling outliner to properties syncing.

Because we cannot define a perfect heuristic to determine when
properties editors should change tabs based on outliner icon selection,
we need an option to enable or disable this behavior per properties
editor.

There are 3 options for controlling the syncing. Auto uses the heuristic
to only allow tab switching when a properties editor and outliner share
a border. On and off enable and disable syncing respectively.

Differential Revision: https://developer.blender.org/D9758
2020-12-21 14:31:32 -07:00
Wayde Moss
2d6e6d035b Nla Refactor: Better blend function parm naming
**Renames parms**:
| **old name** | **new name**
| old_value | lower_value
| target_value | blended_value
| value | strip_value
| inf | influence

**Reason**: {D8296} allows full nla stack evaluation with proper
keyframing support. These names should make it more intuitive how all
the data gets processed and inverted. Note, that I do use the term
"strip_value" instead of something like "fcurve_value" of the tweak
strip. Technically, "strip_value" is closer to what is solved for.
For example, if a noise fmodifier was active for the fcurve, then the
remapping would appear to be wrong. In the future, further solving can
be done afterward, outside of the nla system, to remove the effects of
fmodifiers.

**Renames functions**:
| nla_invert_blend_value | nla_blend_get_inverted_strip_value
| nla_invert_combine_value | nla_combine_get_inverted_strip_value

**Reason**: D8296 adds get_inverted_lower_value() variants,
so "invert" alone is too vague.

**Renames NlaKeyframingContext member**:
| nla_channels | lower_eval_data

**Reason**: D8296 evaluates the upper stack. This name makes it more
obvious what data is stored there.

No functional changes (relative to the dependency below)
Split from {D9247}
Depends on {D9694} since the code was so close to eachother.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D9695
2020-12-21 14:07:16 -05:00
1e2c028a3a Fix/workaround geometry nodes not working with deformation motion blur
Always assume geometry nodes produce potentially animated meshes or point
clouds. In general it is hard to check if geometry nodes are animated, and
for modifiers this was already weak.

The better solution will likely involving checking which geometry was
modified by the depsgraph on frame change, to replace the current mechanism
of manually checking for certain types of modifiers and animation.
2020-12-21 19:19:59 +01:00
36b6ea6cb1 Weight Paint: fix Multi-Paint weight display after rB5502517c3.
Weight Paint Multi-Paint definitely depends on the weight specific
flag, and vertex group locking also involves group name symmetry
via BKE_object_defgroup_mirror_selection. These two are also
features implemented by me so I feel confident.

The rest of object_vgroup.c possibly should be changed too, but
that requires more consideration than these obvious cases.
2020-12-21 20:50:05 +03:00
be71bd8fcc Cleanup: Reduce indentation 2020-12-21 09:43:54 -06:00
Matteo Falduto
985528c9b9 UI: make light spot shape panel consistent between Cycles and Eevee
Differential Revision: https://developer.blender.org/D9906
2020-12-21 14:15:21 +01:00
d2239b685c UI: Use better icon for identifying assets
Use the `ASSET_MANAGER` icon which is more appropriate than the current one
which was just an unused icon that seemed sorta fitting, but was only meant to
be temporary.
The `ASSET_MANAGER` icon is already used for the Asset Browser, so it's being
reused which we normally avoid. So we may still want to create a dedicated one,
maybe a variation of this one.
2020-12-21 13:33:48 +01:00
626a9aae6d Fix part of T84004: Some 2.92 alpha UI strings can't be translated.
Adding 'new' (?) `heading` parameter of some UILayout functions...
2020-12-21 11:50:38 +01:00
5fe24ce295 Fix T84010: Missing scale animation versioning code
Code was removed in 247b10e6a2 but it was incorrect in first place.
Conversion was done for `offset_x` and `offset_y` channel originally,
but it should be done for `scale_x` and `scale_y`
2020-12-21 11:36:39 +01:00
c34ba26856 Fix part of T84004: Some 2.92 alpha UI strings can't be translated.
Not sure why, but py files from `bl_operators` were never considered for
i18n string extraction... They do define some UI strings though.
2020-12-21 11:35:02 +01:00
c9c3bf9833 Some more UI messages fixes... 2020-12-21 10:52:15 +01:00
42e2dd2178 Fix some UI messages and update i18n spellcheck utils. 2020-12-21 10:49:33 +01:00
720b2c6655 install-deps: Install OIIO utils, re-enable package on RPMs.
OIIO utils are mandatory for a whole set of tests (Cycles, VSE), and
it's a small package, no reason to not install it.

Also re-enabling package handling of OIIO on RPM-based distro, not sure
why it was disabled but this has become a fairly stable and standard
library now, would not expect issues anymore.
2020-12-21 09:49:08 +01:00
Matt Hill
fdb7623e09 Unix/macOS: support building with Ccache
This adds an option (WITH_COMPILER_CCACHE) to build using Ccache if it's
found. Makefiles-based, Ninja-based and Xcode generators are supported.

Pass `-DWITH_COMPILER_CCACHE=ON` to cmake to enable Ccache.
Utility option in GNUmakefile is also added: for e.g.,
`make ninja ccache`.

Reviewed By: brecht, ankitm
Differential Revision: https://developer.blender.org/D9665
2020-12-21 10:47:35 +05:30
Garry R. Osgood
84cc00f3b6 Fix T83989: Attribute Math node ignores its operation setting
T83989 observes that the Attribute Math node always adds its
operands regardless of its operator setting. This was caused
by an oversight committed in rB23233fcf056e42, which overlooked
adjusting the exec function to use the new storage location.

Differential Revision: https://developer.blender.org/D9909
2020-12-20 18:46:24 -06:00
c229d9876b Cleanup: Correct comment 2020-12-20 18:42:35 -06:00
d283a093d6 fix T83880: Added check for valid context object to avoid null pointer exception when no object in scene 2020-12-20 18:48:40 +01:00
Yevgeny Makarov
478ba53270 UI: Fix text padding in some list widgets
Normally, pure text buttons have no padding at their edges so they
align with edges of buttons, see D9058. However, in several cases
there are labels aligned to the right side of a list widget row,
so they're missing padding against the right edge.

The fix is to use emboss = 'NONE' for such labels, which changes
the drawing style, adding padding on the right edge. (Normally so
labels aligned with the text from non-embossed buttons). This is
not necessarily intended, but it works properly.

For more information, see the revision.

Differential Revision: https://developer.blender.org/D9874
2020-12-20 11:27:02 -06:00
16527ebaba UI: Slightly improve alignment in selection tool icons
Parts of the tool icons for box, circle, lasso, and tweak select that were
meant to be flat or at a 45 degree angle were slightly misaligned, making
the edge look blurry.
2020-12-20 10:53:23 -06:00
Peter Fog
5a69f70751 VSE: Add options to select neighboring handles
Options added to `sequencer.select_handles()` operator.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D7707
2020-12-20 06:23:08 +01:00
Yevgeny Makarov
864c806863 UI: Reorder enums in render results image editor header
The convention is to put the label at the bottom of the enum, or in the
spot furthest away from the button. This commit reorders the items in
the "Slot", "Layer", and "Pass" menus to be consistent with this
convention. It also reorders the numbering so that higher numbers are
lower.

The original patch was by Adrian Newton (@TFS), with slight changes
and additions.

Differential Revision: https://developer.blender.org/D7142
2020-12-19 21:52:45 -06:00
38b77ef8b2 VSE: Remove cost calculation from cache
This value was meant to be used for keeping images that are slowest to
render in cache. Method of measurement was flawed, because it doesn't
take UI overhead into consideration.

Cache panel is to be removed because users should not have to tweak
settings like this. It is not useful for development either, therefore
it is removed completely.
2020-12-20 03:58:38 +01:00
c4ff91aab7 VSE: Fix incorrect cache memory usage calculation
If image is cached twice, it's size has been counted twice as well, but
only image reference count is increased, not memory usage.

Use `MEM_get_memory_in_use()` instead of size own tracking.
2020-12-20 03:51:56 +01:00
Aaron Carlisle
0144b70948 Movie Clip: Annotation UI Improvements
Previously, the Annotation panels were a bit buggy in the movie clip editor.
This commit fixes the issue of the panel in the sidebar would disappear
when selecting  "Tracks" if no tracks were added to the clip.
To solve this issue the user if given a label text saying "No annotation source"

This commit also removes some grease pencil operators from the toolbar
that do not work with the new annotation system.

This commit also moves the data source choice from the toolbar to the sidebar.
This is needed to migrate the current toolbar to the new tool system
(see T83612)

Some old invalid code was also removed.

Reviewed By: #grease_pencil, antoniov

Differential Revision: https://developer.blender.org/D9729
2020-12-19 14:49:38 -05:00
Aaron Carlisle
6538f1e600 Compositor: New Exposure Node
This new node increases the radiance of an image by a scalar value.
Previously, the only way to adjust the the exposure of an image was with
math node or using the scene's color management.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D9677
2020-12-19 14:41:14 -05:00
09be4a0917 Cleanup: Use typedef for UI emboss type enum
Previously both `char` and `int` were used to represent this enum.

Differential Revision: https://developer.blender.org/D9903
2020-12-19 10:07:20 -06:00
a5a302bd18 Cleanup: Split SEQ_sequencer.h file 2020-12-19 07:25:01 +01:00
046ca0749a Cleanup: Rename BKE_sequencer functions
API functions get SEQ_ prefix.
Intern functions get seq_ prefix

Functions also have appropriate category included in name.
2020-12-19 06:29:15 +01:00
6942dd9f49 Fix T83868: Button animation states no longer visible without emboss
This bug was caused by making it so that non-embossed modifier icon
buttons could become an operator button and retain their red highlight
for disabled modifiers. The icon button needs emboss turned off, but
in earlier versions of Blender, `UI_EMBOSS_NONE` would be overridden
by animation or red alert states.

Instead of abusing "NONE" to mean "none unless there is animation or
red alert", this commit adds a new emboss flag for that situation,
`UI_EMBOSS_NONE_OR_STATUS`, which uses no emboss unless there is an
animation state, or another status. There are only a few situations
where this is necessary, so the change isn't too big.

Differential Revision: https://developer.blender.org/D9902
2020-12-18 17:13:15 -06:00
002722bb80 Fix build error after previous commit
I tested building so many times while making this patch, but somehow
the previous commit was missing a padding variable, I have no idea how.
2020-12-18 17:08:49 -06:00
c106b07e23 Cleanup: Remove unused variables from the bNode struct
In some cases the variables were set but never used anywhere.

Differential Revision: https://developer.blender.org/D9889
2020-12-18 17:04:52 -06:00
6367bc716a Cleanup: Use true and false for booleans 2020-12-18 15:12:15 -06:00
e298339289 Cleanup: Declare variables where initialized
Also decrease scope of some variable declarations.
2020-12-18 12:39:50 -06:00
6be9747b96 Cleanup: Use bool instead of int 2020-12-18 12:12:32 -06:00
2250b5cefe UI: Redesigned data-block selectors
The previous design is rather old and has a couple of problems:

* Scalability: The current solution of adding little icon buttons next to the
  data-block name field doesn't scale well. It only works if there's a small
  number of operations. We need to be able to place more items there for better
  data-block management. Especially with the introduction of library overrides.
* Discoverability: It's not obvious what some of the icons do. They appear and
  disappear, but it's not obvious why some are available at times and others
  not.
* Unclear Status: Currently their library status (linked, indirectly linked,
  broken link, library override) isn't really clear.
* Unusual behavior: Some of the icon buttons allow Shift or Ctrl clicking to
  invoke alternative behaviors. This is not a usual pattern in Blender.

This patch does the following changes:

* Adds a menu to the right of the name button to access all kinds of operations
  (create, delete, unlink, user management, library overrides, etc).
* Make good use of the "disabled hint" for tooltips, to explain why buttons are
  disabled. The UI team wants to establish this as a good practise.
* Use superimposed icons for duplicate and unlink, rather than extra buttons
  (uses less space, looks less distracting and is a nice + consistent design
  language).
* Remove fake user and user count button, they are available from the menu now.
* Support tooltips for superimposed icons (committed mouse hover feedback to
  master already).
* Slightly increase size of the name button - it was already a bit small
  before, and the move from real buttons to superimposed icons reduces usable
  space for the name itself.
* More clearly differentiate between duplicate and creating a new data-block.
  The latter is only available in the menu.
* Display library status icon on the left (linked, missing library, overridden,
  asset)
* Disables "Make Single User" button - in review we weren't sure if there are
  good use-cases for it, so better to see if we can remove it.

Note that I do expect some aspects of this design to change still. I think some
changes are problematic, but others disagreed. I will open a feedback thread on
devtalk to see what others think.

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

Reviewed by: Bastien Montagne

Design discussed and agreed on with the UI team, also see T79959.
2020-12-18 18:28:04 +01:00
7bee1489c1 UI: Rename "Float Color" attribute data type to "Color"
Since "Float Color" is more commonly used than "Byte Color",
which is not exposed in the interface yet anyway, it makes sense to
drop the "Float" label on the color data type name.
2020-12-18 09:34:21 -06:00
3deb21055a Geometry Nodes: support randomly picking instances from collection
This uses the "id" attribute to randomly pick instances from a collection
for each point.

There is one issue. When the collection is updated (e.g. when an object is
added to it), the nodes modifier is not automatically updated. It seems
like we don't have the infrastructure to support this dependency yet.
The same issue exists in the Boolean modifier and with collision collections.
This should be solved separately soonish.

When "Whole Collection" is disabled, one direct child of the input collection
is instanced at each point. A direct child can be an object or a collection.

Currently, all objects are picked approximately equally often. In the future,
we will provide more control over which point gets which instance.

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

Ref T82372.
2020-12-18 16:02:23 +01:00
1be465cccb GPencil: Fix potential error in interpolate frame
As now it is using a duplicated frame, the untag must be done before copying the frames.
2020-12-18 15:57:19 +01:00
f3b50380f0 Fix T83916: Cannot drag link from socket if node is inside frame
Caused by rB7470c10601d0 where iterating nodetree nodes was changed from
backwards to forwards by mistake.

Maniphest Tasks: T83916

Differential Revision: https://developer.blender.org/D9890
2020-12-18 14:41:38 +01:00
Vincent Blankfield
95afc53604 Fix T83716: Dope Sheet, incorrect scaling of channel UI elements
Change the top coordinate of the animation channel list UI elements to
`rect->ymin` so they correctly span from `rect->ymin` to
`channel_height`.

Some buttons in the dope sheet channels didn't scale properly with the
`Keyframe Scale Factor` preferences setting. This was caused by using
the `ymid` value (`ymid = BLI_rctf_cent_y(rect) - 0.5f * ICON_WIDTH`) to
position the buttons that supposed to fill all vertical space in the
channel (with `channel_height` height). The `ymid` value is only
appropriate for the UI elements that with `ICON_WIDTH` height.

Maniphest Tasks: T83716

Reviewed by: sybren

Differential Revision: https://developer.blender.org/D9841
2020-12-18 14:13:52 +01:00
e5764013b0 Geometry Nodes: move Boolean node to mesh category
This node works on meshes specifically.
2020-12-18 13:33:24 +01:00
c5569ba140 Geometry Nodes: do not crash when there are undefined nodes
Undefined geometry nodes will just output a default value now.
2020-12-18 13:28:55 +01:00
79d6bd9a22 Functions: add generic pointer class for const pointers
This adds a GPointer class, which is mostly the same as GMutablePointer.
The main difference is that GPointer references const data, while GMutablePointer
references non-const data.
2020-12-18 13:28:55 +01:00
f43561eae6 Function Nodes: Input Vector
Ref: T82651

Normally people use "Combine XYZ" to input a vector, but it is more
interesting to have an explicit vector input.

So this is basically "Combine XYZ" without any input sockets, the values
are stored in the node itself.

Differential Revision: https://developer.blender.org/D9885
2020-12-18 13:03:27 +01:00
b342e089c3 Fix mistake in Bake Action discontinuity fix
Fix mistake in e5528904f1 where one change accidentally wasn't included
in the commit.
2020-12-18 13:02:28 +01:00
e5528904f1 Fix T83351: Baked object rotation has discontinuities
Fix Euler discontinuities in the Bake Action operator, by explicitly
using the previous Euler angles when converting from matrix to rotation.

This basically follows the same approach as used in e4ca1fc4ea, although
the Euler Discontinuity Filter also performs single-channel filtering which
the Bake Action operator doesn't.
2020-12-18 12:50:36 +01:00
fe5d2448c6 Fix T83494: Eevee clamp node incorrect when min > max.
In glsl the clamp function has undefined behavior when min > max. For
the clamp node this resulted in differences between cycles and eevee.
This patch adds the expected implementation for minmax.

The old clamp function is still used in cases where we know for certain
that the input values are correct (math node clamp option). GPU uses
optimized code and silicon in these cases.
2020-12-18 10:26:02 +01:00
ffb6648a97 Fix T83625: Shading attribute names cause compilation error.
Some GPU platforms don't support having more than one underscore in
sequence in an attribute name. This change will remove the underscore
as a possible character when encoding to save names.
2020-12-18 09:56:28 +01:00
4f9e21bdc9 Fix T82591: Performance regression when rendering at very high resolution
This patch introduces a partial update of GPUTexture. When rendering
a large image the GPUTexture could have been scaled. The old implementation
would rescale the image on CPU and create a new GPUTexture. This
resulted in flooding the PCI bus.

The new solution would only scale and upload the parts of the GPUTexture
that has been changed. It does this by keeping track of areas of 256x256
pixels. When something changes the tiles that cover that changes will be
rescaled and uploaded the next time the GPUTexture is requested.

Test situation: Default Cube, 4 samples, 19200x10800 tile size 512.

Blender 2.83.9: 4m27s.
Blender 2.91:   20+m (regression)
This patch:     1m01s.

There is still room for more optimizations:
* Reduce the time that an image is locked.
** Use task scheduling to update the tiles of an image.
** Generic optimization of the ImBuf scale method.

Maniphest Tasks: T82591

Differential Revision: https://developer.blender.org/D9591
2020-12-18 09:18:44 +01:00
095b693614 Outliner: Set active modifier on click
The outliner already expands the panel for the modifier you click on,
this just extends that idea to also set it active, which is consistent
with behavior of active and selected items elsewhere in Blender.
2020-12-17 23:35:05 -06:00
9dbc014af7 Cleanup: Various clang tidy warnings
There are more in the new mesh fairing code and in the poisson
distribution code, this commit doesn't fix those.
2020-12-17 22:53:47 -06:00
7d25139eaf Fix T82960: Inaccurate selection on collapsed outliner rows
After rB15083d9e1 the outliner tree is not rebuilt after expanding or
collapsing rows. Because the tree is no longer rebuilt the positions
and flags of the elements are not cleared when collapsing a row. This
caused hover highlights and selections on the collapsed child icons to
be incorrect in many cases.

For example, only the direct children of a collapsed element are drawn
inline. If any grandchild elements had been previously icon row flagged
they would continue to be evaluated as icon row elements despite being
hidden. In this case the x coordinates of the child and grandchild would
overlap causing selection to appear erratic.

Now the flags for inline row icons are explicitly cleared, which was
previously only done because the tree was rebuilt on collapsing rows.
2020-12-17 20:10:20 -07:00
7cbcfb7f49 Cleanup: Use LISTBASE_FOREACH macro in outliner code
No functional changes.
2020-12-17 19:59:49 -07:00
f880fe2d66 Fix T82288 Wintab walk navigation erratic.
Walk navigation relies on tablet data being set to detect if motion is
absolute. This patch sets tablet data in Ghost to dummy values when a
tablet pen is in range and not handled by Wintab processing.
2020-12-17 17:21:15 -08:00
Yevgeny Makarov
ef17fb2715 UI: Don't use abbreviations in label text
Expand abbreviations for words like "Bright" (instead of "Brightness"),
"Premul", "Lib", "Dir", etc.

Differential Revision: https://developer.blender.org/D9862
2020-12-17 19:06:21 -06:00
23233fcf05 Cleanup: Use abstraction for attribute math node input
Since creating the attribute node, a helper function has been added to
automatically get the input attribute or a constant value, depending on
the "input type" values for the node. This commit replaces the specific
implementation of that behavior with the new helper function.

The versioning is necessary since the node now has a "storage" struct.
2020-12-17 14:43:01 -06:00
b10d8e330e Cleanup: renaming and code deduplication for color space clarity in picker
Ref T68926
2020-12-17 20:08:58 +01:00
f193b1afb3 Color Management: use scene linear HSV for number buttons in color pickers
Previously these HSV values were in the color picking space, which meant the
relation to the scene linear RGB values was confusing.

The new situation:
* RGB number buttons: scene linear color space
* HSV number buttons: scene linear color space
* Picker widgets: color picking color space
* Hex: sRGB color space

Fixes T69562, T83853, Ref T68926
2020-12-17 20:08:58 +01:00
48ddb94a26 Geometry Nodes: Point separate and attribute compare nodes
This patch adds two related nodes, a node for separating points
and mesh vertices based on a boolean attribute input, and a node
for creating boolean attributes with comparisons.

See the differential for an example file and video.

Point Separate (T83059)
The output in both geometries is just point data, contained in the mesh
and point cloud components, depending which components had data in the
input geometry. Any points with the mask attribute set to true will be
moved from the first geometry output to the second. This means that
for meshes, all edge and face data will be removed. Any point domain
attributes are moved to the correct output geometry as well.

Attribute Compare (T83057)
The attribute compare does the "Equal" and "Not Equal" operations by
comparing vectors and colors based on their distance from each other.
For other operations, the comparison is between the lengths of the
vector inputs. In general, the highest complexity data type is used
for the operation, and a new function to determine that is added.

Differential Revision: https://developer.blender.org/D9876
2020-12-17 12:22:47 -06:00
Himanshi Kalra
e7b698327c Updated and extended Regression Testing frameworks (Gsoc 2020)
This revision contains the following changes-

  - Updated the existing testing framework for Modifiers for Regression
  Testing.
  - Tests for Physics modifiers and remaining Generate and Deform modifiers are added.
  - The existing `ModifierSpec` is updated with backward compatibility to support Physics Modifiers.
  - Now there is support for frame number and giving nested parameters for attributes.
  - Some Deform modifiers required Object Operators, e.g. "Bind" in Mesh Deform, so a new class was added to support that functionality.
  - A separate class for holding Particles System, they are tested by converting all the particles to mesh and joining it to the mesh they were added.
  - Updated the format to add tests for Bevel, Boolean and Operators as
  well.

Reviewed By: zazizizou, mont29, campbellbarton

Differential Revision: https://developer.blender.org/D8507
2020-12-17 20:58:20 +05:30
fed995ced5 Fix T83888: Ctrl F in Asset Browser crashes blender
In case of being in Asset browsing mode, the search field is located in
the header (RGN_TYPE_HEADER not RGN_TYPE_UI as for file browsing mode).
To be future proof, now iterate all regions and act if the
"filter_search" can be activated.

Maniphest Tasks: T83888

Differential Revision: https://developer.blender.org/D9882
2020-12-17 16:05:20 +01:00
1361 changed files with 37273 additions and 16900 deletions

View File

@@ -10,8 +10,9 @@
# 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.
# - Several commits should be added to this list at once, because adding
# one extra commit (to edit this file) after every cleanup is noisy.
# - No clang-tidy changes.
#
# Note:
# - The comment above the SHA should be the first line of the commit.
@@ -92,78 +93,12 @@ c42a6b77b52560d257279de2cb624b4ef2c0d24c
# Cleanup: use doxy sections for imbuf
c207f7c22e1439e0b285fba5d2c072bdae23f981
# Cleanup: Clang-Tidy, modernize-use-bool-literals
af35ada2f3fa8da4d46b3a71de724d353d716820
# Cleanup: Use nullptr everywhere in fluid code
311031ecd03dbfbf43e1df672a395f24b2e7d4d3
# Cleanup: Clang-Tidy, modernize-redundant-void-arg
a331d5c99299c4514ca33c843b1c79b872f2728d
# Cleanup: Clang-Tidy modernize-use-nullptr
16732def37c5a66f3ea28dbe247b09cc6bca6677
# Cleanup: Clang-tidy, modernize-concat-nested-namespaces
4525049aa0cf818f6483dce589ac9791eb562338
# Cleanup: Clang-tidy else-after-return
ae342ed4511cf2e144dcd27ce2c635d3d536f9ad
# Cleanup: Clang-Tidy, readability-redundant-member-init
190170d4cc92ff34abe1744a10474ac4f1074086
# Cleanup: use 'filepath' instead of 'name' for ImBuf utilities
99f56b4c16323f96c0cbf54e392fb509fcac5bda
# Cleanup: clang-format
c4d8f6a4a8ddc29ed27311ed7578b3c8c31399d2
b5d310b569e07a937798a2d38539cfd290149f1c
8c846cccd6bdfd3e90a695fabbf05f53e5466a57
40d4a4cb1a6b4c3c2a486e8f2868f547530e0811
4eac03d821fa17546f562485f7d073813a5e5943
1166110a9d66af9c5a47cee2be591f50fdc445e8
# Cleanup: use preprocessor version check for PyTypeObject declaration
cd9acfed4f7674b84be965d469a367aef96f8af3
# Cycles: fix compilation of OSL shaders following API change
b980cd163a9d5d77eeffc2e353333e739fa9e719
# Cleanup: clang-tidy suppress warnings for PyTypeObject.tp_print
efd71aad4f22ec0073d80b8dd296015d3f395aa8
# Cleanup: fix wrong merge, remove extra unique_ptr.
6507449e54a167c63a72229e4d0119dd2af68ae5
# Cleanup: fix some clang tidy issues
525a042c5c7513c41240b118acca002f6c60cc12
# Fix T82520: error building freestyle with Python3.8
e118426e4695a97d67e65d69677f3c4e2db50a56
# Cleanup: Clang-tidy, readability-else-after-return
7be47dadea5066ae095c644e0b4f1f10d75f5ab3
# Cleanup: Add `r_` to return parameter
45dca05b1cd2a5ead59144c93d790fdfe7c35ee6
# Cleanup: Typo in `print_default_info` function name.
41a73909dec716642f044e60b40a28335c9fdb10
# Cleanup: Reduce indentation
1cc3a0e2cf73a5ff4f9e0a7f5338eda77266b300
# Build-system: Force C linkage for all DNA type headers
ad4b7741dba45a2be210942c18af6b6e4438f129
# Cleanup: Move function to proper section
c126e27cdc8b28365a9d5f9fafc4d521d1eb83df
# Cleanup: remove break after return statements
bbdfeb751e16d939482d2e4b95c4d470f53f18a5
# Cleanup: clang-tidy
af013ff76feef7e8b8ba642279c62a5dc275d59f
# Cleanup: Make panel type flag names more clear
9d28353b525ecfbcca1501be72e4276dfb2bbc2a
# Cleanup: clang-format.
40d4a4cb1a6b4c3c2a486e8f2868f547530e0811

View File

@@ -205,6 +205,7 @@ option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if
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 rendering on the GPU" ON)
option(WITH_HARU "Enable features relying on Libharu (Grease pencil PDF export)" ON)
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
@@ -610,6 +611,11 @@ if(WIN32)
endif()
if(UNIX)
# See WITH_WINDOWS_SCCACHE for Windows.
option(WITH_COMPILER_CCACHE "Use ccache to improve rebuild times (Works with Ninja, Makefiles and Xcode)" OFF)
endif()
# The following only works with the Ninja generator in CMake >= 3.0.
if("${CMAKE_GENERATOR}" MATCHES "Ninja")
option(WITH_NINJA_POOL_JOBS
@@ -725,6 +731,9 @@ set_and_warn_dependency(WITH_OPENVDB WITH_NANOVDB OFF)
# OpenVDB uses 'half' type from OpenEXR & fails to link without OpenEXR enabled.
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENVDB OFF)
# Haru needs `TIFFFaxBlackCodes` & `TIFFFaxWhiteCodes` symbols from TIFF.
set_and_warn_dependency(WITH_IMAGE_TIFF WITH_HARU OFF)
# auto enable openimageio for cycles
if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
@@ -1758,8 +1767,20 @@ if(WITH_BLENDER)
# internal and external library information first, for test linking
add_subdirectory(source)
elseif(WITH_CYCLES_STANDALONE)
add_subdirectory(intern/glew-mx)
add_subdirectory(intern/guardedalloc)
add_subdirectory(intern/libc_compat)
add_subdirectory(intern/numaapi)
add_subdirectory(intern/sky)
add_subdirectory(intern/cycles)
add_subdirectory(extern/clew)
if(WITH_CYCLES_LOGGING)
if(NOT WITH_SYSTEM_GFLAGS)
add_subdirectory(extern/gflags)
endif()
add_subdirectory(extern/glog)
endif()
if(WITH_CUDA_DYNLOAD)
add_subdirectory(extern/cuew)
endif()
@@ -1768,6 +1789,10 @@ elseif(WITH_CYCLES_STANDALONE)
endif()
endif()
#-----------------------------------------------------------------------------
# Testing
add_subdirectory(tests)
#-----------------------------------------------------------------------------
# Blender Application
if(WITH_BLENDER)
@@ -1775,11 +1800,6 @@ if(WITH_BLENDER)
endif()
#-----------------------------------------------------------------------------
# Testing
add_subdirectory(tests)
#-----------------------------------------------------------------------------
# Define 'heavy' submodules (for Ninja builder when using pools).
setup_heavy_lib_pool()
@@ -1833,6 +1853,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_FFTW3)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_GMP)
info_cfg_option(WITH_HARU)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_INPUT_NDOF)
@@ -1841,6 +1862,8 @@ if(FIRST_RUN)
info_cfg_option(WITH_OPENCOLORIO)
info_cfg_option(WITH_OPENIMAGEDENOISE)
info_cfg_option(WITH_OPENVDB)
info_cfg_option(WITH_POTRACE)
info_cfg_option(WITH_PUGIXML)
info_cfg_option(WITH_QUADRIFLOW)
info_cfg_option(WITH_TBB)
info_cfg_option(WITH_USD)

View File

@@ -41,6 +41,7 @@ Convenience Targets
* developer: Enable faster builds, error checking and tests, recommended for developers.
* config: Run cmake configuration tool to set build options.
* ninja: Use ninja build tool for faster builds.
* ccache: Use ccache for faster rebuilds.
Note: passing the argument 'BUILD_DIR=path' when calling make will override the default build dir.
Note: passing the argument 'BUILD_CMAKE_ARGS=args' lets you add cmake arguments.
@@ -182,8 +183,13 @@ endif
ifndef DEPS_INSTALL_DIR
DEPS_INSTALL_DIR:=$(shell dirname "$(BLENDER_DIR)")/lib/$(OS_NCASE)
ifneq ($(OS_NCASE),darwin)
# Add processor type to directory name
# Add processor type to directory name, except for darwin x86_64
# which by convention does not have it.
ifeq ($(OS_NCASE),darwin)
ifneq ($(CPU),x86_64)
DEPS_INSTALL_DIR:=$(DEPS_INSTALL_DIR)_$(CPU)
endif
else
DEPS_INSTALL_DIR:=$(DEPS_INSTALL_DIR)_$(CPU)
endif
endif
@@ -197,7 +203,7 @@ endif
# in libraries, or python 2 for running make update to get it.
ifeq ($(OS_NCASE),darwin)
ifeq (, $(shell command -v $(PYTHON)))
PYTHON:=../lib/darwin/python/bin/python3.7m
PYTHON:=$(DEPS_INSTALL_DIR)/python/bin/python3.7m
ifeq (, $(shell command -v $(PYTHON)))
PYTHON:=python
endif
@@ -241,6 +247,10 @@ ifneq "$(findstring developer, $(MAKECMDGOALS))" ""
CMAKE_CONFIG_ARGS:=-C"$(BLENDER_DIR)/build_files/cmake/config/blender_developer.cmake" $(CMAKE_CONFIG_ARGS)
endif
ifneq "$(findstring ccache, $(MAKECMDGOALS))" ""
CMAKE_CONFIG_ARGS:=-DWITH_COMPILER_CCACHE=YES $(CMAKE_CONFIG_ARGS)
endif
# -----------------------------------------------------------------------------
# build tool
@@ -340,6 +350,7 @@ headless: all
bpy: all
developer: all
ninja: all
ccache: all
# -----------------------------------------------------------------------------
# Build dependencies
@@ -514,7 +525,7 @@ format: .FORCE
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
doc_py: .FORCE
ASAN_OPTIONS=halt_on_error=0 \
ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \
$(BLENDER_BIN) --background -noaudio --factory-startup \
--python doc/python_api/sphinx_doc_gen.py
sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out

View File

@@ -92,6 +92,7 @@ include(cmake/package_python.cmake)
include(cmake/numpy.cmake)
include(cmake/usd.cmake)
include(cmake/potrace.cmake)
include(cmake/haru.cmake)
# Boost needs to be included after python.cmake due to the PYTHON_BINARY variable being needed.
include(cmake/boost.cmake)
include(cmake/pugixml.cmake)

View File

@@ -0,0 +1,46 @@
# ***** 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(HARU_EXTRA_ARGS
-DLIBHPDF_SHARED=OFF
-DLIBHPDF_STATIC=ON
-DLIBHPDF_EXAMPLES=OFF
-DLIBHPDF_ENABLE_EXCEPTIONS=ON
)
ExternalProject_Add(external_haru
URL ${HARU_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${HARU_HASH}
PREFIX ${BUILD_DIR}/haru
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/haru/src/external_haru < ${PATCH_DIR}/haru.diff
CMAKE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${LIBDIR}/haru
${DEFAULT_CMAKE_FLAGS} ${HARU_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/haru
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_haru after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/haru/include ${HARVEST_TARGET}/haru/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/haru/lib/libhpdfs.lib ${HARVEST_TARGET}/haru/lib/libhpdfs.lib
DEPENDEES install
)
endif()
endif()

View File

@@ -187,6 +187,8 @@ harvest(usd/lib/usd usd/lib/usd "*")
harvest(usd/plugin usd/plugin "*")
harvest(potrace/include potrace/include "*.h")
harvest(potrace/lib potrace/lib "*.a")
harvest(haru/include haru/include "*.h")
harvest(haru/lib haru/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*.so*")

View File

@@ -42,7 +42,7 @@ if(UNIX)
-DSQLITE_MAX_VARIABLE_NUMBER=250000 \
-fPIC")
set(SQLITE_CONFIGURE_ENV ${SQLITE_CONFIGURE_ENV} && export LDFLAGS=${SQLITE_LDFLAGS} && export CFLAGS=${SQLITE_CFLAGS})
set(SQLITE_CONFIGURATION_ARGS ${SQLITE_CONFIGURATION_ARGS} --enable-threadsafe --enable-load-extension --enable-json1 --enable-fts4 --enable-fts5
set(SQLITE_CONFIGURATION_ARGS ${SQLITE_CONFIGURATION_ARGS} --enable-threadsafe --enable-load-extension --enable-json1 --enable-fts4 --enable-fts5 --disable-tcl
--enable-shared=no)
endif()

View File

@@ -331,3 +331,7 @@ set(GMP_HASH a325e3f09e6d91e62101e59f9bda3ec1)
set(POTRACE_VERSION 1.16)
set(POTRACE_URI http://potrace.sourceforge.net/download/${POTRACE_VERSION}/potrace-${POTRACE_VERSION}.tar.gz)
set(POTRACE_HASH 5f0bd87ddd9a620b0c4e65652ef93d69)
set(HARU_VERSION 2_3_0)
set(HARU_URI https://github.com/libharu/libharu/archive/RELEASE_${HARU_VERSION}.tar.gz)
set(HARU_HASH 4f916aa49c3069b3a10850013c507460)

View File

@@ -385,25 +385,25 @@ USE_CXX11=true
CLANG_FORMAT_VERSION_MIN="6.0"
CLANG_FORMAT_VERSION_MAX="10.0"
PYTHON_VERSION="3.7.7"
PYTHON_VERSION_SHORT="3.7"
PYTHON_VERSION="3.9.1"
PYTHON_VERSION_SHORT="3.9"
PYTHON_VERSION_MIN="3.7"
PYTHON_VERSION_MAX="3.9"
PYTHON_VERSION_MAX="3.10"
PYTHON_VERSION_INSTALLED=$PYTHON_VERSION_MIN
PYTHON_FORCE_BUILD=false
PYTHON_FORCE_REBUILD=false
PYTHON_SKIP=false
NUMPY_VERSION="1.17.5"
NUMPY_VERSION_SHORT="1.17"
NUMPY_VERSION="1.19.5"
NUMPY_VERSION_SHORT="1.19"
NUMPY_VERSION_MIN="1.8"
NUMPY_VERSION_MAX="2.0"
NUMPY_FORCE_BUILD=false
NUMPY_FORCE_REBUILD=false
NUMPY_SKIP=false
BOOST_VERSION="1.70.0"
BOOST_VERSION_SHORT="1.70"
BOOST_VERSION="1.73.0"
BOOST_VERSION_SHORT="1.73"
BOOST_VERSION_MIN="1.49"
BOOST_VERSION_MAX="2.0"
BOOST_FORCE_BUILD=false
@@ -439,7 +439,7 @@ _with_built_openexr=false
OIIO_VERSION="2.1.15.0"
OIIO_VERSION_SHORT="2.1"
OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MAX="3.0"
OIIO_VERSION_MAX="2.2.10"
OIIO_FORCE_BUILD=false
OIIO_FORCE_REBUILD=false
OIIO_SKIP=false
@@ -483,7 +483,7 @@ OPENVDB_FORCE_REBUILD=false
OPENVDB_SKIP=false
# Alembic needs to be compiled for now
ALEMBIC_VERSION="1.7.12"
ALEMBIC_VERSION="1.7.16"
ALEMBIC_VERSION_SHORT="1.7"
ALEMBIC_VERSION_MIN="1.7"
ALEMBIC_VERSION_MAX="2.0"
@@ -2064,7 +2064,6 @@ compile_OIIO() {
cmake_d="$cmake_d -D CMAKE_PREFIX_PATH=$_inst"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
cmake_d="$cmake_d -D BUILDSTATIC=OFF"
cmake_d="$cmake_d -D LINKSTATIC=OFF"
cmake_d="$cmake_d -D USE_SIMD=sse2"
@@ -2086,7 +2085,7 @@ compile_OIIO() {
cmake_d="$cmake_d -D USE_OPENCV=OFF"
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TESTS=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_TOOLS=ON"
cmake_d="$cmake_d -D TXT2MAN="
#cmake_d="$cmake_d -D CMAKE_EXPORT_COMPILE_COMMANDS=ON"
#cmake_d="$cmake_d -D CMAKE_VERBOSE_MAKEFILE=ON"
@@ -2099,9 +2098,6 @@ compile_OIIO() {
# if [ -d $INST/ocio ]; then
# cmake_d="$cmake_d -D OCIO_PATH=$INST/ocio"
# fi
cmake_d="$cmake_d -D USE_OCIO=OFF"
cmake_d="$cmake_d -D OIIO_BUILD_CPP11=ON"
if file /bin/cp | grep -q '32-bit'; then
cflags="-fPIC -m32 -march=i686"
@@ -4072,7 +4068,7 @@ install_DEB() {
else
check_package_version_ge_lt_DEB libopenimageio-dev $OIIO_VERSION_MIN $OIIO_VERSION_MAX
if [ $? -eq 0 -a "$_with_built_openexr" = false ]; then
install_packages_DEB libopenimageio-dev
install_packages_DEB libopenimageio-dev openimageio-tools
clean_OIIO
else
compile_OIIO
@@ -4714,13 +4710,13 @@ install_RPM() {
INFO "Forced OpenImageIO building, as requested..."
compile_OIIO
else
#check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
#if [ $? -eq 0 -a $_with_built_openexr == false ]; then
# install_packages_RPM OpenImageIO-devel
# clean_OIIO
#else
check_package_version_ge_lt_RPM OpenImageIO-devel $OIIO_VERSION_MIN $OIIO_VERSION_MAX
if [ $? -eq 0 -a $_with_built_openexr == false ]; then
install_packages_RPM OpenImageIO-devel OpenImageIO-utils
clean_OIIO
else
compile_OIIO
#fi
fi
fi

View File

@@ -0,0 +1,12 @@
diff --git a/src/hpdf_image_ccitt.c b/src/hpdf_image_ccitt.c
index 8672763..9be531a 100644
--- a/src/hpdf_image_ccitt.c
+++ b/src/hpdf_image_ccitt.c
@@ -21,7 +21,6 @@
#include <memory.h>
#include <assert.h>
-#define G3CODES
#include "t4.h"
typedef unsigned int uint32;

View File

@@ -88,7 +88,6 @@ class VersionInfo:
self.short_version = "%d.%02d" % (version_numbers[0], version_numbers[1])
self.version = "%d.%02d.%d" % version_numbers
self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE')
self.version_cycle_number = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE_NUMBER')
self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]
if self.version_cycle == "release":
@@ -97,8 +96,7 @@ class VersionInfo:
self.is_development_build = False
elif self.version_cycle == "rc":
# Release candidate
version_cycle = self.version_cycle + self.version_cycle_number
self.full_version = self.version + version_cycle
self.full_version = self.version + self.version_cycle
self.is_development_build = False
else:
# Development build

View File

@@ -42,7 +42,7 @@ def get_cmake_options(builder):
elif builder.platform == 'linux':
config_file = "build_files/buildbot/config/blender_linux.cmake"
optix_sdk_dir = os.path.join(builder.blender_dir, '..', '..', 'NVIDIA-Optix-SDK')
optix_sdk_dir = os.path.join(builder.blender_dir, '..', '..', 'NVIDIA-Optix-SDK-7.1')
options.append('-DOPTIX_ROOT_DIR:PATH=' + optix_sdk_dir)
# Workaround to build sm_30 kernels with CUDA 10, since CUDA 11 no longer supports that architecture

View File

@@ -34,6 +34,8 @@ set(_clang_tidy_SEARCH_DIRS
# TODO(sergey): Find more reliable way of finding the latest clang-tidy.
find_program(CLANG_TIDY_EXECUTABLE
NAMES
clang-tidy-12
clang-tidy-11
clang-tidy-10
clang-tidy-9
clang-tidy-8

View File

@@ -0,0 +1,64 @@
# - Find HARU library
# Find the native Haru includes and library
# This module defines
# HARU_INCLUDE_DIRS, where to find hpdf.h, set when
# HARU_INCLUDE_DIR is found.
# HARU_LIBRARIES, libraries to link against to use Haru.
# HARU_ROOT_DIR, The base directory to search for Haru.
# This can also be an environment variable.
# HARU_FOUND, If false, do not try to use Haru.
#
# also defined, but not for general use are
# HARU_LIBRARY, where to find the Haru library.
#=============================================================================
# Copyright 2021 Blender Foundation.
#
# Distributed under the OSI-approved BSD 3-Clause License,
# see accompanying file BSD-3-Clause-license.txt for details.
#=============================================================================
# If HARU_ROOT_DIR was defined in the environment, use it.
if(NOT HARU_ROOT_DIR AND NOT $ENV{HARU_ROOT_DIR} STREQUAL "")
set(HARU_ROOT_DIR $ENV{HARU_ROOT_DIR})
endif()
set(_haru_SEARCH_DIRS
${HARU_ROOT_DIR}
/opt/lib/haru
)
find_path(HARU_INCLUDE_DIR
NAMES
hpdf.h
HINTS
${_haru_SEARCH_DIRS}
PATH_SUFFIXES
include/haru
)
find_library(HARU_LIBRARY
NAMES
hpdfs
HINTS
${_haru_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# Handle the QUIETLY and REQUIRED arguments and set HARU_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Haru DEFAULT_MSG HARU_LIBRARY HARU_INCLUDE_DIR)
if(HARU_FOUND)
set(HARU_LIBRARIES ${HARU_LIBRARY})
set(HARU_INCLUDE_DIRS ${HARU_INCLUDE_DIR})
endif()
mark_as_advanced(
HARU_INCLUDE_DIR
HARU_LIBRARY
)
unset(_haru_SEARCH_DIRS)

View File

@@ -330,6 +330,9 @@ function(gtest_add_tests)
set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*")
set(gtest_test_type_regex "(TYPED_TEST|TEST_?[FP]?)")
# This will get a filter for each test suite.
set(test_filters "")
foreach(source IN LISTS ARGS_SOURCES)
if(NOT ARGS_SKIP_DEPENDENCY)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${source})
@@ -376,175 +379,32 @@ function(gtest_add_tests)
list(APPEND testList ${ctest_test_name})
endif()
else()
set(ctest_test_name ${ARGS_TEST_PREFIX}${gtest_test_name}${ARGS_TEST_SUFFIX})
add_test(NAME ${ctest_test_name}
${workDir}
COMMAND ${ARGS_TARGET}
--gtest_filter=${gtest_test_name}
${ARGS_EXTRA_ARGS}
)
list(APPEND testList ${ctest_test_name})
# BLENDER: collect tests named "suite.testcase" as list of "suite.*" filters.
string(REGEX REPLACE "\\..*$" "" gtest_suite_name ${gtest_test_name})
list(APPEND test_filters "${gtest_suite_name}.*")
endif()
endforeach()
endforeach()
# Join all found GTest suite names into one big filter.
list(REMOVE_DUPLICATES test_filters)
list(JOIN test_filters ":" gtest_filter)
add_test(NAME ${ARGS_TEST_PREFIX}
${workDir}
COMMAND ${ARGS_TARGET}
--gtest_filter=${gtest_filter}
${ARGS_EXTRA_ARGS}
)
list(APPEND testList ${ARGS_TEST_PREFIX})
if(ARGS_TEST_LIST)
set(${ARGS_TEST_LIST} ${testList} PARENT_SCOPE)
endif()
endfunction()
#------------------------------------------------------------------------------
function(gtest_discover_tests TARGET)
cmake_parse_arguments(
""
"NO_PRETTY_TYPES;NO_PRETTY_VALUES"
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;DISCOVERY_TIMEOUT;XML_OUTPUT_DIR;DISCOVERY_MODE"
"EXTRA_ARGS;PROPERTIES"
${ARGN}
)
if(NOT _WORKING_DIRECTORY)
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
if(NOT _TEST_LIST)
set(_TEST_LIST ${TARGET}_TESTS)
endif()
if(NOT _DISCOVERY_TIMEOUT)
set(_DISCOVERY_TIMEOUT 5)
endif()
if(NOT _DISCOVERY_MODE)
if(NOT CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE)
set(CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE "POST_BUILD")
endif()
set(_DISCOVERY_MODE ${CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE})
endif()
get_property(
has_counter
TARGET ${TARGET}
PROPERTY CTEST_DISCOVERED_TEST_COUNTER
SET
)
if(has_counter)
get_property(
counter
TARGET ${TARGET}
PROPERTY CTEST_DISCOVERED_TEST_COUNTER
)
math(EXPR counter "${counter} + 1")
else()
set(counter 1)
endif()
set_property(
TARGET ${TARGET}
PROPERTY CTEST_DISCOVERED_TEST_COUNTER
${counter}
)
# Define rule to generate test list for aforementioned test executable
# Blender: use _ instead of [] to avoid problems with zsh regex.
set(ctest_file_base "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_${counter}_")
set(ctest_include_file "${ctest_file_base}_include.cmake")
set(ctest_tests_file "${ctest_file_base}_tests.cmake")
get_property(crosscompiling_emulator
TARGET ${TARGET}
PROPERTY CROSSCOMPILING_EMULATOR
)
if(_DISCOVERY_MODE STREQUAL "POST_BUILD")
add_custom_command(
TARGET ${TARGET} POST_BUILD
BYPRODUCTS "${ctest_tests_file}"
COMMAND "${CMAKE_COMMAND}"
-D "TEST_TARGET=${TARGET}"
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
-D "TEST_PROPERTIES=${_PROPERTIES}"
-D "TEST_PREFIX=${_TEST_PREFIX}"
-D "TEST_SUFFIX=${_TEST_SUFFIX}"
-D "NO_PRETTY_TYPES=${_NO_PRETTY_TYPES}"
-D "NO_PRETTY_VALUES=${_NO_PRETTY_VALUES}"
-D "TEST_LIST=${_TEST_LIST}"
-D "CTEST_FILE=${ctest_tests_file}"
-D "TEST_DISCOVERY_TIMEOUT=${_DISCOVERY_TIMEOUT}"
-D "TEST_XML_OUTPUT_DIR=${_XML_OUTPUT_DIR}"
-P "${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}"
VERBATIM
)
file(WRITE "${ctest_include_file}"
"if(EXISTS \"${ctest_tests_file}\")\n"
" include(\"${ctest_tests_file}\")\n"
"else()\n"
" add_test(${TARGET}_NOT_BUILT ${TARGET}_NOT_BUILT)\n"
"endif()\n"
)
elseif(_DISCOVERY_MODE STREQUAL "PRE_TEST")
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL
PROPERTY GENERATOR_IS_MULTI_CONFIG
)
if(GENERATOR_IS_MULTI_CONFIG)
set(ctest_tests_file "${ctest_file_base}_tests-$<CONFIG>.cmake")
endif()
string(CONCAT ctest_include_content
"if(EXISTS \"$<TARGET_FILE:${TARGET}>\")" "\n"
" if(\"$<TARGET_FILE:${TARGET}>\" IS_NEWER_THAN \"${ctest_tests_file}\")" "\n"
" include(\"${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}\")" "\n"
" gtest_discover_tests_impl(" "\n"
" TEST_EXECUTABLE" " [==[" "$<TARGET_FILE:${TARGET}>" "]==]" "\n"
" TEST_EXECUTOR" " [==[" "${crosscompiling_emulator}" "]==]" "\n"
" TEST_WORKING_DIR" " [==[" "${_WORKING_DIRECTORY}" "]==]" "\n"
" TEST_EXTRA_ARGS" " [==[" "${_EXTRA_ARGS}" "]==]" "\n"
" TEST_PROPERTIES" " [==[" "${_PROPERTIES}" "]==]" "\n"
" TEST_PREFIX" " [==[" "${_TEST_PREFIX}" "]==]" "\n"
" TEST_SUFFIX" " [==[" "${_TEST_SUFFIX}" "]==]" "\n"
" NO_PRETTY_TYPES" " [==[" "${_NO_PRETTY_TYPES}" "]==]" "\n"
" NO_PRETTY_VALUES" " [==[" "${_NO_PRETTY_VALUES}" "]==]" "\n"
" TEST_LIST" " [==[" "${_TEST_LIST}" "]==]" "\n"
" CTEST_FILE" " [==[" "${ctest_tests_file}" "]==]" "\n"
" TEST_DISCOVERY_TIMEOUT" " [==[" "${_DISCOVERY_TIMEOUT}" "]==]" "\n"
" TEST_XML_OUTPUT_DIR" " [==[" "${_XML_OUTPUT_DIR}" "]==]" "\n"
" )" "\n"
" endif()" "\n"
" include(\"${ctest_tests_file}\")" "\n"
"else()" "\n"
" add_test(${TARGET}_NOT_BUILT ${TARGET}_NOT_BUILT)" "\n"
"endif()" "\n"
)
if(GENERATOR_IS_MULTI_CONFIG)
foreach(_config ${CMAKE_CONFIGURATION_TYPES})
file(GENERATE OUTPUT "${ctest_file_base}_include-${_config}.cmake" CONTENT "${ctest_include_content}" CONDITION $<CONFIG:${_config}>)
endforeach()
file(WRITE "${ctest_include_file}" "include(\"${ctest_file_base}_include-\${CTEST_CONFIGURATION_TYPE}.cmake\")")
else()
file(GENERATE OUTPUT "${ctest_file_base}_include.cmake" CONTENT "${ctest_include_content}")
file(WRITE "${ctest_include_file}" "include(\"${ctest_file_base}_include.cmake\")")
endif()
else()
message(FATAL_ERROR "Unknown DISCOVERY_MODE: ${_DISCOVERY_MODE}")
endif()
# Add discovered tests to directory TEST_INCLUDE_FILES
set_property(DIRECTORY
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
)
endfunction()
###############################################################################
set(_GOOGLETEST_DISCOVER_TESTS_SCRIPT
${CMAKE_CURRENT_LIST_DIR}/GTestAddTests.cmake
)
# BLENDER: remove the discovery function gtest_discover_tests(). It's not used,
# as it generates too many test invocations.
# Restore project's policies
cmake_policy(POP)

View File

@@ -1,194 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License,
# see accompanying file BSD-3-Clause-license.txt for details.
# Changes made to this script have been marked with "BLENDER".
# BLENDER: disable ASAN leak detection when trying to discover tests.
set(ENV{ASAN_OPTIONS} "detect_leaks=0")
cmake_minimum_required(VERSION ${CMAKE_VERSION})
# Overwrite possibly existing ${_CTEST_FILE} with empty file
set(flush_tests_MODE WRITE)
# Flushes script to ${_CTEST_FILE}
macro(flush_script)
file(${flush_tests_MODE} "${_CTEST_FILE}" "${script}")
set(flush_tests_MODE APPEND)
set(script "")
endmacro()
# Flushes tests_buffer to tests
macro(flush_tests_buffer)
list(APPEND tests "${tests_buffer}")
set(tests_buffer "")
endmacro()
macro(add_command NAME)
set(_args "")
foreach(_arg ${ARGN})
if(_arg MATCHES "[^-./:a-zA-Z0-9_]")
string(APPEND _args " [==[${_arg}]==]")
else()
string(APPEND _args " ${_arg}")
endif()
endforeach()
string(APPEND script "${NAME}(${_args})\n")
string(LENGTH "${script}" _script_len)
if(${_script_len} GREATER "50000")
flush_script()
endif()
# Unsets macro local variables to prevent leakage outside of this macro.
unset(_args)
unset(_script_len)
endmacro()
function(gtest_discover_tests_impl)
cmake_parse_arguments(
""
""
"NO_PRETTY_TYPES;NO_PRETTY_VALUES;TEST_EXECUTABLE;TEST_EXECUTOR;TEST_WORKING_DIR;TEST_PREFIX;TEST_SUFFIX;TEST_LIST;CTEST_FILE;TEST_DISCOVERY_TIMEOUT;TEST_XML_OUTPUT_DIR"
"TEST_EXTRA_ARGS;TEST_PROPERTIES"
${ARGN}
)
set(prefix "${_TEST_PREFIX}")
set(suffix "${_TEST_SUFFIX}")
set(extra_args ${_TEST_EXTRA_ARGS})
set(properties ${_TEST_PROPERTIES})
set(script)
set(suite)
set(tests)
set(tests_buffer)
# Run test executable to get list of available tests
if(NOT EXISTS "${_TEST_EXECUTABLE}")
message(FATAL_ERROR
"Specified test executable does not exist.\n"
" Path: '${_TEST_EXECUTABLE}'"
)
endif()
execute_process(
COMMAND ${_TEST_EXECUTOR} "${_TEST_EXECUTABLE}" --gtest_list_tests
WORKING_DIRECTORY "${_TEST_WORKING_DIR}"
TIMEOUT ${_TEST_DISCOVERY_TIMEOUT}
OUTPUT_VARIABLE output
RESULT_VARIABLE result
)
if(NOT ${result} EQUAL 0)
string(REPLACE "\n" "\n " output "${output}")
message(FATAL_ERROR
"Error running test executable.\n"
" Path: '${_TEST_EXECUTABLE}'\n"
" Result: ${result}\n"
" Output:\n"
" ${output}\n"
)
endif()
# Preserve semicolon in test-parameters
string(REPLACE [[;]] [[\;]] output "${output}")
string(REPLACE "\n" ";" output "${output}")
# Parse output
foreach(line ${output})
# Skip header
if(NOT line MATCHES "gtest_main\\.cc")
# Do we have a module name or a test name?
if(NOT line MATCHES "^ ")
# Module; remove trailing '.' to get just the name...
string(REGEX REPLACE "\\.( *#.*)?" "" suite "${line}")
if(line MATCHES "#" AND NOT _NO_PRETTY_TYPES)
string(REGEX REPLACE "/[0-9]\\.+ +#.*= +" "/" pretty_suite "${line}")
else()
set(pretty_suite "${suite}")
endif()
string(REGEX REPLACE "^DISABLED_" "" pretty_suite "${pretty_suite}")
else()
# Test name; strip spaces and comments to get just the name...
string(REGEX REPLACE " +" "" test "${line}")
if(test MATCHES "#" AND NOT _NO_PRETTY_VALUES)
string(REGEX REPLACE "/[0-9]+#GetParam..=" "/" pretty_test "${test}")
else()
string(REGEX REPLACE "#.*" "" pretty_test "${test}")
endif()
string(REGEX REPLACE "^DISABLED_" "" pretty_test "${pretty_test}")
string(REGEX REPLACE "#.*" "" test "${test}")
if(NOT "${_TEST_XML_OUTPUT_DIR}" STREQUAL "")
set(TEST_XML_OUTPUT_PARAM "--gtest_output=xml:${_TEST_XML_OUTPUT_DIR}/${prefix}${suite}.${test}${suffix}.xml")
else()
unset(TEST_XML_OUTPUT_PARAM)
endif()
# sanitize test name for further processing downstream
set(testname "${prefix}${pretty_suite}.${pretty_test}${suffix}")
# escape \
string(REPLACE [[\]] [[\\]] testname "${testname}")
# escape ;
string(REPLACE [[;]] [[\;]] testname "${testname}")
# escape $
string(REPLACE [[$]] [[\$]] testname "${testname}")
# ...and add to script
add_command(add_test
"${testname}"
${_TEST_EXECUTOR}
"${_TEST_EXECUTABLE}"
"--gtest_filter=${suite}.${test}"
"--gtest_also_run_disabled_tests"
${TEST_XML_OUTPUT_PARAM}
${extra_args}
)
if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED")
add_command(set_tests_properties
"${testname}"
PROPERTIES DISABLED TRUE
)
endif()
add_command(set_tests_properties
"${testname}"
PROPERTIES
WORKING_DIRECTORY "${_TEST_WORKING_DIR}"
SKIP_REGULAR_EXPRESSION "\\\\[ SKIPPED \\\\]"
${properties}
)
list(APPEND tests_buffer "${testname}")
list(LENGTH tests_buffer tests_buffer_length)
if(${tests_buffer_length} GREATER "250")
flush_tests_buffer()
endif()
endif()
endif()
endforeach()
# Create a list of all discovered tests, which users may use to e.g. set
# properties on the tests
flush_tests_buffer()
add_command(set ${_TEST_LIST} ${tests})
# Write CTest script
flush_script()
endfunction()
if(CMAKE_SCRIPT_MODE_FILE)
gtest_discover_tests_impl(
NO_PRETTY_TYPES ${NO_PRETTY_TYPES}
NO_PRETTY_VALUES ${NO_PRETTY_VALUES}
TEST_EXECUTABLE ${TEST_EXECUTABLE}
TEST_EXECUTOR ${TEST_EXECUTOR}
TEST_WORKING_DIR ${TEST_WORKING_DIR}
TEST_PREFIX ${TEST_PREFIX}
TEST_SUFFIX ${TEST_SUFFIX}
TEST_LIST ${TEST_LIST}
CTEST_FILE ${CTEST_FILE}
TEST_DISCOVERY_TIMEOUT ${TEST_DISCOVERY_TIMEOUT}
TEST_XML_OUTPUT_DIR ${TEST_XML_OUTPUT_DIR}
TEST_EXTRA_ARGS ${TEST_EXTRA_ARGS}
TEST_PROPERTIES ${TEST_PROPERTIES}
)
endif()

View File

@@ -8,6 +8,17 @@
#
#=============================================================================
function(GET_BLENDER_TEST_INSTALL_DIR VARIABLE_NAME)
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(GENERATOR_IS_MULTI_CONFIG)
string(REPLACE "\${BUILD_TYPE}" "$<CONFIG>" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
else()
string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
endif()
set(${VARIABLE_NAME} "${TEST_INSTALL_DIR}" PARENT_SCOPE)
endfunction()
macro(BLENDER_SRC_GTEST_EX)
if(WITH_GTESTS)
set(options SKIP_ADD_TEST)
@@ -75,13 +86,7 @@ macro(BLENDER_SRC_GTEST_EX)
target_link_libraries(${TARGET_NAME} ${GMP_LIBRARIES})
endif()
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(GENERATOR_IS_MULTI_CONFIG)
string(REPLACE "\${BUILD_TYPE}" "$<CONFIG>" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
else()
string(REPLACE "\${BUILD_TYPE}" "" TEST_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
endif()
GET_BLENDER_TEST_INSTALL_DIR(TEST_INSTALL_DIR)
set_target_properties(${TARGET_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}"
@@ -94,7 +99,9 @@ macro(BLENDER_SRC_GTEST_EX)
# Don't fail tests on leaks since these often happen in external libraries
# that we can't fix.
set_tests_properties(${TARGET_NAME} PROPERTIES ENVIRONMENT LSAN_OPTIONS=exitcode=0)
set_tests_properties(${TARGET_NAME} PROPERTIES
ENVIRONMENT LSAN_OPTIONS=exitcode=0:$ENV{LSAN_OPTIONS}
)
endif()
if(WIN32)
set_target_properties(${TARGET_NAME} PROPERTIES VS_GLOBAL_VcpkgEnabled "false")

View File

@@ -13,7 +13,7 @@ Invocation:
export CLANG_BIND_DIR="/dsk/src/llvm/tools/clang/bindings/python"
export CLANG_LIB_DIR="/opt/llvm/lib"
python2 clang_array_check.py somefile.c -DSOME_DEFINE -I/some/include
python clang_array_check.py somefile.c -DSOME_DEFINE -I/some/include
... defines and includes are optional
@@ -76,6 +76,32 @@ defs_precalc = {
"glNormal3bv": {0: 3},
"glNormal3iv": {0: 3},
"glNormal3sv": {0: 3},
# GPU immediate mode.
"immVertex2iv": {1: 2},
"immVertex2fv": {1: 2},
"immVertex3fv": {1: 3},
"immAttr2fv": {1: 2},
"immAttr3fv": {1: 3},
"immAttr4fv": {1: 4},
"immAttr3ubv": {1: 3},
"immAttr4ubv": {1: 4},
"immUniform2fv": {1: 2},
"immUniform3fv": {1: 3},
"immUniform4fv": {1: 4},
"immUniformColor3fv": {0: 3},
"immUniformColor4fv": {0: 4},
"immUniformColor3ubv": {1: 3},
"immUniformColor4ubv": {1: 4},
"immUniformColor3fvAlpha": {0: 3},
"immUniformColor4fvAlpha": {0: 4},
}
# -----------------------------------------------------------------------------
@@ -100,7 +126,8 @@ else:
if CLANG_LIB_DIR is None:
print("$CLANG_LIB_DIR clang lib dir not set")
sys.path.append(CLANG_BIND_DIR)
if CLANG_BIND_DIR:
sys.path.append(CLANG_BIND_DIR)
import clang
import clang.cindex
@@ -108,7 +135,8 @@ from clang.cindex import (CursorKind,
TypeKind,
TokenKind)
clang.cindex.Config.set_library_path(CLANG_LIB_DIR)
if CLANG_LIB_DIR:
clang.cindex.Config.set_library_path(CLANG_LIB_DIR)
index = clang.cindex.Index.create()

View File

@@ -20,6 +20,8 @@
# <pep8 compliant>
# Note: this code should be cleaned up / refactored.
import sys
if sys.version_info.major < 3:
print("\nPython3.x needed, found %s.\nAborting!\n" %
@@ -37,12 +39,23 @@ from cmake_consistency_check_config import (
import os
from os.path import join, dirname, normpath, splitext
from os.path import (
dirname,
join,
normpath,
splitext,
)
global_h = set()
global_c = set()
global_refs = {}
# Flatten `IGNORE_SOURCE_MISSING` to avoid nested looping.
IGNORE_SOURCE_MISSING = [
(k, ignore_path) for k, ig_list in IGNORE_SOURCE_MISSING
for ignore_path in ig_list
]
# Ignore cmake file, path pairs.
global_ignore_source_missing = {}
for k, v in IGNORE_SOURCE_MISSING:
@@ -178,6 +191,8 @@ def cmake_get_src(f):
if not l:
pass
elif l in local_ignore_source_missing:
local_ignore_source_missing.remove(l)
elif l.startswith("$"):
if context_name == "SRC":
# assume if it ends with context_name we know about it
@@ -227,10 +242,7 @@ def cmake_get_src(f):
# replace_line(f, i - 1, new_path_rel)
else:
if l in local_ignore_source_missing:
local_ignore_source_missing.remove(l)
else:
raise Exception("non existent include %s:%d -> %s" % (f, i, new_file))
raise Exception("non existent include %s:%d -> %s" % (f, i, new_file))
# print(new_file)
@@ -258,16 +270,16 @@ def cmake_get_src(f):
def is_ignore_source(f, ignore_used):
for index, ig in enumerate(IGNORE_SOURCE):
if ig in f:
for index, ignore_path in enumerate(IGNORE_SOURCE):
if ignore_path in f:
ignore_used[index] = True
return True
return False
def is_ignore_cmake(f, ignore_used):
for index, ig in enumerate(IGNORE_CMAKE):
if ig in f:
for index, ignore_path in enumerate(IGNORE_CMAKE):
if ignore_path in f:
ignore_used[index] = True
return True
return False
@@ -298,7 +310,7 @@ def main():
for cf, i in refs:
errs.append((cf, i))
else:
raise Exception("CMake referenecs missing, internal error, aborting!")
raise Exception("CMake references missing, internal error, aborting!")
is_err = True
errs.sort()
@@ -309,7 +321,7 @@ def main():
# print("sed '%dd' '%s' > '%s.tmp' ; mv '%s.tmp' '%s'" % (i, cf, cf, cf, cf))
if is_err:
raise Exception("CMake referenecs missing files, aborting!")
raise Exception("CMake references missing files, aborting!")
del is_err
del errs
@@ -320,7 +332,7 @@ def main():
if cf not in global_c:
print("missing_c: ", cf)
# check if automake builds a corrasponding .o file.
# Check if automake builds a corresponding .o file.
'''
if cf in global_c:
out1 = os.path.splitext(cf)[0] + ".o"
@@ -356,21 +368,21 @@ def main():
# Check ignores aren't stale
print("\nCheck for unused 'IGNORE_SOURCE' paths...")
for index, ig in enumerate(IGNORE_SOURCE):
for index, ignore_path in enumerate(IGNORE_SOURCE):
if not ignore_used_source[index]:
print("unused ignore: %r" % ig)
print("unused ignore: %r" % ignore_path)
# Check ignores aren't stale
print("\nCheck for unused 'IGNORE_SOURCE_MISSING' paths...")
for k, v in sorted(global_ignore_source_missing.items()):
for ig in v:
print("unused ignore: %r -> %r" % (ig, k))
for ignore_path in v:
print("unused ignore: %r -> %r" % (ignore_path, k))
# Check ignores aren't stale
print("\nCheck for unused 'IGNORE_CMAKE' paths...")
for index, ig in enumerate(IGNORE_CMAKE):
for index, ignore_path in enumerate(IGNORE_CMAKE):
if not ignore_used_cmake[index]:
print("unused ignore: %r" % ig)
print("unused ignore: %r" % ignore_path)
if __name__ == "__main__":

View File

@@ -34,8 +34,18 @@ IGNORE_SOURCE = (
# Ignore cmake file, path pairs.
IGNORE_SOURCE_MISSING = (
# Use for cycles stand-alone.
("intern/cycles/util/CMakeLists.txt", "../../third_party/numaapi/include"),
( # Use for cycles stand-alone.
"intern/cycles/util/CMakeLists.txt", (
"../../third_party/numaapi/include",
)),
( # Use for `WITH_NANOVDB`.
"intern/cycles/kernel/CMakeLists.txt", (
"nanovdb/util/CSampleFromVoxels.h",
"nanovdb/util/SampleFromVoxels.h",
"nanovdb/NanoVDB.h",
"nanovdb/CNanoVDB.h",
),
),
)
IGNORE_CMAKE = (

View File

@@ -32,7 +32,7 @@ CHECKER_IGNORE_PREFIX = [
"intern/moto",
]
CHECKER_BIN = "python2"
CHECKER_BIN = "python3"
CHECKER_ARGS = [
os.path.join(os.path.dirname(__file__), "clang_array_check.py"),

View File

@@ -19,6 +19,7 @@ set(WITH_DRACO ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
set(WITH_GMP ON CACHE BOOL "" FORCE)
set(WITH_HARU ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
@@ -44,6 +45,8 @@ set(WITH_OPENMP ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
set(WITH_POTRACE ON CACHE BOOL "" FORCE)
set(WITH_PUGIXML ON CACHE BOOL "" FORCE)
set(WITH_NANOVDB ON CACHE BOOL "" FORCE)
set(WITH_POTRACE ON CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL ON CACHE BOOL "" FORCE)

View File

@@ -24,6 +24,7 @@ set(WITH_DRACO OFF CACHE BOOL "" FORCE)
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE)
set(WITH_GMP OFF CACHE BOOL "" FORCE)
set(WITH_HARU OFF CACHE BOOL "" FORCE)
set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER OFF CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE)
@@ -51,6 +52,8 @@ set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)
set(WITH_POTRACE OFF CACHE BOOL "" FORCE)
set(WITH_PUGIXML OFF CACHE BOOL "" FORCE)
set(WITH_NANOVDB OFF CACHE BOOL "" FORCE)
set(WITH_QUADRIFLOW OFF CACHE BOOL "" FORCE)
set(WITH_SDL OFF CACHE BOOL "" FORCE)

View File

@@ -20,6 +20,7 @@ set(WITH_DRACO ON CACHE BOOL "" FORCE)
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
set(WITH_GMP ON CACHE BOOL "" FORCE)
set(WITH_HARU ON CACHE BOOL "" FORCE)
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
@@ -45,6 +46,8 @@ set(WITH_OPENMP ON CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
set(WITH_POTRACE ON CACHE BOOL "" FORCE)
set(WITH_PUGIXML ON CACHE BOOL "" FORCE)
set(WITH_NANOVDB ON CACHE BOOL "" FORCE)
set(WITH_POTRACE ON CACHE BOOL "" FORCE)
set(WITH_PYTHON_INSTALL ON CACHE BOOL "" FORCE)

View File

@@ -388,6 +388,43 @@ function(blender_add_lib
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
endfunction()
function(blender_add_test_suite)
if (ARGC LESS 1)
message(FATAL_ERROR "No arguments supplied to blender_add_test_suite()")
endif()
# Parse the arguments
set(oneValueArgs TARGET SUITE_NAME)
set(multiValueArgs SOURCES)
cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# Figure out the release dir, as some tests need files from there.
GET_BLENDER_TEST_INSTALL_DIR(TEST_INSTALL_DIR)
if(APPLE)
set(_test_release_dir ${TEST_INSTALL_DIR}/Blender.app/Contents/Resources/${BLENDER_VERSION})
else()
if(WIN32 OR WITH_INSTALL_PORTABLE)
set(_test_release_dir ${TEST_INSTALL_DIR}/${BLENDER_VERSION})
else()
set(_test_release_dir ${TEST_INSTALL_DIR}/share/blender/${BLENDER_VERSION})
endif()
endif()
# Define a test case with our custom gtest_add_tests() command.
include(GTest)
gtest_add_tests(
TARGET ${ARGS_TARGET}
SOURCES "${ARGS_SOURCES}"
TEST_PREFIX ${ARGS_SUITE_NAME}
WORKING_DIRECTORY "${TEST_INSTALL_DIR}"
EXTRA_ARGS
--test-assets-dir "${CMAKE_SOURCE_DIR}/../lib/tests"
--test-release-dir "${_test_release_dir}"
)
unset(_test_release_dir)
endfunction()
# Add tests for a Blender library, to be called in tandem with blender_add_lib().
# The tests will be part of the blender_test executable (see tests/gtests/runner).
function(blender_add_test_lib
@@ -421,6 +458,12 @@ function(blender_add_test_lib
blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${library_deps}")
set_property(GLOBAL APPEND PROPERTY BLENDER_TEST_LIBS ${name})
blender_add_test_suite(
TARGET blender_test
SUITE_NAME ${name}
SOURCES "${sources}"
)
endfunction()
@@ -454,14 +497,10 @@ function(blender_add_test_executable
SKIP_ADD_TEST
)
include(GTest)
set(_GOOGLETEST_DISCOVER_TESTS_SCRIPT
${CMAKE_SOURCE_DIR}/build_files/cmake/Modules/GTestAddTests.cmake
)
gtest_discover_tests(${name}_test
DISCOVERY_MODE PRE_TEST
WORKING_DIRECTORY "${TEST_INSTALL_DIR}"
blender_add_test_suite(
TARGET ${name}_test
SUITE_NAME ${name}
SOURCES "${sources}"
)
endfunction()
@@ -1192,7 +1231,7 @@ function(find_python_package
set(WITH_PYTHON_INSTALL_${_upper_package} OFF PARENT_SCOPE)
else()
message(STATUS "${package} found at '${PYTHON_${_upper_package}_PATH}'")
if(NOT "${relative_include_dir}" STREQUAL "")
set(_relative_include_dir "${package}/${relative_include_dir}")
unset(PYTHON_${_upper_package}_INCLUDE_DIRS CACHE)

View File

@@ -72,7 +72,11 @@ if(WITH_JACK)
endif()
if(NOT DEFINED LIBDIR)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
else()
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin_${CMAKE_OSX_ARCHITECTURES})
endif()
else()
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
endif()
@@ -428,6 +432,14 @@ if(WITH_GMP)
endif()
endif()
if(WITH_HARU)
find_package(Haru)
if(NOT HARU_FOUND)
message(WARNING "Haru not found, disabling WITH_HARU")
set(WITH_HARU OFF)
endif()
endif()
if(EXISTS ${LIBDIR})
without_system_libs_end()
endif()
@@ -470,3 +482,17 @@ set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
if(WITH_COMPILER_CCACHE)
if(NOT CMAKE_GENERATOR STREQUAL "Xcode")
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
# Makefiles and ninja
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
else()
message(WARNING "Ccache NOT found, disabling WITH_COMPILER_CCACHE")
set(WITH_COMPILER_CCACHE OFF)
endif()
endif()
endif()

View File

@@ -154,3 +154,32 @@ if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
string(APPEND CMAKE_CXX_FLAGS " -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
if(WITH_COMPILER_CCACHE)
if(CMAKE_GENERATOR STREQUAL "Xcode")
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
get_filename_component(ccompiler "${CMAKE_C_COMPILER}" NAME)
get_filename_component(cxxcompiler "${CMAKE_CXX_COMPILER}" NAME)
# Ccache can figure out which compiler to use if it's invoked from
# a symlink with the name of the compiler.
# https://ccache.dev/manual/4.1.html#_run_modes
set(_fake_compiler_dir "${CMAKE_BINARY_DIR}/ccache")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_fake_compiler_dir})
set(_fake_C_COMPILER "${_fake_compiler_dir}/${ccompiler}")
set(_fake_CXX_COMPILER "${_fake_compiler_dir}/${cxxcompiler}")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CCACHE_PROGRAM}" ${_fake_C_COMPILER})
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${CCACHE_PROGRAM}" ${_fake_CXX_COMPILER})
set(CMAKE_XCODE_ATTRIBUTE_CC ${_fake_C_COMPILER} CACHE STRING "" FORCE)
set(CMAKE_XCODE_ATTRIBUTE_CXX ${_fake_CXX_COMPILER} CACHE STRING "" FORCE)
set(CMAKE_XCODE_ATTRIBUTE_LD ${_fake_C_COMPILER} CACHE STRING "" FORCE)
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS ${_fake_CXX_COMPILER} CACHE STRING "" FORCE)
unset(_fake_compiler_dir)
unset(_fake_C_COMPILER)
unset(_fake_CXX_COMPILER)
else()
message(WARNING "Ccache NOT found, disabling WITH_COMPILER_CCACHE")
set(WITH_COMPILER_CCACHE OFF)
endif()
endif()
endif()

View File

@@ -352,6 +352,11 @@ endif()
if(WITH_PUGIXML)
find_package_wrapper(PugiXML)
if (NOT PUGIXML_FOUND)
set(WITH_PUGIXML OFF)
message(STATUS "PugiXML not found, disabling WITH_PUGIXML")
endif()
endif()
if(WITH_OPENIMAGEIO)
@@ -610,7 +615,13 @@ endif()
# GNU Compiler
if(CMAKE_COMPILER_IS_GNUCC)
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
# ffp-contract=off:
# Automatically turned on when building with "-march=native". This is
# explicitly turned off here as it will make floating point math give a bit
# different results. This will lead to automated test failures. So disable
# this until we support it. Seems to default to off in clang and the intel
# compiler.
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -ffp-contract=off")
# `maybe-uninitialized` is unreliable in release builds, but fine in debug builds.
set(GCC_EXTRA_FLAGS_RELEASE "-Wno-maybe-uninitialized")
@@ -684,3 +695,15 @@ set(PLATFORM_LINKFLAGS
if(WITH_INSTALL_PORTABLE)
string(APPEND CMAKE_EXE_LINKER_FLAGS " -no-pie")
endif()
if(WITH_COMPILER_CCACHE)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
# Makefiles and ninja
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "" FORCE)
else()
message(WARNING "Ccache NOT found, disabling WITH_COMPILER_CCACHE")
set(WITH_COMPILER_CCACHE OFF)
endif()
endif()

View File

@@ -800,3 +800,15 @@ if(WITH_POTRACE)
set(POTRACE_LIBRARIES ${LIBDIR}/potrace/lib/potrace.lib)
set(POTRACE_FOUND On)
endif()
if(WITH_HARU)
if(EXISTS ${LIBDIR}/haru)
set(HARU_FOUND On)
set(HARU_ROOT_DIR ${LIBDIR}/haru)
set(HARU_INCLUDE_DIRS ${HARU_ROOT_DIR}/include)
set(HARU_LIBRARIES ${HARU_ROOT_DIR}/lib/libhpdfs.lib)
else()
message(WARNING "Haru was not found, disabling WITH_HARU")
set(WITH_HARU OFF)
endif()
endif()

View File

@@ -8,6 +8,7 @@
import argparse
import os
import platform
import shutil
import sys
@@ -49,7 +50,12 @@ def svn_update(args, release_version):
# Checkout precompiled libraries
if sys.platform == 'darwin':
lib_platform = "darwin"
if platform.machine() == 'x86_64':
lib_platform = "darwin"
elif platform.machine() == 'arm64':
lib_platform = "darwin_arm64"
else:
lib_platform = None
elif sys.platform == 'win32':
# Windows checkout is usually handled by bat scripts since python3 to run
# this script is bundled as part of the precompiled libraries. However it

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = "V2.92"
PROJECT_NUMBER = "V2.93"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@@ -52,10 +52,11 @@ outfilename = sys.argv[2]
cmd = [blender_bin, "--help"]
print(" executing:", " ".join(cmd))
ASAN_OPTIONS = "exitcode=0:" + os.environ.get("ASAN_OPTIONS", "")
blender_help = subprocess.run(
cmd, env={"ASAN_OPTIONS": "exitcode=0"}, check=True, stdout=subprocess.PIPE).stdout.decode(encoding="utf-8")
cmd, env={"ASAN_OPTIONS": ASAN_OPTIONS}, check=True, stdout=subprocess.PIPE).stdout.decode(encoding="utf-8")
blender_version = subprocess.run(
[blender_bin, "--version"], env={"ASAN_OPTIONS": "exitcode=0"}, check=True, stdout=subprocess.PIPE).stdout.decode(encoding="utf-8").strip()
[blender_bin, "--version"], env={"ASAN_OPTIONS": ASAN_OPTIONS}, check=True, stdout=subprocess.PIPE).stdout.decode(encoding="utf-8").strip()
blender_version, blender_date = (blender_version.split("build") + [None, None])[0:2]
blender_version = blender_version.rstrip().partition(" ")[2] # remove 'Blender' prefix.
if blender_date is None:

View File

@@ -163,13 +163,13 @@ Now in the button's context menu select *Copy Data Path*, then paste the result
.. code-block:: python
bpy.context.active_object.modifiers["Subsurf"].levels
bpy.context.active_object.modifiers["Subdivision"].levels
Press :kbd:`Return` and you'll get the current value of 1. Now try changing the value to 2:
.. code-block:: python
bpy.context.active_object.modifiers["Subsurf"].levels = 2
bpy.context.active_object.modifiers["Subdivision"].levels = 2
You can see the value update in the Subdivision Surface modifier's UI as well as the cube.
@@ -185,43 +185,31 @@ For example, if you want to access the texture of a brush via Python to adjust i
#. Start in the default scene and enable Sculpt Mode from the 3D Viewport header.
#. From the Sidebar expand the Brush Settings panel's *Texture* subpanel and add a new texture.
*Notice the texture data-block menu itself doesn't have very useful links (you can check the tooltips).*
#. The contrast setting isn't exposed in the Sidebar, so view the texture in the properties editor:
- In the properties editor select the Texture tab.
- Select brush texture.
- Expand the *Colors* panel to locate the *Contrast* number field.
#. The contrast setting isn't exposed in the Sidebar, so view the texture in the
:ref:`Properties Editor <blender_manual:bpy.types.Texture.contrast`
#. Open the context menu of the contrast field and select *Online Python Reference*.
This takes you to ``bpy.types.Texture.contrast``. Now you can see that ``contrast`` is a property of texture.
#. To find out how to access the texture from the brush check on the references at the bottom of the page.
Sometimes there are many references, and it may take some guesswork to find the right one,
but in this case it's ``Brush.texture``.
but in this case it's ``tool_settings.sculpt.brush.texture``.
#. Now you know that the texture can be accessed from ``bpy.data.brushes["BrushName"].texture``
but normally you *won't* want to access the brush by name, instead you want to access the active brush.
So the next step is to check on where brushes are accessed from via the references.
In this case there it is simply ``bpy.context.brush``.
Now you can use the Python console to form the nested properties needed to access brush textures contrast:
*Context -> Brush -> Texture -> Contrast*.
:menuselection:`Context --> Tool Settings --> Sculpt --> Brush --> Texture --> Contrast`.
Since the attribute for each is given along the way you can compose the data path in the Python console:
.. code-block:: python
bpy.context.brush.texture.contrast
There can be multiple ways to access the same data, which you choose often depends on the task.
An alternate path to access the same setting is:
.. code-block:: python
bpy.context.sculpt.brush.texture.contrast
bpy.context.tool_settings.sculpt.brush.texture.contrast
Or access the brush directly:
.. code-block:: python
bpy.data.brushes["BrushName"].texture.contrast
bpy.data.textures["Texture"].contrast
If you are writing a user tool normally you want to use the :mod:`bpy.context` since the user normally expects

View File

@@ -35,12 +35,13 @@ but not to fully cover each topic.
A quick list of helpful things to know before starting:
- Blender uses Python 3.x; some online documentation still assumes version 2.x.
- The interactive console is great for testing one-liners.
It also has autocompletion so you can inspect the API quickly.
- Button tooltips show Python attributes and operator names.
- The context menu of buttons directly links to this API documentation.
- More operator examples can be found in the text editor's template menu.
- Enable :ref:`Developer Extra <blender_manual:prefs-interface-dev-extras`
and :ref:`Python Tooltips <blender_manual:prefs-interface-tooltips-python>`.
- The :ref:`Python Console <blender_manual:bpy.types.SpaceConsole>`
is great for testing one-liners; it has autocompletion so you can inspect the API quickly.
- Button tooltips show Python attributes and operator names (when enabled see above).
- The context menu of buttons directly links to this API documentation (when enabled see above).
- Many python examples can be found in the text editor's template menu.
- To examine further scripts distributed with Blender, see:
- ``scripts/startup/bl_ui`` for the user interface.
@@ -237,7 +238,7 @@ Examples:
{'FINISHED'}
>>> bpy.ops.mesh.hide(unselected=False)
{'FINISHED'}
>>> bpy.ops.object.scale_apply()
>>> bpy.ops.object.transform_apply()
{'FINISHED'}
.. tip::

View File

@@ -24,10 +24,9 @@ The three main use cases for the terminal are:
- If the script runs for too long or you accidentally enter an infinite loop,
:kbd:`Ctrl-C` in the terminal (:kbd:`Ctrl-Break` on Windows) will quit the script early.
.. note::
.. seealso::
For Linux and macOS users this means starting the terminal first, then running Blender from within it.
On Windows the terminal can be enabled from the Help menu.
:ref:`blender_manual:command_line-launch-index`.
Interface Tricks

View File

@@ -55,7 +55,7 @@ if $DO_EXE_BLENDER ; then
# Don't delete existing docs, now partial updates are used for quick builds.
#
# Disable ASAN error halt since it results in nonzero exit code on any minor issue.
ASAN_OPTIONS=halt_on_error=0 \
ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \
$BLENDER_BIN \
--background \
-noaudio \

View File

@@ -1,7 +1,5 @@
/* Prevent Long enum lists */
.field-body {
display: block;
width: 100%;
/* T76453: Prevent Long enum lists */
.field-list li {
max-height: 245px;
overflow-y: auto !important;
}

View File

@@ -72,6 +72,9 @@ protected:
/// The channel mapper reader in between.
std::shared_ptr<ChannelMapperReader> m_mapper;
/// Whether the source is being read for the first time.
bool m_first_reading;
/// Whether to keep the source if end of it is reached.
bool m_keep;

View File

@@ -78,7 +78,7 @@ bool SoftwareDevice::SoftwareHandle::pause(bool keep)
}
SoftwareDevice::SoftwareHandle::SoftwareHandle(SoftwareDevice* device, std::shared_ptr<IReader> reader, std::shared_ptr<PitchReader> pitch, std::shared_ptr<ResampleReader> resampler, std::shared_ptr<ChannelMapperReader> mapper, bool keep) :
m_reader(reader), m_pitch(pitch), m_resampler(resampler), m_mapper(mapper), m_keep(keep), m_user_pitch(1.0f), m_user_volume(1.0f), m_user_pan(0.0f), m_volume(0.0f), m_old_volume(0.0f), m_loopcount(0),
m_reader(reader), m_pitch(pitch), m_resampler(resampler), m_mapper(mapper), m_first_reading(true), m_keep(keep), m_user_pitch(1.0f), m_user_volume(1.0f), m_user_pan(0.0f), m_volume(0.0f), m_old_volume(0.0f), m_loopcount(0),
m_relative(true), m_volume_max(1.0f), m_volume_min(0), m_distance_max(std::numeric_limits<float>::max()),
m_distance_reference(1.0f), m_attenuation(1.0f), m_cone_angle_outer(M_PI), m_cone_angle_inner(M_PI), m_cone_volume_outer(0),
m_flags(RENDER_CONE), m_stop(nullptr), m_stop_data(nullptr), m_status(STATUS_PLAYING), m_device(device)
@@ -106,6 +106,14 @@ void SoftwareDevice::SoftwareHandle::update()
if(m_pitch->getSpecs().channels != CHANNELS_MONO)
{
m_volume = m_user_volume;
// we don't know a previous volume if this source has never been read before
if(m_first_reading)
{
m_old_volume = m_volume;
m_first_reading = false;
}
m_pitch->setPitch(m_user_pitch);
return;
}
@@ -214,6 +222,13 @@ void SoftwareDevice::SoftwareHandle::update()
m_volume *= m_user_volume;
}
// we don't know a previous volume if this source has never been read before
if(m_first_reading)
{
m_old_volume = m_volume;
m_first_reading = false;
}
// 3D Cue
Quaternion orientation;
@@ -754,6 +769,8 @@ void SoftwareDevice::mix(data_t* buffer, int length)
{
m_mixer->mix(buf, pos, len, sound->m_volume, sound->m_old_volume);
sound->m_old_volume = sound->m_volume;
pos += len;
if(sound->m_loopcount > 0)

View File

@@ -22,6 +22,7 @@
#include <mutex>
#define KEEP_TIME 10
#define POSITION_EPSILON (1.0 / static_cast<double>(RATE_48000))
AUD_NAMESPACE_BEGIN
@@ -64,7 +65,7 @@ bool SequenceHandle::updatePosition(double position)
if(m_handle.get())
{
// we currently have a handle, let's check where we are
if(position >= m_entry->m_end)
if(position - POSITION_EPSILON >= m_entry->m_end)
{
if(position >= m_entry->m_end + KEEP_TIME)
// far end, stopping
@@ -76,7 +77,7 @@ bool SequenceHandle::updatePosition(double position)
return true;
}
}
else if(position >= m_entry->m_begin)
else if(position + POSITION_EPSILON >= m_entry->m_begin)
{
// inside, resuming
m_handle->resume();
@@ -98,7 +99,7 @@ bool SequenceHandle::updatePosition(double position)
else
{
// we don't have a handle, let's start if we should be playing
if(position >= m_entry->m_begin && position <= m_entry->m_end)
if(position + POSITION_EPSILON >= m_entry->m_begin && position - POSITION_EPSILON <= m_entry->m_end)
{
start();
return m_valid;

View File

@@ -200,6 +200,7 @@ set(SRC
${MANTA_PP}/plugin/ptsplugins.cpp
${MANTA_PP}/plugin/secondaryparticles.cpp
${MANTA_PP}/plugin/surfaceturbulence.cpp
${MANTA_PP}/plugin/viscosity.cpp
${MANTA_PP}/plugin/vortexplugins.cpp
${MANTA_PP}/plugin/waveletturbulence.cpp
${MANTA_PP}/plugin/waves.cpp

View File

@@ -1035,7 +1035,7 @@ template<class N, class T> struct RCFixedMatrix {
typedef RCMatrix<int, Real> Matrix;
typedef RCFixedMatrix<int, Real> FixedMatrix;
} // namespace Manta
}
#undef parallel_for
#undef parallel_end

View File

@@ -397,7 +397,7 @@ struct UpdateSearchVec : public KernelBase {
};
//*****************************************************************************
// CG class
// CG class
template<class APPLYMAT>
GridCg<APPLYMAT>::GridCg(Grid<Real> &dst,
@@ -406,10 +406,8 @@ GridCg<APPLYMAT>::GridCg(Grid<Real> &dst,
Grid<Real> &search,
const FlagGrid &flags,
Grid<Real> &tmp,
Grid<Real> *pA0,
Grid<Real> *pAi,
Grid<Real> *pAj,
Grid<Real> *pAk)
std::vector<Grid<Real> *> matrixAVec,
std::vector<Grid<Real> *> rhsVec)
: GridCgInterface(),
mInited(false),
mIterations(0),
@@ -419,10 +417,8 @@ GridCg<APPLYMAT>::GridCg(Grid<Real> &dst,
mSearch(search),
mFlags(flags),
mTmp(tmp),
mpA0(pA0),
mpAi(pAi),
mpAj(pAj),
mpAk(pAk),
mMatrixA(matrixAVec),
mVecRhs(rhsVec),
mPcMethod(PC_None),
mpPCA0(nullptr),
mpPCAi(nullptr),
@@ -445,19 +441,37 @@ template<class APPLYMAT> void GridCg<APPLYMAT>::doInit()
if (mPcMethod == PC_ICP) {
assertMsg(mDst.is3D(), "ICP only supports 3D grids so far");
InitPreconditionIncompCholesky(
mFlags, *mpPCA0, *mpPCAi, *mpPCAj, *mpPCAk, *mpA0, *mpAi, *mpAj, *mpAk);
ApplyPreconditionIncompCholesky(
mTmp, mResidual, mFlags, *mpPCA0, *mpPCAi, *mpPCAj, *mpPCAk, *mpA0, *mpAi, *mpAj, *mpAk);
InitPreconditionIncompCholesky(mFlags,
*mpPCA0,
*mpPCAi,
*mpPCAj,
*mpPCAk,
*mMatrixA[0],
*mMatrixA[1],
*mMatrixA[2],
*mMatrixA[3]);
ApplyPreconditionIncompCholesky(mTmp,
mResidual,
mFlags,
*mpPCA0,
*mpPCAi,
*mpPCAj,
*mpPCAk,
*mMatrixA[0],
*mMatrixA[1],
*mMatrixA[2],
*mMatrixA[3]);
}
else if (mPcMethod == PC_mICP) {
assertMsg(mDst.is3D(), "mICP only supports 3D grids so far");
InitPreconditionModifiedIncompCholesky2(mFlags, *mpPCA0, *mpA0, *mpAi, *mpAj, *mpAk);
InitPreconditionModifiedIncompCholesky2(
mFlags, *mpPCA0, *mMatrixA[0], *mMatrixA[1], *mMatrixA[2], *mMatrixA[3]);
ApplyPreconditionModifiedIncompCholesky2(
mTmp, mResidual, mFlags, *mpPCA0, *mpA0, *mpAi, *mpAj, *mpAk);
mTmp, mResidual, mFlags, *mpPCA0, *mMatrixA[0], *mMatrixA[1], *mMatrixA[2], *mMatrixA[3]);
}
else if (mPcMethod == PC_MGP) {
InitPreconditionMultigrid(mMG, *mpA0, *mpAi, *mpAj, *mpAk, mAccuracy);
InitPreconditionMultigrid(
mMG, *mMatrixA[0], *mMatrixA[1], *mMatrixA[2], *mMatrixA[3], mAccuracy);
ApplyPreconditionMultigrid(mMG, mTmp, mResidual);
}
else {
@@ -465,7 +479,6 @@ template<class APPLYMAT> void GridCg<APPLYMAT>::doInit()
}
mSearch.copyFrom(mTmp);
mSigma = GridDotProduct(mTmp, mResidual);
}
@@ -480,7 +493,7 @@ template<class APPLYMAT> bool GridCg<APPLYMAT>::iterate()
// this could reinterpret the mpA pointers (not so clean right now)
// tmp = applyMat(search)
APPLYMAT(mFlags, mTmp, mSearch, *mpA0, *mpAi, *mpAj, *mpAk);
APPLYMAT(mFlags, mTmp, mSearch, mMatrixA, mVecRhs);
// alpha = sigma/dot(tmp, search)
Real dp = GridDotProduct(mTmp, mSearch);
@@ -492,11 +505,20 @@ template<class APPLYMAT> bool GridCg<APPLYMAT>::iterate()
gridScaledAdd<Real, Real>(mResidual, mTmp, -alpha); // residual += tmp * -alpha
if (mPcMethod == PC_ICP)
ApplyPreconditionIncompCholesky(
mTmp, mResidual, mFlags, *mpPCA0, *mpPCAi, *mpPCAj, *mpPCAk, *mpA0, *mpAi, *mpAj, *mpAk);
ApplyPreconditionIncompCholesky(mTmp,
mResidual,
mFlags,
*mpPCA0,
*mpPCAi,
*mpPCAj,
*mpPCAk,
*mMatrixA[0],
*mMatrixA[1],
*mMatrixA[2],
*mMatrixA[3]);
else if (mPcMethod == PC_mICP)
ApplyPreconditionModifiedIncompCholesky2(
mTmp, mResidual, mFlags, *mpPCA0, *mpA0, *mpAi, *mpAj, *mpAk);
mTmp, mResidual, mFlags, *mpPCA0, *mMatrixA[0], *mMatrixA[1], *mMatrixA[2], *mMatrixA[3]);
else if (mPcMethod == PC_MGP)
ApplyPreconditionMultigrid(mMG, mTmp, mResidual);
else
@@ -584,13 +606,15 @@ void GridCg<APPLYMAT>::setMGPreconditioner(PreconditionType method, GridMg *MG)
assertMsg(method == PC_MGP, "GridCg<APPLYMAT>::setMGPreconditioner: Invalid method specified.");
mPcMethod = method;
mMG = MG;
}
// explicit instantiation
template class GridCg<ApplyMatrix>;
template class GridCg<ApplyMatrix2D>;
template class GridCg<ApplyMatrixViscosityU>;
template class GridCg<ApplyMatrixViscosityV>;
template class GridCg<ApplyMatrixViscosityW>;
//*****************************************************************************
// diffusion for real and vec grids, e.g. for viscosity
@@ -638,10 +662,15 @@ void cgSolveDiffusion(const FlagGrid &flags,
if (grid.getType() & GridBase::TypeReal) {
Grid<Real> &u = ((Grid<Real> &)grid);
rhs.copyFrom(u);
if (flags.is3D())
gcg = new GridCg<ApplyMatrix>(u, rhs, residual, search, flags, tmp, &A0, &Ai, &Aj, &Ak);
else
gcg = new GridCg<ApplyMatrix2D>(u, rhs, residual, search, flags, tmp, &A0, &Ai, &Aj, &Ak);
vector<Grid<Real> *> matA{&A0, &Ai, &Aj};
if (flags.is3D()) {
matA.push_back(&Ak);
gcg = new GridCg<ApplyMatrix>(u, rhs, residual, search, flags, tmp, matA);
}
else {
gcg = new GridCg<ApplyMatrix2D>(u, rhs, residual, search, flags, tmp, matA);
}
gcg->setAccuracy(cgAccuracy);
gcg->solve(maxIter);
@@ -653,12 +682,17 @@ void cgSolveDiffusion(const FlagGrid &flags,
else if ((grid.getType() & GridBase::TypeVec3) || (grid.getType() & GridBase::TypeMAC)) {
Grid<Vec3> &vec = ((Grid<Vec3> &)grid);
Grid<Real> u(parent);
vector<Grid<Real> *> matA{&A0, &Ai, &Aj};
// core solve is same as for a regular real grid
if (flags.is3D())
gcg = new GridCg<ApplyMatrix>(u, rhs, residual, search, flags, tmp, &A0, &Ai, &Aj, &Ak);
else
gcg = new GridCg<ApplyMatrix2D>(u, rhs, residual, search, flags, tmp, &A0, &Ai, &Aj, &Ak);
if (flags.is3D()) {
matA.push_back(&Ak);
gcg = new GridCg<ApplyMatrix>(u, rhs, residual, search, flags, tmp, matA);
}
else {
gcg = new GridCg<ApplyMatrix2D>(u, rhs, residual, search, flags, tmp, matA);
}
gcg->setAccuracy(cgAccuracy);
// diffuse every component separately

View File

@@ -78,13 +78,9 @@ template<class APPLYMAT> class GridCg : public GridCgInterface {
Grid<Real> &search,
const FlagGrid &flags,
Grid<Real> &tmp,
Grid<Real> *A0,
Grid<Real> *pAi,
Grid<Real> *pAj,
Grid<Real> *pAk);
~GridCg()
{
}
std::vector<Grid<Real> *> matrixAVec,
std::vector<Grid<Real> *> rhsVec = {});
~GridCg(){};
void doInit();
bool iterate();
@@ -133,7 +129,10 @@ template<class APPLYMAT> class GridCg : public GridCgInterface {
const FlagGrid &mFlags;
Grid<Real> &mTmp;
Grid<Real> *mpA0, *mpAi, *mpAj, *mpAk;
//! shape of A matrix defined here (e.g. diagonal, positive neighbor cells, etc)
std::vector<Grid<Real> *> mMatrixA;
//! shape of rhs vector defined here (e.g. 1 rhs for regular fluids solve, 3 rhs for viscosity)
std::vector<Grid<Real> *> mVecRhs;
PreconditionType mPcMethod;
//! preconditioning grids
@@ -154,11 +153,9 @@ struct ApplyMatrix : public KernelBase {
ApplyMatrix(const FlagGrid &flags,
Grid<Real> &dst,
const Grid<Real> &src,
Grid<Real> &A0,
Grid<Real> &Ai,
Grid<Real> &Aj,
Grid<Real> &Ak)
: KernelBase(&flags, 0), flags(flags), dst(dst), src(src), A0(A0), Ai(Ai), Aj(Aj), Ak(Ak)
const std::vector<Grid<Real> *> matrixA,
const std::vector<Grid<Real> *> vecRhs)
: KernelBase(&flags, 0), flags(flags), dst(dst), src(src), matrixA(matrixA), vecRhs(vecRhs)
{
runMessage();
run();
@@ -167,11 +164,18 @@ struct ApplyMatrix : public KernelBase {
const FlagGrid &flags,
Grid<Real> &dst,
const Grid<Real> &src,
Grid<Real> &A0,
Grid<Real> &Ai,
Grid<Real> &Aj,
Grid<Real> &Ak) const
const std::vector<Grid<Real> *> matrixA,
const std::vector<Grid<Real> *> vecRhs) const
{
unusedParameter(vecRhs); // Not needed in this matrix application
if (matrixA.size() != 4)
errMsg("ConjugateGrad: Invalid A matrix in apply matrix step");
Grid<Real> &A0 = *matrixA[0];
Grid<Real> &Ai = *matrixA[1];
Grid<Real> &Aj = *matrixA[2];
Grid<Real> &Ak = *matrixA[3];
if (!flags.isFluid(idx)) {
dst[idx] = src[idx];
return;
@@ -196,26 +200,16 @@ struct ApplyMatrix : public KernelBase {
return src;
}
typedef Grid<Real> type2;
inline Grid<Real> &getArg3()
inline const std::vector<Grid<Real> *> &getArg3()
{
return A0;
return matrixA;
}
typedef Grid<Real> type3;
inline Grid<Real> &getArg4()
typedef std::vector<Grid<Real> *> type3;
inline const std::vector<Grid<Real> *> &getArg4()
{
return Ai;
return vecRhs;
}
typedef Grid<Real> type4;
inline Grid<Real> &getArg5()
{
return Aj;
}
typedef Grid<Real> type5;
inline Grid<Real> &getArg6()
{
return Ak;
}
typedef Grid<Real> type6;
typedef std::vector<Grid<Real> *> type4;
void runMessage()
{
debMsg("Executing kernel ApplyMatrix ", 3);
@@ -226,7 +220,7 @@ struct ApplyMatrix : public KernelBase {
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++)
op(idx, flags, dst, src, A0, Ai, Aj, Ak);
op(idx, flags, dst, src, matrixA, vecRhs);
}
void run()
{
@@ -235,10 +229,8 @@ struct ApplyMatrix : public KernelBase {
const FlagGrid &flags;
Grid<Real> &dst;
const Grid<Real> &src;
Grid<Real> &A0;
Grid<Real> &Ai;
Grid<Real> &Aj;
Grid<Real> &Ak;
const std::vector<Grid<Real> *> matrixA;
const std::vector<Grid<Real> *> vecRhs;
};
//! Kernel: Apply symmetric stored Matrix. 2D version
@@ -247,11 +239,9 @@ struct ApplyMatrix2D : public KernelBase {
ApplyMatrix2D(const FlagGrid &flags,
Grid<Real> &dst,
const Grid<Real> &src,
Grid<Real> &A0,
Grid<Real> &Ai,
Grid<Real> &Aj,
Grid<Real> &Ak)
: KernelBase(&flags, 0), flags(flags), dst(dst), src(src), A0(A0), Ai(Ai), Aj(Aj), Ak(Ak)
const std::vector<Grid<Real> *> matrixA,
const std::vector<Grid<Real> *> vecRhs)
: KernelBase(&flags, 0), flags(flags), dst(dst), src(src), matrixA(matrixA), vecRhs(vecRhs)
{
runMessage();
run();
@@ -260,12 +250,16 @@ struct ApplyMatrix2D : public KernelBase {
const FlagGrid &flags,
Grid<Real> &dst,
const Grid<Real> &src,
Grid<Real> &A0,
Grid<Real> &Ai,
Grid<Real> &Aj,
Grid<Real> &Ak) const
const std::vector<Grid<Real> *> matrixA,
const std::vector<Grid<Real> *> vecRhs) const
{
unusedParameter(Ak); // only there for parameter compatibility with ApplyMatrix
unusedParameter(vecRhs); // Not needed in this matrix application
if (matrixA.size() != 3)
errMsg("ConjugateGrad: Invalid A matrix in apply matrix step");
Grid<Real> &A0 = *matrixA[0];
Grid<Real> &Ai = *matrixA[1];
Grid<Real> &Aj = *matrixA[2];
if (!flags.isFluid(idx)) {
dst[idx] = src[idx];
@@ -290,26 +284,16 @@ struct ApplyMatrix2D : public KernelBase {
return src;
}
typedef Grid<Real> type2;
inline Grid<Real> &getArg3()
inline const std::vector<Grid<Real> *> &getArg3()
{
return A0;
return matrixA;
}
typedef Grid<Real> type3;
inline Grid<Real> &getArg4()
typedef std::vector<Grid<Real> *> type3;
inline const std::vector<Grid<Real> *> &getArg4()
{
return Ai;
return vecRhs;
}
typedef Grid<Real> type4;
inline Grid<Real> &getArg5()
{
return Aj;
}
typedef Grid<Real> type5;
inline Grid<Real> &getArg6()
{
return Ak;
}
typedef Grid<Real> type6;
typedef std::vector<Grid<Real> *> type4;
void runMessage()
{
debMsg("Executing kernel ApplyMatrix2D ", 3);
@@ -320,7 +304,7 @@ struct ApplyMatrix2D : public KernelBase {
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
for (IndexInt idx = __r.begin(); idx != (IndexInt)__r.end(); idx++)
op(idx, flags, dst, src, A0, Ai, Aj, Ak);
op(idx, flags, dst, src, matrixA, vecRhs);
}
void run()
{
@@ -329,12 +313,358 @@ struct ApplyMatrix2D : public KernelBase {
const FlagGrid &flags;
Grid<Real> &dst;
const Grid<Real> &src;
Grid<Real> &A0;
Grid<Real> &Ai;
Grid<Real> &Aj;
Grid<Real> &Ak;
const std::vector<Grid<Real> *> matrixA;
const std::vector<Grid<Real> *> vecRhs;
};
struct ApplyMatrixViscosityU : public KernelBase {
ApplyMatrixViscosityU(const FlagGrid &flags,
Grid<Real> &dst,
const Grid<Real> &src,
const std::vector<Grid<Real> *> matrixA,
const std::vector<Grid<Real> *> vecRhs)
: KernelBase(&flags, 1), flags(flags), dst(dst), src(src), matrixA(matrixA), vecRhs(vecRhs)
{
runMessage();
run();
}
inline void op(int i,
int j,
int k,
const FlagGrid &flags,
Grid<Real> &dst,
const Grid<Real> &src,
const std::vector<Grid<Real> *> matrixA,
const std::vector<Grid<Real> *> vecRhs) const
{
if (matrixA.size() != 15)
errMsg("ConjugateGrad: Invalid A matrix in apply matrix step");
Grid<Real> &A0 = *matrixA[0];
Grid<Real> &Aplusi = *matrixA[1];
Grid<Real> &Aplusj = *matrixA[2];
Grid<Real> &Aplusk = *matrixA[3];
Grid<Real> &Aminusi = *matrixA[4];
Grid<Real> &Aminusj = *matrixA[5];
Grid<Real> &Aminusk = *matrixA[6];
if (vecRhs.size() != 2)
errMsg("ConjugateGrad: Invalid rhs vector in apply matrix step");
Grid<Real> &srcV = *vecRhs[0];
Grid<Real> &srcW = *vecRhs[1];
dst(i, j, k) = src(i, j, k) * A0(i, j, k) + src(i + 1, j, k) * Aplusi(i, j, k) +
src(i, j + 1, k) * Aplusj(i, j, k) + src(i, j, k + 1) * Aplusk(i, j, k) +
src(i - 1, j, k) * Aminusi(i, j, k) + src(i, j - 1, k) * Aminusj(i, j, k) +
src(i, j, k - 1) * Aminusk(i, j, k);
dst(i, j, k) += srcV(i, j + 1, k) * (*matrixA[7])(i, j, k) +
srcV(i - 1, j + 1, k) * (*matrixA[8])(i, j, k) +
srcV(i, j, k) * (*matrixA[9])(i, j, k) +
srcV(i - 1, j, k) * (*matrixA[10])(i, j, k) +
srcW(i, j, k + 1) * (*matrixA[11])(i, j, k) +
srcW(i - 1, j, k + 1) * (*matrixA[12])(i, j, k) +
srcW(i, j, k) * (*matrixA[13])(i, j, k) +
srcW(i - 1, j, k) * (*matrixA[14])(i, j, k);
}
inline const FlagGrid &getArg0()
{
return flags;
}
typedef FlagGrid type0;
inline Grid<Real> &getArg1()
{
return dst;
}
typedef Grid<Real> type1;
inline const Grid<Real> &getArg2()
{
return src;
}
typedef Grid<Real> type2;
inline const std::vector<Grid<Real> *> &getArg3()
{
return matrixA;
}
typedef std::vector<Grid<Real> *> type3;
inline const std::vector<Grid<Real> *> &getArg4()
{
return vecRhs;
}
typedef std::vector<Grid<Real> *> type4;
void runMessage()
{
debMsg("Executing kernel ApplyMatrixViscosityU ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 1; j < _maxY; j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, flags, dst, src, matrixA, vecRhs);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, flags, dst, src, matrixA, vecRhs);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
}
const FlagGrid &flags;
Grid<Real> &dst;
const Grid<Real> &src;
const std::vector<Grid<Real> *> matrixA;
const std::vector<Grid<Real> *> vecRhs;
};
struct ApplyMatrixViscosityV : public KernelBase {
ApplyMatrixViscosityV(const FlagGrid &flags,
Grid<Real> &dst,
const Grid<Real> &src,
const std::vector<Grid<Real> *> matrixA,
const std::vector<Grid<Real> *> vecRhs)
: KernelBase(&flags, 1), flags(flags), dst(dst), src(src), matrixA(matrixA), vecRhs(vecRhs)
{
runMessage();
run();
}
inline void op(int i,
int j,
int k,
const FlagGrid &flags,
Grid<Real> &dst,
const Grid<Real> &src,
const std::vector<Grid<Real> *> matrixA,
const std::vector<Grid<Real> *> vecRhs) const
{
if (matrixA.size() != 15)
errMsg("ConjugateGrad: Invalid A matrix in apply matrix step");
Grid<Real> &A0 = *matrixA[0];
Grid<Real> &Aplusi = *matrixA[1];
Grid<Real> &Aplusj = *matrixA[2];
Grid<Real> &Aplusk = *matrixA[3];
Grid<Real> &Aminusi = *matrixA[4];
Grid<Real> &Aminusj = *matrixA[5];
Grid<Real> &Aminusk = *matrixA[6];
if (vecRhs.size() != 2)
errMsg("ConjugateGrad: Invalid rhs vector in apply matrix step");
Grid<Real> &srcU = *vecRhs[0];
Grid<Real> &srcW = *vecRhs[1];
dst(i, j, k) = src(i, j, k) * A0(i, j, k) + src(i + 1, j, k) * Aplusi(i, j, k) +
src(i, j + 1, k) * Aplusj(i, j, k) + src(i, j, k + 1) * Aplusk(i, j, k) +
src(i - 1, j, k) * Aminusi(i, j, k) + src(i, j - 1, k) * Aminusj(i, j, k) +
src(i, j, k - 1) * Aminusk(i, j, k);
dst(i, j, k) += srcU(i + 1, j, k) * (*matrixA[7])(i, j, k) +
srcU(i + 1, j - 1, k) * (*matrixA[8])(i, j, k) +
srcU(i, j, k) * (*matrixA[9])(i, j, k) +
srcU(i, j - 1, k) * (*matrixA[10])(i, j, k) +
srcW(i, j, k + 1) * (*matrixA[11])(i, j, k) +
srcW(i, j - 1, k + 1) * (*matrixA[12])(i, j, k) +
srcW(i, j, k) * (*matrixA[13])(i, j, k) +
srcW(i, j - 1, k) * (*matrixA[14])(i, j, k);
}
inline const FlagGrid &getArg0()
{
return flags;
}
typedef FlagGrid type0;
inline Grid<Real> &getArg1()
{
return dst;
}
typedef Grid<Real> type1;
inline const Grid<Real> &getArg2()
{
return src;
}
typedef Grid<Real> type2;
inline const std::vector<Grid<Real> *> &getArg3()
{
return matrixA;
}
typedef std::vector<Grid<Real> *> type3;
inline const std::vector<Grid<Real> *> &getArg4()
{
return vecRhs;
}
typedef std::vector<Grid<Real> *> type4;
void runMessage()
{
debMsg("Executing kernel ApplyMatrixViscosityV ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 1; j < _maxY; j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, flags, dst, src, matrixA, vecRhs);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, flags, dst, src, matrixA, vecRhs);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
}
const FlagGrid &flags;
Grid<Real> &dst;
const Grid<Real> &src;
const std::vector<Grid<Real> *> matrixA;
const std::vector<Grid<Real> *> vecRhs;
};
struct ApplyMatrixViscosityW : public KernelBase {
ApplyMatrixViscosityW(const FlagGrid &flags,
Grid<Real> &dst,
const Grid<Real> &src,
const std::vector<Grid<Real> *> matrixA,
const std::vector<Grid<Real> *> vecRhs)
: KernelBase(&flags, 1), flags(flags), dst(dst), src(src), matrixA(matrixA), vecRhs(vecRhs)
{
runMessage();
run();
}
inline void op(int i,
int j,
int k,
const FlagGrid &flags,
Grid<Real> &dst,
const Grid<Real> &src,
const std::vector<Grid<Real> *> matrixA,
const std::vector<Grid<Real> *> vecRhs) const
{
if (matrixA.size() != 15)
errMsg("ConjugateGrad: Invalid A matrix in apply matrix step");
Grid<Real> &A0 = *matrixA[0];
Grid<Real> &Aplusi = *matrixA[1];
Grid<Real> &Aplusj = *matrixA[2];
Grid<Real> &Aplusk = *matrixA[3];
Grid<Real> &Aminusi = *matrixA[4];
Grid<Real> &Aminusj = *matrixA[5];
Grid<Real> &Aminusk = *matrixA[6];
if (vecRhs.size() != 2)
errMsg("ConjugateGrad: Invalid rhs vector in apply matrix step");
Grid<Real> &srcU = *vecRhs[0];
Grid<Real> &srcV = *vecRhs[1];
dst(i, j, k) = src(i, j, k) * A0(i, j, k) + src(i + 1, j, k) * Aplusi(i, j, k) +
src(i, j + 1, k) * Aplusj(i, j, k) + src(i, j, k + 1) * Aplusk(i, j, k) +
src(i - 1, j, k) * Aminusi(i, j, k) + src(i, j - 1, k) * Aminusj(i, j, k) +
src(i, j, k - 1) * Aminusk(i, j, k);
dst(i, j, k) += srcU(i + 1, j, k) * (*matrixA[7])(i, j, k) +
srcU(i + 1, j, k - 1) * (*matrixA[8])(i, j, k) +
srcU(i, j, k) * (*matrixA[9])(i, j, k) +
srcU(i, j, k - 1) * (*matrixA[10])(i, j, k) +
srcV(i, j + 1, k) * (*matrixA[11])(i, j, k) +
srcV(i, j + 1, k - 1) * (*matrixA[12])(i, j, k) +
srcV(i, j, k) * (*matrixA[13])(i, j, k) +
srcV(i, j, k - 1) * (*matrixA[14])(i, j, k);
}
inline const FlagGrid &getArg0()
{
return flags;
}
typedef FlagGrid type0;
inline Grid<Real> &getArg1()
{
return dst;
}
typedef Grid<Real> type1;
inline const Grid<Real> &getArg2()
{
return src;
}
typedef Grid<Real> type2;
inline const std::vector<Grid<Real> *> &getArg3()
{
return matrixA;
}
typedef std::vector<Grid<Real> *> type3;
inline const std::vector<Grid<Real> *> &getArg4()
{
return vecRhs;
}
typedef std::vector<Grid<Real> *> type4;
void runMessage()
{
debMsg("Executing kernel ApplyMatrixViscosityW ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 1; j < _maxY; j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, flags, dst, src, matrixA, vecRhs);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, flags, dst, src, matrixA, vecRhs);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
}
const FlagGrid &flags;
Grid<Real> &dst;
const Grid<Real> &src;
const std::vector<Grid<Real> *> matrixA;
const std::vector<Grid<Real> *> vecRhs;
};
/* NOTE: Use this template for new matrix application kernels
//! Template for matrix application kernels
KERNEL()
void ApplyMatrixTemplate (const FlagGrid& flags, Grid<Real>& dst, const Grid<Real>& src,
const std::vector<Grid<Real> *> matrixA, const std::vector<Grid<Real> *> vecRhs)
{
// The kernel must define how to use the grids from the matrixA and vecRhs lists
}
*/
//! Kernel: Construct the matrix for the poisson equation
struct MakeLaplaceMatrix : public KernelBase {

View File

@@ -628,13 +628,24 @@ template<class T> int readGridUni(const string &name, Grid<T> *grid)
// current file format
UniHeader head;
assertMsg(gzread(gzf, &head, sizeof(UniHeader)) == sizeof(UniHeader),
"can't read file, no header present");
assertMsg(head.dimX == grid->getSizeX() && head.dimY == grid->getSizeY() &&
head.dimZ == grid->getSizeZ(),
"grid dim doesn't match, " << Vec3(head.dimX, head.dimY, head.dimZ) << " vs "
<< grid->getSize());
"readGridUni: Can't read file, no header present");
assertMsg(unifyGridType(head.gridType) == unifyGridType(grid->getType()),
"grid type doesn't match " << head.gridType << " vs " << grid->getType());
"readGridUni: Grid type doesn't match " << head.gridType << " vs "
<< grid->getType());
const Vec3i curGridSize = grid->getParent()->getGridSize();
const Vec3i headGridSize(head.dimX, head.dimY, head.dimZ);
# if BLENDER
// Correct grid size is only a soft requirement in Blender
if (headGridSize != curGridSize) {
debMsg("readGridUni: Grid dim doesn't match, " << headGridSize << " vs " << curGridSize, 1);
return 0;
}
# else
assertMsg(headGridSize == curGridSize,
"readGridUni: Grid dim doesn't match, " << headGridSize << " vs " << curGridSize);
# endif
# if FLOATINGPOINT_PRECISION != 1
// convert float to double
Grid<T> temp(grid->getParent());

View File

@@ -230,6 +230,19 @@ int readParticlesUni(const std::string &name, BasicParticleSystem *parts)
assertMsg(((head.bytesPerElement == PartSysSize) && (head.elementType == 0)),
"particle type doesn't match");
const Vec3i curGridSize = parts->getParent()->getGridSize();
const Vec3i headGridSize(head.dimX, head.dimY, head.dimZ);
# if BLENDER
// Correct grid size is only a soft requirement in Blender
if (headGridSize != curGridSize) {
debMsg("readPdataUni: Grid dim doesn't match, " << headGridSize << " vs " << curGridSize, 1);
return 0;
}
# else
assertMsg(headGridSize == curGridSize,
"readPdataUni: Grid dim doesn't match, " << headGridSize << " vs " << curGridSize);
# endif
// re-allocate all data
parts->resizeAll(head.dim);
@@ -325,6 +338,19 @@ template<class T> int readPdataUni(const std::string &name, ParticleDataImpl<T>
pdata->getParticleSys()->resize(head.dim); // ensure that parent particle system has same size
pdata->resize(head.dim);
const Vec3i curGridSize = pdata->getParent()->getGridSize();
const Vec3i headGridSize(head.dimX, head.dimY, head.dimZ);
# if BLENDER
// Correct grid size is only a soft requirement in Blender
if (headGridSize != curGridSize) {
debMsg("readPdataUni: Grid dim doesn't match, " << headGridSize << " vs " << curGridSize, 1);
return 0;
}
# else
assertMsg(headGridSize == curGridSize,
"readPdataUni: Grid dim doesn't match, " << headGridSize << " vs " << curGridSize);
# endif
assertMsg(head.dim == pdata->size(), "pdata size doesn't match");
# if FLOATINGPOINT_PRECISION != 1
ParticleDataImpl<T> temp(pdata->getParent());

View File

@@ -90,6 +90,13 @@ template<> void convertFrom(openvdb::Vec3s &in, Vec3 *out)
(*out).z = in.z();
}
template<> void convertFrom(openvdb::Vec3i &in, Vec3i *out)
{
(*out).x = in.x();
(*out).y = in.y();
(*out).z = in.z();
}
// Convert to OpenVDB value from Manta value.
template<class S, class T> void convertTo(S *out, T &in)
{

View File

@@ -38,6 +38,11 @@
#define POSITION_NAME "P"
#define FLAG_NAME "U"
#define META_BASE_RES "file_base_resolution"
#define META_VOXEL_SIZE "file_voxel_size"
#define META_BBOX_MAX "file_bbox_max"
#define META_BBOX_MIN "file_bbox_min"
using namespace std;
namespace Manta {
@@ -388,7 +393,8 @@ int writeObjectsVDB(const string &filename,
int compression,
int precision,
float clip,
const Grid<Real> *clipGrid)
const Grid<Real> *clipGrid,
const bool meta)
{
openvdb::initialize();
openvdb::io::File file(filename);
@@ -423,13 +429,14 @@ int writeObjectsVDB(const string &filename,
if (GridBase *mantaGrid = dynamic_cast<GridBase *>(*iter)) {
if (clipGrid) {
assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
"writeObjectsVDB: Clip grid and exported grid must have the same size");
}
if (mantaGrid->getType() & GridBase::TypeInt) {
debMsg("Writing int grid '" << mantaGrid->getName() << "' to vdb file " << filename, 1);
Grid<int> *mantaIntGrid = (Grid<int> *)mantaGrid;
if (clipGrid && mantaIntGrid->saveSparse()) {
assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
"writeObjectsVDB: Clip grid and exported grid must have the same size "
<< clipGrid->getSize() << " vs " << mantaGrid->getSize());
}
vdbGrid = exportVDB<int, openvdb::Int32Grid>(mantaIntGrid, clip, vdbClipGrid);
gridsVDB.push_back(vdbGrid);
}
@@ -440,6 +447,11 @@ int writeObjectsVDB(const string &filename,
Grid<Real> *mantaRealGrid = (Grid<Real> *)mantaGrid;
// Only supply clip grid if real grid is not equal to the clip grid
openvdb::FloatGrid::Ptr tmpClipGrid = (mantaRealGrid == clipGrid) ? nullptr : vdbClipGrid;
if (clipGrid && mantaRealGrid->saveSparse()) {
assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
"writeObjectsVDB: Clip grid and exported grid must have the same size "
<< clipGrid->getSize() << " vs " << mantaGrid->getSize());
}
vdbGrid = exportVDB<Real, openvdb::FloatGrid>(mantaRealGrid, clip, tmpClipGrid);
gridsVDB.push_back(vdbGrid);
}
@@ -448,6 +460,11 @@ int writeObjectsVDB(const string &filename,
gClass = (mantaGrid->getType() & GridBase::TypeMAC) ? openvdb::GRID_STAGGERED :
openvdb::GRID_UNKNOWN;
Grid<Vec3> *mantaVec3Grid = (Grid<Vec3> *)mantaGrid;
if (clipGrid && mantaVec3Grid->saveSparse()) {
assertMsg(clipGrid->getSize() == mantaGrid->getSize(),
"writeObjectsVDB: Clip grid and exported grid must have the same size "
<< clipGrid->getSize() << " vs " << mantaGrid->getSize());
}
vdbGrid = exportVDB<Vec3, openvdb::Vec3SGrid>(mantaVec3Grid, clip, vdbClipGrid);
gridsVDB.push_back(vdbGrid);
}
@@ -478,6 +495,16 @@ int writeObjectsVDB(const string &filename,
// Set additional grid attributes, e.g. name, grid class, compression level, etc.
if (vdbGrid) {
setGridOptions<openvdb::GridBase>(vdbGrid, objectName, gClass, voxelSize, precision);
// Optional metadata: Save additional simulation information per vdb object
if (meta) {
const Vec3i size = object->getParent()->getGridSize();
// The (dense) resolution of this grid
vdbGrid->insertMeta(META_BASE_RES,
openvdb::Vec3IMetadata(openvdb::Vec3i(size.x, size.y, size.z)));
// Length of one voxel side
vdbGrid->insertMeta(META_VOXEL_SIZE, openvdb::FloatMetadata(voxelSize));
}
}
}
@@ -522,6 +549,44 @@ int writeObjectsVDB(const string &filename,
return 1;
}
static void clearAll(std::vector<PbClass *> *objects, std::vector<ParticleDataBase *> pdbBuffer)
{
// Clear all data loaded into manta objects (e.g. during IO error)
for (std::vector<PbClass *>::iterator iter = objects->begin(); iter != objects->end(); ++iter) {
if (GridBase *mantaGrid = dynamic_cast<GridBase *>(*iter)) {
if (mantaGrid->getType() & GridBase::TypeInt) {
Grid<int> *mantaIntGrid = (Grid<int> *)mantaGrid;
mantaIntGrid->clear();
}
else if (mantaGrid->getType() & GridBase::TypeReal) {
Grid<Real> *mantaRealGrid = (Grid<Real> *)mantaGrid;
mantaRealGrid->clear();
}
else if (mantaGrid->getType() & GridBase::TypeVec3) {
Grid<Vec3> *mantaVec3Grid = (Grid<Vec3> *)mantaGrid;
mantaVec3Grid->clear();
}
}
else if (BasicParticleSystem *mantaPP = dynamic_cast<BasicParticleSystem *>(*iter)) {
mantaPP->clear();
}
}
for (ParticleDataBase *pdb : pdbBuffer) {
if (pdb->getType() == ParticleDataBase::TypeInt) {
ParticleDataImpl<int> *mantaPDataInt = (ParticleDataImpl<int> *)pdb;
mantaPDataInt->clear();
}
else if (pdb->getType() == ParticleDataBase::TypeReal) {
ParticleDataImpl<Real> *mantaPDataReal = (ParticleDataImpl<Real> *)pdb;
mantaPDataReal->clear();
}
else if (pdb->getType() == ParticleDataBase::TypeVec3) {
ParticleDataImpl<Vec3> *mantaPDataVec3 = (ParticleDataImpl<Vec3> *)pdb;
mantaPDataVec3->clear();
}
}
}
int readObjectsVDB(const string &filename, std::vector<PbClass *> *objects, float worldSize)
{
@@ -550,6 +615,9 @@ int readObjectsVDB(const string &filename, std::vector<PbClass *> *objects, floa
// A buffer to store a handle to pData objects. These will be read alongside a particle system.
std::vector<ParticleDataBase *> pdbBuffer;
// Count how many objects could not be read correctly
int readFailure = 0;
for (std::vector<PbClass *>::iterator iter = objects->begin(); iter != objects->end(); ++iter) {
if (gridsVDB.empty()) {
@@ -557,11 +625,12 @@ int readObjectsVDB(const string &filename, std::vector<PbClass *> *objects, floa
}
// If there is just one grid in this file, load it regardless of name match (to vdb caches per
// grid).
bool onlyGrid = (gridsVDB.size() == 1);
const bool onlyGrid = (gridsVDB.size() == 1);
PbClass *object = dynamic_cast<PbClass *>(*iter);
const Real dx = object->getParent()->getDx();
const Real voxelSize = worldSize * dx;
const Vec3i origRes = object->getParent()->getGridSize();
Real voxelSize = worldSize * dx;
// Particle data objects are treated separately - buffered and inserted when reading the
// particle system
@@ -585,6 +654,81 @@ int readObjectsVDB(const string &filename, std::vector<PbClass *> *objects, floa
if (!nameMatch && !onlyGrid) {
continue;
}
// Metadata: If present in the file, meta data will be parsed into these fields
Real metaVoxelSize(0);
Vec3i metaRes(0), metaBBoxMax(0), metaBBoxMin(0);
// Loop to load all meta data that we care about
for (openvdb::MetaMap::MetaIterator iter = vdbGrid->beginMeta(); iter != vdbGrid->endMeta();
++iter) {
const std::string &name = iter->first;
const openvdb::Metadata::Ptr value = iter->second;
if (name.compare(META_BASE_RES) == 0) {
openvdb::Vec3i tmp = static_cast<openvdb::Vec3IMetadata &>(*value).value();
convertFrom(tmp, &metaRes);
}
else if (name.compare(META_VOXEL_SIZE) == 0) {
float tmp = static_cast<openvdb::FloatMetadata &>(*value).value();
convertFrom(tmp, &metaVoxelSize);
voxelSize = metaVoxelSize; // Make sure to update voxel size variable (used in
// pointgrid's importVDB())
if (worldSize != 1.0)
debMsg(
"readObjectsVDB: Found voxel size in meta data. worldSize parameter will be "
"ignored!",
1);
}
else if (name.compare(META_BBOX_MAX) == 0) {
openvdb::Vec3i tmp = static_cast<openvdb::Vec3IMetadata &>(*value).value();
convertFrom(tmp, &metaBBoxMax);
}
else if (name.compare(META_BBOX_MIN) == 0) {
openvdb::Vec3i tmp = static_cast<openvdb::Vec3IMetadata &>(*value).value();
convertFrom(tmp, &metaBBoxMin);
}
else {
debMsg("readObjectsVDB: Skipping unknown meta information '" << name << "'", 1);
}
}
// Compare metadata with allocated grid setup. This prevents invalid index access.
if (notZero(metaRes) && metaRes != origRes) {
debMsg("readObjectsVDB Warning: Grid '" << vdbGrid->getName()
<< "' has not been read. Meta grid res " << metaRes
<< " vs " << origRes << " current grid size",
1);
readFailure++;
break;
}
if (notZero(metaVoxelSize) && metaVoxelSize != voxelSize) {
debMsg("readObjectsVDB Warning: Grid '"
<< vdbGrid->getName() << "' has not been read. Meta voxel size "
<< metaVoxelSize << " vs " << voxelSize << " current voxel size",
1);
readFailure++;
break;
}
if (metaBBoxMax.x > origRes.x || metaBBoxMax.y > origRes.y || metaBBoxMax.z > origRes.z) {
debMsg("readObjectsVDB Warning: Grid '"
<< vdbGrid->getName() << "' has not been read. Vdb bbox max " << metaBBoxMax
<< " vs " << origRes << " current grid size",
1);
readFailure++;
break;
}
const Vec3i origOrigin(0);
if (metaBBoxMin.x < origOrigin.x || metaBBoxMin.y < origOrigin.y ||
metaBBoxMin.z < origOrigin.z) {
debMsg("readObjectsVDB Warning: Grid '"
<< vdbGrid->getName() << "' has not been read. Vdb bbox min " << metaBBoxMin
<< " vs " << origOrigin << " current grid origin",
1);
readFailure++;
break;
}
if (GridBase *mantaGrid = dynamic_cast<GridBase *>(*iter)) {
if (mantaGrid->getType() & GridBase::TypeInt) {
@@ -644,6 +788,17 @@ int readObjectsVDB(const string &filename, std::vector<PbClass *> *objects, floa
return 0;
}
}
// Do not continue loading objects in this loop if there was a read error
if (readFailure > 0) {
break;
}
}
if (readFailure > 0) {
// Clear all data that has already been loaded into simulation objects
clearAll(objects, pdbBuffer);
pdbBuffer.clear();
return 0;
}
// Give out a warning if pData items were present but could not be read due to missing particle
@@ -718,7 +873,8 @@ int writeObjectsVDB(const string &filename,
int compression,
int precision,
float clip,
const Grid<Real> *clipGrid)
const Grid<Real> *clipGrid,
const bool meta)
{
errMsg("Cannot save to .vdb file. Mantaflow has not been built with OpenVDB support.");
return 0;

View File

@@ -85,7 +85,8 @@ int save(const string &name,
bool precisionHalf = true,
int precision = PRECISION_HALF,
float clip = 1e-4,
const Grid<Real> *clipGrid = nullptr)
const Grid<Real> *clipGrid = nullptr,
const bool meta = false)
{
if (!precisionHalf) {
@@ -105,7 +106,7 @@ int save(const string &name,
return writeGridsVol(name, &objects);
if (ext == ".vdb")
return writeObjectsVDB(
name, &objects, worldSize, skipDeletedParts, compression, precision, clip, clipGrid);
name, &objects, worldSize, skipDeletedParts, compression, precision, clip, clipGrid, meta);
else if (ext == ".npz")
return writeGridsNumpy(name, &objects);
else if (ext == ".txt")
@@ -134,6 +135,7 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
int precision = _args.getOpt<int>("precision", 6, PRECISION_HALF, &_lock);
float clip = _args.getOpt<float>("clip", 7, 1e-4, &_lock);
const Grid<Real> *clipGrid = _args.getPtrOpt<Grid<Real>>("clipGrid", 8, nullptr, &_lock);
const bool meta = _args.getOpt<bool>("meta", 9, false, &_lock);
_retval = toPy(save(name,
objects,
worldSize,
@@ -142,7 +144,8 @@ static PyObject *_W_1(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
precisionHalf,
precision,
clip,
clipGrid));
clipGrid,
meta));
_args.check();
}
pbFinalizePlugin(parent, "save", !noTiming);

View File

@@ -77,7 +77,8 @@ int writeObjectsVDB(const std::string &filename,
int compression = COMPRESSION_ZIP,
int precision = PRECISION_HALF,
float clip = 1e-4,
const Grid<Real> *clipGrid = nullptr);
const Grid<Real> *clipGrid = nullptr,
const bool meta = false);
int readObjectsVDB(const std::string &filename,
std::vector<PbClass *> *objects,
float scale = 1.0);

View File

@@ -42,7 +42,7 @@ inline void updateQtGui(bool full, int frame, float time, const std::string &cur
# ifdef _DEBUG
# define DEBUG 1
# endif // _DEBUG
#endif // DEBUG
#endif // DEBUG
// Standard exception
class Error : public std::exception {
@@ -242,6 +242,39 @@ inline bool c_isnan(float c)
return d != d;
}
//! Swap so that a<b
template<class T> inline void sort(T &a, T &b)
{
if (a > b)
std::swap(a, b);
}
//! Swap so that a<b<c
template<class T> inline void sort(T &a, T &b, T &c)
{
if (a > b)
std::swap(a, b);
if (a > c)
std::swap(a, c);
if (b > c)
std::swap(b, c);
}
//! Swap so that a<b<c<d
template<class T> inline void sort(T &a, T &b, T &c, T &d)
{
if (a > b)
std::swap(a, b);
if (c > d)
std::swap(c, d);
if (a > c)
std::swap(a, c);
if (b > d)
std::swap(b, d);
if (b > c)
std::swap(b, c);
}
} // namespace Manta
#endif

View File

@@ -1,3 +1,3 @@
#define MANTA_GIT_VERSION "commit 327917cd59b03bef3a953b5f58fc1637b3a83e01"
#define MANTA_GIT_VERSION "commit 1c86d86496e7f7473c36248d12ef07bf4d9d2840"

View File

@@ -508,8 +508,7 @@ struct CompMaxVec : public KernelBase {
template<class T> Grid<T> &Grid<T>::copyFrom(const Grid<T> &a, bool copyType)
{
assertMsg(a.mSize.x == mSize.x && a.mSize.y == mSize.y && a.mSize.z == mSize.z,
"different grid resolutions " << a.mSize << " vs " << this->mSize);
assertMsg(a.mSize == mSize, "different grid resolutions " << a.mSize << " vs " << this->mSize);
memcpy(mData, a.mData, sizeof(T) * mSize.x * mSize.y * mSize.z);
if (copyType)
mType = a.mType; // copy type marker
@@ -3402,8 +3401,7 @@ void PbRegister_markIsolatedFluidCell()
void copyMACData(
const MACGrid &source, MACGrid &target, const FlagGrid &flags, const int flag, const int bnd)
{
assertMsg(source.getSize().x == target.getSize().x && source.getSize().y == target.getSize().y &&
source.getSize().z == target.getSize().z,
assertMsg(source.getSize() == target.getSize(),
"different grid resolutions " << source.getSize() << " vs " << target.getSize());
// Grid<Real> divGrid(target.getParent());

View File

@@ -596,6 +596,7 @@ template<class T> class Grid : public GridBase {
//! set data
inline void set(int i, int j, int k, T &val)
{
DEBUG_ONLY(checkIndex(i, j, k));
mData[index(i, j, k)] = val;
}

View File

@@ -491,9 +491,7 @@ template<class T> Grid4d<T> &Grid4d<T>::safeDivide(const Grid4d<T> &a)
}
template<class T> Grid4d<T> &Grid4d<T>::copyFrom(const Grid4d<T> &a, bool copyType)
{
assertMsg(a.mSize.x == mSize.x && a.mSize.y == mSize.y && a.mSize.z == mSize.z &&
a.mSize.t == mSize.t,
"different Grid4d resolutions " << a.mSize << " vs " << this->mSize);
assertMsg(a.mSize == mSize, "different Grid4d resolutions " << a.mSize << " vs " << this->mSize);
memcpy(mData, a.mData, sizeof(T) * mSize.x * mSize.y * mSize.z * mSize.t);
if (copyType)
mType = a.mType; // copy type marker

View File

@@ -1135,26 +1135,27 @@ struct KnAddForceIfLower : public KernelBase {
if (!curFluid && !curEmpty)
return;
Real minVal, maxVal, sum;
if (flags.isFluid(i - 1, j, k) || (curFluid && flags.isEmpty(i - 1, j, k))) {
Real forceMACX = 0.5 * (force(i - 1, j, k).x + force(i, j, k).x);
Real min = std::min(vel(i, j, k).x, forceMACX);
Real max = std::max(vel(i, j, k).x, forceMACX);
Real sum = vel(i, j, k).x + forceMACX;
vel(i, j, k).x = (forceMACX > 0) ? std::min(sum, max) : std::max(sum, min);
minVal = min(vel(i, j, k).x, forceMACX);
maxVal = max(vel(i, j, k).x, forceMACX);
sum = vel(i, j, k).x + forceMACX;
vel(i, j, k).x = (forceMACX > 0) ? min(sum, maxVal) : max(sum, minVal);
}
if (flags.isFluid(i, j - 1, k) || (curFluid && flags.isEmpty(i, j - 1, k))) {
Real forceMACY = 0.5 * (force(i, j - 1, k).y + force(i, j, k).y);
Real min = std::min(vel(i, j, k).y, forceMACY);
Real max = std::max(vel(i, j, k).y, forceMACY);
Real sum = vel(i, j, k).y + forceMACY;
vel(i, j, k).y = (forceMACY > 0) ? std::min(sum, max) : std::max(sum, min);
minVal = min(vel(i, j, k).y, forceMACY);
maxVal = max(vel(i, j, k).y, forceMACY);
sum = vel(i, j, k).y + forceMACY;
vel(i, j, k).y = (forceMACY > 0) ? min(sum, maxVal) : max(sum, minVal);
}
if (vel.is3D() && (flags.isFluid(i, j, k - 1) || (curFluid && flags.isEmpty(i, j, k - 1)))) {
Real forceMACZ = 0.5 * (force(i, j, k - 1).z + force(i, j, k).z);
Real min = std::min(vel(i, j, k).z, forceMACZ);
Real max = std::max(vel(i, j, k).z, forceMACZ);
Real sum = vel(i, j, k).z + forceMACZ;
vel(i, j, k).z = (forceMACZ > 0) ? std::min(sum, max) : std::max(sum, min);
minVal = min(vel(i, j, k).z, forceMACZ);
maxVal = max(vel(i, j, k).z, forceMACZ);
sum = vel(i, j, k).z + forceMACZ;
vel(i, j, k).z = (forceMACZ > 0) ? min(sum, maxVal) : max(sum, minVal);
}
}
inline const FlagGrid &getArg0()

View File

@@ -1138,11 +1138,15 @@ void solvePressureSystem(Grid<Real> &rhs,
// note: the last factor increases the max iterations for 2d, which right now can't use a
// preconditioner
GridCgInterface *gcg;
if (vel.is3D())
gcg = new GridCg<ApplyMatrix>(pressure, rhs, residual, search, flags, tmp, &A0, &Ai, &Aj, &Ak);
else
gcg = new GridCg<ApplyMatrix2D>(
pressure, rhs, residual, search, flags, tmp, &A0, &Ai, &Aj, &Ak);
vector<Grid<Real> *> matA{&A0, &Ai, &Aj};
if (vel.is3D()) {
matA.push_back(&Ak);
gcg = new GridCg<ApplyMatrix>(pressure, rhs, residual, search, flags, tmp, matA);
}
else {
gcg = new GridCg<ApplyMatrix2D>(pressure, rhs, residual, search, flags, tmp, matA);
}
gcg->setAccuracy(cgAccuracy);
gcg->setUseL2Norm(useL2Norm);

File diff suppressed because it is too large Load Diff

View File

@@ -576,8 +576,10 @@ void VICintegration(VortexSheetMesh &mesh,
// prepare CG solver
const int maxIter = (int)(cgMaxIterFac * vel.getSize().max());
vector<Grid<Real> *> matA{&A0, &Ai, &Aj, &Ak};
GridCgInterface *gcg = new GridCg<ApplyMatrix>(
solution, rhs, residual, search, flags, temp1, &A0, &Ai, &Aj, &Ak);
solution, rhs, residual, search, flags, temp1, matA);
gcg->setAccuracy(cgAccuracy);
gcg->setUseL2Norm(true);
gcg->setICPreconditioner(

View File

@@ -423,10 +423,15 @@ void cgSolveWE(const FlagGrid &flags,
const int maxIter = (int)(cgMaxIterFac * flags.getSize().max()) * (flags.is3D() ? 1 : 4);
GridCgInterface *gcg;
if (flags.is3D())
gcg = new GridCg<ApplyMatrix>(out, rhs, residual, search, flags, tmp, &A0, &Ai, &Aj, &Ak);
else
gcg = new GridCg<ApplyMatrix2D>(out, rhs, residual, search, flags, tmp, &A0, &Ai, &Aj, &Ak);
vector<Grid<Real> *> matA{&A0, &Ai, &Aj};
if (flags.is3D()) {
matA.push_back(&Ak);
gcg = new GridCg<ApplyMatrix>(out, rhs, residual, search, flags, tmp, matA);
}
else {
gcg = new GridCg<ApplyMatrix2D>(out, rhs, residual, search, flags, tmp, matA);
}
gcg->setAccuracy(cgAccuracy);

View File

@@ -145,6 +145,7 @@ extern void PbRegister_flipComputeSurfaceNormals();
extern void PbRegister_flipUpdateNeighborRatio();
extern void PbRegister_particleSurfaceTurbulence();
extern void PbRegister_debugCheckParts();
extern void PbRegister_applyViscosity();
extern void PbRegister_markAsFixed();
extern void PbRegister_texcoordInflow();
extern void PbRegister_meshSmokeInflow();
@@ -342,6 +343,7 @@ void MantaEnsureRegistration()
PbRegister_flipUpdateNeighborRatio();
PbRegister_particleSurfaceTurbulence();
PbRegister_debugCheckParts();
PbRegister_applyViscosity();
PbRegister_markAsFixed();
PbRegister_texcoordInflow();
PbRegister_meshSmokeInflow();

View File

@@ -14,7 +14,7 @@
# Standalone or with Blender
if(NOT WITH_BLENDER AND WITH_CYCLES_STANDALONE)
set(CYCLES_INSTALL_PATH "")
set(CYCLES_INSTALL_PATH ${CMAKE_INSTALL_PREFIX})
else()
set(WITH_CYCLES_BLENDER ON)
# WINDOWS_PYTHON_DEBUG needs to write into the user addons folder since it will
@@ -379,6 +379,9 @@ endif()
# Subdirectories
if(WITH_CYCLES_BLENDER)
# Not needed to make cycles automated tests pass with -march=native.
# However Blender itself needs this flag.
remove_cc_flag("-ffp-contract=off")
add_definitions(-DWITH_BLENDER_GUARDEDALLOC)
add_subdirectory(blender)
endif()

View File

@@ -133,12 +133,12 @@ static void scene_init()
/* Camera width/height override? */
if (!(options.width == 0 || options.height == 0)) {
options.scene->camera->width = options.width;
options.scene->camera->height = options.height;
options.scene->camera->set_full_width(options.width);
options.scene->camera->set_full_height(options.height);
}
else {
options.width = options.scene->camera->width;
options.height = options.scene->camera->height;
options.width = options.scene->camera->get_full_width();
options.height = options.scene->camera->get_full_height();
}
/* Calculate Viewplane */
@@ -233,7 +233,7 @@ static void display()
static void motion(int x, int y, int button)
{
if (options.interactive) {
Transform matrix = options.session->scene->camera->matrix;
Transform matrix = options.session->scene->camera->get_matrix();
/* Translate */
if (button == 0) {
@@ -251,8 +251,8 @@ static void motion(int x, int y, int button)
}
/* Update and Reset */
options.session->scene->camera->matrix = matrix;
options.session->scene->camera->need_update = true;
options.session->scene->camera->set_matrix(matrix);
options.session->scene->camera->need_flags_update = true;
options.session->scene->camera->need_device_update = true;
options.session->reset(session_buffer_params(), options.session_params.samples);
@@ -266,10 +266,10 @@ static void resize(int width, int height)
if (options.session) {
/* Update camera */
options.session->scene->camera->width = width;
options.session->scene->camera->height = height;
options.session->scene->camera->set_full_width(options.width);
options.session->scene->camera->set_full_height(options.height);
options.session->scene->camera->compute_auto_viewplane();
options.session->scene->camera->need_update = true;
options.session->scene->camera->need_flags_update = true;
options.session->scene->camera->need_device_update = true;
options.session->reset(session_buffer_params(), options.session_params.samples);
@@ -302,7 +302,7 @@ static void keyboard(unsigned char key)
/* Navigation */
else if (options.interactive && (key == 'w' || key == 'a' || key == 's' || key == 'd')) {
Transform matrix = options.session->scene->camera->matrix;
Transform matrix = options.session->scene->camera->get_matrix();
float3 translate;
if (key == 'w')
@@ -317,8 +317,8 @@ static void keyboard(unsigned char key)
matrix = matrix * transform_translate(translate);
/* Update and Reset */
options.session->scene->camera->matrix = matrix;
options.session->scene->camera->need_update = true;
options.session->scene->camera->set_matrix(matrix);
options.session->scene->camera->need_flags_update = true;
options.session->scene->camera->need_device_update = true;
options.session->reset(session_buffer_params(), options.session_params.samples);
@@ -345,10 +345,7 @@ static void keyboard(unsigned char key)
break;
}
options.session->scene->integrator->max_bounce = bounce;
/* Update and Reset */
options.session->scene->integrator->need_update = true;
options.session->scene->integrator->set_max_bounce(bounce);
options.session->reset(session_buffer_params(), options.session_params.samples);
}

View File

@@ -190,17 +190,18 @@ static void xml_read_camera(XMLReadState &state, xml_node node)
{
Camera *cam = state.scene->camera;
xml_read_int(&cam->width, node, "width");
xml_read_int(&cam->height, node, "height");
int width = -1, height = -1;
xml_read_int(&width, node, "width");
xml_read_int(&height, node, "height");
cam->full_width = cam->width;
cam->full_height = cam->height;
cam->set_full_width(width);
cam->set_full_height(height);
xml_read_node(state, cam, node);
cam->matrix = state.tfm;
cam->set_matrix(state.tfm);
cam->need_update = true;
cam->need_flags_update = true;
cam->update(state.scene);
}
@@ -338,11 +339,13 @@ static void xml_read_shader_graph(XMLReadState &state, Shader *shader, xml_node
if (node_name == "image_texture") {
ImageTextureNode *img = (ImageTextureNode *)snode;
img->filename = path_join(state.base, img->filename.string());
ustring filename(path_join(state.base, img->get_filename().string()));
img->set_filename(filename);
}
else if (node_name == "environment_texture") {
EnvironmentTextureNode *env = (EnvironmentTextureNode *)snode;
env->filename = path_join(state.base, env->filename.string());
ustring filename(path_join(state.base, env->get_filename().string()));
env->set_filename(filename);
}
if (snode) {
@@ -384,8 +387,8 @@ static Mesh *xml_add_mesh(Scene *scene, const Transform &tfm)
/* create object*/
Object *object = new Object();
object->geometry = mesh;
object->tfm = tfm;
object->set_geometry(mesh);
object->set_tfm(tfm);
scene->objects.push_back(object);
return mesh;
@@ -395,7 +398,9 @@ static void xml_read_mesh(const XMLReadState &state, xml_node node)
{
/* add mesh */
Mesh *mesh = xml_add_mesh(state.scene, state.tfm);
mesh->used_shaders.push_back(state.shader);
array<Node *> used_shaders = mesh->get_used_shaders();
used_shaders.push_back_slow(state.shader);
mesh->set_used_shaders(used_shaders);
/* read state */
int shader = 0;
@@ -411,20 +416,24 @@ static void xml_read_mesh(const XMLReadState &state, xml_node node)
xml_read_int_array(nverts, node, "nverts");
if (xml_equal_string(node, "subdivision", "catmull-clark")) {
mesh->subdivision_type = Mesh::SUBDIVISION_CATMULL_CLARK;
mesh->set_subdivision_type(Mesh::SUBDIVISION_CATMULL_CLARK);
}
else if (xml_equal_string(node, "subdivision", "linear")) {
mesh->subdivision_type = Mesh::SUBDIVISION_LINEAR;
mesh->set_subdivision_type(Mesh::SUBDIVISION_LINEAR);
}
if (mesh->subdivision_type == Mesh::SUBDIVISION_NONE) {
array<float3> P_array;
P_array = P;
if (mesh->get_subdivision_type() == Mesh::SUBDIVISION_NONE) {
/* create vertices */
mesh->verts = P;
mesh->set_verts(P_array);
size_t num_triangles = 0;
for (size_t i = 0; i < nverts.size(); i++)
num_triangles += nverts[i] - 2;
mesh->reserve_mesh(mesh->verts.size(), num_triangles);
mesh->reserve_mesh(mesh->get_verts().size(), num_triangles);
/* create triangles */
int index_offset = 0;
@@ -474,7 +483,7 @@ static void xml_read_mesh(const XMLReadState &state, xml_node node)
}
else {
/* create vertices */
mesh->verts = P;
mesh->set_verts(P_array);
size_t num_ngons = 0;
size_t num_corners = 0;
@@ -513,23 +522,20 @@ static void xml_read_mesh(const XMLReadState &state, xml_node node)
}
/* setup subd params */
if (!mesh->subd_params) {
mesh->subd_params = new SubdParams(mesh);
}
SubdParams &sdparams = *mesh->subd_params;
float dicing_rate = state.dicing_rate;
xml_read_float(&dicing_rate, node, "dicing_rate");
dicing_rate = std::max(0.1f, dicing_rate);
sdparams.dicing_rate = state.dicing_rate;
xml_read_float(&sdparams.dicing_rate, node, "dicing_rate");
sdparams.dicing_rate = std::max(0.1f, sdparams.dicing_rate);
sdparams.objecttoworld = state.tfm;
mesh->set_subd_dicing_rate(dicing_rate);
mesh->set_subd_objecttoworld(state.tfm);
}
/* we don't yet support arbitrary attributes, for now add vertex
* coordinates as generated coordinates if requested */
if (mesh->need_attribute(state.scene, ATTR_STD_GENERATED)) {
Attribute *attr = mesh->attributes.add(ATTR_STD_GENERATED);
memcpy(attr->data_float3(), mesh->verts.data(), sizeof(float3) * mesh->verts.size());
memcpy(
attr->data_float3(), mesh->get_verts().data(), sizeof(float3) * mesh->get_verts().size());
}
}
@@ -539,7 +545,7 @@ static void xml_read_light(XMLReadState &state, xml_node node)
{
Light *light = new Light();
light->shader = state.shader;
light->set_shader(state.shader);
xml_read_node(state, light, node);
state.scene->lights.push_back(light);

View File

@@ -59,6 +59,7 @@ class CyclesRender(bpy.types.RenderEngine):
bl_use_exclude_layers = True
bl_use_save_buffers = True
bl_use_spherical_stereo = True
bl_use_custom_freestyle = True
def __init__(self):
self.session = None

View File

@@ -282,7 +282,7 @@ def list_render_passes(scene, srl):
yield ("CryptoAsset" + '{:02d}'.format(i), "RGBA", 'COLOR')
# Denoising passes.
if crl.use_denoising or crl.denoising_store_passes:
if (scene.cycles.use_denoising and crl.use_denoising) or crl.denoising_store_passes:
yield ("Noisy Image", "RGBA", 'COLOR')
if crl.denoising_store_passes:
yield ("Denoising Normal", "XYZ", 'VECTOR')

View File

@@ -1443,6 +1443,7 @@ class CYCLES_LIGHT_PT_nodes(CyclesButtonsPanel, Panel):
class CYCLES_LIGHT_PT_spot(CyclesButtonsPanel, Panel):
bl_label = "Spot Shape"
bl_parent_id = "CYCLES_LIGHT_PT_light"
bl_context = "data"
@classmethod
@@ -1454,7 +1455,6 @@ class CYCLES_LIGHT_PT_spot(CyclesButtonsPanel, Panel):
layout = self.layout
light = context.light
layout.use_property_split = True
layout.use_property_decorate = False
col = layout.column()
col.prop(light, "spot_size", text="Size")
@@ -1969,9 +1969,11 @@ class CYCLES_RENDER_PT_bake_output(CyclesButtonsPanel, Panel):
if rd.bake_type == 'DISPLACEMENT':
layout.prop(rd, "use_bake_lores_mesh")
else:
layout.prop(cbk, "target")
layout.prop(cbk, "margin")
layout.prop(cbk, "use_clear", text="Clear Image")
if cbk.target == 'IMAGE_TEXTURES':
layout.prop(cbk, "margin")
layout.prop(cbk, "use_clear", text="Clear Image")
class CYCLES_RENDER_PT_debug(CyclesButtonsPanel, Panel):

View File

@@ -67,11 +67,10 @@ static bool ObtainCacheParticleData(
Transform tfm = get_transform(b_ob->matrix_world());
Transform itfm = transform_quick_inverse(tfm);
BL::Object::modifiers_iterator b_mod;
for (b_ob->modifiers.begin(b_mod); b_mod != b_ob->modifiers.end(); ++b_mod) {
if ((b_mod->type() == b_mod->type_PARTICLE_SYSTEM) &&
(background ? b_mod->show_render() : b_mod->show_viewport())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod->ptr);
for (BL::Modifier &b_mod : b_ob->modifiers) {
if ((b_mod.type() == b_mod.type_PARTICLE_SYSTEM) &&
(background ? b_mod.show_render() : b_mod.show_viewport())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod.ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
@@ -163,11 +162,10 @@ static bool ObtainCacheParticleUV(Hair *hair,
CData->curve_uv.clear();
BL::Object::modifiers_iterator b_mod;
for (b_ob->modifiers.begin(b_mod); b_mod != b_ob->modifiers.end(); ++b_mod) {
if ((b_mod->type() == b_mod->type_PARTICLE_SYSTEM) &&
(background ? b_mod->show_render() : b_mod->show_viewport())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod->ptr);
for (BL::Modifier &b_mod : b_ob->modifiers) {
if ((b_mod.type() == b_mod.type_PARTICLE_SYSTEM) &&
(background ? b_mod.show_render() : b_mod.show_viewport())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod.ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
@@ -226,11 +224,10 @@ static bool ObtainCacheParticleVcol(Hair *hair,
CData->curve_vcol.clear();
BL::Object::modifiers_iterator b_mod;
for (b_ob->modifiers.begin(b_mod); b_mod != b_ob->modifiers.end(); ++b_mod) {
if ((b_mod->type() == b_mod->type_PARTICLE_SYSTEM) &&
(background ? b_mod->show_render() : b_mod->show_viewport())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod->ptr);
for (BL::Modifier &b_mod : b_ob->modifiers) {
if ((b_mod.type() == b_mod.type_PARTICLE_SYSTEM) &&
(background ? b_mod.show_render() : b_mod.show_viewport())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod.ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
@@ -510,11 +507,10 @@ static void ExportCurveSegmentsMotion(Hair *hair, ParticleCurveData *CData, int
bool BlenderSync::object_has_particle_hair(BL::Object b_ob)
{
/* Test if the object has a particle modifier with hair. */
BL::Object::modifiers_iterator b_mod;
for (b_ob.modifiers.begin(b_mod); b_mod != b_ob.modifiers.end(); ++b_mod) {
if ((b_mod->type() == b_mod->type_PARTICLE_SYSTEM) &&
(preview ? b_mod->show_viewport() : b_mod->show_render())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod->ptr);
for (BL::Modifier &b_mod : b_ob.modifiers) {
if ((b_mod.type() == b_mod.type_PARTICLE_SYSTEM) &&
(preview ? b_mod.show_viewport() : b_mod.show_render())) {
BL::ParticleSystemModifier psmd((const PointerRNA)b_mod.ptr);
BL::ParticleSystem b_psys((const PointerRNA)psmd.particle_system().ptr);
BL::ParticleSettings b_part((const PointerRNA)b_psys.settings().ptr);
@@ -678,9 +674,7 @@ static void export_hair_curves(Scene *scene, Hair *hair, BL::Hair b_hair)
/* Export curves and points. */
vector<float> points_length;
BL::Hair::curves_iterator b_curve_iter;
for (b_hair.curves.begin(b_curve_iter); b_curve_iter != b_hair.curves.end(); ++b_curve_iter) {
BL::HairCurve b_curve = *b_curve_iter;
for (BL::HairCurve &b_curve : b_hair.curves) {
const int first_point_index = b_curve.first_point_index();
const int num_points = b_curve.num_points();
@@ -748,9 +742,7 @@ static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_st
int num_motion_keys = 0;
int curve_index = 0;
BL::Hair::curves_iterator b_curve_iter;
for (b_hair.curves.begin(b_curve_iter); b_curve_iter != b_hair.curves.end(); ++b_curve_iter) {
BL::HairCurve b_curve = *b_curve_iter;
for (BL::HairCurve &b_curve : b_hair.curves) {
const int first_point_index = b_curve.first_point_index();
const int num_points = b_curve.num_points();
@@ -855,10 +847,7 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Hair *ha
hair->set_value(socket, new_hair, socket);
}
hair->attributes.clear();
foreach (Attribute &attr, new_hair.attributes.attributes) {
hair->attributes.attributes.push_back(std::move(attr));
}
hair->attributes.update(std::move(new_hair.attributes));
/* tag update */

View File

@@ -43,42 +43,39 @@ int blender_device_threads(BL::Scene &b_scene)
DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scene, bool background)
{
if (BlenderSession::device_override != DEVICE_MASK_ALL) {
vector<DeviceInfo> devices = Device::available_devices(BlenderSession::device_override);
if (devices.empty()) {
return Device::dummy_device("Found no Cycles device of the specified type");
}
int threads = blender_device_threads(b_scene);
return Device::get_multi_device(devices, threads, background);
}
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
/* Find cycles preferences. */
PointerRNA cpreferences;
for (BL::Addon &b_addon : b_preferences.addons) {
if (b_addon.module() == "cycles") {
cpreferences = b_addon.preferences().ptr;
break;
}
}
/* Default to CPU device. */
DeviceInfo device = Device::available_devices(DEVICE_MASK_CPU).front();
if (get_enum(cscene, "device") == 2) {
if (BlenderSession::device_override != DEVICE_MASK_ALL) {
vector<DeviceInfo> devices = Device::available_devices(BlenderSession::device_override);
if (devices.empty()) {
device = Device::dummy_device("Found no Cycles device of the specified type");
}
else {
int threads = blender_device_threads(b_scene);
device = Device::get_multi_device(devices, threads, background);
}
}
else if (get_enum(cscene, "device") == 2) {
/* Find network device. */
vector<DeviceInfo> devices = Device::available_devices(DEVICE_MASK_NETWORK);
if (!devices.empty()) {
return devices.front();
device = devices.front();
}
}
else if (get_enum(cscene, "device") == 1) {
/* Find cycles preferences. */
PointerRNA cpreferences;
BL::Preferences::addons_iterator b_addon_iter;
for (b_preferences.addons.begin(b_addon_iter); b_addon_iter != b_preferences.addons.end();
++b_addon_iter) {
if (b_addon_iter->module() == "cycles") {
cpreferences = b_addon_iter->preferences().ptr;
break;
}
}
/* Test if we are using GPU devices. */
ComputeDevice compute_device = (ComputeDevice)get_enum(
cpreferences, "compute_device_type", COMPUTE_DEVICE_NUM, COMPUTE_DEVICE_CPU);
@@ -117,13 +114,13 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scen
device = Device::get_multi_device(used_devices, threads, background);
}
/* Else keep using the CPU device that was set before. */
if (!get_boolean(cpreferences, "peer_memory")) {
device.has_peer_memory = false;
}
}
}
if (!get_boolean(cpreferences, "peer_memory")) {
device.has_peer_memory = false;
}
return device;
}

View File

@@ -42,32 +42,20 @@ static Geometry::Type determine_geom_type(BL::Object &b_ob, bool use_particle_ha
return Geometry::MESH;
}
Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
BL::Object &b_ob,
BL::Object &b_ob_instance,
bool object_updated,
bool use_particle_hair,
TaskPool *task_pool)
array<Node *> BlenderSync::find_used_shaders(BL::Object &b_ob)
{
/* 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;
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. */
array<Node *> used_shaders;
BL::Object::material_slots_iterator slot;
for (b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) {
for (BL::MaterialSlot &b_slot : b_ob.material_slots) {
if (material_override) {
find_shader(material_override, used_shaders, default_shader);
}
else {
BL::ID b_material(slot->material());
BL::ID b_material(b_slot.material());
find_shader(b_material, used_shaders, default_shader);
}
}
@@ -79,6 +67,25 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
used_shaders.push_back_slow(default_shader);
}
return used_shaders;
}
Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
BL::Object &b_ob,
BL::Object &b_ob_instance,
bool object_updated,
bool use_particle_hair,
TaskPool *task_pool)
{
/* 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;
Geometry::Type geom_type = determine_geom_type(b_ob, use_particle_hair);
GeometryKey key(b_key_id.ptr.data, geom_type);
/* Find shader indices. */
array<Node *> used_shaders = find_used_shaders(b_ob);
/* Ensure we only sync instanced geometry once. */
Geometry *geom = geometry_map.find(key);
if (geom) {
@@ -124,7 +131,7 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
foreach (Node *node, geom->get_used_shaders()) {
Shader *shader = static_cast<Shader *>(node);
if (shader->need_update_geometry) {
if (shader->need_update_geometry()) {
attribute_recalc = true;
}
}

View File

@@ -285,12 +285,10 @@ static void attr_create_sculpt_vertex_color(Scene *scene,
BL::Mesh &b_mesh,
bool subdivision)
{
BL::Mesh::sculpt_vertex_colors_iterator l;
for (b_mesh.sculpt_vertex_colors.begin(l); l != b_mesh.sculpt_vertex_colors.end(); ++l) {
const bool active_render = l->active_render();
for (BL::MeshVertColorLayer &l : b_mesh.sculpt_vertex_colors) {
const bool active_render = l.active_render();
AttributeStandard vcol_std = (active_render) ? ATTR_STD_VERTEX_COLOR : ATTR_STD_NONE;
ustring vcol_name = ustring(l->name().c_str());
ustring vcol_name = ustring(l.name().c_str());
const bool need_vcol = mesh->need_attribute(scene, vcol_name) ||
mesh->need_attribute(scene, vcol_std);
@@ -307,7 +305,7 @@ static void attr_create_sculpt_vertex_color(Scene *scene,
int numverts = b_mesh.vertices.length();
for (int i = 0; i < numverts; i++) {
*(cdata++) = get_float4(l->data[i].color());
*(cdata++) = get_float4(l.data[i].color());
}
}
}
@@ -315,12 +313,10 @@ static void attr_create_sculpt_vertex_color(Scene *scene,
/* Create vertex color attributes. */
static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, bool subdivision)
{
BL::Mesh::vertex_colors_iterator l;
for (b_mesh.vertex_colors.begin(l); l != b_mesh.vertex_colors.end(); ++l) {
const bool active_render = l->active_render();
for (BL::MeshLoopColorLayer &l : b_mesh.vertex_colors) {
const bool active_render = l.active_render();
AttributeStandard vcol_std = (active_render) ? ATTR_STD_VERTEX_COLOR : ATTR_STD_NONE;
ustring vcol_name = ustring(l->name().c_str());
ustring vcol_name = ustring(l.name().c_str());
const bool need_vcol = mesh->need_attribute(scene, vcol_name) ||
mesh->need_attribute(scene, vcol_std);
@@ -339,13 +335,12 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
vcol_attr = mesh->subd_attributes.add(vcol_name, TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
}
BL::Mesh::polygons_iterator p;
uchar4 *cdata = vcol_attr->data_uchar4();
for (b_mesh.polygons.begin(p); p != b_mesh.polygons.end(); ++p) {
int n = p->loop_total();
for (BL::MeshPolygon &p : b_mesh.polygons) {
int n = p.loop_total();
for (int i = 0; i < n; i++) {
float4 color = get_float4(l->data[p->loop_start() + i].color());
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);
}
@@ -359,14 +354,13 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
vcol_attr = mesh->attributes.add(vcol_name, TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
}
BL::Mesh::loop_triangles_iterator t;
uchar4 *cdata = vcol_attr->data_uchar4();
for (b_mesh.loop_triangles.begin(t); t != b_mesh.loop_triangles.end(); ++t) {
int3 li = get_int3(t->loops());
float4 c1 = get_float4(l->data[li[0]].color());
float4 c2 = get_float4(l->data[li[1]].color());
float4 c3 = get_float4(l->data[li[2]].color());
for (BL::MeshLoopTriangle &t : b_mesh.loop_triangles) {
int3 li = get_int3(t.loops());
float4 c1 = get_float4(l.data[li[0]].color());
float4 c2 = get_float4(l.data[li[1]].color());
float4 c3 = get_float4(l.data[li[2]].color());
/* Compress/encode vertex color using the sRGB curve. */
cdata[0] = color_float4_to_uchar4(c1);
@@ -383,14 +377,12 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
static void attr_create_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh)
{
if (b_mesh.uv_layers.length() != 0) {
BL::Mesh::uv_layers_iterator l;
for (b_mesh.uv_layers.begin(l); l != b_mesh.uv_layers.end(); ++l) {
const bool active_render = l->active_render();
for (BL::MeshUVLoopLayer &l : b_mesh.uv_layers) {
const bool active_render = l.active_render();
AttributeStandard uv_std = (active_render) ? ATTR_STD_UV : ATTR_STD_NONE;
ustring uv_name = ustring(l->name().c_str());
ustring uv_name = ustring(l.name().c_str());
AttributeStandard tangent_std = (active_render) ? ATTR_STD_UV_TANGENT : ATTR_STD_NONE;
ustring tangent_name = ustring((string(l->name().c_str()) + ".tangent").c_str());
ustring tangent_name = ustring((string(l.name().c_str()) + ".tangent").c_str());
/* Denotes whether UV map was requested directly. */
const bool need_uv = mesh->need_attribute(scene, uv_name) ||
@@ -412,14 +404,13 @@ static void attr_create_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh)
uv_attr = mesh->attributes.add(uv_name, TypeFloat2, ATTR_ELEMENT_CORNER);
}
BL::Mesh::loop_triangles_iterator t;
float2 *fdata = uv_attr->data_float2();
for (b_mesh.loop_triangles.begin(t); t != b_mesh.loop_triangles.end(); ++t) {
int3 li = get_int3(t->loops());
fdata[0] = get_float2(l->data[li[0]].uv());
fdata[1] = get_float2(l->data[li[1]].uv());
fdata[2] = get_float2(l->data[li[2]].uv());
for (BL::MeshLoopTriangle &t : b_mesh.loop_triangles) {
int3 li = get_int3(t.loops());
fdata[0] = get_float2(l.data[li[0]].uv());
fdata[1] = get_float2(l.data[li[1]].uv());
fdata[2] = get_float2(l.data[li[2]].uv());
fdata += 3;
}
}
@@ -427,10 +418,10 @@ static void attr_create_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh)
/* UV tangent */
if (need_tangent) {
AttributeStandard sign_std = (active_render) ? ATTR_STD_UV_TANGENT_SIGN : ATTR_STD_NONE;
ustring sign_name = ustring((string(l->name().c_str()) + ".tangent_sign").c_str());
ustring sign_name = ustring((string(l.name().c_str()) + ".tangent_sign").c_str());
bool need_sign = (mesh->need_attribute(scene, sign_name) ||
mesh->need_attribute(scene, sign_std));
mikk_compute_tangents(b_mesh, l->name().c_str(), mesh, need_sign, active_render);
mikk_compute_tangents(b_mesh, l.name().c_str(), mesh, need_sign, active_render);
}
/* Remove temporarily created UV attribute. */
if (!need_uv && uv_attr != NULL) {
@@ -480,13 +471,12 @@ static void attr_create_subd_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
uv_attr->flags |= ATTR_SUBDIVIDED;
}
BL::Mesh::polygons_iterator p;
float2 *fdata = uv_attr->data_float2();
for (b_mesh.polygons.begin(p); p != b_mesh.polygons.end(); ++p) {
int n = p->loop_total();
for (BL::MeshPolygon &p : b_mesh.polygons) {
int n = p.loop_total();
for (int j = 0; j < n; j++) {
*(fdata++) = get_float2(l->data[p->loop_start() + j].uv());
*(fdata++) = get_float2(l->data[p.loop_start() + j].uv());
}
}
}
@@ -706,9 +696,8 @@ static void attr_create_random_per_island(Scene *scene,
DisjointSet vertices_sets(number_of_vertices);
BL::Mesh::edges_iterator e;
for (b_mesh.edges.begin(e); e != b_mesh.edges.end(); ++e) {
vertices_sets.join(e->vertices()[0], e->vertices()[1]);
for (BL::MeshEdge &e : b_mesh.edges) {
vertices_sets.join(e.vertices()[0], e.vertices()[1]);
}
AttributeSet &attributes = (subdivision) ? mesh->subd_attributes : mesh->attributes;
@@ -716,15 +705,13 @@ static void attr_create_random_per_island(Scene *scene,
float *data = attribute->data_float();
if (!subdivision) {
BL::Mesh::loop_triangles_iterator t;
for (b_mesh.loop_triangles.begin(t); t != b_mesh.loop_triangles.end(); ++t) {
data[t->index()] = hash_uint_to_float(vertices_sets.find(t->vertices()[0]));
for (BL::MeshLoopTriangle &t : b_mesh.loop_triangles) {
data[t.index()] = hash_uint_to_float(vertices_sets.find(t.vertices()[0]));
}
}
else {
BL::Mesh::polygons_iterator p;
for (b_mesh.polygons.begin(p); p != b_mesh.polygons.end(); ++p) {
data[p->index()] = hash_uint_to_float(vertices_sets.find(p->vertices()[0]));
for (BL::MeshPolygon &p : b_mesh.polygons) {
data[p.index()] = hash_uint_to_float(vertices_sets.find(p.vertices()[0]));
}
}
}
@@ -756,10 +743,9 @@ static void create_mesh(Scene *scene,
numtris = numfaces;
}
else {
BL::Mesh::polygons_iterator p;
for (b_mesh.polygons.begin(p); p != b_mesh.polygons.end(); ++p) {
numngons += (p->loop_total() == 4) ? 0 : 1;
numcorners += p->loop_total();
for (BL::MeshPolygon &p : b_mesh.polygons) {
numngons += (p.loop_total() == 4) ? 0 : 1;
numcorners += p.loop_total();
}
}
@@ -803,17 +789,15 @@ static void create_mesh(Scene *scene,
/* create faces */
if (!subdivision) {
BL::Mesh::loop_triangles_iterator t;
for (b_mesh.loop_triangles.begin(t); t != b_mesh.loop_triangles.end(); ++t) {
BL::MeshPolygon p = b_mesh.polygons[t->polygon_index()];
int3 vi = get_int3(t->vertices());
for (BL::MeshLoopTriangle &t : b_mesh.loop_triangles) {
BL::MeshPolygon p = b_mesh.polygons[t.polygon_index()];
int3 vi = get_int3(t.vertices());
int shader = clamp(p.material_index(), 0, used_shaders.size() - 1);
bool smooth = p.use_smooth() || use_loop_normals;
if (use_loop_normals) {
BL::Array<float, 9> loop_normals = t->split_normals();
BL::Array<float, 9> loop_normals = t.split_normals();
for (int i = 0; i < 3; i++) {
N[vi[i]] = make_float3(
loop_normals[i * 3], loop_normals[i * 3 + 1], loop_normals[i * 3 + 2]);
@@ -828,18 +812,17 @@ static void create_mesh(Scene *scene,
}
}
else {
BL::Mesh::polygons_iterator p;
vector<int> vi;
for (b_mesh.polygons.begin(p); p != b_mesh.polygons.end(); ++p) {
int n = p->loop_total();
int shader = clamp(p->material_index(), 0, used_shaders.size() - 1);
bool smooth = p->use_smooth() || use_loop_normals;
for (BL::MeshPolygon &p : b_mesh.polygons) {
int n = p.loop_total();
int shader = clamp(p.material_index(), 0, used_shaders.size() - 1);
bool smooth = p.use_smooth() || use_loop_normals;
vi.resize(n);
for (int i = 0; i < n; i++) {
/* NOTE: Autosmooth is already taken care about. */
vi[i] = b_mesh.loops[p->loop_start() + i].vertex_index();
vi[i] = b_mesh.loops[p.loop_start() + i].vertex_index();
}
/* create subd faces */
@@ -891,19 +874,18 @@ static void create_subd_mesh(Scene *scene,
/* export creases */
size_t num_creases = 0;
BL::Mesh::edges_iterator e;
for (b_mesh.edges.begin(e); e != b_mesh.edges.end(); ++e) {
if (e->crease() != 0.0f) {
for (BL::MeshEdge &e : b_mesh.edges) {
if (e.crease() != 0.0f) {
num_creases++;
}
}
mesh->reserve_subd_creases(num_creases);
for (b_mesh.edges.begin(e); e != b_mesh.edges.end(); ++e) {
if (e->crease() != 0.0f) {
mesh->add_crease(e->vertices()[0], e->vertices()[1], e->crease());
for (BL::MeshEdge &e : b_mesh.edges) {
if (e.crease() != 0.0f) {
mesh->add_crease(e.vertices()[0], e.vertices()[1], e.crease());
}
}
@@ -1075,15 +1057,8 @@ void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *me
mesh->set_value(socket, new_mesh, socket);
}
mesh->attributes.clear();
foreach (Attribute &attr, new_mesh.attributes.attributes) {
mesh->attributes.attributes.push_back(std::move(attr));
}
mesh->subd_attributes.clear();
foreach (Attribute &attr, new_mesh.subd_attributes.attributes) {
mesh->subd_attributes.attributes.push_back(std::move(attr));
}
mesh->attributes.update(std::move(new_mesh.attributes));
mesh->subd_attributes.update(std::move(new_mesh.subd_attributes));
mesh->set_num_subd_faces(new_mesh.get_num_subd_faces());

View File

@@ -51,10 +51,11 @@ bool BlenderSync::BKE_object_is_modified(BL::Object &b_ob)
}
else {
/* object level material links */
BL::Object::material_slots_iterator slot;
for (b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot)
if (slot->link() == BL::MaterialSlot::link_OBJECT)
for (BL::MaterialSlot &b_slot : b_ob.material_slots) {
if (b_slot.link() == BL::MaterialSlot::link_OBJECT) {
return true;
}
}
}
return false;
@@ -243,9 +244,6 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
/* holdout */
object->set_use_holdout(use_holdout);
if (object->use_holdout_is_modified()) {
scene->object_manager->tag_update(scene);
}
object->set_visibility(visibility);
@@ -351,6 +349,10 @@ static bool lookup_property(BL::ID b_id, const string &name, float4 *r_value)
return false;
}
if (prop == NULL) {
return false;
}
PropertyType type = RNA_property_type(prop);
int arraylen = RNA_property_array_length(&ptr, prop);

View File

@@ -57,7 +57,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object &b_ob,
/* no update needed? */
if (!need_update && !object->get_geometry()->is_modified() &&
!scene->object_manager->need_update)
!scene->object_manager->need_update())
return true;
/* first time used in this sync loop? clear and tag update */
@@ -85,7 +85,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object &b_ob,
object->set_particle_index(psys->particles.size() - 1);
if (object->particle_index_is_modified())
scene->object_manager->tag_update(scene);
scene->object_manager->tag_update(scene, ObjectManager::PARTICLE_MODIFIED);
/* return that this object has particle data */
return true;

View File

@@ -597,22 +597,19 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
bool removed;
do {
BL::Node::inputs_iterator b_input;
BL::Node::outputs_iterator b_output;
removed = false;
for (b_node.inputs.begin(b_input); b_input != b_node.inputs.end(); ++b_input) {
if (used_sockets.find(b_input->ptr.data) == used_sockets.end()) {
b_node.inputs.remove(b_data, *b_input);
for (BL::NodeSocket &b_input : b_node.inputs) {
if (used_sockets.find(b_input.ptr.data) == used_sockets.end()) {
b_node.inputs.remove(b_data, b_input);
removed = true;
break;
}
}
for (b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) {
if (used_sockets.find(b_output->ptr.data) == used_sockets.end()) {
b_node.outputs.remove(b_data, *b_output);
for (BL::NodeSocket &b_output : b_node.outputs) {
if (used_sockets.find(b_output.ptr.data) == used_sockets.end()) {
b_node.outputs.remove(b_data, b_output);
removed = true;
break;
}

View File

@@ -358,11 +358,7 @@ void BlenderSession::do_write_update_render_tile(RenderTile &rtile,
if (do_read_only) {
/* copy each pass */
BL::RenderLayer::passes_iterator b_iter;
for (b_rlay.passes.begin(b_iter); b_iter != b_rlay.passes.end(); ++b_iter) {
BL::RenderPass b_pass(*b_iter);
for (BL::RenderPass &b_pass : b_rlay.passes) {
/* find matching pass type */
PassType pass_type = BlenderSync::get_pass_type(b_pass);
int components = b_pass.channels();
@@ -552,7 +548,6 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
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);
}
/* Update number of samples per layer. */
@@ -736,10 +731,7 @@ void BlenderSession::do_write_update_render_result(BL::RenderLayer &b_rlay,
if (!do_update_only) {
/* copy each pass */
BL::RenderLayer::passes_iterator b_iter;
for (b_rlay.passes.begin(b_iter); b_iter != b_rlay.passes.end(); ++b_iter) {
BL::RenderPass b_pass(*b_iter);
for (BL::RenderPass &b_pass : b_rlay.passes) {
int components = b_pass.channels();
/* Copy pixels from regular render passes. */
@@ -1116,10 +1108,6 @@ void BlenderSession::update_resumable_tile_manager(int num_samples)
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

@@ -148,15 +148,13 @@ BlenderAttributeType blender_attribute_name_split_type(ustring name, string *r_r
static BL::NodeSocket get_node_output(BL::Node &b_node, const string &name)
{
BL::Node::outputs_iterator b_out;
for (b_node.outputs.begin(b_out); b_out != b_node.outputs.end(); ++b_out)
if (b_out->name() == name)
return *b_out;
for (BL::NodeSocket &b_out : b_node.outputs) {
if (b_out.name() == name) {
return b_out;
}
}
assert(0);
return *b_out;
return *b_node.outputs.begin();
}
static float3 get_node_output_rgba(BL::Node &b_node, const string &name)
@@ -723,9 +721,8 @@ static ShaderNode *add_node(Scene *scene,
image->set_alpha_type(get_image_alpha_type(b_image));
array<int> tiles;
BL::Image::tiles_iterator b_iter;
for (b_image.tiles.begin(b_iter); b_iter != b_image.tiles.end(); ++b_iter) {
tiles.push_back_slow(b_iter->number());
for (BL::UDIMTile &b_tile : b_image.tiles) {
tiles.push_back_slow(b_tile.number());
}
image->set_tiles(tiles);
@@ -885,7 +882,7 @@ static ShaderNode *add_node(Scene *scene,
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_altitude(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());
@@ -1012,18 +1009,18 @@ static ShaderInput *node_find_input_by_name(ShaderNode *node,
string name = b_socket.name();
if (node_use_modified_socket_name(node)) {
BL::Node::inputs_iterator b_input;
bool found = false;
int counter = 0, total = 0;
for (b_node.inputs.begin(b_input); b_input != b_node.inputs.end(); ++b_input) {
if (b_input->name() == name) {
if (!found)
for (BL::NodeSocket &b_input : b_node.inputs) {
if (b_input.name() == name) {
if (!found) {
counter++;
}
total++;
}
if (b_input->ptr.data == b_socket.ptr.data)
if (b_input.ptr.data == b_socket.ptr.data)
found = true;
}
@@ -1045,19 +1042,20 @@ static ShaderOutput *node_find_output_by_name(ShaderNode *node,
string name = b_socket.name();
if (node_use_modified_socket_name(node)) {
BL::Node::outputs_iterator b_output;
bool found = false;
int counter = 0, total = 0;
for (b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) {
if (b_output->name() == name) {
if (!found)
for (BL::NodeSocket &b_output : b_node.outputs) {
if (b_output.name() == name) {
if (!found) {
counter++;
}
total++;
}
if (b_output->ptr.data == b_socket.ptr.data)
if (b_output.ptr.data == b_socket.ptr.data) {
found = true;
}
}
/* rename if needed */
@@ -1082,25 +1080,19 @@ static void add_nodes(Scene *scene,
const ProxyMap &proxy_output_map)
{
/* add nodes */
BL::ShaderNodeTree::nodes_iterator b_node;
PtrInputMap input_map;
PtrOutputMap output_map;
BL::Node::inputs_iterator b_input;
BL::Node::outputs_iterator b_output;
/* find the node to use for output if there are multiple */
BL::ShaderNode output_node = b_ntree.get_output_node(
BL::ShaderNodeOutputMaterial::target_CYCLES);
/* add nodes */
for (b_ntree.nodes.begin(b_node); b_node != b_ntree.nodes.end(); ++b_node) {
if (b_node->mute() || b_node->is_a(&RNA_NodeReroute)) {
for (BL::Node &b_node : b_ntree.nodes) {
if (b_node.mute() || b_node.is_a(&RNA_NodeReroute)) {
/* replace muted node with internal links */
BL::Node::internal_links_iterator b_link;
for (b_node->internal_links.begin(b_link); b_link != b_node->internal_links.end();
++b_link) {
BL::NodeSocket to_socket(b_link->to_socket());
for (BL::NodeLink &b_link : b_node.internal_links) {
BL::NodeSocket to_socket(b_link.to_socket());
SocketType::Type to_socket_type = convert_socket_type(to_socket);
if (to_socket_type == SocketType::UNDEFINED) {
continue;
@@ -1108,22 +1100,22 @@ static void add_nodes(Scene *scene,
ConvertNode *proxy = graph->create_node<ConvertNode>(to_socket_type, to_socket_type, true);
input_map[b_link->from_socket().ptr.data] = proxy->inputs[0];
output_map[b_link->to_socket().ptr.data] = proxy->outputs[0];
input_map[b_link.from_socket().ptr.data] = proxy->inputs[0];
output_map[b_link.to_socket().ptr.data] = proxy->outputs[0];
graph->add(proxy);
}
}
else if (b_node->is_a(&RNA_ShaderNodeGroup) || b_node->is_a(&RNA_NodeCustomGroup) ||
b_node->is_a(&RNA_ShaderNodeCustomGroup)) {
else if (b_node.is_a(&RNA_ShaderNodeGroup) || b_node.is_a(&RNA_NodeCustomGroup) ||
b_node.is_a(&RNA_ShaderNodeCustomGroup)) {
BL::ShaderNodeTree b_group_ntree(PointerRNA_NULL);
if (b_node->is_a(&RNA_ShaderNodeGroup))
b_group_ntree = BL::ShaderNodeTree(((BL::NodeGroup)(*b_node)).node_tree());
else if (b_node->is_a(&RNA_NodeCustomGroup))
b_group_ntree = BL::ShaderNodeTree(((BL::NodeCustomGroup)(*b_node)).node_tree());
if (b_node.is_a(&RNA_ShaderNodeGroup))
b_group_ntree = BL::ShaderNodeTree(((BL::NodeGroup)(b_node)).node_tree());
else if (b_node.is_a(&RNA_NodeCustomGroup))
b_group_ntree = BL::ShaderNodeTree(((BL::NodeCustomGroup)(b_node)).node_tree());
else
b_group_ntree = BL::ShaderNodeTree(((BL::ShaderNodeCustomGroup)(*b_node)).node_tree());
b_group_ntree = BL::ShaderNodeTree(((BL::ShaderNodeCustomGroup)(b_node)).node_tree());
ProxyMap group_proxy_input_map, group_proxy_output_map;
@@ -1131,8 +1123,8 @@ static void add_nodes(Scene *scene,
* Do this even if the node group has no internal tree,
* so that links have something to connect to and assert won't fail.
*/
for (b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) {
SocketType::Type input_type = convert_socket_type(*b_input);
for (BL::NodeSocket &b_input : b_node.inputs) {
SocketType::Type input_type = convert_socket_type(b_input);
if (input_type == SocketType::UNDEFINED) {
continue;
}
@@ -1141,14 +1133,14 @@ static void add_nodes(Scene *scene,
graph->add(proxy);
/* register the proxy node for internal binding */
group_proxy_input_map[b_input->identifier()] = proxy;
group_proxy_input_map[b_input.identifier()] = proxy;
input_map[b_input->ptr.data] = proxy->inputs[0];
input_map[b_input.ptr.data] = proxy->inputs[0];
set_default_value(proxy->inputs[0], *b_input, b_data, b_ntree);
set_default_value(proxy->inputs[0], b_input, b_data, b_ntree);
}
for (b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) {
SocketType::Type output_type = convert_socket_type(*b_output);
for (BL::NodeSocket &b_output : b_node.outputs) {
SocketType::Type output_type = convert_socket_type(b_output);
if (output_type == SocketType::UNDEFINED) {
continue;
}
@@ -1157,9 +1149,9 @@ static void add_nodes(Scene *scene,
graph->add(proxy);
/* register the proxy node for internal binding */
group_proxy_output_map[b_output->identifier()] = proxy;
group_proxy_output_map[b_output.identifier()] = proxy;
output_map[b_output->ptr.data] = proxy->outputs[0];
output_map[b_output.ptr.data] = proxy->outputs[0];
}
if (b_group_ntree) {
@@ -1174,30 +1166,30 @@ static void add_nodes(Scene *scene,
group_proxy_output_map);
}
}
else if (b_node->is_a(&RNA_NodeGroupInput)) {
else if (b_node.is_a(&RNA_NodeGroupInput)) {
/* map each socket to a proxy node */
for (b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) {
ProxyMap::const_iterator proxy_it = proxy_input_map.find(b_output->identifier());
for (BL::NodeSocket &b_output : b_node.outputs) {
ProxyMap::const_iterator proxy_it = proxy_input_map.find(b_output.identifier());
if (proxy_it != proxy_input_map.end()) {
ConvertNode *proxy = proxy_it->second;
output_map[b_output->ptr.data] = proxy->outputs[0];
output_map[b_output.ptr.data] = proxy->outputs[0];
}
}
}
else if (b_node->is_a(&RNA_NodeGroupOutput)) {
BL::NodeGroupOutput b_output_node(*b_node);
else if (b_node.is_a(&RNA_NodeGroupOutput)) {
BL::NodeGroupOutput b_output_node(b_node);
/* only the active group output is used */
if (b_output_node.is_active_output()) {
/* map each socket to a proxy node */
for (b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) {
ProxyMap::const_iterator proxy_it = proxy_output_map.find(b_input->identifier());
for (BL::NodeSocket &b_input : b_node.inputs) {
ProxyMap::const_iterator proxy_it = proxy_output_map.find(b_input.identifier());
if (proxy_it != proxy_output_map.end()) {
ConvertNode *proxy = proxy_it->second;
input_map[b_input->ptr.data] = proxy->inputs[0];
input_map[b_input.ptr.data] = proxy->inputs[0];
set_default_value(proxy->inputs[0], *b_input, b_data, b_ntree);
set_default_value(proxy->inputs[0], b_input, b_data, b_ntree);
}
}
}
@@ -1205,52 +1197,49 @@ static void add_nodes(Scene *scene,
else {
ShaderNode *node = NULL;
if (b_node->ptr.data == output_node.ptr.data) {
if (b_node.ptr.data == output_node.ptr.data) {
node = graph->output();
}
else {
BL::ShaderNode b_shader_node(*b_node);
BL::ShaderNode b_shader_node(b_node);
node = add_node(
scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree, b_shader_node);
}
if (node) {
/* map node sockets for linking */
for (b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) {
ShaderInput *input = node_find_input_by_name(node, *b_node, *b_input);
for (BL::NodeSocket &b_input : b_node.inputs) {
ShaderInput *input = node_find_input_by_name(node, b_node, b_input);
if (!input) {
/* XXX should not happen, report error? */
continue;
}
input_map[b_input->ptr.data] = input;
input_map[b_input.ptr.data] = input;
set_default_value(input, *b_input, b_data, b_ntree);
set_default_value(input, b_input, b_data, b_ntree);
}
for (b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) {
ShaderOutput *output = node_find_output_by_name(node, *b_node, *b_output);
for (BL::NodeSocket &b_output : b_node.outputs) {
ShaderOutput *output = node_find_output_by_name(node, b_node, b_output);
if (!output) {
/* XXX should not happen, report error? */
continue;
}
output_map[b_output->ptr.data] = output;
output_map[b_output.ptr.data] = output;
}
}
}
}
/* connect nodes */
BL::NodeTree::links_iterator b_link;
for (b_ntree.links.begin(b_link); b_link != b_ntree.links.end(); ++b_link) {
for (BL::NodeLink &b_link : b_ntree.links) {
/* Ignore invalid links to avoid unwanted cycles created in graph.
* Also ignore links with unavailable sockets. */
if (!(b_link->is_valid() && b_link->from_socket().enabled() &&
b_link->to_socket().enabled())) {
if (!(b_link.is_valid() && b_link.from_socket().enabled() && b_link.to_socket().enabled())) {
continue;
}
/* get blender link data */
BL::NodeSocket b_from_sock = b_link->from_socket();
BL::NodeSocket b_to_sock = b_link->to_socket();
BL::NodeSocket b_from_sock = b_link.from_socket();
BL::NodeSocket b_to_sock = b_link.to_socket();
ShaderOutput *output = 0;
ShaderInput *input = 0;
@@ -1298,13 +1287,12 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
TaskPool pool;
set<Shader *> updated_shaders;
BL::Depsgraph::ids_iterator b_id;
for (b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) {
if (!b_id->is_a(&RNA_Material)) {
for (BL::ID &b_id : b_depsgraph.ids) {
if (!b_id.is_a(&RNA_Material)) {
continue;
}
BL::Material b_mat(*b_id);
BL::Material b_mat(b_id);
Shader *shader;
/* test if we need to sync */
@@ -1497,7 +1485,6 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
shader->set_graph(graph);
shader->tag_update(scene);
background->tag_update(scene);
}
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
@@ -1517,8 +1504,7 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
viewport_parameters.custom_viewport_parameters());
background->set_use_ao(background->get_use_ao() && view_layer.use_background_ao);
if (background->is_modified())
background->tag_update(scene);
background->tag_update(scene);
}
/* Sync Lights */
@@ -1527,13 +1513,12 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all)
{
shader_map.set_default(scene->default_light);
BL::Depsgraph::ids_iterator b_id;
for (b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) {
if (!b_id->is_a(&RNA_Light)) {
for (BL::ID &b_id : b_depsgraph.ids) {
if (!b_id.is_a(&RNA_Light)) {
continue;
}
BL::Light b_light(*b_id);
BL::Light b_light(b_id);
Shader *shader;
/* test if we need to sync */

View File

@@ -24,6 +24,7 @@
#include "render/mesh.h"
#include "render/nodes.h"
#include "render/object.h"
#include "render/procedural.h"
#include "render/scene.h"
#include "render/shader.h"
@@ -131,9 +132,8 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
}
/* Iterate over all IDs in this depsgraph. */
BL::Depsgraph::updates_iterator b_update;
for (b_depsgraph.updates.begin(b_update); b_update != b_depsgraph.updates.end(); ++b_update) {
BL::ID b_id(b_update->id());
for (BL::DepsgraphUpdate &b_update : b_depsgraph.updates) {
BL::ID b_id(b_update.id());
/* Material */
if (b_id.is_a(&RNA_Material)) {
@@ -151,17 +151,17 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
const bool is_geometry = object_is_geometry(b_ob);
const bool is_light = !is_geometry && object_is_light(b_ob);
if (b_ob.is_instancer() && b_update->is_updated_shading()) {
if (b_ob.is_instancer() && b_update.is_updated_shading()) {
/* Needed for e.g. object color updates on instancer. */
object_map.set_recalc(b_ob);
}
if (is_geometry || is_light) {
const bool updated_geometry = b_update->is_updated_geometry();
const bool updated_geometry = b_update.is_updated_geometry();
/* Geometry (mesh, hair, volume). */
if (is_geometry) {
if (b_update->is_updated_transform() || b_update->is_updated_shading()) {
if (b_update.is_updated_transform() || b_update.is_updated_shading()) {
object_map.set_recalc(b_ob);
}
@@ -181,7 +181,7 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
}
/* Light */
else if (is_light) {
if (b_update->is_updated_transform() || b_update->is_updated_shading()) {
if (b_update.is_updated_transform() || b_update.is_updated_shading()) {
object_map.set_recalc(b_ob);
light_map.set_recalc(b_ob);
}
@@ -302,11 +302,6 @@ void BlenderSync::sync_integrator()
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());
}
@@ -375,8 +370,8 @@ void BlenderSync::sync_integrator()
integrator->set_ao_bounces(0);
}
if (integrator->is_modified())
integrator->tag_update(scene);
/* UPDATE_NONE as we don't want to tag the integrator as modified, just tag dependent things */
integrator->tag_update(scene, Integrator::UPDATE_NONE);
}
/* Film */
@@ -471,16 +466,15 @@ void BlenderSync::sync_images()
return;
}
/* Free buffers used by images which are not needed for render. */
BL::BlendData::images_iterator b_image;
for (b_data.images.begin(b_image); b_image != b_data.images.end(); ++b_image) {
for (BL::Image &b_image : b_data.images) {
/* TODO(sergey): Consider making it an utility function to check
* whether image is considered builtin.
*/
const bool is_builtin = b_image->packed_file() ||
b_image->source() == BL::Image::source_GENERATED ||
b_image->source() == BL::Image::source_MOVIE || b_engine.is_preview();
const bool is_builtin = b_image.packed_file() ||
b_image.source() == BL::Image::source_GENERATED ||
b_image.source() == BL::Image::source_MOVIE || b_engine.is_preview();
if (is_builtin == false) {
b_image->buffers_free();
b_image.buffers_free();
}
/* TODO(sergey): Free builtin images not used by any shader. */
}
@@ -581,10 +575,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
vector<Pass> passes;
/* loop over passes */
BL::RenderLayer::passes_iterator b_pass_iter;
for (b_rlay.passes.begin(b_pass_iter); b_pass_iter != b_rlay.passes.end(); ++b_pass_iter) {
BL::RenderPass b_pass(*b_pass_iter);
for (BL::RenderPass &b_pass : b_rlay.passes) {
PassType pass_type = get_pass_type(b_pass);
if (pass_type == PASS_MOTION && scene->integrator->get_motion_blur())
@@ -729,7 +720,7 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold());
scene->film->tag_passes_update(scene, passes);
scene->integrator->tag_update(scene);
scene->integrator->tag_update(scene, Integrator::UPDATE_ALL);
return passes;
}
@@ -752,9 +743,8 @@ void BlenderSync::free_data_after_sync(BL::Depsgraph &b_depsgraph)
/* TODO(sergey): We can actually remove the whole dependency graph,
* but that will need some API support first.
*/
BL::Depsgraph::objects_iterator b_ob;
for (b_depsgraph.objects.begin(b_ob); b_ob != b_depsgraph.objects.end(); ++b_ob) {
b_ob->cache_release();
for (BL::Object &b_ob : b_depsgraph.objects) {
b_ob.cache_release();
}
}
@@ -853,7 +843,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
preview_samples = preview_samples * preview_samples;
}
if (get_enum(cscene, "progressive") == 0 && (params.device.type != DEVICE_OPTIX)) {
if (get_enum(cscene, "progressive") == 0 && params.device.has_branched_path) {
if (background) {
params.samples = aa_samples;
}

View File

@@ -134,6 +134,7 @@ class BlenderSync {
void sync_view();
/* Shader */
array<Node *> find_used_shaders(BL::Object &b_ob);
void sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, bool update_all);
void sync_shaders(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d);
void sync_nodes(Shader *shader, BL::ShaderNodeTree &b_ntree);

View File

@@ -538,11 +538,9 @@ static inline bool object_use_deform_motion(BL::Object &b_parent, BL::Object &b_
static inline BL::FluidDomainSettings object_fluid_liquid_domain_find(BL::Object &b_ob)
{
BL::Object::modifiers_iterator b_mod;
for (b_ob.modifiers.begin(b_mod); b_mod != b_ob.modifiers.end(); ++b_mod) {
if (b_mod->is_a(&RNA_FluidModifier)) {
BL::FluidModifier b_mmd(*b_mod);
for (BL::Modifier &b_mod : b_ob.modifiers) {
if (b_mod.is_a(&RNA_FluidModifier)) {
BL::FluidModifier b_mmd(b_mod);
if (b_mmd.fluid_type() == BL::FluidModifier::fluid_type_DOMAIN &&
b_mmd.domain_settings().domain_type() == BL::FluidDomainSettings::domain_type_LIQUID) {
@@ -556,11 +554,9 @@ static inline BL::FluidDomainSettings object_fluid_liquid_domain_find(BL::Object
static inline BL::FluidDomainSettings object_fluid_gas_domain_find(BL::Object &b_ob)
{
BL::Object::modifiers_iterator b_mod;
for (b_ob.modifiers.begin(b_mod); b_mod != b_ob.modifiers.end(); ++b_mod) {
if (b_mod->is_a(&RNA_FluidModifier)) {
BL::FluidModifier b_mmd(*b_mod);
for (BL::Modifier &b_mod : b_ob.modifiers) {
if (b_mod.is_a(&RNA_FluidModifier)) {
BL::FluidModifier b_mmd(b_mod);
if (b_mmd.fluid_type() == BL::FluidModifier::fluid_type_DOMAIN &&
b_mmd.domain_settings().domain_type() == BL::FluidDomainSettings::domain_type_GAS) {

View File

@@ -222,9 +222,7 @@ class BlenderVolumeLoader : public VDBImageLoader {
b_volume.grids.load(b_data.ptr.data);
#ifdef WITH_OPENVDB
BL::Volume::grids_iterator b_grid_iter;
for (b_volume.grids.begin(b_grid_iter); b_grid_iter != b_volume.grids.end(); ++b_grid_iter) {
BL::VolumeGrid b_volume_grid(*b_grid_iter);
for (BL::VolumeGrid &b_volume_grid : b_volume.grids) {
if (b_volume_grid.name() == grid_name) {
const bool unload = !b_volume_grid.is_loaded();
@@ -260,9 +258,7 @@ static void sync_volume_object(BL::BlendData &b_data,
volume->set_object_space((b_render.space() == BL::VolumeRender::space_OBJECT));
/* Find grid with matching name. */
BL::Volume::grids_iterator b_grid_iter;
for (b_volume.grids.begin(b_grid_iter); b_grid_iter != b_volume.grids.end(); ++b_grid_iter) {
BL::VolumeGrid b_grid = *b_grid_iter;
for (BL::VolumeGrid &b_grid : b_volume.grids) {
ustring name = ustring(b_grid.name());
AttributeStandard std = ATTR_STD_NONE;

View File

@@ -682,6 +682,7 @@ void BVHEmbree::refit(Progress &progress)
if (mesh->num_triangles() > 0) {
RTCGeometry geom = rtcGetGeometry(scene, geom_id);
set_tri_vertex_buffer(geom, mesh, true);
rtcSetGeometryUserData(geom, (void *)mesh->optix_prim_offset);
rtcCommitGeometry(geom);
}
}
@@ -690,6 +691,7 @@ void BVHEmbree::refit(Progress &progress)
if (hair->num_curves() > 0) {
RTCGeometry geom = rtcGetGeometry(scene, geom_id + 1);
set_curve_vertex_buffer(geom, hair, true);
rtcSetGeometryUserData(geom, (void *)hair->optix_prim_offset);
rtcCommitGeometry(geom);
}
}

View File

@@ -742,6 +742,7 @@ void CUDADevice::move_textures_to_host(size_t size, bool for_texture)
size_t max_size = 0;
bool max_is_image = false;
thread_scoped_lock lock(cuda_mem_map_mutex);
foreach (CUDAMemMap::value_type &pair, cuda_mem_map) {
device_memory &mem = *pair.first;
CUDAMem *cmem = &pair.second;
@@ -773,6 +774,7 @@ void CUDADevice::move_textures_to_host(size_t size, bool for_texture)
max_mem = &mem;
}
}
lock.unlock();
/* Move to host memory. This part is mutex protected since
* multiple CUDA devices could be moving the memory. The
@@ -894,6 +896,7 @@ CUDADevice::CUDAMem *CUDADevice::generic_alloc(device_memory &mem, size_t pitch_
}
/* Insert into map of allocations. */
thread_scoped_lock lock(cuda_mem_map_mutex);
CUDAMem *cmem = &cuda_mem_map[&mem];
if (shared_pointer != 0) {
/* Replace host pointer with our host allocation. Only works if
@@ -935,6 +938,7 @@ void CUDADevice::generic_copy_to(device_memory &mem)
/* If use_mapped_host of mem is false, the current device only uses device memory allocated by
* cuMemAlloc regardless of mem.host_pointer and mem.shared_pointer, and should copy data from
* mem.host_pointer. */
thread_scoped_lock lock(cuda_mem_map_mutex);
if (!cuda_mem_map[&mem].use_mapped_host || mem.host_pointer != mem.shared_pointer) {
const CUDAContextScope scope(this);
cuda_assert(
@@ -946,6 +950,7 @@ void CUDADevice::generic_free(device_memory &mem)
{
if (mem.device_pointer) {
CUDAContextScope scope(this);
thread_scoped_lock lock(cuda_mem_map_mutex);
const CUDAMem &cmem = cuda_mem_map[&mem];
/* If cmem.use_mapped_host is true, reference counting is used
@@ -990,7 +995,6 @@ void CUDADevice::mem_alloc(device_memory &mem)
assert(!"mem_alloc not supported for global memory.");
}
else {
thread_scoped_lock lock(cuda_mem_map_mutex);
generic_alloc(mem);
}
}
@@ -1009,7 +1013,6 @@ void CUDADevice::mem_copy_to(device_memory &mem)
tex_alloc((device_texture &)mem);
}
else {
thread_scoped_lock lock(cuda_mem_map_mutex);
if (!mem.device_pointer) {
generic_alloc(mem);
}
@@ -1073,7 +1076,6 @@ void CUDADevice::mem_free(device_memory &mem)
tex_free((device_texture &)mem);
}
else {
thread_scoped_lock lock(cuda_mem_map_mutex);
generic_free(mem);
}
}
@@ -1097,7 +1099,6 @@ void CUDADevice::const_copy_to(const char *name, void *host, size_t size)
void CUDADevice::global_alloc(device_memory &mem)
{
if (mem.is_resident(this)) {
thread_scoped_lock lock(cuda_mem_map_mutex);
generic_alloc(mem);
generic_copy_to(mem);
}
@@ -1108,7 +1109,6 @@ void CUDADevice::global_alloc(device_memory &mem)
void CUDADevice::global_free(device_memory &mem)
{
if (mem.is_resident(this) && mem.device_pointer) {
thread_scoped_lock lock(cuda_mem_map_mutex);
generic_free(mem);
}
}
@@ -1177,9 +1177,8 @@ void CUDADevice::tex_alloc(device_texture &mem)
size_t src_pitch = mem.data_width * dsize * mem.data_elements;
size_t dst_pitch = src_pitch;
thread_scoped_lock lock(cuda_mem_map_mutex);
if (!mem.is_resident(this)) {
thread_scoped_lock lock(cuda_mem_map_mutex);
cmem = &cuda_mem_map[&mem];
cmem->texobject = 0;
@@ -1229,6 +1228,7 @@ void CUDADevice::tex_alloc(device_texture &mem)
mem.device_size = size;
stats.mem_alloc(size);
thread_scoped_lock lock(cuda_mem_map_mutex);
cmem = &cuda_mem_map[&mem];
cmem->texobject = 0;
cmem->array = array_3d;
@@ -1266,9 +1266,6 @@ void CUDADevice::tex_alloc(device_texture &mem)
cuda_assert(cuMemcpyHtoD(mem.device_pointer, mem.host_pointer, size));
}
/* Unlock mutex before resizing texture info, since that may attempt to lock it again. */
lock.unlock();
/* Resize once */
const uint slot = mem.slot;
if (slot >= texture_info.size()) {
@@ -1317,9 +1314,7 @@ void CUDADevice::tex_alloc(device_texture &mem)
texDesc.filterMode = filter_mode;
texDesc.flags = CU_TRSF_NORMALIZED_COORDINATES;
/* Lock again and refresh the data pointer (in case another thread modified the map in the
* meantime). */
lock.lock();
thread_scoped_lock lock(cuda_mem_map_mutex);
cmem = &cuda_mem_map[&mem];
cuda_assert(cuTexObjectCreate(&cmem->texobject, &resDesc, &texDesc, NULL));
@@ -1357,6 +1352,7 @@ void CUDADevice::tex_free(device_texture &mem)
cuda_mem_map.erase(cuda_mem_map.find(&mem));
}
else {
lock.unlock();
generic_free(mem);
}
}
@@ -1929,18 +1925,19 @@ void CUDADevice::render(DeviceTask &task, RenderTile &rtile, device_vector<WorkT
}
uint step_samples = divide_up(min_blocks * num_threads_per_block, wtile->w * wtile->h);
if (task.adaptive_sampling.use) {
step_samples = task.adaptive_sampling.align_static_samples(step_samples);
}
/* Render all samples. */
int start_sample = rtile.start_sample;
int end_sample = rtile.start_sample + rtile.num_samples;
for (int sample = start_sample; sample < end_sample; sample += step_samples) {
for (int sample = start_sample; sample < end_sample;) {
/* Setup and copy work tile to device. */
wtile->start_sample = sample;
wtile->num_samples = min(step_samples, end_sample - sample);
wtile->num_samples = step_samples;
if (task.adaptive_sampling.use) {
wtile->num_samples = task.adaptive_sampling.align_samples(sample, step_samples);
}
wtile->num_samples = min(wtile->num_samples, end_sample - sample);
work_tiles.copy_to_device();
CUdeviceptr d_work_tiles = (CUdeviceptr)work_tiles.device_pointer;
@@ -1962,7 +1959,8 @@ void CUDADevice::render(DeviceTask &task, RenderTile &rtile, device_vector<WorkT
cuda_assert(cuCtxSynchronize());
/* Update progress. */
rtile.sample = sample + wtile->num_samples;
sample += wtile->num_samples;
rtile.sample = sample;
task.update_progress(&rtile, rtile.w * rtile.h * wtile->num_samples);
if (task.get_cancel()) {

View File

@@ -620,6 +620,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
info.has_half_images = true;
info.has_volume_decoupled = true;
info.has_branched_path = true;
info.has_adaptive_stop_per_sample = true;
info.has_osl = true;
info.has_profiling = true;
@@ -665,6 +666,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
/* Accumulate device info. */
info.has_half_images &= device.has_half_images;
info.has_volume_decoupled &= device.has_volume_decoupled;
info.has_branched_path &= device.has_branched_path;
info.has_adaptive_stop_per_sample &= device.has_adaptive_stop_per_sample;
info.has_osl &= device.has_osl;
info.has_profiling &= device.has_profiling;

View File

@@ -79,6 +79,7 @@ class DeviceInfo {
bool display_device; /* GPU is used as a display device. */
bool has_half_images; /* Support half-float textures. */
bool has_volume_decoupled; /* Decoupled volume shading. */
bool has_branched_path; /* Supports branched path tracing. */
bool has_adaptive_stop_per_sample; /* Per-sample adaptive sampling stopping. */
bool has_osl; /* Support Open Shading Language. */
bool use_split_kernel; /* Use split or mega kernel. */
@@ -99,6 +100,7 @@ class DeviceInfo {
display_device = false;
has_half_images = false;
has_volume_decoupled = false;
has_branched_path = true;
has_adaptive_stop_per_sample = false;
has_osl = false;
use_split_kernel = false;

View File

@@ -920,8 +920,7 @@ class CPUDevice : public Device {
ccl_global float *buffer = render_buffer + index * kernel_data.film.pass_stride;
if (buffer[kernel_data.film.pass_sample_count] < 0.0f) {
buffer[kernel_data.film.pass_sample_count] = -buffer[kernel_data.film.pass_sample_count];
float sample_multiplier = tile.sample / max((float)tile.start_sample + 1.0f,
buffer[kernel_data.film.pass_sample_count]);
float sample_multiplier = tile.sample / buffer[kernel_data.film.pass_sample_count];
if (sample_multiplier != 1.0f) {
kernel_adaptive_post_adjust(kg, buffer, sample_multiplier);
}
@@ -952,7 +951,7 @@ class CPUDevice : public Device {
SIMD_SET_FLUSH_TO_ZERO;
for (int sample = start_sample; sample < end_sample; sample++) {
if (task.get_cancel() || task_pool.canceled()) {
if (task.get_cancel() || TaskPool::canceled()) {
if (task.need_finish_queue == false)
break;
}
@@ -997,7 +996,7 @@ class CPUDevice : public Device {
coverage.finalize();
}
if (task.adaptive_sampling.use) {
if (task.adaptive_sampling.use && (tile.stealing_state != RenderTile::WAS_STOLEN)) {
adaptive_sampling_post(tile, kg);
}
}
@@ -1250,7 +1249,7 @@ class CPUDevice : public Device {
void thread_render(DeviceTask &task)
{
if (task_pool.canceled()) {
if (TaskPool::canceled()) {
if (task.need_finish_queue == false)
return;
}
@@ -1320,7 +1319,7 @@ class CPUDevice : public Device {
task.release_tile(tile);
if (task_pool.canceled()) {
if (TaskPool::canceled()) {
if (task.need_finish_queue == false)
break;
}
@@ -1417,7 +1416,7 @@ class CPUDevice : public Device {
task.offset,
sample);
if (task.get_cancel() || task_pool.canceled())
if (task.get_cancel() || TaskPool::canceled())
break;
task.update_progress(NULL);

View File

@@ -259,6 +259,8 @@ class device_memory {
device_ptr original_device_ptr;
size_t original_device_size;
Device *original_device;
bool need_realloc_;
bool modified;
};
/* Device Only Memory
@@ -329,6 +331,8 @@ template<typename T> class device_vector : public device_memory {
{
data_type = device_type_traits<T>::data_type;
data_elements = device_type_traits<T>::num_elements;
modified = true;
need_realloc_ = true;
assert(data_elements > 0);
}
@@ -347,6 +351,7 @@ template<typename T> class device_vector : public device_memory {
device_free();
host_free();
host_pointer = host_alloc(sizeof(T) * new_size);
modified = true;
assert(device_pointer == 0);
}
@@ -400,6 +405,19 @@ template<typename T> class device_vector : public device_memory {
assert(device_pointer == 0);
}
void give_data(array<T> &to)
{
device_free();
to.set_data((T *)host_pointer, data_size);
data_size = 0;
data_width = 0;
data_height = 0;
data_depth = 0;
host_pointer = 0;
assert(device_pointer == 0);
}
/* Free device and host memory. */
void free()
{
@@ -411,10 +429,40 @@ template<typename T> class device_vector : public device_memory {
data_height = 0;
data_depth = 0;
host_pointer = 0;
modified = true;
need_realloc_ = true;
assert(device_pointer == 0);
}
size_t size()
void free_if_need_realloc(bool force_free)
{
if (need_realloc_ || force_free) {
free();
}
}
bool is_modified() const
{
return modified;
}
bool need_realloc()
{
return need_realloc_;
}
void tag_modified()
{
modified = true;
}
void tag_realloc()
{
need_realloc_ = true;
tag_modified();
}
size_t size() const
{
return data_size;
}
@@ -432,7 +480,24 @@ template<typename T> class device_vector : public device_memory {
void copy_to_device()
{
device_copy_to();
if (data_size != 0) {
device_copy_to();
}
}
void copy_to_device_if_modified()
{
if (!modified) {
return;
}
copy_to_device();
}
void clear_modified()
{
modified = false;
need_realloc_ = false;
}
void copy_from_device()

View File

@@ -248,11 +248,14 @@ class MultiDevice : public Device {
void build_bvh(BVH *bvh, Progress &progress, bool refit) override
{
/* Try to build and share a single acceleration structure, if possible */
if (bvh->params.bvh_layout == BVH_LAYOUT_BVH2) {
if (bvh->params.bvh_layout == BVH_LAYOUT_BVH2 || bvh->params.bvh_layout == BVH_LAYOUT_EMBREE) {
devices.back().device->build_bvh(bvh, progress, refit);
return;
}
assert(bvh->params.bvh_layout == BVH_LAYOUT_MULTI_OPTIX ||
bvh->params.bvh_layout == BVH_LAYOUT_MULTI_OPTIX_EMBREE);
BVHMulti *const bvh_multi = static_cast<BVHMulti *>(bvh);
bvh_multi->sub_bvhs.resize(devices.size());

View File

@@ -151,8 +151,6 @@ string device_opencl_capabilities()
platform_ids.resize(num_platforms);
opencl_assert(clGetPlatformIDs(num_platforms, &platform_ids[0], NULL));
typedef char cl_string[1024];
# define APPEND_INFO(func, id, name, what, type) \
do { \
type data; \
@@ -160,22 +158,33 @@ string device_opencl_capabilities()
opencl_assert(func(id, what, sizeof(data), &data, NULL)); \
result += string_printf("%s: %s\n", name, to_string(data).c_str()); \
} while (false)
# define APPEND_STRING_EXTENSION_INFO(func, id, name, what) \
# define APPEND_STRING_INFO_IMPL(func, id, name, what, is_optional) \
do { \
char data[1024] = "\0"; \
string value; \
size_t length = 0; \
if (func(id, what, sizeof(data), &data, &length) == CL_SUCCESS) { \
if (length != 0 && data[0] != '\0') { \
result += string_printf("%s: %s\n", name, data); \
if (func(id, what, 0, NULL, &length) == CL_SUCCESS) { \
vector<char> buffer(length + 1); \
if (func(id, what, buffer.size(), buffer.data(), NULL) == CL_SUCCESS) { \
value = string(buffer.data()); \
} \
} \
if (is_optional && !(length != 0 && value[0] != '\0')) { \
break; \
} \
result += string_printf("%s: %s\n", name, value.c_str()); \
} while (false)
# define APPEND_PLATFORM_STRING_INFO(id, name, what) \
APPEND_STRING_INFO_IMPL(clGetPlatformInfo, id, "\tPlatform " name, what, false)
# define APPEND_STRING_EXTENSION_INFO(func, id, name, what) \
APPEND_STRING_INFO_IMPL(clGetPlatformInfo, id, "\tPlatform " name, what, true)
# define APPEND_PLATFORM_INFO(id, name, what, type) \
APPEND_INFO(clGetPlatformInfo, id, "\tPlatform " name, what, type)
# define APPEND_DEVICE_INFO(id, name, what, type) \
APPEND_INFO(clGetDeviceInfo, id, "\t\t\tDevice " name, what, type)
# define APPEND_DEVICE_STRING_INFO(id, name, what) \
APPEND_STRING_INFO_IMPL(clGetDeviceInfo, id, "\t\t\tDevice " name, what, false)
# define APPEND_DEVICE_STRING_EXTENSION_INFO(id, name, what) \
APPEND_STRING_EXTENSION_INFO(clGetDeviceInfo, id, "\t\t\tDevice " name, what)
APPEND_STRING_INFO_IMPL(clGetDeviceInfo, id, "\t\t\tDevice " name, what, true)
vector<cl_device_id> device_ids;
for (cl_uint platform = 0; platform < num_platforms; ++platform) {
@@ -183,11 +192,11 @@ string device_opencl_capabilities()
result += string_printf("Platform #%u\n", platform);
APPEND_PLATFORM_INFO(platform_id, "Name", CL_PLATFORM_NAME, cl_string);
APPEND_PLATFORM_INFO(platform_id, "Vendor", CL_PLATFORM_VENDOR, cl_string);
APPEND_PLATFORM_INFO(platform_id, "Version", CL_PLATFORM_VERSION, cl_string);
APPEND_PLATFORM_INFO(platform_id, "Profile", CL_PLATFORM_PROFILE, cl_string);
APPEND_PLATFORM_INFO(platform_id, "Extensions", CL_PLATFORM_EXTENSIONS, cl_string);
APPEND_PLATFORM_STRING_INFO(platform_id, "Name", CL_PLATFORM_NAME);
APPEND_PLATFORM_STRING_INFO(platform_id, "Vendor", CL_PLATFORM_VENDOR);
APPEND_PLATFORM_STRING_INFO(platform_id, "Version", CL_PLATFORM_VERSION);
APPEND_PLATFORM_STRING_INFO(platform_id, "Profile", CL_PLATFORM_PROFILE);
APPEND_PLATFORM_STRING_INFO(platform_id, "Extensions", CL_PLATFORM_EXTENSIONS);
cl_uint num_devices = 0;
opencl_assert(
@@ -202,13 +211,13 @@ string device_opencl_capabilities()
result += string_printf("\t\tDevice: #%u\n", device);
APPEND_DEVICE_INFO(device_id, "Name", CL_DEVICE_NAME, cl_string);
APPEND_DEVICE_STRING_INFO(device_id, "Name", CL_DEVICE_NAME);
APPEND_DEVICE_STRING_EXTENSION_INFO(device_id, "Board Name", CL_DEVICE_BOARD_NAME_AMD);
APPEND_DEVICE_INFO(device_id, "Vendor", CL_DEVICE_VENDOR, cl_string);
APPEND_DEVICE_INFO(device_id, "OpenCL C Version", CL_DEVICE_OPENCL_C_VERSION, cl_string);
APPEND_DEVICE_INFO(device_id, "Profile", CL_DEVICE_PROFILE, cl_string);
APPEND_DEVICE_INFO(device_id, "Version", CL_DEVICE_VERSION, cl_string);
APPEND_DEVICE_INFO(device_id, "Extensions", CL_DEVICE_EXTENSIONS, cl_string);
APPEND_DEVICE_STRING_INFO(device_id, "Vendor", CL_DEVICE_VENDOR);
APPEND_DEVICE_STRING_INFO(device_id, "OpenCL C Version", CL_DEVICE_OPENCL_C_VERSION);
APPEND_DEVICE_STRING_INFO(device_id, "Profile", CL_DEVICE_PROFILE);
APPEND_DEVICE_STRING_INFO(device_id, "Version", CL_DEVICE_VERSION);
APPEND_DEVICE_STRING_INFO(device_id, "Extensions", CL_DEVICE_EXTENSIONS);
APPEND_DEVICE_INFO(
device_id, "Max clock frequency (MHz)", CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint);
APPEND_DEVICE_INFO(device_id, "Max compute units", CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint);
@@ -216,9 +225,14 @@ string device_opencl_capabilities()
}
}
# undef APPEND_STRING_INFO
# undef APPEND_INFO
# undef APPEND_STRING_INFO_IMPL
# undef APPEND_PLATFORM_STRING_INFO
# undef APPEND_STRING_EXTENSION_INFO
# undef APPEND_PLATFORM_INFO
# undef APPEND_DEVICE_INFO
# undef APPEND_DEVICE_STRING_INFO
# undef APPEND_DEVICE_STRING_EXTENSION_INFO
return result;
}

View File

@@ -314,6 +314,14 @@ class OptiXDevice : public CUDADevice {
common_cflags += string_printf(" -I\"%s/include\"", optix_sdk_path);
}
// Specialization for shader raytracing
if (requested_features.use_shader_raytrace) {
common_cflags += " --keep-device-functions";
}
else {
common_cflags += " -D __NO_SHADER_RAYTRACE__";
}
return common_cflags;
}
@@ -752,9 +760,6 @@ class OptiXDevice : public CUDADevice {
const int end_sample = rtile.start_sample + rtile.num_samples;
// Keep this number reasonable to avoid running into TDRs
int step_samples = (info.display_device ? 8 : 32);
if (task.adaptive_sampling.use) {
step_samples = task.adaptive_sampling.align_static_samples(step_samples);
}
// Offset into launch params buffer so that streams use separate data
device_ptr launch_params_ptr = launch_params.device_pointer +
@@ -762,10 +767,14 @@ class OptiXDevice : public CUDADevice {
const CUDAContextScope scope(cuContext);
for (int sample = rtile.start_sample; sample < end_sample; sample += step_samples) {
for (int sample = rtile.start_sample; sample < end_sample;) {
// Copy work tile information to device
wtile.num_samples = min(step_samples, end_sample - sample);
wtile.start_sample = sample;
wtile.num_samples = step_samples;
if (task.adaptive_sampling.use) {
wtile.num_samples = task.adaptive_sampling.align_samples(sample, step_samples);
}
wtile.num_samples = min(wtile.num_samples, end_sample - sample);
device_ptr d_wtile_ptr = launch_params_ptr + offsetof(KernelParams, tile);
check_result_cuda(
cuMemcpyHtoDAsync(d_wtile_ptr, &wtile, sizeof(wtile), cuda_stream[thread_index]));
@@ -807,7 +816,8 @@ class OptiXDevice : public CUDADevice {
check_result_cuda(cuStreamSynchronize(cuda_stream[thread_index]));
// Update current sample, so it is displayed correctly
rtile.sample = wtile.start_sample + wtile.num_samples;
sample += wtile.num_samples;
rtile.sample = sample;
// Update task progress after the kernel completed rendering
task.update_progress(&rtile, wtile.w * wtile.h * wtile.num_samples);
@@ -1240,6 +1250,12 @@ class OptiXDevice : public CUDADevice {
void build_bvh(BVH *bvh, Progress &progress, bool refit) override
{
if (bvh->params.bvh_layout == BVH_LAYOUT_BVH2) {
/* For baking CUDA is used, build appropriate BVH for that. */
Device::build_bvh(bvh, progress, refit);
return;
}
BVHOptiX *const bvh_optix = static_cast<BVHOptiX *>(bvh);
progress.set_substatus("Building OptiX acceleration structure");
@@ -1500,11 +1516,24 @@ class OptiXDevice : public CUDADevice {
}
else {
unsigned int num_instances = 0;
unsigned int max_num_instances = 0xFFFFFFFF;
bvh_optix->as_data.free();
bvh_optix->traversable_handle = 0;
bvh_optix->motion_transform_data.free();
optixDeviceContextGetProperty(context,
OPTIX_DEVICE_PROPERTY_LIMIT_MAX_INSTANCE_ID,
&max_num_instances,
sizeof(max_num_instances));
// Do not count first bit, which is used to distinguish instanced and non-instanced objects
max_num_instances >>= 1;
if (bvh->objects.size() > max_num_instances) {
progress.set_error(
"Failed to build OptiX acceleration structure because there are too many instances");
return;
}
// Fill instance descriptions
# if OPTIX_ABI_VERSION < 41
device_vector<OptixAabb> aabbs(this, "optix tlas aabbs", MEM_READ_ONLY);
@@ -1558,8 +1587,8 @@ class OptiXDevice : public CUDADevice {
instance.transform[5] = 1.0f;
instance.transform[10] = 1.0f;
// Set user instance ID to object index
instance.instanceId = ob->get_device_index();
// Set user instance ID to object index (but leave low bit blank)
instance.instanceId = ob->get_device_index() << 1;
// Have to have at least one bit in the mask, or else instance would always be culled
instance.visibilityMask = 1;
@@ -1665,9 +1694,9 @@ class OptiXDevice : public CUDADevice {
else {
// Disable instance transform if geometry already has it applied to vertex data
instance.flags = OPTIX_INSTANCE_FLAG_DISABLE_TRANSFORM;
// Non-instanced objects read ID from prim_object, so
// distinguish them from instanced objects with high bit set
instance.instanceId |= 0x800000;
// Non-instanced objects read ID from 'prim_object', so distinguish
// them from instanced objects with the low bit set
instance.instanceId |= 1;
}
}
}
@@ -1828,6 +1857,7 @@ void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo
info.type = DEVICE_OPTIX;
info.id += "_OptiX";
info.denoisers |= DENOISER_OPTIX;
info.has_branched_path = false;
devices.push_back(info);
}

View File

@@ -223,8 +223,8 @@ bool DeviceSplitKernel::path_trace(DeviceTask &task,
subtile.num_samples = samples_per_second;
if (task.adaptive_sampling.use) {
subtile.num_samples = task.adaptive_sampling.align_dynamic_samples(subtile.start_sample,
subtile.num_samples);
subtile.num_samples = task.adaptive_sampling.align_samples(subtile.start_sample,
subtile.num_samples);
}
/* Don't go beyond requested number of samples. */

View File

@@ -144,41 +144,20 @@ AdaptiveSampling::AdaptiveSampling() : use(true), adaptive_step(0), min_samples(
}
/* Render samples in steps that align with the adaptive filtering. */
int AdaptiveSampling::align_static_samples(int samples) const
int AdaptiveSampling::align_samples(int sample, int num_samples) const
{
if (samples > adaptive_step) {
/* Make multiple of adaptive_step. */
while (samples % adaptive_step != 0) {
samples--;
}
int end_sample = sample + num_samples;
/* Round down end sample to the nearest sample that needs filtering. */
end_sample &= ~(adaptive_step - 1);
if (end_sample <= sample) {
/* In order to reach the next sample that needs filtering, we'd need
* to increase num_samples. We don't do that in this function, so
* just keep it as is and don't filter this time around. */
return num_samples;
}
else if (samples < adaptive_step) {
/* Make divisor of adaptive_step. */
while (adaptive_step % samples != 0) {
samples--;
}
}
return max(samples, 1);
}
/* Render samples in steps that align with the adaptive filtering, with the
* suggested number of samples dynamically changing. */
int AdaptiveSampling::align_dynamic_samples(int offset, int samples) const
{
/* Round so that we end up on multiples of adaptive_samples. */
samples += offset;
if (samples > adaptive_step) {
/* Make multiple of adaptive_step. */
while (samples % adaptive_step != 0) {
samples--;
}
}
samples -= offset;
return max(samples, 1);
return end_sample - sample;
}
bool AdaptiveSampling::need_filter(int sample) const

View File

@@ -100,7 +100,9 @@ class DenoiseParams {
neighbor_frames = 2;
clamp_input = true;
input_passes = DENOISER_INPUT_RGB_ALBEDO_NORMAL;
/* Default to color + albedo only, since normal input does not always have the desired effect
* when denoising with OptiX. */
input_passes = DENOISER_INPUT_RGB_ALBEDO;
start_sample = 0;
}
@@ -117,8 +119,7 @@ class AdaptiveSampling {
public:
AdaptiveSampling();
int align_static_samples(int samples) const;
int align_dynamic_samples(int offset, int samples) const;
int align_samples(int sample, int num_samples) const;
bool need_filter(int sample) const;
bool use;

View File

@@ -454,7 +454,7 @@ ccl_device_inline bool cylinder_culling_test(const float2 p1, const float2 p2, c
/* Performs culling against a cylinder. */
const float2 dp = p2 - p1;
const float num = dp.x * p1.y - dp.y * p1.x;
const float den2 = dot(p2 - p1, p2 - p1);
const float den2 = dot(dp, dp);
return num * num <= r * r * den2;
}
@@ -571,46 +571,46 @@ ccl_device_inline bool ribbon_intersect(const float3 ray_org,
for (int i = 0; i < N; i++) {
const float u = i * step_size;
const float4 p1 = catmull_rom_basis_eval(curve, u + step_size);
bool valid = cylinder_culling_test(
const bool valid = cylinder_culling_test(
make_float2(p0.x, p0.y), make_float2(p1.x, p1.y), max(p0.w, p1.w));
if (!valid) {
continue;
}
/* Evaluate next point. */
float3 dp1dt = float4_to_float3(catmull_rom_basis_derivative(curve, u + step_size));
dp1dt = (max3(fabs(dp1dt)) < eps) ? float4_to_float3(p1 - p0) : dp1dt;
const float3 wn1 = normalize(make_float3(dp1dt.y, -dp1dt.x, 0.0f)) * p1.w;
/* Construct quad coordinates. */
const float3 lp0 = float4_to_float3(p0) + wn0;
const float3 lp1 = float4_to_float3(p1) + wn1;
const float3 up0 = float4_to_float3(p0) - wn0;
const float3 up1 = float4_to_float3(p1) - wn1;
if (valid) {
/* Construct quad coordinates. */
const float3 lp0 = float4_to_float3(p0) + wn0;
const float3 lp1 = float4_to_float3(p1) + wn1;
const float3 up0 = float4_to_float3(p0) - wn0;
const float3 up1 = float4_to_float3(p1) - wn1;
/* Intersect quad. */
float vu, vv, vt;
bool valid0 = ribbon_intersect_quad(isect->t, lp0, lp1, up1, up0, &vu, &vv, &vt);
if (valid0) {
/* ignore self intersections */
const float avoidance_factor = 2.0f;
if (avoidance_factor != 0.0f) {
float r = mix(p0.w, p1.w, vu);
valid0 = vt > avoidance_factor * r;
}
/* Intersect quad. */
float vu, vv, vt;
bool valid0 = ribbon_intersect_quad(isect->t, lp0, lp1, up1, up0, &vu, &vv, &vt);
if (valid0) {
vv = 2.0f * vv - 1.0f;
/* ignore self intersections */
const float avoidance_factor = 2.0f;
if (avoidance_factor != 0.0f) {
float r = mix(p0.w, p1.w, vu);
valid0 = vt > avoidance_factor * r;
}
/* Record intersection. */
isect->t = vt;
isect->u = u + vu * step_size;
isect->v = vv;
return true;
if (valid0) {
vv = 2.0f * vv - 1.0f;
/* Record intersection. */
isect->t = vt;
isect->u = u + vu * step_size;
isect->v = vv;
return true;
}
}
}
/* Store point for next step. */
p0 = p1;
wn0 = wn1;
}

View File

@@ -214,13 +214,6 @@ ccl_device_inline float3 object_location(KernelGlobals *kg, const ShaderData *sd
#endif
}
/* Total surface area of object */
ccl_device_inline float object_surface_area(KernelGlobals *kg, int object)
{
return kernel_tex_fetch(__objects, object).surface_area;
}
/* Color of the object */
ccl_device_inline float3 object_color(KernelGlobals *kg, int object)
@@ -328,7 +321,7 @@ ccl_device_inline float object_volume_density(KernelGlobals *kg, int object)
return 1.0f;
}
return kernel_tex_fetch(__objects, object).surface_area;
return kernel_tex_fetch(__objects, object).volume_density;
}
ccl_device_inline float object_volume_step_size(KernelGlobals *kg, int object)

View File

@@ -1461,7 +1461,7 @@ typedef struct KernelObject {
Transform tfm;
Transform itfm;
float surface_area;
float volume_density;
float pass_id;
float random_number;
float color[3];

View File

@@ -139,7 +139,7 @@ kernel_cuda_adaptive_scale_samples(WorkTile *tile, int start_sample, int sample,
ccl_global float *buffer = tile->buffer + index * kernel_data.film.pass_stride;
if(buffer[kernel_data.film.pass_sample_count] < 0.0f) {
buffer[kernel_data.film.pass_sample_count] = -buffer[kernel_data.film.pass_sample_count];
float sample_multiplier = sample / max((float)start_sample + 1.0f, buffer[kernel_data.film.pass_sample_count]);
float sample_multiplier = sample / buffer[kernel_data.film.pass_sample_count];
if(sample_multiplier != 1.0f) {
kernel_adaptive_post_adjust(&kg, buffer, sample_multiplier);
}

View File

@@ -15,7 +15,20 @@
*/
#ifdef WITH_NANOVDB
/* Data type to replace `double` used in the NanoVDB headers. Cycles don't need doubles, and is
* safer and more portable to never use double datatype on GPU.
* Use a special structure, so that the following is true:
* - No unnoticed implicit cast or mathematical operations used on scalar 64bit type
* (which rules out trick like using `uint64_t` as a drop-in replacement for double).
* - Padding rules are matching exactly `double`
* (which rules out array of `uint8_t`). */
typedef struct ccl_vdb_double_t {
uint64_t i;
} ccl_vdb_double_t;
# define double ccl_vdb_double_t
# include "nanovdb/CNanoVDB.h"
# undef double
#endif
/* For OpenCL we do manual lookup and interpolation. */

View File

@@ -45,13 +45,12 @@ template<bool always = false> ccl_device_forceinline uint get_object_id()
uint object = optixGetInstanceId();
#endif
// Choose between always returning object ID or only for instances
if (always)
// Can just remove the high bit since instance always contains object ID
return object & 0x7FFFFF;
// Set to OBJECT_NONE if this is not an instanced object
else if (object & 0x800000)
object = OBJECT_NONE;
return object;
if (always || (object & 1) == 0)
// Can just remove the low bit since instance always contains object ID
return object >> 1;
else
// Set to OBJECT_NONE if this is not an instanced object
return OBJECT_NONE;
}
extern "C" __global__ void __raygen__kernel_optix_path_trace()

View File

@@ -43,7 +43,7 @@ class ColorSpaceProcessor;
*
* Data needed by OSL render services, that is global to a rendering session.
* This includes all OSL shaders, name to attribute mapping and texture handles.
* */
*/
struct OSLGlobals {
OSLGlobals()

View File

@@ -27,6 +27,7 @@
#include <OSL/oslclosure.h>
#include <OSL/oslexec.h>
#include <OSL/rendererservices.h>
#ifdef WITH_PTEX
class PtexCache;

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