3 months agoMerge branch 'blender-v2.93-release'
Brecht Van Lommel [Mon, 31 May 2021 17:23:49 +0000 (19:23 +0200)]
Merge branch 'blender-v2.93-release'

3 months agoCycles: optimize 3D viewport rendering with camera passepartout
Brecht Van Lommel [Mon, 31 May 2021 14:21:24 +0000 (16:21 +0200)]
Cycles: optimize 3D viewport rendering with camera passepartout

If the area outside the camera is fully opaque, don't render it.

Contributed by Kdaf.

Differential Revision:

3 months agoCleanup: Replace fseek() calls with BLI_fseek()
Harley Acheson [Mon, 31 May 2021 17:06:38 +0000 (10:06 -0700)]
Cleanup: Replace fseek() calls with BLI_fseek()

The fseek() function on Windows only accepts a 32-bit long offset
argument. Because of this we have our own version, BLI_fseek(), which
will use 64-bit _fseeki64() on Windows. This patch just replaces some
fseek() calls with BLI_fseek().

Differential Revision:

Reviewed by Brecht Van Lommel

3 months agoDisplay source video fps in the VSE
Sebastian Parborg [Mon, 31 May 2021 16:12:44 +0000 (18:12 +0200)]
Display source video fps in the VSE

Now FPS is displayed in the video source for videos to provide easy

Reviewed By: Richard Antalik

Differential Revision:

3 months agoWin: Fix warnings as errors being off for bmesh
Ray Molenkamp [Mon, 31 May 2021 15:59:29 +0000 (09:59 -0600)]
Win: Fix warnings as errors being off for bmesh

bf_bmesh historically always build with the /WX flag
on windows making all warnings errors, somewhere along
the way this has broken for msbuild, ninja still exhibits
the expected behaviour.

The flags are still passed to the target, and I've validated
they are there when the add_library call fires, but they
somehow never make it to the generated msbuild project files.

I suspect this is a cmake bug but I'm seemingly unable
to extract a repro case to file a bug upstream.

Setting the same options target_compile_options seems to work,
I'm not happy about the unexplained nature of the breakage
but this will have to do for now.

3 months agoFix T88670: Load Previous Settings does not copy symlinks
Brecht Van Lommel [Mon, 31 May 2021 15:24:35 +0000 (17:24 +0200)]
Fix T88670: Load Previous Settings does not copy symlinks

The same code existed in 2.82 and earlier so this should be safe. Removing the
custom implementation of shutil.copytree in f34d5d9 did not correctly add back
the option to copy symlinks.

3 months agoVSE: Fix missing cache invalidation
Richard Antalik [Mon, 31 May 2021 15:27:02 +0000 (17:27 +0200)]
VSE: Fix missing cache invalidation

Fixes T88606

3 months agoRefactor: DRW Mesh Extractor: Join the extractors in a same loop
Jeroen Bakker [Mon, 31 May 2021 15:11:01 +0000 (17:11 +0200)]
Refactor: DRW Mesh Extractor: Join the extractors in a same loop

This patch replaces / redoes the entire MeshExtractors system.
Although they were useful and facilitated the addition of new buffers, they made it difficult to control the threads and added a lot of threading overhead.

Part of the problem was in traversing the same loop type in different threads. The concurrent access of the BMesh Elements slowed the reading.

This patch simplifies the use of threads by merging all the old callbacks from the extracts into a single series of iteration functions.

The type of extraction can be chosen using flags.

This optimized the process by around 34%.

Initial idea and implementation By @mano-wii.
Fine-tuning, cleanup by @atmind.

- rdata 9ms iter 50ms (frame 155ms)
- Average: 6.462874 FPS

- rdata 9ms iter 34ms (frame 136ms)
- Average: 7.379491 FPS

Differential Revision:

3 months agoWindows: Clean-up win 8/8.1 API use
Ray Molenkamp [Mon, 31 May 2021 14:56:57 +0000 (08:56 -0600)]
Windows: Clean-up win 8/8.1 API use

For 2.93 we bumped the minimum windows requirement
to windows 8.1, but did not do any clean-up of any
win 8/8.1 API usage we dynamically accessed though

This patch bumps _WIN32_WINNT to 0x0603 (win 8.1)
and cleans up any API use that was accessed in a
more convoluted way than necessary

Differential Revision:

Reviewed by: harley, nicholas_rishel

3 months agoCleanup: else-after-return
Jacques Lucke [Mon, 31 May 2021 13:15:37 +0000 (15:15 +0200)]
Cleanup: else-after-return

3 months agoFix T88569: UI VSE: Menu-based range change, doesn't update the Timeline scrollbar...
Philipp Oeser [Mon, 31 May 2021 11:17:23 +0000 (13:17 +0200)]
Fix T88569: UI VSE: Menu-based range change, doesn't update the Timeline scrollbar width

Use the appropriate notifier, listeners were already doing the rest

Maniphest Tasks: T88569

Differential Revision:

3 months agoFix T88666: Cryptomatte: EXR sequence does not update when scrubbing the timeline.
Jeroen Bakker [Mon, 31 May 2021 12:32:39 +0000 (14:32 +0200)]
Fix T88666: Cryptomatte: EXR sequence does not update when scrubbing the timeline.

Cause is that initializing the cryptomatte session would reset the
current frame of an image sequence. The solution is to always use the
scene current frame so it resets to the correct frame.

This was a todo that wasn't solved after it landed in master.
Needs to be backported to 2.93.

3 months agoFix (unreported): TextureOperation inputs have no resolution
Manuel Castilla [Mon, 31 May 2021 10:26:46 +0000 (12:26 +0200)]
Fix (unreported): TextureOperation inputs have no resolution

When compositor node tree has a texture node, TextureOperation vector inputs  has always {0, 0} resolution instead of having same resolution as TextureOperation which is the expected behaviour for resolutions propagation.

Current TextureOperation determineResolution implementation doesn't determine inputs resolution, breaking propagation of preferred resolution and that's the reason why they are always 0. Setting scene resolution always would mean it is its own resolution and could make sense, but setting it only when preferred resolution is 0, breaks preferred resolution logic affecting other operations as explained in D10972. In any case scene resolution is already the default preferred resolution on viewer and compositor nodes.

Reviewed By: jbakker

Differential Revision:

3 months agoMerge branch 'blender-v2.93-release'
Bastien Montagne [Mon, 31 May 2021 09:56:17 +0000 (11:56 +0200)]
Merge branch 'blender-v2.93-release'

3 months agoFix T88623, T87044: Make encoded videos play correctly in VLC
Sebastian Parborg [Mon, 31 May 2021 09:25:12 +0000 (11:25 +0200)]
Fix T88623, T87044: Make encoded videos play correctly in VLC

The issue was two fold. We didn't properly:

1. Initialize the codec default values which would lead to VLC
   complaining because of garbage/wrong codec settings.

2.Calculate the time base for the video. FFmpeg would happily accept
  this but VLC seems to assume the time base value is at least somewhat
  correct and couldn't properly display the frames as the internal time
  base was huge. We are talking about 90k ticks (tbn) for one second of

This patch initializes all codecs to use their default values and fixes
the time base calculation so it follows the guidelines from ffmpeg.

Reviewed By: Sergey, Richard Antalik

Differential Revision:

3 months agoFix (studio-reported) crash in collection management code.
Bastien Montagne [Mon, 31 May 2021 08:20:23 +0000 (10:20 +0200)]
Fix (studio-reported) crash in collection management code.

Code checking for potential collection loop dependencies can be called
in cases where we cannot guarantee that there is no NULL pointers, so we
need to check those. Was already done for objects.

NOTE: doubled-checked by @jbakker, thanks.

3 months agoRevert "Added v2.93 pipeline config for new buildbot."
Jeroen Bakker [Mon, 31 May 2021 09:16:13 +0000 (11:16 +0200)]
Revert "Added v2.93 pipeline config for new buildbot."

This reverts commit 632bfee0a5ea92d213b5c9d010483c16f0baa636.
This config is only intended for 2.93. Master will get its own config
file after testing that 2.93 is correct.

3 months agoMerge branch 'blender-v2.93-release'
Jeroen Bakker [Mon, 31 May 2021 09:15:50 +0000 (11:15 +0200)]
Merge branch 'blender-v2.93-release'

3 months agoAdded v2.93 pipeline config for new buildbot.
Jeroen Bakker [Mon, 31 May 2021 09:14:40 +0000 (11:14 +0200)]
Added v2.93 pipeline config for new buildbot.

3 months agoGeometry Nodes: do not create unnecessary geometry components
Jacques Lucke [Mon, 31 May 2021 09:12:39 +0000 (11:12 +0200)]
Geometry Nodes: do not create unnecessary geometry components

Previously, making instances real would always create an (empty)
volume and curve component, even when not necessary.

This also fixes T88653.

3 months agoFix (studio-reported) crash in collection management code.
Bastien Montagne [Mon, 31 May 2021 08:20:23 +0000 (10:20 +0200)]
Fix (studio-reported) crash in collection management code.

Code checking for potential collection loop dependencies can be called
in cases where we cannot guarantee that there is no NULL pointers, so we
need to check those. Was already done for objects.

3 months agoFix T88456: DrawManager: Keep subset RenderMeshData around when geometry does not...
Jeroen Bakker [Mon, 31 May 2021 07:32:37 +0000 (09:32 +0200)]
Fix T88456: DrawManager: Keep subset RenderMeshData around when geometry does not change.

Reuse loose geometry during selection (and other operations) from
previous calculation. Loose geometry stays the same, but was
recalculated to determine the size of GPU buffers. This patch would
reuse the previous loose geometry when geometry wasn't changed.

Although not the main bottleneck during selection it is measurable.

`rdata 46ms iter 55ms (frame 410ms)`

This patch.
`rdata 5ms iter 52ms (frame 342ms)`

Reviewed By: mano-wii

Differential Revision:

3 months agoBoolean: applying patch D11431 to speed up hole-tolerant raycast.
Howard Trickey [Sun, 30 May 2021 20:37:49 +0000 (16:37 -0400)]
Boolean: applying patch D11431 to speed up hole-tolerant raycast.

This patch from Erik Abrahamsson uses a parallel_for to speed up
the case where the input is not manifold and the "hole_tolerant"
option is set.
In a test case on a 24 core (48 thread) machine, this sped up a
the boolean part on an object with 221k triangles from 12.06s to 0.46s.

3 months agoDocs: Capitalize first word of sentence
Aaron Carlisle [Sun, 30 May 2021 15:09:01 +0000 (11:09 -0400)]
Docs: Capitalize first word of sentence

3 months agoDocs: clarify description and usage of ''
Aaron Carlisle [Sun, 30 May 2021 15:07:38 +0000 (11:07 -0400)]
Docs: clarify description and usage of ''

Fixes T88669

4 months agoPyDoc: Use em dash instead of comma for enum items
Aaron Carlisle [Sat, 29 May 2021 16:16:13 +0000 (12:16 -0400)]
PyDoc: Use em dash instead of comma for enum items

4 months agoDocs: Add documentation for 'material_index'
Aaron Carlisle [Sat, 29 May 2021 15:22:17 +0000 (11:22 -0400)]
Docs: Add documentation for 'material_index'

Fixes T88485

4 months agoUI: Match tooltip with interface name
Aaron Carlisle [Sat, 29 May 2021 15:21:29 +0000 (11:21 -0400)]
UI: Match tooltip with interface name

4 months agoDocs: Add relevant OCIO envvars to Blender's help message
Aaron Carlisle [Fri, 28 May 2021 19:32:12 +0000 (15:32 -0400)]
Docs: Add relevant OCIO envvars to Blender's help message

4 months agoMerge branch 'blender-v2.93-release'
Antonio Vazquez [Sat, 29 May 2021 13:29:42 +0000 (15:29 +0200)]
Merge branch 'blender-v2.93-release'

4 months agoGPencil: Fix unreported random rotation for single point with texture
Antonio Vazquez [Fri, 28 May 2021 15:14:01 +0000 (17:14 +0200)]
GPencil: Fix unreported random rotation for single point with texture

When using ``Path`` alignment, if the stroke has one point the texture rotates randomly when move the viewport. This was because with one point is impossible to calculate a path.

Now, if the stroke has only one point, the texture for this stroke is aligned to Object.

4 months agoMake encoded video fps correct with ffmpeg < 4.4
Sebastian Parborg [Fri, 28 May 2021 16:37:36 +0000 (18:37 +0200)]
Make encoded video fps correct with ffmpeg < 4.4

Before the FFmpeg commit:
FFmpeg would use deprecated variables to calculate the video fps.

We don't use these deprecated variables anymore, so ensure that the
duration is correct in ffmpeg versions without this fix.

Reviewed By: Sergey, Richard Antalik

Differential Revision:

4 months agoFix T87932: Failure to build movie strip proxy
Sebastian Parborg [Fri, 28 May 2021 16:35:26 +0000 (18:35 +0200)]
Fix T87932: Failure to build movie strip proxy

We didn't initialize the scaled proxy frame properly.
This would lead to issues in ffmpeg 4.4 as they are more strict that the API is properly used.

Now we initialize the size and format of the frame.

4 months agoMerge branch 'blender-v2.93-release'
Clément Foucault [Fri, 28 May 2021 16:19:07 +0000 (18:19 +0200)]
Merge branch 'blender-v2.93-release'

4 months agoGeometry Nodes: Polish switch node UI
Hans Goudey [Fri, 28 May 2021 16:17:04 +0000 (12:17 -0400)]
Geometry Nodes: Polish switch node UI

Based on the task T88006, there are a few simple changes
to make to improve the switch node:
- Change the label to "False" / "True" for clarity
- Change default to geometry, as it's the basic data container in
  geometry nodes.
- Change node class to `NODE_CLASS_CONVERTOR`, which was an oversight
  in the original patch.

I will add the new socket types (material and texture) in a separate commit.
Thanks to @EitanSomething for the original patch.

Differential Revision:

4 months agoEEVEE: Fix NaN caused by ensure_valid_reflection()
Clément Foucault [Fri, 28 May 2021 16:02:45 +0000 (18:02 +0200)]
EEVEE: Fix NaN caused by ensure_valid_reflection()

This was caused by unsafe sqrt calls.

Fixes T86578 white artifacts in EEVEE

Reviewed By: brecht, dfelinto

Differential Revision:

4 months agoMerge branch 'blender-v2.93-release'
Hans Goudey [Fri, 28 May 2021 16:09:08 +0000 (12:09 -0400)]
Merge branch 'blender-v2.93-release'

4 months agoFix T88601: Attribute Compare boolean doesn't expose socket
Hans Goudey [Fri, 28 May 2021 16:04:52 +0000 (12:04 -0400)]
Fix T88601: Attribute Compare boolean doesn't expose socket

While we could make this node work for boolean inputs in the future,
currently it's really just designed to compare "float-like" inputs.
Many comparison modes don't even make sense for boolean inputs.
Therefore, the simplest fix for this bug is just to disable the
boolean attribute input modes for this node.

Differential Revision:

4 months agoGPencil: Fix unreported random rotation for single point with texture
Antonio Vazquez [Fri, 28 May 2021 15:14:01 +0000 (17:14 +0200)]
GPencil: Fix unreported random rotation for single point with texture

When using ``Path`` alignment, if the stroke has one point the texture rotates randomly when move the viewport. This was because with one point is impossible to calculate a path.

Now, if the stroke has only one point, the texture for this stroke is aligned to Object.

4 months agoDrawManager: Early return for buffer cache creation
Germano Cavalcante [Fri, 28 May 2021 14:51:05 +0000 (11:51 -0300)]
DrawManager: Early return for buffer cache creation

No real functional changes.

This is useful for benchmark cases when `cache->uv_cage` is passed but
has no buffers are requested.

4 months agoGeometry Nodes: Add Mesh to Curve Node
Hans Goudey [Fri, 28 May 2021 14:42:22 +0000 (10:42 -0400)]
Geometry Nodes: Add Mesh to Curve Node

This node creates poly curve splines from mesh edges. A selection
attribute input allows only using some of the edges from the mesh.
The node builds cyclic splines from branchless groups of edges where
possible, but when there is a three-way intersection, the spline stops.

The node also transfers all attributes from the mesh to the resulting
control points. In the future we could add a way to limit that to a
subset of the attributes to improve performance.

The algorithm is from Animation Nodes, written by @OmarSquircleArt.
I added the ability to use a selection, attribute transferring, and
used different variable names, etc, but other than that the algorithm
is the same.

Differential Revision:

4 months agoFix incorrect Denoise node SSE 4.1 warning on macOS Intel
Brecht Van Lommel [Fri, 28 May 2021 12:02:24 +0000 (14:02 +0200)]
Fix incorrect Denoise node SSE 4.1 warning on macOS Intel

4 months agoMSVC: Fix build error with 16.10/11
Ray Molenkamp [Fri, 28 May 2021 13:57:21 +0000 (07:57 -0600)]
MSVC: Fix build error with 16.10/11

Not entirely sure why this was not an issue for 16.9
but TBB includes the Windows.h header which by default
will define min and max macro's

These collide with the stl versions in <algorithm>

This patch requests Windows.h not to define the
problematic macro's, resolving the conflict.

4 months agoMerge branch 'blender-v2.93-release'
Philipp Oeser [Fri, 28 May 2021 13:47:38 +0000 (15:47 +0200)]
Merge branch 'blender-v2.93-release'

4 months agoFix T88635: VSE: Select Linked gives unpredictable results
Philipp Oeser [Fri, 28 May 2021 11:38:08 +0000 (13:38 +0200)]
Fix T88635: VSE: Select Linked gives unpredictable results

Caused by {rB66923031e6f2}.

Code would process unselected sequences and skip selected, needs to be
the other way around.

Maniphest Tasks: T88635

Differential Revision:

4 months agoFix crash in liboverride resync.
Bastien Montagne [Fri, 28 May 2021 13:33:04 +0000 (15:33 +0200)]
Fix crash in liboverride resync.

Reported by studio (@andy), thanks.

4 months agoFix T88499: Copy data path operator does not consider library affiliation
Philipp Oeser [Thu, 27 May 2021 12:36:18 +0000 (14:36 +0200)]
Fix T88499: Copy data path operator does not consider library affiliation

When using the operator `ui.copy_data_path_button(full_path=True)` ({key
ctrl shift Alt C} on hover) the copied path does not consider the
library origin. That means that when there is a name clash the data path
is not accurate and refers to the local item instead.

This patch adds the library (if the ID is linked) of the returned string
from RNA_path_full_ID_py.["Cube", "//library.blend"] instead of["Cube"]

note: parsing this happens in

Maniphest Tasks: T88499

Differential Revision:

4 months agoTests: add utility to generate interactive user actions
Campbell Barton [Fri, 28 May 2021 05:44:32 +0000 (15:44 +1000)]
Tests: add utility to generate interactive user actions

A utility that supports passing in actions as command line arguments for
writing reproducible interactions, benchmarking, profiling and testing.

Unlike regular scripts this is able to control model operators usefully.

Typical ways of controlling Blender using this utility are via
operator id's, menu search and explicit events.
Others methods can be added as needed.

See the doc-string for example usage.

4 months agoCleanup: use static set syntax
Campbell Barton [Fri, 28 May 2021 06:05:46 +0000 (16:05 +1000)]
Cleanup: use static set syntax

4 months agoDrawManager: Use Compute Shader to Update Hair.
Jeroen Bakker [Fri, 28 May 2021 06:16:26 +0000 (08:16 +0200)]
DrawManager: Use Compute Shader to Update Hair.

This patch will use compute shaders to create the VBO for hair.
The previous implementation uses transform feedback.

Timings before: between 0.000069s and 0.000362s.
Timings after:  between 0.000032s and 0.000092s.

Speedup isn't noticeable by end-users. The patch is used to test
the new compute shader pipeline and integrate it with the draw
manager. Allowing EEVEE, Workbench and other draw engines to
use compute shaders with the introduction of `DRW_shgroup_call_compute`
and `DRW_shgroup_vertex_buffer`.

Future improvements are possible by generating the index buffer
of hair directly on the GPU.

NOTE: that compute shaders aren't supported by Apple and still use
the transform feedback workaround.

Reviewed By: fclem

Differential Revision:

4 months agoMerge branch 'blender-v2.93-release'
Aaron Carlisle [Fri, 28 May 2021 01:27:48 +0000 (21:27 -0400)]
Merge branch 'blender-v2.93-release'

4 months agoDocs: Update RNA to User Manual mappings
Aaron Carlisle [Fri, 28 May 2021 01:25:31 +0000 (21:25 -0400)]
Docs: Update RNA to User Manual mappings

4 months agoFix T86465: Annotation Tool is missing in VSE Preview toolbar
Antonio Vazquez [Thu, 27 May 2021 17:44:53 +0000 (19:44 +0200)]
Fix T86465: Annotation Tool is missing in VSE Preview toolbar

Added missing topbar in VSE.

Also added the Stabilizer options to Topbar for all modes.

Reviewed By: mendio, pepeland

Maniphest Tasks: T86465

Differential Revision:

4 months agoFix own crash in today's rBf68288a8746f.
Bastien Montagne [Thu, 27 May 2021 17:30:23 +0000 (19:30 +0200)]
Fix own crash in today's rBf68288a8746f.

4 months agoLibOverride: refactor recursive resync.
Bastien Montagne [Thu, 27 May 2021 13:54:26 +0000 (15:54 +0200)]
LibOverride: refactor recursive resync.

We need to re-evaluate what needs to be resynced after each step of
processing overrides from a given 'indirect level' of libraries.
Otherwise, recusrive overrides (overrides of linked overrides) won't

Note that this should not change too much in practice currently, since
there are other issues with recursive overrides yet.

Also, checks (CLOG errors) added show that some ID (node trees) seem to
be detected as needing resynced even after beig just resynced, this
needs further investigation still. Could be though that it is due to
limit currently set on nodetrees, those are always complicated
snowflakes to deal with...

4 months agoFix T88614: Mixdown crashes Blender 2.92.0 and 3.0.0 Alpha
Jörg Müller [Thu, 27 May 2021 17:05:17 +0000 (19:05 +0200)]
Fix T88614: Mixdown crashes Blender 2.92.0 and 3.0.0 Alpha

The problem is caused by the most recent ffmpeg version (4.4) which
needs channels to be set when submitting a frame for encoding.

4 months agoFix T88625: Multiobject UV hiding/unhiding does not work with UV_SYNC_SELECTION
Philipp Oeser [Thu, 27 May 2021 13:30:02 +0000 (15:30 +0200)]
Fix T88625: Multiobject UV hiding/unhiding does not work with UV_SYNC_SELECTION

Oversight in {rB470f17f21c06}.

Hiding was only done for the first mesh, then the operator finished (in
Now just continue to the next.

Maniphest Tasks: T88625

Differential Revision:

4 months agoMerge branch 'blender-v2.93-release'
Clément Foucault [Thu, 27 May 2021 15:15:39 +0000 (17:15 +0200)]
Merge branch 'blender-v2.93-release'

4 months agoRevert "EEVEE: Ensure Reflection: Use new implementation"
Clément Foucault [Thu, 27 May 2021 15:10:17 +0000 (17:10 +0200)]
Revert "EEVEE: Ensure Reflection: Use new implementation"

Both before and after can have artifacts with some normal maps, but this seems to give
worse artifacts on average which are not worth the minor performance increase.

This reverts commit 5c4d24e1fd752a8a89d44d05e8e3f9b31f2d7db0.

Ref T88368, D10084

4 months agoGeometry Nodes: Expose texture and material inputs to modifier
Hans Goudey [Thu, 27 May 2021 15:06:08 +0000 (11:06 -0400)]
Geometry Nodes: Expose texture and material inputs to modifier

This allows choosing material and texture sockets for the group input
node in the modifier. Note that currently grease pencil materials are
displayed in the list, even though grease pencil data is not supported
yet by geometry nodes. That is more complicated to fix in this case,
since we use IDProperties to store the dynamic exposed inputs.

Differential Revision:

4 months agoCleanup: Fix forward declaring class with "struct"
Hans Goudey [Thu, 27 May 2021 15:00:00 +0000 (11:00 -0400)]
Cleanup: Fix forward declaring class with "struct"

4 months agoFix build error: Make CurveEval a struct
Hans Goudey [Thu, 27 May 2021 14:50:43 +0000 (10:50 -0400)]
Fix build error: Make CurveEval a struct

We need a pointer to this in DNA, which means it cannot be a class.

4 months agoCleanup: rename blender-launcher source file.
Ray Molenkamp [Thu, 27 May 2021 14:10:31 +0000 (08:10 -0600)]
Cleanup: rename blender-launcher source file.

blender-laucher.c was not an ideal name for this file
since it's not directly clear it is windows only.

This change renames it to blender_launcher_win32.c
to be more in line with other win32 specific files
we have.

4 months agoGeometry Nodes: Draw curve data in the viewport
Hans Goudey [Thu, 27 May 2021 14:08:40 +0000 (10:08 -0400)]
Geometry Nodes: Draw curve data in the viewport

This patch adds relatively small changes to the curve draw
cache implementation in order to draw the curve data in the
viewport. The dependency graph iterator is also modified
so that it iterates over the curve geometry component, which
is presented to users as `Curve` data with a pointer to the

The idea with the spline data type in geometry nodes is that
curve data itself is only the control points, and any evaluated
data with faces is a mesh. That is mostly expected elsewhere in
Blender anyway. This means it's only necessary to implement
wire edge drawing of `CurveEval` data.

Adding a `CurveEval` pointer to `Curve` is in line with changes
I'd like to make in the future like using `CurveEval` in more places
such as edit mode.

An alternate solution involves converting the curve wire data
to a mesh, however, that requires copying all of the data, and
since avoiding it is rather simple and is in-line with future plans
anyway, I think doing it this way is better.

Differential Revision:

4 months agoFix T88452: Point Separate crash on curve component
Hans Goudey [Thu, 27 May 2021 13:37:19 +0000 (09:37 -0400)]
Fix T88452: Point Separate crash on curve component

The point separate node should create a point cloud from control points
in this case, but for now disable the node on curves to avoid the crash.

4 months agoCleanup: Use consistent variable names
Hans Goudey [Thu, 27 May 2021 13:27:08 +0000 (09:27 -0400)]
Cleanup: Use consistent variable names

4 months agoCleanup: rename BKE_main_id_{clear_newpoins => newptr_and_tag_clear}
Campbell Barton [Thu, 27 May 2021 12:44:02 +0000 (22:44 +1000)]
Cleanup: rename BKE_main_id_{clear_newpoins => newptr_and_tag_clear}

It wasn't obvious this function cleared the tag as well.

4 months agoCleanup: remove duplicate LIB_TAG_NEW untag code
Erik Abrahamsson [Thu, 27 May 2021 12:40:30 +0000 (22:40 +1000)]
Cleanup: remove duplicate LIB_TAG_NEW untag code

This patch removes unnecessary calls to `BKE_main_id_tag_all` where the
same job is done by `BKE_main_id_clear_newpoins` on the following line.

Reviewed By: campbellbarton, mont29

Ref D11379

4 months agoLineArt: List Optimization for tile linked data.
YimingWu [Thu, 27 May 2021 12:33:02 +0000 (20:33 +0800)]
LineArt: List Optimization for tile linked data.

Use array instead of ListBase for line art
bounding area linked triangles and edges.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision:

4 months agoCleanup: Line art variable naming.
YimingWu [Thu, 27 May 2021 10:32:43 +0000 (18:32 +0800)]
Cleanup: Line art variable naming.

Change `reln` to `eln`.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision:

4 months agoLibOverride: Add heuristic protection against infinite loop due to libraries inter...
Bastien Montagne [Thu, 27 May 2021 09:53:44 +0000 (11:53 +0200)]
LibOverride: Add heuristic protection against infinite loop due to libraries inter-dependencies.

This is not supposed to happen, but better be safe than sorry, and
assume it is beyond unlikely that someone would use chains of over 10k
linked libraries.

4 months agoCleanup: Unused include in Cycles
Sergey Sharybin [Thu, 27 May 2021 09:35:38 +0000 (11:35 +0200)]
Cleanup: Unused include in Cycles

4 months agoRefactor: Move display pass to Cycles viewport parameters
Sergey Sharybin [Thu, 27 May 2021 09:31:03 +0000 (11:31 +0200)]
Refactor: Move display pass to Cycles viewport parameters

Allows to centralize storage and modification checks in a single place,
avoiding duplication in the synchronization code.

Ideally we would somehow be able to more granularly modify Cycles side
objects. Leaving this for a future decision, because it might be better
to implement it as a graph on the sync side.

4 months agoCleanup: Redundnat member init in Cycles viewport parameters
Sergey Sharybin [Thu, 27 May 2021 09:24:05 +0000 (11:24 +0200)]
Cleanup: Redundnat member init in Cycles viewport parameters

4 months agoRefactor: Naming in Cycles viewport methods
Sergey Sharybin [Thu, 27 May 2021 09:16:40 +0000 (11:16 +0200)]
Refactor: Naming in Cycles viewport methods

Makes it more explicit they operate on shading/light.

Gives room to move more viewport related settings into this class and
cover with specific or generic modification checks.

4 months agoCleanup: Use logical OR in Cycles background shader
Sergey Sharybin [Thu, 27 May 2021 09:11:49 +0000 (11:11 +0200)]
Cleanup: Use logical OR in Cycles background shader

4 months agoCleanup: const qualifier of return type
Sergey Sharybin [Thu, 27 May 2021 09:10:37 +0000 (11:10 +0200)]
Cleanup: const qualifier of return type

4 months agoRefactor: Remove friend class from Cycles viewport parameters
Sergey Sharybin [Thu, 27 May 2021 09:07:58 +0000 (11:07 +0200)]
Refactor: Remove friend class from Cycles viewport parameters

Such pattern should only be used when it is really needed. Otherwise
just stick to a more regular design, without worrying who is the user
of the class. Otherwise it will be annoying to subclass or unit test.

4 months agoRefactor: Rename pass accessor in viewport parameters
Sergey Sharybin [Thu, 27 May 2021 08:42:22 +0000 (10:42 +0200)]
Refactor: Rename pass accessor in viewport parameters

No need to state that it is a viewport display pass, since the method
is within viewport parameters it is implied that parameters do belong
to the viewport.

Brings this code closer to the Cycles-X branch.

4 months agoFix (studio-reported) infinite loop in resync code.
Bastien Montagne [Thu, 27 May 2021 08:47:02 +0000 (10:47 +0200)]
Fix (studio-reported) infinite loop in resync code.

Very stupid mistake in libraries indirect-level building code, was not
skipping 'loop-back' ID pointers.

Note that we also need some level of checks for the case where there
would be an actual dependency loop between libraries, this is not
supposed to be possible, but better be safe than sorry. Will add in next

4 months agoCleanup: inconsistent parameter name
Jacques Lucke [Thu, 27 May 2021 08:46:43 +0000 (10:46 +0200)]
Cleanup: inconsistent parameter name

4 months agoCleanup: inconsistent parameter name
Jacques Lucke [Thu, 27 May 2021 08:41:40 +0000 (10:41 +0200)]
Cleanup: inconsistent parameter name

4 months agoCleanup: simplify logic for copying vector button as text
Campbell Barton [Thu, 27 May 2021 07:44:30 +0000 (17:44 +1000)]
Cleanup: simplify logic for copying vector button as text

An arbitrary size offsets was used in float_array_to_string,
simplify the loop, use exact size limits.

Also rename variables so it's clear which array the length apply to.

4 months agoFix incorrect BLI_snprintf usage
Campbell Barton [Thu, 27 May 2021 07:16:08 +0000 (17:16 +1000)]
Fix incorrect BLI_snprintf usage

Event though in practice this wasn't causing problems as the fixed size
buffers are generally large enough not to truncate text.

Using the result from `snprint` or `BLI_snprintf` to step over a fixed
size buffer allows for buffer overruns as the returned value is the size
needed to copy the entire string, not the number of bytes copied.

Building strings using this convention with multiple calls:

    ofs += BLI_snprintf(str + ofs, str_len_max - ofs);

.. caused the size argument to become negative,
wrapping it to a large value when cast to the unsigned argument.

4 months agoCleanup: specify array sizes, remove warnings in comments
Campbell Barton [Thu, 27 May 2021 07:12:38 +0000 (17:12 +1000)]
Cleanup: specify array sizes, remove warnings in comments

4 months agoCleanup: spelling
Campbell Barton [Thu, 27 May 2021 07:02:44 +0000 (17:02 +1000)]
Cleanup: spelling

4 months agoNodes: fix material node copied over when socket is copied
Jacques Lucke [Thu, 27 May 2021 07:58:45 +0000 (09:58 +0200)]
Nodes: fix material node copied over when socket is copied

This was missing from rB207472930834a2916cf18bbdff51bcd77c6dd0c0.

4 months agoGeometry Nodes: disable multi-threading in evaluator for now
Jacques Lucke [Thu, 27 May 2021 07:43:11 +0000 (09:43 +0200)]
Geometry Nodes: disable multi-threading in evaluator for now

A deadlock could happen under certain circumstances when
geometry nodes is used on multiple objects.
Once T88598 is resolved, multi-threading can be enabled again.

Differential Revision:

4 months agoCleanup: use UndoMesh as links instead of allocating LinkData
Campbell Barton [Thu, 27 May 2021 06:34:41 +0000 (16:34 +1000)]
Cleanup: use UndoMesh as links instead of allocating LinkData

While the advantage isn't large,
it's simpler to skip the intermediate link.

Also remove unused next and previous struct members
from MeshUndoStep_Elem.

4 months agoUndo: resolve inefficient edit-mesh memory use with multiple objects
Campbell Barton [Thu, 27 May 2021 06:14:51 +0000 (16:14 +1000)]
Undo: resolve inefficient edit-mesh memory use with multiple objects

When editing more than 1 object at a time, complete copies of each mesh
were being stored. Now the most recent undo-data for each mesh is used
(when available).

4 months agoCleanup: Remove completed "TODO" comment
Hans Goudey [Thu, 27 May 2021 02:32:53 +0000 (22:32 -0400)]
Cleanup: Remove completed "TODO" comment

Since rBb67fe05d4bea, the dependency graph supports relations
on collection geometry, and the nodes modifier uses that.

4 months agoCleanup: Simplify spline point attribute materialize functions
Hans Goudey [Thu, 27 May 2021 02:22:09 +0000 (22:22 -0400)]
Cleanup: Simplify spline point attribute materialize functions

- Iterate over the mask directly instead of using an index.
- Use Span slice and copy_from instead of a lower level function.

4 months agoGeometry Nodes: Support interpolation between curve domains
Hans Goudey [Thu, 27 May 2021 02:14:59 +0000 (22:14 -0400)]
Geometry Nodes: Support interpolation between curve domains

This commit adds interpolation from the point domain to the spline
domain and the other way around. Before this, spline domain attributes
were basically useless, but now they are quite helpful as a way to use
a shared value in a contiguous group of points.

I implementented a special virtual array for the spline to points
conversion, so that conversion should be close to the ideal performance
level, but there are a few ways we could optimize the point to spline
conversion in the future:
 - Use a function virtual array to mix the point values for each spline
   on demand.
 - Implement a special case for when the input virtual array is one of
   the virtual arrays from the spline point attributes. In other words,
   decrease curve attribute access overhead.

Differential Revision:

4 months agoWin: Add launcher to hide the console window flash
Ray Molenkamp [Thu, 27 May 2021 02:02:35 +0000 (20:02 -0600)]
Win: Add launcher to hide the console window flash

This patch fixes a long-standing complaint from users:
the console window shortly flashing when they start

This is done by adding a new executable called
blender-launcher.exe which starts blender.exe while
hiding the console.

Any command line parameters given to blender-launcher
will be passed on to blender.exe so it'll be a drop
in replacement.

Starting blender.exe on its own will still function as
a proper console app so no changes required here for
users that use blender for batch processing.

Notable changes:

Registering blender (-R switch) will now register
blender-launcher as the preferred executable.

This patch updates the installer and updates the
shortcuts to start blender-launcher.exe rather
than blender.exe

Differential Revision:

Reviewed by: brecht, harley

4 months agoCleanup: Specify amount of buffers through preprocessor directives
Germano Cavalcante [Thu, 27 May 2021 00:28:05 +0000 (21:28 -0300)]
Cleanup: Specify amount of buffers through preprocessor directives

4 months agoFix T88603: Crash with spline attributes after curve resample
Hans Goudey [Thu, 27 May 2021 01:12:38 +0000 (21:12 -0400)]
Fix T88603: Crash with spline attributes after curve resample

The output curve's spline attribute domain custom data needs to be
reallocated with the correct length after adding the splines.

4 months agoRevert "DrawManager: Use Compute Shader to Update Hair."
Jeroen Bakker [Wed, 26 May 2021 18:32:05 +0000 (20:32 +0200)]
Revert "DrawManager: Use Compute Shader to Update Hair."

This reverts commit 8f9599d17e80254928d2d72081a4c7e0dee64038.

Mac seems to have an error with this change.
                 ERROR: /Users/blender/git/blender-vdev/blender.git/source/blender/draw/intern/draw_hair.c:115:44: error: use of undeclared identifier 'shader_src'
                 ERROR: /Users/blender/git/blender-vdev/blender.git/source/blender/draw/intern/draw_hair.c:123:13: error: use of undeclared identifier 'shader_src'
                 ERROR: make[2]: *** [source/blender/draw/CMakeFiles/bf_draw.dir/intern/draw_hair.c.o] Error 1
                 ERROR: make[1]: *** [source/blender/draw/CMakeFiles/bf_draw.dir/all] Error 2
                 ERROR: make: *** [all] Error 2


4 months agoCleanup: array-parameter warning with GCC 11
Campbell Barton [Wed, 26 May 2021 16:23:19 +0000 (02:23 +1000)]
Cleanup: array-parameter warning with GCC 11

Pass the string size as this is less error prone in general.

4 months agoRevert "Cycles: optimize ensure_valid_reflection(), reduces render time by about 1%"
Brecht Van Lommel [Wed, 26 May 2021 16:22:43 +0000 (18:22 +0200)]
Revert "Cycles: optimize ensure_valid_reflection(), reduces render time by about 1%"

Both before and after can have artifacts with some normal maps, but this seems to give
worse artifacts on average which are not worth the minor performance increase.

This reverts commit 21bc1a99baa765d81c3203fd2e451681b8a7fd55.

Ref T88368, D10084

4 months agoFix buildbot CUDA/OptiX warnings on macOS
Brecht Van Lommel [Wed, 26 May 2021 15:11:45 +0000 (17:11 +0200)]
Fix buildbot CUDA/OptiX warnings on macOS

Explicitly disable these, rather than relying on them not being found.
Also, don't duplicates the architectures list.