blender.git
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.

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

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

Reviewed By: mano-wii

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

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 'bpy.app.version_file'
Aaron Carlisle [Sun, 30 May 2021 15:07:38 +0000 (11:07 -0400)]
Docs: clarify description and usage of 'bpy.app.version_file'

Fixes T88669

3 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

3 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

3 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

3 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

3 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'

3 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.

3 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: github.com/FFmpeg/FFmpeg/commit/1c0885334dda9ee8652e60c586fa2e3674056586
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: http://developer.blender.org/D11417

3 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.

3 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'

3 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: https://developer.blender.org/D11165

3 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: https://developer.blender.org/D11428

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: https://developer.blender.org/D11427

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: https://developer.blender.org/D11265

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: https://developer.blender.org/D11424

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.

bpy.data.objects["Cube", "//library.blend"] instead of
bpy.data.objects["Cube"]

note: parsing this happens in
pyrna_prop_collection_subscript_str_lib_pair_ptr

Maniphest Tasks: T88499

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

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: https://developer.blender.org/D11057

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: https://developer.blender.org/D11347

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
work.

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
case of UV_SYNC_SELECTION).
Now just continue to the next.

Maniphest Tasks: T88625

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

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: https://developer.blender.org/D11393

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
`CurveEval`

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: https://developer.blender.org/D11351

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: https://developer.blender.org/D11302

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: https://developer.blender.org/D11411

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
commit.

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: https://developer.blender.org/D11405

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: https://developer.blender.org/D11376

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
blender.

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: https://developer.blender.org/D11094

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.

4 months agoGPencil: Cleanup - Conform with RNA naming scheme
Falk David [Wed, 26 May 2021 16:23:25 +0000 (18:23 +0200)]
GPencil: Cleanup - Conform with RNA naming scheme

The newly added `disable_masks_viewlayer` RNA property did not conform
with the RNA naming scheme. This renames it to `use_viewlayer_masks`.

4 months agoFix T88111: Skin modifier assets within invalid face normals
Campbell Barton [Wed, 26 May 2021 06:06:02 +0000 (16:06 +1000)]
Fix T88111: Skin modifier assets within invalid face normals

The skin modifier was moving vertices without updating normals for the
connected faces, this happened when smoothing and welding vertices.

Reviewed By: mont29

Ref D11397

4 months agoCleanup: shadow warning
Campbell Barton [Wed, 26 May 2021 15:30:52 +0000 (01:30 +1000)]
Cleanup: shadow warning

Move reproject_type into an extern, to avoid declaring multiple times.

4 months agoLibOverride: add recursive resync.
Bastien Montagne [Wed, 26 May 2021 14:53:59 +0000 (16:53 +0200)]
LibOverride: add recursive resync.

Recursive resync means also resyncing overrides that are linked from
other library files into current working file.

Note that this allows to get 'working' files even when their
dependencies are out of sync. However, since linked data is never
written/saved, this has to be re-done every time the working file is
loaded, until said dependencies are updated properly.

NOTE: This is still missing the 'report' side of things, which is part
of a larger task to enhance reports regarding both linking, and
liboverrides (see T88393).

----------

Technical notes:

Implementing this proved to be slightly more challenging than expected,
mainly because one of the key aspects of the feature was never done in
Blender before: manipulating, re-creating linked data.

This ended up moving the whole resync code to use temp IDs out of bmain,
which is better in the long run anyway (and more aligned with what we
generally want to do when manipulating temp ID data). It should also
give a marginal improvement in performances for regular resync.

This commit also had to carefully 'sort' libraries by level of indirect
usage, as we want to resync first the libraries that are the least directly
used, i.e. libraries that are most used by other libraries.

4 months agoLibOverride: add helper to retrieve override data from an ID.
Bastien Montagne [Wed, 26 May 2021 13:44:51 +0000 (15:44 +0200)]
LibOverride: add helper to retrieve override data from an ID.

Embedded IDs do not own their own override data, but rather use the one
from their owner.

4 months agoIDManagement: Shapekey: add a `owner_get` callback.
Bastien Montagne [Wed, 26 May 2021 13:43:12 +0000 (15:43 +0200)]
IDManagement: Shapekey: add a `owner_get` callback.

Even though shepkeys are not strictly speaking an embedded data, they
share quiet a few points with those, and from liboverride perspective
they are embedded, so...

4 months agoLibOverride: Do not try to generate override data of linked data.
Bastien Montagne [Wed, 26 May 2021 10:43:34 +0000 (12:43 +0200)]
LibOverride: Do not try to generate override data of linked data.

This is obviously not saved, and should never be editable, so was only a
waste of time.

4 months agoID management: remapping: add flag to enforce refcounting handling.
Bastien Montagne [Wed, 26 May 2021 09:52:24 +0000 (11:52 +0200)]
ID management: remapping: add flag to enforce refcounting handling.

While indeally we should only skip refcounting when relevant tag is set,
doing this in remapping code is too risky for now.

Related to previous commit and T88555.

4 months agoID management: Do not assume that `NO_MAIN` means `NO_USER_REFCOUNT`
Bastien Montagne [Wed, 26 May 2021 09:45:27 +0000 (11:45 +0200)]
ID management: Do not assume that `NO_MAIN` means `NO_USER_REFCOUNT`

While this is still very fuzzy in current code, this old behavior makes
it close to impossible to efficiently use out-of-main temp data, as it
implies that we'd need to update refcounts everytime we add something
back into BMain (an 'un-refcount' ID usages when removing from BMain).

Now that we have two separate flags/tags for those two different things,
let's not merge them anymore.

Note that this is somewhat on-going process, still needs more checks and
cleanup. Related to T88555.

4 months agoDrawManager: Use Compute Shader to Update Hair.
Jeroen Bakker [Wed, 26 May 2021 15:02:32 +0000 (17:02 +0200)]
DrawManager: Use Compute Shader to Update Hair.

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

Timings master (transform feedback with GPU_USAGE_STATIC between 0.000069s and 0.000362s
Timings transform feedback with GPU_USAGE_DEVICE_ONLY. between 0.000057s and 0.000122s
Timings compute shader between 0.000032 and 0.000092s

Future improvements:
* Generate hair Index buffer using compute shaders: currently done single threaded on CPU, easy to add as compute shader.

Reviewed By: fclem

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

4 months agoGPU: Compute Pipeline.
Jeroen Bakker [Wed, 26 May 2021 14:49:17 +0000 (16:49 +0200)]
GPU: Compute Pipeline.

With the compute pipeline calculation can be offloaded to the GPU.
This patch only adds the framework for compute. So no changes for users at
this moment.

NOTE: As this is an OpenGL4.3 feature it must always have a fallback.

Use `GPU_compute_shader_support` to check if compute pipeline can be used.
Check `gpu_shader_compute*` test cases for usage.

This patch also adds support for shader storage buffer objects and device only
vertex/index buffers.

An alternative that had been discussed was adding this to the `GPUBatch`, this
was eventually not chosen as it would lead to more code when used as part of a
shading group. The idea is that we add an `eDRWCommandType` in the near
future.

Reviewed By: fclem

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

4 months agoGPencil: Add option to disable masks in view layer
Falk David [Wed, 26 May 2021 14:46:00 +0000 (16:46 +0200)]
GPencil: Add option to disable masks in view layer

This patch adds an option in the Layers > Relations panel called "Disable Masks in Render".
When checked, no masks on this layer are included in the render.

Example:
| {F10087680} | {F10087681} |

See T88202 for why this is needed.

Reviewed By: antoniov

Maniphest Tasks: T88202

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

4 months agoMerge branch 'blender-v2.93-release'
Falk David [Wed, 26 May 2021 14:34:03 +0000 (16:34 +0200)]
Merge branch 'blender-v2.93-release'

4 months agoFix: GPencil mask shows in view layer render
Falk David [Wed, 26 May 2021 14:07:03 +0000 (16:07 +0200)]
Fix: GPencil mask shows in view layer render

Currently when rendering the view layer of a grease pencil layer that has
a mask layer attached, the mask layer would show in the rendered image.
This is inconsistent with the default behaviour with no mask on the
grease pencil layer, because it would only render what's on that
particular layer and not anything from any other layer.

This patch makes the masks invisible in the render.

Note: This might seem like not the best solution, but because masks are
just regular grease pencil layers, it's tricky to pass this edge-case to the
drawing code. The way it is handled right now is the best I could come
up with, without making changes that could affect something else.

Reviewed By: antoniov

Maniphest Tasks: T88202

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

4 months agoMerge branch 'blender-v2.93-release'
Jacques Lucke [Wed, 26 May 2021 14:20:24 +0000 (16:20 +0200)]
Merge branch 'blender-v2.93-release'

4 months agoFix T88250: crash when instancing object in disabled collection
Jacques Lucke [Wed, 26 May 2021 14:06:01 +0000 (16:06 +0200)]
Fix T88250: crash when instancing object in disabled collection

This issue was that `BKE_object_eval_uber_data` was not called for
the text object, because its geometry was not dependent upon
and its `is_directly_visible` tag was `false`. The crash happens in
rendering code, because the evaluated data is missing.

This not only affects text objects, but all object types that have a
geometry component that geometry nodes does not support yet.

The solution is to just add the missing dependencies.

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

4 months agoGPencil: Bake GPencil object transforms into a new GPencil object
Antonio Vazquez [Wed, 26 May 2021 13:41:38 +0000 (15:41 +0200)]
GPencil: Bake GPencil object transforms into a new GPencil object

This operator is a common request of animators to convert the transformation (inluding modifiers) of one grease pencil object, into a new object, generating strokes.

Reviewed By: pepeland

Maniphest Tasks: T87424

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