1
1

Compare commits

...

8045 Commits

Author SHA1 Message Date
0d80c4dbc6 channel range 2022-03-29 01:48:54 +02:00
Richard Antalik
75ecace309 VSE: Use edge panning
Add edge panning feature to transform operator. It works in same way as
in node editor, but Y axis is limited by usable range up to 128
channels.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14310
2022-03-29 01:28:18 +02:00
Richard Antalik
33a914e06b VSE: Add channel headers
This patch adds channel region to VSE timeline area for drawing channel
headers. It is synchronizedwith timeline region. 3 basic features are
implemented - channel visibility, locking and name.

Channel data is stored in `SeqTimelineChannel` which can be top-level
owned by `Editing`, or it is owned by meta strip to support nesting.
Strip properties are completely independent and channel properties are
applied on top of particular strip property, thus overriding it.

Implementation is separate from channel regions in other editors. This
is mainly because style and topology is quite different in VSE. But
also code seems to be much more readable this way.

Currently channels use functions similar to VSE timeline to draw
background to provide illusion of transparency, but only for background
and sfra/efra regions.

Great portion of this patch is change from using strip visibility and
lock status to include channel state - this is facilitated by functions
`SEQ_transform_is_locked` and `SEQ_render_is_muted`

Originally this included changes in D14263, but patch was split for
easier review.

Here is screenshot of how this looks:
{F12907356}

Differential Revision: https://developer.blender.org/D13836
2022-03-29 01:09:24 +02:00
27424b758a Cleanup: Move two grease pencil files to C++
This is meant to allow using C++ data structures in this file
as a performance improvement. Particularly `Vector` instead
of `ListBase` for `duplilist`. This changes builds on all
platforms on the buildbot.
2022-03-28 16:29:36 -05:00
fc288d3970 Cleanup: Move scene.c to C++
This is meant to allow using C++ data structures in this file
as a performance improvement. Particularly `Vector` instead
of `ListBase` for `duplilist`. This change builds and passes
tests on all platforms on the buildbot.
2022-03-28 15:53:19 -05:00
c9f54cd644 Cleanup: Use const mesh arguments
Also correct an enum value from review of D14475.
2022-03-28 15:12:30 -05:00
037f789111 Cleanup: Move transform_snap_object.c to C++
This is meant to allow using C++ data structures in this file
as a performance improvement. Particularly `Vector` instead
of `ListBase` for `duplilist`.

Differential Revision: https://developer.blender.org/D14475
2022-03-28 14:59:42 -05:00
21e72496a6 Fix T96728: 'Automatic Constraint' using the wrong orientation
If the `Automatic Constraint` modifier was activated while an axis
constraint was already set, the orientation used would be the default
orientation of the mode and not that of the scene.

This was because the `initSelectConstraint` function was not called in
this case and the `Automatic Constraint` mode was enabled by other
indirect means.

So the solution is to call `initSelectConstraint` in either case and
remove these "indirect means" of enabling `Automatic Constraint`.
2022-03-28 14:21:33 -03:00
df4d6c22cf Transform: avoid excessive recalculation with 'TREDRAW_SOFT'
Contrary to the initial intention (in rB9916e0193c36), `TREDRAW_SOFT`
flag, when isolated, is not cleared in `transformApply` and therefore is
used in the `drawTransformApply` callback which basically recalculates
the `transformation` which finally clears the flag.

So remove the `drawTransformApply` callback so `transformApply` is not
called when unnecessary.

Differential Revision: https://developer.blender.org/D14430
2022-03-28 14:18:56 -03:00
854af0cd09 Cleanup/Refactor: remove unused 'SNAP_ONLY_ACTIVE' enum parameter
`SNAP_ONLY_ACTIVE` was implemented in order to be used in the Knife tool,
but the project did not go ahead.
2022-03-28 13:55:13 -03:00
39df927b4a Transform: Improve 'absolute grid snap' support detection
The solution supposedly listed all cases that `absolute grid snapping`
was supported. But it ignored some occasions like: Editing Surface
objects, Texture Space.

List now only the cases where this feature should not be supported.
2022-03-28 13:55:13 -03:00
4c66021ccc Cleanup: transform, use early returns
This makes the flow clearer and avoids many `else` conditions.
2022-03-28 13:55:12 -03:00
8b5292a60e Outliner: Don't show indirectly linked Library Overrides properties
The Library Overrides display mode is meant to show overridden
properties from the current file only, not library overrides in
data-blocks that just were linked in. The upcoming Hierarchies view mode
for Library Overrides will also display linked in data-blocks that have
overrides in the source file (but not the individual overridden
properties), see T95802.
2022-03-28 18:03:57 +02:00
2e99295d5e Fix T96812: Regression: Snapping is broken with proportional editing
This was a mistake in the conditional structure introduced in 4b35d6950d

This commit also adds a new type of snap exclusion: `SNAP_NOT_EDITED`.

Thanks to @Ethan1080 for pointing out the error.
2022-03-28 11:26:48 -03:00
e6dfe570cc Fix T96828: GPencil primitives handlers not working
Following the logic is not necessary to check the mouse button because the status has changed before.
2022-03-28 13:11:07 +02:00
555e7c2091 Cleanup: Use bool literals in return statements of text editor poll functions. 2022-03-28 12:11:44 +02:00
da130d751f Fix various UI messages issues. 2022-03-28 10:40:14 +02:00
587efa9949 Fix (unreported) crash in some mesh-from-object code.
Crashed e.g. FBX exporter.

Mistake in rB0c33e84020deca.
2022-03-28 09:53:17 +02:00
af1341322f Fix T96670: bake from multires not reflected in the Image Editor. 2022-03-28 08:28:09 +02:00
387b34f0c2 Cleanup: return success from python_script_error_jump
Relying on checks for the assignment of return arguments isn't so
clear especially when there are multiple return arguments.
2022-03-28 17:15:41 +11:00
1466f480c4 Python: select the start-end range of syntax errors
Python 3.10's syntax errors can specify a range.
Use this for text editor error selection.
2022-03-28 17:06:38 +11:00
0ce6ed4753 Cleanup: variable/argument naming for Python exception access
Names filename/filepath/fn were used interchangeably.
2022-03-28 16:54:31 +11:00
3ea90de9e6 Fix text editor failure to move the cursor for syntax errors
This broke between 3.0 and 3.1, upgrading to Python 3.10 seems the
likely cause as this code didn't change.
2022-03-28 16:44:25 +11:00
e8fd2d8469 Cleanup: early exit when there is no exception
Reduces noise in D9752, no functional change as PyErr_NormalizeException
doesn't do anything when there is no exception set.
2022-03-28 15:06:47 +11:00
6f305577b3 Cleanup: use "num" as a suffix in: source/blender/modifiers
Also rename DNA struct members.
2022-03-28 14:41:31 +11:00
24839fdefa Cleanup: use "num" as a suffix in: source/blender/nodes 2022-03-28 14:14:31 +11:00
556384ca1d Cleanup: use "num" as a suffix in: source/blender/render
See T85728
2022-03-28 14:14:31 +11:00
83c274ccfc Cleanup: use "num" as a suffix in: source/blender/python
See T85728
2022-03-28 14:14:31 +11:00
77155ae1c0 Cleanup: Reduce duplication to prepare for UDIM packing
In preparation for supporting packing of UDIM tiled textures, this patch
refactors a small portion of image.cc. The refactor should lead to less
duplicate code now and when Tiled images are added in the near future.

This patch is based on the prior work done for D6492 where it was
requested this part be split and can be summarized as follows:
 - `load_sequence_single` is removed and merged with `load_image_single`
 - `image_load_sequence_file` is removed and merged with `image_load_image_file`

Reviewed By: lukasstockner97

Differential Revision: https://developer.blender.org/D14327
2022-03-27 17:49:26 -07:00
e2e4c1daaa OBJ: use fmt library instead of sprintf for faster formatting
On Windows/MSVC this gives a minor (~20%) speedup presumably due to a faster float/int formatter. On macOS (Xcode13), this gives a massive speedup, since snprintf that is in system libraries ends up spending almost all the time inside some locale-related mutex lock.

The actual exporter code becomes quite a bit smaller too, since it does not have to do any juggling to support std::string arguments, and the buffer handling code is smaller as well.

Windows (VS2022 release build, Ryzen 5950X 32 threads) timings:
- Blender 3.0 splash scene (2.4GB obj): 4.57s -> 3.86s
- Monkey subdivided level 6 (330MB obj): 1.10s -> 0.99s

macOS (Xcode 13 release build, Apple M1Max) timings:
- Blender 3.0 splash scene (2.4GB obj): 21.03s -> 5.52s
- Monkey subdivided level 6 (330MB obj): 3.28s -> 1.20s

Linux (ThreadRipper 3960X 48 threads) timings:
- Blender 3.0 splash scene (2.4GB obj): 10.10s -> 4.40s
- Monkey subdivided level 6 (330MB obj): 2.16s -> 1.37s

The produced obj/mtl files are identical to before.

Reviewed By: Howard Trickey, Dalai Felinto

Differential Revision: https://developer.blender.org/D13998
2022-03-27 14:25:48 +03:00
3e12488b4e Cleanup: Remove frameserver cmake definition
Left over from rBaab5ac25f2c2e6fbc50f9fb352e71ef0ae0ba2f1
2022-03-26 21:59:22 -04:00
Lictex Steaven
08d2428632 GPencil: Add an xray toggle for each annotation layer
so a layer can be occluded by the scene instead of always showing in front

---

{F12827163}

Reviewed By: fclem, antoniov

Differential Revision: https://developer.blender.org/D13931
2022-03-26 18:26:43 +01:00
082b063f2a Increase bevel segment limit in modifier from 100 to 1000.
A user asked for this increase. The performance lags when reaching
the upper limit of this number of segments, but if you need that
many segments, I guess you are willing to wait.
2022-03-26 13:20:16 -04:00
ffafe494f6 Cleanup: Remove double #ifdef WITH_TBB check 2022-03-26 09:55:08 -06:00
9d25418a52 Fix T95901: Crash in Fill curve (set to N-gon)
The code that eats away faces until you find input faces in
the Constrained Delaunay Triangulation goes too far and crashes
when there are no input faces. In the test case there were input
faces but they only had two vertices, so were all ignored.
2022-03-26 10:47:09 -04:00
4039e94422 Fix T96790: Gpencil Inverted Fill makes extra stroke at origin
The problem was the stroke was created in the inverted loop before checking if the total of points is 0 and exit the loop.

Also some code Cleanup.
2022-03-26 13:20:46 +01:00
23bbc0d748 DRW: Port draw_common.c to use shared definition with GLSL 2022-03-26 13:16:01 +01:00
6073b6b874 GPU: ShaderBuilder: Skip shader compilation for unsupported shaders. 2022-03-26 13:16:01 +01:00
ab97add5fa GL: Fix shader error logging on Apple M1 hardware 2022-03-26 13:16:01 +01:00
664eb19369 GPU: ShaderBuilder: Fix compilation on Mac
This is less than ideal as it seems to link against all
of blender disregarding the stubs.
2022-03-26 13:16:01 +01:00
9c41767d57 Cleanup: move eFileSel_Action from DNA to WM_api.h
This isn't stored in blend files so it can be moved out of DNA.

Also use an enum for `WM_FILESEL_*` members.
2022-03-26 18:42:33 +11:00
4d5e8e5477 Fix incorrect argument for rigid-body world export 2022-03-26 18:36:28 +11:00
c01afe9562 Cleanup: use "use_" prefix for booleans 2022-03-26 18:04:27 +11:00
c330c7a5da Cleanup: quiet compiler warning 2022-03-26 18:04:19 +11:00
1909fd2781 Windows/Installer: Fix capital B in shortcut
the shortcut placed on the desktop and in the start
menu on windows were labelled `blender` rather than `Blender`

spotted by @Severin
2022-03-25 15:17:48 -06:00
6bf51ab03a CMake: Give some extra space to info_cfg_option
WITH_PYTHON_INSTALL_ZSTANDARD was too long and
didn't align very well compared to the other
items in the list.
2022-03-25 14:33:39 -06:00
ba49345705 Fix Outliner highlighting multiple base elements in different libraries
In the Blender File display mode of the Outliner, mouse hovering a
"base" element (e.g. "Objects", "Materials", ...) would also highlight
that same base element in other libraries linked into the scene. In fact
operations like (un)collapsing would be applied to both too.
Issue was that we'd always use the listbase containing the data-blocks
from the current main as a way to identify the tree element. So for the
same data-block types we'd use the same listbase pointers. Instead use
the the library pointer + a per library index.
2022-03-25 19:00:04 +01:00
2631b44e71 MSVC: Fix linker issue with USD
USD requires to be linked with /WHOLEARCHIVE so
the linker won't remove their static initializers.

This strangely has never worked for MSVC since
the flags were set on the LINK_FLAGS property
which is only used to link .dll and .exe files,
given this is a static lib, the flags were not
used, nor did CMake propagate the link directive
to the final targets that did link. Not quite sure
how this has not lead to more problems in the past.

Setting the link directive on the INTERFACE_LINK_OPTIONS
makes cmake do the right thing.

Differential Revision: https://developer.blender.org/D14394
Reviewed by: sybren
2022-03-25 10:15:11 -06:00
19bcfba56f USD I/O: explicitly set or clear the OPTYPE_UNDO flag
Exporting USD cannot be undone, but importing should be undo'able.
2022-03-25 16:53:17 +01:00
2fc77071b5 Image editor: not updating after image operation.
Fixes T96324, T96312, T96323
2022-03-25 16:36:50 +01:00
c671a26637 USD: Support building against USD 21.11+
For 3.2 USD will be bumped to a newer version with some
slight API changes, however since we cannot simultaneously
land the libs for all platforms as well as these code changes,
we'll have to support both 21.02 and 21.11+ for at least a
short period of time making the code slightly more messy than
it could have been.

Differential Revision: https://developer.blender.org/D14184
Reviewed by: sybren
2022-03-25 09:29:39 -06:00
378022c797 BLI: Adjust interpolation to support integers, other tweaks
In order to allow interpolation of integers with a float, add a separate
template parameter for the factor and multiplication types.
Also move some helper constexpr variables to the "base" header
(reversing the dependency to "base" -> "vector").

This also adds a distance function for scalar types, which is
helpful to allow sharing code between vectors and basic types.

Differential Revision: https://developer.blender.org/D14446
2022-03-25 09:57:10 -05:00
1243cb803e Cleanup: Add asserts, remove default case 2022-03-25 09:12:31 -05:00
cea51c1bb5 Curves: Bezier and general interpolate to evaluated utility
This commit implements generic evaluation for Bezier curves (which is
really just linear interpolation, since attributes are not stored on
Bezier handles). For complete parity with the old curve type, we would
have to add options for this (RNA: `Spline.radius_interpolation`),
but it's not clear that we want to do that.

This also adds a generic `interpolate_to_evaluate` utility on curves
that hides the implementation details. Though there is theoretically
a performance cost to that, without some abstraction calling code
would usually be too complex.

Differential Revision: https://developer.blender.org/D14447
2022-03-25 09:03:35 -05:00
c0016d85b2 Curves: Add a utility to count curves of each type
This commit adds a utility that returns an array with the number
of curves of every type. One use case for this is detecting whether
to remove handle or NURBS attributes when changing curve types.
It's best to avoid using this when it's not necessary, but sometimes
it can't really be avoided, and having a utility at least makes using
an optimized version simple.

In the future, this information can be cached in the curves runtime.

Differential Revision: https://developer.blender.org/D14448
2022-03-25 09:00:30 -05:00
59de9ceda0 MSVC: Fix build issue with webp
The webp variables should only be set if
the libs actually exist in the lib folder
2022-03-25 07:31:15 -06:00
97f2210157 GPencil: Cyclic flag for dot dash modifier
Cyclic option per segment, allows interesting "loop" visual effects.

Reviewed by: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D14439
2022-03-25 20:13:50 +08:00
Henrik Dick
d4e1458db3 GPencil: Improve smooth operation
This patch makes the grease pencil smooth operation symmetric.
It also increases the performance a lot if strong smoothing is
required. Additionally there is an option for the position smooth
operation to keep the shape closer to the original for more iterations.

Since the result differs from the previous algorithm, versioning is used
to change the iterations and factor to match the old result.

Differential Revision: http://developer.blender.org/D14325
2022-03-25 11:51:45 +01:00
0c33e84020 Fix compilation warnings after previous change
Thanks Jacques for finding solution for deprecation warning
which was generated by GCC for constructor.

The rest of the change is related on fixing memaccess warning
which was happening when memset/memcpy was used directly on
the DNA object pointer. Now there are two utility functions
for this:

- blender:🧬:zero_memory
- blender:🧬:copy_memory
2022-03-25 11:45:50 +01:00
03df72ee4e Implement C++ methods for DNA structures
This change makes it possible to add implementation of common
C++ methods for DNA structures which helps ensuring unsafe
operations like shallow copy are done explicitly.

For example, creating a shallow copy used to be:

  Object temp_object = *input_object;

In the C++ context it was seen like the temp_object is
properly decoupled from the input object, while in the
reality is it not. Now this code becomes:

  Object temp_object = blender:🧬:shallow_copy(*input_object);

The copy and move constructor and assignment operators are
now explicitly disabled.

Other than a more explicit resource management this change
also solves a lot of warnings generated by the implicitly
defined copy constructors w.r.t dealing with deprecated fields.
These warnings were generated by Apple Clang when a shallow
object copy was created via implicitly defined copy constructor.

In order to enable C++ methods for DNA structures a newly added
macro `DNA_DEFINE_CXX_METHODS()` is to be used:

  tpyedef struct Object {
    DNA_DEFINE_CXX_METHODS(Object)
    ...
  } Object;

For the shallow copy use `blender:🧬:shallow_copy()`.

The implementation of the memcpy is hidden via an internal DNA
function to avoid pulling `string.h` into every DNA header.
This means that the solution does not affect on the headers
dependencies.

---

Ideally `DNA_shallow_copy` would be defined in a more explicit
header, but don;t think we have a suitable one already. Maybe
we can introduce `DNA_access.h` ?

Differential Revision: https://developer.blender.org/D14427
2022-03-25 11:45:50 +01:00
75b8c4fc18 LibOverride: Prevent some more potential modification of overridden collections. 2022-03-25 11:39:06 +01:00
484af996aa Revert "Implement C++ methods for DNA structures"
This reverts commit 8c44793228.

Apparently, this generated a lot of warnings in GCC.

Didn't find a quick solution and is it not something I want to be
trading between (more quiet Clang in an expense of less quiet GCC).

Will re-iterate on the patch are re-commit it.
2022-03-25 10:57:13 +01:00
8c44793228 Implement C++ methods for DNA structures
This change makes it possible to add implementation of common
C++ methods for DNA structures which helps ensuring unsafe
operations like shallow copy are done explicitly.

For example, creating a shallow copy used to be:

  Object temp_object = *input_object;

In the C++ context it was seen like the temp_object is
properly decoupled from the input object, while in the
reality is it not. Now this code becomes:

  Object temp_object = blender:🧬:shallow_copy(*input_object);

The copy and move constructor and assignment operators are
now explicitly disabled.

Other than a more explicit resource management this change
also solves a lot of warnings generated by the implicitly
defined copy constructors w.r.t dealing with deprecated fields.
These warnings were generated by Apple Clang when a shallow
object copy was created via implicitly defined copy constructor.

In order to enable C++ methods for DNA structures a newly added
macro `DNA_DEFINE_CXX_METHODS()` is to be used:

  tpyedef struct Object {
    DNA_DEFINE_CXX_METHODS(Object)
    ...
  } Object;

For the shallow copy use `blender:🧬:shallow_copy()`.

The implementation of the memcpy is hidden via an internal DNA
function to avoid pulling `string.h` into every DNA header.
This means that the solution does not affect on the headers
dependencies.

---

Ideally `DNA_shallow_copy` would be defined in a more explicit
header, but don;t think we have a suitable one already. Maybe
we can introduce `DNA_access.h` ?

Differential Revision: https://developer.blender.org/D14427
2022-03-25 10:37:56 +01:00
315210c22b XR: Fix crash on executing some action operators
Since the XR area does not have any region geometry, hud updates from
operators would cause invalid access when updating region sizes.
2022-03-25 13:22:04 +09:00
93f2ebe7dd Cleanup: use doxy sections for customdata.cc 2022-03-25 14:54:16 +11:00
8ed4638960 Fix: Small fixes for NURBS evaluation
Clear the nurbs basis cache dirty flag when its evaluation finishes.
Remove an incorrect assert that the evaluated size couldn't be zero.
It can, when `check_valid_size_and_order` returns false.
2022-03-24 22:31:50 -05:00
9b2879f8b3 Cleanup: Simplify logic, rename variables
Return the map of gathered attributes directly, use simpler
naming for "attributes" and "gathered_attributes".
2022-03-24 22:29:23 -05:00
83c99ccb21 Cleanup: Use more specific variable name 2022-03-24 22:17:54 -05:00
797a1356ca Curves: Tweak evaluated offset functions
Add a function to retrieve the points for an index range of curves,
and move "ensuring" the offsets to a separate function, since it's
often nicer to call that if you don't need the result span immediately.
2022-03-24 20:58:01 -05:00
6e72e3fdb2 Cleanup: Further renaming in new curves code
A follow-up to e253f9f66d. Follow the policy from T85728
completely (using "num" as a prefix) and rename another function.
2022-03-24 20:48:08 -05:00
d3999683ff WebP: Fix use after free 2022-03-24 21:21:18 -04:00
6e86cf0daa Docs: include WEBP in --help text 2022-03-25 12:10:30 +11:00
2eeb79805c Cleanup: remove argument to doxygen \file
Doxygen doesn't require this to be set.
2022-03-25 12:10:30 +11:00
1ba20947cc Cleanup: rename CustomDataExternal.filename => filepath
Reserve "filename" when only the name component is used.
2022-03-25 12:10:30 +11:00
7d1d9e6015 Cleanup: rename ParticleSettings.child_nbr => child_percent
child_nbr was used as a percentage as well as the final
number of particles. Rename to avoid confusion.
2022-03-25 12:10:21 +11:00
4d46fac65d Cleanup: use count or num instead of nbr
Follow conventions from T85728.
2022-03-25 12:04:20 +11:00
c594cfbe50 Cleanup: use array syntax for sizeof, zero before float suffix 2022-03-25 12:04:19 +11:00
bbd787275f Cleanup: spelling in comments, strings 2022-03-25 12:04:16 +11:00
1d2dfc5e9e Cleanup: sort cmake file lists 2022-03-25 12:04:14 +11:00
a446c53f16 Cleanup: unused warnings 2022-03-25 12:04:12 +11:00
d3a1e9cbb9 Geometry Nodes: Multi-thread creation of selection from field
When boolean fields are evaluated and used as selections, we create
a vector of indices. This process is currently single-threaded, but
226f0c4fef added a more optimized multi-threaded version
of this process. It's simple to use this in the field evaluator.

I tested this with the set position node and a random
value node set to boolean mode on a Ryzen 2700x:
|              | Before  |  After  | Improvement |
| 10% Selected | 40.5 ms | 29.0 ms | 1.4x        |
| 90% Selected | 115 ms  | 45.3 ms | 2.5x        |

In the future there could be a specialized version for non-span
virtual array selections that uses `materialize` to lower virtual
call overhead.

Differential Revision: https://developer.blender.org/D14436
2022-03-24 18:48:38 -05:00
b030ec8760 BLF Cleanup: Use FreeType Enum FT_Err_Ok
Replace comparisons of FT_Error against 0 with FT_Err_Ok instead.

See D14052 for more details.

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

Reviewed by Campbell Barton
2022-03-24 16:20:10 -07:00
4fd0a69d7b ImBuf: Add support for WebP image format
Currently only supports single image frames (no animation possible).

If quality slider is set to 100 then lossless compression will be used,
otherwise lossy compression is used.

Gives about 35% reduction of filesize  save when re-saving splash screens with lossless
compression.
Also saves much faster, up to 15x faster than PNG with a better compression ratio as a plus.

Note, this is currently left disabled until we have WebP libs (see T95206)

For testing precompiled libs can be downloaded from Google:
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html

Differential Revision: https://developer.blender.org/D1598
2022-03-24 18:24:06 -04:00
Jesse Yurkovich
07846b31f3 Cleanup: Optimize viewport view data creation
Each time the user clicks the viewport 2 sets of engine views are
created. Each set is currently composed of 8 view objects, each of size
592 bytes.

Because space is not reserved in the vector that holds them, several
unnecessary re-allocation/copy cycles occur as the vector resizes and
the total allocation load is 8880 bytes. This happens twice.

Reduce to just the allocations necessary and with exactly 4736 bytes
allocated for each set
 - Before: 8 allocations and 8 deallocations totaling 17760 bytes
 - After: 2 allocations and 2 deallocations totaling 9472 bytes

Reviewed By: fclem, jbakker

Differential Revision: https://developer.blender.org/D13782
2022-03-24 21:26:11 +01:00
3c4947cdaa Fix T96756: Blender hanges on rendering after file save, after recent changes 2022-03-24 19:42:59 +01:00
9ef400ddf7 Cycles: don't write light passes for shadow catcher objects
Makes it easier to composite the Combined image from these passes.

Fixes T96758
2022-03-24 19:42:59 +01:00
4a1b0ea902 Fix T94001: OpenColorIO configuration with 1D textures not working 2022-03-24 19:42:59 +01:00
067d0d4466 Fix: Missing "Hair" to "Curves" rename
Missed in fe1816f67f
2022-03-24 13:10:16 -05:00
fb3a0a34b4 Fix: Build error with flag usage and strict warnings 2022-03-24 12:54:30 -05:00
a6214ce7ac Outliner: Don't show empty base elements in the library overrides mode
In the library overrides mode, in some situations there would be empty
base elements like "Collections" or "Objects". Don't show them, it's
confusing wihout use. Code just failed to consider that case.
2022-03-24 18:38:21 +01:00
511dfb7743 Outliner: Don't draw library overrides indicator for override buttons
All the buttons in the Library Overrides display mode would be shown in cyan,
indicating that they are library overrides. Given that this is solely what this
display mode is about, the indicator is just redundant, confusing (why are the
buttons purple?) and looks weird.

Part of T95802.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D14416
2022-03-24 18:17:44 +01:00
ef228d92f2 Fix: Volume grid duplication on USD import.
Fix provided by Piotr Makal in patch D14204.

This patch fixes volume grid duplication which was occurring during
importing USD files. This was caused by calling BKE_volume_grid_add
twice per grid (excluding 'density' grid) for the same Volume
object: (1) in USDVolumeReader::read_object_data and (2) later in
BKE_volume_load.

Differential Revision: https://developer.blender.org/D14204
2022-03-24 12:42:11 -04:00
Lictex Steaven
db4d5d1583 Fix T90110: Dupli Window Not Immediately Active
When creating a new window from a duplicated area - by shift-dragging
on corner action zones - on the Windows platform the resulting window
is initially unresponsive. This patch fixes this by releasing the parent
window's mouse capture.

See D14085 for more details.

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

Reviewed by Ray Molenkamp
2022-03-24 09:41:29 -07:00
dcb520a7af Outliner: Remove list of library overrides from general display modes
There is a dedicated Library Override display mode now, and showing
these elsewhere just adds noise and makes the code problematic to
maintain (since the same element hierarchy will be used in two entirely
different contexts). The corresponding filter settings are removed too.

Part of T95802.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D14411
2022-03-24 17:25:24 +01:00
1ff853a3f0 Outliner: Don't display library overrides from linked files
Instead of having the "Current File" and then the individual libraries
containing indirect library overrides in the Library Overrides display
mode, only show what's in the current file. Agreement was that this
isn't very useful in this view, we may want to add it to the Hierarchy
view though (see T95802).

Part of T95802.

Also expands the top level ID type items ("Objects", "Materials", ...)
by default. See D14410 for details.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D14410
2022-03-24 17:22:37 +01:00
00018bfaa2 Tracking: Fix incorrect angle calculation on marker slide
Now the mouse cursor will exactly follow the tilt/scale sliding area.
2022-03-24 16:56:31 +01:00
dd7250efb1 Tracking: Fix jump when sliding tild/scale of marker
Was a mistake in coordinate handling: need to take possible offset
from the sliding area.

Mouse us still not fully perfectly follows changes of the tilt slide
area, but that is a separate issue.
2022-03-24 16:21:59 +01:00
Henrik Dick
cee6af0056 GPencil: New Envelope Modifier
This new modifier creates a shape known as envelope. It connects all
points that are n points apart. There is also a mode which fits a
single stroke to the envelope shape that is determined by that rule.

For more details, refer to the patch.

Reviewed By: NicksBest, antoniov, frogstomp, mendio

Differential Revision: http://developer.blender.org/D14341
2022-03-24 13:01:46 +01:00
Henrik Dick
dd161ff7a4 Complex Solidify: handle vertex creases
This implements the same interpolation method as for bevel weights
now for vertex and edge creases as well to improve the flexibility.

Differential Revision: http://developer.blender.org/D14170
2022-03-24 12:30:48 +01:00
4a674d08dd Outliner: tweak handling of liboverrides in delete code.
Essentially, we only allow deletion of hierarchy roots of liboverrides,
when hierarchy deletion option is enabled.

Also add some checking code in the generic, non-object/collection ID
delete code, to prevent any deletion of liboverrides that would be part
of a hierarchy.
2022-03-24 12:01:48 +01:00
24c30e001f 3D View: preference to disable selection cycling on first click
Object mode selection does a kind of cycling that excludes the active
selected object. This is separate from regular selection cycling which
is enabled when clicking multiple times without moving the cursor.

This has the down-side that clicking on an object to drag it always
selects the object behind it (in the case of overlapping objects).

Since object mode selection is fundamental functionality, this is
exposed as an experimental preference for user feedback & testing.

See T96752 for details.
2022-03-24 21:48:22 +11:00
643da14a4e Fix make source_archive_complete for release branches
In Blender 3.1 we can't run the source_archive_complete because the
cmake program is trying to download the packages from svn trunk. However
3.2 (aka master) already changed the version of some of the source
packages.

For example the OpenXR-SDK. It should be looking for
OpenXR-SDK-1.0.17.tar.gz in:
https://svn.blender.org/svnroot/bf-blender/tags/blender-3.1-release/lib/packages/

But instead it tries to look for it in:
https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/

Which can't be found since it was replaced with OpenXR-SDK-1.0.22.tar.gz

---

Release checklist: https://wiki.blender.org/wiki/Process/Release_Checklist

The release checklist was updated to include the new instructions:
`In the release branch, update and uncomment BLENDER_VERSION in download.cmake`

Differential Revision: http://developer.blender.org/D14292
2022-03-24 11:39:34 +01:00
Henrik Dick
acd7a648b1 GPencil: Add Scale Thickness to Pivot Point Pie Menu similar to Only Locations
In my opinion Scale Thickness feels similar to Only Locations and was missing from the pie menu in grease pencil edit mode, so here I added it.

Differential Revision: https://developer.blender.org/D12530
2022-03-24 11:22:33 +01:00
a2c2f6a39e Correct syntax error for MSVC 2022-03-24 21:13:58 +11:00
7a028330d2 Cleanup: clang-format 2022-03-24 11:01:12 +01:00
Henrik Dick
8d4244691a GPencil: lower bounds for gap in dot dash modifier
This patch maximizes the possible bounds for the dash and
gap parameters in the dot dash modifier. This makes e.g.
chopping up lines without gaps possible.

Differential Revision: http://developer.blender.org/D14428
2022-03-24 10:51:14 +01:00
bc290b47cd Keymap: experimental preference always use "Mouse Select & Move"
This was already as a preference for the tweak tool,
this preference enables the option for all selection
in the 3D view & UV editor.

This extends on changes from T96544.
2022-03-24 20:45:13 +11:00
e006e66084 Cleanup: use struct member identifiers for initialization
Relying on the order of struct members can be error prone. Update other
instances of ObjectsVisibleIteratorData initialization for MSVC/C++.
2022-03-24 17:30:45 +11:00
4682a0882f Cleanup: use "filepath" instead of "filename" for full paths
Reserve "filename" when only the name component is used.
2022-03-24 16:54:01 +11:00
5058c4b144 Cleanup: localize finding the nearest non-active object on selection
Move this into it's own block since it only needs to run if the
nearest object is currently selected & active.
2022-03-24 15:56:05 +11:00
0ee95e83ea View 3D: Don't prioritize pose objects unless in pose-mode
Always prioritizing bones caused pose-objects to be selected in object
mode even if they were behind other objects.

Now prioritizing pose bones is limited to pose mode.
2022-03-24 15:56:05 +11:00
3e5e204c81 3D View: order by depth when selecting cycles through objects
When cycling through objects select the nearest first
instead of using the order of object-bases in the view_layer.

This matches how pose selection works.
2022-03-24 15:56:05 +11:00
e67cd1f9a8 Cleanup: remove redundant argument for key-map selection template 2022-03-24 15:56:05 +11:00
6d61cf4e80 Cleanup: Typo, improve variable names
`accumulate_counts_to_offsets` wasn't just used for the point domain.
2022-03-23 23:50:10 -05:00
7ef3a1a6e6 BLI: Add utility for tacking average and min runtime
This is useful to save time manually averaging many timing results.
The minimum is included because often it can be more stable than an
average, and it can help to expose calls from other contexts with lower
times that would make the average useless.

Differential Revision: https://developer.blender.org/D14417
2022-03-23 23:35:23 -05:00
610ec34c1f Geometry Nodes: Improve performance writing to vertex groups
In a test file from T96282, this commit reduces the runtime of the
delete geometry node from 82 ms to 23 ms, a 3.6x improvement.
Writing to vertex groups in other cases should be faster too.

The largest improvement comes from not writing a new weight
of zero if the vertex is not in the group. This mirrors the behavior
of custom data interpolation in `layerInterp_mdeformvert`.
Other improvements come from using `set_all` for writing
output attributes and implementing that method for vertex groups.

I also implemented `materialize` methods. Though I didn't obverse
an improvement from this, I think it's best to remove virtual method
call overhead where it's simple to do so.

The test file for the delete geometry node needs to be updated.
These methods could be parallelized too, but better to do that later.

Differential Revision: https://developer.blender.org/D14420
2022-03-23 23:27:26 -05:00
aeb2c2afaf Cleanup: Clang tidy
- Deprecated headers
- Else after return
- Inconsistent parameter names (I used the most recently modified)
- Raw string literals
2022-03-23 23:24:54 -05:00
e253f9f66d Cleanup: Adjust naming in new curves code
Rename "size" variables and functions to use "num" instead,
based on T85728 (though this doesn't apply to simple C++
containers, it applies here). Rename "range" to "points" in
some functions, so be more specific.

Differential Revision: https://developer.blender.org/D14431
2022-03-23 23:05:46 -05:00
a1598d6835 UDIM: Improve tile format detection in filenames
There are some filenames where the UDIM pattern guessing would fail
unnecessarily. The user can fix these up afterwards but it would be
nicer if they would detect properly in the first place.

Examples:
`test.1001.ver0023.png` would guess wrong since it uses the image
sequence detection code which finds the first sequence from the end. It
would guess `filename.1001.ver<UDIM>.png`

`uv-test.u1_v2.png` would fail detection due to a bug in the processing.

Make this much more reliable and add tests for the most important tile
related get/set/detection functions.

Differential Revision: https://developer.blender.org/D14320
2022-03-23 21:01:36 -07:00
ead2c71a90 Cleanup/fix wrong enum items for object.gpencil_modifier_add
No functional changes as the actual list used for display is generated
at runtime via a callback.
2022-03-24 03:43:41 +01:00
ead9ed7e16 Cleanup: extra property update for ShaderFxGlow.opacity 2022-03-24 03:25:10 +01:00
98d4872d7f Cleanup: remove debug prints 2022-03-24 01:35:27 +01:00
Brian Savery
c46e58817c Cycles: enable HIP for Vega and Vega II (Radeon 7) GPUs on Windows
Basic testing on windows only so far. Will need some testing on Linux as well
when the Linux enablement patch is ready.

Does not enable Vega APUs yet (which would be gfx902 or gfx90c).

Differential Revision: https://developer.blender.org/D14432
2022-03-24 01:12:45 +01:00
ad976c0dd7 Fix missing updates for external render engines rendering tiles
For render image buffers to be acquired, a lock must be provided. Also
fixed wrong usage of release, it must always be called regardless if the
returned image buffer is NULL.
2022-03-24 01:03:47 +01:00
51380b9346 Fix Cycles Metal build error and GCC warning after recent changes
Function overloading of make_float4() doesn't work since it's a macro, just
don't do this minor cleanup then.
2022-03-23 23:25:31 +01:00
d84b4becd3 Fix compile error on GCC
Explicit template specialization has to happen outside of class
definition (some compilers are more lenient). Since it is not possible to
specialize the method without also specializing the enclosing class for
all of its possible types, the method is moved outside of the class, and
specialized there.
2022-03-23 22:01:32 +01:00
945dfd200b Cleanup: add const qualifier
This adds a const qualifier to some code path in the Alembic and USD
importers. More could be added elsewhere. This change is done as it will
be required when GeometrySets are supported and helps keeping diff noise
in the patch to a bare minimum.
2022-03-23 21:32:09 +01:00
03a7747aa6 Cleanup: use nullptr 2022-03-23 21:32:09 +01:00
300239b01f UI: Correct error message wording
Fixes T96724
2022-03-23 16:13:09 -04:00
Yuki Hashimoto
31bfa17a1f Cleanup: delete unused ViewMapIO files in Freestyle
ViewMapIO.h is only included in Controller.cpp init_options().
However, g_models_path and g_flags set here are never used elsewhere.
Therefore, ViewMapIO files can be deleted without affecting anything.

Differential Revision: https://developer.blender.org/D14423
2022-03-23 20:06:12 +01:00
Charles Flèche
e7b1be52e0 Cycles: add Alembic procedural to Cycles standalone xml
Example:

<alembic filepath="/tmp/cube.abc" scale="1.45">
  <object path="/Cube/Cube" />
</alembic>

Differential Revision: https://developer.blender.org/D14391
2022-03-23 20:06:12 +01:00
Ethan-Hall
f5066d43ae Cleanup: use make_float4(f) zero_float4() to simplify code
Differential Revision: https://developer.blender.org/D14426
2022-03-23 20:06:12 +01:00
Ethan-Hall
4e56e738a8 Cycles: optimize CPU texture sampler interpolation
Use templates to optimize the CPU texture sampler to interpolate using
float for single component datatypes instead of using float4 for all types.

Differential Revision: https://developer.blender.org/D14424
2022-03-23 20:06:12 +01:00
d67f9820b8 Curves: improve Comb brush
New supported features:
* 3D/spherical brush that samples a good position on the curves.
* Falloff.

The custom falloff curve mapping is not yet available in the ui because that
requires some more ui reorganization. This is better done when we have
a better understanding of what settings we need exactly.

Currently, the depth of the 3d brush is only sampled once per stroke, when
first pressing LMB. Sometimes it is expected that the depth of the brush can
change within a single brush. However, implementing that in a good way
is not straight forward and might need additional options. Therefore that
will be handled separately. Some experimentation results are in D14376.

Ref T96445.

Differential Revision: https://developer.blender.org/D14376
2022-03-23 18:19:59 +01:00
5d38b13e61 CMake: Rename "USD_LIBRARY_PREFIX" to "PXR_LIB_PREFIX" for consistency
rBc1909770e7f192574ea62449dd14b4254637e604 introduced "PXR_LIB_PREFIX" for building the
dependencies, so only makes sense to use the same name in the Hydra render delegate CMake too
2022-03-23 16:52:02 +01:00
d350976ba0 Cycles: Add Hydra render delegate
This patch adds a Hydra render delegate to Cycles, allowing Cycles to be used for rendering
in applications that provide a Hydra viewport. The implementation was written from scratch
against Cycles X, for integration into the Blender repository to make it possible to continue
developing it in step with the rest of Cycles. For this purpose it follows the style of the rest of
the Cycles code and can be built with a CMake option
(`WITH_CYCLES_HYDRA_RENDER_DELEGATE=1`) similar to the existing standalone version
of Cycles.

Since Hydra render delegates need to be built against the exact USD version and other
dependencies as the target application is using, this is intended to be built separate from
Blender (`WITH_BLENDER=0` CMake option) and with support for library versions different
from what Blender is using. As such the CMake build scripts for Windows had to be modified
slightly, so that the Cycles Hydra render delegate can e.g. be built with MSVC 2017 again
even though Blender requires MSVC 2019 now, and it's possible to specify custom paths to
the USD SDK etc. The codebase supports building against the latest USD release 22.03 and all
the way back to USD 20.08 (with some limitations).

Reviewed By: brecht, LazyDodo

Differential Revision: https://developer.blender.org/D14398
2022-03-23 16:39:05 +01:00
827e9ccb29 Revert "Fix T96728: 'Automatic Constraint' using the wrong orientation"
This reverts commit 6cc83f9079.

That commit removed the feature of cancel the 'Auto Constraint'
if it is enabled without drag.
2022-03-23 12:26:58 -03:00
6cc83f9079 Fix T96728: 'Automatic Constraint' using the wrong orientation
If the `Automatic Constraint` modifier was activated while an axis
constraint was already set, the orientation used would be the default
orientation of the mode and not that of the scene.

This was because the `initSelectConstraint` function was not called in
this case and the `Automatic Constraint` mode was enabled by other
indirect means

So the solution is to call `initSelectConstraint` in either case and
remove these "indirect means" of enabling `Automatic Constraint`.
2022-03-23 12:20:39 -03:00
e25238e146 Fix build error on GCC after recent changes 2022-03-23 16:12:55 +01:00
d40d5e8d0f Cleanup: move Mesh Sequence Cache modifier to C++
This moves `MOD_meshsequencecache.c` to C++ and fixes compile warnings
introduced from the change. This uses C++ style casts, as well as
`nullptr` instead of `NULL`.

This will allow to output `GeometrySets` from the modifier, which is C++.

Differential Revision: https://developer.blender.org/D13662
2022-03-23 15:34:13 +01:00
5ac4e6c911 Color Management: add support for OpenColorIO color space aliases
This enables the configuration to specify aliases for compatibility with other
configurations.

When a colorspace name is saved in a.blend, that is the alias of a colorspace
in the current configuration, it will show the main colorspace from the
configuration in the user interface and Python API instead.

Loading & saving the .blend file does not make any changes to the stored name,
so as to not make hidden modifications. Only when setting the property again
will the alias name be overwritten by the main colorspace name.

Fixes T96049

Differential Revision: https://developer.blender.org/D14419
2022-03-23 15:21:58 +01:00
7aab508e32 Color Management: support different settings for render and compositing output
The Output Properties > Output panel now has a Color Management subpanel to
override scene settings. When set to Override instead of Follow Scene, there
are settings to:

* For OpenEXR, choose a (linear) colorspace for RGBA passes
* For other file formats, use different display/view/look/exposure/gamma

These settings affect animation render output, image save of renders and the
compositor file output node. Additionally, the image save operator and
compositor file output nodes also support overriding color management.

Includes some layout changes to the relevant panels to accomdate the new
settings and to improve consistency. Ideally subpanels would be used to better
organize these settings, however nodes and operators don't currently support
creating subpanels.

Differential Revision: https://developer.blender.org/D14402
2022-03-23 15:21:58 +01:00
Jeroen Bakker
51727fe86f Fix T96502: Compilation error OCIO when using GradingPrimaryTransform.
When using GradingPrimaryTransform the generated GLSL code fails to compile. The actual issue is
inside OCIO (https://github.com/AcademySoftwareFoundation/OpenColorIO/issues/1603).

The reason is that unset clamping values are rendered out as `inf`, which isn't recognizable
by GLSL.

The issue is worked around by defining a default for `inf`.

Reviewed By: brecht

Maniphest Tasks: T96502

Differential Revision: https://developer.blender.org/D14425
2022-03-23 14:13:09 +01:00
3d5d8b7f71 Cleanup: Run clang-format on the OBJ exporter 2022-03-23 12:43:03 +01:00
f22331ad21 Cleanup: Move include statements outside of extern "C"
The linking type is to be specified in thew header when
it is really needed.
2022-03-23 12:43:03 +01:00
2d3a62fe16 Fix invalid NULL check in GPU_viewport_unbind_from_offscreen
Mistake from 1d49293b80.
2022-03-23 21:52:01 +11:00
f634010c6e Event System: improve handling of unknown keys
When converting ghost keys to Blender's event system:

- All keys that aren't part of the GHOST_TKey enum map to EVENT_NONE
  (ignored), note that it's an internal error if the value of key isn't
  a known value.

- Modify the switch statement so any missing members of GHOST_TKey
  warn at compile time (GCC & Clang only).

- GHOST_kKeyUnknown maps to EVT_UNKNOWNKEY.
  We could ignore this key, changing can be evaluated separately.
2022-03-23 21:30:36 +11:00
8f63dccaa9 Event System: ignore keys such as print-screen & num-lock
Avoid adding events with their type set to EVENT_NONE as these
can't be categorized usefully (keyboard/mouse/NDOF ... etc),
and add an extra case that needs to be accounted for.

Adding these events seems to be an unintentional change from [0],
these keys used to be ignored in 2.4x.

[0]: a1c8543f2a
2022-03-23 21:17:59 +11:00
ad370868a2 Fix T96712: Debug Assert with PrintScrn & ScrollLock keys
Caused by 08d8eee006.
2022-03-23 20:52:12 +11:00
94b2d83421 Cleanup: move documentation to headers, other minor corrections 2022-03-23 17:18:42 +11:00
56dba4df3c Revert "Fix T89560: Keymap editor no longer shows keying set dropdown"
This reverts commit e55f4657f7.

It's not intended to support assigning shortcuts to this operator,
which could only work for built-in keying sets caused warnings to be
reported warnings when exporting key-maps.

Prefer D14289, preventing users running into this problem to begin with.
2022-03-23 16:47:47 +11:00
d356edf420 UV: support "Tweak Tool: Left Mouse Select & Move"
- Follow the same conventions as the 3D viewport for UV selection
  (using SelectPick_Params internally).

- Use WM_operator_properties_mouse_select for selection properties.
2022-03-23 16:09:22 +11:00
cf1a0ca612 UI: Change subdiv to subdivision for EEVEE hair
Reviewed By: Blendify

Author: @Alaska

Differential Revision: https://developer.blender.org/D14346
2022-03-22 23:09:36 -04:00
612ec0ecdf Fix T96372: UV editor selection display wrong with GPU subdivision
Vertices were not drawn properly as the logic for mapped mesh was used
in the BMesh case.

Edge display would ignore subdivided edges which would come from coarse
edges when setting display flags.
2022-03-23 04:01:12 +01:00
694fe9f77b Fix outliner/selection updates when selecting in the 3D view
The checks for calling outliner flushing didn't account for
entering pose mode for the first time or that pose-bone selection
can also change the object selection.

Resolve by recording what changed and refresh accordingly.

Also de-duplicate calls to DEG_id_tag_update.
2022-03-23 13:44:15 +11:00
5f350a4acd Cleanup: various improvements to ed_object_select_pick
- Document parameters.
- Add code-comments.
- Remove some historic/unhelpful code-comments.
- Rename argument names that were ambiguous
  (object was a boolean for e.g.).
- Move `gpu` picking into an allocated struct which is only
  allocated & used when using GPU picking.
- Move variable declarations after menu picking has been handled.
2022-03-23 13:44:15 +11:00
4822153b85 Cleanup: spelling in comments 2022-03-23 12:15:50 +11:00
6bb28a1a52 Cleanup: follow Python code-style/conventions 2022-03-23 12:00:33 +11:00
3a038f8a60 CMake: add missing headers to source list 2022-03-23 11:58:59 +11:00
d2336237cf License headers: add license header to source/blender/gpu/metal 2022-03-23 11:47:05 +11:00
366abae3e7 Cleanup: use ifdef to disable enum string allocation
Restore variable removed in [0], using an ifdef to avoid the warning.

[0]: c3ecfdf40b
2022-03-23 11:43:21 +11:00
5c27391b0f UI: Clarify fluid sim CFL Number tooltip
Fixes T93863
2022-03-22 18:06:02 -04:00
cc3ec1fc6f Fix minor error in last commit (4b35d6)
If there is no active object, it is to be expected that we are in
object mode as well.
2022-03-22 17:30:03 -03:00
4b35d6950d Fix T96711: snap in edit mode for selected objects does not work
Regression introduced in 52be063012

The `SNAP_NOT_SELECTED` option should only consider base selected if
we are in object mode.
2022-03-22 17:21:58 -03:00
b7b3c4c40c Fix T96705: Crash when pressing F3 outside a Blender window if Developer extras
If the mouse is not hovering the window, there is no active region. This is a
valid state, but the UI-list filter operator didn't account for that case.
2022-03-22 18:35:28 +01:00
b40ac9684c Tiny visual fixes/tweaks for new library override buttons in Outliner
Tweaks:
- Increase horizontal padding for the buttons from 1 point to 2, looked like an
  unintentional placement error before.

Fixes:
- Missing horizontal padding for array buttons
- Small gap between separator line and right column when using a high interface
  scale
- Properly center buttons vertically.
2022-03-22 18:09:46 +01:00
87a0770bb9 Fix T96361: missing update when changing texture mapping properties 2022-03-22 16:33:55 +01:00
8344ef7394 Fix T96524: Regression: The Material Preview doesn't show
The preview does not work well with deferred render result pixels
allocation: it breaks the refresh and requires to toggle current
panels.

Since there is no tiled rendering for previews we don't save any
memory by deferring pixels allocations, so do it for the render
result during the render result creation.

Differential Revision: https://developer.blender.org/D14414
2022-03-22 16:00:09 +01:00
Leon Schittek
7de3caa05d Fix: Drag link search doesn't always connect to socket
Connecting to some sockets of a few nodes via the drag link search
would fail and trigger an assert, because the picked socket wasn't
available. This was due to some sockets only being available with
certain settings.

This patch fixes these cases by adding the availability conditions of
the socket to the node declaration with the `make_available` method
or manually adding a `node_link_gather_search` function.

Differential Revision: https://developer.blender.org/D14283
2022-03-22 09:57:50 -05:00
Laurynas Duburas
6bbc3b5610 Curve: Validation message split from nurb_check_valid
Split retrieval of translated text for the "invalid" messages for NURBS
curves from the actual calculation, which is a lower-level function.
Also fixes an issue where "At least two points required" would always
display in the "Active Spline" panel.

Differential Revision: https://developer.blender.org/D14315
2022-03-22 09:54:13 -05:00
b0aaf6ff4a Fix T96294: Crash and error with shape key normal calculation
A mistake in the mesh normal refactor caused the wrong mesh to
be used when calculating normals with a shape key's deformation.

This commit fixes the normal calculation by using the correct mesh,
with just adjusted vertex positions, and calculating the results
directly into the result arrays when possible. This completely avoids
the need to make a local copy of the mesh, which makes sense,
since the only thing that changes is the vertex positions.

Differential Revision: https://developer.blender.org/D14317
2022-03-22 09:43:02 -05:00
1c790555a0 Cleanup: Use bool for BMesh creation params
These boolean options are passed as uint, but they would be
easier to understand if using bool.

Differential Revision: https://developer.blender.org/D14405
2022-03-22 09:38:12 -05:00
64cd927519 Fix T96308: Mesh to BMesh conversion doesn't calculate vertex normals
Currently there is a "calc_face_normal" argument to mesh to bmesh
conversion, but vertex normals had always implicitly inherited whatever
dirty state the mesh input's vertex normals were in. Probably they were
most often assumed to not be dirty, but this was never really correct in
the general case.

Ever since the refactor to move vertex normals out of mesh vertices,
cfa53e0fbe, the copying logic has been explicit: copy the
normals when they are not dirty. But it turns out that more control is
needed, and sometimes normals should be calculated for the resulting
BMesh.

This commit adds an option to the conversion to calculate vertex
normals, true by default. In almost all places except the decimate
and edge split modifiers, I just copied the value of the
"calc_face_normals" argument.

Differential Revision: https://developer.blender.org/D14406
2022-03-22 09:33:50 -05:00
86d87fcbdb GL: Fix compilation error on MSVC (for real) 2022-03-22 14:52:51 +01:00
a43f3c761e GL: Fix compilation error on MSVC 2022-03-22 14:51:32 +01:00
e0ce1c45f8 Fix T96577: setting curve handles not working correctly with multiple curves
Differential Revision: https://developer.blender.org/D14409
2022-03-22 14:41:43 +01:00
3b5224b57c Cleanup: refactor passing of color management settings for image save
Make a copy of ImageFormatData that contains the effective color management
settings, and pass that along to the various functions. This will make it
possible to add more complex logic later.

For compositing nodes, passing along view and display settings through
many functions made it harder to add additional settings, so just get those
from the scene now.

Differential Revision: https://developer.blender.org/D14401
2022-03-22 14:15:20 +01:00
2ebcb7fab3 Cleanup: make format and fix warning 2022-03-22 13:44:15 +01:00
Jason Fielder
19c793af35 Metal: Make GLSL shader source MSL compliant also
Metal shading language follows the C++ 14 standard and in some cases requires a greater level of explicitness than GLSL. There are also some small language differences:

- Explicit type-casts (C++ requirements)
- Explicit constant values (C++ requirements, e.g. floating point values using 0.0 instead of 0).
- Metal/OpenGL compatibility paths
- GLSL Function prototypes
- Explicit accessors for vector types when sampling textures.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14378
2022-03-22 12:54:44 +01:00
Jason Fielder
309ea31485 Metal: Initial Implementation of Metal Backend for GPU Module.
Adding WITH_METAL option to CMAKE to guard compilation for macOS only. Implemented stub METALBackend to mirror GPUBackend interface and added capabilities initialisation, along with API initialisation paths.

Global rendering coordination commands added to backend with GPU_render_begin and GPU_render_end() commands globally wrapping GPU work. This is required for Metal to ensure temporary resources are generated within an NSAutoReleasePool and freed accordingly.

Authored by Apple: Michael Parkin-White, Vil Harvey, Marco Giordano, Michael Jones, Morteza Mostajabodaveh, Jason Fielder

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

Differential Revision: https://developer.blender.org/D14293
2022-03-22 12:54:34 +01:00
Pratik Borhade
913b6b9ec1 Fix T96624: NLA crash when reordering tracks if no object is selected.
Caused by rBc0bd240ad0a1.
To avoid crash, make boolean value false if active object data is NULL.

Should be backported to 2.93 LTS and 3.1 corrective releases.
2022-03-22 12:04:41 +01:00
3b745f3455 Cleanup: make format + extra parenthesis
Nested ? : get better formatted with some parenthesis around the expressions.
2022-03-22 11:36:10 +01:00
2ba72d847b Fix (unreported) Crash in Array modifier.
Typo (copy/paste mistake) in rB923b28aab85768e2b.
2022-03-22 11:25:54 +01:00
ceaa787e42 Fix T96420: Set ID node not working for instances
Previously, instances used the point domain, but now there is a special
domain for instance attributes that the node has to use.
2022-03-22 11:09:53 +01:00
c1909770e7 CMake: prep USD build & find scripts for USD >= 21.11
Since USD 21.11 the libraries are prefixed with "usd_", i.e.
"libusd_m.a" became "libusd_usd_m.a". This commit adjusts our
`usd.cmake` (for building USD) and `FindUSD.cmake` (for finding the USD
libraries) so that they work with and without this `usd_` prefix.

See for more info:
https://github.com/PixarAnimationStudios/USD/blob/release/CHANGELOG.md#2111---2021-11-01

Reviewed By: LazyDodo, brecht, mont29

Differential Revision: https://developer.blender.org/D14334
2022-03-22 10:56:21 +01:00
47451af027 Cleanup: remove unused code from ed_object_select_pick
- No need to store is_pose_mode, check the object_mode flag instead.

- Remove redundant pose-mode check which now skips object selection.

- Remove disabled grease pencil cursor toggling,
  since I couldn't manage to reproduce a situation where the cursor
  failed to update - also, as there are other places the active object
  can change this would need a more general solution anyway.
2022-03-22 18:07:47 +11:00
6d9de230df Cleanup: refactor 3D view selection picking to early exit for menus
Selecting that opens a menu is now returns early. Handling the menu
selection in-line made this function more difficult to follow.

Also split out selecting an object by it's center into it's own function.
2022-03-22 17:34:37 +11:00
fa96f7381c Cleanup: de-duplicate object-mode locking when selecting 2022-03-22 17:34:37 +11:00
8c072cdc93 Obj: try to fix Linux tests
Related to previous D14368 bug fix, the sorting
operator was not necessarily a stable order sort.
2022-03-22 06:39:50 +02:00
127baac44d Fix pose-selection from menu not activating the object
Unlike the regression from T96663 selecting pose bones from menus
never activated the object.
2022-03-22 13:42:37 +11:00
59870796ea Fix T96663: Selecting a pose-bone doesn't activate the object
Regression in [0] that removed object selection changes while remaining
in pose-mode. This unintentionally removed object activation.

[0]: 859c062a2a
2022-03-22 13:39:01 +11:00
4046f61b39 Fix pose-bone menu selecting before activating the menu
Regression in 1d88aeb95f.
2022-03-22 12:07:00 +11:00
4e1e057ced Cleanup: variable names for menu selection
- Rename baseCount to bone_count, was copy-pasted from object code.
- Also rename baseCount to base_count for object selection,
  following snake case naming conventions.
- Use int instead of short for counters, as there is no reason to use
  short ints.
2022-03-22 11:57:25 +11:00
8bccc7d861 Cleanup: add proper IMB_openexr.h instead of including file from intern/ 2022-03-22 01:30:19 +01:00
9cf40eee4b Fix build error when WITH_OPENEXR=OFF, after recent refactor 2022-03-22 01:30:19 +01:00
fab14f7854 Fix build when using WITH_TBB=OFF after recent changes
And wrap tbb::parallel_sort in blender namespace similar to other TBB
functionality.
2022-03-22 01:30:19 +01:00
976c91cd77 Cleanup: Clang tidy 2022-03-21 17:12:22 -05:00
def1c0c538 Cleanup: Small changes to multires bake normals access
- Order return arguments last, add `r_` prefix
- Use explicit size on array argument
- Avoid double negative in if statement
2022-03-21 17:11:39 -05:00
3a8a7d93f9 Fix T96401: Broken multires baked normals result
A 7 year old commit, 2ec00ea0c1, used incorrect indexing for
the optional array of precomputed poly normals. Apparently that code
path was never used, or this issue would have been discovered earlier.
Recent changes calculate normals on a temporary mesh and use those
for the "low-res" layer, meaning the precomputed path was always taken.
2022-03-21 16:55:55 -05:00
923b28aab8 Fix T96494: Array modifier with caps crash on curve objects
Since 3b6ee8cee7, a list of vertex groups cannot be retrieved
from curve objects for merging because curve objects do not support
vertex groups. Previously the empty list on the object was returned.
Only mesh objects are supported for the caps.
2022-03-21 14:44:39 -05:00
eb1755be35 Fix T96511: New OBJ exporter no longer groups faces by material
Old python exporter in 3.0 and earlier ordered faces by material,
but the new C++ exporter in 3.1+ did not, and was just writing them
in whatever is the order of the mesh data structure.

This mostly does not cause problems, except in some apps e.g.
Procreate -- for large enough meshes, this lack of
"order by material" (which ends up having more usemtl lines)
ends up creating more mesh subsets than necessary inside Procreate.

The change is not computationally heavy, e.g. exporting 6-level
subdivided Monkey mesh goes 1085ms -> 1105ms on my machine.

Reviewed By: @howardt
Differential Revision: https://developer.blender.org/D14368
2022-03-21 20:20:09 +02:00
a58be397e2 Curves: new Add brush
This adds a new Add brush for the new curves object type in sculpt mode.
The brush is used to insert new curves (typically hair) on the surface object.

Supported features:
* Add single curve exactly at the cursor position when `Add Amount` is 1.
* Front faces only.
* Independent interpolate shape and interpolate length settings.
* Smooth and flat shading affects curve shape interpolation.
* Spherical and projection brush.

This also adds the `surface_triangle_index` and `surface_triangle_coordinate`
attributes. Those store information about what position on the surface each
added curve is attached to:
* `surface_triangle_index` (`int`): Index of the internal triangle that a curve
  is attached to. `-1` when the curve is not attached to the surface.
* `surface_triangle_coordinate` (`float2`): First two numbers of a barycentric
  coordinate that reference a specific position within the triangle.

Ref T96444.

Differential Revision: https://developer.blender.org/D14340
2022-03-21 18:59:03 +01:00
Ethan-Hall
f8d19ec5a3 UI: improve names and tooltips in viewport preferences
Rename OpenGL to GPU, Show to Text Info Overlay, and various other tweaks.

Differential Revision: https://developer.blender.org/D14344
2022-03-21 18:09:43 +01:00
Hallam Roberts
c7e25a25b0 Fix T96132: Cycles RGB/Vector/Float Curve shaders ignore extrapolation setting
Differential Revision: https://developer.blender.org/D14393
2022-03-21 17:41:17 +01:00
f92e3b39f1 UI: Use title case for labels 2022-03-21 11:35:17 -05:00
8530e48f86 Cleanup: move render image and multilayer EXR write code to image_save.cc
These share a lot of logic with regular image saving and should be unified
more in the future.
2022-03-21 16:38:13 +01:00
b96462519f Cleanup: move image_save.c to c++ 2022-03-21 16:38:13 +01:00
1897df891c Cleanup: move OpenEXR channel name construction to OpenEXR code 2022-03-21 16:38:13 +01:00
6e4d2fa914 Cleanup: add image_format.cc for functions related to ImageFormatData
Also fixes missing code to read/write/free/copy color management settings
in various places. This can't be set through the UI currently, but still
should be handled consistently.
2022-03-21 16:38:13 +01:00
Ethan-Hall
4abb8a14a2 Cycles: make 3D texture sampling at boundaries more similar to GPU
CPU code for cubic interpolation with clip texture extension only performed
texture interpolation inside the range of [0,1]. As a result, even though the
volume's color is sampled using cubic interpolation, the boundary is not
being interpolated. The GPU appears was interpolating samples that span the
clip boundary softening the edge, which the CPU now does also.

This commit also includes refactoring of 2D and 3D texture sampling in
preparation of adding new extension modes.

Differential Revision: https://developer.blender.org/D14295
2022-03-21 16:38:13 +01:00
Ethan-Hall
be3eef19c0 GPU: Allow the user to set an anisotropic filtering setting below the implementation-defined value of GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
Allow the user to set an anisotropic filtering setting below the implementation-defined value of `GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT`.

This bug-fix is also needed for 2.93 LTS.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D14392
2022-03-21 13:47:08 +01:00
Hallam Roberts
c5456819ee Fix T96655: Bloom crashes Eevee
This patch fixes T96655, bloom crashing Eevee.

The error occurs because rB472fc0c55848b2e2d428cfb4f7debb80a4e12081 added `vec3 safe_color(vec3 c)` to `common_math_lib.glsl`.

However, `vec3 safe_color(vec3 c)` already exists in `effect_bloom_frag.glsl`.
This means `vec3 safe_color(vec3 c)` is duplicated within `common_math_lib.glsl` and `effect_bloom_frag.glsl`.

{F12938060 size=full}

The duplicate code in `effect_bloom_frag.glsl` can be removed since it's no longer needed.

(I checked the remaining methods, there shouldn't be any additional duplicate code)

Reviewed By: fclem

Maniphest Tasks: T96655

Differential Revision: https://developer.blender.org/D14396
2022-03-21 13:20:06 +01:00
Sergey Sharybin
ae21729557 Cycles: Un-pause render when switching to rendered viewport
Consider switching to rendered shading type as a request to start
rendering, without requiring to un-pause.

This minimizes amount of clicks needed to start rendering after
viewport was paused once, and then shading mode got changed.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14244
2022-03-21 10:59:08 +01:00
Pierre Risch
e4278b72bb T84815: Missing preview image in compositing file output node
Hello,
I saw that this revision was stalled for a few months so I tried to update it.
https://developer.blender.org/D10995
I added a function that adds a preview on the first connected input of the file output node.
I removed the preview on the single layer format
Thanks

Reviewed By: #compositing, jbakker

Maniphest Tasks: T84815

Differential Revision: https://developer.blender.org/D14219
2022-03-21 10:56:40 +01:00
9ed63ebb45 Fix T96572: eevee crash with motion blur and stereoscopy
This was a use-after-free bug due to dangling pointers.
2022-03-21 10:05:39 +01:00
fb87578698 Fix T96255: Node socket fails to drag
This is a general issue exposed by moving from tweak to click-drag
events [0], however this bug would have existed for both click &
click-drag events beforehand.

Since [1] the following behavior could occur:

- Click-drag the cursor away from the button.
- Leaving the button would flag it as disabled.
- The disabled button would then break
  causing the event to be considered handled.
- Once handled no click / click-drag action would be tested.

The bug would only happen if the cursor left the button before the drag
threshold was reached which tended to happen with an UI-scale 2 or more.
Or with an increased drag threshold.

Revert [1] (fix for T78503), which is no longer needed since as of [2].

[0]: 4986f71848
[1]: 6f96dd8576
[2]: 87c13ac68c
2022-03-21 18:20:44 +11:00
c4ce1b70e3 Correct error in 3dc44f8c89
The array for event.flag was too big, harmless but incorrect.
Remove the size from the declaration as it's not needed.
2022-03-21 17:21:28 +11:00
3dc44f8c89 Event System: improve event printing
- Use set-style printing of modifier flags instead of booleans.
- Include event.flag.
- Print on a single line (so output can be more easily filtered).
2022-03-21 17:19:26 +11:00
52af3b20d4 Cleanup: cursor motion events now have value set to KM_NOTHING
In some cases value of cursor motion events was set from the last event
written to the wmWindow.eventstate. Avoid potential errors by ensuring
cursor motion events always have their value set to KM_NOTHING.
2022-03-21 15:49:15 +11:00
8ecaa2d624 Fix T96510: ASAN failure when selecting text in Text Editor
Regression in 541ba68991
2022-03-21 13:36:07 +11:00
Aras Pranckevicius
b9123b806f Fix T96470 new obj exporter writing material groups
This is patch D14349 from Aras Pranckevicius.

The logic in the code was _completely different_ from the documentation
and what the python exporter in 3.0 did. The new code assumed that
"export material groups" meant "append material name to the object name",
and was only ever kicking in when the "export object groups" option was
also checked. But the proper behavior (as in 3.0 exporter & the online docs),
is to emit g objectname_materialname before each usemtl line. Which is something entirely else.
2022-03-20 08:59:16 -04:00
Aras Pranckevicius
5bfdaaa800 Fix T96415: new OBJ exporter was applying scaling factor incorrectly
This is patch D14347 from Aras Pranckevicius.

Instead of scaling "the scene" (i.e. transform vertices by object matrix,
then multiply by scale factor), it was instead first applying the scale
factor in local space, and then transforming by the object matrix.
2022-03-19 17:14:53 -04:00
eccb0b222e GPencil: Port main object shader to ShaderCreateInfo
This is quite a huge cleanup. Making use of the `common_gpencil_lib.glsl`
to share more codes and use more consistent codestyle.

The gpencil engine specifics are now out of the `gpencil_vertex()`
function making it easier to add more features.

There should be no regression as all workarounds are kept as is.
2022-03-19 22:05:34 +01:00
36b02c3815 GPUSource: Fix failure case in the enum preprocessor
Some C headers might define the typedefs of the enum themselves.
Even if they are guarded by preprocessor `#if`, our enum preprocessor
has no idea of the validity of the statement. So we just bypass
if there is a typedef just before any `enum` keywords.

Note that the typedef matching is quite fragile.
2022-03-19 22:05:34 +01:00
472fc0c558 DRW: Port improvements in common_math_lib.glsl from eevee-rewrite
Mostly quality of life functions and macros.
2022-03-19 22:05:34 +01:00
6ae03375b6 DRW: Make use of shader shared header
# Conflicts:
#	source/blender/draw/intern/draw_manager.h
#	source/blender/draw/intern/draw_manager_exec.c
#	source/blender/draw/intern/draw_shader_shared.h
2022-03-19 22:05:34 +01:00
3eaf345352 DRW: Introduce GPencil common GLSL library
This library contains the needed functions to render GPencil object
geometry. Centralizing these will make it possible for other draw
engines (EEVEE, Overlay) to reuse the same vertex shader code and
possibly the same fragment rejection methods.
2022-03-19 22:05:34 +01:00
84a0e04296 GPencil: Use ShaderCreateInfo for fullscreen shaders
Simple port. Shouldn't break anything.
2022-03-19 22:05:34 +01:00
568c453ff3 GPencil: Use ShaderCreateInfo for antialiasing shaders
Simple port. Shouldn't break anything.
2022-03-19 22:05:34 +01:00
337343ecc9 GPencil: Use ShaderCreateInfo for vfx shaders
Simple port. Shouldn't break anything.
2022-03-19 22:05:34 +01:00
d7ecd4a0f3 DRW: Add new texture from pool acquire/release mechanism
This adds a simple and more manageable temp texture behavior.

The texture is garanteed to be available only between the acquire/release pair.
This makes the same engine able to reuse the textures and even overlap the acquire
& release calls.
2022-03-19 22:05:34 +01:00
dbf1e7c07f DRW: GPU wrappers: Some quality of life improvements
- Add name support to storage buffers
- Delete view functions for TextureFromPool
- Add support for different size acquire and assert on mulitple acquire
- Allow multiple release
2022-03-19 22:05:34 +01:00
Aras Pranckevicius
8aa365745a Fix T96430: new OBJ exporter wrong normals for non-uniform scale, and wrong face order for negative scale
This applies patch D14343 from Aras Pranckevicius, with a description:

The new 3.1+ OBJ exporter did not have correct logic when faced with
non-uniform & mirrored (negative on odd number of axes) object scale:

- Normals were not transformed correctly (should use inverse transpose of the matrix),
 and were not normalized,
- Face order was not "flipped" when transform has negative scale on odd number of axes
 (visible when using "face orientation" viewport overlay).
2022-03-19 16:20:22 -04:00
873801d25e Make Format Changes
Only formatting changes found by running "make format", no functional
changes

Committed without review, but with verbal approval by Hans Goudey
2022-03-19 10:24:56 -07:00
f381c73a21 Fix T95257: Filter files on "name" and "relpath"
When filtering File Browser items by name, use entry's "name" field as
well as the "relpath" field since they can vary.

See D13940 for details.

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

Reviewed by Bastien Montagne
2022-03-19 09:23:05 -07:00
82c852f387 Fix D14173: Chinese IME Full Width Numbers
Windows IME: Fix duplicated initial character when entering numbers
while in Chinese full width character mode.

See D14354 for more details.

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

Reviewed by Brecht Van Lommel
2022-03-19 09:05:10 -07:00
8711483632 BLI: generalize converting CPPType to static type
Previously, the conversion was done manually for a fixed set of types.
Now, there is a more general utility that can be used in other contexts
(outside of geometry nodes attribute processing) as well.
2022-03-19 10:57:40 +01:00
3e16f3b3ef BLI: move generic data structures to blenlib
This is a follow up to rB2252bc6a5527cd7360d1ccfe7a2d1bc640a8dfa6.
2022-03-19 08:26:29 +01:00
c655146b87 Fix T96584: Properly translate operator on splash screen
The previous fix looks to have been accidentally removed as part of
rB7aec5b06227.

Restore the change.
2022-03-18 20:31:24 -07:00
7fed213ba4 Revert "Compositor: Support backdrop offset for the Viewer node"
This reverts commit 33409f9f1c, as it breaks
panning in the image editor.

Fixes T96543
2022-03-19 00:37:30 +01:00
356073c13e Cleanup: Move object_transform.c to C++
Compilation and clang tidy fixes, use Vector instead of the
macro-based C array system. Builds on all platforms on the
buildbot.
2022-03-18 15:50:46 -05:00
2297db5c49 DRW: gpu wrappers: Fix compilation in release mode 2022-03-18 20:59:48 +01:00
16dd382f06 GPUTexture: Add Cube view as 2D array
This is useful to read/write to the textures directly using compute
shaders and imageLoad/Store.
2022-03-18 20:59:44 +01:00
c509a12fd8 DRW: Expose stencil view in gpu_wrapper 2022-03-18 20:59:40 +01:00
daa26ac0f5 Cleanup: DRW: Fix comments in DRW_gpu_wrapper 2022-03-18 20:59:37 +01:00
e5c2bfb341 DRW: Add support for compute indirect command.
This just expose the GPU API through DRW.
2022-03-18 20:59:33 +01:00
d7df0dcccb GPU: Add indirect dispatch support.
This uses a StorageBuf as the source of indirect dispatch argument.
The user needs to make sure the parameters are in the right order.

There is no support for argument offset for the moment as there is no
need for it. But this might be added in the future.

Note that the indirect buffer is synchronized at the backend level. This is
done for practical reasons and because this feature is almost always used
for GPU driven pipeline.
2022-03-18 20:59:27 +01:00
7ee816e32f GPU: StorageBuf: Add method to clear the buffer in place.
This is a faster way to clear a buffer instead of reuploading new data.
It is equivalent to `memset` and runs directly on the GPU.

This is better to clear huge buffers and to avoid the sync cost of data upload.
2022-03-18 20:59:20 +01:00
5bd38f3be8 Cleanup: GPUStorageBuf: Fix header license 2022-03-18 20:57:15 +01:00
33b4e21820 Cleanup: SSBO: Rename ubo to ssbo in arguments. 2022-03-18 20:54:58 +01:00
93bf17d952 GPU: Add support for stencil buffer texturing mode.
This adds the possibility to read the stencil buffer inside shaders.
This is only available on GL 4.3 so use it accordingly.
2022-03-18 20:54:42 +01:00
054957659f GL: Check texture framebuffer feedback only if not using compute pipeline.
This was getting in the way in multiple instances. Compute shaders dispatch
are still made in the presence of the last bound framebuffer even if they
do not interact with it.
2022-03-18 20:54:27 +01:00
935136f844 GPUTexture: Fix bug in texture view creation
The switch case was based on an uninitialized value.
2022-03-18 20:54:18 +01:00
081255671a GL: Add missing format in image layout conversion 2022-03-18 20:54:02 +01:00
3f484c502f GPUShaderCreateInfo: Add explicit early_fragment_test 2022-03-18 20:53:52 +01:00
0f08453ea9 DRW: Add simple texture view wrappers to draw::Texture 2022-03-18 20:53:41 +01:00
3b75ca2f60 GPUTexture: Expose layer & mip count 2022-03-18 20:53:17 +01:00
374cb32d4a GLShader: Fix two small issues with compute shader generated code 2022-03-18 20:53:04 +01:00
2580869901 DRW: Add support for GPUStorageBuf in wrappers
# Conflicts:
#	source/blender/draw/engines/eevee/eevee_light.cc
#	source/blender/draw/engines/eevee/eevee_shadow.cc
2022-03-18 20:50:25 +01:00
8c93f8c6cc DRW: Add support for GPUStorageBuf 2022-03-18 20:49:45 +01:00
bacfd55a0e GPU/GL: Add StorageBuf implementation
Almost 1:1 identical to UniformBuf implementation.
2022-03-18 20:49:41 +01:00
4544761a2d GPUShader: Fix crash when compilation error is a linking error 2022-03-18 20:49:22 +01:00
59f53f5802 EEVEE: Add new experimental "EEVEE Next" option
This is supposed to hold the latest improvement from the EEVEE rewrite branch.
Note that a restart is necessary in order for the engine to appear.

The registration code is a bit convoluted as it needs to be after the WM_init.
2022-03-18 20:49:09 +01:00
Christoph Lendenfeld
37b93b5df8 Animation: Blend To Default Implementation
Add a new operator to the Graph Editor that blends selected keyframes
to their default value.
The operator can be accessed from
Key>Slider Operators>Blend To Default Value

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9376
Ref: D9367
2022-03-18 20:07:16 +01:00
63f9cb5a0b Fix T96608: GPencil Simplify must check general Simplify switch
As the grease pencil simplify is a subotion of general simplify, if the general switch is disabled, the grease pencil simplify must be disabled too.

This patch also disable the UI panel.
2022-03-18 19:50:38 +01:00
298d8a7b4a Curves: Port reverse curves node to the new data-block
Create a function on CurvesGeometry that can also be used for an edit
mode operator in the future. Dealing with CustomData directly means the
code is a bit more verbose than would be ideal, but this would be a
simple thing to clean up in the future if we get an attribute API here.

Also change the reverse node to first work on a read-only geometry
component, and only get write access if there is a curve selected.

Differential Revision: https://developer.blender.org/D14375
2022-03-18 12:24:05 -05:00
d2726e4626 Cleanup: Remove unnecessary namespace usage, use const 2022-03-18 12:21:13 -05:00
b2cb99d3fd Curves: Port fill curve node to the new data-block
This will mostly just remove the overhead of converting
to and from the old curves type, though it also does open
some opportunities for multi-threading in the future.
2022-03-18 12:18:19 -05:00
8146c996eb Fix: Curves last evaluated segment is empty
A mistake in 8538c69921. The offsets include the segment at the
corresponding index, but the evaluated offset calculation was adjusting
the offset for the second to last segment.
2022-03-18 12:05:14 -05:00
5d7f4f2cab Curves: Port transform node to new data-block
Make the new curves' translate and transform functions also affect
the handle position attributes.

Differential Revision: https://developer.blender.org/D14372
2022-03-18 10:30:27 -05:00
fe9e7036b0 Fix UV's not aligning with image.
This reverts a part of {rB33409f9f1cd42e899f2706fe7878e5e89b50d617}.
2022-03-18 14:17:19 +01:00
65b8b38787 Cleanup: Redundant parenthesis 2022-03-18 14:16:16 +01:00
c3ecfdf40b Cleanup: Compilation warnings
Mainly -Wset-but-unused-variable.
Makes default compilation on macOS way less noisy.

Differential Revision: https://developer.blender.org/D14357
2022-03-18 12:07:08 +01:00
2252bc6a55 BLI: move CPPType to blenlib
For more detail about `CPPType`, see `BLI_cpp_type.hh` and D14367.

Differential Revision: https://developer.blender.org/D14367
2022-03-18 10:57:45 +01:00
7509a74116 Fix T96278: missing update after alpha socket connection
Differential Revision: https://developer.blender.org/D14299
2022-03-18 10:49:54 +01:00
c7954d5904 Cleanup: Remove unused function 2022-03-18 10:34:06 +01:00
578c2f117a Curves: Port handle type selection node to new data-block
The node's structure isn't changed, it basically still works the
same way. The use of virtual arrays could be optimized in the
future if necessary.
2022-03-18 00:16:54 -05:00
389807624d Curves: Port Bezier Segment node to the new data-block
Ref T95443
2022-03-17 22:47:56 -05:00
0eb394af74 Fix resizing nodes not respecting the drag-start
Resizing nodes used the cursor location when the event was triggered
instead of the drag-start, harmless but means the drag location isn't
under the cursor especially with a high drag threshold.

Noticed when investigating other drag issues,
unrelated to recent changes to drag behavior.
2022-03-18 13:20:11 +11:00
5035fbdd23 License headers: use SPDX identifiers in intern/itasc
Added license headers based on the original LGPL files from:
gitlab.kuleuven.be/rob-itasc
2022-03-18 10:27:01 +11:00
a0e2373b7e Docs: add license text file for LGPL2.1 2022-03-18 10:27:01 +11:00
89ab3cdc56 Fix wrong documentation/UI text for NodeLink
`RNA_def_struct_ui_text(srna, ...)` was reused for `is_valid` and `is_muted`
which would set the documentation to theirs (actually to that of the last
call).

`RNA_def_property_ui_text(prop, ...)` should be used for the properties.
2022-03-17 23:57:06 +01:00
a67c7693a7 Fix typo in smooth brush tooltip 2022-03-17 23:56:55 +01:00
8407c0b64e Cleanup: unused class members. 2022-03-17 23:56:18 +01:00
d4bd9f6a27 Curves: Port convex hull node to new data-block
This uses the evaluated positions calculations from 8538c69921.
2022-03-17 17:45:37 -05:00
7bdba5f1e0 Cleanup: Remove unused includes 2022-03-17 17:16:53 -05:00
0835996cc9 Cleanup: Rename "spline" variables to "curve"
Ref T95355
2022-03-17 17:08:36 -05:00
ee2d39b3a7 Cleanup: Reorganize duplicate elements file
Use sections to keep all the code for a specific mode together,
rather than keeping the attribute duplication separate.
2022-03-17 16:46:58 -05:00
663bd38ed6 Curves: Port duplicate elements node to new data-block
Remove the conversion to and from `CurveEval` by supporting the
new Curves data-block in the node. This allows for some simplifications
to the code, as well as a fix for transfering curve domain attributes
when duplicating the curve domain.

The performance improvements (obverved through the timings overlay)
can be relatively massive with many curves. When duplicating 10000
4-point curves to become 2 million curves, I observed an approximate
150x improvement, from about 3 seconds to about 20ms.
2022-03-17 16:36:43 -05:00
6d97a5f93c Cleanup: Miscellaneous improvements to duplicate geometry node
- Pass less redundant information in function arguments.
- Use `IndexRange` more instead of direct offset calculations.
- Use specific geometry component types for specialized functions.
- Use const arguments.
- Declare variables closer to where they are created or used.
- Remove some redundant logic.
- Simplify the description for the output geometry.
2022-03-17 16:23:58 -05:00
7fed4c06c2 Fix keying-set selector broken
The menu for Timeline > Keying > Active Keying Set wouldn't show up.

Caused by d8e3bcf770. The function to attach search menu data to the button
would be called twice with different arguments for the same button now.
Shouldn't be an issue in general, but the first call now had the unexpected
side effect that the button would get disabled. Make sure it's re-enabled when
the second call sets the proper search data now.
2022-03-17 17:52:50 +01:00
17906794f5 Fix T96330: Three times slower 'relink to new id' process in 3.1.
Caused by rB43bc494892c3, moving this 'new id' relink to generic
remapping code added the over-head of proper, generic post-processing,
compared to the special-cases previous code was only designed to handle.

Fortunately with recent 'multi-remapping' work we can easily rewrite
that new id relink code to use the multi-remapping approach too.

No behavioral change is expected from this commit, besides the improved
performances (essentially restored to what they where before
rB43bc494892c3).
2022-03-17 17:23:57 +01:00
Henrik Dick
236ef11a07 GPencil: Fix cyclic flag cleared by simplify modifier
Change the sample mode to don't duplicate the last vertex of the
stroke and instead use the cyclic flag to close previously cyclic
strokes. This is necessary for the following modifiers.

Reviewed By: NicksBest

Differential Revision: http://developer.blender.org/D14359
2022-03-17 14:09:29 +01:00
d0968a9c52 BLI: add probabilistic rounding utility 2022-03-17 12:48:41 +01:00
8f68cff01b Cleanup: name enums 2022-03-17 12:42:01 +01:00
dd483215e5 Hair: Sculpt Mode Icons
From hair particle mode:
* Add
* Comb
* Cut
* Grow

New:
* Delete

Only comb and delete are used at the moment (by the new tools which are
under experimental).
2022-03-17 12:12:53 +01:00
b6702aa604 Curves: separate sculpt brushes into separate files
This makes it easier to work on these brushes in parallel.
2022-03-17 10:04:02 +01:00
884b167f74 View 3D: scale object center selection penalty by the pixel size
All screen-space UI thresholds should scale by the interface scale.
2022-03-17 20:02:37 +11:00
e0a8f9b78e Fix unintended de-selection when selecting the object center
Selecting an object that was already active & selected would de-select
it when the cursor was over the objects center.

This was caused by [0] that added a check which assumed more than one
hits from GPU_select meant there were multiple objects to select from.
This is not necessarily the case since bones, camera tracks or the
objects own center can add additional hits.

Resolve by keeping track of the best hit with & without the
active-selected object, only using the non-active-selected if it's found.

[0] 1550573360
2022-03-17 18:21:47 +11:00
bb735bd518 Tweak Tool: supports select & tweak on LMB (with RMB-select key-map)
Support for differentiating the tweak tool from the 3D cursor when
select is set to RMB.

This is currently an experimental preference:
Tweak Tool: Left Mouse Select & Drag

When enabled the tweak tool can now tweak the existing selection
without de-selecting first, a single click can be used to replace
the selection.
This matches selection in the graph & node editors.

This preferences is only available with "Developer Extras" enabled.

Ref T96544.
2022-03-17 16:47:14 +11:00
3017585ebf View 3D: the select operator now uses the cancel flag on failure
Needed so mapping selection to click doesn't pass the click event
through to setting the 3D cursor for e.g.

While this doesn't happen with the default key-map, setting selection
to LMB-click would set the 3D cursor as well (when the selection
fell through to nothing).
2022-03-17 16:22:33 +11:00
859c062a2a View 3D: multi-object pose selection no longer de-selects objects
De-selecting objects meant that selecting a bone would de-select
all the other pose objects - making exiting & entering pose-mode
loose the current set of pose objects.

Match edit-mode behavior: avoid de-selecting objects in the current mode
(unless the action is explicitly performed in the outliner for e.g.).
2022-03-17 14:39:38 +11:00
ba6d59a85a Cleanup: simplify logic for skipping object selection
Previously setting the 'basact' to NULL was done, but this wasn't
so simple to use with deselect_all which needs to check if there was
anything found at the cursor.

Add a 'handled' variable to differentiate this case, when set
don't attempt object selection.
2022-03-17 14:38:38 +11:00
42f430e9a2 Cleanup: minor clarifications to comments & use const variables 2022-03-17 14:37:23 +11:00
83fd242546 Fix 3D view movie-clip track selection
While basic single track selection worked,
toggling and de-selection has been broken since at least 2.83.

Support SelectPick_Params with the exception of deselect_all
which doesn't make sense for tracks as de-selecting all objects
is expected in that case.
2022-03-17 14:37:22 +11:00
7bc6a04767 Cleanup: split movie clip track selection into it's own function
This was an involved operation to include inline,
making ed_object_select_pick more difficult to follow.

Prepare for track selection to properly support SelectPick_Params.
2022-03-17 14:37:21 +11:00
1d88aeb95f View 3D: support for select passthrough when picking selected items
Currently this isn't used in the key-map, it will eventually
allow the 3D viewports tweak tool to match the behavior of other
editors that support tweaking a selection without first de-selecting
all other elements.
2022-03-17 14:37:20 +11:00
ea0c86e961 Cleanup: spelling in comments
Use <pre>..</pre> for pseudo-code.
2022-03-17 10:08:41 +11:00
27388f7f46 Cleanup: include argument names for drop-box callbacks
Indicates typical names for callbacks and allows them to be documented.
2022-03-17 10:08:41 +11:00
Habib Gahbiche
33409f9f1c Compositor: Support backdrop offset for the Viewer node
This is only part of the experimental "Full Frame" mode (disabled
by default). See T88150.

Currently the viewer node uses buffer paddings to display image offset
in the backdrop as a temporal solution implemented for {D12466}.
This solution is inefficient memory and performance-wise. Another
issue is that the paddings are part the image when saved.

This patch instead sets the offset in the Viewer node image
as variables and makes the backdrop take it into account
when drawing the image or any related gizmo.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12750
2022-03-16 23:28:36 +01:00
22de21bef1 Fix: Compiler error on windows and mac
The previous fix including `<algorithm>` was an improvement
but not the actual error, which appears to be that `int64_t` is
long long int on one platform but just long int on another.
The fix includes the template argument directly.
2022-03-16 16:49:31 -05:00
7a4af7a01b Fix: Build error after curve evaluation commit 2022-03-16 16:29:24 -05:00
8538c69921 Curves: Initial evaluation for curves data-block
This patch adds evaluation for NURBS, Bezier, and Catmull Rom
curves for the new `Curves` data-block. The main difference from
the code in `BKE_spline.hh` is that the functionality is not
encapsulated in classes. Instead, each function has arguments
for all of the information it needs. This makes the code more
reusable and removes a bunch of unnecessary complications
for keeping track of state.

NURBS and Bezier evaluation works the same way as existing code.
The Catmull Rom implementation is new, with the basis function
based on Cycles code. All three types have some basic tests.

For NURBS and Catmull Rom curves, evaluating positions is the
same as any generic attribute, so it's implemented by the generic
interpolation to evaluated points. Bezier curves are a bit special,
because the "handle" control points are stored in a separate attribute.
This patch doesn't include generic interpolation to evaluated points
for Bezier curves.

Ref T95942

Differential Revision: https://developer.blender.org/D14284
2022-03-16 15:47:00 -05:00
9af791f873 Fix: Update icons for hair to curves rename
ddf189892c missed recreating the icons with the new names.
This commit runs `make icons` and replaces the names in CMake.
2022-03-16 12:48:00 -05:00
Bastien Montagne
7e06fc11b7 Add 'multiple' variant of ID relink function.
Similar to other changes to ID remapping, gives huge speedups in some
cases, like certain types of liboverride creation.

Case from {T96092} goes from 1725 seconds (almost 30 minutes) to 45
seconds to generate the liboverride, on my machine.

Reviewed By: jbakker

Maniphest Tasks: T96092

Differential Revision: https://developer.blender.org/D14240
2022-03-16 18:34:20 +01:00
2564d152d6 Cleanup: Remove unnecessary namespace specification
Ever since d5b72fb06c, shader nodes have been in the
`blender::nodes` namespace, so they don't need to use that to access
Blender's C++ types and functions.
2022-03-16 12:33:36 -05:00
263c5b33d6 Fix: Build error from missing build dependencies
Somehow exposed after 943b919fe8, linking could fail because
bf_nodes was not properly configured as a dependency of bf_nodes_shader.
Also add the dependency to the geometry nodes module.
2022-03-16 12:20:05 -05:00
390b9f1305 Fix Cycles HIP assuming warp size 32
In HIP these masks are 64 bit, while in CUDA only 32 bit.
2022-03-16 18:05:48 +01:00
076079454f Cleanup: remove some unused Cycles GPU code
To make porting to other architectures easier, clarifying that this does not
need to be supported. The unused parallel_reduce implementation assumed warp
size 32, but is easy to update if we ever need it in the future.
2022-03-16 18:05:08 +01:00
213d00607e Cleanup: Further removal for legacy geometry nodes
943b919fe8 missed removing the experimental
option and the nodes from the add menu.
2022-03-16 10:56:53 -05:00
79e74b1486 Fix T96518: Gpencil Fill freezes when use invert and click inside areas
When using inverted filling and click inside a closed area and not outside as is expected, the algorithm to detect the contour to fill is unable to find the filling shape and try to fill outside of the valid index.

The infinite loop was adding more memory for each loop and the process continued while there was system resources and finally crashed the system.

As the tool in negative mode is designed to fill all areas when you click outside of any shape, now the algorithm check if the outline is not working as expected and cancels the filling process.
2022-03-16 16:30:53 +01:00
943b919fe8 Geometry Nodes: Remove legacy node code
This commit removes the implementations of legacy nodes,
their type definitions, and related code that becomes unused.
Now that we have two releases that included the legacy nodes,
there is not much reason to include them still. Removing the
code means refactoring will be easier, and old code doesn't
have to be tested and maintained.

After this commit, the legacy nodes will be undefined in the UI,
so 3.0 or 3.1 should be used to convert files to the fields system.

The net change is 12184 lines removed!

The tooltip for legacy nodes mentioned that we would remove
them before 4.0, which was purposefully a bit vague to allow
us this flexibility. In a poll in a devtalk post showed that the
majority of people were okay with removing the nodes.
https://devtalk.blender.org/t/geometry-nodes-backward-compatibility-poll/20199

Differential Revision: https://developer.blender.org/D14353
2022-03-16 08:51:11 -05:00
cb267cec55 Fix T96512: Crash selecting an edge
Regression in 5e5285baf6.
2022-03-16 23:42:31 +11:00
31f31496af Document some flags controlling BKE_library_foreach_ID_link behavior. 2022-03-16 13:15:41 +01:00
42e13ea4bf Cleanup: Deprecated field access in outliner_duplicate
Solved by introducing introducing a variant of MEM_cnew which behaves
as a copy-constructor for a trivial types.

Alternative approach would be to surround DNA structs with clang/gcc
diagnostics push/modify/pop so that implicitly defined constructors
and copy operators are allowed to access deprecated fields.

The downside of the DNA approach is that it will require some way to
easily apply diagnostics modifications to many structs, which is not
possible currently.

The newly added MEM_cnew has other good usecases, so is easiest to
use this route, at least for now.

Differential Revision: https://developer.blender.org/D14356
2022-03-16 12:38:23 +01:00
ddc54a2a6b Cleanup: Remove use of deprecated std::iterator in Freestyle
Resolves a fair amount of noisy warnings with default build on macOS.

Tested using render_layer render test which includes Freestyle layer.

Differential Revision: https://developer.blender.org/D14355
2022-03-16 11:56:30 +01:00
fbc36c77b0 Fix error with pose & deselect_all with 5e5285baf6 2022-03-16 21:25:38 +11:00
79ae5f5014 Fix T96386: crash when changing shader to node group in properties
The previous code updated the wrong node tree. The result was that
the new group node did not have the socket that was supposed to
be linked.
2022-03-16 11:23:45 +01:00
a45108840e CMake: Extra flags to ignore for strict compiler
Solves warnings generated by default build on macOS.
2022-03-16 10:33:04 +01:00
2d42187395 View 3D: refactor edit-mode meta-element selection
Meta-element selection now follows conventions for other picking
functions (e.g. EDBM_select_pick).

- Split meta-element find-nearest into a separate function.

- Cycle the meta-element starting from the active & selected
  instead of comparing & setting a static variable.

- Order elements using depth (from front-to-back)
  when cycling multiple elements.
2022-03-16 20:09:55 +11:00
9df27e7f00 Fix object centers & geometry selecting meta-elements in edit-mode 2022-03-16 19:57:47 +11:00
4f37b548bd Cleanup: de-duplicate struct declaration
Also use boolean instead of int.
2022-03-16 15:55:10 +11:00
8cfdad99a0 Cleanup: incorrect comments, use C comments 2022-03-16 15:30:22 +11:00
24ada9c960 Cleanup: Remove volatile from RenderResult and related APIs
Volatile fields were introduced to the RenderResult struct years ago[1].

However, volatile is most likely not doing what it was intended to do
in this instance, and is problematic when moving files to c++ (see
discussion from D13962). There are complex rules around what happens to
these fields but none of them guarantee what the above commit alluded to.

This patch drops the volatile and cleans up the APIs surrounding it.

[1] rB7930c40051ef1b1a26140629cf1299aa89eed859

Passing on all platforms:
https://builder.blender.org/admin/#/builders/18/builds/338

Differential Revision: https://developer.blender.org/D14298
2022-03-15 21:12:49 -07:00
f1501ac060 Cleanup: rename variables in view3d_select_exec
- Rename 'location' to 'mval', typically used for region cursor coords.
- Rename 'retval' to 'changed', typically used for operators
  when their return value depends on a change being made.
2022-03-16 15:05:05 +11:00
5e5285baf6 View 3D: move picking arguments into a struct & minor refactor
- Add SelectPick_Params struct to make picking logic more
  straightforward and easier to extend.

- Use `eSelectOp` instead of booleans (extend, deselect, toggle)
  which were used to represent 4 states (which wasn't obvious).

- Handle deselect_all when pocking instead of view3d_select_exec,
  de-duplicate de-selection which was already needed in when replacing
  the selection in picking functions.

- Handle outliner update & notifiers in the picking functions
  instead of view3d_select_exec.

- Fix particle select deselect_all option which did nothing.
2022-03-16 14:48:25 +11:00
9a763d24f2 Fix missing update selecting 3D text-box 2022-03-16 13:40:16 +11:00
be7855591e Cleanup: rename cnt to count
Follow naming from T85728.
2022-03-16 11:58:22 +11:00
379bd6d50c Curves: Port count spline length output to new data-block
This fixes T96487 in a similar way to 5791835678,
and also removes the conversion to old curve type for the
"Point Count" output.
2022-03-15 16:22:36 -05:00
d8e3bcf770 Outliner: Display buttons to edit library override properties
As proposed in T95802, this adds buttons to a new column on the right to modify
the override in the Library Override display mode. Some further usability
improvements are planned. E.g. this does not yet expand collections (modifiers,
constraints, etc) nicely or group modified properties of a modifier together.
Vector properties with more than 3 items or matrices aren't displayed nicely
yet, they are just squeezed into the column. If this actually becomes a problem
there are some ideas to address this.

Differential Revision: https://developer.blender.org/D14268
2022-03-15 18:48:52 +01:00
7f77bd95d9 Fix T96381: Cycles GPU wrong render with camera inside multiple volumes 2022-03-15 18:42:08 +01:00
c2f9133b29 Fix Cycles kernel error on Metal after recent changes 2022-03-15 17:56:45 +01:00
630d2b6497 Cycles: allow Adaptive Sampling with Scrambling Distance
While the correlation may not work well with adaptive sampling, in practice
this appears to work ok in most cases

Automatic scrambling distance uses the minimum samples from adaptive sampling,
which provides a good default estimate to avoid artifacts.

Contributed by Alaska.

Differential Revision: https://developer.blender.org/D13325
2022-03-15 16:12:13 +01:00
f9d3632cde Cycles: change Scrambling Distance Multiplier to a soft limit
This allows users to type in values larger than 1, for use in conjunction
with automatic scrambling distance.

Contributed by Alaska.

Differential Revision: https://developer.blender.org/D13580
2022-03-15 16:12:13 +01:00
af51b0d8d8 Fix T96417: Cycles issue with multiscatter GGX and self intersection avoidance
When the light direction is not pointing away from the geometric normal and
there is a shadow terminator offset, self intersection is supposed to occur.
2022-03-15 16:12:13 +01:00
19bff8eb51 Fix T96263: command line rendering affected by current scene subframe 2022-03-15 16:12:13 +01:00
2613a2552d Fix some properties missing in the UI for new Curves object type
Missed some renames from HAIR to CURVES.
2022-03-15 16:12:13 +01:00
3bb4597b2d Disable GPU subdivision if the maximum number of SSBO binding is reached
Some old platforms and drivers have limited amount of SSBO binding per
compute shader. This disables GPU subdivision if we cannot possibly
bind all required buffers within this limit.

For now the maximum number of buffers used by the GPU code is hardcoded,
but will be programmatically detected when shader creation is automated.

Ref D14337
2022-03-15 16:07:32 +01:00
45b637e1e7 GPU capabilities: detect max SSBO bindings
This adds detection of the maximum number of shader storage buffer
bindings that is supported on the current platform. This can be
useful to turn off features that require compute shaders but use
more buffer bindings than available.

Differential Revision: https://developer.blender.org/D14337
2022-03-15 16:04:41 +01:00
e08180fdab Fix slow tracking of long sequences
The performance issue was noticeable when tracking a lot of tracks
which are using keyframe pattern matching. What was happening is that
at some cache gets filled in and the furthest away frame gets removed
from the cache: the frame at marker's keyframe gets removed and needs
to be re-read from disk on the next tracking step.

This change makes it so frames at markers' keyframes are not removed
from cache during tracking.

Steps to easily reproduce:
- Set cache size to 512 Mb.
- Open image sequence in clip editor
- Detect features
- Track all markers

Originally was reported by Rik, thanks!
2022-03-15 15:50:40 +01:00
2156841c8c Fix T96452: Armature corrupted after undoing 'Join' operation.
Modified source Armature ID in the join operation was not properly
tagged as such for the depsgraph (and therefore memfile undo)..

Issue caused/revealed by rBe648e388874a.

Should be backported to 3.1 should we make a corrective release.
2022-03-15 15:02:39 +01:00
256d36683b Cleanup: remove redundant 'extern StructRNA' declarations
After rB9b298cf3dbec, the `StructRNA` declarations can now be accessed via
`RNA prototypes.h`

Also, since all redundated declarations are now removed,
`_WM_MESSAGE_EXTERN_BEGIN` and `_WM_MESSAGE_EXTERN_END` are also no
longer needed.

Differential Revision: https://developer.blender.org/D14342
2022-03-15 09:14:38 -03:00
7ec2c5c10b Cleanup: Remove confusing double negation in RNA helper function
Much more readable that way.
2022-03-15 13:11:41 +01:00
46b35c6836 Cleanup: remove accidental shallow mesh copy 2022-03-15 12:32:18 +01:00
49fc4449e7 Fix T96357: Issue clicking on stem of arrow gizmos to scale on axis
Caused by 0cb5eae9d0 which restored
support for 3D depth when selecting gizmos - making it difficult
to select single lines drawn in front of other gizmos.
Previously the first hit was always used.

Resolve by using a margin around arrow stems when selecting
which was already done for 2D arrows.
2022-03-15 20:03:33 +11:00
a0a572ce8b Cleanup: correct unbalanced doxy sections 2022-03-15 17:29:54 +11:00
683c130b06 Docs: correct doc-string for BPY_driver_reset
Remove outdated reference to "pydrivers.py", also document BPY_DECREF.
2022-03-15 15:31:11 +11:00
8c60050d30 Cleanup: comments in bpy_driver.c, minor corrections 2022-03-15 15:20:38 +11:00
7c24804d62 Cleanup: de-duplicate Py_DECREF when evaluating PyDrivers 2022-03-15 15:06:25 +11:00
977c958242 Fix memory leak when there is an error evaluating a PyDriver
In practice users are unlikely to ever run into this error.
2022-03-15 15:03:27 +11:00
3cbf20228e Cleanup: use single back-ticks in regular comments
Double back-ticks are used for RST literals.
2022-03-15 14:53:49 +11:00
f410efbda0 UI: expose "Dolly View" in the menu
This is mainly to expose the shortcut to make Dolly discoverable.
2022-03-15 13:01:10 +11:00
Iyad Ahmed
fc259d4c30 Fix gpu.types.GPUTexture not passing data buffer to 3D textures
Missed in rB4430e8a00810ca8df2fa20029c4cb8078e8cdbe6

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D14333
2022-03-14 16:06:32 -03:00
d4e46c13cc Geometry Nodes: Add named attribute nodes behind experimental flag
This commit adds three nodes:
- `Remove Attribute`: Removes an attribute with the given name
- `Named Attribute`: A field input node
- `Store Named Attribute`: Puts results of a field in a named attribute

They are added behind a new experimental feature flag, because further
development of attribute search and name dependency visualization will
happen as separate steps.

Ref T91742

Differential Revision: https://developer.blender.org/D12685
2022-03-14 11:48:11 -05:00
a5578351c3 Auto-generate RNA-structs declarations in RNA_prototypes.h
So far it was needed to declare a new RNA struct to `RNA_access.h` manually.
Since 9b298cf3db we generate a `RNA_prototypes.h` for RNA property
declarations. Now this also includes the RNA struct declarations, so they don't
have to be added manually anymore.

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

Reviewed by: brecht, campbellbarton
2022-03-14 17:08:46 +01:00
cc98b40f87 Cleanup: Clang tidy 2022-03-14 10:55:48 -05:00
9b298cf3db RNA: Generate property declerations header, solving msg-bus C++ incompatibility
Lets `makesrna` generate a `RNA_prototypes.h` header with declarations for all
RNA properties. This can be included in regular source files when needing to
reference RNA properties statically.

This solves an issue on MSVC with adding such declarations in functions, like
we used to do. See 800fc17367. Removes any such declarations and the related
FIXME comments.

Reviewed By: campbellbarton, LazyDodo, brecht

Differential Revision: https://developer.blender.org/D13837
2022-03-14 16:50:49 +01:00
cff6eb6580 Cleanup: Remove duplicate Bake modifier code
This patch remove all duplicate code for the same Bake modifier logic.

Still some modifiers need custom bake functions and cannot use this generic bake.
2022-03-14 16:13:59 +01:00
8c4ddd5dde Fix dead-lock in movie cache
Steps to reproduce:
- Add image sequence to movie clip editor.
- Set cache limit to a low value in the user preferences.
- Playback until old frames starts to be removed from cache.
- Jump to the beginning of the image sequence.

The reason of dead-lock comes from two factors:
- Due to global nature of the cache limiter calls needs to be
  guarded with locks.
- Image buffers stored in the cache can have their own cache
  (which is used for color management).

Didn't find a better solution than to use recursive lock.
Kind of makes sense since the thread-guardable resource is
recursive (moviecache can have nested moviecaches).

Differential Revision: https://developer.blender.org/D14331
2022-03-14 14:46:49 +01:00
e0241e0860 Convert moviecache to C++ 2022-03-14 14:46:22 +01:00
a5cd1799fc Cleanup: Deduplicate code in Multiply modifier 2022-03-14 11:35:26 +01:00
8eb189925e Cleanup: Make more obvious from the name that function is not public 2022-03-14 11:21:23 +01:00
7306417ae4 Revert "Animation: Sensible frame range for motion paths"
This reverts commit 1558b270e9.

An earlier commit (rB101fadcf6b93c) introduced some new functionality,
which was overlooked in reviewing this commit & got broken.

Will re-commit after the issue has been fixed.

Ref: D13687
2022-03-14 11:17:45 +01:00
Henrik Dick
4045b3d7b6 GPencil: Fix offset modifier negative scale thickness
If the scale in the offset modifier was set to a value lower than -1,
the object would get mirrored. The problem was, that the thickness
was set to 0 by that. This fix makes the thickness calculation only
use the absolute values.

Differential Revision: http://developer.blender.org/D14324
2022-03-14 11:11:22 +01:00
bf5e9ef2df Fix T96402: fix case when material output is contained in node group
For now just assume that a node group without output sockets is
an output node. Ideally, we would use run-time information stored
on the node group itself to determine if the group contains a
top-level output node (e.g. Material Output). That can be
implemented separately.

In the larger scheme of things, top-level outputs within node
groups seem to break the node group abstraction and reusability
a bit.
2022-03-14 10:49:35 +01:00
c6642f06ab Fix T96395: NDOF entries prevent loading of custom keymaps in 3.2
Even though the default key-map didn't use NDOF types some key-maps did.
2022-03-14 20:42:12 +11:00
82e7956f12 Fix T96396: cannot set active node group output with Python
This is essentially the same fix as in rB22a341d9d8d3d337f79df228ab2e4e0726f81430.
2022-03-14 10:21:47 +01:00
b3d0abd893 Fix T96378: B-Bone selection fails in pose-mode
Regression in 3267c91b4d.
2022-03-14 20:10:24 +11:00
d7dd7403a8 WM: avoid hard coded modifier key checks in object.hide_collection
These checks aren't always valid when there are multiple events
in the queue.
2022-03-14 15:50:06 +11:00
541ba68991 Cleanup: use size_t for BLF text API functions
Also minor cleanup to txt_sel_to_buf:

- Use memcpy instead of strncpy as the strings don't contain nil bytes.
- Replace while loops with for loops.
2022-03-14 14:25:33 +11:00
a5571fd0e8 Cleanup: spelling 2022-03-14 14:25:32 +11:00
6ea1455ce3 Fix mistake in 4c951bfa82
Removed WITH_SYSTEM_GLEW by mistake, thanks to @The_Orb for spotting.
2022-03-14 14:25:31 +11:00
b959f603da Fix T96267: Sidebar Tab Font Size Correction
Correction to the calculation of font size used for the tabs on the
Sidebar so that they are always the same size as other content on the
panel.

See D14322 for more details.

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

Reviewed by Brecht Van Lommel
2022-03-13 17:08:15 -07:00
4ec1c8bc9c Cleanup: Use helper variable, const argument 2022-03-13 16:53:48 -05:00
25b4e41875 Curve: Store NURBS basis cache as a single vector
Instead of allocating a vector of the basis weights cache for
each evaluated point, allocate a single vector for all of the
weights. This should reduce memory usage by avoiding the
overhead of storing many vectors. I noticed a small performance
improvement to evaluated position calculation with an order of 5,
which is larger than `Vector`'s default inline buffer capacity.

This change is possible because of previous commits that
made the basis cache for each evaluated point always have
the same "order" size.
2022-03-13 16:53:48 -05:00
3c8182409c Cleanup: Simplify NURBS basis cache arguments
Only pass a mutable span and a return argument to the calculation
function, so it's simpler and doesn't worry about where either are
stored.
2022-03-13 16:53:48 -05:00
29dc6fb1c1 Curve: Remove temporary buffer during NURBS evaluation
Currently a single buffer is used as working space for all evaluated
points. In order to make evaluations more independent, opening
options like multi-threading in the future, instead use a separate
array for each call. Using an inline buffer capacity higher than
the default allows a few percent performance improvement, and removes
allocations for every evaluated point.
2022-03-13 16:53:48 -05:00
34a61ceeaa Cleanup: Remove unnecessary NURBS optimization
The step after calculating the NURBS basis for a single evaluated
point trimmed extra zeroes from the weights. However, in practice
this rarely did anything, only for the first and last evaluated point
of certain knot configurations. Remove it in order to simplify code.

Also use a separate span for the result, to clarify its length.
2022-03-13 16:53:48 -05:00
Octave C
3b16530aa1 UI: Fix incoherent brush size in popover menu and brush settings
Previously, the popover menu in sculpt/texture paint mode did not
take into account the `UnifiedBrushSettings` for the unit.

To fix this,  the behavior of `class _draw_tool_settings_context_mode`  is matched
by checking the same conditions when setting up the UI of the right-click popover menu.

Fixes T81616

Reviewed By: #sculpt_paint_texture, pablodp606

Maniphest Tasks: T81616

Differential Revision: https://developer.blender.org/D9168
2022-03-13 17:45:35 -04:00
Yevgeny Makarov
301fac5ded UI: Fix Label alignment in top bar
Label alignment in top bar by using `ui_text_icon_width_ex` instead of `w_hint`

Old:

{F12733743}

New:

{F12733742}

Fixes T61558

Reviewed By: Severin

Maniphest Tasks: T61558

Differential Revision: https://developer.blender.org/D13552
2022-03-13 17:38:55 -04:00
Henrik Dick
a6b5d5bfe8 GPencil: Simplify modifier minimal vert count fix
Lower the minimal vert count for all simplify modes.

Differential Revision: http://developer.blender.org/D14319
2022-03-13 17:21:30 +01:00
Aras Pranckevicius
70720c42c2 Fix T96303: C++ OBJ exporter needs presets and skip modifiers.
This patch, D14303, from Aras Pranckevicius adds presets to the OBJ exporter,
and also adds a checkbox (default on) to apply modifiers before export.
2022-03-13 12:04:52 -04:00
91dbc28363 Cleanup: clang format 2022-03-13 00:49:41 -05:00
f6b7396610 Fix transform gizmo check for shift to constrain to a plane
The eventstate was checked instead of the current event being handled,
causing the check to be invalid in some cases.
2022-03-12 21:29:14 +11:00
a2bb3c4cad GPencil: Fix unreported select error in Normalize operator
The curve selection was wrongly checked.
2022-03-12 10:48:42 +01:00
8617ab153e Fix T96352: Gpencil crash using Normalize Thickness with Curves
The stroke curve data could be NULL.
2022-03-12 10:33:32 +01:00
Dilith Jayakody
39c070ed8f Fix T96229: GN Fillet Node unexpected limit radius behavior for 3 point splines
This commit fixes T96229.

The maximum possible radius was being used for 3 point
splines, regardless of the current radius.

Reviewed By: HooglyBoogly

Maniphest Tasks: T96229

Differential Revision: https://developer.blender.org/D14311
2022-03-12 10:19:26 +05:30
f19582ebf4 UI: Use property split in curves surface panel 2022-03-11 14:57:50 -06:00
db7c4d7a1c Cleanup: Use new enum for NURBS curve knots modes
Move the definition of the enum to `Curves` DNA, since the values
will be saved in files, and ongoing development needs to use this.
2022-03-11 14:55:42 -06:00
bd9f94e917 Fix T94692: Show Cached OneDrive Thumbnails
When OneDrive files are offline, show preexisting thumbnails.

See D13930 for details.

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

Reviewed by Julian Eisel
2022-03-11 10:05:16 -08:00
22807d2075 Curves: Move constructor/assignment
Add the ability to move `CurvesGeometry` without copying its attributes
and data. The benefit is more intuitive management of the data-block
copying, and less overhead for copying in some cases. The "moved-from"
source is left in an empty but valid state. A test file is added to test
the move constructor.
2022-03-11 11:34:03 -06:00
Ethan-Hall
3b28c785d4 Cycles: show viewport hair settings when using Cycles
Before this patch, users had to switch render engines just to change how the
hair should be displayed in solid and material preview viewport shading modes.

Differential Revision: https://developer.blender.org/D14290
2022-03-11 18:27:58 +01:00
Ethan-Hall
3902bebf18 Cycles: make smart interpolation fallback to cubic for GPU
Matching CPU and Eevee behavior.

Differential Revision: https://developer.blender.org/D14296
2022-03-11 18:27:58 +01:00
1842cef210 Fix wrong line width when using Show Lines in Histogram scope
By not resetting the line width, other scopes were using the
wrong line thickness.

Contributed by RedMser.

Differential Revision: https://developer.blender.org/D12030
2022-03-11 18:27:58 +01:00
Hallam Roberts
3da84d8b08 Cleanup: use M_PI_2 and M_PI_4 where possible
The constant M_PI_4 is added to GLSL to ensure it works there too.

Differential Revision: https://developer.blender.org/D14288
2022-03-11 18:27:58 +01:00
62a0984d72 Cleanup: fix source typos homogenous->homogeneous
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D14306
2022-03-11 18:27:58 +01:00
e1a1dc868b Cleanup: fix source comment typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D14307
2022-03-11 18:27:58 +01:00
dbd9472ef5 Fix: Assert in set spline type node after recent commit
My own error when committing 0602852860. It appears that
the "Endpoint" knots modes should be handled together, otherwise
out of bounds array access is possible.
2022-03-11 11:27:34 -06:00
ae3c8bc9f0 Fix T85689: Replace SHGetFileInfoW for Drive Name
Win32: Replace SHGetFileInfoW as means to get friendly display names
for volumes because it causes long pauses for disconnected remote
drives.

See D14305 for more details.

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

Reviewed by Brecht Van Lommel
2022-03-11 09:26:59 -08:00
5c86f0369c Fix: Deleting vertex group attribute can change original mesh
There was an error with the attribute API implementation for vertex
groups. If the vertex group layer referenced an original mesh, it wasn't
properly duplicated for writing.
2022-03-11 11:25:59 -06:00
28434dab0c Cleanup: Use helper variable
For a NURBS curve, the order is just the degree plus one.
So just pass around the degree instead of always subtracting one.
2022-03-11 10:46:48 -06:00
9097c97767 Fix T96243: Workbench Curvature not rendering in background.
When rendering using the command line the curvature wasn't rendered. The reason
was that the ui_scale wasn't initialized and therefore the same pixels where
sampled to detect the curvature. This is fixed by setting the ui_scale to 1 for any
image render.
2022-03-11 13:52:12 +01:00
9bee8e46a1 Event System: limit early evaluation of drag actions to mouse buttons
Change early drag evaluation added in
1f1dcf41d5 to only apply to drag events
from mouse buttons. Otherwise pressing two keyboard keys at one would
create a drag event for the first pressed key. While this didn't cause
any bugs as far as I know, this behavior makes most sense for drags
that come from cursor input.
2022-03-11 23:06:45 +11:00
c87c12b2a4 Event System: only set press values in win->eventstate
Only set press events in the windows eventstate, not the current event
since it's not useful for these to be set current events press values.
This makes it possible for a press event to access values for the
previous press.
2022-03-11 23:04:11 +11:00
789b1617f7 Fix out of order event handling when calling operators from gizmos
Activating a gizmo used the windows eventstate which may have values
newer than the event used to activate the gizmo.

This meant transforms check for the key that activated transform
could be incorrect.

Support passing an event when calling operators to avoid this problem.
2022-03-11 22:49:47 +11:00
e20fe18706 Correct error in 1032f111d0
Thanks to Jacques Lucke for spotting.
2022-03-11 22:37:16 +11:00
f4c8b4eb3e Fix threading conflict with movie cache line
It was possible that a render thread will be freeing cache while the
interface is iterating over cache items to build cache line.

Found while looking into T94738. It might be a fix, but I am unable
to reproduce the original issue, so can not know for sure whether
there is something else going or or not.
2022-03-11 12:34:37 +01:00
f6564df351 Cleanup: remove duplicate compiler attribute 2022-03-11 15:29:11 +11:00
cf58648409 Correct error in d2222d5b2c 2022-03-11 15:27:34 +11:00
d2222d5b2c RNA: use a function to access the nurbs error message
It makes more sense to use a function in this case as this
creates an error message which is not data associated with
the NURBS curve.
2022-03-11 15:21:30 +11:00
8cc5483331 Text: use simplified logic for txt_to_buf
This function was copied from txt_sel_to_buf, including unnecessary
complexity to support selection as well as checks for the cursor
which don't make sense when copying the whole buffer.

Use a simple loop to copy all text into the destination buffer.
2022-03-11 15:14:14 +11:00
231eac160e PyAPI: use C/RNA API for Text.from_string/to_string
Use faster C code for getting the buffer from text.
2022-03-11 14:44:02 +11:00
1032f111d0 RNA: support functions returning allocated strings
Now it's possible for a C/RNA function to return a dynamic string,
The PROP_NEVER_NULL flag is also supported so a NULL string returns
None in Python.
2022-03-11 14:42:39 +11:00
f527d6582b Cleanup: remove unused variable 2022-03-11 12:38:34 +11:00
d73726dbbe Cleanup: use doxy sections for the outliner 2022-03-11 12:00:08 +11:00
0327a464ba Fix dragging items in the outliner
Regression in b8960267dd,
it's important for box-select to use the drag start to check
if the cursor is over an icon.
2022-03-11 11:46:23 +11:00
Laurynas Duburas
0602852860 Curve: Improve NURBS knot generation modes
This patch enables all 8 combinations of Nurbs modes: Cyclic,
Bezier and Endpoint. Also removes restriction on Bezier Nurbs order.

The most significant changes are mode combinations bringing new
meaning. In D13891 is a scheme showing NURBS with same control
points in a modes, and also further description of each possible case.

Differential Revision: https://developer.blender.org/D13891
2022-03-10 18:34:27 -06:00
27fb63381e Fix T94121: PyAPI: ID property group returns wrong type with iter()
Regression in 265d97556a.
Where iterating directly on a property group failed, e.g.:
`iter(group)`, tests missed this since only `group.keys()`
was checked.
2022-03-11 10:26:27 +11:00
4a8bd31825 Cleanup: use doxy sections in image.cc
Also minor improvements & clarifications to comments.
2022-03-11 09:41:48 +11:00
d449deec21 Cleanup: use enum for local versioning enum 2022-03-11 09:27:37 +11:00
Germano Cavalcante
e3de755ae3 Transform/UI: individualize the option to use snap per editor type
`3DView`'s `use_snap` option has little or nothing to do with using
snapping in `UV`, `Nodes` or `Sequencer`.
So there are no real advantages to keeping these options in sync.

Therefore, individualize the option to use snap for each "spacetype".

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13310
2022-03-10 18:47:38 -03:00
edcb2ad7b3 Fix: Handle handles reset when realizing with other curve types
The result handle attributes for non-bezier types are zeroed.
By mistake though, the entire array was zeroed, not just the
area corresponding to that curves source.
2022-03-10 15:42:30 -06:00
fe3a9fcce1 Fix incorrect meta strip background color
When viewing meta strip, it had orange color. This was caused by
overflow because of hard-coded offset. Theme got darker, and background
was also set again further in code, but redundant drawing was removed in
f4492629ea.
2022-03-10 20:26:21 +01:00
3f91e7d779 Curves: actually delete curves with Delete brush
Previously, the position was just set to zero as part of the prototype.

Differential Revision: https://developer.blender.org/D14291
2022-03-10 18:06:43 +01:00
22a341d9d8 Fix T96292: unable to set active material output using Python
Differential Revision: https://developer.blender.org/D14301
2022-03-10 18:04:07 +01:00
338fe9e2b5 Cleanup: Reduce duplication in realize instances code
Realizing and copying attributes of meshes, curves, and points are very
similar processes, but currently the logic is duplicated three times in
the realize instances code. This commit combines the implementation
for copying generic attributes and creating the result id attribute.

The functions for threaded copying and filling should ideally be in
some file elsewhere, since they're not just useful here. But it's not
clear where they would go yet.

Differential Revision: https://developer.blender.org/D14294
2022-03-10 09:37:56 -06:00
8cdee3a6d4 Fix T93710: Artifacts denoising hi-res images using OPtiX
Caused by an integer overflow in the tiling utilities of OptiX SDK.

Seems for now it's easier to copy and modify code to our sources so
that we don't need to bump SDK version requirement (which might lead
to an increased driver requirement as well).

There are still some fixes needed from a newer driver to have such
denoising to work properly: Windows requires 511.79, Linux 510.54.

Thanks Patrick for investigation!

Differential Revision: https://developer.blender.org/D14300
2022-03-10 16:17:59 +01:00
Ethan-Hall
34d8ef8fa4 Fix: closest image texture interpolation inconsistent in geometry nodes
The `-0.5f` offset is inconsistent with shader nodes.
See D14235 for an example file.

Differential Revision: https://developer.blender.org/D14235
2022-03-10 11:38:08 +01:00
7b62203fc7 IK: make Ik chain length non-animatable
Mark the chain length of regular and spline IK constraints
non-animatable. Changing the IK chain length requires a rebuild of
depsgraph relations. This makes it unsuitable for animation. It's better
to simply avoid having this property animatable than to allow animation
but produce unstable results.

Ref: T96203
2022-03-10 11:34:51 +01:00
1f1dcf41d5 Event System: key-press while dragging now activates drag first
When dragging with a large threshold (using a tablet for example),
it's possible to press another key before the drag threshold is reached.

So tweaking then pressing X would show the delete popup instead of
transforming along the X-axis.

Now key presses while dragging cause the drag event to be evaluated
before the key press.

Note that to properly base the mouse-move event on the previous
state the last handled event is now stored in the window.
Without this the inserted mouse-move event may contain invalid values
from the next event (it's modifier state or other `prev_*` values).

Requested by @JulienKaspar.
2022-03-10 21:26:15 +11:00
ef6d108b75 Fix T96279: 'Emulate 3 button mouse' fails to emulate MMB
Regression in 08d8eee006 caused
emulate-middle mouse to work once, clearing the modifier key.

Now the modifier key from emulated mouse events is never stored
in the windows event-state.
2022-03-10 20:50:58 +11:00
b33d38ebd9 Cleanup: de-duplicate event customdata freeing logic 2022-03-10 16:44:47 +11:00
8c3aee2faf Cleanup: use SPDX license header 2022-03-10 16:27:18 +11:00
36dd3f42bc Cleanup: use 'WM_file_' prefix for file operations 2022-03-10 16:27:18 +11:00
1829232598 Cleanup: spelling in comments & some minor clarifications 2022-03-10 16:27:18 +11:00
0ef8a6179d Cleanup: Move image.c to c++
Passing on all platforms:
https://builder.blender.org/admin/#/builders/18/builds/329

Differential Revision: https://developer.blender.org/D13962
2022-03-09 21:03:02 -08:00
f379943734 Cleanup: Simplify/deduplicate curves built-in attribute access
Separate two templated functions that deal with custom data so that
each built-in attribute accessor doesn't need the same boilerplace and
logic.
2022-03-09 22:59:39 -06:00
24c543d4af Fix: Add missing break 2022-03-09 10:27:08 -06:00
115ff08fdb Fix: Use "construct" instead of "assign" for uninitialized memory
The realize instances code used "assign", but the attribute buffers on
the result aren't necessarily initialized. This doesn't make a difference
for trivial types like `int`, but it would with more complex types.
2022-03-09 10:23:17 -06:00
6c6f591f90 Curves: Port realize instances node to the new data-block
This commit replaces the temporary conversion to `CurveEval` with
use of the new curves data-block. The end result is that the
process looks more like the other components-- somewhere in between
meshes and point clouds in terms of complexity.

The final result is that the logic between meshes and curves is
very similar. There are a few different strategies to reduce
duplication here, so I'll investigate that separately.

There is some special behavior for the radius and handle position
attributes. I used the attribute API to store spans of these
attributes temporarily. Using access methods on `CurvesGeometry`
would be reasonable to, storing spans separately feels a bit more
predictable for now though.

There should be significant performance improvements in some cases,
I haven't tested that specifically though.

Differential Revision: https://developer.blender.org/D14247
2022-03-09 09:58:02 -06:00
39c50d8f31 Outliner: Ensure compiler error when passing wrong tree-element to macro
Passing a `TreeElement *` instead of its `TreeStoreElement *` to
`TSELEM_OPEN()` would seem to work but cause a bug. Add a type check
that will cause a compiler error if it fails.
2022-03-09 15:28:16 +01:00
8e3a58578a Outliner: Correct check for element culling
I don't see a reason to use 2x the element height for the "in-view"
checks. That seems incorrect (although shouldn't cause issues). So
remove that, I don't expect behavior changes.
2022-03-09 15:23:51 +01:00
c4d3d10401 Cleanup: Deduplicate Outliner item culling logic
For whatever reason the "in-view" check was using 2x the element height.
From what I can see this isn't needed, so I'll remove it in a follow-up
commit.
2022-03-09 15:23:51 +01:00
beaf2baeff Cleanup: fix wrong spelling of texture and indentation
Contributed by luzpaz.

Ref D14271, D14270
2022-03-09 15:07:38 +01:00
Ethan-Hall
ef3d76fbaa Fix wrong detection of alpha for grayscale images, after recent changes
Differential Revision: https://developer.blender.org/D14286
2022-03-09 14:53:07 +01:00
6be665926c LibOverride/Outliner: Restrict further operations over liboverrides.
Restrict a lot deletion/moving around of liboverride objects and
collections in the Outliner.

While some of those operations may be valid in some specific cases, in
the vast majority of cases they would just end up breaking override
hierarchies/relationships.

Part of T95708/T95707.
2022-03-09 12:50:04 +01:00
6a7066c2c1 LibOverride: Add a 'is hierarchy root' macro check. 2022-03-09 12:50:04 +01:00
4da282a161 Curves: rename initial brushes
The brushes that are still called "Test" still need to be changed
until they can get their correct name.

Ref T96259.
2022-03-09 11:33:33 +01:00
010ea688f1 Fix T96233: Crash with gpencil data with vertex groups
Blender crashes when a multi-user grease pencil object has vertex
groups and is modified by modifiers, layer transform or parenting.

The fix makes sure that we copy the vertex group names list.

Reviewed By: antoniov

Maniphest Tasks: T96233

Differential Revision: https://developer.blender.org/D14275
2022-03-09 11:22:51 +01:00
04e89c5b06 Fix T96165: Incorrect render of barcelone scene with BVH2
Fix T95462: Partly transparent objects appear to glow in the dark

The issue was caused by incorrect check for exceeded number
of transparent bounces: the same maximum distance was used
for picking up N closest intersections and counting overall
intersections count.

Now made it so intersection count is using ray distance which
matches the way how Embree and OptiX implementation works.

Benchmark result:
{F12907888}

There is no big time difference in the pabellon scene. The
Victor scene timing doesn't seem to be very reliable as the
variance in time across different benchmark runs is quite
high.

Differential Revision: https://developer.blender.org/D14280
2022-03-09 10:37:19 +01:00
801d7b4921 Fix T95738: wrong "Bottom" selection for cone without base
Original patch by @lone_noel with changes by me.

Differential Revision: https://developer.blender.org/D14102
2022-03-09 10:34:59 +01:00
1f9d85f56a Fix cursor drag failing to use click-start
Error in b8960267dd,
the flag was cleared before use.
2022-03-09 17:18:31 +11:00
9416004092 Cleanup: use doxygen comments & sections for animation files 2022-03-09 16:29:22 +11:00
136f0910ff Fix T96250: Invalid default for uv_relax_method
Correct the default & version existing files.
2022-03-09 16:10:19 +11:00
20f53f6984 Correct assert in 399ac1ff11
Pass NULL instead of an empty string.
2022-03-09 13:43:39 +11:00
399ac1ff11 Fix subtype & default for keying set operator properties
Error in 1a12c9edab,
also correct descriptions.
2022-03-09 13:23:00 +11:00
e55f4657f7 Fix T89560: Keymap editor no longer shows keying set dropdown
Include built-in keying sets when ANIM_keying_sets_enum_itemf is called
without a context to allow binding keys to built-in keying sets.
2022-03-09 13:02:29 +11:00
2146256563 Cleanup: use ELEM macro 2022-03-09 10:13:43 +11:00
626c844105 Cleanup: rename wmEvent.prev_click_* to prev_press_*
At the time of naming these members only some event types generated
click events so it made some sense to differentiate a click.

Now all buttons support click & drag it's more logical to use the
prefix "prev_press_" as any press event will set these values.

Also update doc-strings.
2022-03-09 09:25:14 +11:00
353376c783 Fix T92331: Duplicated Window Should Not Be Modal
Operator area_dupli_invoke should not create modal windows.

See D14253 for details.

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

Reviewed by Brecht Van Lommel
2022-03-08 13:57:35 -08:00
Aleksi Juvani
eb326c7b40 Attributes: Implement CustomData interpolation for boolean data type
This commit fixes an issue, where for instance, when merging vertices
with the "Merge by Distance" geometry node, the resulting vertices had
their boolean attributes set unpredictably.

Boolean attributes are implemented as custom data, and when welding
vertices, the custom data for the resulting vertices comes from
interpolating the custom data of the source vertices.

This commit implements the missing interpolation function for the
boolean custom data type. This interpolation function is implemented in
terms of the logical or operation, that is to say, if any of the source
vertices (with a weight greater than zero) have the boolean set, the
boolean will also be set on the resulting vertex.

This logic matches 95981c9876.

In geometry nodes, attribute interpolation generally does not use the
CustomData API for performance reasons, but other areas of Blender
still do.

Differential Revision: https://developer.blender.org/D14172
2022-03-08 15:51:53 -06:00
521d4190a0 Fix T96146: Subdivide curve node uninitialized dangling handles
Handles of non-cyclic bezier curves were not initialized.
Now properly copy the dangling handle positions and types
from the source curve.
2022-03-08 15:45:37 -06:00
b8960267dd Event System: drag events no longer default to the drag start location
This avoids transform jumping which is a problem when tweaking values a
small amount. A fix for T40549 was made box-select used the location
when the key was pressed.

While it's important for box-select or any operator where it's expected
the drag-start location is used, this is only needed in some cases.
Since the event stores the click location and the current location,
no longer overwrite the events real location. Operators that depend on
using the drag-start can use this location if they need.

In some cases the region relative cursor location (Event.mval) now needs
to be calculated based on the click location.

- Added `WM_event_drag_start_mval` for convenient access to the region
  relative drag-start location (for drag events).
- Added `WM_event_drag_start_xy` for window relative coordinates.
- Added Python property Event.mouse_prev_click_x/y

Resolves T93599.

Reviewed By: Severin

Ref D14213
2022-03-09 08:38:42 +11:00
Hallam Roberts
156e07232e Geometry Nodes: Tiny optimization to UV Sphere primitive
Prevents a few unneeded calls to `std::sin`, with an observed
performance improvement of about 1 percent.

Differential Revision: https://developer.blender.org/D14279
2022-03-08 14:39:58 -06:00
d09695b4dd Cleanup: Clang tidy 2022-03-08 13:28:22 -06:00
90c3147e05 Cleanup: Correct comment
Normals aren't stored in custom data anymore, nor are they stored in
MVert for comparisons.
2022-03-08 12:31:21 -06:00
c7ff99b100 Merge branch 'blender-v3.1-release' 2022-03-08 12:19:50 -06:00
c77597cd0e Fix T95843: Invalid mesh runtime data after sculpt undo
When the geometry of the sculpt mesh was replaced when restoring from
a full undo step, the runtime data was not cleared (including any
normals, triangulation data, or any other cached derived data).
In the report, only the invalid normals were observed.

The fix is to simply clear these caches. Later they will be reallocated
and recalculated if necessary. Since the whole mesh replaced here
anyway, this should be a safe fix.

Differential Revision: https://developer.blender.org/D14282
2022-03-08 12:16:42 -06:00
ffea47530d Merge branch 'blender-v3.1-release' 2022-03-08 18:46:23 +01:00
7add8163e4 Blender 3.1 - version bump -> release 2022-03-08 18:36:00 +01:00
b154b8c6f8 Merge branch 'blender-v3.1-release' 2022-03-08 18:34:09 +01:00
b217eb73f5 Licenses: Attribution document for Blender 3.1 2022-03-08 18:27:04 +01:00
50bd8bb175 Cleanup: Remove extra . at the end of RNA string
The strings must not end with point.
2022-03-08 16:55:29 +01:00
c305b88aac Docs: 3.1 release description for Linux appdata 2022-03-08 16:55:19 +01:00
944122d49f Cleanup: Use ELEM macro 2022-03-08 16:44:03 +01:00
62885637fb Cleanup: Make format 2022-03-08 16:41:30 +01:00
Marc Chéhab
e74838d0d0 GPencil: New "Additive" mode for build modifier
The new mode only builds the new strokes in each frame. 

The code is assuming somebody uses "additive" drawing, so that each frame is different only in its NEW strokes. Already existing strokes are skipped. 

I used a simple solution: Count the number of strokes in the previous frame and ignore this many strokes in the current frame.

Differential Revision: https://developer.blender.org/D14252
2022-03-08 16:40:27 +01:00
5791835678 Geometry Nodes: fix spline length node after recent refactor
Differential Revision: https://developer.blender.org/D14276
2022-03-08 16:09:44 +01:00
7bd3762b7c UI: Minor tweaks to IDTemplate operations. 2022-03-08 14:57:47 +01:00
bea7d2e22d LibOverride: Do not assert when root ID is not object/collection.
While uncommon, this is still a valid case...
2022-03-08 14:57:47 +01:00
178f4fa71e Cleanup: fix compiler warning 2022-03-08 13:58:50 +01:00
6f8e65cd7a Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-03-08 13:48:47 +01:00
d5e4cab76c Fix T96224: GPU subdiv crash with smooth normals and tangents
Tangents are computed from UVs on the CPU side when using GPU subdivision
and require that the normals are available there as well (at least for smooth
shading, flat normals can be computed on the fly). This simply adds the missing
normals update call for the `MeshRenderData` setup for the subdivision case.

Differential Revision: https://developer.blender.org/D14278
2022-03-08 13:47:14 +01:00
3a672fe6fb GPU: disable compute shader for problematic drivers
Some drivers for legacy platforms seem to have issues with compute
shaders, as revealed by T94936. This disables compute shader for the
known drivers where this issue is present. It is not clear if the issue
is Windows only or not, so this disable them for all operating systems.

See T94936 for a list of configurations where the issue is reproducible
or not.

Differential Revision: https://developer.blender.org/D14264
2022-03-08 13:39:18 +01:00
64a5fd7a1d Fix wrong edge crease validity check in the Cycles Alembic procedural 2022-03-08 13:38:21 +01:00
3cb3167278 Simplify sound property handling
Sound properties like volume, pitch and muting are handled in
`BKE_sound_add_scene_sound()`. This is unnecessary, because in
properties are then set to real values in `SEQ_edit_update_muting()` and
`seq_update_seq_cb()`.

Alternatively, it may be better to remove all other updates leave them
in `BKE_sound_add_scene_sound()`. But I want to add muting per channel,
whhich is easier and probably cleaner to do with function
`SEQ_edit_update_muting()`.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D14269
2022-03-08 13:16:36 +01:00
73dc8c24e4 PyAPI: optimize depsgraph use in PyDrivers
Avoid re-creating & freeing the depsgraph for every driver evaluation.

Now the depsgraph is kept in the name-space (matching self),
only re-created when the value changes.

In a contrived test-case with many drivers this gave ~15% overall
speedup for animation playback.
2022-03-08 22:15:12 +11:00
f76f48be23 Fix (unreported) liboverride rules from linked data disapearing.
Code cleaning up no-more-needed override data during diffing process
would systematically remove override data from linked IDs.

While this is not a critical issue in theory, it has bad consequences at
the very least on user UI/UX, and potentially can cause bugs in some
corner-cases scenarii.
2022-03-08 12:08:21 +01:00
0df8c22c8a LibOverrides: Tweak to ensure no overrides can be created on linked data.
Was already mostly the case, but from RNA API there was no proper check.
2022-03-08 11:02:22 +01:00
1c1efe3ac6 Fix memory leak evaluating PyDrivers
Missed decref in 686ab4c940 caused every
driver evaluation to create the BPy_StructRNA depsgraph without freeing
the previously allocated depsgraph.
2022-03-08 20:47:43 +11:00
10c11bb897 Curves: add initial comb, grow and shrink brush
The exact behavior of the brushes is still being iterated on, but it
helps having a base implementation that we can work upon.
All of that is still hidden behind an experimental feature flag anyway.

The brushes will get a name in the ui soon.

Differential Revision: https://developer.blender.org/D14241
2022-03-08 10:41:52 +01:00
Jeroen Bakker
1d902a6367 Fix T96213: Crash when texture painting across multiple materials.
Issue only happens in release builds on windows. That said it was an
actual error in the code. This class is compiled inline in release
builds. When updating multiple textures it would reuse the same memory
to collect the changes. When the previous loaded tilenumber was exactly the
same but from a different image the tile buffer wasn't loaded.

Reviewed By: sergey

Maniphest Tasks: T96213

Differential Revision: https://developer.blender.org/D14274
2022-03-08 10:38:38 +01:00
94d2470c41 Curves: increase default viewport resolution for curves object
This part has to be refactored soon anyway, because more types
curves have to be drawn for the new Curves object.

For now, 3 is a better default than 2, because that matches the
actual resolution of the curve currently.
2022-03-08 10:36:46 +01:00
4b598739c5 Curves: disable stroke spacing for curve sculpt brushes
This makes the brushes more smooth, because the brush has an
effect after every mouse move, instead of only every x pixels.

For this to work well, the brushes have to look at the stroke
segments instead of at the mouse positions separately.

A more fine grained check might be added in the future.
2022-03-08 10:33:51 +01:00
b588c09eee Fix: add missing case in switch statement for curves 2022-03-08 10:23:38 +01:00
3d71a05a1d Merge branch 'blender-v3.1-release' 2022-03-08 09:52:47 +01:00
Pratik Borhade
2ddb53de54 Fix T96228: TypeError on use of Copy from Active Track operation
Issue was introduced after the python 3.10 switch
Explicit conversion to int will fix the issue.
Same issue is likely to happen with `MovieTrackingSettings.default_search_size`
So I did the same change over there.

Differential Revision: https://developer.blender.org/D14273
2022-03-08 09:52:17 +01:00
63ac1660c0 Fix T92861: Transform fails for multiple pose object sharing ob-data
Support transforming two pose objects at once even when they share
object data as this is per-object.
2022-03-08 15:13:53 +11:00
3c889fe2b0 Cleanup: pass const scene argument to UV selection functions 2022-03-08 14:45:33 +11:00
06d9c2c223 Cleanup: spelling in comments 2022-03-08 14:32:34 +11:00
c0c840cc31 Cleanup: prefer UNUSED_VARS_NDEBUG for debug only variables
Otherwise it's possible to accidentally use these variables
in debug builds, breaking release builds.
2022-03-08 14:15:34 +11:00
59c972b40a Event System: remove unused NDOF buttons
GHOST always converts NDOF keyboard buttons into keyboard events
so there is no need to expose their values for Blender event types.
2022-03-08 14:01:49 +11:00
88b2bbc649 Event System: support changing NDOF button shortcuts 2022-03-08 13:56:04 +11:00
b58e660828 Event System: click/click-drag support for NDOF buttons
Support this for completeness, as it's simpler to support click-drag
for all events types that support press/release instead of having to
document which kinds buttons support click-drag.
2022-03-08 13:48:40 +11:00
f052fb5646 Event System: add ISKEYBOARD_OR_BUTTON macro
This simplifies checking for event types that support press & release.
2022-03-08 13:48:34 +11:00
08d8eee006 Event System: refactor click detection into function
Also simplify modifier & keymodifier assignment.
2022-03-08 13:48:33 +11:00
08f88bba69 Event System: exclude cursor & NDOF motion from ISHOTKEY() macro
In practice this didn't cause a bug since assigning hot-keys was also
checking for "press" events (which NDOF_MOTION doesn't generate).

Add ISNDOF_BUTTON macro which is now used by ISHOTKEY to avoid
problems in the future.
2022-03-08 13:48:32 +11:00
7b66397664 Cleanup: spelling in comments, use C++ comments for disabled code 2022-03-08 13:48:31 +11:00
901a03725e Curves: Port mesh to curve node to new data-block
The main improvement is a code simplification, because attributes don't
have to be transferred separately for each curve, and all attributes can
be handled generically. Performance improves significantly when the
output contains many curves. Basic testing with a 2 million curve output
shows an approximate 10x performance improvement.
2022-03-07 19:06:40 -06:00
c238728105 Fix: Curves cyclic access function duplicates attribute
This was an oversight in 6594e802ab. First it must check if the
attribute exists before adding it.
2022-03-07 18:58:04 -06:00
b8f1ae5c38 Cleanup: Rename geometry set "curve" to "curves"
Similar to 245722866d, just another function I missed before.
2022-03-07 16:26:55 -06:00
dfd7832a0e Merge branch 'blender-v3.1-release' 2022-03-07 13:58:14 -06:00
2b3367cdf8 Fix T93573: Curve evaluated mesh selected in edit mode
This fixes the second part of T93573 that 8506f3d9fe didn't
properly address. Specifically, outlines of instances still had the
selected color in edit mode in wireframe view. This change is the
same as that commit, just in a different place.

Differential Revision: https://developer.blender.org/D14229
2022-03-07 13:54:49 -06:00
0597902bde Fix memory leak when reading ffmpeg video frames.
We had forgotten to unref packets after reading them.
This lead to a memory leak inside of ffmpeg.
2022-03-07 19:04:51 +01:00
Leon Schittek
1cb303242f UI: align labels of number fields and value sliders
Previously the labels and values in number fields and value sliders
used different padding for the text. This looks weird when they are
placed underneath each other in a column and, as noted by a comment
in the code of `widget_numslider`, they are actually meant to be
aligned.

This patch fixes that by using the same padding that is used for the
number field for the value slider, as well. This also has the benefit,
that the labels of the value sliders don't shift anymore when adjusting
the corner roundness.

Differential Revision: https://developer.blender.org/D14091
2022-03-07 18:32:47 +01:00
21d633f83b GPencil: Temporary fix to avoid crashes on startup
This quick fix will populate the runtime orig pointers to avoid
crashes when a grease pencil object uses layer transforms, parenting
or modifiers.
This will have to be revisited and fixed with a better solution.
2022-03-07 17:48:36 +01:00
Ethan-Hall
15186f4259 Shader Nodes: added alpha mode selector to Image Texture node
Enables image user nodes to display the file alpha mode, similar to the
colorspace setting.

Also removes image_has_alpha in favor of using BKE_image_has_alpha, because it
did not check if the image actually had an alpha channel, just if the file format
was capable of supporting an alpha channel.

Differential Revision: https://developer.blender.org/D14153
2022-03-07 17:39:27 +01:00
Ethan-Hall
5b4ab89663 Shader Nodes: add Alpha output to Object Info node
An alpha component can be specified for an object's color. This adds an alpha
socket to the object info shader node allowing for the alpha component of the
object's color to be accessed in the shader editor.

Differential Revision: https://developer.blender.org/D14141
2022-03-07 17:35:48 +01:00
76f9d83a19 Merge branch 'blender-v3.1-release' 2022-03-07 17:31:32 +01:00
Ethan-Hall
60481e4d99 Fix T96195: f-curve factorized polynomial generator broken UI
The polynomial parameters were not shown correctly.

Differential Revision: https://developer.blender.org/D14254
2022-03-07 17:30:30 +01:00
f130d4f211 Cleanup: fix various typos
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D14203
2022-03-07 17:28:39 +01:00
5bb2b4236d Cleanup: move asssertion-test-only variable into #ifndef NDEBUG block
Move `ToolSettings *ts` into an `#ifdef NDEBUG` block, as it's only used
for a `BLI_assert` call.
2022-03-07 17:10:13 +01:00
2d06b97d29 Fix T95256: Crash when creating off-screen pose asset
Fix crash when creating a pose asset for which the file list entry in
the asset browser is scrolled off-screen. Because of the
off-screen-ness, it wasn't loaded into memory, which eventually caused
an unexpected NULL pointer.

The solution was to use a different function (`filelist_file_find_id`)
that can reliably find the file list entry, after which the cache entry
can be created.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D14265
2022-03-07 17:07:20 +01:00
Leon Schittek
6b8dde93b0 Fix T95531: Draw y axis values in Driver Editor
When drawing the driver editor, only skip drawing the "scrubbing area"
and not the Y-axis values or the scroll bars.

The issue was introduced in rBb3431a88465db2433b46e1f6426c801125d0047d
to avoid drawing the playhead in the Driver Editor but also prevented
the text on the y axis from being drawn.

Reviewed by: Severin, sybren

Maniphest Tasks: T95531

Differential Revision: https://developer.blender.org/D14022
2022-03-07 17:07:20 +01:00
5dca3ee6a2 Fix T95256: Crash when creating off-screen pose asset
Fix crash when creating a pose asset for which the file list entry in
the asset browser is scrolled off-screen. Because of the
off-screen-ness, it wasn't loaded into memory, which eventually caused
an unexpected NULL pointer.

The solution was to use a different function (`filelist_file_find_id`)
that can reliably find the file list entry, after which the cache entry
can be created.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D14265
2022-03-07 17:04:10 +01:00
5ae26e410a Fix T94360: Assert on dragging keyframes
Fix an assert by commenting out the assert.

In normal situations all keyframes are sorted. However, while keys are
transformed, they may change order and then this assertion no longer
holds. The effect is that the drawing isn't perfect during the
transform; the "constant value" bars aren't updated until the
transformation is confirmed. Apart from that, the code runs fine, so it
seems like a workable workaround.
2022-03-07 16:48:44 +01:00
Leon Schittek
ea3b2e8736 Fix T95531: Draw y axis values in Driver Editor
When drawing the driver editor, only skip drawing the "scrubbing area"
and not the Y-axis values or the scroll bars.

The issue was introduced in rBb3431a88465db2433b46e1f6426c801125d0047d
to avoid drawing the playhead in the Driver Editor but also prevented
the text on the y axis from being drawn.

Reviewed by: Severin, sybren

Maniphest Tasks: T95531

Differential Revision: https://developer.blender.org/D14022
2022-03-07 16:24:17 +01:00
5b2d9c0cbe Merge branch 'blender-v3.1-release' 2022-03-07 15:19:05 +01:00
e908ebc094 Fix T96207: wrong default value of Principled BSDF specular tint
Contributed by MysteryPancake.

Differential Revision: https://developer.blender.org/D14256
2022-03-07 14:53:59 +01:00
7f57899823 Merge branch 'blender-v3.1-release' 2022-03-07 12:37:54 +01:00
00f6e4c990 Fix T96180: driver in node tree not updating in real time
Differential Revision: https://developer.blender.org/D14260
2022-03-07 12:37:13 +01:00
4ffe2fec16 Python: Add new annotation_pre & annotation_post handlers
Annotation tool is used as a general mark tool for many add-ons. To be able to detect when an annotation is done is very handy to integrate the annotation tool in add-ons and other studio workflows.

The  new callback names are:  `annotation_pre`  and `annotation_post`

Both callbacks are exposed via the Python module `bpy.app.handlers`

Example use:

```
import bpy

def annotation_starts(gpd):
    print("Annotation starts")

def annotation_done(gpd):
    print("Annotation done")

bpy.app.handlers.annotation_pre.clear()
bpy.app.handlers.annotation_pre.append(annotation_starts)
bpy.app.handlers.annotation_post.clear()
bpy.app.handlers.annotation_post.append(annotation_done)
```

Note: The handlers are called for any annotation tool, including eraser.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D14221
2022-03-07 12:36:47 +01:00
548eabbaa1 Revert "Revert "Fix Crash: Switching to wireframe mode.""
This reverts commit 25fc5876d3.

Committed this unintentionally, looking into an alternate fix.
2022-03-07 22:32:46 +11:00
638c0bd234 Merge branch 'blender-v3.1-release' 2022-03-07 21:52:24 +11:00
a61ee1dcae Cleanup: quiet warnings 2022-03-07 21:51:50 +11:00
0e51defcf4 Fix T95591: Crash on drawing with measure tool with tweak fallback tool
Using press to activate the Tweak tool doesn't work well when used a
fallback tool as the drag event is often used by the current tool -
making it impossible not to select when dragging (unless the fallback
tool is disabled entirely).
Resolve this by using CLICK events when the Tweak tool is used as a
fallback.

Even though this avoids the crash, check for null-pointer de-reference
since changes to the key-map shouldn't cause operators to crash.

Note that the ability for operators to access a gizmo before it's fully
initialized is a more general problem that should be addressed, but out
of scope for a bug-fix.

Reviewed By: zeddb, JulienKaspar, Severin

Maniphest Tasks: T95591

Ref D14231
2022-03-07 21:47:00 +11:00
Yann Lanthony
7ca13eef7c Improve multi-user gpencil data performance with modifiers
When a grease pencil data-block has multiple users and is subject
to modifiers, layer transforms or parenting, performance
(especially playback) is greatly affected.

This was caused by the grease pencil eval process which does per
instance full-copies of the original datablock in case those
kinds of transformations need to be applied.

This commit changes the behavior of the eval process to do shallow
copies (layers with empty frames) of the datablock instead
and duplicates only the visible strokes.

When we need to have a unique eval data
per instance, only copy the strokes of visible
frames to this copy.

Performance:
On a test file with 1350 frames 33k strokes and 480k points
in a single grease pencil object that was instanced 13 times:
 - master: 2.8 - 3.3 fps
 - patch: 42 - 52 fps

Co-authored by: @filedescriptor
This patch was contributed by The SPA Studios.

Reviewed By: #grease_pencil, pepeland

Differential Revision: https://developer.blender.org/D14238
2022-03-07 11:38:56 +01:00
57c5f2a503 Merge branch 'blender-v3.1-release' 2022-03-07 21:35:21 +11:00
72e20785e1 Fix T96205: Active shape key gets lost upon edit mode undo
Regression in d961adb866,
it's important that for the Mesh used for undo storage matches
the shape-key instead of using the coordinates of the Basis key.

Prior to bfdbc78466 a different method of
restoring the basis shape-key coordinates was used (restoring from the
input `Mesh.mvert` array). When undo wrote the edit-mesh into the mesh
this was always NULL so the basis shape keys coordinates were never
used.

Now a parameter has been added so undo can use the active shape for the
meshes vertex coordinates.

Reviewed By: sergey

Maniphest Tasks: T96205

Ref D14258
2022-03-07 21:31:48 +11:00
25fc5876d3 Revert "Fix Crash: Switching to wireframe mode."
This reverts commit cb986446e2.
2022-03-07 19:55:33 +11:00
Jeroen Bakker
073d2390f0 Fix T96163: Image editor doesn't refresh when undo/redo.
Undo would invalidate image owned GPU textures only. Textures
that are owned by the editor were not refreshed. This patch would
invalidate all the GPU textures by marking the whole image dirty.

This can be improved later as we could add partial updates of GPU
textures.

Reviewed By: mont29

Maniphest Tasks: T96163

Differential Revision: https://developer.blender.org/D14259
2022-03-07 08:43:50 +01:00
ad2948face Merge branch 'blender-v3.1-release' 2022-03-07 07:49:52 +01:00
4681987d92 Fix T96156: Snap to 3D cursor can't be undone
Caused by oversight in 2bcf93bbbe. Operator returns `OPERATOR_CANCELLED`
when it should return `OPERATOR_FINISHED`.

Reviewed By: mano-wii, campbellbarton

Differential Revision: https://developer.blender.org/D14243
2022-03-07 07:46:24 +01:00
Red Mser
8ec35c05b2 Curve: sync active material with selection
Changing active spline updates active material index.

Reviewed By: campbellbarton

Ref D14250
2022-03-07 12:06:33 +11:00
fae45a43fa Cleanup: use doxy-sections for pipeline, text_drag & effects
Also improve on the doc-string for RE_RenderFrame & RE_RenderAnim.
2022-03-07 10:51:22 +11:00
a5f972c018 Cleanup: use loops for key-map entries that map values to number keys
Also add __all__ referencing the only two members of the modules
that should be accessed externally.
2022-03-06 21:16:21 +11:00
887ccb8537 Fix T96152: Crash realizing curve instances
The "curve_type" was transferred to instances because it isn't a
built-in curve attribute. Then it was interpolated as a point
domain attribute from the instance domain in the realize
instances node.

The fix was just missing from 9ec12c26f1.
`curve_type` needs to be marked as a built-in attribute.
2022-03-04 22:28:57 -05:00
295d5c6ef5 Fix T96164: Crash with curve domain attributes
When converting from the new type to the old, the curve domain
attributes weren't properly resized, so their data was not properly
allocated.
2022-03-04 11:11:56 -05:00
45079b169d Fix T96160: freezing when using multiple Handle Type Selection nodes
Differential Revision: https://developer.blender.org/D14245
2022-03-04 15:21:18 +01:00
1763ffa0be Cleanup: Unused variable warnings 2022-03-04 07:59:07 -05:00
5eaeb9bd0d GPencil: Fix wrong parameters in gpencil_check_same_material_color
The stroke and fill parameters were flipped.
2022-03-04 08:44:23 +01:00
0212c423bf Cleanup: remove outdated references to tweak 2022-03-04 13:31:16 +11:00
0a4fdcbb5f Cleanup: unused Python variables & imports 2022-03-04 11:07:37 +11:00
6bca614fd8 Cleanup: use doxy-sections in outliner_draw.cc
Also remove outdated comment.
2022-03-04 10:53:06 +11:00
bfd43222c3 Cleanup: use doxy-sections for interface_dropboxes.cc 2022-03-04 10:35:22 +11:00
0a2d61f45c Sequencer: de-duplicate new-scene enum, include in generated docs 2022-03-04 10:31:11 +11:00
65e6bcdd9f Sequencer: disallow assigning scenes to non-seuencer strips 2022-03-04 10:31:11 +11:00
ccefcf46bf Cleanup: use doxy-sections in scene_edit.c 2022-03-04 10:31:11 +11:00
4837ea3ab6 Cleanup: warning & spelling from recent scene/sequencer operator
- Avoid the abbreviation "VSE" as the convention is to use "sequencer".
- Remove dead-code (second return statement).
- Remove unused argument.
2022-03-04 10:31:11 +11:00
8b06c524d2 Cleanup: spelling in comments, function name 2022-03-04 10:31:11 +11:00
Azeem Bande-Ali
fd2519e0b6 UI: Drag & Drop to Properties Materials Panel
Support drag/drop of materials to Properties Material Slots.

See D13549 for more details.

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

Reviewed by Julian Eisel
2022-03-03 15:28:48 -08:00
471f27d66b Curves: Port endpoint selection node to new data-block
The node should be faster than in 3.1, for a few reasons:
- It doesn't need to calculate and allocate the curve offsets.
- It doesn't need to de-reference a pointer for each curve.
- The inputs are accessed from the virual arrays fewer times.

On top of that, I added two other performance improvements:
- The node is multi-threaded when there are many curves.
- There are generated special cases for single value and span inputs.

**Performance**
With a set position node affecting 1 million splines with a selection
based on this node, on an Intel i5 8250U (times are approximate):
| Before | After | Speedup |
| 760 ms | 60 ms | 13x     |

Differential Revision: https://developer.blender.org/D14233
2022-03-03 11:55:31 -05:00
908ac7dce2 Merge branch 'blender-v3.1-release' 2022-03-03 17:47:34 +01:00
769ae5c866 Fix T96139: Cycles doesn't warn if the render is paused
Caused by 6ec83afb1d.

Technically, a regression since 3.0.

Differential Revision: https://developer.blender.org/D14239
2022-03-03 17:21:11 +01:00
d793d18413 BLI: Add functions to IndexRange to mirror Span
Adds functions for special cases of slicing and an `is_empty` method.
2022-03-03 11:14:44 -05:00
e8dc82311d Fix T96145: GPencil eval data not updated correctly
When removing a modifier, changing the layer transform or updating
 the parent of a grease pencil object that has a multi-user datablock
 and animation data, the eval data is not updated properly (after a
 frame change). This can also cause memory leaks.

 The fix makes sure that we free and reset any runtime copy
 (`ob->runtime.gpd_eval`) in `BKE_gpencil_prepare_eval_data`.

 Note: As far as we can tell, `ob->runtime.gpd_orig` is unused and could
 be removed. The assignment in `BKE_gpencil_prepare_eval_data`
 seemed to be unnecessary.

Co-authored-by: @yann-lty

Reviewed By: antoniov

Maniphest Tasks: T96145

Differential Revision: https://developer.blender.org/D14236
2022-03-03 16:01:23 +01:00
6e487228a5 File Browser UI: Allow dragging anywhere in a file preview tile to drag
Previously you'd have to be careful to drag the image itself. Dragging
anywhere else on the tile (e.g. between the preview and the text, or the
text itself) would trigger border select. This often conflicts with user
expectations and causes frustration when trying to work quick, I've seen
many people complain about this.

Note that the "hitbox" for dragging is a bit smaller than the tile, to
not make border select by dragging from in-between the tiles too hard.

Differential Revision: https://developer.blender.org/D14228
2022-03-03 15:17:23 +01:00
544bd0c353 Cleanup: Remove redundant drag image size parameters
Just use the image-buffer size and the already provided scale to
determine the size, not the button size (which would always have to
match the scaled image-buffer size or it would give unexpected results).
2022-03-03 15:04:45 +01:00
1b863041c9 i18n: Fix more potential contextual issues with "Back" UI label.
Add 'ID_ACTION' context to some animation curve interpolation enums.

Related to T95506/T43295.
2022-03-03 14:52:45 +01:00
0f77933031 Merge branch 'blender-v3.1-release' 2022-03-03 13:49:08 +01:00
9c2e385509 Fix Cycles hang in classroom scene with upcomping AMD driver version 22.10
This is a workaround until there is a fix in the HIP compiler or driver.

Differential Revision: https://developer.blender.org/D14232
2022-03-03 13:42:58 +01:00
ffaaa0bcbf UV: Edge selection support
This patch adds edge selection support for UV editing (refer T76545).
Developed as a part of GSoC 2021 project - UV Editor Improvements.

Previously, selections in the UV editor always flushed down to vertices
and this caused multiple issues such as T76343, T78757 and T26676.
This patch fixes that by adding edge selection support for all UV
operators and adding support for flushing selections between vertices
and edges. Updating UV select modes is now done using a separate
operator, which also handles select mode flushing and undo for UV
select modes. Drawing edges (in UV edge mode) is also updated to match
the edit-mesh display in the 3D viewport.

Notes on technical changes made with this patch:
* MLOOPUV_EDGESEL flag is restored (was removed in rB9fa29fe7652a).
* Support for flushing selection between vertices and edges.
* Restored the BMLoopUV.select_edge boolean in the Python API.
* New operator to update UV select modes and flushing.
* UV select mode is now part of editmesh undo.

TODOs added with this patch:
* Edge support for shortest path operator (currently uses vertex path logic).
* Change default theme color instead of reducing contrast with edge-select.
* Proper UV element selections for Reveal Hidden operator.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12028
2022-03-03 17:59:09 +05:30
76879e3702 Outliner: Display respective data-block icon in library overrides mode
Just showing the library override icon for every item doesn't add much
information, it's just redundant. Displaying the data-block type icon on
the other hand can be useful.

Differential Revision: https://developer.blender.org/D14208
2022-03-03 13:18:23 +01:00
9b12889a1a Fix T96140: Crash on color button drag & drop
Use-after-free in context store, which wasn't cleared correctly after
setting and querying.
2022-03-03 12:51:44 +01:00
2d24ba0210 VSE: Allow to create scene in strip properties
This patch adds a button in the scene to add a new one, but this does not change to the new created scene because this breaks the storyboarding workflow.

This is a common request for Storyboarding artists.

Reviewed By: mendio, brecht, ISS

Differential Revision: https://developer.blender.org/D14148
2022-03-03 12:37:48 +01:00
ce0d4ea41c Merge branch 'blender-v3.1-release' 2022-03-03 20:47:07 +11:00
d961adb866 Fix T96135: Mesh coordinates are set to the last edited shape-key
When exiting edit-mode set the vertex coordinates to the basis-shape when editing non-basis keys.

Regression in bfdbc78466.

Reviewed By: sergey

Ref D14234
2022-03-03 20:42:30 +11:00
d66b047ca3 WM: use pass-through for cursor placement operator
This is needed since 4d0f846b93
however change in the operator instead of the event handler is correct,
as accepting a press event should suppress drag events unless
the pass-through flag is set.

This is how select & tweak already works.
2022-03-03 20:35:14 +11:00
ec09ded792 Fix missing i18n context variable in UI py script.
Mistake in own rBdb3f5ae48ac, thanks to Ethan-Hall (@Ethan1080) for the
heads up.
2022-03-03 08:57:06 +01:00
a8df292264 Cleanup: comments in wm_event_system.c 2022-03-03 16:45:40 +11:00
4d0f846b93 Event System: use more thoroughly tested logic for click-drag events
No functional changes, largely restoring old logic & removing the need
for workarounds.

Reverts:
- 13b6cec039.
- aa71414dfc (partially).
2022-03-03 16:07:18 +11:00
9d529407da UI: only wrap cursor motion horizontally when dragging markers
It's not useful to wrap vertical motion when dragging markers.
It was too easy to accidentally wrap the cursor to the top of a region,
as markers need to be dragged from the bottom edge of the region.
2022-03-03 15:48:41 +11:00
d764448f73 Cleanup: use doxygen sections for anim_markers.c 2022-03-03 15:46:26 +11:00
08da699faa Cleanup: rename misleading variable for marker selection cycling
"marker_selected" was the marker after the selected marker
and is used for cycling the selection.
2022-03-03 15:46:15 +11:00
61c288cee5 Fix timeline marker click-drag arbitrary deselection
The logic to cycle selected markers wasn't cycling back to the beginning
of the list.

The marker after the selected marker at the cursor frame was also used
to check if a selection existed, causing dragging to transform all
selected markers to de-select all when when dragging the last marker.
2022-03-03 15:25:02 +11:00
ef431a8705 Cleanup: remove references to key-map modifier values denoting order
This feature was never exposed to users.
2022-03-03 13:57:44 +11:00
3c175caaa3 Cleanup: Rename set handle type node internally to match UI
I've had trouble finding this node a few times now,
it's simpler if the file name matches the name in the UI.
2022-03-02 17:58:17 -05:00
ddf956fb58 Curves: Port set resolution node to the new data-block
The node unnecessarily converted to the old data structure to check if
there were any poly splines. Instead, that warning is just removed,
because the node now still sets resolution values in that case, they
just aren't used (before the values weren't set at all). Either way, it
wasn't clear that looping though all of the curve types was worth
the performance cost here.
2022-03-02 17:50:25 -05:00
2600806c2e Fix: BLI math clamp doesn't work
Return type was wrong, output of std::clamp wasn't used.
2022-03-02 17:09:17 -05:00
ecba8c1243 Fix mistake in seeking cleanup
In `ffmpeg_read_video_frame` fix assignment used as truth value.
In `ffmpeg_seek_recover_stream_position` loop while return value is
greater or equal to 0.
2022-03-02 22:25:43 +01:00
f531dff9b3 Cleanup: Use rectangle for file browser tile drawing
Passing around coordinates for drawing can be quite confusing, it's
often not clear what they represent and where they are currently.
Instead pass around the tile rectangle for drawing and let all code draw
based on that, it's way more clear that way.

Changes shouldn't be user visible.
2022-03-02 19:25:18 +01:00
Nikhil Shringarpurey
721b705499 UI: Comments Misspellings of Vertex/Vertices
Correct misspellings in code comments of "vertex" and "vertices".

See D13932 for more details.

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

Reviewed by Harley Acheson
2022-03-02 10:05:15 -08:00
ca0b728529 Fix T96101: "Remove" button failure on Grease Pencil layer's relation to bone
As the channel was not found, the relation data was not updated.

Now, if the bone is removed, the relation is set.
2022-03-02 17:48:35 +01:00
34267a868a Merge branch 'blender-v3.1-release'
and resolve merge error (version string).
2022-03-02 17:35:09 +01:00
9789a6c6d9 Search: take word order into account in string search
Differential Revision: https://developer.blender.org/D14223
2022-03-02 17:25:39 +01:00
8506f3d9fe Blender 3.1 bcon4 - change release cycle to release candidate
This is still a rolling release candidate with new builds every day
as a preparation to the final release.
2022-03-02 17:17:38 +01:00
ac45540a34 Curves: add brush to add curves on surface
This adds a prototype for the first brush that can add new curves by
painting on a surface. Note that this can only be used when the curves
object has a surface object set in the properties panel.

The brush can take minimum distance into account. This allows
distributing curves with a somewhat consistent density.

Differential Revision: https://developer.blender.org/D14207
2022-03-02 17:15:44 +01:00
037e1ad140 Merge branch 'blender-v3.1-release' 2022-03-02 17:13:57 +01:00
2fb31f34af Fix T95692: incorrect interpolated children particle hair
Differential Revision: https://developer.blender.org/D14227
2022-03-02 17:12:56 +01:00
d86f80f42a Merge branch 'blender-v3.1-release' 2022-03-02 10:55:21 -05:00
216a215ba5 Fix T93573: Remove outline from instances in edit mode
This commit removes the outline from instances generated from an object
when in edit mode. This takes the change in aa13c4b386 a bit further,
with the idea that instance outlines are more like regular outlines.

Because evaluated object data that doesn't match the original object
type is treated as an instance internally, this fixes the way evaluated
meshes for curves objects have an outline, for example.

See the differential revision for a visual comparison.

Differential Revision: https://developer.blender.org/D14226
2022-03-02 10:49:48 -05:00
7935d3668a Fix T95479: geometry nodes crash with cage display
Differential Revision: https://developer.blender.org/D14225
2022-03-02 16:10:42 +01:00
Ethan Hall
1e1d1f15e8 UI: Enable the outliner to use the correct icon for each curve subtype
This patch enables enables the outliner to use the correct icon for each
of the curve subtypes (Curve/Surface/Font).

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

Reviewed by: Julian Eisel
2022-03-02 15:52:17 +01:00
13b6cec039 Fix/Workaround T96120: Crash dropping from the file browser
Since removal of tweak events 4986f71848,
box-select is activating while dragging files.

As far as I can tell this used to work because of differences
int the order tweak / click-drag events are handled.

Apply a workaround since dragging files doesn't prevent other parts
of the UI from activated (it's possible to open menus for e.g),
this is something we will likely want to limit which would resolve
this bug too.
2022-03-03 01:36:14 +11:00
3a0df7d37b Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-03-02 15:22:19 +01:00
6883c47bb5 Fix T94729: GPU subdivision does not support meshes without polygons
There are two issues revealed in the bug report:
- the GPU subdivision does not support meshes with only loose geometry
- the loose geometry is not subdivided

For the first case, checks are added to ensure we still fill the
buffers with loose geometry even if no polygons are present.

For the second case, this adds
`BKE_subdiv_mesh_interpolate_position_on_edge` which encapsulates the
loose vertex interpolation mechanism previously found in
`subdiv_mesh_vertex_of_loose_edge`.

The subdivided loose geometry is stored in a new specific data structure
`DRWSubdivLooseGeom` so as to not pollute `MeshExtractLooseGeom`. These
structures store the corresponding coarse element data, which will be
used for filling GPU buffers appropriately.

Differential Revision: https://developer.blender.org/D14171
2022-03-02 15:19:55 +01:00
47396ea81e Fix T96123: Crash when click-dragging across the visibility icons
Partially revert aa71414dfc

This attempted have the click-drag event compatible with old tweak
events, but needs to be re-thought since it caused events to be handled
in unexpected situations.
2022-03-03 01:11:17 +11:00
4a95c3466f Fix T96085: repeated evaluation of geometry nodes when nothing changed
Differential Revision: https://developer.blender.org/D14216
2022-03-02 14:12:08 +01:00
c23ec04b4e BLI: add scoped-defer utility to add RAII-like behavior to C types
This utility is useful when using C types that own some resource in
a C++ file. It mainly helps in functions that have multiple return
statements, but also simplifies code by moving construction and
destruction closer together.

Differential Revision: https://developer.blender.org/D14215
2022-03-02 12:51:21 +01:00
721335553c Add Object Tool: use the drag-start location for initial placement 2022-03-02 22:29:40 +11:00
Henrik Dick
c2e8e68b65 Fix T95963: change thresholds in complex solidify
This fix contains two parts. There was one critical mistake where
order of two indices was wrong when removing constraint planes from
the array. The other changes are improvements to the used thresholds
to keep everything numerically stable.

Differential Revision: http://developer.blender.org/D14183
2022-03-02 12:14:22 +01:00
ccf4001458 Fix modal item open/close in the outliner since removing tweak events
Correct check for left-mouse event which assumed the alternative was
a tweak event.

Also remove print added by accident.
2022-03-02 22:04:39 +11:00
102644cb8c Fix releasing modifier keys suppressing drag events
Always use event.prev_click_type since this is never set on key-release,
which could still interrupt dragging (box selecting for example).
2022-03-02 21:47:49 +11:00
1747269ea5 Cleanup: misleading code from aa71414dfc
This branch was previously run when the action had been handled,
since action checks were removed it was running. This assignment
does nothing but shouldn't be kept.
2022-03-02 21:47:49 +11:00
51c5a4d85d Merge branch 'blender-v3.1-release' 2022-03-02 11:45:48 +01:00
Brecht Van Lommel
383a6ee78c Fix T94609: geometry nodes always re-evaluated with image texture nodes
previously_visible_components_mask was not preserved for Image ID nodes, which
meant it was always detected as newly visible and tagged to be updated, which
in turn caused the geometry nodes using it to be always updated also.

Reviewed By: sergey, JacquesLucke

Maniphest Tasks: T94609

Differential Revision: https://developer.blender.org/D14217
2022-03-02 11:45:17 +01:00
5086913b28 Fix T96116: Image editor not updated when adding new tile. 2022-03-02 11:42:23 +01:00
f8577db05d Docs: document the use_axis_view argumeht to view_roll_angle
Also remove event print left in by accident.
2022-03-02 18:28:15 +11:00
46a5a15d30 Cleanup: rename direction enum as it's part of the key-map item
Also improve doc-strings for key-map item constants.
2022-03-02 18:00:59 +11:00
7e4c031328 Cleanup: remove all tweak events from key-map presets 2022-03-02 17:29:27 +11:00
4986f71848 Event System: remove tweak events in favor of click-drag
Supporting two kinds of dragging is redundant, remove tweak events as
they only supported 3 mouse buttons and added complexity from using the
'value' to store directions.

Support only click-drag events (KM_CLICK_DRAG) which can be used with
any keyboard or mouse button.

Details:

- A "direction" member has been added to keymap items and events which
  can be used when the event value is set to KM_CLICK_DRAG.

- Keymap items are version patched.

- Loading older key-maps are also updated.

- Currently the key-maps stored in ./release/scripts/presets/keyconfig/
  still reference tweak events & need updating. For now they are updated
  on load.

Note that in general this wont impact add-ons as modal operators don't
receive tweak events.

Reviewed By: brecht

Ref D14214
2022-03-02 15:31:50 +11:00
426ff481a7 Event System: match click-drag & tweak event handling for transform 2022-03-02 14:53:15 +11:00
78372d8b9c Event System: support "Release Confirms" for click-drag events 2022-03-02 14:44:34 +11:00
aa71414dfc Fix click-drag events for dragging markers
Clicking and dragging markers accumulates flags from multiple operators
in a way that can't be interpreted when combine.

Follow tweak behavior for cancelling click-drag events.
2022-03-02 14:28:29 +11:00
cf428b2ebd Fix ignored click-drag events when operators pass-through & finished
Replacing tweak key-map items with click-drag caused selection
in the graph/sequencer/node editors to ignore drag events
(all uses of WM_generic_select_modal).

Operators that return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED
result in the event loop considering the event as being handled.

This stopped WM_CLICK_DRAG events from being generated which is not the
case for tweak events.

As click-drag is intended to be compatible with tweak events,
accept drag events when WM_HANDLER_BREAK isn't set or when
wm_action_not_handled returns true.
2022-03-02 12:25:12 +11:00
aa500c4fca Cleanup: use back-slash for doxygen commands, color after parameters 2022-03-02 12:11:08 +11:00
eabdcdcd44 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-03-02 00:59:03 +01:00
4932269ec3 Fix T94952: normals maps don't render correctly with GPU subdivision
A simple case of missing the tangent VBO. The tangents are computed from
the coarse mesh, and interpolated on the GPU for the final mesh. Code for
initializing the tangents, and the vertex format for the VBO was
factored out of the coarse extraction routine, to be shared with the
subdivision routine.
2022-03-02 00:58:40 +01:00
e03b9f555c Cmake: Re-enable Amaranth add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-03-01 17:45:45 -05:00
a75e9863fe Cmake: Re-enable Amaranth add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-03-01 17:45:13 -05:00
10405b15ec Cleanup: Refactor seeking code
Improve readability and reduce indentation levels. No functional changes.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D14075
2022-03-01 23:42:23 +01:00
4491c62260 Fix potential crash during proxy building
Last step of proxy building caused crash due to thread race contition
when acessing ed->seqbase.

Looking at code, it seems that calling IMB_close_anim_proxies on
original strips is unnecessary so this code was removed to resolve this
issue.

Locking seqbase data may be possible, but it's not very practical as
many functions access this data on demand which can easily cause
program to freeze.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D14210
2022-03-01 23:42:23 +01:00
bfe37b7255 Merge branch 'blender-v3.1-release' 2022-03-01 18:35:48 -03:00
9bd586a01e Fix T95608: Mac issues with drag drop on multi-monitor
Mousemove events are sent to windows.

In Windows OS, almost all mousemove events are sent to the window whose
mouse cursor is over.

On MacOS, the window with mousemove events is always the active window.
It doesn't matter if the mouse cursor is inside or outside the window.

So, in order for non-active windows to also have events,
`WM_window_find_under_cursor` is called to find those windows and send
the same events.

The problem is that to find the window, `WM_window_find_under_cursor`
only has the mouse coordinates available, it doesn't differentiate
which monitor these coordinates came from.

So the mouse on one monitor may incorrectly send events to a window on
another monitor.

The solution used is to use a native API on Mac to detect the window
under the cursor.

For Windows and Linux nothing has changed.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14197
2022-03-01 18:25:12 -03:00
e1ec2d0251 Merge branch 'blender-v3.1-release' 2022-03-01 16:31:18 -03:00
8e88af9934 Fix wrong object mode checking in snap code
The value of `OB_MODE_OBJECT` is 0, this makes it unsuitable as a bitflag.

Issue pointed out at https://pvs-studio.com/en/blog/posts/cpp/0922/

Thanks to Andrey Karpov
2022-03-01 16:30:30 -03:00
8322a4f6b7 Fix T92980: missing Cycles video texture update with persistent data 2022-03-01 19:51:30 +01:00
Henrik Dick
6498688e27 GPencil: Improve subdivision modifier
The subdivision modifier for Grease Pencil handles closed strokes
correctly now and does converge to the same shape as the mesh
subdivision surface.

Differential Revision: http://developer.blender.org/D14218
2022-03-01 19:32:02 +01:00
444d57d440 Geometry Nodes: Port most curve primitives to new data-block
Create `Curves` directly, instead of using the conversion from
`CurveEval`. This means that the `tilt` and `radius` attributes
don't need to be allocated. The old behavior is kept by using the
right defaults in the conversion to `CurveEval` later on.

The Bezier segment primitive isn't ported yet, because functions
to provide easy access to built-in attributes used for Bezier curves
haven't been added yet.

Differential Revision: https://developer.blender.org/D14212
2022-03-01 12:06:29 -05:00
f085c2bab5 Cmake: Re-enable tiny cad add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-03-01 11:58:27 -05:00
89bf5d8ba9 Cmake: Re-enable tiny cad add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-03-01 11:57:13 -05:00
f98d74c80d Curves: Move curves primitive to object add code
Currently, any time a Curves data-block is created, the `curves_random`
function runs, filling it with 500 random curves, also adding a radius
attribute. This is just left over from the prototype in the initial
commit that added the type.

This commit moves the code that creates the random data to the curve
editors module, like the other primitives are organized.

Differential Revision: https://developer.blender.org/D14211
2022-03-01 11:40:25 -05:00
952a613d38 Cycles: Hide MetalRT checkbox for AMD GPUs
This patch hides the MetalRT checkbox for AMD GPUs, pending fixes for MetalRT argument encoding on AMD.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14175
2022-03-01 16:05:47 +00:00
143bc9f8d4 Merge branch 'blender-v3.1-release' 2022-03-01 23:11:46 +11:00
d681d82d41 Fix T96035: Some tool settings do not work
Oversight in 74611e3555 missed updating
property access to use the tool identifier to lookup the property group.
2022-03-01 23:09:56 +11:00
f493e2f23a Merge branch 'blender-v3.1-release' 2022-03-01 11:46:53 +01:00
629f22f161 Fix T95997: Crash when entering edit mode
The issue was uncovered by the 0f89bcdbeb, but the root cause goes
into a much earlier design violation happened in the code: the modifier
evaluation function is modifying input mesh, which is not something
what is ever expected.

Bring code closer to the older state where such modification is only
done for the object in edit mode.

---

From own tests works seems to work fine, but extra eyes and testing
is needed.

Differential Revision: https://developer.blender.org/D14191
2022-03-01 11:46:38 +01:00
90ec634135 Fix incorrect drag-event threshold when releasing modifiers early
db4313610c added support for modifier
keys to be released while dragging.

The key release events set wmEvent.prev_type which is used select the
drag threshold, causing the wrong threshold to be used.

Add wmEvent.prev_click_type which is only set when the drag begins.
2022-03-01 21:41:08 +11:00
cde5e12c0b Fix T96097: Image editor tile drawing not working.
The image engine is depth aware when using tile drawing the depth is
only updated for the central image what lead to showing the background
on top of other areas.

Also makes sure that switching the tile drawing would lead to an update
of the texture slots.
2022-03-01 11:37:18 +01:00
4b9c77a19a Merge branch 'blender-v3.1-release' 2022-03-01 11:36:46 +01:00
9216cf9cb5 Fix: dangling internal links after removing sockets
This is a follow up for rBd5e73fa13dd275fb9c76b1e41142ab086dd2e6be.
The issue was found with the file in T95997.
2022-03-01 11:34:36 +01:00
476fe7d164 Fix T95979: Bake doesn't update Image editor. 2022-03-01 11:20:54 +01:00
eec1c16200 Fix T96030: Update Image editor after reload. 2022-03-01 11:04:09 +01:00
a5214212cf Fix T96030: ImageEditor not updated for generated images. 2022-03-01 10:51:07 +01:00
d743ef91df Fix 3d texture painting artifacts.
When dimension of images aren't a multifold of 256 parts of the gpu
textures are not updated. This patch will calculate the correct part of
the image that needs to be reuploaded.
2022-03-01 10:45:19 +01:00
4a4701b43c Fix painting on none 256 aligned images.
Internally the update tiles are 256x256. Due to some miscalculations
tiles were not generated correctly if the dimension of the image wasn't
a multifold of 256.
2022-03-01 09:32:58 +01:00
34f6a99433 Fix crash triggered by an introduced assert. 2022-03-01 08:56:58 +01:00
ead84d2ba6 Fix building error in previous commit. 2022-03-01 08:53:23 +01:00
5e9c1feb8a Image Engine: Performance 8 byte images.
Previously we used to cache a float image representation of the image in
rect_float. This adds some incorrect behavior as many areas only expect
one of these buffers to be used.

This patch stores float buffers inside the image engine. This is done per
instance. In the future we should consider making a global cache.
2022-03-01 08:41:25 +01:00
f0bfceb96d Cleanup: remove unused code 2022-03-01 17:22:35 +11:00
9b114d6214 Merge branch 'blender-v3.1-release' 2022-02-28 23:47:43 -05:00
91de337dc5 Cmake: Re-enable tissue add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-02-28 23:45:59 -05:00
a4e8b3a9a9 Cleanup: remove check_deprecated.py
This was temporarily added back as the build-bot was running it.
2022-03-01 14:09:03 +11:00
8a8424021c Cleanup: move Event.is_repeat & is_direction_inverted to flags
Use a flag for events to avoid adding struct members every time a new
kind of tag is needed - so events remain small.

This also simplifies copying settings as flags can be copied at once
with a mask.
2022-03-01 12:21:27 +11:00
eb0f8317e2 Cleanup: ED_view3d_win_to_delta & ED_view3d_calc_zfac usage
- Rename ED_view3d_win_to_delta `mval` argument to `xy_delta` as it
  as it was misleading since this is an screen-space offset not a region
  relative cursor position (typical use of the name `mval`).
  Also rename the variable passed to this function which also used the
  term `mval` in many places.
- Re-order the output argument of ED_view3d_win_to_delta last.
  use an r_ prefix for return arguments.
- Document how the `zfac` argument is intended to be used.
- Split ED_view3d_calc_zfac into two functions as the `r_flip` argument
  was only used in some special cases.
2022-03-01 11:18:17 +11:00
Leon Schittek
ae6400cfb4 UI: Fix multi input socket outline and highlight
Small fixes to the drawing of multi input sockets:
 - Make the outline thickness consistent with normal node sockets,
   independent from the screen DPI.
 - Only highlight multi input sockets when they are actually selected.
 - Skip selected multi inputs when drawing normal selected sockets.

Differential Revision: https://developer.blender.org/D14192
2022-02-28 18:05:30 -05:00
5777bd719b Cleanup: use doxygen comments, correct spelling
Also move eDupli_ID_Flags doc-string to it's declaration.
2022-03-01 09:36:25 +11:00
94a4dddb1b Fix: Don't tag curves component cache dirty for radius
Changing the radius does not invalidate a cache on
`CurvesGeometry`.
2022-02-28 17:28:54 -05:00
9ebb65323e Fix: Use correct default in Curves to CurveEval conversion
Currently the code expects the radius attribuet to always exist on the
input Curves. This won't be true in the future though, so the correct
default value of one should be used when creating the data on CurveEval,
where the data is not optional.
2022-02-28 17:27:38 -05:00
6594e802ab Curves: Add method to access cyclic attribute
Avoids the need to use the attribute API to access this commonly
used builtin attribute.
2022-02-28 17:20:37 -05:00
4c407f20a6 Cleanup: Move object_add.c to C++
This patch was tested on the buildbot first, it builds on all platforms.
2022-02-28 16:20:55 -05:00
Leon Schittek
75bb99fa40 Nodes: Improve readability of selected node links
This commit improves the drawing of selected node links:
 - Highlight the entire link to make it easier to spot where the link
   is going/coming from.
 - Always draw selected links on top, so they are always clearly
   visible.
 - Don't fade selected node links when the sockets they are connected
   to are out out view.
 - Dragged node links still get a partial highlight when they are only
   attached to one socket.

Differential Revision: https://developer.blender.org/D11930
2022-02-28 15:52:00 -05:00
Wannes Malfait
eeb0279e89 Geometry Nodes: Use std::move in dual mesh node
Add a std::move in some places to prevent arrays from being copied.
These cases were potentially optimized by the compiler, but this makes
it more explicit.

Differential Revision: https://developer.blender.org/D14129
2022-02-28 15:16:01 -05:00
611157057b Cleanup: Use bool instead of int 2022-02-28 15:10:20 -05:00
7c3a5da04b Merge branch 'blender-v3.1-release' 2022-02-28 14:38:41 -05:00
59a133b61f Cmake: Re-enable real snow add-on
This add-on now conforms to the distribution requirements, see: T95442.
2022-02-28 14:38:13 -05:00
96492903aa Merge branch 'blender-v3.1-release' 2022-02-28 19:18:22 +01:00
44b0c70919 Fix T92288, T96041: instancing of shared mesh objects without modifiers broken
New code from the vertex normal refactor cfa53e0fbe combined with older code
from 592759e3d6 that disabled instancing for custom normals and autosmooth
meant that instancing was always disabled.

However we do not need to disable instancing for custom normals and autosmooth
at all, this can be shared between instances just fine.
2022-02-28 18:32:27 +01:00
Henrik Dick
8c932ab43c Fix T96032: add null check to constraint operators
The constraint operators for delete, apply, copy and copy to selected
were missing null checks and could crash blender when called wrongly
from the python api.

Differential Revision: http://developer.blender.org/D14195
2022-02-28 18:26:58 +01:00
245722866d Cleanup: Rename geometry set "curve" functions to "curves"
Ref T95355
2022-02-28 10:53:30 -05:00
9ec12c26f1 Geometry Nodes: Begin conversion to new curves
This commit changes `CurveComponent` to store the new curve
type by adding conversions to and from `CurveEval` in most nodes.
This will temporarily make performance of curves in geometry nodes
much worse, but as functionality is implemented for the new type
and it is used in more places, performance will become better than
before.

We still use `CurveEval` for drawing curves, because the new `Curves`
data-block has no evaluated points yet. So the `Curve` ID is still
generated for rendering in the same way as before. It's also still
needed for drawing curve object edit mode overlays.

The old curve component isn't removed yet, because it is still used
to implement the conversions to and from `CurveEval`.

A few more attributes are added to make this possible:
- `nurbs_weight`: The weight for each control point on NURBS curves.
- `nurbs_order`: The order of the NURBS curve
- `knots_mode`: Necessary for conversion, not defined yet.
- `handle_type_{left/right}`: An 8 bit integer attribute.

Differential Revision: https://developer.blender.org/D14145
2022-02-28 10:46:34 -05:00
37d2c774c1 Fix T96073: Don't remove links when inserting reroute nodes
This was an oversight in rB06ac5992618a75c453e495e06af7c5faf30499a7.
2022-02-28 16:42:15 +01:00
81bb86c750 Cleanup: Remove duplicated comment
Something went wrong here in 61776befc3.
2022-02-28 16:33:34 +01:00
579f42ae52 Cleanup: Move mesh_validate.c to C++
This patch was tested on the build bots on all platforms.
2022-02-28 10:08:26 -05:00
f5159e078e Merge branch 'blender-v3.1-release' 2022-02-28 15:03:17 +01:00
413e87b6b7 Fix T96048: Crash on appending with driver variables loop in shapekeys.
The usual 'shape keys snowflake' nightmare again...
2022-02-28 15:02:17 +01:00
db3f5ae48a Fix T95506: Separate strings for "Back" (operator).
Add a new `EDITOR_VIEW3D` context to those view orientations.
2022-02-28 14:37:07 +01:00
1e848281f9 18n: Add new EDITOR_VIEW3D translation context. 2022-02-28 14:37:07 +01:00
8e940f31fd WM: Allow drop-box polls to use context from UI
The UI context was only set for the operator polls, but not for the
drop-box polls. Initially I thought this wouldn't be needed since the
drop-boxes should leave up context polls to the operator, but in
practice that may not be what API users expect. Plus the tooltip for the
drop-boxes will likely have to access context anyway, so they should be
able to check it beforehand.
2022-02-28 13:14:46 +01:00
Colin Marmont
1558b270e9 Animation: Sensible frame range for motion paths
Motion paths can now be initialised to more sensible frame ranges,
rather than simply 1-250:

- Scene Frame Range
- Selected Keyframes
- All Keyframes

The Motion Paths operators are now also added to the Object context menu
and the Dopesheet context menu.

The scene range operator was removed, because the operators now
automatically find the range when baking the motion paths.

The clear operator now appears separated in "Selected Only" and "All",
because it was not clear for the user what the button was doing.

Reviewed By: sybren, looch

Maniphest Tasks: T93047

Differential Revision: https://developer.blender.org/D13687
2022-02-28 12:28:19 +01:00
6f23401e98 Merge branch 'blender-v3.1-release' 2022-02-28 10:57:12 +01:00
6bbf63f251 Fix T96054: Switching vertex group does not update display
Caused by 0f89bcdbeb and was not fully addressed by 6f9828289f:
tagging an ID with flag 0 is to be seen as an explicit tag for copy
on write.

Would be nice to either consolidate code paths of flag 0 and explicit
component tag, or get rid of tagging with 0 flag, but that is above of
what we can do for the upcoming release.
2022-02-28 10:54:07 +01:00
307d612404 Fix compilation warning. 2022-02-28 09:45:52 +01:00
cb736d2f03 Fix T95298: Multiview images not displaying correctly.
Image users have a multi_index that wasn't updated in case it is a normal
image.
2022-02-28 09:23:45 +01:00
540fd10b4f Fix T95992: Crash Ancored strokes 2d texture painting.
When using ancored stroked the diameter of the stroke can be 0 what
leads to a division by zero that on certain platforms wrap to a large
negative number that cannot be looked up. This fix will clamp the size
of the brush to 1.
2022-02-28 09:03:47 +01:00
2a644deaa7 Fix T95981: Remove implicit conversion in texture paint shader.
This fixes a crash on selected platforms.
2022-02-28 08:40:59 +01:00
db4313610c Event System: drag events now use modifier state on drag start
Now drag & tweak can have modifier keys to be released while dragging.
without this, modifier keys needs to be held which is more noticeable
for tablet input or whenever the drag threshold is set to a large value.

Resolves T89989.
2022-02-28 15:31:01 +11:00
63891f9dad Fix: Crash in Duplicate Element
Return early if a curve has a domain size of 0.
T96060
2022-02-27 15:16:45 -06:00
4f2f3114b7 Fix: Incorrect assert in curves code
The attribute data might be null if the number of curves is zero.
While that is not common, an empty curves data-block is valid.
2022-02-26 17:33:45 -05:00
ee160630c6 Merge branch 'blender-v3.1-release' 2022-02-26 17:57:37 -03:00
4ee4b61dd8 Ghost/Event System: Support mapping more keys
This fixes T93051, T76405 and maybe others.

Characters like '²', '<' are not recognized in Blender's shortcut keys.
And sometimes simple buttons like {key .} and {key /} on the Windows
keyboard, although the symbol is "known", Blender also doesn't
detect for shortcuts.

For Windows, some of the symbols represented by `VK_OEM_[1-8]` values,
depending on the language, are not mapped by Blender.

On Mac there is a fallback reading the "actual character value of the
'remappable' keys". But sometimes the character is not mapped either.

On Windows, the solution now mimics the Mac and tries to read the button's
character as a fallback.

For unmapped characters ('²', '<', '\''), now another value is chosen as a
substitute.

More "substitutes" may be added over time.

Differential Revision: https://developer.blender.org/D14149
2022-02-26 17:56:17 -03:00
576853661c UI: Use title case for labels 2022-02-25 23:34:08 -05:00
d6b3723b08 Cleanup: typos in comments. 2022-02-26 02:15:22 +01:00
ac3f4db719 Cleanup: Mesh normal calculation comments and logic
Some logic and comments in the vertex normal calculation were
left over from when normals were stored in MVert, before
cfa53e0fbe. Normals are never allocated and freed
locally anymore.
2022-02-25 17:47:42 -05:00
1598ab9639 Merge branch 'blender-v3.1-release' 2022-02-25 17:23:14 -05:00
7aa0be4b32 Fix: Failing OBJ export tests due to mesh normals commit
In some cases, the normal edit modifier calculated the normals on one
mesh with the "ensure" functions, then copied the mesh and retrieved
the layers "for write" on the copy. Since 59343ee162, normal
layers are never copied, and normals are allocated with malloc instead
of calloc, so the mutable memory was uninitialized.

Fix by calculating normals on the correct mesh, and also add a warning
to the "for write" functions in the header.
2022-02-25 17:18:07 -05:00
a911f075d7 Fix T93123: viewport lags with custom attributes
The check to see if newly requested attributes are not already in the
cache was not taking into account the possibility that we do not have
new requested attributes (`num_requests == 0`). In this case, if
`attr_used` already had attributes, but `attr_requested` is empty, we
would consider the cache as dirty, and needlessly rebuild the attribute
VBOs.
2022-02-25 22:04:10 +01:00
72a286760f Fix compile warning from earlier commit. 2022-02-25 22:01:17 +01:00
bdf4e1596d Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-25 21:36:09 +01:00
c8b4e0c0b5 Disable GPU subdivision if autosmooth or split normals are used
These features are complicated to support on GPU and hardly compatible
with subdivision in the first place. In the future, with T68891 and
T68893, subdivision and custom smooth shading will be separate workflows.
For now, and to better prepare for this future (although long term
plan), we should discourage workflows mixing subdivision and custom
smooth normals, and as such, this disables GPU subdivision when
autosmoothing or custom split normals are used.

This also adds a message in the modifier's UI to indicate that GPU
subdivision will be disabled if autosmooth or custom split normals are
used on the mesh.

Differential Revision: https://developer.blender.org/D14194
2022-02-25 21:28:13 +01:00
118a219e9d Fix different shading between CPU and GPU subdivision
Reuse the same vertex normals calculation as for the GPU code, by
weighing each vertex normals by the angle of the edges incident to the
vertex on the face.

Additionally, remove limit normals, as the CPU code does not use them
either, and would also cause different shading issues when limit surface
is used.

Fixes T95242: shade smooth artifacts with edge crease and limit surface
Fixes T94919: subdivision, different shading between CPU and GPU
2022-02-25 21:25:13 +01:00
4896e72a4d Fix T95977: Point Info node radius wrong under rotation 2022-02-25 20:51:22 +01:00
1a8db5b717 Fix: Only possible to create one 8 bit integer attribute
The custom data code checks for `LayerTypeInfo.defaultname` before
adding a second layer with a certain type. This was missed in
e7912dfa19. In practice, this default name
is not actually used.
2022-02-25 10:35:14 -05:00
0a6a74bac4 Fix T94396: USD errors opening saved scenes.
Added call to ensure that the USD plugins are registered
when opening a USD cache archive. This is to avoid USD
load errors due to missing USD file format plugins when
opening blender files that contain USD transform cache
constraints and mesh sequence cache modifilers.

Fixes T94396
2022-02-25 09:27:10 -05:00
06f5f29d17 Merge branch 'blender-v3.1-release' 2022-02-25 15:11:01 +01:00
e84b42bfcf Fix (unreported) Outliner 'liboverride create hierarchy' applied on several IDs.
This operation can only be applied on one ID at a time, so only apply it
to the active Outliner item, and not all the selected ones.

Also renamed `Make Library Override` menu entry to `Make Library Override
Single` to emphasis this is not the 'default expected' option for the
user.
2022-02-25 15:06:43 +01:00
6e11cfc56a Curves: add surface object pointer
Ref T95776.

Differential Revision: https://developer.blender.org/D14182
2022-02-25 13:22:42 +01:00
1a853a9e90 LibOverrides: fix handling of hierarchy root in complex cases.
This affects essentially the Outliner 'create hierarchy' tool currenlty.
Previously code did not handle properly hierarchy root in case overrides
where created from a non-root ID (e.g. an object inside of a linked
collection), and in case additional partial overrides were added to an
existing partially overrided hierarchy.

Also did some renaming on the go to avoid using 'reference' in override
context for anything else but the reference linked IDs.
2022-02-25 12:18:48 +01:00
5db32ab5fc Merge branch 'blender-v3.1-release' 2022-02-25 21:51:37 +11:00
0bac962fe5 CMake: exclude add-ons that don't confirm to key requirements
These add-ons don't have documentation on blender.org, see: T95442

These can be re-enabled once documentation has been relocated.
2022-02-25 21:50:00 +11:00
8ddeb71a55 Merge branch 'blender-v3.1-release' 2022-02-25 11:40:19 +01:00
66328db703 Fix T95636: Dragging Material from Asset Browser (Link mode) to Viewport empty space removes this material from all objects
Trust user count to actually delete or not the dragged ID when current
dragging is cancelled, since it may be already used by others.

NOTE: This is more a band-aid fix than anything else, cancelling drag
has a lot of other issues here (like never deleting any indirectly
linked/appended data, etc.). It needs a proper rethink in general.
2022-02-25 11:37:55 +01:00
4c9846eeae Cleanup: Modify comment 2022-02-25 11:24:45 +01:00
8f1ee85ff4 Merge branch 'blender-v3.1-release' 2022-02-25 11:22:17 +01:00
5186a28dec GPencil: Make Fill Dilate expand outside stroke
To keep consistency with the new contract option, the dilate now expand the shape beyond the internal closed area.

Note: This was committed only in master (3.2) by error.
2022-02-25 11:15:56 +01:00
5fd792c1f6 GPencil: Fill Dilate using negative values contract the fill area
This is requested by artist for some animation styles where is necessary to fill the area, but create a gap between fill and stroke.

Also some code cleanup and fix a bug in dilate for top area.

Reviewed By: pepeland, mendio

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

Note: This was committed only in master (3.2) by error.
2022-02-25 11:15:42 +01:00
ad0b3abf53 Cleanup: use flags for wmEvent modifier keys
Using flags makes checking multiple modifiers at once more convenient
and avoids macros/functions such as IS_EVENT_MOD & WM_event_modifier_flag
which have been removed. It also simplifies checking if modifier keys
have changed.
2022-02-25 17:58:22 +11:00
60af7a3496 Fix T95984: Use consistent shifting for persp and ortho cam.
Now always properly shifting camera for ortho and perspective.
2022-02-25 14:07:39 +08:00
e7cae51877 Fix T95984: Use consistent shifting for persp and ortho cam.
Now always properly shifting camera for ortho and perspective.
2022-02-25 13:57:27 +08:00
7d7dd66ba7 GPUTexture: Add support for texture view
This is an OpenGL 4.3 feature that enables creating a texture using a range
of the same data as another texture.
2022-02-24 22:51:19 +01:00
e59f754c16 GPUTexture: Use immutable storage
This means textures need to have the number of mipmap levels specified
upfront. It does not mean the data is immutable.

There is fallback code for OpenGL < 4.2.

Immutable storage will enables texture views in the future.
2022-02-24 22:51:19 +01:00
c23ee6d7b4 Cleanup: Simplify operating on multiple geometry components 2022-02-24 14:02:32 -05:00
5ccbbaed08 Cleanup: Sort include lines 2022-02-24 19:44:07 +01:00
3b3e519edd Nodes: Add include to avoid Windows compiler error
This line was added as request of @HooglyBoogly
2022-02-24 19:43:14 +01:00
9de720f31a Merge branch 'blender-v3.1-release' 2022-02-24 19:40:42 +01:00
8fb7c50aab Fix compiler error in Windows
In some compilers this file fails because the function `BKE_mesh_poly_normals_ensure`is not defined.
2022-02-24 19:38:16 +01:00
0781c22cee Fix T95969, T91856: bake AO to vertex color artifacts after ray offset removal
Without ray offsets intersections at neigbhoring triangles are found, as
the ray start is exactly at the vertex. There was a small offset towards
the center of the triangle, but not enough.

Now this offset computation is moved into Cycles and modified for better
results. It's still not perfect though like any offset approach, especially
with long thin triangles.

Additionaly, this uses the shadow terminate offset for AO rays now, which
helps remove some pre-existing artifacts.
2022-02-24 19:35:36 +01:00
6e396e21e6 Cleanup: remove unused ray offset function 2022-02-24 19:35:36 +01:00
4c66bd5da2 Curves: Use simpler "set" behavior for postion attribute
This is similar to f8fe0e831e, which made the change to the
handle position attributes. This commit removes the way that setting the
`position` attribute also changes the handle position attributes. Now,
the "Set Position" node still has this behavior, but changing the
attribute directly (with the modifier's output attributes) does not.

The previous behavior was a relic of the geometry nodes design
from before fields and the set position node existed.

This makes the transition to the new curves data structure simpler.
There is more room for optimizing the Bezier case of the set position
node in the future.
2022-02-24 12:22:26 -05:00
f4d80ecdfd Cleanup: Typo in comment 2022-02-24 12:01:22 -05:00
cc966c548d Merge branch 'blender-v3.1-release' 2022-02-24 11:57:53 -05:00
7b37d980b9 Fix: Crash switching between sculpt and edit mode
Also fix a couple other places where normals layers weren't properly
tagged dirty or reallocated when the mesh changes.

Caused by cfa53e0fbe. When the size of a mesh changes,
the normal layers need to be reallocated. There were a couple of places
that cleared other runtime data with `BKE_mesh_runtime_clear_geometry`
but didn't deal with normals properly. Clearing the runtime "geometry"
is different from clearing the normals, because sometimes the size of
the normal layers doesn't have to change, in which case simply tagging
them dirty is fine.
2022-02-24 11:56:32 -05:00
7c1b0dec00 Merge branch 'blender-v3.1-release' 2022-02-24 17:43:24 +01:00
f8507ca372 EEVEE: Fix crash when shadow caster count is reduced to 0.
The crash was catched by ASAN. It was caused by the buffer shrinking logic
being faulty.
2022-02-24 17:43:04 +01:00
17301a3163 Fix incorrect Outliner tree-display type returned
Reverts 6d97fdc37e. A function like this should not return a different
tree-display object than of the requested type. This may hide errors,
and leaves the Outliner in an undefined state (where the stored display
mode doesn't match the tree-display object). I rather don't hide the
fact that all display-modes should be handled here, and emit a clear
error if one isn't.
2022-02-24 17:10:19 +01:00
fc8aab755a Fix T96015: Calling wrong operator resulting in python error
Own mistake in rB86fc63c4ca9d36eae7512c5c3e640285d84415d1.
Forgot to change the call from `wm.url_open` to `wm.url_open_preset`.
2022-02-24 11:10:00 -05:00
8d83fc552a GPU: Fix compilation in debug mode
Fixes issue introduced in rB1685b1dba44e02ce1faace4a5de6d6cd0d98ef90
2022-02-24 15:55:22 +01:00
1685b1dba4 OCIO: Fix mip length in texture creation
Also add an assert to avoid reproducing the error in the future.
2022-02-24 15:48:54 +01:00
9be720d85e BLI: support accessing nth last element in Array/Span/Vector
This often helps to make the intend of code more clear compared
to computing the index manually in the caller.
2022-02-24 14:50:13 +01:00
7cab7eb3d6 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-24 14:34:15 +01:00
b7a954218b Fix T95976: on cage GPU subdivision breaks X-ray selection
When X-ray mode is active the selection is done using the mesh data to
select what is closest to the cursor. When GPU subdivision is active with
the "show on cage" modifier option, this fails as the mesh used for selection
is the unsubdivided one.

This creates a subdivision wrapper before running the selection routines to
ensure that subdivision is available on the CPU side as well.

Differential Revision: https://developer.blender.org/D14188
2022-02-24 14:33:48 +01:00
189c5bd9af Merge branch 'blender-v3.1-release' 2022-02-24 12:45:27 +01:00
17e0634902 Fix T95985: crash when assigning a name for an output attribute
This was a double free error which happened because `BM_mesh_bm_from_me`
was taking ownership of arrays that were still owned by the Mesh. Note that
this only happens when the mesh is empty but some custom data layers still
have a non-null data pointer. While usually the data pointer should be null in
this case for performance reasons, other functions should still be able to
handle this situation.

Differential Revision: https://developer.blender.org/D14181
2022-02-24 12:44:02 +01:00
d48e595c78 Fix wrong asset library displayed/loaded in asset view templates
Sometimes when switching asset libraries in the asset view templates
(like the pose library sidebar UI), the wrong library would end up being
shown.
2022-02-24 12:40:40 +01:00
b0eed6fb9a Merge branch 'blender-v3.1-release' 2022-02-24 18:01:53 +11:00
41d607976c Keymap: use 90 degree roll for NDOF roll shortcuts
3Dconnexion documentation states these buttons should roll 90 degrees.
2022-02-24 18:00:18 +11:00
13efaa8a09 3D View: keep the orthographic view when rolling 90 degrees
Support for maintaining orthographic view for view3d.view_roll for an
angle of 90/-90 degrees.
2022-02-24 18:00:17 +11:00
87c2b1988d Keymap: correct NDOF button roll assignment
NDOF ROLL CCW was used for both left & right roll.
2022-02-24 18:00:17 +11:00
e767a2d98b Keymap: correct NDOF button roll assignment
NDOF ROLL CCW was used for both left & right roll.
2022-02-24 17:51:19 +11:00
81df323df4 Tests: disable file output for bl_keymap_validate.py
Left on by accident but should only be used when debugging output.
2022-02-24 17:43:36 +11:00
fe4b53311a Merge branch 'blender-v3.1-release' 2022-02-24 15:25:38 +11:00
f80f7afbf0 Fix 2D view NDOF panning requiring both axes to be non-zero
Possible fix for T86592.
2022-02-24 15:24:09 +11:00
1a6b35157c Cleanup: code comments in vfont_to_curve 2022-02-24 13:20:33 +11:00
b45a3e8747 Cleanup: remove dead code in vfont_to_curve
Also replaces numbers with character literals for tab/space.
2022-02-24 13:14:33 +11:00
24450fa142 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-24 03:01:44 +01:00
d59f45fb15 Cleanup: remove dead code from text wrapping logic
Error from original commit in 2005,
97df61a7e5.
2022-02-24 12:53:11 +11:00
e83e7d49b6 Cleanup: use continue instead of goto for 3D text wrapping logic 2022-02-24 12:53:09 +11:00
ba274d20b4 Fix T95959: crash when exporting subdivision to Alembic
When exporting generated coordinates, the subdivision export code was
using the schema for the non-subdivision case, which is invalid as
non-initialized. This typo existed since the initial commit for the
feature (rBf9567f6c63e75feaf701fa7b78669b9a436f13dd).
2022-02-24 02:46:33 +01:00
affed12bb9 Merge branch 'blender-v3.1-release' 2022-02-24 12:19:17 +11:00
c9582b2752 Fix T95116: Scale to fit fails with a single word & non-zero Y-size
The scale-to-fit option did nothing for single words when
the text box had a height. This happened because it was expected that
text would be wrapped however single words never wrap.

Now the same behavior for zero-height text boxes is used when text
can't be wrapped onto multiple lines.
2022-02-24 12:18:39 +11:00
f8fe0e831e Curves: Use simpler "set" behavior for handle position attributes
The handle position attributes `handle_left` and `handle_right` had
rather complex behavior to get expected behavior when aligned or auto/
vector handles were used. In order to simplify the attribtue API and
make the transition to the new curves data structure simpler, this
commit moves that behavior from the attribute to the "Set Handle
Positions" node. When that node is used, the behavior should be the
same as before. However, if the modifier's output attributes were used
to set handle positions, the behavior may be different. That situation
is expected to be very rare though.
2022-02-23 15:44:55 -05:00
756f7fb23e Geometry Nodes: Face is Planar Node
This adds a node with a boolean field output which returns true if all of the
points of the evaluated face are on the same plane. A float field input allows
for the threshold of the face/point comparison to be adjusted on a per face basis.

One clear use case is to only triangulate faces that are not planar.

Differential Revision: https://developer.blender.org/D13906
2022-02-23 14:19:54 -06:00
86fc63c4ca Cleanup: Simplify manual url version handling
Recently we changed the build pipeline to always create a version
number in the url and point 'dev' to the latest version rather than creating the version number url once we release.

This makes the check to `bpy.app.version_cycle` unnecessary.
2022-02-23 15:00:16 -05:00
6ca85a8cf1 Fix: Build issue on windows
tbb/enumerable_thread_specific.h drags in windows.h
which will define min/max macro's unless you politely
ask it not to.

it's bit of an eyesore, but it is what it is
2022-02-23 12:27:02 -07:00
88712453f6 Fix error with SPDX-License-Identifier 2022-02-23 14:16:46 -05:00
572acba5d1 Merge branch 'blender-v3.1-release' 2022-02-23 14:12:48 -05:00
80be63e2a5 Update RNA to user manual mapping file 2022-02-23 14:10:52 -05:00
b93d4faba8 Fix for last commit: Define for Node numbering 2022-02-23 13:04:46 -06:00
81e89a444e Merge branch 'blender-v3.1-release' 2022-02-23 14:01:20 -05:00
99a6392fb5 Fix OSL trace() not being fully updated for ray offsetting removal
This was the last place still using the ray_offset() function.
2022-02-23 20:01:03 +01:00
dbef66c32f Fix T95952: Uninitialized value used in Bezier Segment node
0fd72a98ac called functions to set bezier handle positions
that used uninitialized memory. The fix is to define the handle positions
explicitly, like before.
2022-02-23 13:57:04 -05:00
7518adc5bb Fix: Attempt to fix build error on windows
`index_mask.cc` ends up including this header, but not much else,
the `<algorithm>` include is necessary on Windows for `std::max`.
2022-02-23 13:02:06 -05:00
226f0c4fef Curves: initial brush implementations for curves sculpt mode
The main goal here is to add the boilerplate code to make it possible
to add the actual sculpt tools more easily. Both brush implementations
added by this patch are meant to be prototypes which will be removed
or refined in the coming weeks.

Ref T95773.

Differential Revision: https://developer.blender.org/D14180
2022-02-23 16:56:27 +01:00
120f16fa1f Geometry Nodes: Duplicate Elements Node
This adds a node which copies part of a geometry a dynamic number
of times.

Different parts of the geometry can be copied differing amounts
of times, controlled by the amount input field. Geometry can also
be ignored by use of the selection input.

The output geometry contains only the copies created by the node.
if the amount input is set to zero, the output geometry will be
empty. The duplicate index output is an integer index with the copy
number of each duplicate.

Differential Revision: https://developer.blender.org/D13701
2022-02-23 09:08:16 -06:00
e32b676baf Merge branch 'blender-v3.1-release' 2022-02-23 09:58:41 -05:00
398538b914 Fix T95987: Data transfer modifier custom normals crash
59343ee162 missed one case of normals being
retrieved from polygon custom data instead of the normals API.
The fix is simple.
2022-02-23 09:49:25 -05:00
1361c6e604 Curves: Add methods to retrieve range for points or curves 2022-02-23 08:54:35 -05:00
b9ce036d6b Merge branch 'blender-v3.1-release' 2022-02-23 14:33:53 +01:00
867e50b886 Fix T95183: Cage gizmo axis unreliable
`orient_matrix` was not initialized.

Reviewed By: lichtwerk

Differential Revision: https://developer.blender.org/D14167
2022-02-23 14:25:00 +01:00
391c3848b1 NDOF: make camera view/pan behavior optional
User request since adding this option in:
51975b89ed

When disabled, use the previous behavior when orbiting a camera view.
2022-02-23 21:25:46 +11:00
3429444905 BLI: add index mask utilities
Sometimes it is useful to get the index ranges that are in an index mask.
That is because some algorithms can process index ranges more efficiently
than generic index masks.

Extracting ranges from an index mask is relatively efficient, because it is
cheap to check if a span of indices contains a contiguous range.
2022-02-23 11:14:07 +01:00
66c0fe5b23 Cleanup: correction to repeated word removal & correct spelling 2022-02-23 20:47:14 +11:00
7393cc1db7 Cleanup: Remove repeated word in comments 2022-02-23 18:24:37 +11:00
Alaska
165b030b19 Cleanup: Remove repeated word in comment
Differential Revision: https://developer.blender.org/D14178
2022-02-23 11:07:04 +05:30
3c0fd287cb Merge branch 'blender-v3.1-release' 2022-02-23 16:29:51 +11:00
74611e3555 Fix T93331: Gizmo tool options reset when switching tools
Drag Action was constantly resetting itself to "move".

Solve this by storing the tool settings per tool and no longer clear
gizmo properties when activating a new tool.
2022-02-23 16:27:26 +11:00
06bc20f61a Fix: Errors in previous cleanup commit
f3ef0763b4 introduced a file by mistake, and didn't add
a new enum type to many switch cases. Sorry for the noise.
2022-02-22 22:15:03 -05:00
f3ef0763b4 Cleanup: Use new curves type enum for CurveEval
Though this is less aesthetically pleasing, it makes the transition to the
new curves type (T95941) a bit simpler, and it has to be done anyway.
2022-02-22 21:52:48 -05:00
c6df7266c7 CMake: move cmake_consistency_check.py into source/tools/ repo
This isn't needed for building Blender so move this along side
other source checking scripts.
2022-02-23 12:31:46 +11:00
e1c33698e6 GNUmakefile: prefer "check_" prefix instead of "test_"
- Reserve "test" for tests & testing frameworks.
- Add "check_mypy" to "make help" text.
- Output to the standard output instead of redirecting to log-files,
  leave redirecting output log-files to the user running the command.
2022-02-23 12:31:46 +11:00
4c423ccbd6 CMake: include missing files
Also use SRC_ prefix for source variables so cmake_consistency_check.py
detects these files as being known to CMake.
2022-02-23 12:31:46 +11:00
4addc1f31e Tests: temporarily add back tests/check_deprecated.py
The build-bot directly referenced this file and doesn't
have publically available configuration.

Add an empty file until this can be removed by the build scripts.
2022-02-23 12:30:54 +11:00
5b4732f81c Cleanup: Use new enum for CurveEval handle types
This will make the transition to the new curves data structure
a bit simple, since the handle types can be copied directly between
the two. The change to CurveEval is simple because it is runtime-only.
2022-02-22 17:37:58 -05:00
0b9cc6725c XR: Use #ifdef for Vive Focus 3 extension
Helps with building against different OpenXR SDK versions (i.e. for
downstream builds that require specific versions), as the extension was
only defined since OpenXR 1.0.22.
2022-02-23 06:56:08 +09:00
d228f05814 Merge branch 'blender-v3.1-release' 2022-02-22 14:40:20 -05:00
2746238dde Python API Docs: Hide version swtich
This still needs some fixes to be ready for release.
2022-02-22 14:39:51 -05:00
529f891878 GPencil: Make Fill Dilate expand outside stroke
To keep consistency with the new contract option, the dilate now expand the shape beyond the internal closed area.
2022-02-22 20:03:34 +01:00
ad3ee84f4e Cleanup: Remove unused mesh dirty flags
These were only set in two places. One was related to "tessellated loop
normal", and the other derived corner normals. The values were never
checked though, after 59343ee162. The handling of dirty face
corner normals is clearly problematic, but in the future it should be
handled like the normal layers on the other domains instead.

Ref D14154, T95839
2022-02-22 13:13:13 -05:00
c7a9f76149 Merge branch 'blender-v3.1-release' 2022-02-22 12:47:05 -05:00
59343ee162 Fix T95839: Data race when lazily creating mesh normal layers
Currently, when normals are calculated for a const mesh, a custom data
layer might be added if it doesn't already exist. Adding a custom data
layer to a mesh is not thread-safe, so this can be a problem in some
situations.

This commit moves derived mesh normals for polygons and
vertices out of `CustomData` to `Mesh_Runtime`. Most of the
hard work for this was already done by rBcfa53e0fbeed7178.
Some changes to logic elsewhere are necessary/helpful:
- No need to call both `BKE_mesh_runtime_clear_cache` and
  `BKE_mesh_normals_tag_dirty`, since the former also does the latter.
- Cleanup/simplify mesh conversion and copying since normals are
  handled with other runtime data.

Storing these normals like other runtime data clarifies their status
as derived data, meaning custom data moves more towards storing
original/editable data. This means normals won't automatically benefit
from the planned copy-on-write refactor (T95845), so it will have to be
added manually like for the other runtime data.

Differential Revision: https://developer.blender.org/D14154
2022-02-22 12:44:15 -05:00
f3d97498c3 Merge branch 'blender-v3.1-release' 2022-02-22 18:03:27 +01:00
ee9949a85f Fix (unreported) LibOverride: missing copying flag member. 2022-02-22 18:01:52 +01:00
29696fb725 UI: ActionZone Swap Areas Between Windows
Allow SCREEN_OT_area_swap to operate between different Blender
windows, and other minor feedback improvements.

See D14135 for more details and demonstrations.

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

Reviewed by Campbell Barton
2022-02-22 08:58:42 -08:00
8ae77efe4e Merge branch 'blender-v3.1-release' 2022-02-22 17:34:07 +01:00
283a4cd40e Fix ffmpeg tests when using ffmpeg 5.0 2022-02-22 17:30:52 +01:00
2f951667c0 OCIO: Fix bool1 vs. bool comparison warning.
Fixes the following warning:
`'!=': unsafe mix of type 'bool1' and type 'bool' in operation`
2022-02-22 17:29:32 +01:00
353fe610ed Fix: Clear mesh runtime cache when adding elements
Currently the RNA functions to add mesh elements like vertices
don't clear the runtime cache of things like triangulation, BVH
trees, etc. This is important, since they might be accessed with
incorrect sizes. This is split from a fix for T95839.
2022-02-22 11:14:50 -05:00
8073c95fe9 Cleanup: Deduplicate logic in RNA_property_editable & co.
Fairly straight-forward, now all the logic for all those 'is editable'
complex checks is gathered into a single util function.
2022-02-22 16:38:04 +01:00
51c7193405 Cycles: Removed numaapi from standalone 2022-02-22 16:34:52 +01:00
b861d3e4c1 Merge branch 'blender-v3.1-release' 2022-02-22 16:08:38 +01:00
ca991e3012 Fix compilation error on certain platforms
Atomic operations performed by the C++ standard library might require
libatomic on platforms which do not have hardware support for those
operations.

This change makes it that such configurations are automatically detected
and -latomic is added when needed.

Differential Revision: https://developer.blender.org/D14106
2022-02-22 15:47:43 +01:00
37fb69e020 Fix (unreported) RNA_property_editable_index.
NOTE: This function is currently unused. However, it does use a callback
defined by a few RNA properties through
`RNA_def_property_editable_array_func`, so don't think it should be
removed without further thinking.

This function had two main issues:
* It was doing bitwise AND on potentially three sources of property
  flag, when actually used `RNA_property_editable` just use one source
  ever.
* It was completely ignoring liboverride cases.

TODO: Deduplicate code between `RNA_property_editable`,
`RNA_property_editable_info` and `RNA_property_editable_index`.
2022-02-22 15:33:52 +01:00
f449b89688 Cleanup: Make RNA_property_editable logic clearer.
Split code in smaller bits with early returns, instead of a giant single
set of checks.

No behavioral change expected here.
2022-02-22 15:18:08 +01:00
472ddc6e27 Merge branch 'blender-v3.1-release' 2022-02-22 15:13:27 +01:00
1d4037645f Cleanup: quiet warnings for FFMPEG before 5.0
Even though 5.0 has been released newer distributions wont include it,
so quiet warnings.
2022-02-22 15:11:35 +01:00
9d8af55eb8 GNUmakefile: missed removing docs for test_deprecated when renaming 2022-02-23 00:05:34 +11:00
66f3545a0b Cleanup: compiler warning 2022-02-22 14:03:11 +01:00
85b39b6be0 Fix subdivision surface modifier doing unnnecessary work
There was accidentally some displacement related code running even when not
using displacement.

Differential Revision: https://developer.blender.org/D14169
2022-02-22 14:03:11 +01:00
6bb4c0e498 GNUmakefile: rename test_depracted to check_deprecated
Also move this utility into the source/tools repo.
2022-02-23 00:00:32 +11:00
4a7559bbcb Cleanup: quiet warnings for FFMPEG before 5.0
Even though 5.0 has been released newer distributions wont include it,
so quiet warnings.
2022-02-23 00:00:32 +11:00
64293a277f Merge branch 'blender-v3.1-release' 2022-02-22 13:57:05 +01:00
4e78a7360e Fix T93784: text and curve objects have no motion blur
Previously, objects and geometries were mapped between frames
using different hash tables in a way that is incompatible with
geometry instances. That is because the geometry mapping happened
without looking at the `persistent_id` of instances, which is not possible
anymore. Now, there is just one mapping that identifies the same
object at multiple points in time.

There are also two new caches for duplicated vbos and textures used for
motion blur. This data has to be duplicated, otherwise it would be freed
when another time step is evaluated. This caching existed before, but is
now a bit more explicit and works for geometry instances as well.

Differential Revision: https://developer.blender.org/D13497
2022-02-22 13:52:15 +01:00
0b4c56b010 Cleanup: Replace eTexPaintMode with classes.
For an upcoming prototype we would introduced a new eTexPaintMode
option. That would add more cases and if statements. This change migrate
the eTexPaintMode to 3 classes. AbstractPaintMode contains a shared interface.
ImagePaintMode for 2d painting and ProjectionPaintMode for 3d painting.
2022-02-22 13:42:44 +01:00
683a77256d Fix compilation issue under windows. 2022-02-22 10:30:02 +01:00
4ba894cbb8 Fix compilation error on certain platforms.
Seems this isn't an issue on newer compilers.
2022-02-22 10:00:03 +01:00
1d4ed6ba29 Convert paint_image to cc. 2022-02-22 10:00:03 +01:00
1ec02b8695 Cleanup: Renamed PaintOperation.custom_paint to stroke_handle. 2022-02-22 10:00:03 +01:00
0cfcb261b1 Merge branch 'blender-v3.1-release' 2022-02-22 19:59:31 +11:00
0ad4d2694b Python: change behavior for CONSOLE_OT_indent_or_autocomplete
Checking only the previous character broke import auto-completion.
2022-02-22 19:57:36 +11:00
7657358447 Cleanup: use doxygen sections 2022-02-22 19:39:55 +11:00
27427f3447 Cleanup: Use switch-statement for eTexPaintMode. 2022-02-22 09:02:52 +01:00
2cd33955be Merge branch 'blender-v3.1-release' 2022-02-22 16:43:23 +11:00
c5b66560de Fix T93629: Reset to defaults undoes all steps when applied twice
Reset Defaults left the undo stack in an invalid state,
with the active undo step left at the previous state then it should
have been.

Now the buttons own undo logic is used to perform undo pushes.
2022-02-22 16:40:07 +11:00
2234bfbcdb GPencil: Simplify sample modifier improvements.
1. Now handles cyclic strokes correctly.

2.  Added a sharp threshold value to allow preservation of sharp corners.

Reviewed By: Antonio Vazquez (antoniov), Aleš Jelovčan (frogstomp)

Ref D14044
2022-02-22 12:54:35 +08:00
0f2e0a25e1 LineArt: Consistent backface culling behavior
1. Now will remove lines if both adjacent faces are back face.

2. Added a check to respect material back face culling setting.

3. Changed label in the modifier to "Force Backface Culling" (which reflect more accurately with what the checkbox does).

Reviewed By: Antonio Vazquez (antoniov), Aleš Jelovčan (frogstomp)

Ref D14041
2022-02-22 12:51:49 +08:00
2fefdaae93 Merge branch 'blender-v3.1-release' 2022-02-21 21:54:59 -03:00
75be58c63d Fix errors in 'gpu.state' documentation
`blend_depth_test_get` --> `depth_test_get`
`depth_mask_set_get` --> `depth_mask_get`

Thanks to @SBCV for pointing out these inconsistencies.
2022-02-21 21:48:17 -03:00
18d3d283ec Fix wrong method name in gpu documentation
`use_program_point_size` --> `program_point_size_set`.
2022-02-21 21:48:02 -03:00
Germano Cavalcante
c73bacc364 Camera: Simplify View Frame code
- No need for `normal_tx` array if we normalize the planes in `plane_tx`.
- No need to calculate the distance squared to a plane (with `dist_signed_squared_to_plane_v3`) if the plane is normalized. `plane_point_side_v3` gets the real distance, accurately, efficiently and also signed.

So normalize the planes of the member `CameraViewFrameData::plane_tx`.
2022-02-21 21:47:46 -03:00
459d9c1e3d Fix (unreported): Issues with 'SNAP_NOT_SELECTED' for pose and edit modes
This is a regression partially introduced in rB0a6f428be7f0.

Bones being transformed into edit mode were snapping to themselves.

And the bones of the pose mode weren't even snapping.

(Curious that this was not reported).
2022-02-21 21:47:24 -03:00
fcda858e32 Cleanup: remove Python 3.9 annotation workarounds 2022-02-22 10:28:01 +11:00
ca12696257 Merge branch 'blender-v3.1-release' 2022-02-22 10:18:15 +11:00
ec5bbebf3e Python: bump minimum version to 3.10
Since Python 3.10 is now supported on all platform,
bump the minimum version to reduce the number of Python versions that
need to be supported simultaneously.

Reviewed By: LazyDodo, sybren, mont29, brecht

Ref D13943
2022-02-22 10:16:25 +11:00
b13bf8556b Cleanup: clang-format 2022-02-22 10:08:38 +11:00
55a4ebc701 Merge branch 'blender-v3.1-release' 2022-02-22 10:08:24 +11:00
6ec57f9083 Merge branch 'blender-v3.1-release' 2022-02-22 10:08:20 +11:00
2a5df72d9b Revert "Cleanup: quiet const cast warning"
This reverts commit 626fb290eb.

This was an intentional change for FFMPEG v5.0,
removing the cast should be done in a version check instead.
2022-02-22 10:07:05 +11:00
bfdbc78466 Fix T44415: Shape keys get out of sync when using undo in edit-mode
This is an alternate fix for T35170 since it caused T44415.
Having the undo system manipulate the key-block coordinates is error
prone as (in the case of T44415) there are situations when it's
important to apply the difference with the original shape key.

This reverts dab0bd9de6, and instead
avoids the problem by not using the data in `Mesh.key` as a reference
for updating shape-keys when exiting edit-mode.

The assumption that the `Mesh.key` in edit-mode won't be modified
until leaving edit-mode isn't always true. Leading to synchronization
errors. (details noted in code-comments).

Resolve this by using shape-key data stored in the BMesh.

Resolving both T35170 & T44415.

Details:

- Remove use of the original vertices when exiting edit mode.
- Remove use of the original shape-key coordinates when exiting
  edit-mode (except as a last resort).
- Move shape-key synchronization into a separate function:
  `bm_to_mesh_key`.
- Split the synchronization loop into two branches,
  depending on the existence of BMesh shape-key coordinates.
- Always write shape-key values back to the BMesh CD_SHAPEKEY layers.
  This was only done in some cases but is now necessary for all
  shape-keys as these are used to calculate offsets where the `Mesh.key`
  was previously used.
- Report a warning when the shape-key layer isn't found as this uses an
  imperfect method of restoring coordinates which should only be used as
  a last resort.

Reviewed By: mont29

Ref D14127
2022-02-22 09:57:07 +11:00
c3d36b7127 Cleanup: clang-format 2022-02-22 09:56:43 +11:00
dde5cc6670 Cleanup: Use curves wrapper 2022-02-21 17:06:17 -05:00
24ddb4b1ad Merge branch 'blender-v3.1-release' 2022-02-21 14:04:38 -05:00
284cef473f Fix T95919: Apply Pose as Rest Pose Operator crashes
A simple mistake with a null mesh in rBcfa53e0fbeed.
2022-02-21 13:59:18 -05:00
48abcc91ae Merge branch 'blender-v3.1-release' 2022-02-21 19:51:50 +01:00
49ae0b5b3c Fix T95923: GPencil Array modifier constant offset works even disabled
The problem was when the Object Offset was enabled because the Constant Offset flag was not checked and the offset always was added to the transformation matrix.
2022-02-21 19:48:11 +01:00
9762dbe94e Merge branch 'blender-v3.1-release' 2022-02-21 13:07:14 -05:00
be6bcaa8c1 Fix T93873: Wrong limits for color socket exposed to modifier
Limit the min and max of the IDProperty for the node group input
from 0 to infinity, and the soft min and max between 0 and 1.

Thanks to @PratikPB2123 for investigation.
2022-02-21 13:01:37 -05:00
b7171d1b82 Cleanup: Use function to check if normals are dirty
This makes the fix for T95839 simpler.
Similar to 969c4a45ce.
2022-02-21 12:17:41 -05:00
a81cc5cbcb Fix: Avoid potential use of dirty normals
Instead of accessing the `CD_NORMAL` layer directly,
use the proper API for accessing mesh normals. Even if the
layer exists, the values might be incorrect due to a deformation.
Related to ef0e21f0ae, 969c4a45ce, and T95839.
2022-02-21 11:40:59 -05:00
869dd2e699 Fix T95154 Eevee AO node: the "only local" option applies "inside" instead
The `custom2` was not being used as a bitflag as it should.
2022-02-21 17:18:45 +01:00
68a2dc58de Weight Proximity: do flag split versioning both in 3.1 and 3.2
The flags overlapped ever since normalize was added, so this
requires versioning to copy the flag value. This needs to be
done both in Blender 3.1 and 3.2.

Differential Revision: https://developer.blender.org/D14165
2022-02-21 18:15:17 +03:00
1234a7ada0 Merge branch 'blender-v3.1-release' 2022-02-21 18:14:41 +03:00
82ff0fa586 Weight Proximity: fix value overlap between Normalize and Invert VGroup.
The flags overlapped ever since normalize was added, so this requires
versioning to copy the flag value.

Differential Revision: https://developer.blender.org/D14165
2022-02-21 18:08:53 +03:00
ed9f763034 Paint: pass operator to stroke update function
This allows accessing properties of the operator that the
stroke belongs to.
2022-02-21 16:07:59 +01:00
38ae311706 Weight Modifiers: use the correct flags for the mask invert property.
The code was using the same flag value for different modifiers,
resulting in matching the toggle to random overlapping flags.

Differential Revision: https://developer.blender.org/D14165
2022-02-21 18:07:08 +03:00
Henrik Dick
68586d2c18 Complex Solidify: improve constraints solver
The constraints solver is now able to handle more cases correctly.
Also the behavior of the boundary fixes is slightly changed if
the constraints thickness mode is used.

Differential Revision: https://developer.blender.org/D14143
2022-02-21 14:13:55 +01:00
fa715a158a Vertex Weight Mix: support Minimum and Maximum mix modes.
The modifier supports arithmetic operations, like Add or Multiply,
but for some reason omits Minimum and Maximum. They are similarly
simple and useful math functions and should be supported.

Differential Revision: https://developer.blender.org/D14164
2022-02-21 16:01:39 +03:00
0f242981ec Workbench: Fix missing world_data ubo during opaque prepass 2022-02-21 13:30:20 +01:00
5c11ca10c0 Merge branch 'blender-v3.1-release' 2022-02-21 23:15:50 +11:00
829812f180 Fix T92467: Path Selection broken when Drag is set to Tweak
When RMB-select uses "Select Tweak" as a fallback tool,
ignore all bindings mapped to the Control key as these are
used for path selection.

This was fixed in 2a2d873124
however that caused shift-select to fail (T93100).
2022-02-21 23:09:34 +11:00
d076e9468c Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-21 13:06:28 +01:00
132f9a2e31 Fix T95596: Crash in versioning of node animation
The node animation versioning code passes `nullptr` to the `oldName` and
`newName` parameters, but those weren't `NULL`-safe. I added an extra
check for this.

No functional changes, just a crash fix.
2022-02-21 13:02:23 +01:00
e2ffe88983 Curves: use paint cursor in curves sculpt mode
Also adds radius and strength control to the tool settings in the ui.
2022-02-21 12:49:36 +01:00
fcb84e32e0 Cleanup: use namespace and code sections 2022-02-21 12:01:30 +01:00
7f2beb79c6 Cleanup: move curves sculpt mode toggle operator to sculpt/paint module
This is necessary, because the operator will have to use functions that
are currently private within this module. E.g. `paint_cursor_start`.
2022-02-21 11:57:43 +01:00
141d5851d7 Paint: decouple op->customdata from PaintStroke
Previously, all operators using `PaintStroke` would have to store
the stroke in `op->customdata`. That made it impossible to store
other operator specific data in `op->customdata` that was unrelated
to the stroke.

This patch changes it so that the `PaintStroke` is passed to api
functions as a separate argument, which allows storing the stroke
as a subfield of some other struct in `op->customdata`.
2022-02-21 11:52:46 +01:00
5be74160c0 macOS/ blender_icons_update.py: prioritise environment variables
Also fix binary name for mac

Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D14161
2022-02-21 15:19:19 +05:30
bce810f057 Fix T95871: Non-float textures report as float.
Althought the float buffers are only used as cache, current code paths
don't look at the flags to identify which kind of image it is. Actual
fix would be to check flags, but that wouldn't be something to add one
week before release.

This commit fixes it by removing the buffers after use in the image
engine.
2022-02-21 07:48:49 +01:00
9189191c5b Fix errors in 'gpu.state' documentation
`blend_depth_test_get` --> `depth_test_get`
`depth_mask_set_get` --> `depth_mask_get`

Thanks to @SBCV for pointing out these inconsistencies.
2022-02-20 23:31:08 -03:00
813895f713 Cleanup: use strict type checking for bl_keymap_validate 2022-02-21 12:21:47 +11:00
167c4c6962 Tests: add duplicate key-map test, also test multiple configurations
Duplicate key-map items (while harmless in most cases) may cause
unexpected behavior or point to mistakes in the key-map,
so best avoid these.
2022-02-21 12:03:56 +11:00
16da9c944c Cleanup: remove duplicate key-map items 2022-02-21 12:01:32 +11:00
1884f6e729 BLI_array: add BLI_array_trim utility to re-allocate the current size
Use this in BKE_view_layer_array_* functions.
2022-02-21 12:01:32 +11:00
7b11c71729 RNA: modify debug mode logic for setting invalid unset values
The previous behavior called RNA_enum_item_add a second time,
filled it's contents with invalid values then subtracted totitem,
this caused an unusual reallocation pattern where MEM_recallocN
would run in order to create the dummy item, then again when adding
another itme (reallocating an array of the same size).

Simply memset the array to 0xff instead.
2022-02-21 12:01:32 +11:00
2554ef986a readfile: free & reallocate arrays in oldnewmap_clear
Even though the size of the map was set back to DEFAULT_SIZE_EXP,
the underlying arrays were left unchained. In some cases this caused
further expansions to result in an unusual reallocation pattern
where MEM_reallocN would run expand the entries into an array
that was in fact the same size.
2022-02-21 12:01:32 +11:00
e93a8c4f74 Cleanup: avoid reallocating arrays at the same size 2022-02-21 12:01:32 +11:00
626fb290eb Cleanup: quiet const cast warning 2022-02-21 12:01:32 +11:00
36d7adf85c Merge branch 'blender-v3.1-release' 2022-02-20 23:15:39 +01:00
1a0a22f95a Fix T95413: Blur node size input crash
Bug was introduced in D12167.

Reading input size from an input socket is not possible in tiled compositor before execution is initialized. A similar change was done for the base class, see BlurBaseOperation::init_data().

Reviewed by: Jeroen Bakker

Differential Revision: https://developer.blender.org/D14067
2022-02-20 23:00:44 +01:00
de886884c0 Fix T95470: LineArt GPU subdiv fix.
Use evaluated mesh instead of ob->data.

Reviewed by: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D14040
2022-02-20 19:40:44 +08:00
Aaron Carlisle
1f79132287 UI: Do not include the text stating an enum item is the default
This adds maintence overhead and it is not that useful when we have reset to default.

If this is something that we want it should be added dynamically.

Reviewed By: HooglyBoogly, Severin, #user_interface

Differential Revision: https://developer.blender.org/D14151
2022-02-19 21:31:53 -05:00
991781c8ea LineArt: GPU subdiv fix.
Use evaluated mesh instead of ob->data.

Reviewed by: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D14040
2022-02-19 22:35:22 +08:00
385d9488e6 Fix incorrect copying of XR action paths
After using MEM_dupallocN() on the original item/binding, the
user/component path ListBase for the new item/binding needs to be
cleared and each path copied separately.
2022-02-19 15:23:34 +09:00
16d5658365 OCIO: Port shader creation logic to use GPUShaderCreateInfo
This commit should suffice to make the shader API agnostic now (given that
all users of it use the GPU API).

This makes the shaders not trigger a false positive error anymore since
the binding slots are now garanteed by the backend and not changed at
after compilation.

This also bundles all uniforms into UBOs. Making them extendable without
limitations of push constants. The generated uniforms from OCIO are not
densely packed in the UBO to avoid complexity. Another approach would be to
use GPU_uniformbuf_create_from_list but this requires converting uniforms
to GPUInputs which is too complex for what it is.

Reviewed by: brecht, jbakker

Differential Revision: https://developer.blender.org/D14123
2022-02-18 22:30:45 +01:00
e81dda4f38 Merge branch 'blender-v3.1-release'
# Conflicts:
#	intern/opencolorio/ocio_shader_shared.hh
2022-02-18 22:29:31 +01:00
93cc892470 Revert "OCIO: Port shader creation logic to use GPUShaderCreateInfo"
This reverts commit 7f7c614ecd.
2022-02-18 22:28:05 +01:00
32660382f5 Revert "OCIO: Fix gpu include file"
This reverts commit 3cebfadb27.
2022-02-18 22:28:01 +01:00
7f68185d34 Merge branch 'blender-v3.1-release' 2022-02-18 15:17:01 -06:00
3cebfadb27 OCIO: Fix gpu include file
Was the cause by ef0e21f0ae
2022-02-18 21:52:29 +01:00
eba3ffc31a GL: Fix possible shift by -1
This can happen when the attribute has been optimized out by the compiler.
2022-02-18 21:33:47 +01:00
7f7c614ecd OCIO: Port shader creation logic to use GPUShaderCreateInfo
This commit should suffice to make the shader API agnostic now (given that
all users of it use the GPU API).

This makes the shaders not trigger a false positive error anymore since
the binding slots are now garanteed by the backend and not changed at
after compilation.

This also bundles all uniforms into UBOs. Making them extendable without
limitations of push constants. The generated uniforms from OCIO are not
densely packed in the UBO to avoid complexity. Another approach would be to
use GPU_uniformbuf_create_from_list but this requires converting uniforms
to GPUInputs which is too complex for what it is.

Reviewed by: brecht, jbakker

Differential Revision: https://developer.blender.org/D14123
2022-02-18 21:33:47 +01:00
ef0e21f0ae Cleanup: Remove unused argument to mesh tessellation
This removes manual handling of normals that was hard-coded
to false in the one place the function was called. This change
will help to make a fix to T95839 simpler.
2022-02-18 13:39:16 -06:00
969c4a45ce Cleanup: Use functions for accessing mesh normal dirty state
It's better not to expose the details of where the dirty flags are
stored to every place that wants to know if the normals are dirty.
Some of these places are relics from before vertex normals were
computed lazily anyway, so this is more of an incrememtal cleanup.
This will make part of the fix for T95839 simpler.
2022-02-18 13:21:36 -06:00
eaa4aa8644 Fix part of T95848: missing updates editing light object nodes
Make relation match material and world nodes. Does not address the reported
issue regarding muted nodes, but another missing update found investigating.
2022-02-18 19:50:53 +01:00
b04d42022f Fix T95338: missing image editor refresh after render compositing
This was an old issue, but recent image partial update changes made this more
likely to happen in some cases. Now ensure that whenever the rendered scene
switches the image is updated.
2022-02-18 19:50:53 +01:00
Dominik Fill
d9d97db018 Fix T87829, T95331: Issues when nodes too close together
This patch aims to fix the issues presented in T87829 and T95331,
namely precision issues while connecting two nodes when being too
close together in the node editor editors, in a few cases even
resulting in the complete inability to connect nodes.

Sockets are found by intersecting a padded rect around the cursor
with the nodes' sockets' location. That creates ambiguities, as it's
possible for the padded rect to intersect with the wrong node,
as the distance between two nodes is smaller than the rect is padded.

The fix in this patch is checking against an unpadded rectangle in
visible_node().

Differential Revision: https://developer.blender.org/D14122
2022-02-18 12:22:51 -06:00
07fbf3108b Merge branch 'blender-v3.1-release' 2022-02-18 11:40:55 -06:00
Wannes Malfait
82fc68ed90 Fix T95542: Dual Mesh crashes with some non-manifold vertices
The problem was that the code for sorting polygons around a vertex
assumed that it was a manifold or boundary vertex. However in some cases
the vertex could still be nonmanifold causing the crash. The cases where
the sorting fails are now detected and these vertices are then marked as
nonmanifold.

Differential Revision: https://developer.blender.org/D14065
2022-02-18 11:35:08 -06:00
Leon Schittek
ddc52f2e1d Fix: Curve to Mesh node creates caps when curve is cyclic
The "Fill Caps" option on the Curve to Mesh node introduced in
rBbc2f4dd8b408ee makes it possible to fill the open ends of the sweep
to create a manifold mesh.

This patch fixes an edge case, where caps were created even when the
rail curve (the curve used in the "Curve" input socket) was cyclic
making the resulting mesh non-manifold.

Differential Revision: https://developer.blender.org/D14124
2022-02-18 11:27:28 -06:00
c2016feadc Merge branch 'blender-v3.1-release' 2022-02-18 18:25:31 +01:00
af6a1b08e3 VSE: Refactor our code to be compatible with ffmpeg 5.0
In ffmpeg 5.0, several variables were made const to try to prevent bad API usage.
Removed some dead code that wasn't used anymore as well.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D14063
2022-02-18 18:24:16 +01:00
16ab6111f7 UI: Speedup preview icon loading from hard drive
Significantly improves loading speed of preview images from disk, e.g. custom
previews loaded using `bpy.utils.previews.ImagePreviewCollection.load()`.

See D14144 for details & comparison videos.

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

Reviewed by: Bastien Montagne
2022-02-18 18:13:06 +01:00
1850a0b2ab Mesh: Avoid creating incorrect original index layers
Currently, whenever any BMesh is converted to a Mesh (except for edit
mode switching), original index (`CD_ORIGINDEX`) layers are added.
This is incorrect, because many operations just convert some Mesh into
a BMesh and then back, but they shouldn't make any assumption about
where their input mesh came from. It might even come from a primitive
in geometry nodes, where there are no original indices at all.

Conceptually, mesh original indices should be filled by the modifier
stack when first creating the evaluated mesh. So that's where they're
moved in this patch. A separate function now fills the indices with their
default (0,1,2,3...) values. The way the mesh wrapper system defers
the BMesh to Mesh conversion makes this a bit less obvious though.

The old behavior is incorrect, but it's also slower, because three
arrays the size of the mesh's vertices, edges, and faces had to be
allocated and filled during the BMesh to Mesh conversion, which just
ends up putting more pressure on the cache. In the many cases where
original indices aren't used, I measured an **8% speedup** for the
conversion (from 76.5ms to 70.7ms).

Generally there is an assumption that BMesh is "original" and Mesh is
"evaluated". After this patch, that assumption isn't quite as strong,
but it still exists for two reasons. First, original indices are added
whenever converting a BMesh "wrapper" to a Mesh. Second, original
indices are not added to the BMesh at the beginning of evaluation,
which assumes that every BMesh in the viewport is original and doesn't
need the mapping.

Differential Revision: https://developer.blender.org/D14018
2022-02-18 10:51:00 -06:00
a08c5c7149 Merge branch 'blender-v3.1-release' 2022-02-18 10:35:11 -06:00
82c3bef765 Fix T94495: Split edges node leads to a crash in edit mode
If original indices exist on the input mesh, also copy them to
the BMesh used for the edge split operation so they aren't lost.

Part of D14018
2022-02-18 10:34:00 -06:00
ddf189892c Cleanup: Rename original curve object type enum
This commit renames enums related the "Curve" object type and ID type
to add `_LEGACY` to the end. The idea is to make our aspirations clearer
in the code and to avoid ambiguities between `CURVE` and `CURVES`.

Ref T95355

To summarize for the record, the plans are:
- In the short/medium term, replace the `Curve` object data type with
 `Curves`
- In the longer term (no immediate plans), use a proper data block for
  3D text and surfaces.

Differential Revision: https://developer.blender.org/D14114
2022-02-18 09:50:29 -06:00
48b17da1d9 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-18 16:36:45 +01:00
1b47d07d76 Fix T95724: boundary error in BLI_str_unescape_ex
Fix boundary error in `BLI_str_unescape_ex`. The `dst_maxncpy` parameter
indicates the maximum buffer size, not the maximum number of characters.

As these are strings, the loop has to stop one byte early to allow space
for the trailing zero byte.

Thanks @mano-wii for the patch!
2022-02-18 16:34:00 +01:00
734c6a4405 Nodes: Update dependency graph when removing some nodes
When removing a node that has a dependence on an ID, like the object
info node, the dependency graph relations weren't updated. This can
cause unexpected performance issues if a complex node tree continues
to depend on an ID that it doesn't actually use anymore. To fix this case,
tag relations for an update if the node has a data-block socket.

Fixes part of T88332

Differential Revision: https://developer.blender.org/D14121
2022-02-18 09:25:13 -06:00
Sayed Amin
ceea3d0f80 Fix T95135: improve error filtering non-existant anim data
If there is no animation at all, or it's all hidden, the Euler Filter
operators poll now fails with a message that explains this a bit more,
instead of just the generic "context is wrong" error.

Reviewed By: sybren

Maniphest Tasks: T95135

Differential Revision: https://developer.blender.org/D13967
2022-02-18 16:24:48 +01:00
aab1561690 LibOverride: Fix resync sometimes deleting root ID of other liboverrides.
While this should not happen in theory, very bad/broken/dirty files can
lead to such situations.

So we need to re-ensure valid root IDs after resync (for now, done after
each 'library indirect level' pass of resync, this may not be 100%
bulletproof though, time will say).

Found while investigating Blender studio issues in Snow parkour short.
2022-02-18 16:08:43 +01:00
d9fe565c85 LibOverride: Fix potential broken cases re ShapeKeys when finding hierarchy root ID.
In some cases broken files could lead to selecting a shapekey as
hierarchy root ID, which is not allowed.

Found while investigating Blender studio issues in Snow parkour short.
2022-02-18 16:06:15 +01:00
303b566b10 Merge branch 'blender-v3.1-release' 2022-02-18 15:32:24 +01:00
e4b7d52fe4 Fix graphics interop resources leak in Cycles
When new display driver is given to the PathTrace ensure that there are
no GPU resources used from it by the work. This solves graphics interop
descriptors leak.

This aqlso fixes Invalid graphics context in cuGraphicsUnregisterResource
error when doing final render on the display GPU.

Fixes T95837: Regression: GPU memory accumulation in Cycles render
Fixes T95733: Cycles Cuda/Optix error message with multi GPU devices. (Invalid graphics context in cuGraphicsUnregisterResource)
Fixes T95651: GPU error (Invalid graphics context in cuGraphicsUnregisterResource)
Fixes T95631: VRAM is not being freed when rendering (Invalid graphics context in cuGraphicsUnregisterResource)
Fixes T89747: Cycles Render - Textures Disappear then Crashes the Render

Maniphest Tasks: T95837, T95733, T95651, T95631, T89747

Differential Revision: https://developer.blender.org/D14146
2022-02-18 15:26:15 +01:00
40cddcd917 Cleanup: Fix incompatible pointer types warnings 2022-02-18 23:21:53 +09:00
af308049bc Merge branch 'blender-v3.1-release' 2022-02-18 14:55:54 +01:00
02f4d63dcc Fix broken shapekeys: check for 'NULL' from pointer too.
Add check for `NULL` `from` pointer to `BLO_main_validate_shapekeys`,
and delete these shapekeys, as they are fully invalid and impossible to
recover.

Found in a studio production file (`animation
test/snow_parkour/shots/0040/0040.lighting.blend`, svn rev `1111`).
Would be nice to know how this was generated too...
2022-02-18 12:29:27 +01:00
5f16e24cc9 Curves: add initial edit mode support
This adds initial support for edit mode for the experimental new curves
object. For now we can only toggle in and out of the mode, no real
interraction is possible.

This patch also adds empty menus in edit mode. Those were added mainly
to quiet warnings as the menus are programmatically added to the edit
mode based on the object type and context.

Ref T95769

Reviewed By: JacquesLucke, HooglyBoogly

Maniphest Tasks: T95769

Differential Revision: https://developer.blender.org/D14136
2022-02-18 11:31:13 +01:00
8b4da9a191 Fix strict compilation warnings 2022-02-18 10:14:34 +01:00
61aaeb3745 Curves: initial brush system integration for curves sculpt mode
This adds the boilerplate code that is necessary to use the tool/brush/paint
systems in the new sculpt curves mode.

Two temporary dummy tools are part of this patch. They do nothing and
only serve to test the boilerplate. When the first actual tool is added,
those dummy tools will be removed.

Differential Revision: https://developer.blender.org/D14117
2022-02-18 09:14:54 +01:00
964d3a38fa XR: Enable Vive Focus 3 controller extension
Allows controller-specific action bindings for the HTC Vive Focus 3
controller. Currently not supported by any OpenXR runtimes (save for
the dedicated Focus 3 runtime in developer early-access:
https://forum.vive.com/topic/11354-openxr-support-for-focus-3-early-access-application-form),
but useful to have for the future.
2022-02-18 17:00:43 +09:00
4ad4d8a59c Cleanup: Use compact license header.
New file introduced in blender-v3.1-release branch.
2022-02-18 08:30:10 +01:00
5c6eefa850 Merge branch 'blender-v3.1-release' 2022-02-18 08:29:32 +01:00
fe26d18889 Fix T95809: Check color space changes to refresh image engine.
Previous commit fixed the compositor node, this commit is related to the
shader tree. Also checks if the color space or alpha mode have changed.
2022-02-18 08:22:18 +01:00
400e57b64a Fix T95809: Compositor Node not directly updated in image editor.
Image wasn't tagged to be dirty.
2022-02-18 08:11:51 +01:00
6efdfeb886 Image Engine: Store image usage to identity changes.
Previous implementation had a copy of the image user, which doesn't
contain all the data to identify changes. This patch introduces a new
struct to store the data and can be extended with other data as well
(color spaces, alpha settings).
2022-02-18 07:55:36 +01:00
ca1f879c02 Cleanup: simplify viewmove_apply
Check for a camera-view before checking if the view is locked
to the cursor/object since the camera-view takes priority,
it reads better to check that first.

Also reuse the event offset variable.
2022-02-18 17:24:10 +11:00
51975b89ed 3D View: Add camera view pan/zoom support for NDOF
NDOF navigation in a camera view now behaves like orthographic pan/zoom.

Note that NDOF orbiting out of the camera view has been disabled,
see code comment for details.

Resolves T93666.
2022-02-18 17:09:49 +11:00
f33e6e0d8c Cleanup: move camera-view pan/zoom into utility functions 2022-02-18 16:48:27 +11:00
ae9dd0cbf9 Merge branch 'blender-v3.1-release' 2022-02-17 23:44:47 -06:00
Pratik Borhade
1d0d810331 Fix T93526: Missing tooltip for attribute search button
For the attribute search button, the tooltip was missing
if the input socket type has attribute toggle activated.

Differential Revision: https://developer.blender.org/D14142
2022-02-17 23:44:16 -06:00
59aaf2036e Fix wrong method name in gpu documentation
`use_program_point_size` --> `program_point_size_set`.
2022-02-17 22:11:08 -03:00
9153bf24cb Merge branch 'blender-v3.1-release' 2022-02-17 20:30:45 +01:00
3cdbeb32d3 Fix build error on some compilers after recent bugfix 2022-02-17 20:30:19 +01:00
ad2577e0cd Merge branch 'blender-v3.1-release' 2022-02-17 19:52:46 +01:00
da6b534274 Fix T95368: wrong white point adaptation for Linear ACES color space
This affected loading of EXR files with set to Linear ACES colorspace, as
well as the sky texture for in some custom OpenColorIO configurations.

Use the builtin OpenColorIO transform from ACES AP0 to XYZ D65 to fix this.
2022-02-17 19:51:43 +01:00
48432c1c92 Fix: Debug build error with vector type division
The idea is to keep `is_any_zero` in the `blender::math` namespace,
so instead of trying to be clever, just move it there and expand the
function where it was used in the class.
2022-02-17 12:36:41 -06:00
b6fe1b0c65 Merge branch 'blender-v3.1-release' 2022-02-17 18:44:18 +01:00
a04300c436 Cleanup: Move more cmake library variables to be advanced
I noticed that there were a few variables that should not be visible per default.
It seems to me to simply be an oversight, so I went ahead and cleaned them up.

Reviewed By: Sybren, Ray molenkamp

Differential Revision: http://developer.blender.org/D14132
2022-02-17 18:42:06 +01:00
8355ac97b4 GPU: Remove runtime sampler texture slot assignment
This avoid potential shader recompilation and is more in line
with vulkan design.
2022-02-17 18:15:31 +01:00
37fa1bc254 OCIO: Port shader creation logic to use GPUShaderCreateInfo
This commit should suffice to make the shader API agnostic now (given that
all users of it use the GPU API).

This makes the shaders not trigger a false positive error anymore since
the binding slots are now garanteed by the backend and not changed at
after compilation.

This also bundles all uniforms into UBOs. Making them extendable without
limitations of push constants. The generated uniforms from OCIO are not
densely packed in the UBO to avoid complexity. Another approach would be to
use GPU_uniformbuf_create_from_list but this requires converting uniforms
to GPUInputs which is too complex for what it is.

Reviewed by: brecht, jbakker

Differential Revision: https://developer.blender.org/D14123
2022-02-17 18:15:31 +01:00
9281ba5812 Fix part of T95654: Cycles crash with text objects in excluded view layers
This is a bug on the Blender side, where the depsgraph does not have proper
relations for text object duplis and fails to include the required materials
in the dependency graph. But at least Cycles should not crash.
2022-02-17 17:30:40 +01:00
b5e3700b79 Cleanup: Replace direct id.lib pointer checks with ID_IS_LINKED macro usages. 2022-02-17 17:08:00 +01:00
c99d1d5d0d Fix build errors on Linux/clang after recent changes 2022-02-17 16:19:26 +01:00
114cc47b78 Fix: Memory leak in recently added curves copy function
Specify that the destination curve must be initialized, and free the
existing attributes (which `CustomData_copy` doesn't do).
2022-02-17 09:05:08 -06:00
Germano Cavalcante
e240c8c5db Camera: Simplify View Frame code
- No need for `normal_tx` array if we normalize the planes in `plane_tx`.
- No need to calculate the distance squared to a plane (with `dist_signed_squared_to_plane_v3`) if the plane is normalized. `plane_point_side_v3` gets the real distance, accurately, efficiently and also signed.

So normalize the planes of the member `CameraViewFrameData::plane_tx`.
2022-02-17 11:51:45 -03:00
a4c800ed02 Merge branch 'blender-v3.1-release' 2022-02-17 15:24:29 +01:00
e5100ca3ad Build: update CMake to support OpenImageIO 2.3.4
FindOpenImageIO was updated to link to separate OpenImageIO_Util for new
versions, where it is required. For older versions, we can not link to it
because there will be duplicated symbols.

Ref D14128
2022-02-17 15:21:09 +01:00
2c9931699e Build: update CMake to support OpenEXR 3
FindOpenEXR was updated to find new lib names and separate Imath. It's all
added to the list of OpenEXR include dirs and libs.

This keeps it compatible with both version 2 and 3 for now, and doesn't
require changes outside the find module.

Ref D14128
2022-02-17 15:21:09 +01:00
cd7550cfe7 Images: update code to support OpenEXR 3
Compatibility with OpenEXR 2 is preserved, since Blender releases and Linux
distribution packages can be on different versions.

Ref D14128
2022-02-17 15:21:09 +01:00
6a283b7a7f Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-17 15:16:31 +01:00
4541249360 Fix compile error on MSVC
`uint` is POSIX type, use `GLuint` like for the rest of the code.
2022-02-17 15:15:46 +01:00
68a09bf5fd Cleanup/fix comment. 2022-02-17 14:36:03 +01:00
433fad50d8 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-17 13:14:47 +01:00
c5dcfb63d9 Fix T94881: GPU subdivision fails with high polycount coarse meshes
Coarse meshes with high polycount would show as corrupted when GPU
subdivision is used with AMD cards This was caused by the OpenSubdiv
library not taking `GL_MAX_COMPUTE_WORK_GROUP_COUNT` into account when
dispatching computes. AMD drivers tend to set the limit lower than
NVidia ones (2^16 for the former, and 2^32 for the latter, at least
on my machine).

This moves the `GLComputeEvaluator` from the OpenSubdiv library into
`intern/opensubdiv` and modifies it to compute a dispatch size in a
similar way as for the draw code: we split the dispatch size into a 2
dimensional value based on `GL_MAX_COMPUTE_WORK_GROUP_COUNT` and
manually compute an index in the shader.

We could have patched the OpenSubdiv library and sent the fix upstream
(which can still be done), however, moving it to our side allows us to
better control the `GLComputeEvaluator` and in the future remove some
redundant work that it does compared to Blender (see T94644) and
probably prepare the ground for Vulkan support. As a matter of fact,
this patch also removes the OpenGL initialization that OpenSubdiv would
do here. This removal is not related to the bug fix, but necessary to not
have to copy more files/code over.

Differential Revision: https://developer.blender.org/D14131
2022-02-17 13:14:19 +01:00
43b40f7bde Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-17 08:41:01 +01:00
be3047c500 Fix T95827: vertex groups do not display correctly with GPU subdivision
Issue caused by 993839ce85 which modified
the coarse face flags update function, but forgot the case where we have
a mapped extraction with no BMesh.
2022-02-17 08:40:38 +01:00
401383f245 Fix vertex groups not rendering properly with GPU subdivision
This was missing the BMesh case. Issue found while investigating T95827.
2022-02-17 08:38:12 +01:00
6a8709ba13 XR: Allow variable count of action map subactions
Previously, the number of action map subactions was limited to two per
action (identified by user_path0, user_path1), however for devices with
more than two user paths (e.g. Vive Tracker) it will be useful to
support a variable amount instead.

For example, a single pose action could then be used to query the
positions of all connected trackers, with each tracker having its own
subaction tracking space.

NOTE: This introduces breaking changes for the XR Python API as follows:
- XrActionMapItem: The new `user_paths` collection property
replaces the `user_path0`/`user_path1` properties.
- XrActionMapBinding: The new `component_paths` collection property
replaces the `component_path0`/`component_path1` properties.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D13949
2022-02-17 15:51:16 +09:00
7d4d8a13ce Merge branch 'blender-v3.1-release' 2022-02-17 15:39:31 +09:00
dd6fd06c15 Fix T76082: VR Scene Inspection: It shows me only a pink screen
This fixes VR pink screen issues when using the DirectX backend, caused
by `wglDXRegisterObjectNV()` failing to register the shared
OpenGL-DirectX render buffer. The issue is mainly present on AMD
graphics, however, there have been reports on NVIDIA as well.

A limited workaround for the SteamVR runtime (AMD only) was provided
in rB82ab2c167844, however this patch provides a more complete solution
that should apply to all OpenXR runtimes. For example, with this patch,
the Windows Mixed Reality runtime that exclusively uses DirectX can now
be used with AMD graphics cards.

Implementation-wise, a `GL_TEXTURE_2D` render target is used as a
fallback for the shared OpenGL-DirectX resource in the case that
registering a render buffer (`GL_RENDERBUFFER`) fails. While using a
texture render target may be less optimal than a render buffer, it
enables proper display in VR using the OpenGL/DirectX interop (tested
on AMD Vega 64).

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14100
2022-02-17 15:28:29 +09:00
8c8d84fbc5 Cleanup: compiler warning, typo in comment 2022-02-17 16:50:44 +11:00
bdde8c7207 License headers: use SPDX identifiers 2022-02-17 16:47:37 +11:00
Christoph Lendenfeld
b626edd751 fix: RNA property not set for Graph editor breakdown op
After running the breakdown operator for the graph editor,
the factor property in the redo panel didn't reflect the value you chose

to mitigate that issue down the line there is a
new helper function to get the factor value, and
store it at the same time

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D14105
Ref: D14105
2022-02-16 21:55:42 +01:00
8c96ee8903 Cleanup: Deduplicate functions for creating attributes 2022-02-16 14:10:21 -06:00
6862caea5e macOS/bpy module: install text files correctly
Instead of Blender.app (despite building bpy), install license etc in
`Resources/text` of bpy install location. Part of D14111
2022-02-17 01:31:03 +05:30
71545e542c macOS/bpy module: install scripts relative to bpy.so
Brew's Python framework's site-packages is a symlink so the assumption
that Resources and site-packages would be in the same directory
doesn't hold. So install scripts etc relative to bpy.so. Part of D14111
2022-02-17 01:31:03 +05:30
57013e2a44 Merge branch 'blender-v3.1-release' 2022-02-16 19:51:58 +01:00
05697470ab Cleanup: Remove deprecated StringGrid from our openvdb code
StringGrid has been deprecated in openvdb 9.0.0 and will be removed soon

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D14133
2022-02-16 19:49:58 +01:00
f38c2fbef9 Merge branch 'blender-v3.1-release' 2022-02-16 19:03:00 +01:00
0622d2ec61 Fix T95815: missing null check when computing dupli dimensions
Some instances might be "empty" and therefore have no dimensions.
Those should be ignored here.
2022-02-16 18:58:01 +01:00
c324cf1539 Curves: Further implementation of new curves data structure
The general idea here is to wrap the `CurvesGeometry` DNA struct
with a C++ class that can do most of the heavy lifting for the curve
geometry. Using a C++ class allows easier ways to group methods, easier
const correctness, and code that's more readable and faster to write.
This way, it works much more like a version of `CurveEval` that uses
more efficient attribute storage.

This commit adds the structure of some yet-to-be-implemented code,
the largest thing being mutexes and vectors meant to hold lazily
calculated evaluated positions, tangents, and normals. That part might
change slightly, but it's helpful to be able to see the direction this
commit is aiming in. In particular, the inherently single-threaded
accumulated lengths and Bezier evaluated point offsets might be cached.

Ref T95355

Differential Revision: https://developer.blender.org/D14054
2022-02-16 11:32:37 -06:00
5b73017ddb BLI: Generalize short algorithm for finding bounds
Finding the greatest and/or smallest element in an array is a common
need. This commit refactors the point cloud bounds code added in
6d7dbdbb44 to a more general header in blenlib.
This will allow reusing the algorithm for curves without duplicating it.

Differential Revision: https://developer.blender.org/D14053
2022-02-16 10:53:58 -06:00
399168f3c1 BLI: Implement templated math functions for basic types
This is meant to complement the `blender::math` functions recently
added by D13791. It's sometimes desired to template an operation to work
on vector types, but also basic types like `float` and `int`. This patch
adds that ability with a new `BLI_math_base.hh` header.

The existing vector math header is changed to use the `vec_base` type
more explicitly, to allow the compiler's generic function overload resolution
to determine which implementation of each math function to use.
This is a relatively large change, but it also makes the file significantly
easier to understand by reducing the use of macros.

Differential Revision: https://developer.blender.org/D14113
2022-02-16 10:28:26 -06:00
5b3a415a59 Merge branch 'blender-v3.1-release' 2022-02-16 15:59:06 +01:00
257ba175fa Fix: removing anonymous attributes before adding mesh to bmain
This was an issue when e.g. `bpy.data.meshes.new_from_object` was
used on an object that uses geometry nodes.
2022-02-16 15:58:27 +01:00
03ff58b67d Cleanup: Use const qualifier in modifier data copy
Fix possible overflow of Modifier UUID

The code prior this change was re-generating modifier's session UUID
prior to copying this id from the source. This approach has a higher
risk of modifiers session UUID to overflow and start colliding with
existing modifiers.

This change makes it so that modifier copy does not re-generated the
session UUID unless it is needed.

Differential Revision: https://developer.blender.org/D14125
2022-02-16 15:40:03 +01:00
7e312f89d9 Cleanup: Use const qualifier in modifier data copy 2022-02-16 15:40:03 +01:00
259f4e50ef Merge branch 'blender-v3.1-release' 2022-02-16 15:35:18 +01:00
f059bdc823 Cycles: restore basic standalone GUI, now using SDL
GLUT does not support offscreen contexts, which is required for the new
display driver. So we use SDL instead. Note that this requires using a
system SDL package, the Blender precompiled SDL does not include the video
subsystem.

There is currently no text display support, instead info is printed to
the terminal. This would require adding an embedded font and GLSL shaders,
or using GUI library.

Another improvement to be made is supporting OpenColorIO display transforms,
right now we assume Rec.709 scene linear and display.

All OpenGL, GLEW and SDL code was move out of core cycles and into
app/opengl. This serves as a template for apps that want to integrate
Cycles interactive rendering, with a simple OpenGLDisplayDriver example.
In general this would be adapted to the graphics API and color management
used by the app.

Ref T91846
2022-02-16 15:30:43 +01:00
a6267f1167 BLI: Fix compilation error caused by rBa9f023e22638
Explicitly referencing the typename fixes the issue.
2022-02-16 14:40:14 +01:00
3f0e63fcca Merge branch 'blender-v3.1-release' 2022-02-16 11:16:22 +01:00
54972123f7 Fix Image GPU texture.
Due to recent changes there have been reports of incorrect loading of
GPU textures. This fix reverts a part of {D13238} that might be the
source of the issue.
2022-02-16 10:45:46 +01:00
86762e8371 Merge branch 'blender-v3.1-release' 2022-02-16 08:41:40 +01:00
232d5d3f13 Fix T95787: Texture paint: Apply Camera Image crash for certain images
This does not happen with **any** image, but with images that have ID
properties.

ID properties are used to store view projection matrices (e.g. for
reprojection with `Image from View` or `Quick Edit` -- these are the
ones we are interested in), but of course they can be used for anything
else, too. The images in the file from the report have ID properties from
an Addon for example.

So the crash can reliably be reproduced with **any** image doing the
following:
```
bpy.data.images['myImage']['myIDprop'] = "foo"
```
This would lead code in `texture_paint_camera_project_exec` to think the
needed `view_data` is on the image (but in reality it was just some
other IDprop).

Solution is simple: just check `view_data` is really valid after getting
it from the IDprops.

Maniphest Tasks: T95787

Differential Revision: https://developer.blender.org/D14116
2022-02-16 08:35:15 +01:00
18d18b5a98 UV: move sticky selection from image space into tool settings
Having this setting stored in the image space caused low level selection
logic to have to pass around the image space (which could be NULL
in some cases). Use the tool-settings instead since there doesn't seem
to be much/any advantage in having this setting per-space.
2022-02-16 13:46:00 +11:00
a0ad8c57ef License headers: use SPDX identifiers 2022-02-16 13:04:20 +11:00
81223ae164 Cleanup: spelling in comments 2022-02-16 13:04:20 +11:00
37821143dd Cleanup: clang-format, use static sets, sort struct declarations 2022-02-16 13:04:20 +11:00
d3b1cce400 GPUTexture: Add dimensions getter
Pretty straight forward. Returns the texture dimensions count. This is
different from the size.
2022-02-15 22:20:49 +01:00
cbdd578640 Fix: Build error in debug build
Error in a9f023e226
2022-02-15 13:57:17 -06:00
e272bdc171 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-15 20:41:39 +01:00
53fe4f62fe Fix T95806: subdivision missing in Cycles when using autosmooth
Although rB56407432a6a did fix missing subdivision in some cases, in
other cases it did not return the mesh wrapper (like when using
autosmooth, which requires a copy of the mesh), so the non-subdivided
mesh was still returned.
2022-02-15 20:40:58 +01:00
4782713390 Fix T94994: Anim Player Stops working In Video Sequence Editor
Port from upstream: variable was unitialized when device initialization
failed when the WASAPI mixing thread is started.
2022-02-15 20:04:42 +01:00
1efb8e215e Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-15 17:53:51 +01:00
48b26d9c2e Fix T95697: GPU subdivision ignores custom normals
Similarly to the CPU subdivision, we interpolate custom loop normals
from the coarse mesh, and this for the final normals.
2022-02-15 17:53:22 +01:00
430ced76d5 GPU subdiv: fix custom data interpolation for N-gons
Not all coarse vertices were used to compute the center value (off by
one), and the interpolation for the current would always start at the
base corner for the base face instead of the base corner for the current
patch.
2022-02-15 17:53:12 +01:00
a9f023e226 BLI: Change dependencies in vector math files
This patch reverses the dependency between `BLI_math_vec_types.hh` and
`BLI_math_vector.hh`. Now the higher level `blender::math` functions
depend on the header that defines the types they work with, rather than
the other way around.

The initial goal was to allow defining an `enable_if` in the types header
and using it in the math header. But I also think this operations to types
dependency is more natural anyway.

This required changing the includes some files used from the type
header to the math implementation header. I took that change a bit
further removing the C vector math header from the C++ header;
I think that helps to make the transition between the two systems
clearer.

Differential Revision: https://developer.blender.org/D14112
2022-02-15 10:27:03 -06:00
3ed3ee253b Cleanup: Rename file used for calculating mesh edges
This commit renames `mesh_validate.cc` to `mesh_calc_edges.cc`.
I would like to move `mesh_validate.c` to C++, but it makes sense to
keep this specific algorithm in a smaller file.
2022-02-15 09:29:22 -06:00
Michael
b22db23aee Define CLANG_FORMAT_VERSION in install_deps.sh
When running `./blender/build_files/build_environment/install_deps.sh` on Ubuntu 20.04.3 LTS the following error can be seen:
```
./blender/build_files/build_environment/install_deps.sh: line 1266: [: too many arguments
```
This error results from the call:
```
  check_package_version_ge_DEB $CLANG_FORMAT $CLANG_FORMAT_VERSION
```
with `CLANG_FORMAT_VERSION` being undefined.
Also as `clang-format` 13 is already released and hopefully didn't break anything `CLANG_FORMAT_VERSION_MEX` could use version bump.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13924
2022-02-15 14:12:21 +01:00
07032dd218 Curves: add initial sculpt mode
This adds a new sculpt mode to the experimental new curves object.
Currently, this mode can only be entered and exited, nothing else.
The main initial purpose of this node will be to use it for hair grooming.

The patch also adds the `editors/curves/` directory for the new curves
object, which will be necessary for many other things as well.

I added a completely new mode (`OB_MODE_SCULPT_CURVES`), because
`OB_MODE_SCULPT` seems to be rather specific to meshes, and reusing
it doesn't seem worth the trouble. The tools/brushes used in mesh vs.
curves sculpt mode are quite distinct as well.

I had to add DNA_userdef_enums.h to make the patch compile with C++
(forward declaration of enums isn't allowed). This follows the same
pattern that we use for other enums in dna.

Differential Revision: https://developer.blender.org/D14107
2022-02-15 12:32:15 +01:00
07ed869b94 RNA: add RNA_collection_is_empty & RNA_property_collection_is_empty
Some collections needed to be iterated over to count their length.
Provide a function to check if the collection is empty to avoid this.
2022-02-15 20:13:00 +11:00
4637e83990 Merge branch 'blender-v3.1-release' 2022-02-15 19:51:43 +11:00
597edd299f Merge branch 'blender-v3.1-release' 2022-02-15 19:51:40 +11:00
92a3732ff1 Fix T95791: Unable to switch between multiviews.
Root cause is copy pasting buggy code.
2022-02-15 19:51:30 +11:00
7083ea36e2 Fix T94085: Crash with empty stroke list 2022-02-15 19:49:02 +11:00
d1c7a252eb Fix T95791: Unable to switch between multiviews.
Root cause is copy pasting buggy code.
2022-02-15 09:41:10 +01:00
14dd207b75 License headers: use SPDX for remaining files in Cycles 2022-02-15 17:52:38 +11:00
88b6e5571e License headers: use SPDX for remaining CMake find modules & gtests 2022-02-15 17:45:39 +11:00
fcac0b6fea Fix playing image-sequences with frames containing 9 or more numbers
The path calculation method for animation players: frame-cycler, rv &
mplayer would fail when the number of digits exceeded the range of a
32bit int causing RenderData.frame_path() to raise a ValueError.

Use a simpler method of extracting the range that uses the sign to
detect the beginning of the number.
2022-02-15 17:21:21 +11:00
fa7bd4c069 Cleanup: move utility to create a frame path into a static method
Add PlayRenderedAnim._frame_path_with_number_char since mixing
this logic inline made the code harder to follow.
2022-02-15 17:16:26 +11:00
c146d75808 readme.html: replace IRC with blender.chat, fix typo
- Replace IRC links and channels with blender.chat ones.
- Fix mismatch in text vs link of "GIT and Bug Tracker".
- http -> https for blender links
2022-02-15 11:09:40 +05:30
14d98d0388 CMake: create readme.html with configure_file
Since the output file stays unmodified for most developer builds,
install step installed it redundantly.

Create readme.html using `configure_file`:
- Now it's modified only if final output changes (handled by CMake).
- If input file (from git) or blender version changes,
  it //will// be modified.

Also don't re-implement what CMake can do.

Reviewed By: campbellbarton, LazyDodo
Differential Revision: https://developer.blender.org/D13863
2022-02-15 10:14:35 +05:30
9d01358a68 Cleanup: unused argument warnings 2022-02-15 13:04:31 +11:00
e3a18a890d Cleanup: minor changes to Python argument parsing loop
- Increment the argument index at the end of the loop.
  Otherwise using the index after incrementing required subtracting 1.
- Move error prefix creation into a function: `pyrna_func_error_prefix`
  so it's possible to create an error prefix without duplicate code.

This simplifies further changes for argument parsing from D14047.
2022-02-15 12:57:59 +11:00
a9a05d5597 Merge branch 'blender-v3.1-release' 2022-02-15 01:05:47 +01:00
facd9d8268 Cleanup: clang-format 2022-02-15 01:05:25 +01:00
3d1e978257 Merge branch 'blender-v3.1-release' 2022-02-14 18:01:52 -06:00
1f7f7ca14e Fix T95720: Spreadsheet missing volume grid info
The cell drawing code in 474adc6f88 was missing an
implementation for virtual arrays of strings.
2022-02-14 18:00:45 -06:00
d7d827789b GLShaderInterface: Fix undefined behavior when attributes are optimized away.
Optimized out attributes returns an invalid location `-1` resulting in
an undefined behavior shift.
2022-02-15 00:48:18 +01:00
89b47c1214 Merge branch 'blender-v3.1-release' 2022-02-15 00:11:23 +01:00
302c74e596 GLCompute: Apply state before dispatch 2022-02-15 00:10:50 +01:00
b744081f83 GLDebug: Fix severity check
The check was reversed, leading to less errors being reported.
2022-02-15 00:02:31 +01:00
19b21563d6 GPUTexture: Fix missing enum cases in to_component_len()
This might have caused undersized buffer if using the wrong formats with
`GPU_texture_read()`.
2022-02-15 00:01:04 +01:00
ad1f8a50b0 Cleanup: Use C++ math functions
Use functions from the `math` and `std` namespaces instead
of from `BLI_math_vector.h`.
2022-02-14 15:48:46 -06:00
761274fc19 Merge branch 'blender-v3.1-release' 2022-02-14 12:35:33 -06:00
33d5ecd5b5 Fix T95252: Move duplicate node doesn't do edge-panning
Set "view2d_edge_pan" to true for the NODE_OT_translate_attach operator,
which is used by the duplication operator. This is done in the keymap so
that it's not hard-coded.

Differential Revision: https://developer.blender.org/D13934
2022-02-14 12:34:54 -06:00
7773393d35 Cleanup: Pass const Scene to mesh evaluation 2022-02-14 12:05:54 -06:00
e26194e80d Merge branch 'blender-v3.1-release' 2022-02-14 18:31:19 +01:00
6ae08da5c8 Fix T95756: Crash inserting geometry node after linking modifier
The root issue was caused by a mistake in modifier copy data which was
wrongly re-generating source modifier data identifier.

The c8cca88851 simply exposed a bug in code which always was there
since the modifiers session UUID was introduced.

Shows an importance of const qualifier :)
2022-02-14 18:19:13 +01:00
19403fc852 Merge branch 'blender-v3.1-release' 2022-02-14 17:48:52 +01:00
a5edff4b73 Fix T95778, the macOS minimum versions have been increased for Metal. 2022-02-14 17:47:35 +01:00
d8e2f612ec Cleaunp: Modify comment 2022-02-14 16:39:06 +01:00
56407432a6 Fix T94479: GPU Subdivision surface modifier does not apply to Cycles renders
Since now we delegate the evaluation of the last subsurf modifier in the stack
to the draw code, Cycles does not get a subdivided mesh anymore. This is because
the subdivision wrapper for generating a CPU side subdivision is never created
as it is only ever created via `BKE_object_get_evaluated_mesh` which Cycles does
not call (rather, it accesses the Mesh either via `object.data()`, or via
`object.to_mesh()`).

This ensures that a subdivision wrapper is created when accessing the object data
or converting an Object to a Mesh via the RNA/Python API.

Reviewed by: brecht

Differential Revision: https://developer.blender.org/D14048
2022-02-14 16:36:32 +01:00
3b14224881 GPencil: Fill Dilate using negative values contract the fill area
This is requested by artist for some animation styles where is necessary to fill the area, but create a gap between fill and stroke.

Also some code cleanup and fix a bug in dilate for top area.

Reviewed By: pepeland, mendio

Differential Revision: https://developer.blender.org/D14082
2022-02-14 16:30:09 +01:00
0999a01b03 Fix T95320: CacheFile templates crash when used through Python
The crash is caused as we did not check that the RNA pointer is null
before trying to use it. This moves the existing checks from the
modifier panels into the template functions so the logic is a bit
centralized.
2022-02-14 16:13:25 +01:00
65d4c58060 Fix Cycles assert in debug mode after recent changes
We sometimes call start() on already started renders, just do nothing then.

Ref D14086
2022-02-14 15:45:11 +01:00
15141ec19a Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-14 14:49:11 +01:00
993839ce85 Fix T95177: GPU subdiv crashes mirror modifier in edit-mode
The issue has two causes: on one hand origin indices were not handled
properly, on the other hand the extraction type (Mesh, BMesh, or mapped)
was not detected correctly.

For the second case reuse the MeshRenderData creation from the coarse
code path so that we make the same decisions. Loose geometry extraction
had to be updated to properly handle the BMesh cases.

For the origin indices, in some cases (for edges and faces), the arrays
used by the subdivision code already have the origin indices baked into
them, so mapping them a second time through the origin index layer is
wrong, and could cause out of bounds accesses.

For vertices especially, we would use two arrays: one for mapping
subdivision vertices to coarse vertices, and another one to map coarse
vertices to subdivision loops used for the selection index buffer. The
second one is now removed (which saves a bit of memory) as it is did not
have the proper data setup for use with the origin indices and we can
easily compute it using the first array anyway.
2022-02-14 14:48:44 +01:00
06a492cfdc Fix (studio reported) crash in new resync code.
We do not always resync/replace the root ID of a hierarchy now that we
do partial resync.
2022-02-14 13:26:42 +01:00
c32d3a175d Merge branch 'blender-v3.1-release' 2022-02-14 12:07:59 +01:00
3a9a37d6dc Fix T95601: Missing handling of keyingsets ID pointers in lib_query/foreach_id code.
This will have to be backported to 2.93 and possibly 2.83 if possible.
2022-02-14 12:05:11 +01:00
777953f36b Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-14 11:09:34 +01:00
e0fd31f083 Fix segfault calling id_properties_ui("prop").update()
Fix segfault when calling `some_id.id_properties_ui("propname").update()`,
i.e. call the `update()` function without any keyword arguments. In such
a case, Python passes `kwargs = NULL`, but `PyDict_Contains()` is not
`NULL`-safe.
2022-02-14 11:08:53 +01:00
48e2bf3638 Merge branch 'blender-v3.1-release' 2022-02-14 11:00:30 +01:00
1236d2aea8 Cleanup use c style comments. 2022-02-14 10:58:45 +01:00
d23cf42ba7 Fix T95725: Changing render slot doesn't update displayed image.
Fixed by checking the requested pass, layer and view against the
previous used one.
2022-02-14 10:54:21 +01:00
ab71d833c7 Phase out IMA_GPU_REFRESH.
IMA_GPU_REFRESH is replaced by
BKE_image_partial_update_mark_full_update and should not be used
anymore.
2022-02-14 10:33:56 +01:00
efac4db166 Merge branch 'blender-v3.1-release' 2022-02-14 09:42:03 +01:00
f0e32ef4ff Fix T95699: Compostior backdrop not updated.
The Viewer marked the gpu texture to be out of date. But it should have used
the mark_full_update as the gpu textures
are only used by the render/draw engines.

The image/node editor uses the image engine that have its own GPU textures.
2022-02-14 09:21:05 +01:00
f663a1dc09 Image Engine: Remove region_uv_bounds.
They have been replaced by clipping_uv_bounds. Using region_uv_bounds
could lead to problems when drawing the compositor backdrop.
2022-02-14 09:21:04 +01:00
fe9b3dd5f9 Image Engine: Limit the number of interal textures.
Currently one a single texture slot is used to update the screen.
Current design is implemented to use multiple textures.
for now limit the number of texture slots to 1.
2022-02-14 09:21:04 +01:00
08882ddfc2 Merge branch 'blender-v3.1-release' 2022-02-14 09:09:37 +01:00
33dde170ce Fix T95749: missing update when normal node changes
This node is a bit of a weird case, because it uses the value stored in an
output socket as an input. So when we want to determine if the Dot
changed, we also have to check if the Normal output changed.

A cleaner solution would be to refactor this by either storing the normal
on the node directly (instead of in an output socket), or by exposing it
by a separate input. This refactor should be done separately though.
2022-02-14 09:08:54 +01:00
31be5ce8b9 GNUmakefile: update arguments for 'doc_man' target
Add '--verbose' argument to the script so the destination is printed.
Otherwise there is no hint to where the man page was written.
2022-02-14 16:20:16 +11:00
47b783bbe9 GNUmakefile: remove package targets that no longer exist 2022-02-14 16:12:14 +11:00
963ca15ba4 GNUmakefile: don't echo output for checking utilities & docs
When running checkers, showing commands to activate them adds noise.
2022-02-14 16:09:05 +11:00
0fd66b4f07 GNUmakefile: use PYTHON variable instead of python3
Also update the Python3 binary on macOS.
2022-02-14 16:04:31 +11:00
7d5f6c330f Cleanup: Clang tidy
Use using instead of typedef, remove redundant string init,
use "empty", address qualified auto, use nullptr.
2022-02-13 13:15:53 -06:00
7413c2feed Cleanup: Optimize gl query code path
Currently whenever gl queries are performed for the viewport, a large
1024 byte array is allocated to store the query results (256 of them).

Unfortunately, if any gizmo using a `draw_select` callback is active
(e.g. the transform gizmos), these queries (and allocations) will occur
during every mouse move event.

Change the vector to allow for up to 16 query results before making an
allocation. This provides enough space for every built-in gizmo except
Scale Cage (which needs 27 queries). It also removes unnecessary
allocations from two other related vectors used during query processing.

Differential Revision: https://developer.blender.org/D13784
2022-02-12 21:52:24 -08:00
52be063012 Fix (unreported): Issues with 'SNAP_NOT_SELECTED' for pose and edit modes
This is a regression partially introduced in rB0a6f428be7f0.

Bones being transformed into edit mode were snapping to themselves.

And the bones of the pose mode weren't even snapping.

(Curious that this was not reported).
2022-02-12 16:13:28 -03:00
824f514f8f Fix T94860: GPencil - Avoid drift in Sculpt when mouse/pen is not moved
This fix avoid the drif checking if the previous position is equals to new one, in this case, the pen has not moved and can be canceled.

Differential Revision: https://developer.blender.org/D13870
2022-02-12 10:50:39 +01:00
cf6546863e Merge branch 'blender-v3.1-release' 2022-02-11 20:57:18 -05:00
517afcc858 Fix T91423: View Animation not working with stereoscopic animations
The animation playback did not take into account individual stereoscopic views.

This patch fixes this by playing back the active view render.

Reviewed By: campbellbarton

Maniphest Tasks: T91423

Differential Revision: https://developer.blender.org/D14070
2022-02-11 20:56:51 -05:00
35c261dfcf Merge branch 'blender-v3.1-release' 2022-02-11 23:58:41 +01:00
27d3140b13 Cycles: Fix Metal kernel compilation for AMD GPUs
Workaround for a compilation issue preventing kernels compiling for AMD GPUs: Avoid problematic use of templates on Metal by making `gpu_parallel_active_index_array` a wrapper macro, and moving `blocksize` to be a macro parameter.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14081
2022-02-11 22:52:48 +00:00
Stefan Werner
f3c58c6505 Cycles: Removed redundant/buggy code in multiscatter BSDF
A zero length vector was normalized and the resulting NaN used in further calculations.
This caused trouble on some compilers when using fast math.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D14058
2022-02-11 22:41:17 +01:00
ad53cb0b9d Merge branch 'blender-v3.1-release' 2022-02-11 19:44:27 +01:00
40fce61a6a Cycles: enable Metal on AMD GPUs, set macOS minimum versions
* Apple Silicon support enabled on macOS 12.2+
* AMD support enabled on macOS 12.3+

This patch also fixes a device enumeration crash on certain AMD configs which
was caused by over-release of MTLDevice objects.

Differential Revision: https://developer.blender.org/D14090
2022-02-11 19:22:16 +01:00
Leon Schittek
ed4b032155 UI: Improve node drop shadow
Improve the nodes' drop shadow by making it scale with the view
and replace the loop for the alpha calculation with something more
explicit.

The amount of drop shadow softness was scaled with the zoom level
and therefore had a fixed screen space size. DPI and UI scale
weren't taken into account either. This patch fixes both issues by
basing the shadow softness on the `widget_unit` that scales correctly
in zoomable views and takes UI scale etc. into account.

Differential Revision: https://developer.blender.org/D13356
2022-02-11 11:52:56 -06:00
c070e0864c Fix missing license file from last commit 2022-02-11 18:08:32 +01:00
8fb2926a53 Cycles: show Metal device in preferences also on Intel Macs
In anticipation of enabling AMD Metal support.

Ref D14090, T92212
2022-02-11 17:51:55 +01:00
9cfc7967dd Cycles: use SPDX license headers
* Replace license text in headers with SPDX identifiers.
* Remove specific license info from outdated readme.txt, instead leave details
  to the source files.
* Add list of SPDX license identifiers used, and corresponding license texts.
* Update copyright dates while we're at it.

Ref D14069, T95597
2022-02-11 17:47:34 +01:00
7434b83948 Fix (studio-reported) liboverrides potential infinite loop in hierarchy root doversion.
Drivers make it way too easy to create dependenciy loops between IDs, so
need to use the same trick as in other dependency-following code in this
file to prevent those infinite loops.

hard to predict for sure how bad of a hierarchy root this can end up
producing, but in general cases think this should be OK.
2022-02-11 16:12:28 +01:00
41ef1ac2da Merge branch 'blender-v3.1-release' 2022-02-11 15:36:05 +01:00
9ac1735205 Fix Cycles compilation on 32bit ARM platform
The rbit instruction is only available starting with ARMv6T2 and
the register prefix is different from what AARCH64 uses.

Separate the 32 and 64 bit ARM branches, add missing ISA checks.

Made sure the code works as intended on macMini with Apple silicon,
and on Raspberry Pi 4 B running 32bit Raspbian OS.

Differential Revision: https://developer.blender.org/D14056
2022-02-11 15:27:29 +01:00
Bastien Montagne
1695d38989 LibOverride: Add partial resync.
Reduce compute effort of liboverrides resync process by only re-syncing
the parts of the override hierarchy that actually need it.

The main change compared to existing code (which was systematically resyncing
a whole override hierarchy), is that resyncing now operates over several
sub-hierarchies at once, each defined by their own 'resync root' ID.
This ensures that we do not get several new overrides for the same data inside
of the same hierarchy.

Implements T95682.

Differential Revision: https://developer.blender.org/D14079
2022-02-11 15:18:32 +01:00
e6f3bb984b Merge branch 'blender-v3.1-release' 2022-02-11 14:55:42 +01:00
Jeroen Bakker
a71a513def Remap multiple items in referenced data.
This patch increases the performance when remapping data.
{D13615} introduced a mechanism to remap multiple items in a single go.
This patch uses the same mechanism when remapping data inside ID datablocks.

Benchmark results when loading the village scene of sprite fright on AMD Ryzen 7 3800X 8-Core Processor
Before this patch 115 seconds
When patch applied less than 43 seconds

There is still some room for improvement by porting relink code.

Reviewed By: mont29

Maniphest Tasks: T95279

Differential Revision: https://developer.blender.org/D14043
2022-02-11 14:53:33 +01:00
811cbb6c0a Helper functions for IDRemapper.
Adds helper functions to debug IDRemapper data structure.

`BKE_id_remapper_result_string` converst a given IDRemapperApplyResult
to a readable form for logging purposes.
`BKE_id_remapper_print` prints out the rules inside a IDRemapper struct.
2022-02-11 14:49:47 +01:00
f691d4553b Docs: add license text files for all SPDX identifiers 2022-02-11 14:48:32 +01:00
6ec83afb1d Cycles: refactor to keep session thread alive for duration of session
Instead of creating and destroying threads when starting and stopping renders,
keep a single thread alive for the duration of the session. This makes it so all
display driver OpenGL resource allocation and destruction can happen in the same
thread.

This was implemented as part of trying to solve another bug, but it did not
help. Still I prefer this behavior, to eliminate potential future issues wit
graphics drivers or with future Cycles display driver implementations.

Differential Revision: https://developer.blender.org/D14086
2022-02-11 14:35:10 +01:00
e2728a0056 Fix T95420: Cycles crash with stereo render and tiles
For reasons unclear, destroying and then recreating a vertex buffer in the
render OpenGL context is affecting the immediate mode vertex buffer in the
draw manager OpenGL context.

Instead just create a single vertex buffer and use it for the lifetime of
the render OpenGL context. There's not really any need to have a separate
one per tile as far as I can tell.

Differential Revision: https://developer.blender.org/D14084
2022-02-11 14:35:10 +01:00
6175c569f9 Tests: enable full Cycles Metal device regression tests on buildbot
Now that all tests are passing. This does add about 5 minutes to the macOS
builds on buildbot.

Ref T92212
2022-02-11 14:35:10 +01:00
fcec55796e Cycles: support rendering attributes for Curves objects
This adds support for exporting attributes from a Blender Curves object to Cycles.
The implementation follows that of the Mesh object. This also creates motion blur
data if the "velocity" attribute is present on the Curves.

Ref T94193

Reviewed By: brecht

Maniphest Tasks: T94193

Differential Revision: https://developer.blender.org/D14088
2022-02-11 13:49:00 +01:00
cc6ddfbf68 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-02-11 13:48:09 +01:00
2496a94384 Fix T95698: deadlock with GPU subdivision
Multithreaded tasks have to be isolated when holding a mutex, which was
missing for the generation of the subdivision wrapper.
2022-02-11 13:45:12 +01:00
a816eaa1ce Cleanup: add descriptions to the IDRemapperApplyOptions. 2022-02-11 12:54:49 +01:00
2d231f837a Merge branch 'blender-v3.1-release' 2022-02-11 20:51:27 +09:00
675f38aca7 Fix excessive re-creation of VR viewport textures
Due to the freeing and re-creation of textures performed when binding
offscreen viewports, VR viewport textures would be needlessly
re-created every drawing iteration, leading to a negative impact on VR
frame rate.

This was brought to light by 6738ecb64e, which introduced an
additional texture clear operation on initialization and was
prohibitively costly on some systems when performed every frame.

Now, the textures for VR viewports will not be always re-created
during offscreen binding, but only when necessary using a pre-drawing
step (`wm_xr_session_surface_offscreen_ensure()`).

Reviewed By: jbakker, fclem

Differential Revision: https://developer.blender.org/D14059
2022-02-11 20:46:55 +09:00
2cad80cbc4 Fix incompatible swapchain format for Quest 2
When using a RGBA16 (`GL_RGBA16`, `DXGI_FORMAT_R16G16B16A16_UNORM`)
swapchain format with Quest 2, no image is presented to the headset.
This can occur when using the SteamVR runtime with an AMD graphics card
(ex. T95374).

Workaround is to move this format after the Quest 2-compatible RGBA16F
formats in the candidates list so that the RGBA16F formats are chosen
instead.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14024
2022-02-11 20:46:38 +09:00
4fbd00e04c Fix T94268: Closing SteamVR and restarting VR Session crashes Blender
Crash was caused since the function pointers
`s_xrGetOpenGLGraphicsRequirementsKHR_fn`/
`s_xrGetD3D11GraphicsRequirementsKHR_fn` were static and were not
updated with the correct proc address after being set the first time.

As stated in the OpenXR spec: "function pointers returned by
xrGetInstanceProcAddr using one XrInstance may not be valid when used
with objects related to a different XrInstance".

Although it would seem reasonable that the proc address would not
change if the instance was the same (hence the `static XrInstance s_instance;`),
in testing, repeated calls to `xrGetInstanceProcAddress()`
with the same instance still can result in changes (at least for the
SteamVR runtime) so the workaround is to simply set the function pointers
every time, essentially trivializing their `static` designations.

Reviewed By: Severin

Maniphest Tasks: T94268

Differential Revision: https://developer.blender.org/D14023
2022-02-11 20:46:26 +09:00
fd98241cb8 Merge branch 'blender-v3.1-release' 2022-02-11 12:26:33 +01:00
b38f40e904 Geometry Nodes: show indicator when realize instances node is in legacy mode
For the majority of node groups created in Blender 3.0 the behavior does not change.
So far we only found a single file where this setting has an effect.

Differential Revision: https://developer.blender.org/D14078
2022-02-11 12:24:07 +01:00
f19585656f Fix compile warnings.
We should change the API of ntree so we can check with a const. I added
this as a todo for now and used a const cast.
2022-02-11 10:28:59 +01:00
Jeroen Bakker
bccdb143db Refactoring of BKE_library_id_can_use_idtype to use filter_id.
For an upcoming project we would want to match multiple id types in a
single go. To not replicate the implementation using other types we
introduce `BKE_library_id_can_use_filter_id` that returns all supported
types as a filter.

Not all ID types have a filter_id (ID_LI, ID_KE, ID_SCR) These
exceptions are not available in the filter_id function.

Reviewed By: mont29

Maniphest Tasks: T95279

Differential Revision: https://developer.blender.org/D14061
2022-02-11 08:24:33 +01:00
9118cdfff3 File headers: use SPDX license for key-maps 2022-02-11 16:55:49 +11:00
cec0c65c0f License: add GPL-3.0-or-later identifier
Some add-ons use this.
2022-02-11 16:27:17 +11:00
fe55789b6f File headers: manually convert files to use SPDX headers
Also add BSD-2-Clause to SPDX license list.
2022-02-11 15:15:49 +11:00
281ba8a063 File headers: add missing copyright, add MIT to SPDX licenses 2022-02-11 14:56:03 +11:00
f7bbec290d File headers: add license to Python scripts 2022-02-11 14:30:21 +11:00
1df8a5f8fb File headers: use SPDX license for CMake files 2022-02-11 14:23:56 +11:00
9802d50c6b File headers: use SPDX for Zlib license 2022-02-11 14:23:55 +11:00
bff0cf1030 Cleanup: remove white-space before headers 2022-02-11 14:23:54 +11:00
7946f34d64 GNUmakefile: add check_licenses target
This reports files that don't include SPDX headers.
Optionally showing unique headers which is useful to see
irregular/nonstandard headers.
2022-02-11 14:22:27 +11:00
0247dcde65 Cleanup: Remove unused mesh mask definitions
Maintaining and understanding these can be a burden,
so the fewer we have, the better. These particular masks
haven't been used for years.
2022-02-10 21:03:59 -06:00
467c16eab1 Remove New from new obj exporter menu. 2022-02-10 19:32:30 -05:00
355dc28f72 Merge branch 'blender-v3.1-release' 2022-02-10 19:24:43 -05:00
4d29ec42bc Revert "Split Python OBJ importer and exporter, enabling only the importer."
This reverts commit ff9dc1986e.
2022-02-10 19:21:32 -05:00
0263c8238b Remove 'New' from new Obj exporter menu entry. 2022-02-10 19:00:40 -05:00
f39698de77 Revert "Split Python OBJ importer and exporter, enabling only the importer."
This reverts commit ff9dc1986e.
2022-02-10 18:29:29 -05:00
c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
1a705fa139 Cleanup: clang-format 2022-02-11 09:14:35 +11:00
2cc4747443 Cleanup: Clang tidy
Mismatched parameter names and else after return.
2022-02-10 15:53:37 -06:00
40e8b9775d Fix: Missing changes in recent "Curves" rename
More missing changes in fe1816f67f. This will hopefully fix a
Python API docs build error, and fixes the "Object Types Visibility"
popover.
2022-02-10 15:51:26 -06:00
75bcc096a1 License: add Apache-2.0 to doc/license
Include this as it's used the source/ directory.
2022-02-11 08:50:46 +11:00
Henrik Dick
6804ab2381 Merge branch 'blender-v3.1-release' 2022-02-10 22:39:38 +01:00
Henrik Dick
39bac58cdf Fix: Enable edge bevel weight in solidify if needed
Complex Solidify creates edge bevel weights on the rim if the
according vertex has some vertex bevel weight. If there are no
edge bevel weights, they were left disabled even if vertex bevel
weights are used.
2022-02-10 22:29:10 +01:00
Henrik Dick
5cac5a1a69 Fix: Bevel vertex didn't use weights in some cases
Bevel Vertices did not use vertex/bevel weights if the Width Type
was set to Width or Depth.
2022-02-10 22:14:02 +01:00
516781da80 Fix: Incorrect size used for reading curves data
Copy and paste mistake in fe1816f67f
2022-02-10 11:45:15 -06:00
29674d5e78 Merge branch 'blender-v3.1-release' 2022-02-10 11:34:20 -06:00
88ff5e5fb9 Fix T95458: Line art ignores curve objects with no evaluated mesh
Some curve objects don't have an evaluated mesh at all, but line art
currently assumes that all curve objects have one before converting
it to a mesh internally. Fix this by checking if the curve object has an
evaluated mesh before skipping it.

The remaining problem is that evalauted from non-mesh objects or
evaluated curves from non-curve objects, etc. will be ignored if
"Allow Duplicates" is off. That's a different problem though.

Differential Revision: https://developer.blender.org/D14036
2022-02-10 11:33:36 -06:00
a44366a642 Cycles: Expose "Use MetalRT" checkbox
For curve-heavy scenes, memory consumption regressed when we switched from MetalRT to bvh2. Allow users to opt in to MetalRT to workaround this.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14071
2022-02-10 17:32:46 +00:00
35dedc11d5 Fix T95477: Report error instead of crashing when Metal texture size limits exceeded.
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14074
2022-02-10 17:06:29 +00:00
3d12dd59ce Cycles: Workaround for failing "bake" unit tests in Metal
Allocate "RenderBuffers" with MTLResourceStorageModeShared.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14073
2022-02-10 17:05:13 +00:00
410e4e7ce1 Workaround for T94142: Cycles Metal crash with simultaneous viewport and final render
Disable binary archives on Apple Silicon (issue stems from instancing multiple PSOs from the same binary archive). Pipeline creation still filters through the OS shader cache, mitigating any impact on setup times after the initial render.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D14072
2022-02-10 17:04:08 +00:00
25c4000796 Fix T95613: remove anonymous attributes when converting object
This is the same behavior as when applying a geometry nodes modifier
that adds anonymous attributes.
2022-02-10 18:03:37 +01:00
22c60ac8b1 Cleanup: Remove defenition for unused flag 2022-02-10 11:00:47 -06:00
7682d7de04 Refactor: Move PBVH update tag out of MVert
This is part of the project of converting `MVert` into `float3`.
(more details in T93602), The pbvh update flag is removed and
replaced with a bitmap stored in the PBVH structure. This
patch is similar to D13878. This is mainly setup for an eventual
performance improvement by removing the extra data from
mesh vertices, but if it's consistent with testing in the other patch
doing the same thing for another "temp tag", then it may actually
increase the speed of sculpt code slightly, since less memory needs
to be loaded when checking/changing the flags.

Differential Revision: https://developer.blender.org/D14000
2022-02-10 10:59:20 -06:00
2cd1472f86 Merge branch 'blender-v3.1-release' 2022-02-10 17:32:16 +01:00
720d653b41 Fix T95624: video texture not refreshing when changing offset in node
The main issue is that the image and image user is not updated correctly
in `rna_ImageUser_update`. `BKE_image_user_frame_calc` does not set the
correct frame, because the image is null. Also `IMA_GPU_REFRESH` is not
set for the same reason.

When gpu materials are first created, it is expected that the frame is set
correctly, and the flag is set if necessary. Therefore, somewhere during
depsgraph evaluation, those have to be updated. The depsgraph node
to do the update existed already. Now there is a new relation so that it is
executed when the node tree changed, not only when the frame changed.
2022-02-10 17:31:25 +01:00
9a2b206639 Minor cleanup: Use ID_IS_LINKED. 2022-02-10 17:30:07 +01:00
64dd6877aa Merge branch 'blender-v3.1-release' 2022-02-10 10:25:20 -06:00
c0674aa145 Fix T95334: Crash with no vertex normals in multires bake
This is partially caused by a stupid mistake in cfa53e0fbe
where I missed initializing the `vert_normals` pointer in
`MResolvePixelData`. It's also caused by questionable assumptions
from DerivedMesh code that vertex normals would be valid.

The fix used here is to create a temporary mesh with the data necessary
to compute vertex normals, and ensure them here. This is used because
normal calculation is only implemented for `Mesh` and edit mesh, not
`DerivedMesh`. While this might not be great for performance, it's
potentially aligned with future refactoring of this code to remove
`DerivedMesh` completely. Since this is one of the last places the data
structure is used, that would be a great improvement.

Differential Revision: https://developer.blender.org/D13960
2022-02-10 10:10:45 -06:00
d5a88f9bf4 Fix (unreported) over-resync from RNA detection code in linked cases.
While applying liboverrides on linked data, RNA code (in
`rna_property_override_check_resync`) would detect a lot of false positive
regarding IDs needing resync, because the temporary ID used to apply
overrides was always local, breaking the libraries comparison check.

NOTE: that whole 'apply liboverrides' code could use some refreshment,
it did not change much from initila version several years ago, we now
have better tools and control over non-main data.

But for now the 'trick' in that commit should do the job, ultimately
those temps IDs should never be put in Main at all.
2022-02-10 16:58:22 +01:00
ad77b52abc Correction to previous Clang strict warning commit
Need to only pop diagnostic if it was really pushed.

Pointed out by Aras Pranckevicius, thanks!
2022-02-10 16:05:11 +01:00
b73c265974 Merge branch 'blender-v3.1-release' 2022-02-10 16:04:50 +01:00
94f0230230 Fix T95666: Crash when attempting multires linear subdivide
The crash was happening when the mesh had loose edges.

Loose edges are not part of OpenSubdiv topology and hence should not be
communicated to the refiner. Pass ta boolean flag indicating whether an
edge is loose or not in the mesh foreach routines, which seems to be
the easiest way.
2022-02-10 15:51:19 +01:00
e9c9a2183d LibOverride: Fix/improve handling of hierarchy root in tagged creation.
Decouple the reference (linked) root ID and the hierarchy (override) root ID.
Previous code was assuming that the reference ID was always also tagged
for override creation, which is true in current master, but cannot be
assumed in general (and won't be true with partial resync anymore).

Also add asserts to validate conditions that the reference/hierarchy_root
variables must meet.
2022-02-10 14:55:12 +01:00
d16e5babaf Merge branch 'blender-v3.1-release' 2022-02-10 14:12:35 +01:00
04d55038ee Fix size_t -> int -> size_t round trip in Cycles
There are two things achieved by this change:

- No possible downcast of size_t to int when calculating motion steps.
- Disambiguate call to `min()` which was for some reason considered
  ambiguous on 32bit platforms `min(int, unsigned int)`.
- Do the same for the `max()` call to keep them symmetrical.

On an implementation side the `min()` is defined for a fixed width
integer type to disambiguate uint from size_t on 32bit platforms,
and yet be able to use it for 32bit operands on 64bit platforms without
upcast.

This ended up in a bit bigger change as the conditional compile-in of
functions is easiest if the functions is templated. Making the functions
templated required to remove the other source of ambiguity which is
`algorithm.h` which was pulling min/max from std.

Now it is the `math.h` which is the source of truth for min/max.
It was only one place which was relying on `algorithm.h` for these
functions, hence the choice of `math.h` as the safest and least
intrusive.

Fixes 32bit platforms (such as i386) in Debian package build system.

Differential Revision: https://developer.blender.org/D14062
2022-02-10 12:39:41 +01:00
87d2de88fd Fix T95664: missing update after changing active output node 2022-02-10 12:07:48 +01:00
e2befa425a GPencil: Update-on-write using update cache
This implements the update cache described in T95401.

The cache is currently only used for drawing strokes and
sculpting (using the push brush).
**Note: Making use of the cache throughout grease pencil will
have to be done incrementally in other patches. **

The update cache stores what elements have changed in the
original data-block since the last time the eval object
was updated. Additionally, the update cache can store multiple
updates to the data and minimizes the number of elements
that need to be copied.

Elements can be tagged using `BKE_gpencil_tag_full_update` and
`BKE_gpencil_tag_light_update`. A full update means that the element
itself will be copied but also all of the content inside. E.g. when a
layer is tagged for a full update, the layer, all the frames inside the
layer and all the strokes inside the frames will be copied.
A light update means that only the properties of the element are copied
without any of the content. E.g. if a layer is tagged with a light
update, it will copy the layer name, opacity, transform, etc.

When the update cache is in use (e.g. elements have been tagged) then
the depsgraph will not trigger a copy-on-write, but an update-on-write.
This means that the update cache will be used to determine what elements
have changed and then only those elements will be copied over to the
eval object.

If the update cache is empty or the data block was tagged with a full
update, we always fall back to a copy-on-write.

Currently, the update cache is only used by the active depsgraph. This
is because we need to free the update cache after an update-on-write so
it's reset and we need to make sure it is not freed or read by other
depsgraphs.

Co-authored-by: @yann-lty
This patch was contributed by The SPA Studios.

Reviewed By: sergey, antoniov, #dependency_graph, pepeland, mendio

Maniphest Tasks: T95401

Differential Revision: https://developer.blender.org/D13984
2022-02-10 11:35:56 +01:00
84f30ac3a2 Deps: upgrade OpenXR 1.0.17 -> 1.0.22
Simple upgrade of OpenXR to 1.0.22, following the steps from
https://wiki.blender.org/wiki/Source/OpenXR_SDK_Dependency and
rBb69ab42982a1. No changes to Blender code were necessary, only a version
bump.

The primary motivation for this upgrade is to utilize the
`XR_HTCX_vive_tracker_interaction` extension introduced in ver. 1.0.20.
However, the latest release (1.0.22) also adds a number of potentially
useful extensions such as:
- `XR_FB_render_model`
- `XR_HTC_facial_expression`
- `XR_HTC_vive_focus3_controller_interaction`

Ref T95206

Reviewed By: LazyDodo, sybren, mont29

Maniphest Tasks: T95206

Differential Revision: https://developer.blender.org/D13950
2022-02-10 19:15:29 +09:00
Brad Clark
26740aaf51 Fix T84486: NLA, disable "Sync Length" after split
Turn off "Sync Length" when splitting an NLA strip.

The NLA Strip-Action Clip has a setting called "Sync Length" that is on
by default and helps to update the length of the clip to the current
actions keyframes so the strip shows the entire actions stored
animation.

When you split one of these strip-action clips in the NLA to trim it
shorter or to move it somewhere else in the NLA tracks to blend or work
with, the "Sync Length" setting stays checked on.  You can have many
strips in the NLA that all look to the same action, if you split one
strip , you now have two strips showing or linked to the same action.

To see or edit keyframes on a strip, you enter tweak mode. When you exit
tweak mode, if "Sync Length" is active on the strip-action clip
settings, the strip length is changed/reset to match the action keys.
When you have many clips, this causes all of them to evaluate and update
no matter where they are in the NLA.  This destroys/undoes all the user
work to trim down and place the clips in the NLA.

**Description of the proposed solution:**

This patch/change would turn off, the "Sync Length" setting when the
split tool was used on a strip/action clip to help protect the users
choice to trim and keep the clip that length. It doesn't change the
ability to turn the setting back on or off, it just makes sure that the
user doesn't accidentally or unknowingly loose work.

The same process happens when an action is created that has a "manual
range" set that is different than the length of the actions start-end
keyframes. It makes sense to do the same thing for the split tool.

**Alternative solutions:**

While the user could know this and turn off this setting by hand, it is
easy to forget and or the user might think that it only happened to the
one clip they were editing and not realize it happened to all the
trimmed versions, changing the users choice without the user knowing it
happened.

**Limitations of the proposed solution:**

It only fixes the split tool, if another tool was created and some how
impacted the clip length we would need to have that tool also take the
sync length into account.

Reviewed By: sybren

Maniphest Tasks: T84486

Differential Revision: https://developer.blender.org/D10168
2022-02-10 11:08:00 +01:00
9e9355190c Fix compilation with strict Clang flags
There is no `-Wformat-truncation` warning in Clang, so tweak checks
around diagnostics pragma accordingly.
2022-02-10 10:55:50 +01:00
8c18b16829 Merge branch 'blender-v3.1-release' 2022-02-10 10:48:06 +01:00
5312cf50a1 Fix strict warning initializing texture result in compositor
From a strict language point of view the code required a braces around
`trgba` initialization. But it is easier to rely on the fact that fields
which are not specified are zero-initialized.
2022-02-10 10:46:06 +01:00
507a4deef1 Fix invalid creation of partial image updater 2022-02-10 10:42:25 +01:00
e6ad11f06d Cleanup: quiet warnings including RE_pipeline.h directly 2022-02-10 16:45:54 +11:00
c824c06f38 Cleanup: Clang tidy, unused variabel warnings 2022-02-09 23:07:48 -06:00
2887df119c Fix: Complete curves renaming missed in previous commit
This made cycles not render curves. Missed in fe1816f67f
2022-02-09 17:56:19 -06:00
fe80ff446f Cleanup: copyright in headers, spelling in comments
- Order year consistently.
- Minor consistency (case, double-spacing).
- Correct typos.
2022-02-10 10:25:06 +11:00
58761eb11a GNUmakefile: move editor settings to .editorconfig
Remove inline vim/emacs editor configuration,
add makefile to editorconfig instead.
2022-02-10 09:20:34 +11:00
7b0174ef81 Cleanup: remove overly detailed contact info, correct md5 copyright
Also remove copyright text with no assignment.
2022-02-10 09:05:40 +11:00
e420514892 Merge branch 'blender-v3.1-release' 2022-02-09 11:06:34 -06:00
d1202bd641 Fix T95620: Crash When Entering Edit Mode on a Curve
Under some circumstances, simply adding a curve object and going
to edit mode would cause a crash. This is because the evaluated
`CurveEval` was accessed but also freed by the dependency graph.

The fix reverts the part of b76918717d that uses the
`CurveEval` for the curve object bounds. While this isn't ideal,
it was the previous behavior, and some unexpected behavior
with object bounds is much better than a crash. Plus, given the plans
of using the new "Curves" data-block for evaluated curves, this
situation will change relatively soon anyway.
2022-02-09 11:06:10 -06:00
6e14be858c Merge branch 'blender-v3.1-release' 2022-02-09 16:16:34 +01:00
c69ee218d7 Revert "Fix size_t -> int -> size_t round trip in Cycles"
This reverts commit d74bb7be19.

Need to re-iterate to have a proper support of all platforms.
2022-02-09 16:16:21 +01:00
3e67831d3f VSE: Fix sound strip not aligned with movie strip
Strip aligning wasn't done when length of 2 strip is equal, but since
these strips are aligned according to position in stream this can
produce offset.
2022-02-09 16:06:56 +01:00
e098a29606 Merge branch 'blender-v3.1-release' 2022-02-09 15:54:41 +01:00
7313a84c5a Fix T95612: only overwrite existing attributes with matching domain and type
Also fixes T95611 and T95610.

Differential Revision: https://developer.blender.org/D14051
2022-02-09 15:50:03 +01:00
669d3bbad6 Merge branch 'blender-v3.1-release' 2022-02-09 14:46:00 +01:00
d74bb7be19 Fix size_t -> int -> size_t round trip in Cycles
There are two things achieved by this change:

- No possible downcast of size_t to int when calculating motion steps.
- Disambiguate call to min() which was for some reason considered
  ambiguous on 32bit platforms `min(int, unsigned int)`.

On an implementation side the `min()` is defined for a fixed width
integer type to disambiguate uint from size_t on 32bit platforms,
and yet be able to use it for 32bit operands on 64bit platforms without
upcast.

Fixes 32bit platforms (such as i386) in Debian package build system.

Differential Revision: https://developer.blender.org/D13992
2022-02-09 14:45:39 +01:00
3577ccc9c0 Cleanup: Add newline in error message.
Increases readability during debugging.
2022-02-09 14:09:04 +01:00
6345032a49 Cleanup: non-standard license formatting, minor changes 2022-02-09 23:57:12 +11:00
312d6925c4 Cleanup: make file headers more consistent
Also some descriptive text into doc-strings.
2022-02-09 23:47:34 +11:00
b4700a13c6 VSE: Use float for transformation offset
When image position is animated, float makes movement look smoother.
2022-02-09 13:42:58 +01:00
7c10e364b2 BLI: wrap parallel_invoke from tbb 2022-02-09 13:08:04 +01:00
3f061ef050 Merge branch 'blender-v3.1-release' 2022-02-09 12:38:08 +01:00
d82384f7e1 Fix T95640: missing null check in previous commit 2022-02-09 12:36:49 +01:00
312c8fdaf9 Cleanup: Better naming in lib_remap.
Renames is_never_null to violates_never_null.
2022-02-09 11:44:14 +01:00
Alaska
fd6506626b Adjust "Show Backface" tool tip to be more accurate
Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13849
2022-02-09 11:28:39 +01:00
Alaska
d3d9e2abbf Fix small grammatical mistake in Refraction Depth tooltip
Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D13850
2022-02-09 11:26:21 +01:00
bfacb22a93 Merge branch 'blender-v3.1-release' 2022-02-09 11:20:51 +01:00
06ac599261 Fix T91840: do not create invalid links when inserting a node
Differential Revision: https://developer.blender.org/D14050
2022-02-09 11:19:23 +01:00
Colin Basnett
6f01758b47 Added a "Sharpen Less" kernel for the Filter Compositor node
Added a new "Sharpen Less" kernel to the filter compositor node. The intent here is to provide a much less aggressive sharpening filter that can't simply be solved by toning down the factor on the existing sharpen filter.

The existing "Sharpen" filter uses a "box" kernel:

```
-1 -1 -1
-1  9 -1
-1 -1 -1
```

The new "Sharpen Less" filter uses a "diamond" kernel:

```
 0 -1  0
-1  5 -1
 0 -1  0
```

The difference between the two is clear to see in the following side-by-side:

{F12847431}

Below shows the difference between the filtering kernels as applied to a B&W render of Suzanne with the UV grid as a texture. The left side of the render using the existing "Sharpen" filter, and the right side showing the new "Sharpen Less" filter. Notice that the left side is more aggressive in accentuating localized contrasts across the image. This can lead to what appears to be aliasing or striations in the resulting image:

{F12847429}

https://developer.blender.org/T95275
https://blender.community/c/rightclickselect/57Kq/?sorting=hot
{F12847428}

Reviewed By: #compositing, jbakker

Differential Revision: https://developer.blender.org/D14019
2022-02-09 10:28:00 +01:00
81da638c44 Cleanup: move file descriptions into doxygen file section
Continuation of 19100aa57d.
2022-02-09 18:33:29 +11:00
19100aa57d Cleanup: move file descriptions into doxygen file section
Also other minor corrections & reformat particle system copyright.
2022-02-09 18:10:43 +11:00
2c7f2a0ba4 Cleanup: simplify copyright headers for sequence & imbuf 2022-02-09 16:47:15 +11:00
68a21697be Cleanup: remove "The Original Code is: ..." from code comments
This is almost always meaningless as most code has changed
since the comment was added. Besides this, version control can be used
to check if/when a file was modified.

Some cases of this were kept when they contain details
about the original copyright holder.
2022-02-09 16:04:31 +11:00
59a7095f79 Cleanup: use consistent copyright location, move descriptions
Order copyright immediately after the license block,
this was done almost everywhere with a few exceptions.

Remove authors from a few files (we had already removed "Contributors"
section however with old patches being applied this gets added back in).

Also move descriptive text into the doxygen comment block under \file.
In some cases remove the text as it was accidentally copied.
2022-02-09 16:00:16 +11:00
Shrey Aggarwal
f021d46752 Cleanup: GHOST_ISystem::toggleConsole API
GHOST_ISystem::toggleConsole had a somewhat misleading name
it could be fed 4 different values, so it was not as much a
toggle as a set console window state.

This change renames `toggleConsole` to a more appropriately
named `setConsoleWindowState` and replaces the integer it had
to an enum so it's easy to tell what is being asked of it at
the call site.

Reviewed By: LazyDodo
Differential Revision: https://developer.blender.org/D14020
2022-02-08 17:40:48 -07:00
Paolo Acampora
452a7f6731 Fix T91871: Symmetrize Armature on custom bone shape
Symmetrize Armature now also symmetrizes the transform of custom bone
shapes.

Adds a new property to `bpy.ops.armature.symmetrize`:

//Parameters//:

- **direction **(enum in ['NEGATIVE_X', 'POSITIVE_X'], (optional)) –
  **Direction**, Which sides to copy from and to (when both are selected)

- **custom_shape **(enum in ['SYMMETRIZE_SAME', 'SYMMETRIZE_ALL',
  'SYMMETRIZE_NONE'], (optional)) – **Custom Shapes**, Wether to
  symmetrize non symmetric custom bone shapes, all custom shapes, or
  none at all

//Rationale//:

Reviewed By: #animation_rigging, Mets, sybren

Maniphest Tasks: T91871

Differential Revision: https://developer.blender.org/D13416
2022-02-08 18:09:48 +01:00
55c90df316 BLF: Enable Filtering of woff and woff2 Fonts
Add files with extension ".woff" and ".woff2" to FILE_TYPE_FTFONT
file type. Allows selecting and using these types of font files.

See D13822 for more details.

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

Reviewed by Campbell Barton
2022-02-08 08:43:01 -08:00
5d9d2565d2 Cleanup: simplify DNA genfile casting
Avoid using the uint64_t as an intermediate cast since it complicates
behavior for signed types (which first need to be cast to an int64_t).

Assign both old_value_i & old_value_f from the original value to avoid
the need for different handling of signed/unsigned types.

Reviewed By: JacquesLucke

Ref D14039
2022-02-08 22:52:46 +11:00
460d1a4cb3 Eevee: support the no-op Bump node optimization like in Cycles.
A Bump node without a Height input is meaningless and does nothing.
As such, it is available as an old workaround that allows making Node
Group inputs that default to normal when not connected, by routing
via a no-op Bump node before doing math.

Cycles specifically recognizes this use case and either bypasses
the node, or converts it into a Geometry Normal node, but Eevee
was still evaluating it as usual. That incurred performance cost,
and also normalized the vector unlike Cycles.

This implements the same bypass logic for Eevee. Since I'm not
sure if it's possible to totally remove the node at this stage,
it emits a no-op function call to copy the input vector.

Differential Revision: https://developer.blender.org/D14045
2022-02-08 14:37:25 +03:00
3267c91b4d Fix T91253: Slow pose bone selection with many bones
Viewport cull bones during selection to avoid depth-picking
reading the depth buffer for bones that aren't in the viewport.

Files with thousands of bones could hang blender for seconds while
selecting. The issue could still happen with overlapping bones or when
zoomed out so all bones are under the cursor, however in practice this
rarely happens.

Now files with many bones select quickly.

Related changes include:

- Split `BKE_pchan_minmax` out of `BKE_pose_minmax`.
- Add `mat3_to_size_max_axis` to return the length of the largest
  axis (used for scaling the radius).

Reviewed By: sybren

Maniphest Tasks: T91253

Ref D13990
2022-02-08 22:16:51 +11:00
530be35516 Merge branch 'blender-v3.1-release' 2022-02-08 12:13:24 +01:00
de71860555 Fix T95570: missing task isolation when computing normals 2022-02-08 12:12:49 +01:00
923ccf6b10 LibOverride: Use new 'hierarchy root' info in relevant override code.
This new info simplifies greatly the handling of resync and deleting
liboverride hierarchies, and makes those operations more robust to
complex dependencies cases between different hierarchies.

Related to T95283.
2022-02-08 11:22:56 +01:00
98c242affd LibOverride: Add 'hierarchy root ID' info.
This change will make handling of liboverrides hierarchies (especially
resyncing) much easier and efficient. It should also make it more
resilient to 'degenerate' cases, and allow proper support of things like
parenting an override to another override of the same linked data (e.g.
a override character parented to another override of the same
character).

NOTE: this commit only implements minimal changes to add that data and
generate it for existing files on load. Actual refactor of resync code
to take advantage of this new info will happen separately.
2022-02-08 10:51:31 +01:00
32278b79a8 LibOverride: Add 'hierarchy root ID' info.
This change will make handling of liboverrides hierarchies (especially
resyncing) much easier and efficient. It should also make it more
resilient to 'degenerate' cases, and allow proper support of things like
parenting an override to another override of the same linked data (e.g.
a override character parented to another override of the same
character).

NOTE: this commit only implements minimal changes to add that data and
generate it for existing files on load. Actual refactor of resync code
to take advantage of this new info will happen separately.
2022-02-08 10:50:39 +01:00
0617efd51b Merge branch 'blender-v3.1-release' 2022-02-08 10:26:42 +01:00
1995aae6e3 Fix T94415: Nodes: poor selection behavior inside frame nodes
Previously, node selection made no distinction between a frame node and
other nodes. So a frame node would be selected by their whole rect or
center (depending on box/lasso/circle select). As a consequence of this,
box and lasso could not pratically be started inside a frame node (with
the intention to select a subset of contained child nodes) because the
frame would be selected immediately and tweak-transforming started.
Circle selecting would always contain the frame node as well (making
transforming a subset of nodes without also transforming the whole frame
impossible).

Now change selection behavior so that for all selection modes only the
border [the margin area that is automatically added around all nodes,
see note below] of a frame node is considered in selection. This makes
for a much more intuitive experience when arranging nodes inside frames.

note: to make the area of interest for selection/moving more obvious,
the cursor changes when hovering over (as is done for resizing).
note: this also makes the resize margin consistent with other nodes.
note: this also fixes right resize border (was exclusive instead of
inclusive as every other border)

Also fixes T46540.
2022-02-08 10:14:14 +01:00
67c12ed765 Cleanup: remove useless statement.
Layouts are active by default when created, no need to set this
explicitely. Leftover from proxy removal.
2022-02-08 09:16:49 +01:00
8abd8865d2 Mesh: add option to select vertices by similar vertex crease
This adds an option to the "Select Similar" operator in edit mode to
select vertices based on vertex crease similarity. The implementation
follows that of the edge crease, with a 1-dimensional KD-tree used to
store and retrieve vertex indices base on crease values.

To maintain compatibility with old files (scripts), the `SIMEDGE_CREASE`
enumeration identifier remains `CREASE`, while the one for the new
`SIMVERT_CREASE` is `VCREASE` to follow the naming convention of other
enum values.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D14037
2022-02-08 06:10:22 +01:00
Dominik Fill
7047bd41c6 UI: Change computation of node socket position to align with label
This Diff changes the computation of the input and output socket
position to being always aligned with its corresponding label.

Reviewed By: campbellbarton

Ref D14025
2022-02-08 14:55:02 +11:00
667b4bc0e4 Cleanup: clang-format 2022-02-08 14:25:31 +11:00
9d674d9852 Fix dna_genfile error converting signed int types to floating point
Regression in 51befa4108
caused negative values to overflow into a uint64_t.

Resolve by casting to a signed int from originally signed types.

This caused D14033 not to work properly.
2022-02-08 11:54:44 +11:00
7df651367f Cleanup: use an intermediate value for cast_primitive_type
Assign the actual value before casting to large uint64_t/double types.

This improves readability, especially in cases where both pointer
and integer casts were used in one expression, to make matters worse
clang-format treated these casts as a multiplication.

This also made debugging/printing the values more of a hassle.

No functional changes (GCC produced identical output).
2022-02-08 11:54:44 +11:00
e5fc579073 Merge branch 'blender-v3.1-release' 2022-02-07 18:42:58 -06:00
b76918717d Fix T95573: Incorrect bounding box of evaluated curve
Account for `CurveEval`, which stores the proper deformed and
procedurally created data, unlike the `nurb` list, which has always
just meant a copy of the original curve.

Also account for the case when the curve is empty by using a -1, 1,
fallback bounding box in that case, just like mesh objects.
2022-02-07 18:42:31 -06:00
770793e545 Merge branch 'blender-v3.1-release' 2022-02-07 16:11:21 -06:00
Wannes Malfait
229d0ace02 Fix T95532: Merge node deletes everything for empty selections
The problem was that nullptr was returned which is a valid value for
Mesh * and hence the returned optional was treated as having some value.
There was no check for point clouds so that was fixed as well.

Differential Revision: https://developer.blender.org/D14026
2022-02-07 16:08:36 -06:00
11d785edea Fix T95502: macOS app has both python 3.9 and 3.10 executables 2022-02-07 20:51:03 +01:00
674e4640f6 Merge branch 'blender-v3.1-release' 2022-02-07 14:29:26 -05:00
Myles Walcott
880e85fc80 Cleanup: Grammar in doc/python_api
* Its -> It's
* Scripts -> Script's
* then -> than

Several phrasing grammar fixes.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D14021
2022-02-07 14:28:12 -05:00
fe1816f67f Curves: Rename "Hair" types, variables, and functions to "Curves"
Based on discussions from T95355 and T94193, the plan is to use
the name "Curves" to describe the data-block container for multiple
curves. Eventually this will replace the existing "Curve" data-block.
However, it will be a while before the curve data-block can be replaced
so in order to distinguish the two curve types in the UI, "Hair Curves"
will be used, but eventually changed back to "Curves".

This patch renames "hair-related" files, functions, types, and variable
names to this convention. A deep rename is preferred to keep code
consistent and to avoid any "hair" terminology from leaking, since the
new data-block is meant for all curve types, not just hair use cases.

The downside of this naming is that the difference between "Curve"
and "Curves" has become important. That was considered during
design discussons and deemed acceptable, especially given the
non-permanent nature of the somewhat common conflict.

Some points of interest:
- All DNA compatibility is lost, just like rBf59767ff9729.
- I renamed `ID_HA` to `ID_CV` so there is no complete mismatch.
- `hair_curves` is used where necessary to distinguish from the
  existing "curves" plural.
- I didn't rename any of the cycles/rendering code function names,
  since that is also used by the old hair particle system.

Differential Revision: https://developer.blender.org/D14007
2022-02-07 11:56:48 -06:00
b8c764c5d1 Merge branch 'blender-v3.1-release' 2022-02-07 18:45:24 +01:00
65d287a14a Fix T95543: incorrect handling of implicit field inputs in ui 2022-02-07 18:44:30 +01:00
d3e9d74a5f Merge branch 'blender-v3.1-release' 2022-02-07 18:17:29 +01:00
eb071e3d3c Fix: missing null check
This fixes https://github.com/JacquesLucke/animation_nodes/issues/1827.
2022-02-07 18:16:35 +01:00
2f7aecb6ce Merge branch 'blender-v3.1-release' 2022-02-07 17:57:01 +01:00
2f868e5647 Fix T95578: missing update when linking selected nodes
This removes a "narrow" update in `snode_autoconnect` in favor
of the more general update in `node_make_link_exec`.
2022-02-07 17:56:25 +01:00
Charlie Jolly
fe4e85a924 Nodes: Dynamic node class for Map Range node
This patch makes it possible to set the UI color of a node's
header bar and override the default from the node's typeinfo.

Currently the color is taken from the `.nclass`
member of the node's bNodeType->TypeInfo struct.
This is created once when registering the node.
The TypeInfo is used for both UI and non-UI functionality.
Since the TypeInfo is shared, the header bar for the node
can't be changed without changing all nodes of that type.

The Map Range node is shown as a `Converter` or blue color by default.
This patch allows this to be changed dynamically to `Vector` or purple.

This is done by adding a `ui_class` callback to node typeinfo struct.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13936
2022-02-07 15:39:39 +00:00
a7b5982030 Fix missing removal of proxy references in py scripts.
Reported by studio (Hjalti), thanks.
2022-02-07 16:23:26 +01:00
Shrey Aggarwal
a5dd1bc53d Fix T90868: Console window flash when exiting
If the console was hidden on windows, it would
be made visible during shutdown in an effort
not hide a potentially active interactive console
session. This however did not take in account
if blender was actually launched from an interactive
console causing the console window to briefly flash
during shutdown even when launched from the new
launcher, the brief flash concerned some users.

This change adjusts the behaviour to restore the
console only when blender was started from the
console.

Reviewed By: LazyDodo
Differential Revision: https://developer.blender.org/D14016
2022-02-07 08:20:12 -07:00
b3bb51dd83 Fix asset-view template ignoring "Asset Indexing" debug option
If the "Asset Indexing" option was disabled in Preferences > Experimental
> Debugging, the asset-view template (used by pose libraries for
example) would still use the indexing.
2022-02-07 12:18:15 +01:00
d9b1bd01f7 Merge branch 'blender-v3.1-release' 2022-02-07 11:13:06 +01:00
3cd686cae8 Fix UI messages (typos etc.). 2022-02-07 11:12:37 +01:00
Dimitry Kaplin
1c5f2e49b7 VSE: Add filter method to strip transform
Previously, nearest interpolation filter was used for preview, because
it offered good performance and bilinear was used for rendering. This
is not always desirable behavior, so filter method can now be chosen by
user. Chosen method will be used for preview and for rendering.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12807
2022-02-07 10:41:26 +01:00
6766699530 UV: use grey on black for dashed-line display
Dashed line display was changed since 2.7x, using white on black
instead of grey on black.

This made selection difficult to see as white is brighter
than the default selected color.

Match the grey used in 2.7x.
2022-02-07 15:50:42 +11:00
2b14aa0a39 Cleanup: spelling in comments 2022-02-07 15:33:10 +11:00
7e6066c9c3 Cleanup: clang-format 2022-02-07 15:32:34 +11:00
Henrik Dick
94866ef84f Fix Bevel intersection continuity.
This patch from Henrik Dick improves the continuity between the
grid forming corners and the edge polyons on multisegment bevels.
For details, see patch D13867.
2022-02-06 16:01:57 -05:00
f199f03994 Merge branch 'blender-v3.1-release' 2022-02-06 15:00:21 -05:00
Aras Pranckevicius
1d59a7aa77 Fix T95384: new obj exporter inaccurate roughness value in new exporter.
Fixes T95384. New exporter was missing a fix for T94516 that recently got applied to the python exporter.

Also changed the obj export tests code so that when save_failing_test_output is requested and MTL result is different from the golden expectation, it is saved as well, similar to how it's done for the OBJ file result.
2022-02-06 14:53:07 -05:00
Aras Pranckevicius
9261bc9476 Further speedup of new obj exporter.
This change from Aras further parallelizes wihin large meshes (the previous one
just parallelized over objects).

Some stats: on A Windows machine, AMD Ryzen (32 threads):

(one mesh) Monkey subdivided to level 6: 4.9s -> 1.2s (blender 3.1 was 6.3s; 3.0 was 49.4s).
(one mesh) "Rungholt" minecraft level: 8.5s -> 2.9s (3.1 was 10.5s; 3.0 was 73.7s).
(lots of meshes) Blender 3 splash: 6.2s -> 5.2s (3.1 was 48.9s; 3.0 was 392.3s).

On a Linux machine (Threadripper, 48 threads, writing to SSD):
Monkey - 5.08s -> 1.18s (4.2x speedup)
Rungholt - 9.52s -> 3.22s (2.95x speedup)
Blender 3 splash - 5.91s -> 4.61s (1.28x speedup)

For details see patch D14028.
2022-02-06 14:28:22 -05:00
96cda4da28 GLDebug: Wrap glDispatch function into our debug wrappers 2022-02-06 17:03:05 +01:00
e440691e89 Merge branch 'blender-v3.1-release' 2022-02-06 12:39:56 +01:00
8be20fcc61 GPU: Fix assert when running without --debug-gpu option on older GL
This was caused by rB3a90f93507a344d2b6eb3ae631371348ff977047
2022-02-06 12:39:17 +01:00
48fbf0baea DRW: Add preprocessor error if including common_view_lib.glsl without draw_view
This avoid making include mistake and potentially detect areas that do
not really need common_view_lib.glsl.
2022-02-06 01:25:46 +01:00
085a3662dd GPUShaderCreateInfo: Add duplication error checking of dependency merging
As of now we do not allow additional infos duplication. We could in the future
but for now assert that this is not the case.
2022-02-06 01:25:46 +01:00
153f2c20b2 Merge branch 'blender-v3.1-release' 2022-02-05 17:52:31 -06:00
59a8bdd48c Fix: Displaying any point cloud in the viewport causes crash
Caused by rBf75449b5f2b04b79, which was missing a null check when
attempting to extract a `CustomData` pointer from an mesh that might
be null if the object isn't a mesh object. The commit added null checks
elsewhere, so simply adding them here is a straightforward fix.

Fixes T95526, T95539
2022-02-05 17:52:04 -06:00
94c0a59f95 Merge branch 'blender-v3.1-release'
Also fixed conflicts due to the change in file writing in the new obj exporter
in master, and fixed one of the tests that was added in master but not 3.1.
2022-02-05 18:04:30 -05:00
Aras Pranckevicius
c24b2cdebf Fix T95360, new 3.1 obj exporter losing nurbs curve "endpoint".
The new wavefront .obj exporter in 3.1 was producing slightly invalid parm line syntax (missing u), and was not setting first/last N params to zeroes and ones for curves with "endpoint" flag properly.
2022-02-05 17:51:03 -05:00
bfe6e792c7 Merge branch 'blender-v3.1-release' 2022-02-05 23:09:09 +01:00
3a90f93507 GPU: Debug: Avoid double printing of compilation issues
To avoid that, we simply filter using a debug group.
2022-02-05 23:08:49 +01:00
26b70fce8a GPU: move gpu_shader_shared_utils.h to the public section of the module
This is then easier to include in other modules.
2022-02-05 22:42:34 +01:00
2ee81bf285 Merge branch 'blender-v3.1-release' 2022-02-05 22:18:51 +01:00
f2087dfc69 GPUTexture: Fix missing/wrong cases in to_data_format() 2022-02-05 19:29:45 +01:00
edc0e77afe GPU: Enable CLOG for gpu when --debug-gpu option is set
This is because all of the debug printing is done through CLog now. Without
it the is little point in this option.
2022-02-05 19:27:21 +01:00
7bdfce687b GL: Fix compute shader label error 2022-02-05 19:27:09 +01:00
cbd23a7304 DRW: Fix memory leak in UniformArrayBuffer 2022-02-05 13:59:46 +01:00
e5af6a0d0f GLShaderInterface: Fix SSBO using the ubo mask
This might head lead to a crash when a shader uses both ubo and ssbo.
2022-02-05 13:28:41 +01:00
835dd95046 BLF: Cleanup blf_glyph_cache_find & blf_font_size
Removes unnecessary calls to blf_glyph_cache_find, simplifies
blf_font_size, and reduces calls to it. blf_glyph_cache_new
and blf_glyph_cache_find made static.

See D13374 for more details.

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

Reviewed by Campbell Barton
2022-02-04 18:32:32 -08:00
b1cee36190 BLF: Default Size as Float
Allowing setting and storing of the default font size as float.

See D13230 for more details.

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

Reviewed by Campbell Barton
2022-02-04 18:05:25 -08:00
141da5dc03 Partially pevert "Fix error in b1b1a74af15b4eaa0757ad88acfbcac73b9a64fe"
This partially reverts commit 81d2eda2bf.

That commit introduced unrelated changes.
2022-02-04 23:00:43 -03:00
fbd5b85456 BLF: Removal of blf_font_draw_ascii Declaration
Removal of declaration of unused blf_font_draw_ascii

See D13624 for more details.

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

Reviewed by Campbell Barton
2022-02-04 17:55:50 -08:00
bb3bcf744c BLF: Save fixed_width value in cache
Cache the font size's ideal fixed width column size in the glyph cache
rather than the font itself to improve performance.

See D13226 for more details.

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

Reviewed by Campbell Barton
2022-02-04 17:49:21 -08:00
2a967d444f BLF: blf_glyph_cache_free Made Static
blf_glyph_cache_free does not need to be public.

See D13395 for more details.

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

Reviewed by Campbell Barton
2022-02-04 17:37:23 -08:00
81d2eda2bf Fix error in b1b1a74af1
`op` --> `op->customdata`
2022-02-04 22:12:07 -03:00
b1b1a74af1 Cleanup: set 'op->customdata' out of 'viewops_data_create'
Setting the `op->customdata` out of `viewops_data_create` makes the usage of the function clearer thus making the code easier to read.
2022-02-04 20:38:53 -03:00
ec9f237a9e Cleanup: merge functions with similar usage
`viewops_data_alloc` allocates and stores some pointers in
`ViewOpsData` while `viewops_data_create` reuses already stored
pointers and also stores others in `ViewOpsData`.

The similar names and usages can confuse and in this case it also
creates a dependency on the order in which these functions are called.

Merging these functions simplifies usage and deduplicates code.
2022-02-04 20:16:36 -03:00
f79c8e25f1 Cleanup: Grammar in comments and tooltips
- "own" -> "its own"
- "it's" -> "its"
- Use proper plural
2022-02-04 14:52:52 -06:00
0b4cf2984f Fix: Remove incorrect assert in mesh modifier evaluation
Since we have a node that sets a mesh's auto smooth angle
(unfortunately, in retrospect), we generally can't assume at all
that value is the same as whatever input mesh. Similar asserts
were removed previously in 8216b759e9. While the attempt
at assertions to clarify assumptions is noble, this one doesn't
make sense anymore.

I found this while investigating T95479.

Differential Revision: https://developer.blender.org/D14009
2022-02-04 14:19:04 -06:00
a5be935966 Fix uninitialized value in Cycles BVH after recent changes
Found by asan, unknown if it actually caused an issue.
2022-02-04 20:27:49 +01:00
dc85776b8b GLShader: Fix several low importance issues
- Fix image.format conversion to string
- Fix warnings about ARB_conservative_depth not found even if GL > 4.2
- Add `array(type)` define for portable array definition
2022-02-04 20:21:41 +01:00
c017820692 GPUShader: Improve error/warning logging experience
Thanks to the new `ShaderCreateInfo` we now include source files without
any modification. This let us query which are the source files passed to the
`print_log` function. The log will now include a file with row and column
number which is interpreted as a link in most IDE.

DEBUG_CONTEXT_LINES will add more lines around the error lines for more
context. This is also useful if the error line is imprecise (because of
driver bugs) and the reported line is not sufficient to know the location
of the error.

The DEBUG_DEPENDENCIES option will display the list of included files in
the shader sources. Note that it will not print generated source.

This commit also fixes some issues with unhelpful logs, bogus row & column
numbers, other error format, and bug if row was 0.
2022-02-04 20:21:41 +01:00
671fb286ab GPUShader: Cleanup dependency system to not remove string allocation
Source files are now only referenced and listed for the driver to ingest.
Shader sources now includes generated data if any.
Also cleans up gpu_shader_dependency_get_builtins casts.
2022-02-04 20:21:41 +01:00
ae50527c23 GL: Add all image types in binding setup. 2022-02-04 20:21:41 +01:00
25c50ddd09 GPUFramebuffer: Bump max attachment count to 8
This is needed by eevee-rewrite
2022-02-04 20:21:41 +01:00
77d005ea36 GPUShaderCreateInfo: Merge changes from eevee-rewrite
This includes multiple commits:
- Fix crash when using std::cerr for error output
- Add auto_resource_location which overrides all resources location (not vert input)
- Improve codestyle of error reporting.
- Add type conversion to string and to `eGPUType`
- Add comparison operator (will be used for hash collision resolution).
- Add members related to generated code (codegen)
2022-02-04 20:21:41 +01:00
03fbb3de24 GPUState: Add more barrier types
This will be useful when compute shader will be used more.

Refer to the opengl documentation for their meaning.
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glMemoryBarrier.xhtml
2022-02-04 20:21:41 +01:00
66e9ee1a2f Cleanup: Remove unused "init" node tree flag
The value of this flag was set, but not used anywhere.

Differential Revision: https://developer.blender.org/D13519
2022-02-04 12:51:03 -06:00
afc2cc393d Merge branch 'blender-v3.1-release' 2022-02-04 19:35:35 +01:00
260e6fd46b Workbench: Fix unreported heavily quantized mesh due to driver issue
Detected on `amdgpu-pro` libGL implementation. The workaround is to not
use explicit location for vertex attributes. This is not a real problem
as we don't rely on them for now.
2022-02-04 19:34:48 +01:00
0446c9c875 Fix: Incorrect default distance for merge by distance node
This was an oversight in the patch that added this node,
the default merge distance is meant to be the same as the weld
modifier, 0.001m, meaning by in most situations it removes
vertices generally at the same location.
2022-02-04 12:21:27 -06:00
b61cb67e6d Fix T94410: stopping Cycles render in 3D viewport quad view keeps using CPU
Only one of the four renders was being stopped.
2022-02-04 18:55:07 +01:00
a5e9f9b346 DRW: Fix a comment 2022-02-04 18:54:32 +01:00
4a1979b55d Cleanup: Overlay: Remove uneeded UBO binds 2022-02-04 18:54:32 +01:00
7b88a206b2 DRW: Add DRW_UNUSED_RESOURCE_TRACKING for ubo and ssbo
When uncommented, this option will make any call binding a resource that is
not present in the shader produce a warning message with its origin.
2022-02-04 18:54:32 +01:00
9aa25ff53d DRW: Add compute_ref calls, barriers calls, and vertex_buffer_ref
- Compute ref let the size of dispatch be modified just before drawing.
- Barrier call makes it possible to chain multiple compute passes in one pass.
- DRW_shgroup_vertex_buffer_ref is the analog of DRW_shgroup_uniform_block_ref.
2022-02-04 18:54:32 +01:00
665997f1cd DRW: Fix bug in cubemap creation in draw::Texture
The order of if clause made impossible to create a cubemap.
2022-02-04 18:54:32 +01:00
edb0e7ca30 Fix T95471: baking normals wrong after recent MVert normals refactor 2022-02-04 18:15:39 +01:00
0f40855a09 Fix T93851: Cycles wrong glossy indirect pass with volumes 2022-02-04 17:53:39 +01:00
b2f5540a02 Fix: Remove incorrect assert in mesh modifier evaluation
Since we have a node that sets a mesh's auto smooth angle
(unfortunately, in retrospect), we generally can't assume at all
that value is the same as whatever input mesh. Similar asserts
were removed previously in 8216b759e9. While the attempt
at assertions to clarify assumptions is noble, this one doesn't
make sense anymore.

I found this while investigating T95479.

Differential Revision: https://developer.blender.org/D14009
2022-02-04 10:32:21 -06:00
e7912dfa19 Attributes: Infrastructure for generic 8-bit integer data type
This commit adds infrastructure for 8 bit signed integer attributes.
This can be useful given the discussion in T94193, where we want to
store spline type, Bezier handle type, and other small enums as
attributes.

This is only exposed in the interface in the attribute lists, so it
shouldn't be an option in geometry nodes, at least for now.
I expect that this type won't be used directly very often, it
should mostly be cast to an enum type. However, with support
for 8 bit integers, it also makes sense to add things like mixing
implementations for consistency.

Differential Revision: https://developer.blender.org/D13721
2022-02-04 10:29:11 -06:00
b2e43a4a9d deps_builder: Update to freetype 2.11.1
Required to solve a crash on windows (T95367)

Mostly an uneventful update, except for FreeType
giving its cmake options a rename.

Reviewed By: brecht, sybren
Differential Revision: https://developer.blender.org/D13968
2022-02-04 09:19:10 -07:00
b4563ab2df Cleanup: avoid generating some functions in all translation units
Every translation unit that included the modified headers generated
some extra code, even though it was not used. This adds unnecessary
compile time overhead and is annoying when investigating the
generated assembly.
2022-02-04 17:18:56 +01:00
4aeb6add6e Guarded allocator: Document non-obvious initialization with MEM_new()
Initialization with `MEM_new()` depends a lot on the initialization rules
of C++, which are not obvious. Calling it with no arguments to be passed
to the constructor may cause the resulting object to be implicitly 0
initialized (or parts of it). This can have an impact on performance
sensitive code, so it's something to document.

Alternatively we could enforce default initialization (as opposed to the
value initalization that happens now), but this could cause
uninitialized memory in a way that isn't obvious either. This is a
possible source of bugs, so Jacques and I decided against it.
2022-02-04 16:57:46 +01:00
RedMser
150f42e6d3 NLA: shortcut to rename active strip
Use the global F2 rename panel for the NLA editor to rename NLA strips.

Reviewed By: sybren, RiggingDojo

Differential Revision: https://developer.blender.org/D12300
2022-02-04 16:39:00 +01:00
7331c86dbf macOS: support building blender-thumbnailer
It was missing framework flags added in `setup_platform_linker_flags`.
Keep it off until QuickLook Thumbnailing is implemented.

Differential Revision: https://developer.blender.org/D13997
2022-02-04 20:57:30 +05:30
b2abcea950 Merge branch 'blender-v3.1-release' 2022-02-04 15:54:37 +01:00
f75449b5f2 Fix T95467: Textures disappear when going to Edit Mesh on Solid Texture mode
The check for existence of custom data layers did not take wrapper nature of
mesh into account.

Quickest and safest for 3.1 solution is to take care of branching of checks
in the draw manager.

Ideally both wrapper and mesh access will happen via the same public API
without branching in the "user" code. That is something outside of the fix
for the coming release though.

Differential Revision: https://developer.blender.org/D14013
2022-02-04 15:54:25 +01:00
7b686970ef Merge branch 'blender-v3.1-release'
# Conflicts:
#	source/blender/draw/engines/workbench/workbench_effect_cavity.c
2022-02-04 15:40:29 +01:00
0b0f4829e1 Cleanup: Removed Object type specific 'make_local' callback.
This callback was only needed to allow specific handling of proxies, now
that theses have been removed the generic
`BKE_lib_id_make_local_generic` code works for objects as well.
2022-02-04 15:35:51 +01:00
2e766ff762 Image Editor: Fix slowdown with 8b colormanaged images.
Byte images are converted to float. Due to an issue how VSE cache is
freeing its images we cannot store these float buffers what leads
to recalculating it for each change in the image editor.

This fix will reduce the slowdown to areas that have the root cause of
the memory leak, so the buffers can be reused between refreshes.

NOTE: The root cause should still be fixed.

Thanks for reporting Sybren!
2022-02-04 15:32:28 +01:00
4eb10e414b Fix wrong use of region size without pixel-size applied
Didn't cause visible issues, because the layout uses spacers to
right-align text, which happens to use the region size with pixel-size
applied for calculations.
2022-02-04 15:29:52 +01:00
3d973d01fa View3D: move some of the early returns from operators to the poll function
Some navigation operators check flags like `RV3D_LOCK_ROTATION` in the
invoke function to see if the operation can be performed.

As the comment indicates, these checks should be in the poll function.

This avoids redundant initialization.

Note that this brings functional changes as now operators with context
`EXEC_DEFAULT`  will also be affected by the flag.
(There doesn't seem to be a problem with the current code).

Differential Revision: https://developer.blender.org/D14005
2022-02-04 11:21:20 -03:00
7099d5b661 Fix: Missing translations from operator descriptions
The strings in the `get_description` functions for operators need
translation, they are not found by the translation system automatically,
and there is no translation applied afterwards either (as far as I could
tell). Some used `N_` before, but most did nothing.

Differential Revision: https://developer.blender.org/D14011
2022-02-04 07:31:53 -06:00
623ff64a27 Fix T81541: Symmetrize Transform Constraint, Y rotational axis unexpected results
The case where Y rotation is mapped to Y rotation was not handled.
This is now fixed.

Also added an automated test to make sure that the symmetrize operator
functions as intended.

Reviewed By: Sybren

Differential Revision: http://developer.blender.org/D9214
2022-02-04 14:21:20 +01:00
0dd3e77d71 Cleanup: Workbench: Remove unused resources in cavity shaders
This avoid uneeded resource binds.
2022-02-04 14:08:27 +01:00
71fff31990 Fix T95427: Crash during dragging a link in a node editor
This was caused by macros interpreted as recursive. Workaround by
not using macros at all and just define local variables which
hopefully will be optimized.
2022-02-04 14:08:27 +01:00
e7b8871d3d Fix T95284 Workbench: "World" Cavity Type Doesn't Render Anything
This was caused by a faulty UBO bind (not updated after renaming).
2022-02-04 14:08:27 +01:00
3adcfbf63c Merge branch 'blender-v3.1-release' 2022-02-04 14:07:06 +01:00
080dd18cdf Fix T95427: Crash during dragging a link in a node editor
This was caused by macros interpreted as recursive. Workaround by
not using macros at all and just define local variables which
hopefully will be optimized.
2022-02-04 14:05:17 +01:00
8e0763827e Fix T95284 Workbench: "World" Cavity Type Doesn't Render Anything
This was caused by a faulty UBO bind (not updated after renaming).
2022-02-04 14:05:17 +01:00
cb986446e2 Fix Crash: Switching to wireframe mode.
Crash introduced by {rB0cb5eae}.

When switching to between drawing modes the region.draw_buffer could be
uninitialized when the gizmo depth test is performed. When the mouse is
placed on top of a gizmo part that could be highlighted would crash.

This fix adds a early exit when depth testing is requested, but there
isn't a draw_buffer. Not sure this is an root cause fix.

Reported by multiple animators in Blender Studio.
2022-02-04 14:00:06 +01:00
f9aab6717b Merge branch 'blender-v3.1-release' 2022-02-04 13:11:18 +01:00
b8a634cb1d Fix T95489: support writing to vertex groups with geometry nodes again
Technically, this can't be relied upon in the long term. It worked more or
less accidentally before. It was broken by a previous fix accidentally. I mainly
bring it back because rBa985f558a6eb16cd6f0 was not expected to have
this side effect.

Note, this change can result in slower performance. Writing to a vertex
groups is less efficient than using a generic attribute.
2022-02-04 13:10:02 +01:00
e6f9a72884 Cleanup: remove unused LOG declaration
No functional changes.
2022-02-04 11:26:06 +01:00
Aras Pranckevicius
a20cfb9eff BLI: use methods specialized for finding a single char in StringRef
Previously, these methods used the more generic substring-finding
algorithm, which is more complex and slower.

Using the more specialized methods results in a noticable speedup
in the obj importer (D13958).

Differential Revision: https://developer.blender.org/D14012
2022-02-04 10:38:05 +01:00
5088d907e5 Compositor: Backdrop mode changes node grid.
When viewing backdrop on top of the node grid, the grid would be
rendered black when the mode wasn't set to RGBA. This fix fixes this by
reverting the previous fix of drawing the backdrop and implement a
different one that recomputes the UV coordinates on the screen edges.
2022-02-04 09:51:25 +01:00
2d429bfdf8 Fix T93425: makesdna crashes during build with LTO on s390x Linux
DNAstr was assumed to be 4-byte aligned which is not necessarily
the case for byte-arrays.

Use a compiler attribute to ensure this is the case.

Thanks to @mtasaka for investigating and providing a patch.
2022-02-04 19:48:00 +11:00
Bastien Montagne
e9fc25835f Remove internal proxy code, and deprecate related DNA data.
Part of T91671.

Not much else to say, this is mainly a massive deletion of code.

Note that a few cleanups possible after this proxy removal were kept out
of this commit to try to reduce a bit its size.

Reviewed By: sergey, brecht

Maniphest Tasks: T91671

Differential Revision: https://developer.blender.org/D13995
2022-02-04 09:30:44 +01:00
5a4eadc2e7 Cleanup: spelling in comments
Also update viewport comments.
2022-02-04 16:07:24 +11:00
39a1b51efd Cleanup: cage3d gizmo used two margin scale values
Replace this with a single margin.
2022-02-04 15:41:31 +11:00
ef951825a5 Merge branch 'blender-v3.1-release' 2022-02-04 15:38:30 +11:00
lictex_
f7a6e8db04 Fix T88579: scale cage doesn't work well for small/large objects
Apply proper view scale for cage 3d's draw_select,
same as draw.

Reviewed By: campbellbarton

Ref D13956
2022-02-04 15:37:07 +11:00
7803312476 Cleanup: halve calls to BLI_str_utf8_size_safe in the text editor
Syntax highlighted text was calculating the utf8 character
size twice per character.
2022-02-04 14:02:53 +11:00
d730f79e0e Cleanup: use mono-space font drawing for single character display
This doesn't make a user visible difference since it's only used for
brackets at the moment, this is more for general correctness as the
width calculation for mono-spaced text drawing is different
(as it uses BLI_wcwidth).
2022-02-04 14:02:53 +11:00
28656293c6 Cleanup: Clang tidy, use braces
Braces missed in b73d3b80fd
2022-02-03 18:27:42 -06:00
3ddc39bec9 Merge branch 'blender-v3.1-release' 2022-02-04 11:17:49 +11:00
ef2685afea Fix assertion snapping to selected in mesh edit-mode
ED_transverts_create_from_obedit expected an evaluated object.

Add flag to request TX_VERT_USE_MAPLOC to be set, which avoids having to
calculate this data when it's not used as well as the requirement
that the input object be evaluated from the depsgraph.
2022-02-04 11:08:34 +11:00
b73d3b80fd Fix T94334: Area close operator crash in 3D view menu
This fixes the crash by removing the `do_view3d_header_buttons` handler.
The code can work at a higher level here, using the operator for setting
the select mode, which makes this patch a cleanup as well.

The operator now has a description callback to add the custom
description used for the behavior in its invoke method.

Differential Revision: https://developer.blender.org/D13660
2022-02-03 17:36:05 -06:00
af426c8508 Cleanup: Add file names back to node header
These were removed in rBbe3f3812dc4b, but it's preferred to keep them.
I had to do a bit of reorganizing, and I corrected the file type too.
2022-02-03 15:34:01 -06:00
3e0ffe5a39 Cleanup: Add comment about unsed custom data type
Since f59767ff97, these hair layer types are unused. Since DNA
compatibility was broken with any files that would contain them, the
indices can be reused to avoid growing custom data's typemap.
2022-02-03 14:35:51 -06:00
c832f4f7d1 Merge branch 'blender-v3.1-release' 2022-02-03 15:22:27 -05:00
a0c1306e8c Py Docs: Fix error is version switch
Slile parameter of 4 was looking for the language in the URL but the API docs do not have a language in the URL.
2022-02-03 15:21:44 -05:00
fd66733ca7 Merge branch 'blender-v3.1-release' 2022-02-03 15:06:31 -05:00
bda210d74a Py Docs: Fix json URL
In the future when we have a docs staging area it will be
important to change where this JSON is pulled from.
For now, always pull from the "Production" versions
2022-02-03 15:06:11 -05:00
56e5b4cc27 Merge branch 'blender-v3.1-release' 2022-02-03 14:38:26 -05:00
e7f74a7d6a Py Docs: Fix typo in previous commit
- Correct spacing
- Add missing comma
2022-02-03 14:37:55 -05:00
c4ffc3355f Merge branch 'blender-v3.1-release' 2022-02-03 14:25:57 -05:00
6a2fc3230f Py Docs: Implement version switch to switch between versions on the website
This commit adds a version switch similar to the one on the user manual,
in the future it would be nice to refactor both of these into a more generic
code that works for both. Maybe develop this into a sphinx extension.

As part of this change I had to change how the blender hash is displayed.
Instead of the version hash in the top left it has been moved to the page footer.

This change will also be backported to 2.93 LTS, 2.93 LTS, and 3.0.
2022-02-03 14:25:26 -05:00
c8dee942be Merge branch 'blender-v3.1-release' 2022-02-03 17:51:56 +01:00
f59767ff97 Curves: Changes to the new curves data-block
This patch refactors the "Hair" data-block, which will soon be renamed
to "Curves". The larger change is switching from an array of `HairCurve`
to find indices in the points array to simply storing an array of offsets.
Using a single integer instead of two halves the amount of memory for that
particular array.

Besides that, there are some other changes in this patch:
- Split the data-structure to a separate `CurveGeometry`
  DNA struct so it is usable for grease pencil too.
- Update naming to be more aligned with newer code and the style guide.
- Add direct access to some arrays in RNA
-- Radius is now retrieved as a regular attribute in Cycles.
-- `HairPoint` has been renamed to `CurvePoint`
-- `HairCurve` has been renamed to `CurveSlice`
- Add comments to the struct in DNA.

The next steps are renaming `Hair` -> `Curves`, and adding support
for other curve types: Bezier, Poly, and NURBS.

Ref T95355

Differential Revision: https://developer.blender.org/D13987
2022-02-03 10:49:51 -06:00
2f591adc1a Fix T95334: Crash with no vertex normals in multires bake
This is partially caused by a stupid mistake in cfa53e0fbe
where I missed initializing the `vert_normals` pointer in
`MResolvePixelData`. It's also caused by questionable assumptions
from DerivedMesh code that vertex normals would be valid.

The fix used here is to create a temporary mesh with the data necessary
to compute vertex normals, and ensure them here. This is used because
normal calculation is only implemented for `Mesh` and edit mesh, not
`DerivedMesh`. While this might not be great for performance, it's
potentially aligned with future refactoring of this code to remove
`DerivedMesh` completely. Since this is one of the last places the data
structure is used, that would be a great improvement.

Differential Revision: https://developer.blender.org/D13960
2022-02-03 10:35:50 -06:00
71cd9f9fbb Fix (unreported) broken logic in proxy to liboverride conversion.
Iterating over scene's objects while we modify those (through proxy to
override conversion code) is call for problems (use after free etc.).

Instead, all proxy objects need to be gathered first in a temporary
list, and processed all at once in a second loop.
2022-02-03 17:19:04 +01:00
7476eb761b Merge branch 'blender-v3.1-release' 2022-02-03 16:59:26 +01:00
4be87e97f4 Fix T94435: remove anonymous attributes when applying modifier
Differential Revision: https://developer.blender.org/D13994
2022-02-03 16:52:16 +01:00
bcded0a158 Merge branch 'blender-v3.1-release' 2022-02-03 15:38:51 +01:00
946c70e6a7 Fix (unreported) broken do_version of hidden layers from pre-2.8 files.
`BKE_collection_object_add` ensures given object is added to an editable
collection, and not e.g. a linked or override one.

However, some processes like do_version manipulate collections also from
libraries, i.e. linked collections, in those cases we need a version of
the code that unconditionnally adds the given object to the given
colleciton.
2022-02-03 15:37:05 +01:00
3bcbbf8992 Split Python OBJ importer and exporter, enabling only the importer.
This is from patch D13988. It removes the "- New" from the menu of the
new obj exporter, changes the default addon to just io_import_obj,
and does the right versioning thing.
Also disables the python tests for the old python exporter.
2022-02-03 09:30:55 -05:00
5920de9247 Merge branch 'blender-v3.1-release' 2022-02-03 14:54:39 +01:00
e4c179f1d8 Cleanup: clang-format 2022-02-03 14:54:03 +01:00
Sebastian Herholz
01f1b51a2e Fix T93565: revert Cycles to old normal behavior for point lights
This patch reverts the normal behavior of the spotlights. In the last fix,
the returned normal of a spot light was equal to its direction. This broke
some texturing methods used by artists.

Differential Revision: https://developer.blender.org/D13991
2022-02-03 14:50:06 +01:00
b4e06bd7d4 Cleanup: Rename 'TRACKBALLSIZE' to 'V3D_OP_TRACKBALLSIZE' 2022-02-03 10:06:09 -03:00
Germano Cavalcante
1963ad52ce Cleanup: Split View3D navigation code into specific compilation units
The view3d_edit.c file is already getting big (5436 lines) and mixes
operators of different uses.

Splitting the code makes it easier to read and simplifies the
implementation of new features.

Differential Revision: https://developer.blender.org/D13976
2022-02-03 10:06:09 -03:00
e5a110719f Fix T91254: Some editing operation indirectly delete objects from override collections.
Those cases are fairly hard to track down... Added some more checks,
also at lower levels, more generic levels of object editing, and fixed
core check in liboverride (previously code was assuming that an override
of a collection only could have overrides of objects or linked objects,
but this is not necessarily true).
2022-02-03 14:00:12 +01:00
ff9dc1986e Split Python OBJ importer and exporter, enabling only the importer.
This is from patch D13988. It removes the "- New" from the menu of the
new obj exporter, changes the default addon to just io_import_obj,
and does the right versioning thing.
Also disables the python tests for the old python exporter.
2022-02-03 07:56:55 -05:00
3bf2a6e3c9 Cleanup: use NULL items for the default sample enum
Using this enum quiets a warning when exporting key-maps.
2022-02-03 23:02:00 +11:00
60a09bc1be Merge branch 'blender-v3.1-release' 2022-02-03 22:59:09 +11:00
6c6556c5bd Docs: correct weight paint sample description 2022-02-03 22:57:24 +11:00
5a2101f754 Merge branch 'blender-v3.1-release' 2022-02-03 22:42:48 +11:00
59b777eedd Fix T95137: Spline calc_length not working with just 1 NURB point
The NURB case did not properly handle a curve with only 1 point.

Ref D13904
2022-02-03 22:40:32 +11:00
9b42620ef2 Merge branch 'blender-v3.1-release' 2022-02-03 21:39:26 +11:00
35aedd87e7 Fix T66913: undo after frame-change doesn't refresh properly
Use the ID.recalc flag to detect when updates after frame-change is
needed. Since comparing the last calculated frame doesn't take undo into
account (see code-comment for details).

`ID_RECALC_AUDIO_SEEK` has been renamed to `ID_RECALC_FRAME_CHANGE`
since this is not only related to audio however internally this flag is
still categorized in `NodeType::AUDIO`.

Reviewed By: sergey

Ref D13942
2022-02-03 21:37:42 +11:00
98cc3c6009 Cleanup: clang-format 2022-02-03 21:32:31 +11:00
b9483ea380 Merge branch 'blender-v3.1-release' 2022-02-03 10:02:36 +01:00
c8cca88851 Fix assert in original modifiers pointer update function
The issue was happening with a specific file where the ID management
code was not fully copying all modifiers because of the extra check
in the `BKE_object_support_modifier_type_check()`.

While it is arguable that copy-on-write should be a 1:1 copy there is
no real need to maintain the per-modifier pointer to its original.
Use its SessionUUID to perform lookup in the original datablock.

Downside of this approach is that it is a linear lookup instead of
direct pointer access, but the upside is that there is less pointers
to manage and that the file with unsupported modifiers does behave
correct without any asserts.

Differential Revision: https://developer.blender.org/D13993
2022-02-03 10:02:20 +01:00
45d5773519 Cleanup: Use utility function to access original modifier in RNA 2022-02-03 10:02:20 +01:00
c80411ce3b Despgraph: Remove asserts from object modifier backup
The modifiers are mapped between original and evaluated objects based on
their session IDs. The pointer to original modifier is no longer needed
for the backup: it remained from the initial implementation which was
rewritten at some point.

This is a preparation for removal of the pointer to original modifier.
2022-02-03 10:02:20 +01:00
e468abc360 Merge branch 'blender-v3.1-release' 2022-02-03 09:59:22 +01:00
c379223053 Fix wrong function call in Cycles acceleration UI poll.
Thanks to Sergey for spotting this mistake.
2022-02-03 09:57:24 +01:00
26fe2c1885 Merge branch 'blender-v3.1-release' 2022-02-03 17:20:47 +11:00
b0847eff2a Fix T93625: fallback tools don't work with RMB select
c9d9bfa84a caused a regression in when
the right-mouse select action was set to "Select & Tweak" (default).

Now the fallback tool works with RMB select as it did before.
2022-02-03 17:14:07 +11:00
eb0e0a3b75 LibOverride: Move proxy conversion code in its own file.
This will allow to keep the access to deprecated DNA proxy data in that
specific file, instead of allowing deprecated accesses in the whole
override kernel code.

Part of T91671.
2022-02-02 17:22:12 +01:00
a83fff7c63 Remove operators to manually convert proxies to liboverrides.
Now that proxy conversions if enforced, those operations are not useful
anymore.

Part of T91671.
2022-02-02 16:56:23 +01:00
f0cfa94d94 Fix T95397: Grease Pencil Icons do not match in Outliner vs Dope Sheet Editor
There was an inconsistency between icons.
2022-02-02 16:33:29 +01:00
04a93b795c Merge branch 'blender-v3.1-release' 2022-02-02 16:30:12 +01:00
43b0ff3054 Fix (unreported) bug in liboverride resync code.
Part of the resynching code would access collections' objects base
cache, which can be invalid at that point (due to previous ID remapping
and/or deletion). Use a custom recursive iterator over collections'
objects instead, since those 'raw' data like collection's objects list,
and collection's children lists, should always be valid.

Found while investigating a studio production file.
2022-02-02 16:25:41 +01:00
40b84ffc50 Draw Manager: Marked work around code.
Mark the work around that was added for the VSE memory leak.
2022-02-02 15:05:06 +01:00
fd35aa48d1 Workaround for VSE memory leak.
This is a temp fix for a memory leak where the VSE isn't aware that a
float representation of the image could exist. The VSE somehow doens't
clears it (refcounter is still 1).

The work around is just to let the image engine clean up all the data it
created. Potential this would add more overhead when buffers are needed
more than once.
2022-02-02 14:20:18 +01:00
e54fba5591 Merge branch 'blender-v3.1-release' 2022-02-02 13:12:12 +01:00
bf8597febe BLI: fix memory leak in VectorSet
The leak happened when the vector set had to grow when it
was empty but it had allocated the keys array already.
2022-02-02 13:11:33 +01:00
4dcaac6d33 Cleanup: comment printing when loading XML
This printed text when the theme was changes from the quick setup.
Also use a context manager for opening a file.
2022-02-02 21:06:38 +11:00
d81c3bcfbb Merge branch 'blender-v3.1-release' 2022-02-02 10:56:00 +01:00
a985f558a6 Fix T95084: evaluate all output attributes before changing geometry
This refactors how output attributes are computed in the geometry
nodes modifier. Previously, all output attributes were computed one
after the other. Every attribute was stored on the geometry directly
after computing it. The issue was that other output attributes might
depend on the already overwritten attributes, leading to unexpected
behavior.

The solution is to compute all output attributes first before changing the
geometry. Under specific circumstances, this refactor can result in a speedup,
because output attributes on the same domain are evaluated together now.
Overwriting existing might have become a bit slower, because we write the
attribute into  new buffer instead of using the existing one.

Differential Revision: https://developer.blender.org/D13983
2022-02-02 10:54:54 +01:00
ff4e04a293 Merge branch 'blender-v3.1-release' 2022-02-02 10:38:24 +01:00
71b451bb62 Fix T95288: Shrinkwrap selection broken in edit mode
Mistake in the 974981a637: f the edit data is not present then the
origindex codepath is to be used. Added a brief note about it on the
top of the file.

More ideally would be to remove edit mesh from non-bmesh-wrappers
but this would require changes in the draw manager to make a proper
decision about drawing edit mode overlays.
2022-02-02 10:35:32 +01:00
829d93ff06 Remove option to not auto-convert proxies on file load.
Now all proxies will always be converted to library overrides. If
conversion fails, they are simply 'disabled'.

This should be the last 'user-visible' step of proxies removal.
Remaining upcoming commits will remove internal ID management, depsgraph
and evaluation code related to proxies.

Also bump the blendfile subversion.

Part of T91671.
2022-02-02 09:47:10 +01:00
049df7ef94 Proxies Removal: Handle conversion to liboverrides also for linked data.
So far linked proxies were just kept as-is, this is no longer an option.

Attempt to convert them into liboverrides as much as possible, though
some cases won't be supported:
- Appending proxies is broken since a long time, so conversion will fail
  here as well.
- When linking data, some cases will fail to convert properly. in
  particular, if the linked proxy object is not instanced in a scene
  (e.g. when linking a collection containing a proxy as an
  epty-instanced collection instead of a view-layer-instanced collection).

NOTE: converion when linking/appending is done unconditionnaly, option
to not convert on file load will be removed in next commit anyway.

Part of T91671.
2022-02-02 09:47:10 +01:00
286fcb3a60 LibOverride: Add 'owner library' info to some liboverride code.
This will help when dealing with liboverrides from other library files,
e.g for resync or proxies conversion.

This commit only affects proxy conversion.

Part of T91671.
2022-02-02 09:47:10 +01:00
4927919613 Cleanup: Use correct identifier for ShaderParameters.
Code use struct and class, but should only have used struct.
2022-02-02 08:32:32 +01:00
e8b3bd15e8 Cleanup: skip redundant steps when the selection buffer is cached
The viewport theme loaded and virtual modifiers allocated unnecessary.
2022-02-02 18:12:53 +11:00
da5e72eb01 Cleanup: exclude bone names & axes from selection drawing
These aren't used for picking bones so there is no need to draw them.
2022-02-02 18:06:51 +11:00
cabc9506f9 Fix crash in recent pose-bone transform cleanup
ff5e8e6d53 dereferenced a NULL pointer
when dragging a bone with a connected parent in pose-mode.
2022-02-02 18:02:13 +11:00
709f67cbf0 Docs: note that Bone.xwidth & zwidth are doubled 2022-02-02 17:31:06 +11:00
9b779993f0 Docs: add doc-string for RNA_property_is_set_ex use_ghost argument 2022-02-02 13:53:46 +11:00
d82372aee3 Cleanup: spelling in comments 2022-02-02 13:53:46 +11:00
811606a064 Cleanup: shadow warning, remove unused flags 2022-02-02 13:53:36 +11:00
9cc4861e6f Compositor: Combine and Separate XYZ Node
We have this node for shader and geometry nodes. Compositor can also
work with vectors, and this can help with that.

Reviewed By: manzanilla

Maniphest Tasks: T95385

Differential Revision: https://developer.blender.org/D12919
2022-02-01 18:18:51 -05:00
c9b578eac8 Geometry Nodes: Remove object transform dependency in some cases
The geometry nodes modifier currently always adds a dependency
relation from the evaluated geometry to the object transform. However,
that can be avoided unless there is a collection or object info node in
"Relative" mode.

In order to avoid requiring dependency graph relations updates often
when editing a node tree, this patch doesn't check if the node is muted
or if the data-block sockets are empty before adding the dependency.

Fixes T95265

Differential Revision: https://developer.blender.org/D13973
2022-02-01 16:27:29 -06:00
b91ae8b14c Merge branch 'blender-v3.1-release' 2022-02-01 22:54:23 +01:00
95fcb41841 Fix T95378: Seek problems when timecodes are used
Function `IMB_indexer_get_seek_pos()` can return non 0 seek position for
frame index 0. This causes seeking to incorrect GOP and scanning ends
with failiure.

Hard-code first frame index seek position to 0.

Differential Revision: https://developer.blender.org/D13974
2022-02-01 22:53:24 +01:00
6b914a43ad Fix error in ff5e8e6d53
And silence unused variable warning.
2022-02-01 18:50:10 -03:00
b127654816 Fix build error
The return value of this function was removed in ff5e8e6d53
2022-02-01 15:46:07 -06:00
a12265f048 Fix T95353: Crash with proxy auto building
Proxy building data were freed before process was started.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13972
2022-02-01 22:46:04 +01:00
03e580c98c Cleanup: Use C++ types 2022-02-01 15:42:04 -06:00
ff5e8e6d53 Cleanup: restructure 'transform_convert_pose_transflags_update'
Move the bones count and `has_translate_rotate` parameter out of the
function as they are not required in some places.
2022-02-01 18:38:26 -03:00
Yevgeny Makarov
7aec5b0622 UI: Adjust Layout on Quick Setup Screen
Some items on the Quick Setup screen can be truncated with some
languages and/or with High DPI monitors. This patch adjusts column
sizes and turns off the expand on Spacebar options, making everything
fit a bit better.

See D9853 for more details.

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

Reviewed by Julian Eisel
2022-02-01 11:17:57 -08:00
2b01964e6c Merge branch 'blender-v3.1-release' 2022-02-01 19:25:36 +01:00
83b6c8f2b1 Fix T95278: Crash on startup because of GLSL recursion
Bypassing the defines which are only there for error checking.
2022-02-01 19:22:50 +01:00
f39ade9e00 GPUShader: Rename createInfo storage Qualifiers
Using opt-in instead of opt-out to make code easier to read.
Add combined flag enum.
Making restrict an inverse flag option because it is so rare to
use it.
2022-02-01 19:05:22 +01:00
9505af72d4 GPUShader: Add support for gpu_BaryCoord and fallback
This adds the possibility to use the `gpu_BaryCoord[NoPersp]`
builtin to support barycentric coordinates without geometry shader.

The `BuiltinBits::LAYER` builtin needs to be manually added
to the `GPUShaderCreateInfo` in order to use this feature.
Note: This is only available for shaders using `GPUShaderCreateInfo`.

A geometry shader fallback is generated if the extension
`AMD_shader_explicit_vertex_parameter` is not available.

`NV_fragment_shader_barycentric` was not considered because it is not
present inside the `glew.h` with use and seems to only be available
with vulkan.
2022-02-01 19:05:22 +01:00
9e42b9827a GPUShader: Add support for vertex shader gl_Layer and fallback
This adds the possibility to use the `gpu_Layer` builtin to
support layered rendering without geometry shader.

The `BuiltinBits::LAYER` builtin needs to be manually added
to the `GPUShaderCreateInfo` in order to use this feature.
Note: This is only available for shaders using `GPUShaderCreateInfo`.

A geometry shader fallback is generated if the extension
`AMD_shader_explicit_vertex_parameter` is not available.
2022-02-01 19:05:22 +01:00
9bbfade772 GPUShader: Improve builtins support in GPUShaderCreateInfo
- Scan all static shaders for builtins on startup.
- Add possibility to manually add builtins.
- `ShaderCreateInfo.builtins_` contain builtins from all stages.
2022-02-01 19:05:22 +01:00
7475f7b0de GPUShader: Expose create_info getter
This allows to check if a create_info extists based on its name.
2022-02-01 19:05:22 +01:00
Falk David
ffb0ecb498 Fix T91463: Separate points makes gap on cyclic stroke
If an entire cyclic stroke was selected, calling "Separate by Points"
would leave a gap in the new object (making the new stroke non-cyclic).

The patch makes sure that if we separate by points and all points are
selected, we fall back to separate by stroke.

Reviewed By: antoniov

Maniphest Tasks: T91463

Differential Revision: https://developer.blender.org/D12527
2022-02-01 18:09:34 +01:00
2110e271f5 Merge branch 'blender-v3.1-release' 2022-02-01 17:53:19 +01:00
2bd71b49e7 Fix T95395: dangling parent pointer when creating node group
Differential Revision: https://developer.blender.org/D13981
2022-02-01 17:48:44 +01:00
Falk David
e9150ac317 Fix T89514: GP draw mode not saved when scene is not the active one
This patch fixes the error that pops up
(`Error: Unable to execute '... Mode Toggle', error changing modes`)
when trying to switch to e.g. draw mode from a grease pencil object
that was saved in draw mode in an inactive scene when the file was loaded.

Note that this does not fix the bigger issue described in T91243.

The fix makes sure that we reset all the mode flags on the grease pencil
data when we set the mode to object mode.

Reviewed By: antoniov

Maniphest Tasks: T89514

Differential Revision: https://developer.blender.org/D12419
2022-02-01 16:02:03 +01:00
32b33e91eb Asset Browser: Use directory name as default when adding asset libraries
When adding an asset library in the Preferences, set the name of the new
library to the chosen directory's name by default. That avoids having to
set it manually which can be annoying. Previously I thought it would be
nice to show the name button in red then, making the user aware that
they have to give it a name, but that appears to be more annoying than
useful/practical after all.
2022-02-01 14:59:11 +01:00
b03fb70eff Silence draw manager warning.
This message isn't useful for users so silenced it.
2022-02-01 13:50:19 +01:00
f8713aae5e Cleanup: Remove unused datatoc definitions. 2022-02-01 12:14:52 +01:00
217e0a2ce6 Fix T95262: instances ignored in Frame Selected operator
The issue was that the code only looked at `dob->ob`
instead of `dob->ob_data` which is necessary since
rB5a9a16334c573c4566dc9b2a314cf0d0ccdcb54f.

This now uses the same pattern that is used in other places
where `BKE_object_replace_data_on_shallow_copy` is used.
2022-02-01 11:58:53 +01:00
84dab8b597 Fix T95314: constant values not shown in spreadsheet 2022-02-01 11:43:48 +01:00
34449ba9a6 Merge branch 'blender-v3.1-release' 2022-02-01 11:04:38 +01:00
6f9828289f Fix T95356: Crash in armature edit mode and certain condition
Blender would have crashed when renaming bone in Edit Mode, Saving, and
than selecting/deselecting.

Caused by a mistake in the 0f89bcdbeb: can not "short-circuit" the
CoW update if it was explicitly requested.

Safest for now solution seems to be to store whether the CoW component
has been explicitly tagged, so that the following configuration can be
supported:

    DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
    DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE);

Differential Revision: https://developer.blender.org/D13966
2022-02-01 11:04:19 +01:00
396413dedf Partial Fix: Showing Compositor Backdrop in node editor.
Since splitting the depth and the color shader in the image engine the
backdrop wasn't visible anymore. The reson is that the min max uv
coordinates were never working for the node editor backdrop that uses
its own coordinate space.

This partial fix will ignore the depth test when drawing the color part
of the backdrop. This will still have artifacts that are visible when
showing other options as RGBA.

Proper fix would be to calculate the the uv vbo in uv space and not in
image space.
2022-02-01 10:49:28 +01:00
146618fb22 Fix T95376: Fix crash when switching to UV workspace.
Can also happen in other places when the overlay engine is active. Some
parts of the overlay engine uses builtin shaders, but disable the color
space conversion to the target texture.

Currently there the overlay engine has its own set of libraries it could
include and defined a macro to pass-throught the color space conversion.

The library include mechanism currently fails when it couldn't find the
builtin library in the libraries of the overlay engine. This only
happened in debug mode.

This change will not fail, but warns the developer if a library could
not be included. In the future this should be replaced by a different
mechanism that can disable the builtin library. See {T95382}.
2022-02-01 08:38:34 +01:00
120deaac5b Merge branch 'blender-v3.1-release' 2022-02-01 15:37:14 +11:00
64264a496d Merge branch 'blender-v3.1-release' 2022-02-01 15:37:10 +11:00
c8814fb610 Fix T95185: Invalid normals after undo in sculpt mode
Since d9c6ceb3b8 partial updates to
normals in sculpt-mode were accumulating into the current normal
instead of a zeroed value.

Zero vertex normal values tagged for calculation before accumulation.

Reviewed By: HooglyBoogly

Ref D13975
2022-02-01 15:35:08 +11:00
9ce1135440 Cleanup: remove duplicate vertex normal array in SculptSession
From investigating T95185, it's important the normal returned by
SCULPT_vertex_normal_get always match the PBVH normal array.

Since this is always initialized in the PBVH, there is no advantage
in storing the normal array in two places, it only adds the possibility
that changes in the future causing different meshes normals to be used.

Split out from D13975.
2022-02-01 13:39:19 +11:00
f21f1279fa Merge branch 'blender-v3.1-release' 2022-02-01 13:34:43 +11:00
2e4a1a70da Fix building with audaspace disabled 2022-02-01 13:33:50 +11:00
95005bbe02 Merge branch 'blender-v3.1-release' 2022-02-01 00:10:47 +01:00
f420118335 Fix T93856: VP9 lossless render missing alpha
Since 0ea0ccc4ff, `AV_PIX_FMT_YUV444P` pixel format was used for
lossless renders, which did override `AV_PIX_FMT_YUVA420P` format when
"RGBA" output is chosen. VP9 encoder doesn't seem to support
`AV_PIX_FMT_YUVA444P` pixel format, so use `AV_PIX_FMT_YUVA420P` for
lossless RGBA ouput instead.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13947
2022-02-01 00:00:29 +01:00
1d1859c3c4 Fix compile error with audaspace disabled
Argument was removed in a recent commit.
2022-01-31 23:48:43 +01:00
bff83ecee5 Cleanup: Add missing breaks in previous commit
I missed compile warnings for these. Sorry for the noise.
Also combine assignments with null checks to save a few lines.
2022-01-31 15:43:23 -06:00
71c76d596c Merge branch 'blender-v3.1-release' 2022-01-31 22:32:08 +01:00
2053fc849e Cleanup: Return early, use switch, rename function 2022-01-31 15:27:35 -06:00
68c2650b03 Fix T94287: gaps between strips when adding movies
Currently, audio and video strips are synchronized based on data from
media stream, which is nice, but this causes gaps between strips.
This synchronization was implemented by moving movie strip position
relative to sound, which doesn't make much sense for user which is
mostly interested in editing video.

Code was bit hard to read, so it has been simplified. Ideally video
stream time would be easily accessible so synchronization could be done
at any time, but this is not necessary at this point.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D13948
2022-01-31 22:22:36 +01:00
c3a41a8002 Merge branch 'blender-v3.1-release' 2022-01-31 21:00:28 +01:00
c8c9965df2 Fix crash with non-closed meshes in recent bugfix for texture margin
Ref T95249, D13935
2022-01-31 20:59:25 +01:00
5fabbedb04 Fix Cycles assert in light sampling
There is no object transform on lights.
2022-01-31 20:45:12 +01:00
c4f159cfcd Cleanup: Add back comment removed in recent commit
23775f3914 removed this comment, but it's
preferred to keep it instead.
2022-01-31 12:00:45 -06:00
81ee46da1a Fix: Unutilized curve mapping in vector shader node
This could result in a shading errors is some cases such as undo.

Follow up to rB1405787142d1f87f18631114167675ed145f6d75
2022-01-31 12:59:54 -05:00
716d8436f0 Fix: Unutilized curve mapping in vector shader node
This could result in a shading errors is some cases such as undo.

Follow up to rB1405787142d1f87f18631114167675ed145f6d75
2022-01-31 12:56:40 -05:00
64359f8998 Cleanup: Better name for new Outliner tree element type
The name `type` was confusing, since we usually use that in other ways.

Also updated the relating comments.
2022-01-31 18:36:55 +01:00
fc5ef2452d Cleanup: Namespace alias for internal outliner header
Long namespace qualifiers add visual noice and make code harder to read.
2022-01-31 18:36:55 +01:00
2bd30272ea Merge branch 'blender-v3.1-release' 2022-01-31 12:32:31 -05:00
Leon Schittek
5edb924e57 UI Papercut: Fix gap in node outline
Correct corner radius of the node outline to prevent a noticeable gap in
some cases.

---

Currently we make a small mistake in the creation of the node outline:
We offset the rectangle describing the outline by the outline thickness,
but we don't adjust the corner radius accordingly.
Therefore the rounded corner of the outline and the node body are not
concentric which can sometimes lead to a visible gap at the corner.
How noticeable it is depends on the theme, the screen's dpi and the
line thickness set in the preferences.

Simply adjusting the corner radius for the outline to also be increased
by the outline thickness fixes this small issue.

| display, line thickness | **patch** | **master** |
| --- | --- | --- |
| 1080p, default/thin  | {F12835304} | {F12835305} |
| retina, thin | {F12835306} | {F12835307} |

The issue was mentioned by @hitrpr

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D13955
2022-01-31 12:31:54 -05:00
Martijn Versteegh
8ad5241778 Fix T95250: bake margin adjacent faces uses stale UV map in edit mode
Use the evaluated mesh to generate the Adjacent Faces margin.

Baking used the evaluated mesh, but generating the margin used the base
mesh. This would lead to generating the margin from a stale UV map when the
UV editor was open and the UV map was changed. Fix it by passing the same
mesh as used for baking through to the margin generation.

Differential Revision: https://developer.blender.org/D13938
2022-01-31 18:18:05 +01:00
Martijn Versteegh
83fa6a1b2a Fix T95249: bake margin adjacent faces fails in some directions
The new adjacent faces method border lookup fails in some directions around
45 degrees

* Use 8 Dijkstra directions (also diagonally) to determine which polygon is the
  closest to each pixel. Using only Manhattan distance lead to large parts of
  the texture which were matched with the wrong polygon.

* Use neighbroing polygons for edge search. The Adjacent Faces algorithm needs
  to determine the closest edge, in UV space, each pixel. To speed this up
  first as map is built which finds the closest polygon for each pixel along
  horizontal, vertical and diagonal steps. Because this can sometimes be one
  edge off we first look in the polygon from the map, if that fails also
  check the edges of its neighbouring UV polygons.

Differential Revision: https://developer.blender.org/D13935
2022-01-31 18:18:04 +01:00
Martijn Versteegh
c626301f19 Cleanup: remove wrong assert
Was accidentally left in after refactoring.

Fixes T95347

Differential Revision: https://developer.blender.org/D13963
2022-01-31 18:18:02 +01:00
64ca0f44cb Merge branch 'blender-v3.1-release' 2022-01-31 17:43:43 +01:00
5257257539 Fix T95205: remove attribute only once
The bug was caused by a typo.
2022-01-31 17:40:55 +01:00
9578fe3068 Fix T95341: BGL renders incorrect color
Missing include statements of the gpu_shader_colorspace_lib.glsl in
various shaders ignored the target texture color space.
2022-01-31 15:43:13 +01:00
2216699c64 Cleanup: Change NULL to nullptr. 2022-01-31 15:43:13 +01:00
8cc6623c18 Merge branch 'blender-v3.1-release' 2022-01-31 15:29:02 +01:00
180a68c1dc Fix (studio-reported) missing RNA path for EEVEE render passes.
For those EEVEE passes a bit of trickery with pointer offsets allows to
get the owning viewlayer, so path generation is not too bad.

Also moved ViewLayer path generation itself into a public utils, to
avoid duplicating code.

NOTE: Doing the same for AOV would be needed, but since pointer offsets
won't help us here to find the owning viewlayer, not sure how to do it
nicely yet (only solution I think is to loop over all AOVs of all
ViewLayer of the scene to find it :( ).

Reported by Beau Gerbrands (@Beaug), thanks.
2022-01-31 15:16:36 +01:00
46abc6ce25 Fix T95238: BPY Documentation for Tablet Pressure is Incorrect
Set an appropriate range and default value for the property.
2022-01-31 10:20:34 -03:00
caaec3e0c5 Merge branch 'blender-v3.1-release' 2022-02-01 00:02:08 +11:00
a31859c754 Merge branch 'blender-v3.1-release' 2022-02-01 00:02:05 +11:00
8b4f1e41ea Merge branch 'blender-v3.1-release' 2022-02-01 00:02:02 +11:00
cf871ab967 Merge branch 'blender-v3.1-release' 2022-02-01 00:01:58 +11:00
9badd27fb7 Merge branch 'blender-v3.1-release' 2022-02-01 00:01:54 +11:00
b9718899fa Python: default to version to 3.10 for Linux
This doesn't bump the minimum version, see D13943.
2022-01-31 23:57:10 +11:00
deb90557ea Fix T95332: Crash loading older files.
Image buffer was visible but buffer wasn't available. In the case
the color only overlay of the render result was displayed the image
buffer was not check to be valid.

This patch adds a null pointer check to check in `IMB_alpha_affects_rgb`
to solve this crash.
2022-01-31 12:25:18 +01:00
869180548c Image editor: Fix drawing artifacts with render results.
Use the input depth texture to determine if the color of the texture
should be shown.
2022-01-31 11:59:16 +01:00
75576a3001 Fix (unreported) install_deps: wrong order of actions in python handling.
We need to get installed version of python *after* we actually install/update
the package.
2022-01-31 11:08:14 +01:00
Michael
e43ccfb702 Fix: Specify exact Python version for python3-dev on Debian&Ubuntu
This commit specifies the exact Python version which is included in the
package name, thereby allowing `install_deps.sh` to suggest
"`-D PYTHON_VERSION=3.10`" correctly.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13925
2022-01-31 10:59:38 +01:00
dfc959eed6 Fix T95299: Empty render results show transparency checkerboard.
When an image buffer cannot be read the checkerboard should not be
drawn.
2022-01-31 10:51:25 +01:00
cfa235b89d Image Editor: Fix background drawing of empty tiles.
Empty (UDIM) tiles where drawn with a transparency checkerboard. They
should be rendered with a border background. The cause is that the image
engine would select a single area that contained all tiles and draw them
as being part of an image.

The fix is to separate the color and depth part of the image engine
shader and only draw the depths of tiles that are enabled.
2022-01-31 09:57:51 +01:00
a727692af7 XR: Print OpenXR SDK version in --debug-xr mode
Helps with version validation when updating the OpenXR dependency.
2022-01-31 16:09:17 +09:00
ed80c887b7 Fix wmTimer.ntime becoming NAN with a zero time-step
While this didn't cause any user visible bugs, this wouldn't
have behaved as intended since the timer would never run again once
wmTimer.ntime was set to NAN.
2022-01-31 14:36:37 +11:00
97dbe235a2 Cleanup: comments and minor changes to GPU_select code
- Remove outdated references to glReadPixels & OpenGL.
- Rename GPUPickState.{gl => gpu}
- Add doc-string for MAXPICKELEMS.
- Use doxygen comments & other minor doc-string improvements.
2022-01-31 14:10:38 +11:00
8815f2f116 Cleanup: use struct for GPU the select buffer
GPU_select originally used GL_SELECT which defined the format for
storing the selection result.

Now this is no longer the case, define our own struct - making the code
easier to follow:

- Avoid having to deal with arrays in both `uint*` and `uint(*)[4]`
  multiplying offsets by 4 in some cases & not others.

- No magic numbers for the offsets of depth & selection-ID.

- No need to allocate unused members to match GL_SELECT
  (halving the buffer size).
2022-01-31 14:10:08 +11:00
9ccdad8a21 Cleanup: use enum type for selection mode & internal algorithm enum 2022-01-31 13:06:56 +11:00
57f6aa4d83 Cleanup: Remove unused "_ex" version of function 2022-01-30 18:15:38 -06:00
79032a8513 Cleanup: Remove unused DerivedMesh flag
The value of this flag was never used.
2022-01-30 18:11:20 -06:00
23775f3914 Cleanup: Remove unused DerivedMesh functions
Remove functions and function pointers that were never set or never
used at all. The "tessface" original index handling in `subsurf_ccg.c`
can be removed because the data was never used.
2022-01-30 18:06:47 -06:00
ac3324f197 Cleanup: spelling in comments 2022-01-31 10:51:33 +11:00
012e41fc8b Cleanup: use our own conventions for tags in comments 2022-01-31 10:49:59 +11:00
14427f5aaa Cleanup: Remove unused DerivedMesh normal handling
This function and flags weren't used outside of DerivedMesh
code, and since the plan is to remove the data structure, it makes
sense to remove complexity where possible.
2022-01-30 17:01:03 -06:00
a04d0de039 Fix T95336: Wrong tooltip for Show Only on Keyframed checkbox
The "Paint" mode is wrong, must be "Draw"
2022-01-30 23:12:23 +01:00
Aras Pranckevicius
1f7013fb90 Speed up the new OBJ exporter via bigger write buffer and parallelization.
This is a patch from Aras Pranckevicius, D13927. See that patch for full
details. On Windows, the many small fprintfs were taking up a large amount
of time and significant speedup comes from using snprintf into chained buffers,
and writing them all out later.
On both Windows and Linux, parallelizing the processing by Object can also lead
to a significant increase in speed.
The 3.0 splash screen scene exports 8 times faster than the current C++ exporter
on a Windows machine with 32 threads, and 5.8 times faster on a Linux machine
with 48 threads.

There is admittedly more memory usage for this, but it is still using 25 times
less memory than the old python exporter on the 3.0 splash screen scene, so
this seems an acceptable tradeoff. If use cases come up for exporting obj files
that exceed the memory size of users, a flag could be added to not parallelize
and write the buffers out every so often.
2022-01-30 15:03:31 -05:00
b315678fea Merge branch 'blender-v3.1-release' 2022-01-30 13:57:45 -05:00
Aras Pranckevicius
07514def19 Fix T95328, new obj exporter not exporting custom normals.
Previously, the new obj exporter was only exporting per-vertex normals for faces
marked as "smooth". But a face can have custom normals, as soon as the normals
data layer exists. This change makes it follow the behavior of USD & Collada
exporters and the old Python one, which also export per-vertex normals as soon
as the layer is there. (From Patch D13957.)
2022-01-30 13:48:03 -05:00
4fcc651435 Revert "UI: Do not translate "Blender""
See rB0c5a9a0e776eeb724f7266694153f98721e34fde for the issue with this.

This reverts commit 0c5a9a0e77.
2022-01-30 12:19:38 -05:00
a58592885c Cleanup: Remove modifier type hair callback
This is similar to e032ca2e25 which removed the
callback for volumes. Now that we have geometry sets, there is
no need to define a callback for every data type, and this wasn't
used. Procedural curves/hair editing will use nodes rather than new
modifier types anyway.
2022-01-30 00:07:07 -06:00
0c5a9a0e77 UI: Do not translate "Blender"
Blender is the name of the software, it does not make sense to
translate into a language's term for the kitchen appliance.
2022-01-29 21:00:12 -05:00
f18172b023 Cleanup: Pass cursor position as a single array to eyedropper functions
Since `event->xy` is now an array these functions can be
simplified to accept the sample point as an array.

Clarifications were also made to variable names:
- `eye->last_x/y` --> `eye->cursor_last`
- `mx/my` --> `cursor`

Differential Revision: https://developer.blender.org/D13671
2022-01-29 20:45:03 -05:00
f8b8727873 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-01-30 01:07:38 +01:00
2cf3ed13da Fix T95315: "Override Layers" panel open crash with null CacheFile 2022-01-30 01:06:56 +01:00
e951e81b0f Cleanup: Cmake: remove unnecessary definitions for internationalization
Previously, macros were ifdefed using the cmake option `WITH_INTERNATIONAL`
However, the is unnecessary as withen the functions themselves have checks for building without internationalization.
This also means that many `add_definitions(-DWITH_INTERNATIONAL)` are also unnecessary.

Reviewed By: mont29, LazyDodo

Differential Revision: https://developer.blender.org/D13929
2022-01-29 17:40:27 -05:00
ec2e9a4352 Merge branch 'blender-v3.1-release' 2022-01-29 13:14:45 -05:00
c9d35ee07c Fix: Eevee: Float Curve node causes issues with compiled shader
This fixes a regression from rBa0edee712a79239133ff840f911f6416d4c41855.
Issue being the curve map not being initialized in the GPU shader function.

Fixes T95221
2022-01-29 13:14:26 -05:00
1405787142 Fix: Eevee: Float Curve node causes issues with compiled shader
This fixes a regression from rBa0edee712a79239133ff840f911f6416d4c41855.
Issue being the curve map not being initialized in the GPU shader function.

Fixes T95221
2022-01-29 13:11:06 -05:00
90a23dec46 Cleanup: Remove mesh vertex "temp tag" flag
As part of the project of converting `MVert` into `float3`
(more details in T93602), this is an easy step, since it
is only locally used runtime data. In the six places it was
used, the flag was replaced by a local bitmap.

By itself this change has no benefits other than making some
code slightly simpler. It only really matters when the other
flags are removed and it can be removed from `MVert`
along with the bevel weight.

Differential Revision: https://developer.blender.org/D13878
2022-01-28 22:40:13 -06:00
0b2864382a Merge branch 'blender-v3.1-release' 2022-01-29 01:42:04 +01:00
544a0f2880 Fix memory leak when adding movie strips
Introduced by b45e71e22c.
2022-01-29 01:31:53 +01:00
d29a079cb6 Merge branch 'blender-v3.1-release' 2022-01-28 17:47:38 -06:00
03b57d3973 Fix T94476: Threading/performance issue with curve to points node
For every spline, *all* of the normals and tangents in the output
were normalized. The node is multithreaded, so sometimes a thread
overwrote the normalized result from another thread.

Fixing this problem also made the node orders of magnitude
faster when there are many splines.
2022-01-28 17:47:14 -06:00
fd1078e105 Fix T62651: Win32 Multiple Adapters Warning
Show a more instructive error message for users who have plugged
multiple monitors into multiple display adapters. And do not exit
if unable to open a child window when in this state.

See D13885 for more details

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

Reviewed by Ray Molenkamp
2022-01-28 15:20:07 -08:00
3435c9a2c1 Merge branch 'blender-v3.1-release' 2022-01-28 23:51:50 +01:00
afdc35b636 Fix typos in rB0a8fa07735cdb89081b652c032c73863e34f8ff1 2022-01-28 23:50:49 +01:00
fe80b6ceac Merge branch 'blender-v3.1-release' 2022-01-28 23:32:51 +01:00
0a8fa07735 Fix T95278: Crash on startup because of GLSL compiler bug
The GLSL defines used to make the uniform names unusable for local variable
is being interpreted as recursive on some implementation.

This avoids it by create a second macro avoiding the recursion.
2022-01-28 23:28:53 +01:00
6b7756279f Fix T93626: Win IME Chinese Numpad Decimal
Allow Windows IME Pinyin, when in Chinese mode, to use numpad decimal
key to enter decimal point.

See D13902 for more details.

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

Reviewed by Brecht Van Lommel
2022-01-28 13:32:46 -08:00
4311a32bc2 Win IME: Ideographic Full Stop to Decimal Point
Convert Ideographic Full Stop, used in Simplified Chinese and Japanese,
to Decimal Point when entering numbers into numerical inputs.

See D13903 for more details

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

Reviewed by Brecht Van Lommel
2022-01-28 13:11:56 -08:00
ace1b6a73a UI: Add OneDrive to System List for Windows
This patch adds a "OneDrive" icon to the File Manager System list for
Windows (only!).

See D11133 for more details.

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

Reviewed by Julian Eisel
2022-01-28 12:22:42 -08:00
26e608d820 Win32: Initialize GHOST_WindowWin32 Members
Initialize m_Bar, m_dropTarget, & m_hWnd members of GHOST_WindowWin32
in constructor's member initializer list. This ensures they are are
set or NULL in destructor if constructor does not complete.

See D13886 for more details.

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

Reviewed by Jesse Yurkovich
2022-01-28 12:03:20 -08:00
82ad1631e4 Fix Cycles assert in light sampling
There is no object transform on lights.
2022-01-28 17:32:18 +01:00
dd4a89e78d Merge branch 'blender-v3.1-release' 2022-01-28 10:06:04 -06:00
cb09485ff2 UI: Use property split in new operator popup
This attribute conversion operator was just added.
The UI looks more consistent with property split.
2022-01-28 10:03:07 -06:00
92d747b0c4 Drag & drop: Support using context of hovered button when dropping
Buttons can hold context and it's very useful to use this as a way to
let buttons provide context for drop operators.
For example, with this D13549 can make the material slot list set the
material-slot pointer for each row, and the drop operator can just query
that.
2022-01-28 16:53:37 +01:00
391bb6e9ba Cleanup: Clang-tidy warning gl_shader.cc 2022-01-28 16:35:05 +01:00
b6f640b953 Cleanup: Clang-tidy warnings.
Silence Clang-tidy warnings in gpu module.
2022-01-28 16:18:13 +01:00
4e93918b35 Merge branch 'blender-v3.1-release' 2022-01-28 15:09:35 +01:00
3b2a1ff716 Image Engine: Remove unused shader parameter Color.
This change removes an unused shader parameter that also collided when a
local varialble with the same name was used on different platforms.
2022-01-28 15:03:45 +01:00
75e61e5a6d Image Engine: Use GPUShaderCreateInfo.
Ported the image engine shaders to use the GPUShaderCreateInfo struct.
No functional changes.
2022-01-28 15:03:45 +01:00
c40d6ebceb Merge branch 'blender-v3.1-release' 2022-01-28 14:46:16 +01:00
430f71fce2 Fix insufficient CPU flags checks for Cycles OIDN
Sometime throughout development some checks got lost during refactor.
This change makes it so that if OIDN is not supported on the current
CPU Cycles will report an error and stop rendering. This behavior is
similar to when an OptiX denoiser is requested and there is no OptiX
compatible device available.

The easiest way to verify this change is to force return false from
the `openimagedenoise_supported()`.

Fixes Cycles part of the T94127.

Differential Revision: https://developer.blender.org/D13944
2022-01-28 14:28:04 +01:00
29a1d8b1d3 Fix compilation error in previous commit. 2022-01-28 14:01:25 +01:00
cdcbdf8ce4 Remove compilation warnings TexResult. 2022-01-28 13:28:31 +01:00
5d74fa314b Fix overread warning in screen operator
Fixes a `stringop-overread` warning, other people are working on fixing
some more :)
2022-01-28 12:40:44 +01:00
7c48196056 Silent compilation warning in space_graph. 2022-01-28 11:48:47 +01:00
be921a04f2 Image engine: Remove unused parameter.
Parameter was used to still be compatible with the previous drawing mode.
The previous mode isn't available anymore so the parameter can should be
removed.
2022-01-28 11:48:47 +01:00
dcb7b3f9f7 Image Engine: Fix issue show alpha flag not reset.
After showing the alpha in the image editor the setting was not reset
so all images in the editor showed as being transparent.

This commit fixes this by resetting the flag before updating.
2022-01-28 11:48:47 +01:00
379814a118 Draw: Remove unused code in image engine shader. 2022-01-28 11:48:47 +01:00
60bd6804db Revert "3.1 splashscreen"
This reverts commit 3aa56608f7.
2022-01-28 11:34:51 +01:00
1a15461612 Merge branch 'blender-v3.1-release' 2022-01-28 11:34:31 +01:00
3aa56608f7 3.1 splashscreen
Credit: Lorenzo Aiello - https://orencloud.artstation.com/
2022-01-28 11:32:12 +01:00
f4031f2be2 Revert "Update pipeline config and point to 3.1 branches."
This reverts commit 5d4583683b.
2022-01-28 11:19:29 +01:00
66e4fdab68 Revert "Blender 3.1 bcon3 (beta)"
This reverts commit d45098024e.
2022-01-28 11:19:10 +01:00
cfe18c3b94 Merge remote-tracking branch 'origin/blender-v3.1-release' 2022-01-28 11:11:51 +01:00
f756dc4812 Blender 3.1 Beta- subversion bump 2022-01-28 11:11:11 +01:00
5d4583683b Update pipeline config and point to 3.1 branches. 2022-01-28 11:01:11 +01:00
d45098024e Blender 3.1 bcon3 (beta) 2022-01-28 10:55:28 +01:00
c37b837244 Fix T95060: Outliner: Broken 'make override hierarchy' in indirect linked casae.
In Outliner, 'Make Override Hierarchy' on an indirectly linked data would
fail in case some items higher up in the hierarchy also needed to be
overridden was also indirectly linked.
2022-01-28 10:53:53 +01:00
c0225aa573 Blender 3.2 bcon1 - alpha
Bump the version number for the new release cycle.
2022-01-28 10:48:27 +01:00
49b9b0251b Draw: Remove unused shader.
tile images aren't a special case anymore for the image engine.
2022-01-28 10:47:52 +01:00
78647fbcc0 Fix T95060: Outliner: Broken 'make override hierarchy' in indirect linked casae.
In Outliner, 'Make Override Hierarchy' on an indirectly linked data would
fail in case some items higher up in the hierarchy also needed to be
overridden was also indirectly linked.
2022-01-28 10:24:07 +01:00
e1be275878 Fix typo in comment. 2022-01-28 09:24:11 +01:00
Jeroen Bakker
bdd74e1e93 DrawManager: Image engine support huge images.
Adding better support for drawing huge images in the image/uv editor. Also solved tearing artifacts.
The approach is that for each image/uv editor a screen space gpu texture is created that only contains
the visible pixels. When zooming or panning the gpu texture is rebuild.

Although the solution isn't memory intensive other parts of blender memory usage scales together with
the image size.

* Due to complexity we didn't implement partial updates when drawing images tiled (wrap repeat).
  This could be added, but is complicated as a change in the source could mean many different
  changes on the GPU texture. The work around for now is to tag all gpu textures to be dirty when
  changes are detected.

Original plan was to have 4 screen space images to support panning without gpu texture creation.
For now we don't see the need to implement it as the solution is already fast. Especially when
GPU memory is shared with CPU ram.

Reviewed By: fclem

Maniphest Tasks: T92525, T92903

Differential Revision: https://developer.blender.org/D13424
2022-01-28 08:37:45 +01:00
0a32ac02e9 Image: Partial Update Redesign.
This patch reimplements the image partial updates. Biggest design motivation for the redesign
is that currently GPUTextures must be owned by the image. This reduces flexibility and adds
complexity to a single component especially when we want to have different structures.

The new design is not limited to GPUTextures and can also be used by reducing overhead in image
operations like scaling. Or partial image updating in Cycles.

The usecase in hand is that we want to support virtual images in the image editor so we can
work with images that don't fit in a single GPUTexture.

Using `BKE_image_partial_update_mark_region` or `BKE_image_partial_update_mark_full_update`
a part of an image can be marked as dirty. These regions are stored per ImageTile (UDIM).

When a part of the code wants to receive partial changes it needs to construct a `PartialUpdateUser`
by calling `BKE_image_partial_update_create`. As long as this instance is kept alive the changes can
be received.

When a user wants to update its own data it will call `BKE_image_partial_update_collect_changes`
This will collect the changes since the last time the user called this function. When the partial changes
are available the partial change can be read by calling `BKE_image_partial_update_get_next_change`

It can happen that the introduced mechanism doesn't have the data anymore to construct the
changes since the last time a PartialUpdateUser requested it. In this case it will get a request
to perform a full update.

Maniphest Tasks: T92613

Differential Revision: https://developer.blender.org/D13238
2022-01-28 08:06:19 +01:00
1e0758333d Cleanup: add compiler attributes to BLI_path functions 2022-01-28 15:06:29 +11:00
9523b1478e BLI_path: assert passing relative paths to BLI_path_cmp_normalized
Assert when "//" prefixed relative paths are passed to
BLI_path_cmp_normalized as this can't be expanded
and it's possible the paths come from different blend files.
2022-01-28 15:05:21 +11:00
ebd0e76088 Cleanup: indentation for CMake files
Also minor white-space & case changes.
2022-01-28 14:52:47 +11:00
9f6b19526d Cleanup: spelling in comments
Also minor wording improvements.
2022-01-28 14:52:47 +11:00
7475012e24 Cleanup: rename BLI_paths_equal to BLI_path_cmp_normalized
Changes to recent addition: c85c52f2ce.

Having both BLI_paths_equal and BLI_path_cmp made it ambiguous
which should be used, as `BLI_paths_equal` wasn't the equivalent to
`BLI_path_cmp(..) == 0` as it is for string equals macro `STREQ(..)`.
It's also a more specialized function which is not used for path
comparison throughout Blender's internal path handling logic.

Instead rename this `BLI_path_cmp_normalized` and return the result of
`BLI_path_cmp` to make it clear paths are modified before comparison.

Also add comments about the conventions for Blender's path comparison
as well as a possible equivalent to Python's `os.path.samefile`
for checking if two paths point to the same location on the file-system.
2022-01-28 14:50:16 +11:00
f2b24272dd Fix T93328: Movie seeking doesn't work.
Caused by integer overflow in `steps_per_frame` calculation.
2022-01-27 23:21:45 +01:00
da848b7440 GPUShader: Abort in case of dependency issues.
This is to avoid being flooded with compilation errors that are not helpful.
2022-01-27 22:57:02 +01:00
423bbbbaae BLI_float4x4: Add operator[]
This makes porting existing code using `float[4][4]` easier.
2022-01-27 21:35:43 +01:00
Germano Cavalcante
3775615aea Outliner: avoid creating unnecessary undo steps
The `OUTLINER_OT_item_activate` operator, although it detects when
something changes, always returns `OPERATOR_FINISHED` and thus induces
the creation of undo steps.

So return `OPERATOR_CANCELLED` when nothing changes.

Ref T94080

Reviewed By: Severin

Maniphest Tasks: T94080

Differential Revision: https://developer.blender.org/D13638
2022-01-27 15:41:40 -03:00
a21f1e81e0 DRW: Fix some issues with DRW_gpu_wrapper.hh
- Fix assert on size.
- Fix void * casting.
- Pass extent by values.
- Add swap function to avoid letting the types copyable.
- Add back the GPUTexture * operator on TextureFromPool.
2022-01-27 18:46:01 +01:00
87c13ac68c UX: Prevent click-through panels and used header area
Does two main changes:
* Handle regions in the order as visible on screen. Practically this
  just means handling overlapping regions before non-overlapping ones.
* Don't handle any other regions after having found one containing the
  mouse pointer.

Fixes: T94016, T91538, T91579, T71899 (and a whole bunch of duplicates)
Addresses: T92364

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

Reviewed by: Campbell Barton
2022-01-27 18:40:54 +01:00
4710f3346a Event System: Add debug sanity check "always pass" events
Asserts that such events actually always lead to a handler return value
that actually keeps the event passing.

Reviewed by Campbell Barton as part of
https://developer.blender.org/D13539.
2022-01-27 18:40:54 +01:00
74d68e50d3 Revert "Cleanup: Remove unused variables in winstuff.c"
This reverts commit 32a96b80a3.

this needed an ifdef, not a removal, will land a proper fix later
2022-01-27 10:21:35 -07:00
89dbad9085 Fix T95202: Curve to mesh node inconsistent edge vertex order
Though the edge vertices aren't really meant to have an order,
it can make a difference in operations when there isn't any other
information to make decisions from, like etruding a circle of
loose edges (the situation in the report). This commit changes
the order of the vertices in the final cyclic edge to go in the
same direction as all of the other edges.
2022-01-27 11:21:07 -06:00
834b966b41 Fix T95212: Mirror modifier normals crash
The vertex and face normals from the input mesh
were used to calculate the normals on the result,
which could cause a crash because the result should
be about twice as large.

Also remove an unnecessary dirty tag, since it is handled
automatically when creating a new mesh or in the case
of the mirror modifier, when calculating the new custom
face corner normals.
2022-01-27 11:02:10 -06:00
d7ac659e02 Cleanup: Clang tidy
Use nullptr, use named parameters, fix deprecated header
2022-01-27 10:53:53 -06:00
9c341153a2 Fix T95062: Outliner Library Overrides not refreshed when removing overrides.
Those operations were missing the necessary notification for the
Outliner. This was also affecting RNA API of liboverrides.
2022-01-27 17:52:09 +01:00
279a73e429 Fix: Complete transfer attribute input renaming
Complete the renaming from 6a16a9e661
to include variable names and warning messages.
2022-01-27 10:41:41 -06:00
32a96b80a3 Cleanup: Remove unused variables in winstuff.c
This clears up 4 unused variable warnings coming
from BLI_windows_register_blend_extension
2022-01-27 09:37:11 -07:00
25ac6aa5e4 Fix T85233: Transfer Weights tooltip is wrong.
Swap "active" and "selected" in the tooltip if the `use_reverse_transfer`
option is activated.

Reviewed By: mont29

Maniphest Tasks: T85233

Differential Revision: https://developer.blender.org/D13499
2022-01-27 17:21:01 +01:00
658ae5d63f DRW: Fix DRW_gpu_wrapper.hh
The UBYTE datatype is not supported by the clear fallback. Also fix vector
types headers.
2022-01-27 17:05:02 +01:00
Yevgeny Makarov
58e0aa36ea Fix T93766: 'New Collection' entry in 'Move to collection' menu is not translated.
Also fixes similar issues regarding some liboverride menu entries.

Reviewed By: mont29

Maniphest Tasks: T93766

Differential Revision: https://developer.blender.org/D13513
2022-01-27 16:51:14 +01:00
99ffe1153a install_deps: Downgrade python-ztandard to 0.16.0.
Higher version requires a new version of the ztandard library itself.

Ref. T93161/D13922.
2022-01-27 16:16:14 +01:00
6c483479b8 GLFramebuffer: Add assert to check if framebuffer has the expected data
It came to light that there is no error checking when trying to read
a framebuffer plane without anything attached to it.
2022-01-27 16:13:49 +01:00
Michael Kowalski
c85c52f2ce USD Preview Surface material export.
Add `USD Preview Surface From Nodes` export option, to convert a
Principled BSDF material node network to an approximate USD Preview
Surface shader representation. If this option is disabled, the original
material export behavior is maintained, where viewport setting are saved
to the Preview Surface shader.

Also added the following options for texture export.

  - `Export Textures`: If converting Preview Surface, export textures
    referenced by shader nodes to a 'textures' directory which is a
    sibling of the USD file.
  - `Overwrite Textures`: Allow overwriting existing texture files when
    exporting textures (this option is off by default).
  - `Relative Texture Paths`:  Make texture asset paths relative to the
    USD.

The entry point for the new functionality is
`create_usd_preview_surface_material()`, called from
`USDAbstractWriter::ensure_usd_material()`.  The material conversion
currently handles a small subset of Blender shading nodes,
`BSDF_DIFFUSE`, `BSDF_PRINCIPLED`, `TEX_IMAGE` and `UVMAP`.

Texture export is handled by copying texture files from their original
location to a `textures` folder in the same directory as the USD.
In-memory and packed textures are saved directly to the textures folder.

This patch is based, in part, on code in Tangent Animation's USD
exporter branch.

Reviewed By: sybren, HooglyBoogly

Differential Revision: https://developer.blender.org/D13647
2022-01-27 15:51:50 +01:00
d518550c46 Fix crash on older platform due to unsupported clear command
Clearing using GPU_texture_create_2d for unorm texture needs to use
GPU_DATA_FLOAT to match the conversion requirements.
2022-01-27 15:50:38 +01:00
aa2164da33 Cleanup: Fix const correctness warning 2022-01-27 15:26:43 +01:00
5730668dea Downgrade Python zstandard module to 0.16.0
Downgrade the Python zstandard from 0.17.0 to 0.16.0. The Python package
should be linked against the exact same version of libzstd as Blender is,
otherwise it will refuse to load from within the Blender executable.

Python zstandard 0.17.0 links to 1.5.1, whereas we need 1.5.0.
2022-01-27 15:10:05 +01:00
8a20aec403 CMake/Linux/Python:copy either chardet or charset_normalizer
`chardet` was replaced by `charset_normalizer` for modern `requests`.
With this change, `{make,ninja} install` will also copy the latter into
Blender's install directory.
2022-01-27 15:10:05 +01:00
5400018106 Build: enable Python 3.10 on macOS 2022-01-27 15:03:11 +01:00
6f1ab97c53 Cleanup: Add more const correctness to some functions
These are functions that are used by eevee-rewrite which has more strict
const correctness.
2022-01-27 14:59:37 +01:00
78f29c0467 cmake/windows: Enable Python 3.10 2022-01-27 06:57:25 -07:00
0379ddac7d GPUShaderCreateInfo: Add optionnal check for optimized out resources
This opt-in functionnality enabled developper keep track of unused
resources present in the `GPUShaderCreateInfo` descriptors of their
shaders.

The output is pretty noisy at the moment so we do not enforce its usage.
2022-01-27 10:30:06 +01:00
cf31c4ba18 install_deps: Update OSL to 1.11.17.0 for llvm13 compatibility.
While install_deps tries to stay as close as possible from official
Blender versions of the libraries, it also strives to use as many distro
packages as possible.

OSL 1.11.16.0 is the minimal version that builds with llvm13, which is
the default llvm/clang version in e.g. Debian testing.
2022-01-27 09:06:50 +01:00
a99e43b2b7 install_deps: Update python and deps versions as per T93161/D13922. 2022-01-27 09:06:50 +01:00
5abab0a41a GPUShaderCreateInfo: Remove push_constant indexing
This is too much impractical and offers no real benefit.
2022-01-27 08:54:24 +01:00
a7f7b0b77e Deps builder: Python 3.10.2
Also included:

IDNA 3.2 -> 3.2
Charset Normalizer 2.0.6 -> 2.0.10
UrlLib3 1.26.7 -> 1.26.8
Requests 2.26.0 -> 2.27.1
Cython 0.29.24 -> 0.29.26
ZStandard 0.15.2 -> 0.17.0
Numpy 1.12.2 -> 1.22.0

Reviewed by: brecht
Differential Revision: https://developer.blender.org/D13922
2022-01-26 18:09:50 -07:00
1edf520439 Windows: Retire MSVC 2017 support
The lower bar for building blender
is now MSVC 2019 16.9.16.
2022-01-26 17:56:38 -07:00
0e86c60c28 Geometry Nodes: String to Curves Line/Pivot Point
Adds two new attribute outputs:
"Line" outputs the line number of the character.
"Pivot Point" outputs the selected pivot point position per char.
Some refactoring of the text layout code.

Differential Revision: https://developer.blender.org/D13694
2022-01-26 22:12:50 +01:00
bb1e2a80e4 Cleanup: Workbench: Remove extern shader strings
This is not needed anymore with the new dependency system.
2022-01-26 22:04:49 +01:00
710e46cb2d Cleanup: Move specific node tree execution functions into respective module
`node_exec` had some code that was specific to texture/shader nodes.
These functions  arent used outside there module so limit there declarations.

Also make a function static that is only used in `node_exec.c`

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13899
2022-01-26 15:29:31 -05:00
cab1f1d9a2 Geometry Nodes: Add or improve various socket descriptions 2022-01-26 14:22:23 -06:00
7b615ca186 Cleanup: Remove RNA data from TreeElement, get via type specific class
The `TreeElement.rnaptr` was only needed for RNA tree-elements. Now it
can be gotten through the new type specific classes, e.g.
`TreeElementRNAProperty.getPointerRNA()`.
2022-01-26 19:15:57 +01:00
9dc0379dc0 Cleanup: Improve function name, introduced in own recent commit
I prefer it this way around now, especially since I'm adding a
`getPointerRNA()` too. Good to keep it match the actual struct names.
2022-01-26 19:15:57 +01:00
f6296e502a Cleanup: Small improvements to Outliner RNA path build function
Smaller cleanups to improve readability of a complex function.
2022-01-26 19:15:57 +01:00
fdd84d36ce Fix incorrect index-key in RNA path built from Outliner
Bug introduced in 7cbcfb7f49.
2022-01-26 19:15:57 +01:00
b57db4b79e Cleanup: Reduce void * reliance of new RNA C++ Outliner elements
Continuation of the previous commit, this time addressing the same for
RNA tree-elements.
2022-01-26 19:15:57 +01:00
fc0dd5583c Cleanup: Reduce void * reliance of new sequencer C++ Outliner elements
Plan is to remove things like `TreeElement.directdata` and to instead
expose specific queries in the new type specific tree-element classes.
e.g. like here: `TreeElementSequence.getSequence()`

For now uses `tree_element_cast<>()` to get the new type specific
tree-element, later these should replace `TreeElement` all together.
2022-01-26 19:15:57 +01:00
08e2885796 Outliner: Function to "cast" C-style TreeElement to typed C++ pendant
Add function to safely request the type-specific C++ element from a
C-style `TreeElement`. Looks like this:
```
TreeElementFoo *te_foo = tree_element_cast<TreeElementFoo>(te);
```
The "cast" will return null if the tree-element doesn't match the
requested type.

This is useful for the transition from the C-style type to the new ones.
2022-01-26 19:15:57 +01:00
da1b6c4c02 Outliner: Port sequencer elements to new tree-element design
Continuation of work started in 2e221de4ce and 249e4df110.

Adds new tree-element classes for sequences, strips and strip
duplicates.
2022-01-26 19:15:57 +01:00
d74c2b5c1f Outliner: Add missing sanity checks for RNA tree-elements
Forgot to add these in 9bce134e56. Also tweaked assert to print a
message that was previously communicated via a comment only.
2022-01-26 19:15:57 +01:00
57dfec79f4 DRW: Fix builtin uniform name mismatch
This lead to severe unreported regression, like volume rendering broken
in workbench.
2022-01-26 19:09:05 +01:00
13f2df3c28 Fix/workaround failing Cycles tests on macOS after ray offset changes
Temporarily blacklist a few tests with overlapping objects as they seem to
give different results on this platform.
2022-01-26 18:52:56 +01:00
489b484b7b Cleanup: GPUShaderShared: Complete vector support
Move some declaration from `GPU_shader_shared.h` to the main
common file and add missing vector declarations.
2022-01-26 18:10:59 +01:00
b42adab3a2 GPUShader: Add GLSL source modification pass to support enums
This uses a light parser / string modification pass to convert
C++ enum declaration syntax to GLSL compatible one.

GLSL having no support for enums, we are forced to convert the
enum values to a series of constant uints.

The parser (not really one by the way), being stupidly simple,
will not change anything to the values and thus make some C++
syntax (like omitting the values) not work.

The string replacement happens on all GLSL files on startup.
I did not measure significant changes in blender startup speed.
There is plans to do all of this at compile time.

We limit the scope of the search to `.h` and `.hh` files to prevent
confusing syntax in `.glsl` files.

There is basic error reporting with file, line and char logging
for easy debuggabiliy.

The requirements to use this enum sharing system are already listed in
`gpu_shader_shared_utils.h` and repeated on top of the preprocessor
function.
2022-01-26 18:10:59 +01:00
e729abb0e2 BLI_string_ref: Add back missing rfind()
Must have been removed in a bad merge or something.
2022-01-26 18:10:59 +01:00
William Leeson
74afc86d4b Cycles: remove ray offsetting
Remove small ray offsets that were used to avoid self intersection, and leave
that to the newly added primitive object/prim comparison. These changes together
significantly reduce artifacts on small, large or far away objects.

The balance here is that overlapping primitives are not handled well and should
be avoided (though this was already an issue). The upside is that this is
something a user has control over, whereas the other artifacts had no good
manual solution in many cases.

There is a known issue where the Blender particle system generates overlapping
objects and in turn leads to render differences between CPU and GPU. This will
be addressed separately.

Differential Revision: https://developer.blender.org/D12954
2022-01-26 17:51:05 +01:00
William Leeson
ae44070341 Cycles: explicitly skip self-intersection
Remember the last intersected primitive and skip any intersections with the
same primitive.

Ref D12954
2022-01-26 17:51:05 +01:00
William Leeson
a9bb460766 Cycles: compute triangle location from barycentric instead of re-intersecting
This is a bit more efficient than what we did before.

Ref D12954
2022-01-26 17:51:05 +01:00
974981a637 Fix T95222: Crash selecting vertices with modifier applied on cage
Caused by 0f89bcdbeb where it was needed for cage and evaluated mesh
to have same behavior in respect of having edit_mesh pointer assigned.
This change makes it so that edit_data is not implied to exist when the
edit_mesh pointer is not null. This was already the case in some other
code.
2022-01-26 17:48:45 +01:00
79927e730e LibOverride: Resync: Do not process overrides that should already have been resynced.
Those cases are almost always synptoms of either bug in code, or broken
files. Re-doin resync on them only costs time and causes extra trash
data as a result, without really helping in any way.
2022-01-26 16:20:08 +01:00
990ed109f2 Fix (unreported) missing 'override-exclusion' flag on new RNA mesh data accessors.
Both new normals (from rBb7fe27314b25) and vpaint (from rBf7bbc7cdbb6c)
RNA arrays were missing the `PROPOVERRIDE_IGNORE`. Those huge blobs of
geometry data should never be processed by liboverride code.
2022-01-26 16:20:08 +01:00
37848d1c8e Assets: enable node group assets
This enables support for node group assets. Previously, node group
assets only worked when the "extended asset browser" experimental
features is enabled.

Differential Revision: https://developer.blender.org/D13748
2022-01-26 15:22:15 +01:00
12b26d21b0 Assets: allow creating preview image by rendering active object
For node groups there is no good default preview generation.
Nevertheless, t would be useful to generate a preview image for a
node group by rendering an object in some cases.

This commit adds a new operator that allows updating the preview
image for the active asset by rendering the active object.
Note, the operator can also be used for other asset types, not just
node groups.

The operator can be found in a menu right below the refresh-preview
button. Currently it is the only operator in that menu. In the future,
more operators to create previews may be added.

Differential Revision: https://developer.blender.org/D13747
2022-01-26 15:10:49 +01:00
6738ecb64e Fix T94900: Fix drawing artifacts sequencer+node editor.
The VSE and node editor only uses an overlay buffer to draw to the screen. The
GPUViewport assumes that platforms clears all textures during creation, but
they do not on selected platforms. What would lead to drawing from
uncleared memory.

This patch fixes this by clearing all viewport textures during creation.
2022-01-26 14:48:28 +01:00
5b299e5999 D13910: Workbench: Port shaders to use GPUShaderCreateInfo
Also adds a few things to GPUShader for easily create shaders.
Heavy usage of macros to compose the createInfo and avoid
duplications and copy paste bugs.
This makes the link between the shader request functions
(in workbench_shader.cc) and the actual createInfo a bit
obscure since the names are composed and not searchable.

Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D13910
2022-01-26 12:46:37 +01:00
9bce134e56 Outliner: Port RNA elements to new tree-element design
Continuation of work started in 2e221de4ce and 249e4df110.

Adds new tree-element classes for RNA structs, properties and array
elements. This isn't exactly a copy and paste, even though logic should
effectively be the same. Further cleanups are included to share code in
a nice way, improve code with simple C++ features, etc.
2022-01-26 11:44:58 +01:00
1bf6a880ab ID: Fix failing test cases.
This fixes failing test cases when using `make test`.
See {D13615} for more information.

The fix will perform the id remapping one item at a time. Although not
really nice, this isn't a bottleneck.

The failing test cases is because space_node stores pointers multiple
times and didn't update all pointers. It was not clear why it didn't do
it, but changing the behavior more to the previous behavior fixes the
issue at hand.

I prefer to remove the double storage of the node tree pointers (in
snode and path) to reduce pointer management complexity.
2022-01-26 11:12:52 +01:00
Jeroen Bakker
a21bca0e20 Performance: Remap multiple items in UI
During sprite fright loading of complex scenes would spend a long time in remapping ID's
The remapping process is done on a per ID instance that resulted in a very time consuming
process that goes over every possible ID reference to find out if it needs to be updated.

If there are N of references to ID blocks and there are M ID blocks that needed to be remapped
it would take N*M checks. These checks are scattered around the place and memory.
Each reference would only be updated at most once, but most of the time no update is needed at all.

Idea: By grouping the changes together will reduce the number of checks resulting in improved performance.
This would only require N checks. Additional benefits is improved data locality as data is only loaded once
in the L2 cache.

It has be implemented for the resyncing process and UI editors.
On an Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz 16Gig the resyncing process went
from 170 seconds to 145 seconds (during hotspot recording).

After this patch has been applied we could add similar approach
to references (references between data blocks) and functionality (tagged deletion).
In my understanding this could reduce the resyncing process to less than a second.
Opening the village production file between 10 and 20 seconds.

Flame graphs showing that UI remapping isn't visible anymore (`WM_main_remap_editor_id_reference`)
* Master {F12769210 size=full}
* This patch {F12769211 size=full}

Reviewed By: mont29

Maniphest Tasks: T94185

Differential Revision: https://developer.blender.org/D13615
2022-01-26 11:12:35 +01:00
b3bf46b78d Revert "CMake: include BROTLI_LIBRARIES in FREETYPE_LIBRARIES on UNIX"
This reverts commit 086f191169.

There was apparently a problem using APPEND which wasn't referenced
in the commit log.

Added comment noting the reason for the discrepancy.
2022-01-26 20:51:04 +11:00
0cb5eae9d0 Gizmo: optimize intersection tests, fix selection bias
Use more efficient logic for detecting when gizmos are under the cursor.
Even though this isn't a bottleneck, it runs on cursor motion in the
3D viewport, so avoiding any lag here is beneficial.

The common case for cursor motion without any gizmos was always
drawing two passes (one small, then again if nothing was found).

Now a single draw call at the larger size is used.

In isolation this gives around 1.2x-1.4x speedup.

When there are multiple gizmos a depth-buffer picking is used
(similar to object / bone selection) which is more involved but
still only performs 2x draw calls since the result is cached for reuse.

See note in gizmo_find_intersected_3d for a more detailed explanation.

Also restore the depth values in the selection result as they're
needed for gizmos to use selection bias.
Broken since support for GL_SELECT was removed.
2022-01-26 17:24:21 +11:00
1758dcd423 Fix T94794: Gizmo selection doesn't pick the front-most gizmo
Early on in 2.8x development gizmo-depth used GL_SELECT,
which has been removed. Bind the depth buffer so occlusion queries
use the front-most gizmo.

While this report only mentions face-maps, gizmo depth was ignored in
all cases. This wasn't noticeable in most cases though since the
transform gizmo for example was placed so gizmos didn't overlap.
2022-01-26 17:21:10 +11:00
9338126ecc Fix error using GPU selection cache for selection picking
When calling GPU_select_cache_begin, checking the selection mode used
the last used selection mode, not the one about to be used.

Using border select, then picking would not use the selection cache.

This wasn't noticeable by users as failing to use cache just completes
the selection without it (drawing the depth buffer unnecessarily).
2022-01-26 17:21:10 +11:00
46ae083113 Fix: OSL not recognizing UVTILE images
The OSL image compilation step needed to be taught about the new UVTILE
format for UDIM textures.

A small missing feature from OIIO[1] means this is a bit uglier than it
needs to be. Once we update to a version of OIIO with the fix we can
remove the string replace part.

[1] 35cb6a83e2

Differential Revision: https://developer.blender.org/D13912
2022-01-25 22:00:23 -08:00
b06fff4737 Cleanup: spelling in comments 2022-01-26 16:06:22 +11:00
94d2a611ec Cleanup: unused variable warning, formatting 2022-01-26 16:01:34 +11:00
37e555d2fe CMake: mark all BROTLI libraries as advanced 2022-01-26 16:01:00 +11:00
086f191169 CMake: include BROTLI_LIBRARIES in FREETYPE_LIBRARIES on UNIX
This was already done for APPLE & WIN32, which would
reference these libraries twice.

Now append BROTLI_LIBRARIES to FREETYPE_LIBRARIES when they're
required for linking.

No functional changes as all references to FREETYPE_LIBRARIES also
used BROTLI_LIBRARIES.
2022-01-26 16:00:55 +11:00
4c951bfa82 CMake: add WITH_SYSTEM_FREETYPE to link against the systems freetype 2022-01-26 15:31:30 +11:00
4530449317 CMake: resolve issues using pre-compiled & system libraries for Unix
When LIBDIR existed, searching for system libraries would always
first search 'LIBDIR'.

This meant "WITH_SYSTEM_*" would still prefer LIBDIR versions of
libraries if they exist.

The presence of LIBDIR also ignored the setting for WITH_STATIC_LIBS
which is now restored to the cached value once pre-compiled libraries
have been handled.
2022-01-26 15:20:32 +11:00
c4bedeb018 GLShader: Fix crash caused by redundant uniform declaration
This slipped through during a rebase.
2022-01-26 00:03:27 +01:00
83094d9a0d Fix T94149: Incorrect sound strip length
Fix formula in function `SEQ_sound_update_length`.

Formula for sound strip length was changed in commit ded68fb102, when
strip is added to timeline, but it was not changed in function
mentioned above.
2022-01-25 23:59:50 +01:00
c1b5cea63a Cleanup: Remove useless comments 2022-01-25 16:54:36 -06:00
b45e71e22c VSE: Build proxies only for slow movies
This change applies only for automatic proxy building, when strip
is added to timeline. Manual building process is not affected.

Don't build proxy file if movie is already fast enough to seek.
To determine seek performance, check if whole GOP can be decoded
in 100 milliseconds.

To consider some variation in GOP size, large number of packets are
read, assuming that each packet will produce 1 frame. While this is not
technically correct, it does give quite accurate estimate of maximum GOP
size.

This test will ensure consistent performance on wide array of machines.
Check should be done in order of few milliseconds.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11671
2022-01-25 22:06:46 +01:00
597eaeaa11 Deps builder: add VS2019, remove 2013/2015 support
This will allow building most deps with VS2019
SDL has some linker issues that are resolved in
a newer version, but that would be better handled
in a separate change.

VS2013 and VS2015 support which was broken has
been removed.
2022-01-25 13:55:18 -07:00
52b2769b9c Fix T95169: Assert in weld modifier code
Return early before accessing the array when all edges are merged.
2022-01-25 13:56:00 -06:00
c847122096 Cleanup: Remove leftover hair fade code in Cycles
Missed in rB1687903fb813f6656453fbc7c49237b06437370c
2022-01-25 14:14:39 -05:00
1687903fb8 Cleanup: Remove leftover hair fade code in Cycles. 2022-01-25 19:46:10 +01:00
c89d6b0953 Workbench: Use GPU_ARB_gpu_shader5 instead of GL variant
This is to be able to turn off the extension usage on demand.
2022-01-25 18:51:31 +01:00
2637f94358 GLShader: Fix buffer overflow caused by workaround uniform
In order to use a workaround builtin uniform, we need to count it
just like other uniforms and give it some space in the name buffer.

This also fixes extensions being added after the uniform declaration.
All `#extension` directives are now part of the gl backend.
2022-01-25 18:48:58 +01:00
3e2591c83e Cleanup: Remove unused variable
Mistake in a18bd403bf
2022-01-25 11:08:34 -06:00
0ec94d5359 Geometry Nodes: Port weld modifier to the merge by distance node
This commit moves the weld modifier code to the geometry module
so that it can be used in the "Merge by Distance" geometry node
from ec1b0c2014. The "All" mode is exposed in the node
for now, though we could expose the "Connected" mode in the future.

The modifier itself is responsible for creating the selections from
the vertex group. The "All" mode takes an `IndexMask` for the
selection, and the "Connected" mode takes a boolean array,
since it actually iterates over all edges.

Some disabled code for a BVH mode has not been copied over,
it's still accessible through the patches and git history anyway,
and it made the port slightly simpler.

Differential Revision: https://developer.blender.org/D13907
2022-01-25 11:07:31 -06:00
932d8dba52 Point Cloud: expose in Python API for release, now that Cycles uses it
Previously it was only part of experimental features in beta, however now
renderers can render point clouds generated by geometry nodes. Adding or
converting a point cloud object directly is still hidden by default, since
there is no good way to edit it.
2022-01-25 18:03:52 +01:00
ec1b0c2014 Geometry Nodes: Initial merge by distance node
This implements a merge by distance operation for point clouds.
Besides the geometry input, there are two others-- a selection
input to limit the operation to certain points, and the merge
distance. While it would be a reasonable feature, the distance
does not support a field currently, since that would make
the algorithm significantly more complex.

All attributes are merged to the merged points, with the values
mixed together. This same generic method is used for all attributes,
including `position`. The `id` attribute uses the value from the
first merged index for each point.

For the implementation, most of the effort goes into creating a
merge map to speed up attribute mixing. Some parts are inherently
single-threaded, like finding the final indices accounting for the
merged points. By far most of the time is spend balancing the
KD tree.

Mesh support will be added in the next commit.

Differential Revision: https://developer.blender.org/D13649
2022-01-25 10:51:52 -06:00
97a023a0d5 Cycles: Reorganize Acceleration Structure UI panel.
Only show options that are valid for the used device (CPU, GPU, Multi).

Note: The panel isn't shown for OPTIX anymore, unless Multi device is used.

Reference: https://developer.blender.org/D13592
2022-01-25 17:33:41 +01:00
e2a36a6e45 Cycles: Make Embree compact BVH optional
Make the Embree RTC_SCENE_FLAG_COMPACT flag optional and enabled per default.
Disabling it makes CPU rendering a bit faster in some scenes at the cost of a higher memory usage.

Barbershop renders about 3% faster, victor about 4% on CPU with compact BVH disabled.

Differential Revision: https://developer.blender.org/D13592
2022-01-25 17:22:08 +01:00
f26c36c96b make.bat: unify python detection
Several sub commands tried on their own
to locate python, given I wanted to look
in several locations for a broader libdir
compatibility this is best done in a
central location.

Python 3.9 is still preferred, but if
3.10-3.12 are available that be accepted
as well.

note: this is about the python version
make.bat uses to run various python helper
scripts, this change has no influence on
the python version blender itself uses.
2022-01-25 09:19:03 -07:00
c813a1b358 Cycles: add Point Info node
With (center) position, radius and random value outputs.

Eevee does not yet support rendering point clouds, but an untested
implementation of this node was added for when it does.

Ref T92573
2022-01-25 17:14:20 +01:00
eab066cbf2 VSE: Use timecodes by default
Movies with variable frame rate can cause mismatch of displayed frame
when proxies are used. Since proxies are not used for rendering, this
means, that output may be different than expected. This problem can be
avoided when timecodes are used.

Set used timecode to Record Run. Timecodes are built with proxies at
the same time, therefore if proxies are built and used this will
resolve possible mismatch of output.

Record run is chosen, because it will show frames based on time they
were encoded by encoder and should match behavior as if movie was
played back at normal speed. This change is done only for new strips
in order to not overwrite user defined settings.

Other minor changes:
- When proxies are enabled, size 25% is no longer set by default. It was mostly annoying anyway.
- Silence warning when timecode file is not present. This was introduced in 4adbe31e2f.
  Previously use of timecodes was hard-coded in sequencer and this error would spam console if timecodes would be
  enabled by default and proxies would be never built.

ref: T95093

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13905
2022-01-25 17:07:11 +01:00
Michael
2ed73fc97e Fix T94237: Glitch when copying unaligned ffmpeg buffer
Using a negative linesize to flip an image vertically is supported in
ffmpeg but not for every function.

This method treats frames that need and those that do not need alignment
the same. An RGBA frame buffer with alignment that ffmpeg decides is
optimal for the CPU and build options is allocated by ffmpeg.
The `sws_scale` does the colorspace transformation into this RGBA frame
buffer without flipping. Now the image is upside down and aligned.
The combined unaligning and vertical flipping is then done by
`av_image_copy_to_buffer` which seems to handle negative linesize
correctly.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13908
2022-01-25 17:07:11 +01:00
a18bd403bf Nodes: Improve link-drag search support for boolean math node
List the operations in the search instead of the "Boolean" socket names.
2022-01-25 09:51:20 -06:00
96667e3391 Fix T93058: Crash on opening old pre-2.80 .blend files.
Layer resync code would not yet fully properly deal with all possible
invalid status of ViewLayer comming from those older files.

Now put 2.80-doversion specific fixes into their own dedicated
function, so that they do not affect actual regular layer resync code
anymore. Also added some sanity-checks in main
`BKE_layer_collection_sync` code.
2022-01-25 16:44:55 +01:00
6c25aabddf GLShader: Fix fallback to gl_BaseInstance
All `#entension` directives needs to be first before any other
token. Add missing `;` after uniform declaration.
2022-01-25 16:23:54 +01:00
0477ca75f0 CMake/Linux: only link to brotli when using static precompiled libraries
The Brotli library only needs to be explicitly linked when using the
statically linked libraries. When using system libs they're shared, and
the .so loading mechanism takes care of dependencies.
2022-01-25 16:18:59 +01:00
Hallam Roberts
14f6afb090 Geometry Nodes: Expand the Boolean Math node
Currently the Boolean Math node only has 3 basic logic gates:
AND, OR, and NOT. This commit adds 6 additional logic gates
for convenience and ease of use.

- **Not And (NAND)** returns true when at least one input is false.
- **Nor (NOR)** returns true when both inputs are false.
- **Equal (XNOR)** returns true when both inputs are equal.
- **Not Equal (XOR)** returns true when both inputs are different.
- **Imply (IMPLY)** returns true unless the first input is true and
  the second is false.
- **Subtract (NIMPLY)** returns true when the first input is true and
  the second is false.

Differential Revision: https://developer.blender.org/D13774
2022-01-25 09:09:39 -06:00
368bfa80f9 Fix: Build issue with MSVC + Python 3.10
ssize_t is a posix type pyconfig.h previously
supplied for MSVC, it appears to have stopped
doing this in the python 3.10 headers.

Py_ssize_t is the type of the field this macro
actually returns, so best to to use that in our
code as well.
2022-01-25 07:54:28 -07:00
460e0a1347 Revert "Performance: Remap multiple items in UI"
This reverts commit 948211679f.
This commit introduced some regressions in the test suite.
As this change is a core part of blender Bastien and I decided to revert
it as the solution isn't clear and needs more investigation.

The following tests FAILED:
	 62 - blendfile_liblink (SEGFAULT)
	 63 - blendfile_library_overrides (SEGFAULT)

It fails in (id_us_ensure_real)
2022-01-25 15:31:46 +01:00
33ba298b5d GPUShader: Add optionnal single shader stage interface for in and out
This makes optionnal the use of a different interface for the geometry
shader stage output. When the vertex and geometry interface instance name
matches, a `_in` and `_out` suffix is added to the end of the instance name.

This makes it easier to have optional geometry shader stages.

# Conflicts:
#	source/blender/gpu/intern/gpu_shader_create_info.hh
2022-01-25 15:08:11 +01:00
Jeroen Bakker
948211679f Performance: Remap multiple items in UI
During sprite fright loading of complex scenes would spend a long time in remapping ID's
The remapping process is done on a per ID instance that resulted in a very time consuming
process that goes over every possible ID reference to find out if it needs to be updated.

If there are N of references to ID blocks and there are M ID blocks that needed to be remapped
it would take N*M checks. These checks are scattered around the place and memory.
Each reference would only be updated at most once, but most of the time no update is needed at all.

Idea: By grouping the changes together will reduce the number of checks resulting in improved performance.
This would only require N checks. Additional benefits is improved data locality as data is only loaded once
in the L2 cache.

It has be implemented for the resyncing process and UI editors.
On an Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz 16Gig the resyncing process went
from 170 seconds to 145 seconds (during hotspot recording).

After this patch has been applied we could add similar approach
to references (references between data blocks) and functionality (tagged deletion).
In my understanding this could reduce the resyncing process to less than a second.
Opening the village production file between 10 and 20 seconds.

Flame graphs showing that UI remapping isn't visible anymore (`WM_main_remap_editor_id_reference`)
* Master {F12769210 size=full}
* This patch {F12769211 size=full}

Reviewed By: mont29

Maniphest Tasks: T94185

Differential Revision: https://developer.blender.org/D13615
2022-01-25 14:51:44 +01:00
Jeroen Bakker
3f42417cd4 Draw: Migrate hair refine compute shader to use create info.
This patch migrates the draw manager hair refine compute shader to use
GPUShaderCreateInfo.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13915
2022-01-25 14:46:45 +01:00
196da819ba Python: Expose crazyspace correction functionality via RNA
Allows to perform correction of coordinate delta/displacement in a
similar way of how sculpt mode handles sculpting on a deformed mesh.
An example of usecase of this is allowing riggers and sciprters to
improve corrective shapekey workflow.

The usage consists of pre-processing and access. For example:

  object.crazyspace_eval(depsgraph, scene)

  # When we have a difference between two vertices and want to convert
  # it to a space to be stored, say, in shapekey:
  delta_in_orig_space = rigged_ob.crazyspace_displacement_to_original(
      vertex_index=i, displacement=delta)

  # The reverse of above.
  delta_in_deformed_space = rigged_ob.crazyspace_displacement_to_deformed(
      vertex_index=i, displacement=delta)

  object.crazyspace_eval_clear()

Fuller explanation with actual usecases and studio examples are written in
the comment:

  https://developer.blender.org/D13892#368898

Differential Revision: https://developer.blender.org/D13892
2022-01-25 14:43:44 +01:00
31296f6f9d CMake/Linux: Fix Brotli library finding on standard distros.
Brotli seems to add a custom postfix to its static libraries by default,
but in Debian at least libraries are just named the same for both shared
and static versions, as usual.

So add standard name after static-specific ones.

Follow-up to rB4c617c06e9cb and rBa000de7c2a4d.
2022-01-25 14:34:33 +01:00
0f89bcdbeb Fix depsgraphs sharing IDs via evaluated edit mesh
The evaluated mesh is a result of evaluated modifiers, and referencing
other evaluated IDs such as materials.
It can not be stored in the EditMesh structure which is intended to be
re-used by many areas. Such sharing was causing ownership errors causing
bugs like

  T93855: Cycles crash with edit mode and simultaneous viewport and final render

The proposed solution is to store the evaluated edit mesh and its cage in
the object's runtime field. The motivation goes as following:

- It allows to avoid ownership problems like the ones in the linked report.
- Object level is chosen over mesh level is because the evaluated mesh
  is affected by modifiers, which are on the object level.

This patch allows to have modifier stack of an object which shares mesh with
an object which is in edit mode to be properly taken into account (before
the change the modifier stack from the active object will be used for all
objects which share the mesh).

There is a change in the way how copy-on-write is handled in the edit mode to
allow proper state update when changing active scene (or having two windows
with different scenes). Previously, the copt-on-write would have been ignored
by skipping tagging CoW component. Now it is ignored from within the CoW
operation callback. This allows to update edit pointers for objects which are
not from the current depsgraph and where the edit_mesh was never assigned in
the case when the depsgraph was evaluated prior the active depsgraph.

There is no user level changes changes expected with the CoW handling changes:
should not affect on neither performance, nor memory consumption.

Tested scenarios:

- Various modifiers configurations of objects sharing mesh and be part of the
  same scene.

- Steps from the reports: T93855, T82952, T77359

This also fixes T76609, T72733 and perhaps other reports.

Differential Revision: https://developer.blender.org/D13824
2022-01-25 14:32:23 +01:00
c5980ada4f GPU: Add GPU_shader_create_from_info_name
This function will be used as the way to build shaders from
create_infos. The previous used method was using a private function.
2022-01-25 14:22:44 +01:00
Kevin C. Burke
17b0c06946 Animation: Equalize Handle Operator
The Equalize Handles operator allows users to make selected handle
lengths uniform: either respecting their original angle from the key
control point or by flattening their angle (removing the overshoot
sometimes produced by certain handle types).

Design: T94172

Reviewed by: sybren

Differential Revision: https://developer.blender.org/D13702
2022-01-25 11:41:40 +01:00
a000de7c2a CMake/Linux: find Brotli library the proper way
Use a `FindBrotli.cmake` module instead of manually appending library
paths.

This is just for Linux; Windows and macOS will be reviewed separately.
2022-01-25 11:34:13 +01:00
a54142f3f1 Cleanup: Replace reinterp cast with static cast.
Conversion of void* should not use the unsafe reinterp cast.
2022-01-25 10:18:32 +01:00
1b1693d43f Fix (unreported) RNA setter for TextEditor's text ID pointer not ensuring real user. 2022-01-25 09:12:13 +01:00
2e9b8689e4 Fix T95037: Allow making local IDs that are not used by anything.
Some IDs (like text ones) can be linked and only kept around thanks to
editors, allow making such IDs local in `BKE_lib_id_make_local_generic`.

Also refactor logic checking whether ID should be made directly local or
copied into its own util function, so that we can remain sure all
special-cases 'make local' code still uses the same logic here.
2022-01-25 09:12:13 +01:00
a2301b1d91 Geometry Nodes: Add description to curve handle input node
The "Relative" input isn't immediately obvious unless one is familar
with that naming pattern, so an explicit description may be helpful.
2022-01-25 00:04:33 -06:00
114b06b3cb Cleanup: Remove unused pixel buffer in read_render_tile
A left over remnant from rB1a134c4c30a643ada1b9a7a037040b5f5c173a28

Differential Revision: https://developer.blender.org/D13901
2022-01-24 20:53:19 -08:00
2bf519d211 Cleanup: Correct location of node function declarations
Currently there are many function declarations in `BKE_node.h` that
don't actually have implementations in blenkernel. This commit moves
the declarations to `NOD_composite.h`, `NOD_texture.h`, and
`NOD_shader.h` instead. This helps to clarify the purpose of the
different modules.

Differential Revision: https://developer.blender.org/D13869
2022-01-24 16:18:30 -06:00
4d799db72f LShaderInterface: Fix interface binding with UBO containing arrays
To avoid the issue we search using the name in the `name_buffer_` which
already have the array suffix stripped out.
2022-01-24 21:25:53 +01:00
5a0c5912a4 Tests: Enable new tests for geometry nodes extrude node
rB95981c9876483256b28
2022-01-24 13:55:32 -06:00
083de503ce GLShaderInterface: Fix interface from createInfo not setting bindings
This is because the `glUniform1i` calls were not preceeded by `glUseProgram`
which made parameters not stick.
2022-01-24 20:26:33 +01:00
04c3b08518 Fix T94355: Cycles wrong GPU bake with adaptive sampling 2022-01-24 19:18:11 +01:00
263f862ba5 Add workaround for broken interface query functions on Intel HD Graphics 4400 and 4600
Fixes T93680

For current drivers of Intel HD Graphics 4400 and 4600, various Program Introspection functions appear broken and return incorrect values, causing crashes in the current handling of SSBOs. Disable use of this feature on those devices. Add checks to features that use SSBOs (Hair and Subdivision Modifier).

Reviewed By: fclem, jbakker

Maniphest Tasks: T93680

Differential Revision: https://developer.blender.org/D13806
2022-01-24 18:48:16 +01:00
e2337b5342 GPU subdiv: reduce memory usage for point IBO
The point IBO should only have data for coarse vertices (or in general,
the vertices in the original mesh). As it used for displaying the
vertices for selection in edit mode, and as it indexes into the VBOs for
the positions and edit data, it is itself only indexed by coarse/
original vertex index.

For the subdivision case, this would allocate space for the final
subdivision vertex and reallocate to make room for loose geometry,
although only the first coarse vertex count amount of data would be.

Now just allocate for the required memory. Also reuse index buffer APIs
instead of doing manual work.
2022-01-24 18:42:37 +01:00
90d61600fc GPU subdiv: fix unitialized data 2022-01-24 18:27:05 +01:00
Jens Ehrhardt
e673cfc2d7 Fix T95099: Have launcher wait for Blender exit
unity launches blender in background mode to do some
file conversions, ever since the launcher got introduced
this process broke.

The root cause here is: Unity looks up the default program
to launch .blend files with, which is now the launcher, then
launches it in background mode with a script to export the data.

The launcher however was designed to exit as quickly as
possible so there would not be an extra background process
lingering. It does not wait for blender to exit and does not
pass back any error codes.

This broke unity's workflow since it assumed if the process
exits and succeeds the data *must* be ready for reading which
no longer holds true.

This change keeps the launcher design as was previously,
*except* when launching in background mode, then it
waits and passes back any error codes, thus restoring
unity's workflow.

Differential Revision: https://developer.blender.org/D13894
Reviewed by: LazyDodo, Brecht
2022-01-24 08:43:38 -07:00
25fa5792e6 Cleanup: Move the "toggle smooth brush" functionality to functions
This is so it will be easier to keep the logic to toggle on/off in sync
because they are declared close to eachother.
2022-01-24 16:00:01 +01:00
a215d7e230 Hook up invert and smooth mode to weight and vertex paint
Previously weight paint wasn't hooked up to the "Smooth" and "Invert" modes.
With this patch it is not possible to use the "Smooth" and "Invert"
modifiers for the draw keybindings.

Reviewed By: Campbell Barton

Differential Revision: http://developer.blender.org/D13857
2022-01-24 16:00:01 +01:00
0928fe8710 Fix T94651: Cycles error with pointcloud vector attribute 2022-01-24 15:58:32 +01:00
4c617c06e9 Linux/CMake: link libbbrotli*.a along with new FreeType
Add `libbrotlidec-static.a` and `libbrotlicommon-static.a` to the CMake
`$FREETYPE_LIBRARIES` variable; they'll be required when the Linux libs
for the FreeType upgrade lands (D13448).

The order of libraries is different compared to the similar lines in the
Windows and Apple CMake files, to prevent linker errors on Linux.
2022-01-24 15:44:03 +01:00
796ef560b4 Fix Image.gl_touch not loading image.
Same fix as for {rBc09f61a9157ddee0e186db52fb7ac0f4cdae09da}
2022-01-24 15:32:04 +01:00
578baf95e0 Cleanup: Remove unused enum
The `SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL` value is not actually
being used.

Keeping it in the code only complicates its readability.
2022-01-24 10:18:34 -03:00
e774f2c901 GPUShaderCreateInfo: Add manual validation of bindpoints
Some drivers/glsl compilers will not warn about multiple resources using
the same binding, creating silent errors.

This patch checks for this case and outputs a descriptive error message if
a particular createInfo merge error is founds.

Other validation can be added later.
2022-01-24 13:28:33 +01:00
7708a848c9 Cleanup: sort cmake file lists 2022-01-24 21:23:30 +11:00
4b1f243e4d Cleanup: sort struct forward declarations 2022-01-24 21:16:06 +11:00
f9b6a257bd Cleanup: clang-format 2022-01-24 21:15:25 +11:00
95981c9876 Geometry Nodes: Extrude Mesh Node
This patch introduces an extrude node with three modes. The vertex mode
is quite simple, and just attaches new edges to the selected vertices.
The edge mode attaches new faces to the selected edges. The faces mode
extrudes patches of selected faces, or each selected face individually,
depending on the "Individual" boolean input.

The default value of the "Offset" input is the mesh's normals, which
can be scaled with the "Offset Scale" input.

**Attribute Propagation**
Attributes are transferred to the new elements with specific rules.
Attributes will never change domains for interpolations. Generally
boolean attributes are propagated with "or", meaning any connected
"true" value that is mixed in for other types will cause the new value
to be "true" as well. The `"id"` attribute does not have any special
handling currently.

Vertex Mode
 - Vertex: Copied values of selected vertices.
 - Edge: Averaged values of selected edges. For booleans, edges are
   selected if any connected edges are selected.
Edge Mode
 - Vertex: Copied values of extruded vertices.
 - Connecting edges (vertical): Average values of connected extruded
   edges. For booleans, the edges are selected if any connected
   extruded edges are selected.
 - Duplicate edges: Copied values of selected edges.
 - Face: Averaged values of all faces connected to the selected edge.
   For booleans, faces are selected if any connected original faces
   are selected.
 - Corner: Averaged values of corresponding corners in all faces
   connected to selected edges. For booleans, corners are selected
   if one of those corners are selected.
Face Mode
 - Vertex: Copied values of extruded vertices.
 - Connecting edges (vertical): Average values of connected selected
   edges, not including the edges "on top" of extruded regions.
   For booleans, edges are selected when any connected extruded edges
   were selected.
 - Duplicate edges: Copied values of extruded edges.
 - Face: Copied values of the corresponding selected faces.
 - Corner: Copied values of corresponding corners in selected faces.
Individual Face Mode
 - Vertex: Copied values of extruded vertices.
 - Connecting edges (vertical): Average values of the two neighboring
   edges on each extruded face. For booleans, edges are selected
   when at least one neighbor on the extruded face was selected.
 - Duplicate edges: Copied values of extruded edges.
 - Face: Copied values of the corresponding selected faces.
 - Corner: Copied values of corresponding corners in selected faces.

**Differences from edit mode**
In face mode (non-individual), the behavior can be different than the
extrude tools in edit mode-- this node doesn't handle keeping the back-
faces around in the cases that the edit mode tools do. The planned
"Solidify" node will handle that use case instead. Keeping this node
simpler and faster is preferable at this point, especially because that
sort of "smart" behavior is not that predictable and makes less sense
in a procedural context.

In the future, an "Even Offset" option could be added to this node
hopefully fairly simply. For now it is left out in order to keep
the patch simpler.

**Implementation**
For the implementation, the `Mesh` data structure is used directly
rather than converting to `BMesh` and back like D12224. This optimizes
for large extrusion operations rather than many sequential extrusions.
While this is potentially more verbose, it has some important benefits:
First, there is no conversion to and from `BMesh`. The code only has
to fill arrays and it can do that all at once, making each component of
the algorithm much easier to optimize. It also makes the attribute
interpolation more explicit, and likely faster. Only limited topology
maps must be created in most cases.

While there are some necessary loops and allocations with the size of
the entire mesh, I tried to keep everything I could on the order of the
size of the selection rather than the size of the mesh. In that respect,
the individual faces mode is the best, since there is no topology
information necessary, and the amount of work just depends on the size
of the selection.

Modifying an existing mesh instead of generating a new one was a bit
of a toss-up, but has a few potential benefits:
 - Avoids manually copying over attribute data for original elements.
 - Avoids some overhead of creating a new mesh.
 - Can potentially take advantage of future ammortized mesh growth.
This could be changed easily if it turns out to be the wrong choice.

Differential Revision: https://developer.blender.org/D13709
2022-01-23 22:42:49 -06:00
46475b8e11 Cleanup: Grammar: its self vs. itself 2022-01-23 22:34:56 -06:00
43e3a33082 Cleanup: spelling in comments 2022-01-24 14:35:23 +11:00
c69a581c0b Cleanup: avoid positional struct initialization
When moving to C++ field for initialization was removed.
Favor assignments to field names as it reads better and avoids bugs if
files are ever re-arranged as well as mistakes (see T94784).

Note that the generated optimized output is identical with GCC11.
2022-01-24 14:27:16 +11:00
abf30007ab Geometry Nodes: Triangulate Node - Add Selection Input
This adds a selection field input to the node, faces that are selected and
meet the minimum vertex count threshold will be triangulated.

Differential Revision: https://developer.blender.org/D13804
2022-01-23 13:27:53 -06:00
38c7378949 Geometry Nodes: Relative Handle Position Mode
Add a boolean option to have the Curve Handle Position input node return the
position of the handle relative to each point position.

Differential Revision: https://developer.blender.org/D12947
2022-01-23 12:29:37 -06:00
807c58aae4 Cleanup: separate function for Alembic edge crease reading 2022-01-23 16:35:11 +01:00
889712927f Fix Cycles crash collecting render stats 2022-01-23 16:30:57 +01:00
5c4a5fd40d Cleanup: Improvements to mesh to bmesh conversion
- Use `Array` and `Span` instead of raw pointers.
- Declare variables in smaller scope.
- Use references instead of pointers.
2022-01-22 18:09:30 -06:00
6cd977b903 Fix T94760: Crash building BMesh when opening file
A large polygon in the file from the report caused `alloca`
to exceed the maximum stack size, causing a crash.  Instead
of using `alloca`, use `blender::Array` with an inline buffer.

Based on a patch by Germano Cavalcante (@mano-wii).

Differential Revision: https://developer.blender.org/D13898
2022-01-22 13:06:15 -06:00
dde997086c LineArt: Option to keep contour when using face mark filtering.
When enabled, it will keep contour around the object instead of hide them by rule of face mark,
so the object can always have full contour while filtering out some of the feature lines inside certain regions.

Reviewed By: Antonio Vazquez (antoniov), Aleš Jelovčan (frogstomp)

Differential Revision: https://developer.blender.org/D13847
2022-01-22 16:57:25 +08:00
579e8ebe79 LineArt: Back face culling
Option to discard back faced triangles, this speeds up calculation especially for when you only want to show visible feature lines.

Reviewed By: Antonio Vazquez (antoniov), Aleš Jelovčan (frogstomp)

Differential Revision: https://developer.blender.org/D13848
2022-01-22 16:41:08 +08:00
5ae76fae90 LineArt: Noise tolerant chaining.
Instead of splitting it at each occlusion change, it tolerates short segments of "zig-zag" occlusion incoherence and doesn't split the chain at these points, thus creating a much smoother result.

Reviewed By: Antonio Vazquez (antoniov), Aleš Jelovčan (frogstomp)

Differential Revision: https://developer.blender.org/D13851
2022-01-22 16:13:44 +08:00
e88d966737 BMesh: merge normal and tessellation calculation on undo
This gives a modest speedup as calculating tessellation and face
normals at the same time can be more efficiently multi-threaded.

Also avoids calculating face normals twice,
oversight in d590e223da.
2022-01-22 18:02:12 +11:00
25c99e72cd Fix linking in debug mode
b7878a4d45 seems to have caused linking
issues building debug mode on Linux.

Using extern "C" resolves.
2022-01-22 17:59:09 +11:00
b7878a4d45 Cleanup: Move bmesh_mesh_convert.c to C++
Useful for a simpler bug fix, code clarity,
and easier possible optimizations in the future.
2022-01-21 23:53:15 -06:00
Aras Pranckevicius
9350005d8b Fix T13879 new OBJ exporter not saving files with Unicode characters.
Need to use BLI_fopen instead of fopen.
2022-01-21 20:14:01 -05:00
1f026a3db9 Cleanup: Use references, const variables 2022-01-21 18:20:07 -06:00
Laurynas Duburas
45d038181a Curves: Improve accuracy and clarity of NURBS knots calculation
This commit improves NURBS knot generation by adding proper support
for the combination of the Bezier and cyclic options. In other cases
the resulting knot doesn't change. This cyclic Bezier knot is used to
create accurate accurate "Nurbs Circle", "Nurbs Cylinder" primitives.
"Nurbs Sphere" and "Nurbs Torus" primitives are also improved by
tweaking the spin operator.

The knot vector in 3rd order NURBS curve with Bezier option turned on
(without cyclic) is changed in comparison to previous calculations,
although it doesn't change the curve shape itself.

The accuracy of the of NURBS circle is fixed, which can be checked by
comparing with mesh circle. Tessellation spacing differences in
circular NURBS is also fixed, which is observable with the NURBS
cylinder and sphere primitives. These were causing seam-like effects.

This commit contains comments from Piotr Makal (@pmakal).

Differential Revision: https://developer.blender.org/D11664
2022-01-21 16:40:49 -06:00
d590e223da Fix T94974: Invalid normals in edit mode
Normal layers currently aren't stored in the undo step
mesh storage, since they are not stored in files at all.
However, the edit mesh expects normals to be fully
calculated, and does not keep track of a dirty state.
This patch updates the normals in the BMesh created
by loading an undo step.

Another option would be calculating the normals on
the undo mesh first, which might be better if Mesh
normal calculation is faster than BMesh calculation,
but the preferred method to access vertex normals fails
in this case, because the mesh runtime mutexes are not
initialized for undo-state meshes.

Differential Revision: https://developer.blender.org/D13859
2022-01-21 16:14:00 -06:00
68aa35ae74 Fix T94967: Sculpt mode crashes with missing normals
From an error in rBcfa53e0fbeed, the vertex normals in `SculptSession`
seem to be used, but in the case when no "pbvh" is used, the value of
the pointer is never assigned.

Normals were not generally dirty before this "ensure" function with
regular sculpting operations, so this addition shouldn't have any cost.

Differential Revision: https://developer.blender.org/D13854
2022-01-21 16:12:12 -06:00
294ab84909 Fix T95097: Attribute Capture node UI inconsistency
All other nodes with data type and domain choices have the domain
below the data type. Generally that order makes sense, because it's
consistent with nodes that have no domain drop-down.
2022-01-21 16:08:21 -06:00
1c23a06706 Fix: Applying object transform can create normal layers
Because this operator is used on original objects, it's best to tag
the normals dirty instead of explicitly calculating them, to avoid
unnecessarily storing normal layers on an original object (since
they might have to be recalculated during evaluation anyway).
There may be other places this change is helpful, but being
conservative is likely better for now.

Related to T95125
2022-01-21 16:04:16 -06:00
e07b217669 Build: update macOS for FreeType library with woff2 support
Ref D13448, T93161
2022-01-21 21:36:00 +01:00
32ceb0b807 Fix std::optional value() build error on older macOS SDK
No longer happens on the buildbot, but for users building with an older
Xcode we still need to avoid using value().
2022-01-21 21:36:00 +01:00
4f9be46526 Distribute Points on Faces: Fix missing minimum value for density socket
Negative number density is not a part of this reality.
2022-01-21 15:31:51 -05:00
54d69a2fd1 Fix new OBJ exporter to handle instancing.
The new OBJ exporter did not handle object instances.
The fix is to use a dependency graph iterator, asking for instances.
Unfortunately that iterator makes a temporary copy of instance objects
that does not persist past the iteration, but we need to save all the
objects and meshes to write later, so the Object has to be copied now.

This changed some unit tests. Even though the tests don't have instancing,
the iterator also picks up some Text objects as Mesh ones (which is a good
thing), resulting in two more objects in the all_objects.obj file output.
2022-01-21 14:37:33 -05:00
9d274a609c cmake/win: Platform update for freetype 2.11.0
freetype now depends on brotli
2022-01-21 11:40:53 -07:00
58f8eb54a3 deps/win: fix typo in brotli.cmake
it was harvesting to the zstd folder which
is not where these libs ought to be.
2022-01-21 11:36:56 -07:00
RUben
5b90c046d5 Fix: Object selection delay with many objects
With object collection properties open there was a huge delay when
switching active objects in a large scene, (~10k objects, ~5m vertices).
This is due to a non-optimal function to query all the collections the object is in.

To solve this the code can be simplified by using `bpy.types.Object.users_collection`
This returns all the collections the object is in removing the need to compute this in python.
2022-01-21 13:13:04 -05:00
c20f209b1c Cmake/Deps: Freetype 2.11.0 / brotli 1.0.9
The UI team requested adding woff2 support to freetype.
this required a new dependency brotli.

This changes adds brotili to the builder and bumps
freetype to version 2.11.0

As freetype now depends on other libraries, for consistency
all use of ${FREETYPE_LIBRARY} in cmake has been updated to
use ${FREETYPE_LIBRARIES} adjustments have been made in the
windows platform file, all other platforms use cmake's
FindFreeType.cmake which already sets this variable.

reviewed by: brecht

Differential Revision: https://developer.blender.org/D13448
2022-01-21 10:26:05 -07:00
59fc95bf97 UI: Clarify Active Movie Clip tooltip
See T92299
2022-01-21 12:02:34 -05:00
d034b85f33 Geometry Nodes: new Scale Elements nodes
This node can scale individual edges and faces. When multiple selected
faces/edges share the same vertices, they are scaled together.
The center and scaling factor is averaged in this case.

For some examples see D13757.

Differential Revision: https://developer.blender.org/D13757
2022-01-21 17:34:47 +01:00
Alan Babu
c39d514a4e Geometry Nodes: Flip Faces Node
Currently there is no way to flip normals in geometry nodes. This node
makes that possible by flipping the winding order of selected faces.
The node is purposely not called "Flip Normals", because normals are
derived data, changing them is only a side effect. The real change is
that the vertex and edge indices in the face corners of every selected
polygon are reversed, and face corner attribute data is reversed.

While there are existing utilities to flip a polygon and its custom
data, this node aims to process an attribute's data together instead
of processing all attributes separately for each index.

Differential Revision: https://developer.blender.org/D13809
2022-01-21 09:26:40 -06:00
4251455dcd Geometry Nodes: Mesh Island Node - Rename Index Socket
Rename 'Index' Socket to 'Island Index' to make it more consistent with
'Island Count'

Differential Revision: https://developer.blender.org/D13893
2022-01-21 09:01:18 -06:00
87c5423c5e Geometry Nodes: New Output for Number of Mesh Islands
Adds a second output to the Mesh Islands node that shows the total
number of islands as a field.

Differential Revision: https://developer.blender.org/D13700
2022-01-21 08:30:02 -06:00
Brecht Van Lommel
d68ce0e475 Cycles: add pointcloud implementation for Metal RT
This is not currently working, with an internal compiler error. However
we are currently using BVH2 instead of Metal RT. So this has no effect for
users, it's being committed to avoid the code getting outdated.

Ref T92573, T92212

Differential Revision: https://developer.blender.org/D13632
2022-01-21 14:42:27 +01:00
5e51a5e8a4 Fix error in previous commit. 2022-01-21 14:35:27 +01:00
93065a67c6 GPU: Disable create info for 2d image overlay merge.
This shader needs to use the same interface as the OCIO shader. On Linux
and Windows this seems to be the case. On MacOS however there is a
mismatch that makes the overlay texture to be completely black when
switching to workbench in the Shader workspace.

This is just a temporarily work-around as this should be solved. Due to
the poor GPU debugging facilities on Mac we haven't been able to
pin-point the root cause.
2022-01-21 14:24:30 +01:00
f6888b530a Attributes: add operator to convert generic attributes to other types
Editing of generic attributes on the original objects in edit modes is
still very limited. However, when applying a geometry nodes modifier
that generates new attributes. These attributes will show up in the
Attributes panel.

Currently, our exporters are not capable of exporting generic attributes.
Therefore, for the time being, a work around is to apply geometry nodes
and then convert a generic attribute to a task specific attribute like a
uv map, vertex group or vertex color layer. Once more parts of Blender
support generic attributes, this will become less important.

Currently, only meshes are supported by the operator. However, it would
be relatively easy to extend it to other geometry types.

Differential Revision: https://developer.blender.org/D13838
2022-01-21 12:47:35 +01:00
36c40760a5 .obj: simplify templates in FileHandler, add comments
- Remove redundant template from `FormattingSyntax`.
- Replace one enable_if with static assert for readability
- Add comments

No functional change expected.

Reviewed by: jacqueslucke
Differential Revision: https://developer.blender.org/D13882
2022-01-21 15:28:04 +05:30
23fa5bb723 GPU: Remove unused resources in shader create info.
When adding the shader create infos some additional resources where defined
that doesn't exist in the shader itself. This commit will remove them.
2022-01-21 09:58:58 +01:00
64196a6b29 Cleanup: struct/class mismatch. 2022-01-21 07:52:10 +01:00
872dc1038c UI: exclude "Undo History" from menu search
Undo history was showing in menu search since converting undo history to
a menu from a popup, see: 0e1bb232e6.
2022-01-21 16:30:11 +11:00
53923f502d Fix T95078: Setting digits as modifier in keymap doesn't work
Allow any non-modifier keyboard events to be used.

Note that the existing check for >= EVT_AKEY allowed NDOF and other
non-keyboard events (including modifiers, which didn't work).
2022-01-21 15:20:02 +11:00
20655128c9 Cleanup: event type values & defines
- Use defines instead of magic numbers for F-Key & NDOF range checks.
- Use explicit values for NDOF event types.
- Minor clarification to doc-strings.
- Use doxy-sections.
2022-01-21 15:19:00 +11:00
5fca280c80 Fix: Node link drag search doesn't list shader sockets
Shader sockets were only available when dragging from inputs.
2022-01-20 16:26:43 -06:00
1ac2d2dcb6 Fix T93711: Cycles diffuse/glossy baking does not write alpha
With the change to use render passes internally the alpha channel got lost.
Add support for these render passes to output an alpha channel for baking.
2022-01-20 22:32:35 +01:00
14d261d23a Cleanup: Resolve unused variable warning, make function static 2022-01-20 15:10:56 -06:00
9ca1052226 Fix Python API docs build error
There is probably a better solution that's possible, but the few other
things I tried didn't work, and the build error should be resolved for
the buildbots. This is similar to the "breaks" in the namespace for
functions declared in `ED_node.h`.
2022-01-20 15:10:28 -06:00
4369c5817a Fix T94457: random result using sky texture in light object
Still not well defined, but should not longer use uninitialized values that
gave different results between CPU/GPU and subsequent renders.
2022-01-20 21:28:41 +01:00
22a8e934e4 Fix T94698: artifacts in light passes with mixed volumes and surfaces 2022-01-20 20:55:43 +01:00
e1ae95f6b2 Fix T93520: wrong subframe motion blur with rigid body physics
The code here was using velocity based interpolation copied from particles.
However there is no velocity cached in the rigid body point cache so the
results were non-sensical.
2022-01-20 20:40:55 +01:00
24e00c115c Fix T94712: Cycles missing colorspace transform on grayscale images 2022-01-20 20:40:55 +01:00
2559d79d2f Fix T94582: Cycles mapping shader node incorrectly skipped in Normal mode
Even if no rotation or scale is specified, we must still always normalize
the output.
2022-01-20 20:40:55 +01:00
Charlie Jolly
cc1a48e395 Geometry Nodes: Curve Primitive Arc
This adds a new curve primitive to generate arcs.

Radius mode (default): Generates a fixed radius arc on XY plane
with controls for Angle, Sweep and Invert.

Points mode: Generates a three point curve arc from Start to End
via Middle with an Angle Offset and option to invert the arc.
There are also outputs for arc center, radius and normal direction
relative to the Z-axis.

This patch is based on previous patches
D11713 and D13100 from @guitargeek. Thank you.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13640
2022-01-20 19:04:09 +00:00
6baccc36a0 Fix continuous stream of thumbnail notifiers after redo
This fixes a similar issue as the previous commit, but this time the
continuous notifiers would be sent after redoing. E.g. after moving an
object, and then modifying the transform in the "Adjust Last Operation"
panel.
2022-01-20 18:51:49 +01:00
d552b3c0c0 Fix file/asset thumbnails causing constant stream of notifiers
The thumbnail caching continuously sends `ND_SPACE_FILE_PREVIEW`
notifiers via a timer. But this timer was never ended properly after
thumbnails are fully loaded into the cache.
Wouldn't actually cause a refresh or redraw, send and process the
notifiers.

I already tried to avoid this for the asset view template, but
apparently that wasn't working correctly. For the File/Asset Browser I
never applied that fix to avoid possible regressions before the release.
2022-01-20 18:51:49 +01:00
902a103f80 Cleanup: Move node editor files to proper namespace
This commit moves code in all node editor files to the
`blender::ed::space_node` namespace, except for C API
functions defined in `ED_node.h`, which can only be moved
once all areas calling them are moved to C++.

The change is fairly straightforward, I just moved a couple
of "ED_" code blocks around to make the namespace more
contiguous, and there's the method for adding a pointer to
a struct in a C++ namespace in DNA.

Differential Revision: https://developer.blender.org/D13871
2022-01-20 10:36:56 -06:00
19622ffc5b Cleanup: Remove OpenCL workaround in volume_sample_channel(). 2022-01-20 17:02:20 +01:00
f6c8a78ac6 Cycles: Fix bvh2 gen on Apple Silicon and use it to speed up renders
This patch fixes a correctness issue discovered in the `int4 select(...)` function on Apple Silicon machines, which causes bad bvh2 builds. Although the generated bvh2s give correct renders, the resulting runtime performance is terrible. This fix allows us to switch over to bvh2 on Apple Silicon giving a significant performance uplift for many of the standard benchmarking assets. It also fixes some unit test failures stemming from the use of MetalRT, and trivially enables the new pointcloud primitive.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13877
2022-01-20 15:37:49 +00:00
9315215b20 Fix T94726: crash with GPU subdivision on a custom bone shape
Custom bones are drawn by instancing the GPUBatch of the base object. To
access the mesh and its GPUBatch, `BKE_object_get_evaluated_mesh` was
used. However, since GPU subdivision support, this will return a
subdivision wrapper which will never be drawn, and thus will have an
invalid batch, which caused the crash.

`BKE_object_get_evaluated_mesh_no_subsurf` should be used instead, to
return the mesh that will be drawn, and have the subdivision evaluated
on the GPU. Note that the rest of the draw code is already using this
function.
2022-01-20 15:28:08 +01:00
264fe10ddd Cleanup: Remove unused python helper function.
Branched Path has been removed with the Cycles X merge.
2022-01-20 14:34:20 +01:00
969a571e0f Revert "Sculpt: Multires Heal Brush"
This reverts commit ae349eb2d5.
2022-01-20 03:55:41 -08:00
4425e0cd64 Subdivision: add support for vertex creasing
This adds vertex creasing support for OpenSubDiv for modeling, rendering,
Alembic and USD I/O.

For modeling, vertex creasing follows the edge creasing implementation with an
operator accessible through the Vertex menu in Edit Mode, and some parameter in
the properties panel. The option in the Subsurf and Multires to use edge
creasing also affects vertex creasing.

The vertex crease data is stored as a CustomData layer, unlike edge creases
which for now are stored in `MEdge`, but will in the future also be moved to
a `CustomData` layer. See comments for details on the difference in behavior
for the `CD_CREASE` layer between egdes and vertices.

For Cycles this adds sockets on the Mesh node to hold data about which vertices
are creased (one socket for the indices, one for the weigths).

Viewport rendering of vertex creasing reuses the same color scheme as for edges
and creased vertices are drawn bigger than uncreased vertices.

For Alembic and USD, vertex crease support follows the edge crease
implementation, they are always read, but only exported if a `Subsurf` modifier
is present on the Mesh.

Reviewed By: brecht, fclem, sergey, sybren, campbellbarton

Differential Revision: https://developer.blender.org/D10145
2022-01-20 12:21:34 +01:00
9b4c017031 Cleanup: Remove incorrect comment 2022-01-19 23:56:27 -06:00
ae349eb2d5 Sculpt: Multires Heal Brush
This brush fixes the random spikes that
occasionally happen in multires models.
These spikes can be nearly impossible to
fix manually and can make working with
multires a nightmare.
2022-01-19 17:28:22 -08:00
eb3ff1d6f9 Cleanup: spelling in comments 2022-01-20 11:59:20 +11:00
1d536c21dd Cleanup: clang-format 2022-01-20 11:59:20 +11:00
e3f9d9b206 Cleanup: quiet ASAN warnings for divide by zero & NULL memcpy args
No functional changes as the inf value was never used &
memcpy args were only NULL when the size to copy was zero.
2022-01-20 11:59:20 +11:00
b7fe27314b Mesh RNA API: Expose contiguous normal arrays
Since vertex and face normals are now stored on the mesh when necessary,
we can expose them as contiguous arrays of vectors in the Python API.
This can give render engines and other addons easy access to they data
for fast access through a regular collection property.

While "Mesh Vertex" still has a "normal" property in RNA, that is only
maintained in order to avoid breaking the existing API, and accessing
it is less efficient than accessing the normals directly.

I made the normal arrays read-only, because modifying them could
put them in an invalid state. This is inline with how we treat the data
internally, and helps keep relationships between data clear.

Differential Revision: https://developer.blender.org/D13839
2022-01-19 18:43:05 -06:00
b47a1867e8 Cleanup doc comments for sculpt_intern.h 2022-01-19 16:21:14 -08:00
e7db1247b1 Fix: File Browser using asset indexer after Asset Browser was visible
When toggling to a File Browser from an Asset Browesr, the asset indexer
would be used to load files. I couldn't spot issues with that on a
quick look, but this should still be corrected.
2022-01-19 20:43:31 +01:00
293aab2253 Asset Browser: Add debug option to disable asset indexing
Adds an "Asset Indexing" option (enabled by default) to Preferences >
Experimental > Debugging. This is useful when working on the asset
library loading.
2022-01-19 20:12:53 +01:00
9a2d1cd5b7 PyAPI Docs: Prepare for Sphinx 4.5 2022-01-19 14:08:38 -05:00
cd0acba330 CMake: Support external callback in configuration
An external CMake script can be used to debug CMake code, modify/read
target properties, inter-target dependencies, non-cache variables etc.

Reviewed by: LazyDodo, brecht
Differential Revision: https://developer.blender.org/D13830
2022-01-20 00:15:09 +05:30
17cab47ed1 Cycles: Fix T94736: Crash when modifying strength of world environment texture
This patch fixes crash T94736 on Metal in which the launch_params were not being updated to reflect destruction of MetalMem objects.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13875
2022-01-19 18:17:37 +00:00
596ce11556 CMake Cleanup: use set for filepath instead of option
See https://developer.blender.org/D13830#368219
2022-01-19 23:34:25 +05:30
f179637222 Fix T95042: Rendering high-res image in Cycles crashes
Integer overflow when the final frame is handled by the Blender's
output driver.

Thanks Jesse and Thomas for investigation!
2022-01-19 16:03:28 +01:00
ecf2f5ed01 Fix error in previous commit
While doing last minute cleanup in
e49bf4019b,  missed to rename function
in one place.
2022-01-19 14:32:11 +01:00
eddad4e9a1 VSE: Support copy-pasting strips with animation
When copying strips between 2 scenes, it wasn't possible to copy
animation curves along with strips.

In this patch curves are copied into clipboard `ListBase`. When pasted,
original curves are moved into temporary `ListBase` and curves in
clipboard are moved into scene action. This is because when strips from
clipboard have to be renamed, function `SEQ_ensure_unique_name()` does
fix RNA paths of curves, but this is done globally for all curves within
action. After strips are renamed, restore original curves from backup.

Note: This patch handles only fcurves. Drivers and actions are currently
not handled anywhere in VSE.

Fixes T77530

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13845
2022-01-19 14:15:49 +01:00
e49bf4019b Cleanup: VSE animation handling
- Move functions that handle animation to own file - `animation.c`
- Refactor `SEQ_offset_animdata` and `SEQ_free_animdata` functions
- Add function `SEQ_fcurves_by_strip_get` to provide more granular
  and explicit way for operators to handle animation
- Remove function `SEQ_dupe_animdata`, do curve duplication explicitly
  in operator code, which makes more sense to do. Further this function
  was also used for renaming strips which makes no sense.
- Refactor usage of function `SEQ_free_animdata` and remove XXX comment.
  Now this functiuon is no longer called when `Sequence` data is freed
  implicitly, it is done explicitly in high level function
  `SEQ_edit_remove_flagged_sequences`

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13852
2022-01-19 14:12:23 +01:00
1788298804 Cleanup: Strict compiler warning in Cycles
The ustring is not a trivially copyable object from the C++ standard
point of view, so using memcpy on it is strictly wrong. In practice,
however, this is OK since it is just a thin wrapper around char*.

For now use explicit cast to void* same as it was done in other places
of ccl::array implementation. But also localize the place where memory
copy happens to make it easier to support proper non-trivial C++
objects in the future.
2022-01-19 12:01:49 +01:00
8a23d91a50 GPUShaderCreateInfo: Rework geometry shader layout support
This merge the description into one struct only that can be more easily
copied during `finalize()`.

The in and out layout parameters are better named and extended with the
invocation count (with fallback support)
2022-01-19 11:59:57 +01:00
952a4fa456 Fix T94987: Dragged node links are invisible.
Route cause was data alignment mismatch between GPU and CPU. This
mismatch would not allow us to bind the UBO where data wasn't available
on the GPU.

Fixed by using float4 in stead of float2. This could eventually be
packed, but that would lead to less readable code.
2022-01-19 11:32:34 +01:00
71386c08f1 Fix T95039,T94998: Shaders compilation errors on Mac.
Cause was incorrect logic when generating the resource layout. It the
explicit_location_support setting was ignored and the binding were
generated for image, uniform buffers and storage buffers.
2022-01-19 10:28:19 +01:00
eb63646605 BMesh: add mesh debug information printing
- Add BM_mesh_debug_print & BM_mesh_debug_info.
- Report flags in Mesh.cd_flag in BKE_mesh_debug_print
- Move custom data printing into customdata.cc (noted as a TODO).

Note that the term "runtime" has been removed from
`BKE_mesh_runtime_debug_print` since these are useful for debugging any
kind of mesh data.
2022-01-19 17:16:00 +11:00
71879d665d BMesh: improve handling of custom-data flag (Mesh.cd_flag)
Code that handled merging & initializing custom-data from other
meshes sometimes missed checks for this flag, causing bevel weights to
lost when the mesh was converted to a BMesh.

The following changes are a more general fix for T94197.

- Add BM_mesh_copy_init_customdata_from_mesh_array which initializes
  custom-data from multiple meshes at once.
  As well as initializing custom-data layers from Mesh.cd_flag.

  This isn't essential for boolean, however it avoids the overhead of
  resizing custom-data layers.

- Loading mesh data into a BMesh now respects Mesh.cd_flag
  instead of only checking if the BMesh custom-data-layer exists.
  Without this, the order of meshes passed to BM_mesh_bm_from_me could
  give different (incorrect) results.

- Copying mesh data now copies `cd_flag` too. This is a precaution
  as in my tests evaluating modifiers these values always matched.
  Nevertheless it's correct to copy this value as custom-data it's
  self is being copied.
2022-01-19 14:30:10 +11:00
ee6507f2b1 Docs: notes on thumbnail sizes
The rationale for storing thumbnails at different sizes wasn't obvious.
2022-01-19 14:05:56 +11:00
7e3b1e2c8f Fix flipped order of items in the "Undo History" menu
Error in 0e1bb232e6.
2022-01-19 13:25:10 +11:00
2e5aecf557 Fix T94202: GPUFrameBuffer: wrong refcount in the buffer passed for read_color and read_depth
The buffer passed as an argument to `GPUFrameBuffer.read_color` is used
in the return of the function and therefore, if not used, its refcount is
decremented.

So be sure to increment the refcount of the already existing objects that
will be used in the return of a function.
2022-01-18 19:23:16 -03:00
221ff895d9 Cleanup: Use references, LISTBASE_FOREACH macro 2022-01-18 13:32:36 -06:00
a5610da1d5 Fix T93413: Nodes 'Make Links' fails for multi input socket
This was the case for multi input sockets that have a link already.

Since we have multi input sockets, the way we use `socket_is_available`
is not really giving the expected result on these.

When used for input sockets the intention is to find a free socket
(either for noodle **replacement**, then it is always available, or just
the next free available socket).
Now I would think without the intention to replace an existing link, a
multi input socket should still be available.
From the inside of the function, the `replace` argument turns [namewise]
to `allow_used`, which sounds a little different (so one might argue
that if `allow_used` is `False` this should also trigger for already
connected multi input sockets).
In the end, this is an issue with the variable naming though, cant think
of a usecase where the patch change would really go against intentions.

Maniphest Tasks: T93413

Differential Revision: https://developer.blender.org/D13866
2022-01-18 20:23:39 +01:00
9506dcf675 Fix T95029: Arrow gizmo always uses normal direction
Bug possibly introduced in {rBc57e4418bb85aec8bd3615fd775b990badb43d30}.

Interestingly, the orientation set before (NORMAL), even different from
the orientation that was actually used, was allowing the use of
"orient_matrix" ("orient_matrix_type" should have been NORMAL in that
case too).

In any case, make sure the "orient_matrix_type" and "orient_type" are the
same so that the "orient_matrix" is used.
2022-01-18 16:21:48 -03:00
977baeaa26 Cleanup: Make node editor functions private
These operations (sorting and selecting all nodes) should generally
be handled by the node editor and not outside code. They were not
called outside of the node editor, so they can be moved to the editor's
`intern` header.
2022-01-18 13:07:41 -06:00
09ecb089a5 Cleanup: Remove unused node editor toolbar file
This file was added nine years ago, and was unused then.
Now with active tools we use a different approach to create
toolbars, so the file is not relevant.
2022-01-18 12:31:14 -06:00
15657b7ccd Fix warning from rB9925606539. 2022-01-18 18:38:14 +03:00
b88a37a490 Geometry Nodes: new Field at Index node
This node allows accessing data of other elements in the context geometry.
It is similar to the Transfer Attribute node in Index mode. The main difference
is that this node does not require a geometry input, because the context
is used.

The node can e.g. be used to generalize what the Edge Vertices node is doing.
Instead of only being able to get the position of the vertices of an edge,
any field/attribute can be accessed on the vertices.

Differential Revision: https://developer.blender.org/D13825
2022-01-18 16:25:47 +01:00
4d5c08b938 Geometry Nodes: Add Signed Output to Edge Angle Node
Adds a second output to the edge angle node that shows the signed angle
between the two faces, where Convex angles are positive and Concave angles
are negative. This calculation is slower than the unsigned angle, so it
was best to leave both for times where the unsigned angle will suffice.

Differential Revision: https://developer.blender.org/D13796
2022-01-18 09:20:31 -06:00
796e9d442c Geometry Nodes: improve domain interpolation code
It's now easier than before to do the interpolation of attributes
only for the elements that are actually used in some cases.
This can result in a speedup because unnecessary computations
can be avoided. See the patch for a simple performance test.

Differential Revision: https://developer.blender.org/D13828
2022-01-18 16:14:00 +01:00
dfe22a53bb Fix T95003: Shader issue using voronoi noise.
Cause of the issue isn't that clear, but the NVIDIA GLSL compiler
complained that it couldn't find an overloaded function when the second
parameter is an interger. This change fixes it by using a float.
2022-01-18 14:32:26 +01:00
0d7b3ed39c RNA: display exact integer values without fraction if step is integer.
Display exact integer values of a floating point fields without
a fraction if the step is also an exact integer. This is intended
for cases when the value can technically be fractional, but most
commonly is supposed to be integer.

This handling is not applied if the field has any unit except frames,
because integer values aren't special for quantities like length.

The fraction is discarded in the normal display mode and when copying
the value to clipboard, but not when editing to remind the user that
the field allows fractions.

Differential Revision: https://developer.blender.org/D13753
2022-01-18 16:24:54 +03:00
6952228386 UI: fix a precision issue with float field step size.
Fix a precision issue when stepping down from 1 to 0 via the left
decrement button and step 100 results in a small nonzero value.

The reason is that 0.01 can't be precisely represented in binary
and converting to double before multiplication reveals this.

Ref D13753
2022-01-18 16:24:54 +03:00
6a8ad00bcc Cleanup: Avoid possible NULL pointer error
In normal conditions, `gpf` always has a value, but better move inside the NULL checking.
2022-01-18 13:44:41 +01:00
08d008a508 GPU: Create Info for GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR.
This patch converts GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR shader to use
the GPUShaderCreateInfo pattern. It can be used as a reference when
converting other shaders.

In this special case the flat uniform vector cannot be used anymore as it
doesn't fit as push constants. To solve this a uniform buffer is used.
2022-01-18 13:17:04 +01:00
2486346f6f Fix T94977: muted link is not ignored in eevee
Add a preprocessing step that removes all muted links from
the localized node tree.

Differential Revision: https://developer.blender.org/D13864
2022-01-18 13:06:49 +01:00
9f8ae130af Fix T95006: missing modifier update after frame change
The previous optimization did not work in general yet, unfortunately.
This change makes the code more correct, but also brings back
some unnecessary updates (e.g. when creating a node group).
2022-01-18 12:58:29 +01:00
5d7ac749c5 Fix T94197: Applying boolean with fast solver clears bevel weights
For boolean operations only one of the meshes was checked to determine
if bevel weights should be created.

Now initialize custom data from both meshes flag.
Note that this is a localized fix to be back-ported, further changes
will be made so edit-mode conversion accounts for this
without the caller needing explicit checks for custom-data flags.
2022-01-18 21:35:10 +11:00
fce0b824a7 Assets: Enabling Asset Indexing.
Asset indexing was disabled as ID property indexing wasn't supported.
Now that ID property support is added we can enable asset indexing.

Check {T91406} for more information about asset indexing.
2022-01-18 11:20:50 +01:00
Jeroen Bakker
36068487d0 AssetsBrowser: Add ID Properties to Asset Indexer
Object/collection asset workflow would need the bounding box for snapping.
The bounding box is stored using ID properties in the scene. Currently ID properties
aren't stored in the asset index, what would break object snapping. For this reason
Asset Indexing is turned off in mater. This patch will introduce the indexing of ID
properties what will allow the indexing to be turned on again.

## Data Mapping ##

For data mapping we store the internal structure of IDProperty to the indexer (including meta-data) to be able to deserialize it back.
```
[
  {
    "name":  ..,
    "value": ..,
    "type": ..,
    /* `subtype` and `length` are only available for IDP_ARRAYs. */
    "subtype": ..,
  },
]
```

| **DNA** | **Serialize type** | **Note** |
| IDProperty.name | StringValue| |
| IDProperty.type | StringValue| "IDP_STRING", "IDP_INT", "IDP_FLOAT", "IDP_ARRAY", "IDP_GROUP", "IDP_DOUBLE"|
| IDProperty.subtype | StringValue| "IDP_INT", "IDP_FLOAT", "IDP_GROUP", "IDP_DOUBLE" |
| IDProperty.value | StringValue | When type is IDP_STRING |
| IDProperty.value | IntValue | When type is IDP_INT |
| IDProperty.value | DoubleValue | When type is IDP_FLOAT/IDP_DOUBLE |
| IDProperty.value | ArrayValue | When type is IDP_GROUP. Recursively uses the same structure as described in this section. |
| IDProperty.value | ArrayValue | When type is IDP_ARRAY. Each element holds a single element as described in this section. |

NOTE: IDP_ID and IDP_IDARRAY aren't supported. The entry will not be added.

Example
```
[
  {
    "name": "MyIntValue,
    "type": "IDP_INT",
    "value": 6,
  },
  {
    "name": "myComplexArray",
    "type": "IDP_ARRAY",
    "subtype": "IDP_GROUP",
    "value": [
        [
          {
            "name": ..
            ....
          }
        ]
    ]
  }
]
```

## Considered alternatives ##

- Add conversion functions inside `asset_indexer`; makes generic code part of a specific solution.
- Add conversion functions inside `BLI_serialize`; would add data transformation responsibilities inside a unit that is currently only responsible for formatting.
- Use direct mapping between IDP properties and Values; leads to missing information and edge cases (empty primitive arrays) that could not be de-serialized.

Reviewed By: Severin, mont29, HooglyBoogly

Maniphest Tasks: T92306

Differential Revision: https://developer.blender.org/D12990
2022-01-18 11:18:11 +01:00
d7822981b1 Python API Docs: add non-invert Bone.convert_local_to_pose example.
This updates the example function to support assigning a subset of
bone matrices. The code was tested to work in real use by @gaiaclary.
2022-01-18 11:45:27 +03:00
542d15b1cd Allow overriding motion path settings.
Motion paths themselves aren't getting saved (not sure if they are
without overrides), but being able to override options makes them
usable even if it's necessary to regenerate every edit session.

Differential Revision: https://developer.blender.org/D13842
2022-01-18 11:45:27 +03:00
1b94631975 CMake: Fix using numpy variable for the zstandard path
Copy paste error in a5917175d8.
2022-01-18 17:23:19 +11:00
6dd89afa96 Fix obj exporter tests by deduping normals and printing with less precision.
Some new obj exporter tests were disabled because the normals were different
in the last decimal place on different platforms.
The old python exporter deduped normals with their coordinates rounded to
four decimal places. This change does the same in the new exporter.
On one test, this produced a file 25% smaller and even ran 10% faster.
2022-01-17 23:22:40 -05:00
db496a0b7d Cleanup: spelling in comments 2022-01-18 14:27:29 +11:00
20df402adc Cleanup: move docs to definition 2022-01-18 14:13:58 +11:00
7220897280 WM: batch rename support for volume & light object data
Also order items to match the "Add" menu.
2022-01-18 12:23:15 +11:00
75d84b1b64 WM: batch rename outliner support for various ID types
The outliner selection can now be used for renaming objects,
object-data & materials.
2022-01-18 12:12:05 +11:00
0fc9526178 Fix for batch rename operating on library collections & materials 2022-01-18 11:50:02 +11:00
84f6d86445 Fix batch renaming selected meta-strips 2022-01-18 11:13:05 +11:00
c11c2a4b91 WM: batch rename collections outside the outliner
Use selected objects collection instances to rename in the 3D view.
2022-01-18 10:47:12 +11:00
Red Mser
54fb1a75ee WM: batch rename collections
User must activate the operator from the outliner,
so that the selected collections can be determined.

Reviewed By: campbellbarton

Ref D13821
2022-01-18 10:26:20 +11:00
0fa36c81d9 Cleanup: quite old-style-declaration warning, strip trailing space 2022-01-18 10:26:18 +11:00
3bbb39ecc1 Cleanup: remove HWND from GHOST_Wintab constructor.
No change in behavior.
2022-01-17 14:07:08 -08:00
44ca984dc7 BLI: Add index_range method to VectorSet
This can simplify iterating through all of the indices in the vector,
which is fairly common, since one of the benefits of the data structure
is that all values are contiguous.
2022-01-17 15:10:52 -06:00
8c1ddee10c Geometry Nodes: Set Handle Type Node: Left and right by default
This node's UI uses a multi-select enum to allow adjusting the
type of both handle sides with the same node. Since usually the
user wants to affect both handles, and it's the multi-select behavior
isn't obvious, selecting both by default is an improvement.
2022-01-17 15:02:15 -06:00
b776c46d2f Fix T94715: multiple volumes using the same .vdb causes freeze
Needs more TBB task isolation, as even freeing an OpenVDB grid uses
multithreading.
2022-01-17 20:36:59 +01:00
Martijn Versteegh
449db0ab1e Baking: new method to generate margin, based on adjacent faces
This significantly reduces discontinuities on UV seams, by giving a better
match of the texture filtered colors on both sides of the seam. It works by
using pixels from adjacent faces across the UV seam.

This new option is called "Adjacent Faces" and is the default. The old option
is called "Extend", and extends border pixels outwards.

Differential Revision: https://developer.blender.org/D13303
2022-01-17 19:36:13 +01:00
8af22719d0 Cleanup: Remove now redundant performance workaround for asset previews
Not needed anymore after aa0ecd179. The removed function was identical
to `icon_draw_rect()` now.

Reverts ab7214ca2e.
2022-01-17 18:26:32 +01:00
fa1fef5081 Cleanup: Correct comments for immediate mode buffer draw functions 2022-01-17 18:26:10 +01:00
194979e929 Cleanup: Improve naming of immediate mode buffer draw functions
Followup to the previous commit. Jeroen and I agreed the old naming was
confusing.
2022-01-17 18:26:10 +01:00
aa0ecd1791 UI: Speed up icon scaling
Use GPU-side scaling to speed up the scaling itself, and to avoid having
to copy the image buffer using the CPU. Mipmapping is used to get decent
filtering when downscaling without ugly artifacts.
In my comparisons, there was barely any difference between the methods
for DPIs >= 1. Below that, the result looks a bit different due to the
different filtering method.

See D13144 for screen-recordings showing the difference.

Part of T92922.

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

Reviewed by: Jeroen Bakker
2022-01-17 18:26:10 +01:00
4d10a46e63 Cleanup: refactor BVH2 in preparation of self intersection skip
Move some logic out of triangle intersection functions and into BVH
traversal, so we can share logic between primitives.

Ref D12954
2022-01-17 17:35:23 +01:00
a25cfc5db2 Texture/Vertex Paint: Add secondary color to the tool header
Before we would only display the secondary color in the N-panel.
Now we also display it in the tool header.
2022-01-17 16:50:20 +01:00
be8f10a4e2 T94828: Appending collection with instancing links nested collections
See T94828 for details.

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

Reviewed by: Bastien Montagne
2022-01-17 16:32:50 +01:00
e3fd0b1d17 Fix compiler warning on Windows
The variable was `uint64_t` and needs `1ull`
2022-01-17 16:08:48 +01:00
7abdd82dfd Fix T94338: bpy.data.libraries.load does not return the right thing.
Typo in rB605cdc4346e5f82, both `eBlendfileLinkAppendForeachItemFlag`
flags had the same value, effectively preventing to filter out direct
vs. indirect appended items.
2022-01-17 15:22:22 +01:00
59fcbdd815 Cleanup: deduplicate condition in transform curve code
Checking `t->around` and `nu->pntsv` does not need to be done in 2 places.
2022-01-17 11:14:44 -03:00
0a08ac2528 Alembic: add support for reading override layers
Override layers are a standard feature of Alembic, where archives can override
data from other archives, provided that the hierarchies match.

This is useful for modifying a UV map, updating an animation, or even creating
some sort of LOD system where low resolution meshes are swapped by high resolution
versions.

It is possible to add UV maps and vertex colors using this system, however, they
will only appear in the spreadsheet editor when viewing evaluated data, as the UV
map and Vertex color UI only show data present on the original mesh.

Implementation wise, this adds a `CacheFileLayer` data structure to the `CacheFile`
DNA, as well as some operators and UI to present and manage the layers. For both
the Alembic importer and the Cycles procedural, the main change is creating an
archive from a list of filepaths, instead of a single one.

After importing the base file through the regular import operator, layers can be added
to or removed from the `CacheFile` via the UI list under the `Override Layers` panel
located in the Mesh Sequence Cache modifier. Layers can also be moved around or
hidden.

See differential page for tests files and demos.

Reviewed by: brecht, sybren

Differential Revision: https://developer.blender.org/D13603
2022-01-17 14:51:04 +01:00
9d3f35a0bf Revert "Revert "GPUShaderCreateInfo for interface abstraction""
This reverts commit edee5a947b.

Fixes compilation error (Missing file BLI_float2.hh)
2022-01-17 14:46:32 +01:00
edee5a947b Revert "GPUShaderCreateInfo for interface abstraction"
This reverts commit 8fb2ff458b.
Missing some files.
2022-01-17 14:34:28 +01:00
Jeroen Bakker
8fb2ff458b GPUShaderCreateInfo for interface abstraction
This is a first part of the Shader Create Info system could be.

A shader create info provides a way to define shader structure, resources
and interfaces. This makes for a quick way to provide backend agnostic
binding informations while also making shader variations easy to declare.

- Clear source input (only one file). Cleans up the GPU api since we can create a
  shader from one descriptor
- Resources and interfaces are generated by the backend (much simpler than parsing).
- Bindings are explicit from position in the array.
- GPUShaderInterface becomes a trivial translation of enums and string copy.
- No external dependency to third party lib.
- Cleaner code, less fragmentation of resources in several libs.
- Easy to modify / extend at runtime.
- no parser involve, very easy to code.
- Does not hold any data, can be static and kept on disc.
- Could hold precompiled bytecode for static shaders.

This also includes a new global dependency system.
GLSL shaders can include other sources by using #pragma BLENDER_REQUIRE(...).

This patch already migrated several builtin shaders. Other shaders should be migrated
one at a time, and could be done inside master.

There is a new compile directive `WITH_GPU_SHADER_BUILDER` this is an optional
directive for linting shaders to increase turn around time.

What is remaining:
- pyGPU API {T94975}
- Migration of other shaders. This could be a community effort.

Reviewed By: jbakker

Maniphest Tasks: T94975

Differential Revision: https://developer.blender.org/D13360
2022-01-17 14:32:28 +01:00
08822801ac Fix T94805: Library weak reference generates "path not found" reports.
No reason to handle those paths here, those are fully internal temp
data, user should not be exposed to it currently.
2022-01-17 14:22:59 +01:00
04feaa8bd0 Core: Library Remap test cases.
For an upcoming refactoring of library remapping we want to be able to test if the logic won't change.
It also increased my experience inside the remapping codebase and find out what exactly needed to
be refactored.

This patch adds test cases for the core functionality of `foreach_libblock_remap_callback`. The test cases
don't cover of all the branches. Also pre-, post-processing, referencing and proxies are not tested.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13815
2022-01-17 12:45:37 +01:00
e15449623d InstallDeps: Increase 'MEX' version of llvm to 14.
llvm 13 is now default on debian testing, tried it quickly and it seems
to work fine, so raising exclusive maximum value for it to 14.
2022-01-17 10:34:34 +01:00
40c8e23d48 LineArt: Invert collection option.
Allows conveniently selecting an inverse of a collection.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D13846
2022-01-17 17:22:09 +08:00
e1e3043a51 CMake: resolve issue finding mold
The default installation path uses `libexec`, missed this as the
package for Arch replaces this with `lib`,
now both are checked.
2022-01-17 18:12:15 +11:00
Piotr Makal
a84621347d Geometry Nodes: Improve conversion from NURBS to Bezier
This patch improves conversion method from NURBS to Bezier curves,
resulting in exact shape between those two types when provided with
a 3rd degree NURBS curve. Part of T86086.

See the differential revision for more comparisons.

The node still cannot account properly for a NURBS "order" other
than 4 and it does not take into account control point weights.

Differential Revision: https://developer.blender.org/D13546
2022-01-16 22:52:18 -06:00
Alaska
34d424fd64 Fix T94526: Incorrect workspace ordering tooltip
Fix the description for WORKSPACE_OT_reorder_to_back to say "last" in
list rather than "first"

See D13696 for more details.

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

Reviewed by Aaron Carlisle
2022-01-16 15:26:08 -08:00
d914cfcb7a Cleanup: simplify parameters
Use a common `userdata` for the different snap callbacks.
2022-01-16 11:25:51 -03:00
608d51c9c8 Fix T94951: Crash when snapping
Missed in {rBd9c6ceb3b88b6db87490b08e0089f9a18e6c52d6}
2022-01-16 11:25:51 -03:00
bc66cd9868 Fix T94865: GPU subdiv crash switching to texpaint area
The crash is due to the fact that GPU subdivision extraction routines
for edit data (including UVs) only worked for BMesh. However, a Mesh
based version is still needed for texture painting. This adds the
missing components. This also ensures all data are properly initialized
(at least the ones revealed by the bug).
2022-01-16 08:40:38 +01:00
3574f2730d Cleanup: deduplicate GPU subdiv data extraction loops
This puts the loop over the final subdivision quads outside of the mesh
iteration callback. This can also allow for easier parallel execution in
the future if need be.
2022-01-16 07:31:26 +01:00
b87d87b1d3 macOS: fix llvm-ranlib invalid option error 2022-01-16 11:47:55 +05:30
e69020ad0f CMake: only ever enable one alternative linker for UNIX/GCC
Since the option to enable linkers are booleans,
it's possible to enable them all at once.

Now only the first enabled + available linker is used
(with priority given to link is with better performance).
2022-01-15 16:40:24 +11:00
18c5d4ccb3 CMake: use LINKER flags instead of CFLAGS for setting the linker
Set the linker using CMAKE_*_LINKER_FLAGS instead of {C/CXX}FLAGS.

There is no advantage in using the CFLAGS to set the linker, it has the
downside of triggering a full rebuild when changing the linker.

Tested building Blender and the bpy.so Python module.

Ref D13833

Reviewed by: sergey, brecht
2022-01-15 16:12:13 +11:00
9664cc91f3 Fix T94918: GPU subdivision uses viewport levels for final render
The resolution for the subdivision grid traversal was always based on
the viewport setting.
2022-01-15 01:36:18 +01:00
6a16a9e661 Geometry Nodes: Rename transfer attribute geometry input
Conceptually, this is the geometry that data is taken from,
not the target of an operation, so rename it from "Target"
to "Source". This was common user feedback and agreed
on in a recent sub-module meeting.
2022-01-14 16:42:04 -06:00
6e926e9b56 Fix T94852: Geometry Proximity crash when unsuccessful
Before rB644e6c7a3e99ae1d43ed, `fill` was used in the error
cases, but now `fill_indices` is used, which doesn't work when
the span is empty (when only one output is used). The fix is just
to check for that case.
2022-01-14 16:10:38 -06:00
2a095d8bfe Audaspace: port bugfixes from upstream.
Windows audio backend (WASAPI) now automatically switches to
the selected audio device in windows.
2022-01-14 22:51:35 +01:00
9fe704800e Nodes: Support link-drag search with compare node outputs
The search list only displayed the "Result" output socket in this
case, which is unexpected since dragging from an input gives the
operations in the list as well. Also use integer mode when
connecting to boolean sockets.
2022-01-14 14:38:49 -06:00
b7a27efd78 Cleanup: Remove unused subdiv functions
I noticed these when doing final cleanup on rBcfa53e0fbeed.
One use was removed in that commit, the others were unused
going further back a few years.

Differential Revision: https://developer.blender.org/D13834
2022-01-14 14:04:24 -06:00
bba95d1901 Fix possible build error with unity build
`NodeOperationBuilder::Link` could conflict with the list base macros.
To resolve this dont use `using Link`.
2022-01-14 13:46:31 -05:00
67517c7d5c Cleanup: Outliner function names, simplify struct initialization 2022-01-14 19:26:04 +01:00
41495707d2 Fix incorrect destruction of Outliner tree-elements
`TreeElement` isn't a trivial type anymore, so `MEM_delete()` should be
called, which calls the destructor.
AFAICS this would cause a memory leak, since the contained `unique_ptr`
is allocated but not destructed correctly - but it's not using the
guarded allocator so woudn't be reported.
2022-01-14 19:26:04 +01:00
82d5905e4b Cleanup: Use destructor to delete Outliner runtime data
Simplifies and makes things safer due to proper RAII usage.
2022-01-14 19:26:04 +01:00
ca9a749b21 Cleanup: Use smart pointers for Outliner tree display and element types
Smart pointers should be the default choice for C++ owning pointers,
since they let you manage memory using RAII.

Also moved type factory methods into static class functions.
2022-01-14 19:26:04 +01:00
e9a43a3b60 Cleanup: Remove Outliner C-API headers/wrappers
Basically this removes any C <-> C++ glue code. C++ types are accessed
directly via the public C++ APIs.
Contains some related changes like, moving functions that were
previously declared in a now removed header to a different file, whose
header is the more appropriate place (and the source file as well).
But generally I tried to avoid other changes.
2022-01-14 19:26:04 +01:00
9109ea0b96 Disable some failing new obj exporter tests.
The switch to how normals are kept has led to tiny differences in
the normal output values on different platforms. Disabling the failing
tests while working on a solution to this problem.
2022-01-14 12:34:07 -05:00
5703efab88 Fix T94784: Crop node gizmo doesn't work
Fix refactoring mistake in rBcbca71a7cff3
Not the min and max values are initialized properly.
2022-01-14 17:44:18 +01:00
d723fa3d31 blenlib Any tests: Fix unknown pragma warning on Windows.
Part of a5cb7c1e62 is reverted since it 
created unknown pragma warning on windows.
Use a trick to do self-assigning.
Reviewed by Jacques Lucke in chat.
2022-01-14 22:10:28 +05:30
780633ec4b Cleanup: Unused function 2022-01-14 17:37:14 +01:00
301bb5afa5 Cleanup: Remove unused functions 2022-01-14 17:06:16 +01:00
eb33ee566e Fix T: Crash in do-version of older pre-2.80 blender files.
`BKE_layer_collection_sync` was missing a specific handling for one of
those pre-master collection cases,

NOTE: It is a bit unfortunate to have to do 'do-version' code in BKE...
At some point might look into moving this into actual `do_version` file,
but this is not fully trivial not critical improvement for now.
2022-01-14 17:02:05 +01:00
85df7036f7 Fix T94827: Group Input/Output cannot connect to custom sockets
Caused by rBa5c59fb90ef9.

Since Group Input and Output sockets happen to be of type `SOCK_CUSTOM`
[and since rBa5c59fb90ef9 custom py defined sockets are too :)] a check
introduced in rB513066e8ad6f that prevents connections for `SOCK_CUSTOM`
triggered.

Now refine the check, so it specifically looks for NODE_GROUP_INPUT /
NODE_GROUP_OUTPUT, too (this keeps the intention intact to not connect
group inputs to group outputs and vice versa, but allows custom py
defined sockets to connect again) and put it in new utility function.

Maniphest Tasks: T94827

Differential Revision: https://developer.blender.org/D13817
2022-01-14 16:30:59 +01:00
e57365a70b Cleanup split foreach_libblock_remap_callback into smaller functions. 2022-01-14 15:50:42 +01:00
348631cffe Fix: Compilation error caused by missing target relation
bf_nodes/bf_nodes_composite depend on DNA headers
2022-01-14 07:46:00 -07:00
8ae6995e98 Tests: show more precise numbers in benchmark charts 2022-01-14 15:17:22 +01:00
c0d0e2788b Cleanup: compiler warnings with clang 2022-01-14 15:17:22 +01:00
ba48c1ee58 macOS: silence bundle identifier mismatch Xcode warning
Blender.xcodeproj User-supplied CFBundleIdentifier value
'org.blenderfoundation.blender' in the Info.plist must be the same as
the PRODUCT_BUNDLE_IDENTIFIER build setting value ''.

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13826
2022-01-14 19:33:23 +05:30
6f51cb0ad7 Info.plist: Bump LSMinimumSystemVersion to silence warning
Didn't remove the key-value pair since old Xcode behavior is not
known.

warning: LSMinimumSystemVersion of '10.9.0' is less than the value of
MACOSX_DEPLOYMENT_TARGET '10.13' - setting to '10.13'. (in target
'blender' from project 'Blender')

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13831
2022-01-14 19:33:06 +05:30
a5cb7c1e62 blenlib/ Any tests: fix self-assignment warning and typo
Fix assignment warning

source/blender/blenlib/tests/BLI_any_test.cc:56:5: warning: explicitly
assigning value of variable of type 'blender::Any<void, 8, 8>'
to itself [-Wself-assign-overloaded]
  c = c;

Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D13835
2022-01-14 19:32:29 +05:30
0cf746c1fa Fix T94878: LineArt crease threshold logic error.
A coding mistake allows default crease to override object crease, now fixed.
2022-01-14 21:43:52 +08:00
c0432d5edb Fix T94089: GPencil Drawing don't Update after paste in Dopesheet
When paste new frames, the datablock need to be tagged to update the drawings.
2022-01-14 13:51:30 +01:00
86b7746e3c Fix T94903: GPencil: Copying keys doesn't preserve Keyframe Type
When a new frame is created, ensure the keytype of source key is used.
2022-01-14 13:05:57 +01:00
0a3de0305c Cleanup: move attribute operators to c++ 2022-01-14 12:53:19 +01:00
c9a8975de5 Fix T94867: viewport render not updating when editing color ramp
The changed node wasn't tagged correctly.
2022-01-14 12:50:53 +01:00
261517e475 Cleanup: Fix warning when compiling without Audaspace 2022-01-14 11:56:02 +01:00
c8e536bac3 Fix T94837: curve tilt on a 2-point-curve is wrong
2-point-curves are treated separately from 3plus-point-curves (assume a
lot of the twisting reduction can be skipped, so there is a dedicated
function for single segment curves).

And while using the 3plus-point-curves function [`make_bevel_list_3D`]
would actually work in this case, the dedicated function
`make_bevel_list_segment_3D` would only consider the tilt of the second
point and would just copy over the quat to the first point as well. Dont
see a reason for this, now consider the first point's tilt as well.

Maniphest Tasks: T94837

Differential Revision: https://developer.blender.org/D13813
2022-01-14 11:26:21 +01:00
e0ac75cb44 Cleanup: Reduce indentation in foreach_libblock_remap_callback. 2022-01-14 09:55:35 +01:00
7c568e7d36 Python API: add "children_recursive" property to Object & Collection
This is a convenience property, already available for bones.

Simplifies D13821 which in-lined this function.
2022-01-14 12:21:56 +11:00
cea588b9ef Cleanup: spelling in comments, C++ style comments for disabled code
Also ensure space at end of comment.
2022-01-14 11:23:46 +11:00
7a0cf2c72f Fix crash caused by exception in Python gizmo target get handler 2022-01-14 10:18:52 +11:00
1bd0a87384 Cleanup: Clang tidy
- modernize-deprecated-headers
- modernize-use-using
- modernize-use-nullptr
- modernize-use-bool-literals
2022-01-13 17:11:38 -06:00
8b3d798374 CMake: add WITH_LINKER_MOLD option for GCC/Clang Unix platforms
Can give considerably faster linking, especially on system with many
cores.

The mold linker recently reached 1.0, see:
https://github.com/rui314/mold

The current stable release of GCC can't use this linker via
-fuse-ld=mold, so this patch uses the "-B" argument to add a binary
directory containing an alternate "ld" command that points to
"mold" (which is part of the default mold installation).

Some timing tests for linking full builds for AMD TR 3970X:

- BFD: 20.78 seconds.
- LLD: 12.16 seconds.
- GOLD: 7.21 seconds.
- MOLD: 2.53 seconds.

Ref D13807

Reviewed by: sergey, brecht
2022-01-14 09:44:58 +11:00
0c5ccae79d Fix: Incorrect logic in mesh validation for removing layers
The mask is only used if it's not zero. Adding the normal mask made
it not zero, but it didn't include anything else, so all custom data
layers except normals were removed. The fix is to only add normals
to the mask when it should be used.
2022-01-13 16:36:50 -06:00
cfa53e0fbe Refactor: Move normals out of MVert, lazy calculation
As described in T91186, this commit moves mesh vertex normals into a
contiguous array of float vectors in a custom data layer, how face
normals are currently stored.

The main interface is documented in `BKE_mesh.h`. Vertex and face
normals are now calculated on-demand and cached, retrieved with an
"ensure" function. Since the logical state of a mesh is now "has
normals when necessary", they can be retrieved from a `const` mesh.

The goal is to use on-demand calculation for all derived data, but
leave room for eager calculation for performance purposes (modifier
evaluation is threaded, but viewport data generation is not).

**Benefits**
This moves us closer to a SoA approach rather than the current AoS
paradigm. Accessing a contiguous `float3` is much more efficient than
retrieving data from a larger struct. The memory requirements for
accessing only normals or vertex locations are smaller, and at the
cost of more memory usage for just normals, they now don't have to
be converted between float and short, which also simplifies code

In the future, the remaining items can be removed from `MVert`,
leaving only `float3`, which has similar benefits (see T93602).

Removing the combination of derived and original data makes it
conceptually simpler to only calculate normals when necessary.
This is especially important now that we have more opportunities
for temporary meshes in geometry nodes.

**Performance**
In addition to the theoretical future performance improvements by
making `MVert == float3`, I've done some basic performance testing
on this patch directly. The data is fairly rough, but it gives an idea
about where things stand generally.
 - Mesh line primitive 4m Verts: 1.16x faster (36 -> 31 ms),
   showing that accessing just `MVert` is now more efficient.
 - Spring Splash Screen: 1.03-1.06 -> 1.06-1.11 FPS, a very slight
   change that at least shows there is no regression.
 - Sprite Fright Snail Smoosh: 3.30-3.40 -> 3.42-3.50 FPS, a small
   but observable speedup.
 - Set Position Node with Scaled Normal: 1.36x faster (53 -> 39 ms),
   shows that using normals in geometry nodes is faster.
 - Normal Calculation 1.6m Vert Cube: 1.19x faster (25 -> 21 ms),
   shows that calculating normals is slightly faster now.
 - File Size of 1.6m Vert Cube: 1.03x smaller (214.7 -> 208.4 MB),
   Normals are not saved in files, which can help with large meshes.

As for memory usage, it may be slightly more in some cases, but
I didn't observe any difference in the production files I tested.

**Tests**
Some modifiers and cycles test results need to be updated with this
commit, for two reasons:
 - The subdivision surface modifier is not responsible for calculating
   normals anymore. In master, the modifier creates different normals
   than the result of the `Mesh` normal calculation, so this is a bug
   fix.
 - There are small differences in the results of some modifiers that
   use normals because they are not converted to and from `short`
   anymore.

**Future improvements**
 - Remove `ModifierTypeInfo::dependsOnNormals`. Code in each modifier
   already retrieves normals if they are needed anyway.
 - Copy normals as part of a better CoW system for attributes.
 - Make more areas use lazy instead of eager normal calculation.
 - Remove `BKE_mesh_normals_tag_dirty` in more places since that is
   now the default state of a new mesh.
 - Possibly apply a similar change to derived face corner normals.

Differential Revision: https://developer.blender.org/D12770
2022-01-13 14:38:25 -06:00
800fc17367 Fix/workaround MSVC compile error with messag-bus
Some of the message-bus macros are not safe to use in C++. This has come
up before, but no good solution was found. Now @LazyDodo, @HooglyBoogly
and I concluded this is the best duct tape "solution" for the moment.
The message-bus API should address this.
2022-01-13 20:40:52 +01:00
1c4a1c13e0 Cleanup: Run make format 2022-01-13 19:56:11 +01:00
5ecaa9a838 Fix compilation error caused by missing target relation
compositor depends on DNA now so that it can access offsets.
2022-01-13 11:34:41 -07:00
3537abe84b Geometry Nodes: Rename String to Curves socket
Today many users seem to think the output from
this node is a single curve with multiple splines.
This patch renames the geometry output socket
from "Curves" to "Curve Instances" to avoid confusion.

Differential Revision: https://developer.blender.org/D13693
2022-01-13 19:17:03 +01:00
743b9c5e1d CMake: fix build issue with gcc+clang-tidy
Precompiled headers are in a compiler specific format,
when using clang-tidy it tries to read the GCC PCH file
and fails at that.

Disable PCH's for now when WITH_CLANG_TIDY is enabled since
a clean work-around doesn't seem readily available.

relevant LLVM/CMake bugs:

https://bugs.llvm.org/show_bug.cgi?id=41579
https://gitlab.kitware.com/cmake/cmake/-/issues/22081

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

Reviewed by: sergey, Blendify
2022-01-13 09:47:14 -07:00
b8157f5bf1 Fix compilation error caused by missing target relation
Space clip depends on DNA now so that it can access offsets.
2022-01-13 17:25:57 +01:00
22dc865a86 Cleanup: Use nullptr in new Outliner C++ files 2022-01-13 17:01:47 +01:00
039cc32917 Outliner: Compile all Outliner files in C++
We want to refactor quite some of the Outliner code using C++, this is a
logical step to help the transition to a new architecture.

Includes plenty of fixes to make this compile without warnings, trying
not to change logic. The usual stuff (casts from `void *`, designated
initializers, compound literals, etc.).
2022-01-13 17:01:47 +01:00
1a4f8ab389 Cleanup: Make message-bus utility macros callable from C++
C++ doesn't support compound literals like used here (GCC does via an
extension).
2022-01-13 17:01:47 +01:00
f173973ae4 Fix T94874: Drivers using bone custom properties don't work on modifiers 2022-01-13 15:17:32 +01:00
79e985ea54 Cleanup: fix building all geometry nodes in one translation unit
There were a couple of function name collisions which were caused
by sharing code with the mask modifier. I just removed the dependence
on the mask modifier now. The code that I duplicated for that purpose
is only in a legacy node, so it can be expected to be removed soonish.
2022-01-13 12:39:48 +01:00
19a6220308 Fix link errors after recent FFMPEG / link_directories changes 2022-01-13 11:12:56 +01:00
d53738396f Tests: skip some compositor tests when WITH_LIBMV=OFF 2022-01-13 10:41:34 +01:00
7bb572f208 Fix T94737: Cycles wrong normal map normal with OSL
Ensure valid reflection was moved elsewhere, should not be done in the node
anymore.
2022-01-13 10:40:41 +01:00
0cf2fafd81 Fix T94050, T94570, T94527: Cycles Bevel and AO nodes not working with Metal
Workaround what may be a compiler bug, solution found by Michael Jones.
2022-01-13 10:40:41 +01:00
a3deef6fff Fix Cycles CPU + GPU render not using CPU after recent changes
In some places the task scheduler was not initialized in time.
2022-01-13 10:40:41 +01:00
eaa4cdaa42 Fix T94758: wrong denoising albedo with BSSRDF retro reflection 2022-01-13 10:40:40 +01:00
Brecht Van Lommel
29450a2af3 Build: remove usage of link_directories
We are now always using absolute paths for libraries, as recommended by the
CMake docs.

Followup to D9177.
2022-01-13 10:40:38 +01:00
Brecht Van Lommel
75a1a578bd CMake: use FFmpeg find module on Linux
And change install_deps.sh to build shared (instead of static) FFMPEG
libraries, for consistency with other library dependencies and to simplify
the logic. This may require users of install_deps.sh to rebuild FFMPEG.

This is the last step that lets us get rid of LIBPATH variables and
link_directories() entirely, as recommended by the CMake docs.

Some fixes were needed in the find FFMPEG module to make it actually work,
this code was unused up to now.

Followup to D8855.

Differential Revision: https://developer.blender.org/D9177
2022-01-13 10:27:11 +01:00
f1a488d0f2 Fix T92953: Tool Settings: Drag on Tweak fails with LMB select 2022-01-13 14:30:12 +11:00
a7c9fb59ca Cleanup: follow code-style for float suffix 2022-01-13 12:34:28 +11:00
227f0f3582 Cleanup: quiet missing braces warning 2022-01-13 12:33:34 +11:00
97c2c39916 Fix T94624: Object as font instances don't work
The fundamental limitation is that we can only have one instance
("dupli") generator at a time. Because the mesh output of a curve
object is output as an instances, the geometry set instances existed,
replacing the object as font instances. The "fix" is to reverse the
order. The behavior won't be perfect still, but at least the old
behavior will be preserved, which is really what matters for a
feature like this.

One way to take this change further would be completely disabling
regular geometry evaluation while this option is active. However,
it doesn't seem like that would actually improve the state of the code.

Differential Revision: https://developer.blender.org/D13768
2022-01-12 13:46:13 -06:00
a311fa96aa Fix T85706: wm_window_make_drawable update DPI
When drawing windows on monitors that differ in DPI, we can sometimes
have UI elements draw at an incorrect scale. This patch just ensures
that `wm_window_make_drawable` always updates DPI.

See D10483 for more details.

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

Reviewed by Brecht Van Lommel
2022-01-12 10:37:52 -08:00
e594f23a27 Revert "CMake: use FFmpeg find module on Linux"
This reverts commit 62a0de1673. Linux buildbot
is giving link errors.
2022-01-12 19:07:40 +01:00
fa8c2c7885 Fix T94071: Area Split Improvements
Allow area Split to be initiated in any area and give better feedback
when not allowed.

See D13599 for more details and usage examples.

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

Reviewed by Campbell Barton
2022-01-12 09:45:19 -08:00
a0dcd0bf2c Fix warnings after bab47b60cb
It's not really clear how this part of the defaults code should be used,
I think this is fine now and solves the warnings.
2022-01-12 18:37:53 +01:00
a72a9e099c Cleanup: Correct indentation 2022-01-12 18:37:53 +01:00
Brecht Van Lommel
62a0de1673 CMake: use FFmpeg find module on Linux
And change install_deps.sh to build shared (instead of static) FFMPEG
libraries, for consistency with other library dependencies and to simplify
the logic. This may require users of install_deps.sh to rebuild FFMPEG.

This is the last step that lets us get rid of LIBPATH variables and
link_directories() entirely, as recommended by the CMake docs.

Some fixes were needed in the find FFMPEG module to make it actually work,
this code was unused up to now.

Followup to D8855.

Differential Revision: https://developer.blender.org/D9177
2022-01-12 18:25:24 +01:00
Simon Lenz
bab47b60cb DNA: Add space clip editor defaults
This is my attempt of adding defaults for the space clip editor struct
(in line with https://developer.blender.org/T80164).

It adds the default allocation for `SpaceClip` and
`node_composite_movieclip.cc`. This also solves the error below (for
C++ files using the DNA_default_alloc), which was put forward by
Sergey Sharybin.

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

Reviewed by: Julian Eisel
2022-01-12 18:04:48 +01:00
Bastien Montagne
a909ab984c Outliner: Add way to display warning icon for items.
While theorically fairly generic, current code is only enabled for
bledfile and liboverride views, and only used to display messages from
library IDs.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D13766
2022-01-12 18:01:50 +01:00
5f7ad4baaa BLI_math: Fix building when WITH_GMP is off 2022-01-12 17:24:57 +01:00
Nikhil Shringarpurey
e5858a3ad0 Icons: Remove absolute pathnames and deprecated gradients from SVG files
SVG files contained specific detailed pathnames on developers'
computers. These included full local user profile and path and should
not be in the release.

This patches corrects those lines. It also removes unused gradients from
the private icons SVG.

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

Reviewed by: Yevgeny Makarov, Julian Eisel
2022-01-12 15:03:05 +01:00
ec5560db73 DRW: Add DRW_gpu_wrapper.hh
This adds wrapper classes that make it easier to use GPU objects in C++.

####Motivations:####

 - Easier handling of GPU objects.
 - EEVEE rewrite already makes use of similar wrappers.
 - There is the ongoing effort to use more C++ in the codebase
 and lans to port more engines to it.
 - The shader code refactor will make use of many UBOs with shared
 struct declaration. This helps managing them.
 - Safer handling of `TextureFromPool` which can't be bound as normal
 texture (only texture ref) and can be better tracked in the future.

####Considerations:####

 - I chose the `blender::draw` namespace because `blender::gpu` already has private classes (i.e: `gpu::Texture`).
 - Theses are wrappers that manage a GPU object internally. They might be confused with actual `Texture`. However, the name `TextureWrapper` is a bit too much verbose in my opinion. I'm open to suggestion about better name.

Reviewed By: jbakker

Differential Revision: http://developer.blender.org/D13805
2022-01-12 13:05:18 +01:00
0882069095 Cleanup: codestyle obj_exporter_tests.cc. 2022-01-12 13:02:28 +01:00
1552b86b55 Cleanup: Not needed if statement around delete. 2022-01-12 13:02:28 +01:00
d43b5791e0 BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:`float2`) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the `blender::math` namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

####Motivations:
- We are aiming to share UBO and SSBO structures between GLSL and C++.
This means we will use many of the existing vector types and others
we currently don't have (uintX, intX). All these variations were
asking for many more code duplication.
- Deduplicate existing code which is duplicated for each vector size.
- We also want to share small functions. Which means that vector
functions should be static and not in the class namespace.
- Reduce friction to use these types in new projects due to their
incompleteness.
- The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a
bit of a let down. Most clases are incomplete, out of sync with each
others with different codestyles, and some functions that should be
static are not (i.e: `float3::reflect()`).

####Upsides:
- Still support `.x, .y, .z, .w` for readability.
- Compact, readable and easilly extendable.
- All of the vector functions are available for all the vectors types
and can be restricted to certain types. Also template specialization
let us define exception for special class (like mpq).
- With optimization ON, the compiler unroll the loops and performance
is the same.

####Downsides:
- Might impact debugability. Though I would arge that the bugs are
rarelly caused by the vector class itself (since the operations are
quite trivial) but by the type conversions.
- Might impact compile time. I did not saw a significant impact since
the usage is not really widespread.
- Functions needs to be rewritten to support arbitrary vector length.
For instance, one can't call `len_squared_v3v3` in
`math::length_squared()` and call it a day.
- Type cast does not work with the template version of the `math::`
vector functions. Meaning you need to manually cast `float *` and
`(float *)[3]` to `float3` for the function calls.
i.e: `math::distance_squared(float3(nearest.co), positions[i]);`
- Some parts might loose in readability:
`float3::dot(v1.normalized(), v2.normalized())`
becoming
`math::dot(math::normalize(v1), math::normalize(v2))`
But I propose, when appropriate, to use
`using namespace blender::math;` on function local or file scope to
increase readability.
`dot(normalize(v1), normalize(v2))`

####Consideration:
- Include back `.length()` method. It is quite handy and is more C++
oriented.
- I considered the GLM library as a candidate for replacement. It felt
like too much for what we need and would be difficult to extend / modify
to our needs.
- I used Macros to reduce code in operators declaration and potential
copy paste bugs. This could reduce debugability and could be reverted.
- This touches `delaunay_2d.cc` and the intersection code. I would like
to know @howardt opinion on the matter.
- The `noexcept` on the copy constructor of `mpq(2|3)` is being removed.
But according to @JacquesLucke it is not a real problem for now.

I would like to give a huge thanks to @JacquesLucke who helped during this
and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: https://developer.blender.org/D13791
2022-01-12 12:57:07 +01:00
fb6bd88644 Revert "BLI: Refactor vector types & functions to use templates"
Includes unwanted changes

This reverts commit 46e049d0ce.
2022-01-12 12:50:02 +01:00
Clment Foucault
46e049d0ce BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:`float2`) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the `blender::math` namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

####Motivations:
 - We are aiming to share UBO and SSBO structures between GLSL and C++.
 This means we will use many of the existing vector types and others
 we currently don't have (uintX, intX). All these variations were
 asking for many more code duplication.
 - Deduplicate existing code which is duplicated for each vector size.
 - We also want to share small functions. Which means that vector
 functions should be static and not in the class namespace.
 - Reduce friction to use these types in new projects due to their
 incompleteness.
 - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a
 bit of a let down. Most clases are incomplete, out of sync with each
 others with different codestyles, and some functions that should be
 static are not (i.e: `float3::reflect()`).

####Upsides:
 - Still support `.x, .y, .z, .w` for readability.
 - Compact, readable and easilly extendable.
 - All of the vector functions are available for all the vectors types
 and can be restricted to certain types. Also template specialization
 let us define exception for special class (like mpq).
 - With optimization ON, the compiler unroll the loops and performance
 is the same.

####Downsides:
 - Might impact debugability. Though I would arge that the bugs are
 rarelly caused by the vector class itself (since the operations are
 quite trivial) but by the type conversions.
 - Might impact compile time. I did not saw a significant impact since
 the usage is not really widespread.
 - Functions needs to be rewritten to support arbitrary vector length.
 For instance, one can't call `len_squared_v3v3` in
 `math::length_squared()` and call it a day.
 - Type cast does not work with the template version of the `math::`
 vector functions. Meaning you need to manually cast `float *` and
 `(float *)[3]` to `float3` for the function calls.
 i.e: `math::distance_squared(float3(nearest.co), positions[i]);`
 - Some parts might loose in readability:
 `float3::dot(v1.normalized(), v2.normalized())`
 becoming
 `math::dot(math::normalize(v1), math::normalize(v2))`
 But I propose, when appropriate, to use
 `using namespace blender::math;` on function local or file scope to
 increase readability.
 `dot(normalize(v1), normalize(v2))`

####Consideration:
 - Include back `.length()` method. It is quite handy and is more C++
 oriented.
 - I considered the GLM library as a candidate for replacement. It felt
 like too much for what we need and would be difficult to extend / modify
 to our needs.
 - I used Macros to reduce code in operators declaration and potential
 copy paste bugs. This could reduce debugability and could be reverted.
 - This touches `delaunay_2d.cc` and the intersection code. I would like
 to know @howardt opinion on the matter.
 - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed.
 But according to @JacquesLucke it is not a real problem for now.

I would like to give a huge thanks to @JacquesLucke who helped during this
and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: https://developer.blender.org/D13791
2022-01-12 12:47:43 +01:00
e5766752d0 Revert "BLI: Refactor vector types & functions to use templates"
Reverted because the commit removes a lot of commits.

This reverts commit a2c1c368af.
2022-01-12 12:44:26 +01:00
Nathan Rozendaal
b2ccd8546c Compositor: Add Scene Time Node, Rename Time node
Fixes issue T94603
It adds a new compositor node called Scene Time which is already present as a geo node, having the same basic nodes available in all node trees is a nice thing to have.
Renames "Time" node to "Time Curve", this is done to avoid confusion between the Time node and the Scene Time node.

Reviewed By: jbakker

Maniphest Tasks: T94603

Differential Revision: https://developer.blender.org/D13762
2022-01-12 12:29:44 +01:00
a2c1c368af BLI: Refactor vector types & functions to use templates
This patch implements the vector types (i.e:float2) by making heavy
usage of templating. All vector functions are now outside of the vector
classes (inside the blender::math namespace) and are not vector size
dependent for the most part.

In the ongoing effort to make shaders less GL centric, we are aiming
to share more code between GLSL and C++ to avoid code duplication.

Motivations:
- We are aiming to share UBO and SSBO structures between GLSL and C++.
  This means we will use many of the existing vector types and others we
  currently don't have (uintX, intX). All these variations were asking
  for many more code duplication.
- Deduplicate existing code which is duplicated for each vector size.
- We also want to share small functions. Which means that vector functions
  should be static and not in the class namespace.
- Reduce friction to use these types in new projects due to their
  incompleteness.
- The current state of the BLI_(float|double|mpq)(2|3|4).hh is a bit of a
  let down. Most clases are incomplete, out of sync with each others with
  different codestyles, and some functions that should be static are not
  (i.e: float3::reflect()).

Upsides:
- Still support .x, .y, .z, .w for readability.
- Compact, readable and easilly extendable.
- All of the vector functions are available for all the vectors types and
  can be restricted to certain types. Also template specialization let us
  define exception for special class (like mpq).
- With optimization ON, the compiler unroll the loops and performance is
  the same.

Downsides:
- Might impact debugability. Though I would arge that the bugs are rarelly
  caused by the vector class itself (since the operations are quite trivial)
  but by the type conversions.
- Might impact compile time. I did not saw a significant impact since the
  usage is not really widespread.
- Functions needs to be rewritten to support arbitrary vector length. For
  instance, one can't call len_squared_v3v3 in math::length_squared() and
  call it a day.
- Type cast does not work with the template version of the math:: vector
  functions. Meaning you need to manually cast float * and (float *)[3] to
  float3 for the function calls.
  i.e: math::distance_squared(float3(nearest.co), positions[i]);
- Some parts might loose in readability:
  float3::dot(v1.normalized(), v2.normalized())
  becoming
  math::dot(math::normalize(v1), math::normalize(v2))
  But I propose, when appropriate, to use
  using namespace blender::math; on function local or file scope to
  increase readability. dot(normalize(v1), normalize(v2))

Consideration:
- Include back .length() method. It is quite handy and is more C++
  oriented.
- I considered the GLM library as a candidate for replacement.
  It felt like too much for what we need and would be difficult to
  extend / modify to our needs.
- I used Macros to reduce code in operators declaration and potential
  copy paste bugs. This could reduce debugability and could be reverted.
- This touches delaunay_2d.cc and the intersection code. I would like to
  know @Howard Trickey (howardt) opinion on the matter.
- The noexcept on the copy constructor of mpq(2|3) is being removed.
  But according to @Jacques Lucke (JacquesLucke) it is not a real problem
  for now.

I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who
helped during this and pushed me to reduce the duplication further.

Reviewed By: brecht, sergey, JacquesLucke

Differential Revision: http://developer.blender.org/D13791
2022-01-12 12:19:39 +01:00
d320f3677e Cleanup: make format 2022-01-12 11:29:18 +01:00
1e61b759c7 Fix T94797: crash when playing animation in eevee rendered view
The issue was caused by rBd09b1d2759861aa012ab2e7e4ce2ffa2.
Since this commit, the image users in gpu materials were updated
during depsgraph evaluation as well. However, there was a race
condition when one thread is deleting gpu materials in `BKE_material_eval`
while another thread is updating the image users at the same time.

The solution is to make sure that deleting gpu materials is done before
iterating over all gpu materials, by adding a new depsgraph relation.
2022-01-12 11:15:22 +01:00
145f1d1e0a Fix T94812: render layer sockets are missing after file load
The main issue was the use of `G_MAIN` during file load.
This patch refactors the code so that iterating over `G_MAIN`
is not necessary anymore. See D13800 for more details.

Differential Revision: https://developer.blender.org/D13800
2022-01-12 11:07:31 +01:00
7a2b181591 Fix T94041: Loading a new file gives crash while rendering in viewport
The issue was caused by Cycles display driver not being able to restore
window's OpenGL context after disposing Cycles-side OpenGL context.

This is due to the window OpenGL re-activation needing to access window
manager which gets cleared out form global main during file reading.

Defer clearing window manager from the global main to until after all
screens are "exited". This allows Cycles to properly stop rendering,
dispose its OpenGL context, and restore window's drawable context.

It is unclear why it was required to clear window manager list early
on. Guess is that it comes from an original code in a1c8543f2a where
there was an early return which then got replaced with an actual logic
without changing the order of de-initialization and window manager list
clear.

Differential Revision: https://developer.blender.org/D13799
2022-01-12 10:01:33 +01:00
ebad1d8d33 CMake: exclude linker options for APPLE and non-UNIX
These are only used for non-apple unix systems.
2022-01-12 18:55:13 +11:00
795cea2cce Revert "Cleanup GPencil strength previous commit"
This reverts commit e339946515.

This broken the tablet pressure and it was impossible to set a proper strength.
2022-01-12 08:45:57 +01:00
7f28084e2a Cleanup: use utility functions 2022-01-12 06:46:12 +01:00
77616082f4 Fix T89542: Crash when loading certain .hdr files
The direct cause of the bug in question was passing in the raw memory
buffer to sscanf. It should be called with a null-terminated buffer;
which isn't guaranteed when blindly trusting the file data.

When attempting to fuzz this code path, a variety of other crashes were
discovered and fixed.

Differential Revision: https://developer.blender.org/D11952
2022-01-11 20:48:32 -08:00
0dc309bef6 Cleanup: remove redundant const qualifiers for POD types 2022-01-12 12:51:11 +11:00
f4492629ea Cleanup: VSE channel drawing
Remove code that very slightly darkened line on bottom of timeline, when
backdrop is enabled. Purpose of the code wasn't dodumented, and 2.79
doesn't seem to produce this darkened line.
Rename drawing functions to appropriate names.
2022-01-12 01:46:27 +01:00
ef5d01d98f deps_builder: GMP 6.2.1
Pretty straightforward update, nothing noteworthy to report.

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

Reviewed by: brecht, sybren
2022-01-11 16:26:30 -07:00
89145341e5 BLF: UI_fontstyle_draw Usage
Add maximum string length argument to UI_fontstyle_draw to reduce usage
of BLF_DRAW_STR_DUMMY_MAX. Reorders arguments to UI_fontstyle_draw_ex

See D13794 for more details.

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

Reviewed by Campbell Barton
2022-01-11 14:52:39 -08:00
bbe59c6014 BLF: Reduction of use of BLF_DRAW_STR_DUMMY_MAX
Reduction of the number of uses of the define BLF_DRAW_STR_DUMMY_MAX
by using actual sizes of static character arrays.

See D13793 for more details.

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

Reviewed by Campbell Barton
2022-01-11 14:08:38 -08:00
ab125f466c Fix T94751: ground created by Setup Tracking Scene not marked as Shadow Catcher
Change that was missing in {rBca64bd0aacda}.
2022-01-11 19:02:04 -03:00
947dc21979 Cleanup: Fix build warning with MSVC
comparing a bool > 0 make MSVC emit
warning C4804: '>': unsafe use of type 'bool' in operation.

int does the job nicely.
2022-01-11 14:57:54 -07:00
5a6ec0f003 Build: Enable unity build for bf_compositor
Blender's compositor code already makes extensive use of
namespace which makes it very simple to enable unity build.
There was one duplicated function that has since to be moved
to a common header.

I saw roughly a 3x speedup of bf_compositor using ninja on
linux using i5 8250u (1:34 down to 0:34).

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D13792
2022-01-11 16:55:45 -05:00
48ff9b57f8 Build: Add precompiled headers for bf_compositor
With this change, compilation saw a 2.4x improvement.

This can be combined with unity build to give an overall 4x improvement

Depends on D13797

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D13798
2022-01-11 16:50:35 -05:00
bdf99a5119 cleanup: hipew remove unused variables
caused 4 warnings, nothing even conditionally
uses them, can be safely removed.
2022-01-11 14:49:29 -07:00
e339946515 Cleanup previous commit
Don't need check minimum constant value, brush value is enough.
2022-01-11 22:48:26 +01:00
ac3d07ad17 Fix T94799: GPencil Strokes drawn at 0.0 Strength still visible
There was a clamp with a value greater than 0.
2022-01-11 22:45:50 +01:00
376e425c02 Fix T93588: some videos loaded flipped over Y axis on macOS Arm
Was not actually flipping in the need_aligned_ffmpeg_buffer case.
2022-01-11 21:43:32 +01:00
45bb6b836a IME Cleanup: Unused GHOST_TEventImeData Member
Removal of unused tmp member of GHOST_TEventImeData. Not used now,
nor was it used by the commit that added it to begin with.

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

Reviewed by Ray Molenkamp
2022-01-11 12:35:11 -08:00
e95b4dc2dd Cleanup: Fix build warnings with MSVC
our UNUSED macro is essentially a no-op for MSVC, which lead to
the situation  where this well meant macro was emitting the
following warning:

C4189: 'UNUSED_i': local variable is initialized but not referenced

However since we have been on c++17 for a while now the UNUSED
macro can be replaced with the standard [[maybe_unused]] attribute
in cpp files.

This changes cleans up the use of the UNUSED macro in the
bf_nodes_geometry project.

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

Reviewed by: JacquesLucke, Severin, Sergey, HooglyBoogly
2022-01-11 12:54:18 -07:00
259a71cd3c Build: use precompiled headers on all platforms
Since CMake 3.16, CMake has native precompiled header (PCH) support.

This change swaps Blender's own PCH implementation with the native implementation.
Previously, PCH was only enabled on Windows however,
this new implementation works on all platforms.

For more information see https://cmake.org/cmake/help/latest/command/target_precompile_headers.html

On my system, Linux with ninja running on an i5 8250U
I saw a 60% reduction in compile times for `bf_freestyle` + linking time.

Reviewed By: LazyDodo, brecht

Differential Revision: https://developer.blender.org/D13797
2022-01-11 14:18:58 -05:00
8cff1ecf9f Fix T94804: GPencil Simplify when strokes are Automerged in Draw Mode
The problem was the points were selected in edit mode and then sampled. Now, in draw mode, the points are always unselected to avoid this effect in the auto merge process.
2022-01-11 19:20:27 +01:00
Henrik Dick
631067e559 Add support for a longest diagonal quad triangulation mode
The new triangulation mode for quads is the opposite of the current default
shortest diagonal mode. It is optimal for cloth simulations using quad meshes.

Differential Revision: http://developer.blender.org/D13777
2022-01-11 18:51:25 +01:00
41ce7807a6 Fix T94299: Object asset set as visible but doesn't show
Differential Revision: https://developer.blender.org/D13738

Reviewed by: Bastien Montagne, Sergey Sharybin
2022-01-11 18:38:05 +01:00
ccac22fec5 Cleanup compiler warning in Windows
`bool` used instead of `int`
2022-01-11 16:48:16 +01:00
6774cae3f2 Fix T94728: Auto Depth problem with Cliping Region
Issue introduced in rB1d49293b80446b89b5b12fa0eeefaf14e5051e48

`drw_manager_init` must be called after `drw_context_state_init` as
`DST.draw_ctx.sh_cfg` (indicating when the view is clipped) must be set
first.

Differential Revision: https://developer.blender.org/D13795
2022-01-11 10:39:39 -03:00
fc0f315106 Cleanup: remove unnecessary 'use_opengl_context' parameter
The argument passed is always false.
2022-01-11 10:28:32 -03:00
Aleksi Juvani
0c94e5d166 Fix PSYS_GLOBAL_HAIR stripped even if connecting the hair fails
After disconnecting hair on an object, if you then hide the particle system, and try connecting the hair again, the operator is cancelled due to `remap_hair_emitter` returning `false` because `target_psmd->mesh_final` is NULL, but `connect_hair` will still strip the `PSYS_GLOBAL_HAIR` flag, which will cause the hair in the hidden particle system to be positioned incorrectly. The correct behavior is to strip the flag only if `remap_hair_emitter` succeeds.

Differential Revision: https://developer.blender.org/D13703
2022-01-11 13:08:13 +01:00
9dc9692b09 Select Similar: hide 'threshold' from UI when not used
When the 'threshold' is not used in the type we are comparing, just hide
it. This was obvious for some types (e.g. Materials), but maybe not so
on others (e.g. Polygon Sides) and potentionally confusing.

Reported by @hitrpr in chat.

Differential Revision: https://developer.blender.org/D13760
2022-01-11 11:47:57 +01:00
255727b752 GPU: Utility function to bind UBO to batches. 2022-01-11 09:57:22 +01:00
Evan Wilson
1949aece21 Explicit Color OCIO role comment fix.
This is an update to the correct OCIO role.

It changes `SceneReference` to `scene_linear`

See https://opencolorio.readthedocs.io/en/latest/guides/authoring/overview.html#config-roles

>     - reference - the color space against which the other color spaces are defined
>NOTE: The reference role has sometimes been misinterpreted as being the space in which “reference art” is stored in.
>
>    - scene_linear - the scene-referred linear-to-light color space, often the same as the reference space

The current OCIO UX working group doc says:

>reference: This role has had multiple interpreted meanings over the years and is a common point of confusion. It is kept in OCIO for backwards compatibility, but the recommendation is that it is not used by apps.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11398
2022-01-11 09:55:22 +01:00
4e8a883bcc Cleanup: use unity build for composite nodes
GIves about a 2.1x improvement in compilation times.
2022-01-11 02:57:14 -05:00
bc02ede98b Cleanup: Deduplicate finv_test function 2022-01-11 02:16:47 -05:00
d608b98145 Cleanup: quite missing-variable-declarations warnings 2022-01-11 18:16:00 +11:00
9af81c2b74 Cleanup: correct exception message 2022-01-11 18:16:00 +11:00
c77f837598 Revert "Cleanup: remove declaration for removed function"
This reverts commit aa363ec2ae.

The function still exists, this commit caused a warning with Clang
So keep MEM_printmemlist_pydict.
2022-01-11 18:16:00 +11:00
fd922f5940 Cleanup: Composite nodes: add namespace for every file
This puts all static functions in composite node files into a new
namespace. This allows using unity build which can improve
compile times significantly.

This is a follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5
but for compositor nodes.

The namespace name is derived from the file name.
That makes it possible to write some tooling that checks the names later on.
The filename extension (`cc`) is added to the namespace name as well.
his also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file.

Reviewed By: JacquesLucke, HooglyBoogly, jbakker

Differential Revision: https://developer.blender.org/D13466
2022-01-11 02:11:14 -05:00
f2fb9a0c59 Fix T94768: Crash in VSE prefetching
If timeline contains scene strip outside of edited meta strip, this will
cause crash. This is because prefetchin ignored meta strips being edited
when rendering, but did check for scene strips only inside edited meta
strip.

Change active seqbase pointer when entering meta strip. This makes it
possible to prefetch only content that is being presented to user.
2022-01-11 06:12:15 +01:00
f134341e03 Fix T94671: performance regression with subsurf modifier
rBeed45d2a239a introduced a GPU backend for OpenSubDiv which lets us do
the subdivision at render time. However, some tools might still need to
have the subdivision data available on the CPU side. For this a
subdivision mesh wrapper was also introduced, and is computed whenever a
CPU side mesh is needed. The subdivision settings for this wrapper are
stored during modifier evaluation if GPU subdivision can be done.

The performance regression is due to the fact that although the
subdivision mesh was already computed on the CPU, and no subdivision
wrapper is generated, some checks for creating subdivision data in
`BKE_mesh_wrapper_ensure_subdivision` where still run, one of which is
very expensive.

To fix this we first check the runtime settings of the mesh to see if
subdivision is needed at all.
2022-01-11 03:34:16 +01:00
922ae55a16 Spreadsheet: Add mesh topology information with a debug value
This commit adds topology information from mesh data structs to the
spreadsheet when the debug value `4001` is set. Eventually we could
expose these. For now it can be a useful tool for developers when
working on mesh algorithms.

Differential Revision: https://developer.blender.org/D13735
2022-01-10 16:45:53 -06:00
37b336a8af Cleanup: Remove unused "active ID" node flag
The value of this flag was only retrieved in `nodeGetActiveID`, which
wasn't used anywhere. Other than that, the `NODE_ACTIVE_ID` and
related functions seem to come from the Blender internal renderer.

Differential Revision: https://developer.blender.org/D13770
2022-01-10 16:42:50 -06:00
f4af21038d Geometry Nodes: Move normal field input to be usable elsewhere
This commit moves the normal field input to `BKE_geometry_set.hh`
from the node file so that normals can be used as an implicit input to
other nodes.

Differential Revision: https://developer.blender.org/D13779
2022-01-10 16:41:05 -06:00
fe82b8d1e8 Docs: correct doc-string for bl_run_operators_event_simulate
The event() action swapped type/value arguments.
2022-01-11 09:13:25 +11:00
4b8cf11fa5 macOS: fix xcrun sdk detection for minimal CLT
Differential Revision: https://developer.blender.org/D13783
2022-01-11 01:07:31 +05:30
a4a95c8d36 Docs: Add comments to node socket struct header 2022-01-10 12:29:09 -06:00
ccf06fffbc UI: Allow AltGr Key + C,V,X Text Input
Slight change to our processing of Ctrl-C, Ctrl-V, and Ctrl-X so that
they will not be triggered if Alt is also pressed. This allows entry
of AltGr-C, -V, -X when using International keyboard layouts.

See D13781 for more details

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

Reviewed by Brecht Van Lommel
2022-01-10 09:52:19 -08:00
Takahiro Shizuki
57bea57f5e Fix T94434: Windows IME Pinyin Forward Slash
Treat "/" as a key that should be evaluated by the Win IME system when
the input language is Chinese. This fixes a duplication of the input
character and results in the expected output of a Chinese wide comma.

See D13771 for more details.

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

Reviewed by Brecht Van Lommel
2022-01-10 09:09:13 -08:00
1a27d20df3 Tests: disable all but one simple test for the Cycles Metal device
Until all tests are passing, this lets us run a basic test on the buildbot.

Ref T92212
2022-01-10 17:35:07 +01:00
39ba82f25d Fix T94111: nurb normal calculation does not work
The normals were computed with an uninitialized tilt.
2022-01-10 17:25:42 +01:00
af6a30ebf1 Fix compilation error after recent fix
For some reason GCC accepted C++-style of unused variable marking.
2022-01-10 17:17:31 +01:00
b0a83a6ed4 Fix compile error with msvc 2022-01-10 17:10:07 +01:00
292c2cefe3 Fix T93727: Tiled render error in Cycles after changing temp directory
Consider temporary directory to be variant part of session configuration
which gets communicated to the tile manager on render reset.

This allows to be able to render with one temp directory, change the
directory, render again and have proper render result even with enabled
persistent data.

For the ease of access to the temp directory expose it via the render
engine API (engine.temp_directory).

Differential Revision: https://developer.blender.org/D13790
2022-01-10 16:54:12 +01:00
20cb2c72a5 Fix second render failure with Cycles persistent data
The issue was caused by the recent changes in the way how the
render result is drawn: the display driver now could hold an
OpenGL resources. Those resources are not shared across contexts
so whenever OpenGL context is destroyed those resources are to
be destroyed as well (and not attempted to be re-used for a next
render).

Do such destruction and entire driver re-creation since it does
simplifies things from API usage point of view without causing
measurable slowdown.

Steps to reproduce the issue:
- Set the render resolution to 2x of Full HD
- Enable persistent data
- Render (F12)
- Render again

Observe OpenGL state being corrupted. Easy to see in debug mode
where IMM abstraction level reports issues about the buffer size
not being the proper size. This was caused by the display driver
trying to use VAO from the previous OpenGL context.

Differential Revision: https://developer.blender.org/D13789
2022-01-10 16:53:44 +01:00
d9dd8c287f Fix T94661: Out-of-bounds memory access due to malformed DDS image file
Harden bounds check in the stream reader avoiding integer overflow.
2022-01-10 14:27:54 +01:00
76d69bbb08 Fix Cycles compilation with Optix on Windows.
Since Optix 7.3 is required, update the default path accordingly.
2022-01-10 13:39:53 +01:00
8dd163160e Fix T94766: texture coordinates from other object do not refresh
The core issue is that flushing dependencies are created from an object
to a node tree when it contains e.g. a Texture Coordinate node.
That is an issue because the evaluation of the node tree itself does not
depend on the object (node tree evaluation is essentially a no-op).

Only other systems that parse and evaluate the node tree in a specific
context actually depend on e.g. the position of the referenced object.
It can even be the case that the node tree depends on objects that
the actual evaluator (geometry nodes modifier/material) does not depend
on, because a node is not connected to the output.

Geometry nodes makes the distinction between dependencies to the
node tree and to the evaluator already. Shader nodes do not.
Therefore, shader nodes need a flushing relation from node groups
to their parent node groups.

This brings back some unnecessary updates from rB7e712b2d6a0d
(e.g. when creating a node group from nodes that are not connected
to the output). This is a bit unfortunate, but refactoring how
dependencies work with shader nodes is a out of scope for this fix.
2022-01-10 13:02:57 +01:00
Demeter Dzadik
3ec88ae21d Fix error when keyframing with Custom Properties
Since rBf9ccd26b037d, calling `data.path_resolve()` on custom properties
with `None` value do not cause a `ValueError` exception any more. This
is now taken into account in the keying sets targeting custom
properties.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13787
2022-01-10 13:01:01 +01:00
f5e90a943f Remove GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR.
Shader isn't used and not accessible via py-api.
2022-01-10 12:51:21 +01:00
8a772645e2 Remove GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR.
Shader isn't used and not accessible via py-api.
2022-01-10 12:51:21 +01:00
1b57dcf320 Remove GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA.
Shader isn't used and not accessible via py-api.
2022-01-10 12:51:21 +01:00
6669431846 Remove GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR.
Shader isn't used and not accessible via py-api.
2022-01-10 12:51:21 +01:00
e12a707692 Remove GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR.
Shader isn't used and not accessible via the py-api.
2022-01-10 12:51:21 +01:00
f813aab787 Remove GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA.
Shader isn't used and isn't accessible via py-api.
2022-01-10 12:51:21 +01:00
cfb3f5062d Cleanup: Remove unused source files. 2022-01-10 12:51:21 +01:00
3488339475 Cleanup: Consistent naming GPU_SHADER_2D_AREA_BORDERS. 2022-01-10 12:51:21 +01:00
227fd753df GPU: Remove unused UV shaders.
The UV shaders have been migrated to the overlay engine and aren't
accessible via the python API.
2022-01-10 12:51:21 +01:00
bd8fa07a3d Cleanup: add utility macro to simplify using std::enable_if 2022-01-10 12:28:33 +01:00
934db6a820 Fix T94409: GPencil smooth stroke thickness operator weird result
The smooth was not working "smoothly" and any change in the factor produced a weird result.
2022-01-10 12:23:52 +01:00
5aac794b11 Fix compile error in gpu test. 2022-01-10 12:16:25 +01:00
1b1e947162 Fix T94600: Apply single shrinkwrap constraint fails
rBd6891d9bee2b introduced a way to apply a single constraint from the
constraint stack. For this we want to work in the evaluated domain, in
particular the constraint target should be evaluated (the shrinkwrap
constraint needs to have access to the target's evaluated mesh).

Thx a lot to @sergey for handholding here!

Maniphest Tasks: T94600

Differential Revision: https://developer.blender.org/D13765
2022-01-10 11:57:54 +01:00
101fadcf6b Motion Path: Tweak the User Interface
This moves the clear paths button ("X") to the same line of "Update All Paths",
and make it visible at all times.

1. The clear button affects all objects (by default). However the
Calculate/Update Paths only works on the selected objects/objects.
Better to not have them both on the same line.

2. The operator to clear object and pose paths can run even if the active
object/bone has no motion path. However the UI was not showing the button in
those cases.

Before:
{F12757500, size=full}

After:
{F12757502, size=full}

Differential Revision: https://developer.blender.org/D13609
2022-01-10 11:40:37 +01:00
62e8d80a61 Fix out of bounds memory access displaying the compositor crop gizmo
Regression from typo in cbca71a7cf.
2022-01-10 21:09:30 +11:00
6beaa29791 Compositing Convert color space node
Compositor node to convert between color spaces.

Conversion is skipped when converting between the same color spaces or to or from data spaces.
Implementation done for tiled and full frame compositor.

Reviewed By: Blendify, jbakker

Differential Revision: https://developer.blender.org/D12481
2022-01-10 08:59:00 +01:00
eb7333e772 Cleanup: Wintab input processing.
Switched populating GHOST_WintabInfoWin32 vector from resizing and
assigning to reserving and pushing.

Removed unnecessary state tracking for multiple button presses in a
single packet.

Paired initialization with definition, and added default initialization
for GHOST_WintabInfoWin32.
2022-01-09 19:38:11 -08:00
1705587e21 Cleanup: note that compositor vector blur shares logic with zbuf.c
Note that some functions have been copied between these files.
De-duplication isn't trivial as there are differences in some functions.
2022-01-10 13:47:13 +11:00
74c896c081 Cleanup: typos in comments, remove libnumaapi reference 2022-01-10 13:47:12 +11:00
c04d36e922 Cleanup: Missing internationization for socket description 2022-01-09 18:39:34 -05:00
37d6ae16be Fix mistake in previous commit 2022-01-09 18:32:26 -05:00
17c7bac405 Cleanup: redundent semicolons after function braces 2022-01-09 18:24:48 -05:00
6110f3aa1f Cleanup: Use new socket builder API 2022-01-09 17:44:36 -05:00
ca0c69eaeb UI: Make uiTemplateNodeLink work for all socket types
Currently the node link ui template only works with a few socket types.
This commit addes support for the rest of the socket type declarations.

As pointed out in D13776 currently after recent refactors
Shader nodes no longer display in the menu.

In the future more socket types will be used in the shader nodes
and makes the UI template work better for other node trees.

Differential Revision: https://developer.blender.org/D13778
2022-01-09 11:49:08 -05:00
5519a6a520 Fix T94243: weightpaint gradient panel shown in other places
Weightpaint gradient tool panel showed in other modes (and as a separate
panel).

Fix for fix, see
- rBf8a0e102cf5e
- rBe549d6c1bd2d

So now, check mode again and restrict to topbar (prevents an additional
panel since this is already included in the brush settings).

ref rB0837926740b3 in sculpt-dev branch, so thx @joeedh as well!

Maniphest Tasks: T94243

Differential Revision: https://developer.blender.org/D13630
2022-01-09 11:31:57 +01:00
c5ee3ac7e0 Cleanup: Remove no op socket templates 2022-01-09 01:03:39 -05:00
e17ac8dc58 Cleanup: Nodes: Begin splitting shader node buttons into individual files
Currently, most node buttons are defined in `drawnode.cc` however,
this is inconvenient because it requires editing many files when adding new nodes.
The goal is to minimize the number of files needed to add or update a node.

This commit moves most of the node layout functions for shader nodes into their respected
source/blender/nodes/shader/nodes file.

In the future, these functions will be simplified to node_layout.

Some nodes were left in `drawnode.cc` as this would require duplicating code
while this is likely fine it is best to leave that to a seperate commit.
2022-01-09 00:59:34 -05:00
ed1ced2484 Cleanup: Use new socket builder API 2022-01-08 23:16:55 -05:00
9620fdc986 Cleanup: Remove no op socket templates 2022-01-08 22:15:47 -05:00
45bc4e3209 Fix T94713: Alembic crash with empty frames and velocities
Some software or processing tools (videogrammetry in this case) may
export malformed files with velocity data even when the frame is empty
for some reason. We need to explicity compare the data size with the
vertex size, and refuse to load the attribute if there is a data size
mismatch.
2022-01-08 20:46:28 +01:00
d5e73fa13d Fix T94534: dangling pointer in internal link after removing socket
The dangling pointer caused errors further down the line.
The solution is to simply delete an internal link when one
of the corresponding sockets is removed (just like normal
links are removed as well).
2022-01-08 17:36:59 +01:00
937aa8e114 Cleanup: Use new socket builder API 2022-01-07 23:53:57 -05:00
90e5ce6ab5 Cleanup: Loop through socket listbase instead of array
The socket arrays will be removed when using the new socket builder.
So instead we have to loop through the node outputs list.
2022-01-07 23:53:45 -05:00
741ed5fcd2 Fix Cycles compile error after last own commit
We can't include `BLI_utildefines.h` in `RNA_types.h` since Cycles includes
that, but duplicates some of the util defines. So you'd have duplicated
definitions.
2022-01-08 00:28:19 +01:00
34e84d0ee8 Cleanup: Remove unused code from BKE_node.h
Remove a variety of unused functions, declarations without definitions,
incorrect comments, and defines that have been commented for years
2022-01-07 16:16:56 -06:00
09d6846839 Fix Adjust Last Operation panel showing session UUID number button
This is implementation specific data that should never be exposed to regular
users. Also make sure this data is not saved to presets.
2022-01-07 23:06:29 +01:00
3e11c7016e RNA: Support bitwise operators for property flags in C++
Needed for the following commit.
2022-01-07 22:50:55 +01:00
5ba5678e00 Cleanup: Use forward declaration of struct in header
This meant that BKE_mesh.h couldn't be used without
the DNA headers first.
2022-01-07 12:42:04 -06:00
Aleksi Juvani
1152caad32 Fix: connecting hair fails on meshes with no generative modifiers
Fixes a bug introduced in rB5dedb39d447b. `mesh_original` is not set if the
mesh has no generative modifiers, in which case we can use `mesh_final`, which
would seem to be consistent with the rest of the particle code. An alternative
approach would be to make sure that `mesh_original` is always set in
`deformVerts`.

Differential Revision: https://developer.blender.org/D13754
2022-01-07 18:05:03 +01:00
Olivier Maury
34d553671d Fix wrong shadow terminator geometry offset with deformation motion blur
Differential Revision: https://developer.blender.org/D13759
2022-01-07 17:20:04 +01:00
Olivier Maury
ee0928d4be Fix wrong shadow terminator geometry offset for instances
Must take into account SD_OBJECT_TRANSFORM_APPLIED to determine if the normal
was already in world space.

Differential Revision: https://developer.blender.org/D13639
2022-01-07 17:20:04 +01:00
ae28d90578 Fix T93350: Cycles renders shows black during rendering huge resolutions
The root of the issue is caused by Cycles ignoring OpenGL limitation on
the maximum resolution of textures: Cycles was allocating texture of the
final render resolution. It was exceeding limitation on certain GPUs and
driver.

The idea is simple: use multiple textures for the display, each of which
will fit into OpenGL limitations.

There is some code which allows the display driver to know when to start
the new tile. Also added some code to allow force graphics interop to be
re-created. The latter one ended up not used in the final version of the
patch, but it might be helpful for other drivers implementation.

The tile size is limited to 8K now as it is the safest size for textures
on many GPUs and OpenGL drivers.

This is an updated fix with a workaround for freezing with the NVIDIA
driver on Linux.

Differential Revision: https://developer.blender.org/D13385
2022-01-07 17:20:04 +01:00
Michael Jones
efe3d60a2c Cycles: Fix Metal build
This patch fixes a couple of new Metal kernel compilation errors: 1) a kernel parameter count overflow, and 2) missing address space qualifiers.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13763
2022-01-07 16:19:31 +00:00
b7ea6e9d0e LibOverrides: small refactor of resync main public function.
Simplify signature of `BKE_lib_override_library_resync` and make it a
shallow wrapper around new internal `lib_override_library_resync` that
can then be easily extended for other internal needs.

Not functional changes expected here.
2022-01-07 15:25:25 +01:00
Germano Cavalcante
5560f32447 Fix T94078: Wrong Bound Box calculated for curves
`DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN` creates temporary objects that
correspond to duplicates or instances.

These temporary objects can share same pointers with the original object
as in the case of Bounding Box.

Bound Box of temporary objects is marked dirty in
`BKE_object_replace_data_on_shallow_copy` since `ob->data` is different.

This causes the original Bounding Box, calculated for the evaluated
geometry, to be lost.

The solution in this commit is to change the boundbox reference of the
temporary objects, so the boundbox of the non-temporary object (with
the data curve) is not marked dirty.

Differential Revision: https://developer.blender.org/D13581
2022-01-07 10:42:13 -03:00
5085c622ea Cleanup: Remove unused numapi library 2022-01-07 12:19:02 +01:00
312aa67cc7 Remove dead numaapi code in blenlib
It it rather an old experiment now which didn't pay off.
The initial idea was to have main and jobs threads on fast
nodes of TR2 processors. This didn't really work reliably
because in Blender we need to be able to create nested
threads without their affinity set. This is not how some of
OS are creating nested threads, and we don't always have
access to child threads to reset their affinity.

So overall complexity of the initial idea implementation
became too much compared to the performance gain.
2022-01-07 12:19:02 +01:00
ed52de948c LibOverride: Add tag to libraries that had to be recursively resynced.
Request from studio, to help identify quickly libs that need update.

NOTE: Currently only outputing INFO log in console, display of this info
in the outliner will come in a separate commit.
2022-01-07 12:09:50 +01:00
2cc6b249c3 Cycles: Remove usage of libnumaapi
No need for it now since all the threading queries and
scheduling is done via TBB.

Should be no functional changes as all the removed code
is supposed to be unused.
2022-01-07 11:47:37 +01:00
Jagannadhan Ravi
361702f239 Fix T94310: Blender doesn't support with 128 threads well in Win11
Query TBB for the maximum allowed concurrency, which is free from a bug
in own concurrency detection code. One thing to keep in mind is that now
Cycles is limited by the number of threads in the TBB areana from which
Session is created. This isn't a problem for Blender since we do not limit
arena on Blender side. Could be something to watch out for in other Cycles
integrations.

Differential Revision: https://developer.blender.org/D13658
2022-01-07 11:37:30 +01:00
bef2412ca2 Fix T86952: Buffer overflow reading specific DDS images
Add a data boundary check in the flipping code.

This code now also communicates the number of mipmap levels
it processed with an intent to avoid GPU texture from using
more levels than there are in the DDS data.

Differential Revision: https://developer.blender.org/D13755
2022-01-07 11:15:17 +01:00
29e33cfff5 Fix T94659: crash when deleting instances (part 2)
This was missing from rB3e92b4ed2408eacd126c0.
Before only the Separate Geometry node was fixed, because that
node was used in the file from the bug report. The same issue
existed in the Delete Geometry node as well though.
2022-01-07 08:21:34 +01:00
6c906b7c21 Fix T94707: inverted output of separate geometry node incorrect
This was an oversight in rB3e92b4ed2408eacd126c0.
2022-01-07 08:11:25 +01:00
7c04bc9a01 Cleanup: exclude uiFont from DNA, rename filename -> filepath
This isn't saved to the preferences,
so there is no need to store in DNA.

Also remove unused `r_to_l` member.
2022-01-07 18:05:36 +11:00
f24854005d Fix T94708: negative reference count error with Python API callbacks
Regression in 7972785d7b that caused
Python callback arguments to be de-referenced twice - potentially
accessing freed memory. Making a new-file with a circle-select
tool active triggered this (for example).

Now arguments aren't de-referenced when Blender it's self has already
removed the callback handle.
2022-01-07 17:48:54 +11:00
1642028310 Cleanup: use the ELEM macro 2022-01-07 17:48:25 +11:00
82858ca3f4 Fix T94629: The IMB_flip API would fail with large images
Fix IMB_flip[xy] to handle cases where integer overflow might occur when
given sufficiently large image dimensions.

All of these fixes were of a similar class where the intermediate
sub-expression would overflow silently. Widen the types as necessary.

Differential Revision: https://developer.blender.org/D13744
2022-01-06 21:35:04 -08:00
b3dc1a17a0 Fix BKE_image_ensure_tile_token being called with a full path
Assert that only the file name component is passed in
since special handling for UDIM should only be applied to the file name.

Also remove an unnecessary NULL check on the filename argument.
2022-01-07 15:15:08 +11:00
2cd8238ce3 Cleanup: use static sets for comparison, quiet unused arg warnings 2022-01-07 14:47:27 +11:00
f48164b5ea Cleanup: rename sculpt_brushes.c -> sculpt_brush_types.c
This better differentiates sculpt brush types with brush data-blocks,
since the same sculpt brush type may be used for many brushes.
2022-01-07 14:28:49 +11:00
3d3bc74884 Cleanup: remove redundant const qualifiers for POD types
MSVC used to warn about const mismatch for arguments passed by value.
Remove these as newer versions of MSVC no longer show this warning.
2022-01-07 14:16:26 +11:00
bb69c19f08 Cleanup: Fix spelling in filename 2022-01-06 20:51:23 -05:00
e6ca0b33e9 Cleanup: Add bf_nodes_texture library
For sake of consistencey with other node tree types, create its own cmake module.
This change helps keep `bf_nodes` focused on  generic nodes files.

Texture nodes are end of life and hopefully for Blender 4.0 they can be removed.
It is not expected that these will see the updates that the other nodes are getting.
This change also helps isolate the end of life files, we may move some texture
specific node tree execution code out of `node_exec` and into a `node_texture_exec` files.

Differential Revision: https://developer.blender.org/D13743
2022-01-06 18:21:01 -05:00
ed9b21098d Cleanup: Use new socket builder API
This commit converts most shader or bsdf nodes.
2022-01-06 17:57:30 -05:00
3ae664363d Fix T94635: Sculpt Smooth in Surface mode with Anchored Stroke crash
Sculpt Smooth in Surface mode (as opposed to Laplacian) needs a cache
initialized on first time. In anchored stroke mode with spherical falloff
this was skipped though (because this starts of with no PBVH nodes and
an early return checks for this) and `first_time` was set to false before
cache initialization.

Now move the cache initalization to happen earlier (same as the cache
initialization for automasking).

Maniphest Tasks: T94635

Differential Revision: https://developer.blender.org/D13746
2022-01-06 20:55:43 +01:00
3a4952e7c2 Fix Cycles updating display unnecessarily when stopping 3D viewport
Debug code accidentally committed in 466b50d. This was found while
investigating issues with D13385.
2022-01-06 19:10:50 +01:00
0c6b29ee43 Fix T94672: incorrect Workbench shadows with GPU subdivision
The `lines_adjacency` IBO build in the GPU subdivision case was missing
edges at the boundaries of open meshes. As it is used for the shadow
pass, the shadows were then not clipped properly.

This would also make X-Ray mode render differently in those cases.

To fix this, we can simply reuse the buffer finalization routine from the
non-subdivision case, as such edges are handled there.
2022-01-06 16:25:09 +01:00
c2089ae53c GPU subdiv: fix wrong data sizes used for lines adjacency IBO
Function parameters were mismatched, causing an assertion failure in
debug builds.
2022-01-06 16:24:52 +01:00
ddae2d88fa Depsgraph: only link 'IK Constraint -> Init IK Tree' if animated.
This relation is intended to ensure that the properties of the IK
constraint are ready by the time the IK solver tree is built. This
however can cause spurious dependency cycles, because there is only
one init tree node for the whole armature, and the relation actually
implies dependency on all properties of the bone.

This patch reduces spurious dependencies by only creating the relation
if any properties of the IK constraint specifically are animated.

Differential Revision: https://developer.blender.org/D13714
2022-01-06 16:43:18 +03:00
1785286ecc Bone Overlay: support changing bone wireframe opacity.
When weight painting the bone overlay is extremely intrusive,
effectively requiring either extensive use of hiding individual
bones, or disabling the whole bone overlay between selections.

This addresses the issue by adding a bone opacity slider that
is used for the 'wireframe' armature drawing mode. It directly
controls the uniform opacity as a straightforward option.

Differential Revision: https://developer.blender.org/D11804
2022-01-06 16:43:18 +03:00
7bcf21e66e Depsgraph: fix spurious cycles with identically named idprops on bones.
If multiple bones have a custom property with the same name,
depsgraph didn't distinguish between them, potentially leading
to spurious cycles.

This patch moves ID_PROPERTY operation nodes for bone custom
properties from the parameters component to individual bone
components, thus decoupling them.

Differential Revision: https://developer.blender.org/D13729
2022-01-06 16:43:18 +03:00
08aa7861d6 Fix T94685: python error adding Space handlers for Spreadsheet
Oversight in {rB9cb5f0a2282a}.

Above commit made an entry in `rna_Space_refine()`, but the entry in
`rna_Space_refine_reverse()` was missing (and this is what python uses
for the Space callbacks).

Maniphest Tasks: T94685

Differential Revision: https://developer.blender.org/D13751
2022-01-06 13:47:35 +01:00
45277d804e Cleanup: use correct file namespace name 2022-01-06 13:25:42 +01:00
d31b8c316f Cleanup: typos in code. 2022-01-06 11:48:44 +01:00
88e15ff1e6 Fix T94674: crash reading ORCOs from an Alembic animation
The crash is caused as the data is only for the first frame, but the mesh
changes topology, so reading the data in subsequent frames causes a
buffer overflow. To fix this, we check that the data size matches the
mesh's vertex count.
2022-01-06 11:48:44 +01:00
ed3fecae8e Cleanup: USD/ABC, remove const from pass-by-value params
Remove `const` from pass-by-value parameters in function declarations.
The variables passed as parameters can never be modified by the function
anyway, so declaring them as `const` is meaningless. Having the
declaration there could confuse, especially as it suggests it does have
a meaning, training people to write meaningless code.
2022-01-06 11:41:03 +01:00
f9aa6376f1 Cleanup: anim, remove const declarations from pass-by-value params
Remove `const` from pass-by-value parameters in function declarations.
The variables passed as parameters can never be modified by the function
anyway, so declaring them as `const` is meaningless. Having the
declaration there could confuse, especially as it suggests it does have
a meaning, training people to write meaningless code.
2022-01-06 11:41:03 +01:00
1484fe260b Cleanup: Replace FINISHED with CANCELLED
As the operator does nothing, better use cancelled.
2022-01-06 10:22:32 +01:00
e766dc9189 Fix (unreported) crash in liboverride after yesterday's commit.
Own mistake in rBbfb760e16acb.
2022-01-06 10:01:07 +01:00
6f389f1bb8 Cleanup: move public doc-strings into headers
Some recent changes re-introduced public-style doc-strings
in the source file.
2022-01-06 19:25:24 +11:00
c12607baa3 Cleanup: quiet GCC stringop-overflow in bmesh_beautify.c
Also elaborate on the doc-string.
2022-01-06 13:54:56 +11:00
66a4da87f4 Cleanup: sort cmake file lists 2022-01-06 13:54:55 +11:00
ed68e18c1c Cleanup: remove unnecessary slashes and quotes from paths in CMake 2022-01-06 13:54:54 +11:00
2ee37e9031 Cleanup: remove redundant/unused assignment
SRC was being assigned invalid values then overwritten.
2022-01-06 13:54:53 +11:00
499fec6f79 Cleanup: spelling in comments 2022-01-06 13:54:52 +11:00
aa363ec2ae Cleanup: remove declaration for removed function 2022-01-06 13:54:51 +11:00
61e2384b7a Cleanup: compiler warnings 2022-01-06 13:54:49 +11:00
60757f010a CMake: add missing headers 2022-01-06 13:54:48 +11:00
0e53ea4cb5 Correct error when moving doc-strings into header
Error in ffc4c126f5,
which moved doc-strings from implementation into headers.

Some changes in BKE_animsys.h needed to done manually as there
were already doc-strings in both the header and implementation
(with overlapping information).
When making these changes some doc-strings were removed unintentionally.

Thanks for @sybren for the heads up.
2022-01-06 13:54:46 +11:00
4067367b6c Cleanup: Clang-tidy: modernize-redundant-void-arg 2022-01-05 21:44:22 -05:00
c0fb8ea8f3 Cleanup: Spelling/grammar in comments 2022-01-05 19:03:05 -06:00
1d9bac7d92 Cleanup: Use snake case for file names
This is so that we can have "proper" file namespace names in D13466
2022-01-05 17:15:13 -05:00
0e1da8dd12 In obj exporter test, fix a strncpy length and a stray test file left behind. 2022-01-05 17:05:53 -05:00
e55a6bf82b Cleanup: Remove empty node socket template array 2022-01-05 16:45:41 -05:00
c240ab70ae Cleanup: Use new socket builder API
Instead of looping through the old socket template array
looper through the node output listbase.
2022-01-05 16:27:29 -05:00
7c013f1154 Fix: MSVC build error
MSVC2017 and early 2019 versions are under
the impression struct OGLRender is non trivial
type due to the ThreadCondition field, not
entirely sure why, but it is what it is.

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

Reviewed by: JacquesLucke
2022-01-05 14:02:07 -07:00
611da3b7d6 Cleanup: Use new socket builder API 2022-01-05 15:47:15 -05:00
50f694c7de Cleanup: Use new socket builder API
Also enables translation of socket names
2022-01-05 15:47:15 -05:00
a5b4373f95 Fix/workaround macOS Rosetta crash running Cycles AVX tests
Just disable these tests on macOS for now as fixing seems hard, and we want to
be able to cross-compile and test x86_64 on Arm machines on the buildbot.
2022-01-05 21:21:13 +01:00
cdd61bb6d7 Fix Cycles AVX test failure with x86_64 build running on Arm
Don't create const avx vectors before validating if CPU supports AVX.
2022-01-05 20:05:16 +01:00
f7a0f6a0e4 Fix T94563: Cycles standalone build error on with strict float/double casting
Thanks to John David for finding this.
2022-01-05 20:05:16 +01:00
1dc0bf86bb Fix T93695: Discontinuous cutting with the knife tool
An important check to reject edge linehits when a vertex of that edge
was already hit was accidentally removed in
rB6e77afe6ec7b6a73f218f1fef264758abcbc778a
2022-01-05 18:32:23 +00:00
a0edee712a Cleanup: Remove unused node_type_exec for shader node
From what I can tell these are left over from Blender Internal render.

Test still pass locally, also tested a couple eevee scenes.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D13732
2022-01-05 11:52:57 -05:00
8cd6d0fe68 Fix T94169: Missing grease pencil render with tiled rendering
Delay grease pencil for until after the render result is written
to the Blender side.

Differential Revision: https://developer.blender.org/D13740
2022-01-05 17:47:10 +01:00
3c04b44913 Fix Cycles allocating result too early
When tiled rendering was used the render result was
allocated at the end of every view layer render as
opposite of an intended end of all rendering.

Modify the render_result_end so that it only ensures
pixels are allocated if pixels are actually copied
over.
2022-01-05 17:47:10 +01:00
5e7e571b0d Fix Cycles using Cancel semantic on final result write
Seems like a copy-paste bug from another place.
2022-01-05 17:47:10 +01:00
bfb760e16a Fix T94650: LibOverride: Bad handling of (auto)resync in case of single override.
Overrides that are not created as part of an override hierarchy should
not be handled through (auto)resync at all. users are responsible to
hanlde those updates if they need it.

This is achieved by flagging overrides created outside of a hierarchical
process accordingly, and skipping them during resync process.
2022-01-05 17:30:22 +01:00
1403f034ff LibOverride: Cleanup some code.
No functional change.
2022-01-05 17:30:22 +01:00
b63f375775 Assets: disable automatic preview generation for node groups
The current preview generation is more confusing than useful.
Therefore it is better to disable it until better preview generation
methods are found.

Differential Revision: https://developer.blender.org/D13728
2022-01-05 17:01:52 +01:00
3e92b4ed24 Fix T94659: crash when deleting instances
The crash was caused by using `modify_geometry_sets` to modify
instances, which does not generally work unfortunately.
The intended behavior was wrong anyway. In instances mode,
only top level instances should be deleted.

Also removed the old error handling because it doesn't look like it
ever worked. all_is_error remained false all the time.
Furthermore, updating it was not thread safe.

Differential Revision: https://developer.blender.org/D13736
2022-01-05 16:55:09 +01:00
Aleksi Juvani
5dedb39d44 Fix T54488: hair disconnect/reconnect not working with modifiers
Take the Use Modifier Stack setting into account when connecting hair, and
fix wrong results results when using deforming modifiers also.

Differential Revision: https://developer.blender.org/D13704
2022-01-05 16:53:54 +01:00
1031638c51 Cleanup: rename mesh -> geom in some places that now handle multiple geom types 2022-01-05 16:06:34 +01:00
f64d7bfa4a Cleanup: compiler warnings about unused code 2022-01-05 16:06:23 +01:00
8393ccd076 Cycles: Add OptiX temporal denoising support
Enables the `bpy.ops.cycles.denoise_animation()` operator again and modifies it to support
temporal denoising with OptiX. This requires renders that were done with both the "Vector"
and "Denoising Data" passes.

Differential Revision: https://developer.blender.org/D11442
2022-01-05 15:58:36 +01:00
86141a75eb Cleanup: fix typos in source code in intern/
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D13532
2022-01-05 15:35:30 +01:00
29ab711efa Cleanup: Remove unused code (USE_COLOR_U32) 2022-01-05 15:00:07 +01:00
4c3f52e7dc Cycles: support rendering PointCloud motion blur from attribute
This adds support to render PointCloud motion blur from a standard
"velocity" attribute.

This implementation is similar to that of the Mesh geometry, and
perhaps some code could be deduplicated through a more generic API.
`mesh_need_motion_attribute` was renamed `object_need_motion_attribute`
as it does not really require a mesh and moved to `util.h` so that
it can be shared.

This fixes T94622.

Reviewed By: brecht

Maniphest Tasks: T94622

Differential Revision: https://developer.blender.org/D13719
2022-01-05 14:17:57 +01:00
b1bd0f8ffd Enable OpenEXR DWAB compresstion
The DWAB compression was disabled in the d59721c2c3 due to
a bug in the OpenEXR library which is now resolved.

Re-enable the DWAB compression for OpenEXR output. It is a
simple change, and DWAB often behaves better than DWAA.

Differential Revision: https://developer.blender.org/D13713
2022-01-05 14:07:21 +01:00
13e7065dd2 Fix T94564: Mirror clipping is not properly placed in sculpt mode
If a mirror object is used in a mirror modifier, sculptmode did not take
this into account (and instead always clipped on the sculpt objects
local axis).

Now take this into account by storing a matrix in the preparation
function `sculpt_init_mirror_clipping` and use that later in
`SCULPT_clip`.

Maniphest Tasks: T94564

Differential Revision: https://developer.blender.org/D13711
2022-01-05 13:23:37 +01:00
924d2b8df6 Fix T94506: Crash in Compositing 2022-01-05 12:31:37 +01:00
d960c78693 Fix T94545: support realizing instanced collections
This case wasn't handled in rBf5ce243a56a22d718 correctly.
Now `object_get_evaluated_geometry_set` just returns a geometry
set that contains the collection instance for collection instance objects.
2022-01-05 11:47:09 +01:00
33400ffcc9 IDManagement: Add assert against no-main IDs passed to BKE_id_delete.
This high-level function can only deal with IDs in main, trying to use
it to delete/free a no-main ID does nothing.
2022-01-05 10:39:09 +01:00
5df916f23f Fix T94366: Grease Pencil Automerge no immediate UI update
Just an oversight in rBe9607f45d85d.
Now add notifier that toolsettings changed.

Maniphest Tasks: T94366

Differential Revision: https://developer.blender.org/D13723
2022-01-05 09:13:52 +01:00
b7073fa797 Cleanup: Use new socket builder API 2022-01-05 00:59:18 -05:00
458be2ecc4 Nodes: Consistent link drag search for math and vector math nodes
Previously operations for the math node when connecting to
outputs weren't added. It also used a different method to
check whether the link would be valid.
2022-01-04 23:19:12 -06:00
5336fdc6e3 Cleanup: Make shade node util header CPP only
Now that all shader nodes are converted to CPP
this header can now be made into a CPP header.
2022-01-04 23:25:27 -05:00
713d59bcaf Fix T89587: Don't Change Line Width For Previews
Do not temporarily change U.pixelsize while creating object previews
in object_preview_render. It does nothing to the render, but the change
in line width can affect other UI drawing since it is done in a thread.

see D13717 for for details.

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

Reviewed by Julian Eisel
2022-01-04 15:51:18 -08:00
e3748d7fa5 Fix T94145: Knife tool fails in orthographic mode
Calculating min and max orthographic extent forgot to convert to
worldspace coordinates.
2022-01-04 20:26:09 +00:00
07de17ded6 Cleanup: Dont use relative include
Instead let cmake determine the path for file includes
2022-01-04 11:58:21 -05:00
Aaron Carlisle
25018dc061 Cleanup: Nodes: Convert generic shader node files to c++
Along with the general changes to CPP this commit does the following

- Use static casts where possible
- Use new CPP MEM library functions instead of cast
- Use listbase macros where possible
- Declare variables where initialized

Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D13718
2022-01-04 11:42:40 -05:00
f7c0287278 Fix: Link drag search error with random value node from color socket
Dragging from a color socket would hit an assert in a debug build.
The node does not have a color mode currently, so use the vector mode
instead when connecting to a color socket.
2022-01-04 10:32:32 -06:00
55842b4244 Fix T94620: GPencil AutoMerge does not work when Draw On Back is enabled
The problem was the stroke was added to head and the `prev` pointer was NULL. Now check if there is the list is empty`next`.
2022-01-04 17:08:05 +01:00
ad8e2d6661 Fix T94308: Window Manager console error 2022-01-04 17:00:05 +01:00
bbd0c4118b Fix: Build issue with MSVC
std::min was used without including the algorithm
header. Seems to be implicitly included by
something in newer MSVC versions and GCC, however
vs16.4 needed a little help here.
2022-01-04 07:15:51 -07:00
54e2f851a4 Cleanup: Code formatting. 2022-01-04 14:07:27 +01:00
070948b5f1 Fix T94546: Remove soft limit for the Clamp Node value socket. 2022-01-04 12:26:16 +01:00
f7018f7b06 Fix T94544: crash removing image used as camera background via python
Since 2.8, background images are tied to cameras (in 2.79 these were
tied to a View3D I think).
Code in `BKE_library_id_can_use_idtype` wasnt taking this relation
between `Camera` and `Image` into account, thus leading to ID deletion/
unlinking not working properly -- in particular `libblock_remap_data`
not doing its thing (and leaving the camera as a user of the image),
then things went downhill from there...

Now make the "Camera-can-use-an-Image" relation clear in
`BKE_library_id_can_use_idtype`.

Maniphest Tasks: T94544

Differential Revision: https://developer.blender.org/D13722
2022-01-04 12:13:05 +01:00
b2867d4365 Fix T94599: Assert on usercount when deleting image created via operator.
`IMAGE_OT_new` operator would not properly clear the by-default one user
generated by 'new id' code, in case it could not tie the image to
anything.
2022-01-04 10:03:31 +01:00
Manuel Castilla
a2a02e3994 Fix T90830: Crop node cropping is one pixel short
Currently the crop higher limits are inclusive too which contradicts
the documentation as it says that if Left and Right are both 50, it
will result in a zero-sized image. And the result is one pixel out of
the crop gizmo, which is another hint that this is not intended.

In "Full Frame" experimental mode it's two pixels short because of
a misuse of `BLI_rcti_isect_pt` as it considers max limits inclusive.

Reviewed By: jbakker

Maniphest Tasks: T90830

Differential Revision: https://developer.blender.org/D12786
2022-01-04 08:22:37 +01:00
Aidan Davey
325beef7af Fix T91160 - Movie Clip Editor - frame indicator/controller is not displayed
The frame indicator/controller is not displayed when in the Graph or Dopesheet view of the Movie Clip Editor

To solve this we could call the function ED_time_scrub_draw_current_frame in clip_draw_dopesheet_main and graph_region_draw in space_clip.c

Reviewed By: jbakker

Maniphest Tasks: T91160

Differential Revision: https://developer.blender.org/D12659
2022-01-04 08:21:13 +01:00
Aaron Carlisle
7af01de802 Shader Nodes: Unity Build
Enable unity builds for  `bf_nodes_shader`, gives about a 2.7x speedup
of total compile times when just building `bf_nodes_shader`.
On my machine, this equates to saving about 30 seconds.

Differential Revision: https://developer.blender.org/D13720
2022-01-03 23:10:36 -05:00
a9e0caa92d Cleanup: Move node storage macro inside file namespace
Must have been a mistake in previous commits,
this fix is needed to enable unity builds.
2022-01-03 21:52:20 -05:00
d2cc672b0c Fix soft light blend mode math
Function `blend_color_softlight_float` used math different to compositor and
produced result that had abrupt value changes.

Use math based on modified screen blend mode as compositor does.
2022-01-04 02:11:38 +01:00
9c85acf61d Fix out of range color in blend modes
Result of Exclusion and Pin Light blend modes could be greater than 255
which caused artifacts. Limit color value to 0-255 range.
2022-01-04 02:11:38 +01:00
Aaron Carlisle
d3ad04172d Cleanup: Remove bNodeType flag from base registration functions
This flag is only used a few small cases, so instead
of setting the flag for every node only set the
required flag for the nodes that require it.

Mostly the flag is used to set `ntype.flag = NODE_PREVIEW`
For nodes that should have previews by default which
is only some compositor nodes and some texture nodes.

The frame node also sets the `NODE_BACKGROUND` flag.

All other nodes were setting a flag of 0 which has no purpose.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13699
2022-01-03 19:33:14 -05:00
9793bc30ce BLI: Add slice method to MutableSpan
Span had a slice method with an IndexRange argument, but MutableSpan
did not, yet. This commit makes the two types consistent.
2022-01-03 16:27:13 -06:00
675d3cdd69 Cleanup: Clang tidy 2022-01-03 13:52:55 -06:00
4e44cfa3d9 Add a new C++ version of an exporter for the Wavefront .obj format.
This was originally written by Ankit Meel as a GSoC 2020 project.
Howard Trickey added some tests and made some corrections/modifications.
See D13046 for more details.

This commit inserts a new menu item into the export menu called
"Wavefront OBJ (.obj) - New".
For now the old Python exporter remains in the menu, along with
the Python importer, but we plan to remove it soon (leaving the
old addon bundled with Blender but not enabled by default).
2022-01-03 14:49:31 -05:00
c6069c439c Fix T94581: Incorrect geometry delete behavior with instances
Compare the start of the range to zero to figure out whether the
indices for the instances to keep starts at zero. Also rename the
selection argument, since it made it seem like the selected indices
should be removed rather than kept.
2022-01-03 13:19:04 -06:00
a42e972e1b Fix T94316: Asset catalog tree scrolls away when renaming a catalog
The activation of the text button is a bit special, since it happens during
drawing, the layout isn't computed yet then. Comparable cases where the button
is added on top don't use the layout system, so this didn't become an issue
until now. Trigger a delayed call to `UI_but_ensure_in_view()`.
2022-01-03 19:55:49 +01:00
1b9e103a30 Fix T94594: Incorrect spreadsheet data set region type in old files
This completes 1a721c5dbe by versioning old files to correct the
region type. The "tools" region type is relatively standard for this type
of region and doesn't require any changes to the theme, unlike
the "nav bar" type, which would have been a reasonable choice.
2022-01-03 12:54:40 -06:00
b7ad58b945 Geometry Nodes: Edge Angle Node
Calculates the angle in radians between two faces that meet at an edge.
0 to PI in either direction with flat being 0 and folded over on itself PI.
If there are not 2 faces on the edge, the angle will be 0.

For valid edges, the angle is the same as the 'edge angle' overlay.

For the Face and Point domain, the node uses simple interpolation to calculate a value.

Differential Revision: https://developer.blender.org/D13366
2022-01-03 11:16:50 -06:00
ca143fafa6 Cleanup: Silence "integer conversion resulted in a change of sign" warning in Cycles kernel code
Occured because "PATH_RAY_SHADOW_CATCHER_BACKGROUND" is expressed as an unsigned
integer, because too large for a signed integer, but the "PathRayFlag" enum type defaulted to a
signed integer still.
2022-01-03 16:28:44 +01:00
8f9f65bc29 Allow overrides for cloth, collision and force field properties.
Allow overriding simple properties of cloth simulations, colliders
and force fields. Vertex group and shape key selectors in cloth are
still not overridable since they are tied to mesh data.

Force fields have a number of physical fields shared between multiple
RNA fields. Until they are decoupled, they will produce redundant
overrides, and cannot have different hard range limits.

Differential Revision: https://developer.blender.org/D13710
2022-01-03 18:06:13 +03:00
8189471912 Fix T94392: 3D Cursor surface projection onto hidden geometry
Regression introduced in rB098008f42d8127d9b60717c7059d3c55a3bfada7

Previously the selected geometry was ignored along with the hidden one.

The mentioned commit caused neither the hidden nor the selected one to be ignored.

But hidden geometry needs to be ignored.
2022-01-03 11:52:02 -03:00
a230445cae Depsgraph: Remove object-level visibility from geometry builders
Continuation of the D13404 which finished the design of not having
geometry-level nodes dependent on object-level.

Differential Revision: https://developer.blender.org/D13405
2022-01-03 15:30:14 +01:00
a3e634d4d7 Cleanup: Unused variable in Cycles code 2022-01-03 14:46:10 +01:00
6a4ee3fd56 Fix (unreported) i18n utils failing to create MO files in trunk.
Not really important anymore, since those are not used by Blender, but
better be consistent.
2022-01-03 11:48:24 +01:00
e51864a357 Add Georgian to our list of languages.
CC @Tamuna who started the translation for this language.
2022-01-03 11:13:15 +01:00
0a4bd32e59 Blender font: Add georgian script.
Weirdly enough, our 'mono' font already had it, but not the main one.

Copied from DeJaVu sans font.

CC @Tamuna who started the translation for that language.
2022-01-03 11:12:55 +01:00
add4aa7d25 Install_deps: Also cleanup CLANG CMAKE variables
Needed together with LLVM cleanup, otherwise things fail when LLVM gets
updated.
2022-01-03 10:39:37 +01:00
2e00d90938 Cleanup: Renamed to_object_value to to_dictionary_value. 2022-01-03 10:25:16 +01:00
e2fdc6226a Cleanup: rename ValueType.Object to ValueType.Dictionary. 2022-01-03 10:23:09 +01:00
ea8d749587 Cleanup: Rename ObjectValue to DictionaryValue (Serialization).
ObjectValue was to confusing as it is the term from JSON.
2022-01-03 08:10:21 +01:00
180b66ae8a UDIM: Support virtual filenames
This implements the design detailed in T92696 to support virtual
filenames for UDIM textures. Currently, the following 2 substitution
tokens are supported:

| Token | Meaning |
| ----- | ---- |
| <UDIM>   | 1001 + u-tile + v-tile * 10 |
| <UVTILE> | Equivalent to u<u-tile + 1>_v<v-tile + 1> |

Example for u-tile of 3 and v-tile of 1:
filename.<UDIM>_ver0023.png   --> filename.1014_ver0023.png
filename.<UVTILE>_ver0023.png --> filename.u4_v2_ver0023.png

For image loading, the existing workflow is unchanged. A user can select
one or more image files, belonging to one or more UDIM tile sets, and
have Blender load them all as it does today. Now the <UVTILE> format is
"guessed" just as the <UDIM> format was guessed before.

If guessing fails, the user can simply go into the Image Editor and type
the proper substitution in the filename. Once typing is complete,
Blender will reload the files and correctly fill the tiles. This
workflow is new as attempting to fix the guessing in current versions
did not really work, and the user was often stuck with a confusing
situation.

For image saving, the existing workflow is changed slightly. Currently,
when saving, a user has to be sure to type the filename of the first
tile (e.g. filename.1001.png) to save the entire UDIM set. The number
could differ if they start at a different tile etc. This is confusing.
Now, the user should type a filename containing the appropriate
substitution token. By default Blender will fill in a default name using
the <UDIM> token but the user is free to save out images using <UVTILE>
if they wish.

Differential Revision: https://developer.blender.org/D13057
2022-01-02 20:48:59 -08:00
Aaron Carlisle
367fc69dc1 Nodes: Convert several shader nodes to c++
Also add file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13690
2022-01-02 23:35:20 -05:00
8be217ada5 Geometry Nodes: add field node type for constants
It is common to have fields that contain a constant value. Before this
commit, such constants were represented by operation nodes which
don't have inputs. Having a special node type for constants makes
working with them a bit cheaper.

It also allows skipping some unnecessary processing when evaluating
fields, because constant fields can be detected more easily.

This commit also generalizes the concept of field node types a bit.
2022-01-02 14:27:16 +01:00
4c46203cb5 Geometry Nodes: small refactor towards supporting partially lazy nodes
Currently, a node either supports lazyness during execution (like the Switch
node), or it doesn't. If it does support lazyness, then every input is computed
lazily. However, usually not all inputs actually have to be computed lazily.
E.g. the boolean switch input is always required, while the other inputs
should be computed lazily.

Better support for such sockets  can avoid unnecessary round trips through
the node execution function.
2022-01-01 12:50:48 +01:00
Charlie Jolly
6844304dda Nodes: Add Compare node operations to link drag search menu
Exposes compare operations via rna emums.
This uses the rna enum to build the search list using
named operations linked to socket A.
This also weights the Math Node comparison operations lower
for geometry node trees.

Differential Revision: https://developer.blender.org/D13695
2021-12-31 20:32:42 +00:00
e79b4523b4 LineArt: Correct collection intersection mask logic.
The logic used to be:

"if collection doesn't have child collection, check if ob is from this one"

The correct logic should be:

"if collection child does not have this ob, then check this collection".
2021-12-31 21:54:07 +08:00
97ae08c9fc LineArt: Correct clamping of out of bound isect index
Handles rare cases where line doesn't intersect the triangle correctly.
2021-12-31 21:26:39 +08:00
d09b1d2759 Fix T94464: video texture is not refreshing
In the past that worked because the `GPUMaterial` referenced the
`ImageUser` from the image node. However, that design was incompatible
with the recent node tree update refactor (rB7e712b2d6a0d257d272e).
Also, in general it is a bad idea to have references between data that is
owned by two different data blocks.

This incompatibility was resolved by copying the image user from the node
to the `GPUMaterial` (rB28df0107d4a8). Unfortunately, eevee depended
on this reference, because the image user on the node was update when the
frame changed. Because the image user was copied, the image user in the
`GPUMaterial` did not receive the frame update anymore.

This frame update is added back by this commit. The main change is that
the image user iterator now also iterates over image users in `GPUMaterial`s
on material and world data blocks. An issue is that these materials don't
exist on the original data blocks and that caused the check in
`build_animation_images` in the depsgraph to give the wrong answer.
Therefore the check is extended.

Right now the check is not optimal, because it results in more depsgraph
nodes than are necessary. This can be improved when it becomes cheaper
to check if a node tree contains any references to a video texture.
The node tree update refactor mentioned before makes it much easier
to construct this kind of run-time data from the bottom up, instead of
scanning the entire node tree recursively every time some information
is needed.
2021-12-31 14:24:11 +01:00
56344fb30f Cleanup: Silence warning for wrong const char comparison
Incorrectly used comparison for empty string.

Reported in chat by @jacqueslucke.
2021-12-31 13:05:58 +00:00
018272ee5b Fix T94416: incorrect handling when nodes are linked in a loop
This just skips the entire algorithm when there are cycles.
In the future, cycles could be handled more gracefully in the
algorithm, but for now that's not worth it and is not necessary
to fix the bug.
2021-12-31 11:33:47 +01:00
Charlie Jolly
71468f475b Nodes: Weight drag link search for Math nodes
As @hooglyboogly suggested in D13680, this patch adds weighting
to the search results. Dragging from a vector/rgba socket weights
the Vector Math node higher than a float Math node, and vice versa.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13691
2021-12-31 02:34:23 +00:00
0aa7315608 Fix (unreported): remove menu separators from drag link search
Search was picking up the menu separator entries.
Add check for these which are defined by empty identifier strings.
2021-12-31 01:15:00 +00:00
bf4358ed0c Cleanup: Use switch to get gpu shader name
Rather than using the array syntax that doesnt work in C++,
use a switch state which is also much easier to read.
2021-12-30 17:39:23 -05:00
ee2b72fd29 Nodes: Convert several shader nodes to c++
Also add file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13690
2021-12-30 12:42:12 -05:00
e0d1e66732 Fix T93868: GPencil material filter does not work with instances
When the material is used in several objects, the filter by material is not working as expected because the internal pointers are different due eval version.

Now, the original version of the material is compared to keep same address.
2021-12-30 12:48:51 +01:00
Shen Ciao
52da1afbf6 Fix T93134: Set origin broken for curve edit mode
Bug: Set Origin causes unexpected offset on Grease Pencil strokes when Curve Editing is enabled.
Fix: Add transformation of editcurve points in `object_origin_set_exec`.

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T93134

Differential Revision: https://developer.blender.org/D13273
2021-12-30 11:29:09 +01:00
49a18cc91e Fix T93163: GPencil scale thickness fails in negative scales
Before the negative scales produced a thickness invalid. Now, the value is used in absolute value to avoid this situation.
2021-12-30 11:18:05 +01:00
0b73b2c6cf Nodes: Improve link drag search for Math and Vector Math nodes
Exposes math operations via rna emums.

This uses the rna enum to build the search list.

Differential Revision: https://developer.blender.org/D13680
2021-12-30 01:22:10 +00:00
6d7dbdbb44 Point Cloud: Optimize bounding box calculation
This is analagous to 6a71b2af66 which did the same
thing for mesh data. Two differences are that here the coordinates
are simply `float3`, and we account for the radius if it's available.
Here I observed a similar performance increase, from 50ms
average to 10ms average, with 16 million points, a 5x speedup.

The calculation is about 1.4 times faster when no radius is used, down
 to 7.3ms average. Before, the calculation was only 1.2 times faster.
2021-12-29 18:39:41 -06:00
9d3264b4fd Cleanup: clang-tidy modernize-redundant-void-arg 2021-12-29 18:51:10 -05:00
d3a31311b9 Nodes: Convert shader, texture category nodes to c++
Also add/correct file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13688
2021-12-29 18:36:15 -05:00
c0fdf16561 Fix T94454: Python API curve to mesh use after free without depsgraph
This was caused by a mistake in eb0eb54d96, which removed
the clearing of the curve edit mode pointers that are set when creating
the temporary data for the conversion. If they are not cleared, the
generic ID free function will also free the edit mode data, which is
wrong when the source curve is in edit mode.
2021-12-29 16:53:02 -06:00
04ead39dae Modifiers: decrease maximum allocation size for Weld vertices
At the time of allocating the buffer with vertices in context, we don't
know exactly how many vertices are affected, but we do know that it is
less than or equal to twice the number of vertices killed.
2021-12-29 17:45:56 -03:00
bb0da7dbbd Fix (unreported): missing relations update after adding scene time node
This just moves the relations update to a lower level function that is used
by other functions. Eventually, the special case for this node should be
generalized.
2021-12-29 19:40:14 +01:00
5e8b42bf86 Cleanup: Remove unused DerivedMesh functions 2021-12-29 12:37:01 -06:00
a94d80716e Geometry Nodes: Support instances in the delete geometry node
Ever since the instance domain was added, this was exposed, it just
didn't do anything. This patch implements the instances domain in the
delete and separate geometry nodes, where it acts on the top-level
instances.

We act on a mutable instances input, with the idea that eventually
copy on write attribute layers will make this less expensive. It also
allows us to keep the instance references in place and to do less
work in some situations.

Ref T93554

Differential Revision: https://developer.blender.org/D13565
2021-12-29 11:31:58 -06:00
a836ded990 Geometry Nodes: Accumulate Fields Node
This function node creates a running total of a given Vector, Float, or
Int field.

Inputs:
  - Value: The field to be accumulated
  - Group Index: The values of this input are used to aggregate the input
    into separate 'bins', creating multiple accumulations.
Outputs:
  - Leading and Trailing: Returns the running totals starting
   at either the first value of each accumulations or 0 respectively.
  - Total: Returns the total accumulation at all positions of the field.

There's currently plenty of duplicate work happening when multiple outputs
are used that could be optimized by a future refactor to field inputs.

Differential Revision: https://developer.blender.org/D12743
2021-12-29 10:25:39 -06:00
279085e18e Fix: Issues with attribute comparison in geometry nodes tests
A few typos in 17770192fb lead to an incorrect count of custom
data layers in the test meshes. We only want to consider layers that are
not anonymous, and there was a copy and paste mistake.
2021-12-29 10:23:53 -06:00
d5b77fd522 Nodes: Composite: UI fixes to time node
- Use default size consistent with other curve nodes
- Use column instead of row for properties
2021-12-29 11:16:44 -05:00
Germano Cavalcante
1c7d7c9150 Fix T94113: Local view + Geometry Nodes is broken for instances
`GeometrySet::compute_boundbox_without_instances` may not initialize min
max in some cases such as meshes without vertices.

This can result in a Bounding Box with impossible dimensions
(min=FLT_MAX, max=-FLT_MAX).

So repeat the same solution seen in `BKE_object_boundbox_calc_from_mesh`
and set boundbox values to zero.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13664
2021-12-29 12:36:58 -03:00
d786b48aab Cleanup: Remove dead code 2021-12-29 10:31:17 -05:00
Aaron Carlisle
465bd66519 Nodes: Cleanup: Remove no op registration functions
All these function paramaters are set to NULL so they arent necessary.

Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D13686
2021-12-29 10:00:50 -05:00
Germano Cavalcante
b7f6377e38 gpu.types.GPUOffScreen: accept format argument for color texture
Some projects need more than 8-bit RGBA off-screen, so add the ability to
accept color format and defaults to RGBA8 so existing code should not be
affected.

Currently supported formats:
- RGBA8 (default)
- RGBA16
- RGBA16F
- RGBA32F

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D13650
2021-12-29 11:46:53 -03:00
bdcc258305 Fix: VSE colormix blend factor not working
Blend factor was used to adjust alpha of background image, which is not
correct. This was done in fdee84fd56 where another change was, that
background alpha is copied into result, which is correct.

Apply blend factor to foreground image alpha channel.
2021-12-29 15:00:57 +01:00
4bf74afacc Fix T94422: Shading/Normals break on array modifier caps
The array modifier does not necessarily tag normals dirty.
If it doesnt, normals are recalculated "internally" using the offset ob
transform. This was happening for the array items, but not for the caps.

Now do the same thing for caps.

Maniphest Tasks: T94422

Differential Revision: https://developer.blender.org/D13681
2021-12-29 10:16:48 +01:00
dc0bf9b702 Fix T94453: Weld modifier crash after recent cleanup
I had assumed that the span's size was the same as the length variable.
In the future, separate lengths could be removed in favor of using
lengths directly from spans.
2021-12-29 00:16:54 -06:00
ba38b06a97 Nodes: Convert shader, shader category nodes to c++
Also add file namespace

This is needed to use new node APIs

Differential Revision: https://developer.blender.org/D13684
2021-12-28 22:51:57 -05:00
b92ef379b7 Cleanup: clang-tidy
Fixes two instances of `-Wunused-but-set-variable`

There are several more of these but these were low hanging
and noisy with one being in a header functions.
2021-12-28 21:53:41 -05:00
53ed7ec7f2 Cleanup: clang-tidy
- modernize-deprecated-headers
- modernize-redundant-void-arg

Missed in rB11ac276caaa6e6d42176452526af97cf972abb5f
2021-12-28 20:58:50 -05:00
c34ea3323a Cleanup: Remove unused node tree "local sync" functions 2021-12-28 18:25:18 -06:00
7006d4f0fb Cleanup: Use indices instead of pointers
This improves code readability.

Take the opportunity and improve the comments too.
2021-12-28 20:42:21 -03:00
1464eff375 Cleanup: Return early, organize variable declarations 2021-12-28 15:36:59 -06:00
c32ce881e8 Nodes: Enable unity build for function nodes
Unity build saves 5 seconds off the total build time when compiling `bf_nodes_function`.
Total build times went from 25s to 20s (20% reduction),
tested with ninja on linux running i5 8250U.
2021-12-28 15:49:42 -05:00
Aaron Carlisle
1e9175e1d7 Nodes: Add bf_nodes_function module
In the future this will be used to support unity builds for function nodes

Differential Revision: https://developer.blender.org/D13682
2021-12-28 15:18:17 -05:00
2668f9181c Nodes: Split shader color ramp into its own file 2021-12-28 14:18:31 -05:00
715e0faabc Nodes: Declare function nodes in individual file namespace
To be used in the future to support unity builds
2021-12-28 14:18:31 -05:00
955748ab1e Fix: Duplicate link search entries for attribute statistic node
Using the output declarations is incorrect because there is a
declaration for each type. Instead loop over the names directly,
since it will make it easier to add an integer mode that only
supports some of the outputs.
2021-12-28 12:44:36 -06:00
4cbcfd22f5 Fix T94442: Trim curve node can crash with duplicate point
The calculation to find the factor between two evaluated points assumed
that the points were not at the same location. This assumption is some-
what reasonable, since we might expect `lower_bound` to skip those
point anyway. However, the report found a case where the first two
evaluated points were coincident, and there is no strong reason not
to make this safe, so add a check for 0 length before the division.
2021-12-28 12:22:14 -06:00
d7c556de32 GPencil: Avoid crashes calling from python
This is part of T94439
2021-12-28 18:50:07 +01:00
2e6ae11326 Nodes: Add bf_nodes_composite module
In the future this will be used to support unity builds for composite nodes

Differential Revision: https://developer.blender.org/D13678
2021-12-28 12:22:06 -05:00
1a721c5dbe Fix T94380: Scrolling zooms in spreadsheet data set region
The region used to be type "Channels", but the standard for this
type is "Tools", which is what the file browser uses. This follows
the changes in rB01df48a98394, which also make the region more
"standard."
2021-12-28 11:05:31 -06:00
0e38002dd5 Cleanup: Loops in VSE effect processing
Some effect functions looped over alternating lines, previously with
different factors. Since only one factor is used, code can be
simplified by looping all lines in one for loop.

There should be no functional changes.
2021-12-28 16:40:09 +01:00
bd9d09ca82 Fix T94439: Some GPencil operators crash when calling from console
This fix avoid the segment fault for several operators.
2021-12-28 16:07:07 +01:00
9bacd54312 LibOverride: better handling of the "no override of bones' shapes" case.
Also avoid overriding collections of bone shape objects, if possible.
2021-12-28 15:08:10 +01:00
23ac79f2c2 LibOverride: Tweak RNA 'need resync' detection code.
* Assert about source ID of an overridden pointer property not being a
  liboverride was not necessary, just skip in that case.
* Tag actual 'real' ID owner for resync, and not (potentially) an embedded one.
2021-12-28 15:08:10 +01:00
44db9f192e Cleanup: Factor in VSE effect processing
2 factor variables were passed to effects, but they were hard coded to
have same value.

Remove duplicate variable from arguments, rename single argument to
`fac`. Inverted factor variables were renamed to `mfac`. Any other
factor related variables are prefixed with `temp_`.

There should be no functional changes.
2021-12-28 14:30:21 +01:00
a7dca135dc Fix loss of cloth disk cache on reload in library overrides.
If the override system creates an override record for the cache
name (no idea why though), it trashes the disk cache on file load.

The reason is that it tries to rename cache files in update handler
when assigning the name, and BLI_rename deletes the target file even
if both names are the same.

This is a safe fix that simply aborts the pointless rename attempt.

Differential Revision: https://developer.blender.org/D13679
2021-12-28 14:56:09 +03:00
b29e33caa2 Fix T94408: missing sockets after adding node group 2021-12-28 11:21:07 +01:00
e28222966b Fix compile error when building without OpenSubDiv
Stubs were missing for functions added to opensubdiv_evaluator_capi.h
2021-12-28 09:36:30 +01:00
d25fa3250a Fix T94420: deadlock with subsurf modifiers
The deadlock was caused as the lock on the Mesh mutex used to compute
the subdivision wrapper was not released in some early exits of the
function.
2021-12-28 09:20:17 +01:00
f6699bfccf Revert "LineArt: Intersection function additional clamping"
This reverts commit 0a68fa8e14.
2021-12-28 11:55:37 +08:00
0a68fa8e14 LineArt: Intersection function additional clamping
To handle a rare case where it leads to a -1 index in isect order lookup
2021-12-28 11:21:25 +08:00
8c4edd1b37 Cleanup: clang format 2021-12-27 16:23:23 -05:00
d5b72fb06c Nodes: Declare shader nodes in individual file namespace
To be used in the future to support unity builds
2021-12-27 16:21:31 -05:00
336f6f4bbd GPencil: Fix error in previous Cleanup 2021-12-27 19:51:32 +01:00
d6dd2f51bb Cleanup: Use vector function 2021-12-27 13:16:47 -05:00
5814de65f9 Cleanup: Store cursor location in tGPspoint as an array
Fixes many instances of `-Wstringop-overread` warning on GCC 11

Differential Revision: https://developer.blender.org/D13672
2021-12-27 12:31:31 -05:00
11ac276caa Cleanup: clang tidy
Use c++ headers; use nullptr; redundant `void` in parameter list;
inconsistent parameter name.
2021-12-27 18:18:37 +01:00
1c9d8fcb47 Render: move editor/render module to c++
Doing this in preparation for some work on asset preview generation.

Differential Revision: https://developer.blender.org/D13676
2021-12-27 17:26:09 +01:00
644e6c7a3e Fix T93941: geometry proximity breaks with high resolution mesh
The calls to `.fill` were overwriting indices that are processed by
other threads.
2021-12-27 17:21:09 +01:00
eed45d2a23 OpenSubDiv: add support for an OpenGL evaluator
This evaluator is used in order to evaluate subdivision at render time, allowing for
faster renders of meshes with a subdivision surface modifier placed at the last
position in the modifier list.

When evaluating the subsurf modifier, we detect whether we can delegate evaluation
to the draw code. If so, the subdivision is first evaluated on the GPU using our own
custom evaluator (only the coarse data needs to be initially sent to the GPU), then,
buffers for the final `MeshBufferCache` are filled on the GPU using a set of
compute shaders. However, some buffers are still filled on the CPU side, if doing so
on the GPU is impractical (e.g. the line adjacency buffer used for x-ray, whose
logic is hardly GPU compatible).

This is done at the mesh buffer extraction level so that the result can be readily used
in the various OpenGL engines, without having to write custom geometry or tesselation
shaders.

We use our own subdivision evaluation shaders, instead of OpenSubDiv's vanilla one, in
order to control the data layout, and interpolation. For example, we store vertex colors
as compressed 16-bit integers, while OpenSubDiv's default evaluator only work for float
types.

In order to still access the modified geometry on the CPU side, for use in modifiers
or transform operators, a dedicated wrapper type is added `MESH_WRAPPER_TYPE_SUBD`.
Subdivision will be lazily evaluated via `BKE_object_get_evaluated_mesh` which will
create such a wrapper if possible. If the final subdivision surface is not needed on
the CPU side, `BKE_object_get_evaluated_mesh_no_subsurf` should be used.

Enabling or disabling GPU subdivision can be done through the user preferences (under
Viewport -> Subdivision).

See patch description for benchmarks.

Reviewed By: campbellbarton, jbakker, fclem, brecht, #eevee_viewport

Differential Revision: https://developer.blender.org/D12406
2021-12-27 16:35:54 +01:00
31e120ef49 Nodes: Support linking to existing group input from link drag search.
Before one could only create a new group input using the link drag search.
With this patch it becomes possible to create a Group Input node for an
existing input.

Differential Revision: https://developer.blender.org/D13674
2021-12-27 16:15:11 +01:00
51a131ddbc BLI: add utility to check if type is any specific type
This adds `blender::is_same_any_v` which is the almost the same as
`std::is_same_v`. The difference is that it allows for checking multiple
types at the same time.

Differential Revision: https://developer.blender.org/D13673
2021-12-27 16:08:11 +01:00
594438ef0d Allocator: add missing include
The placement-new operator requires `#include <new>`.
It is used in `MEM_new`.
2021-12-27 15:41:56 +01:00
7cf5f4cc63 LineArt: Protecting bounding area links.
In case they overflowed the bounding area maximum link count,
Protect the link array so it doesn't crash.
2021-12-27 14:33:58 +08:00
52585b39a1 LineArt: Remove duplicated edge-boundbox linking.
The edge is linked twice from differen calls during line art calculation
Probably caused by a merge and both calls stayed for some reason.
This would lead to edge link overflowing its limit of 2^16 items.
2021-12-27 14:22:09 +08:00
20b438d523 Cleanup: Use array for BKE cursor functions
Missed this function in rB67525b88d2e
2021-12-26 15:08:41 -05:00
5cf993f951 Cleanup: Fix compile warning
Own mistake in rB67525b88d2e
2021-12-26 15:08:41 -05:00
28a8d434d5 Fix T94387: Mesh sequence cache, crash when clicking a panel
The crash happens when opening a panel (added in rB43f5e761a66e87fed664a199cda867639f8daf3e)
when no CacheFile is set in the modifier.

To fix this, check that the CacheFile pointer is not null before attempting to draw anything.
2021-12-26 13:45:49 +01:00
dd3a72f275 Docs: Add to and cleanup attribute API docs
Most of the comment block is similar to the text in the source
code documentation wiki. It's helpful to have some text in
a header file too, so it's closer for programmers already looking
at the code.

This also uses more consistent syntax and wording in the comments
about the attribute API in `GeometryComponent`.

Ref T93753

Differential Revision: https://developer.blender.org/D13661
2021-12-25 15:08:38 -06:00
ceed8f7c06 Cleanup: Use more common variable name
It's preferred to use `area` as a name for `ScrArea` variables.
2021-12-25 14:57:07 -06:00
85abac7e87 Cleanup: Move customdata.c to C++
Differential Revision: https://developer.blender.org/D13666
2021-12-25 14:28:22 -06:00
Christoph Lendenfeld
f7ddb1ed8a Breakdown Implementation
This patch adds the breakdown (or tween) functionality to the graph editor.

The factor defines the linear interpolation from left key to right key.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9375
Ref: D9375
2021-12-25 20:58:47 +01:00
Aaron Carlisle
fbd01624e3 Shader Nodes: Convert bump node to use new socket builder
This node is a bit special in that it uses two internal sockets
for a hack for Eevee; see rBffd5e1e6acd296a187e7af016f9d7f8a9f209f87

As a result, the `SOCK_UNAVAIL` flag is exposed to socket builder API.

Reviewed By: JacquesLucke, fclem

Differential Revision: https://developer.blender.org/D13496
2021-12-25 11:13:15 -05:00
Aaron Carlisle
c5862da5ad Cleanup: use new c++ guarded allocator API in nodes
Also simplify the allocation name to `__func__`

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13665
2021-12-25 11:12:08 -05:00
Christoph Lendenfeld
9085b4a731 Blend To Neighbor Implementation
This patch adds the blend to neighbor operator to the Graph editor.

The operator acts like the blend to neighbor operator for a pose context, just working on keyframes.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9374
Ref: D9374
2021-12-25 13:40:53 +01:00
e505957b47 Fix T94375: Python error when trying to add Grease Pencil brush preset
The prop name was wrong.
2021-12-25 12:53:35 +01:00
28df0107d4 Fix T94362: GPUMaterialTexture references freed ImageUser
The issue was caused by rB7e712b2d6a0d257d272ed35622b41d06274af8df
and the fact that `GPUMaterialTexture` contains an `ImageUser *` which
references the `ImageUser` on e.g. `NodeTexImage`.

Since the node tree update refactor, it is possible that the node tree changes
without changing the actual material. Therefore, either the renderer should
check if the node tree has changed or it should not store pointers to data in
node storage. The latter approach is implemented in this patch.

Differential Revision: https://developer.blender.org/D13663
2021-12-25 11:14:02 +01:00
f1e04116f0 Cleanup: Do not use magic number 2021-12-25 00:02:45 -05:00
67525b88d2 Cleanup: Use array for BKE cursor functions
Differential Revision: https://developer.blender.org/D12962
2021-12-24 23:59:33 -05:00
95c7e8aa13 Update RNA to user manual mapping file 2021-12-24 22:54:59 -05:00
fc45b00720 Cleanup: Define node tree icon in register function
I suppose this was done to reduce then dependencies.
However, most nodes already depend on UI code so this isnt too useful.
2021-12-24 22:47:58 -05:00
6e0cf86e73 Cleanup: use new c++ guarded allocator API
API added in rBa3ad5abf2fe85d623f9e78fefc34e27bdc14632e
2021-12-24 22:18:04 -05:00
79012c6784 Cleanup: Use consistent order for custom data mesh masks
Loops come last in the struct's definition, use the same order when
initializing the common masks in customdata.c (they were switched
with the poly masks).
2021-12-24 18:26:11 -06:00
26c7be71d7 Nodes: Migrate bump shader node to cpp
Needed for D13496
2021-12-24 15:42:58 -05:00
291d2a2222 Cleanup: Remove misleading comments
Most of these custom data layers weren't BMesh only, and the
one that actually looks to be BMesh only has `BM` in its name.
2021-12-24 11:00:01 -06:00
d48fc7d156 Cleanup: Use vector instead of linked list 2021-12-24 10:05:47 -06:00
dd01ce2cd0 Fix T94322: add missing updates after recent refactor
This was a regression in rB7e712b2d6a0d257d272ed35622b41d06274af8df.
2021-12-24 13:39:50 +01:00
ba4b7b4319 Fix T94162: incorrect handling when there are multiple group outputs
Typically a node group should only have a single Group Output node.
However, currently Blender already supports having multiple group outputs,
one of which is active. This wasn't handled correctly by geometry nodes.

Differential Revision: https://developer.blender.org/D13611
2021-12-24 12:34:04 +01:00
c0db8a9a3b Cleanup: remove unused button function
rB05f900e3466b45a19e13bea6dd641e4f7b8b46e9 removed unused button functions,
but since that commit the `uiDefIconTextButBit()` static function sits
unused as well. It's now been removed.
2021-12-24 10:39:36 +01:00
81b3933abb Fix T94357: Node Ungroup operator copies current node tree
This was a mistake in rBfdc4a1a590d8befb1ff which copied the parent
node tree into itself rather than accessing the node group's nodes.
2021-12-23 22:48:55 -06:00
35bd6fe993 Fix T94344: Incorrect size for edge vertices node output
This looks like a copy and paste error from the original commit.
The virtual array output used the number of mesh polygons instead
of the number of edges.
2021-12-23 16:22:07 -06:00
2df912466c Cleanup: Remove outdated comment
After rB01df48a983944ab3f8a, this comment no longer applies.
2021-12-23 13:28:44 -06:00
582f6032fc Cleanup: Move hair object type files to C++
Differential Revision: https://developer.blender.org/D13657
2021-12-23 11:46:45 -06:00
05f900e346 Cleanup: Remove unused UI button definition functions
These were part of the older buttons API that shouldn't be used in
more places at this point. Most layouts should be built with the regular
layout system API and RNA properties. This sort of button can still be
created though, since these were just shortcuts anyway.
2021-12-23 11:30:11 -06:00
43f5e761a6 Cache File: use panels to organize UI
This adds interface panels to organize the Cache File UI parameters for
modifiers and constraints into related components: velocity, time, and
render procedural.

Properties relating to the three aforementioned components are separated
from `uiTemplateCacheFile` into their own functions (e.g.
`uiTemplateCacheFileVelocity` for the velocity one), which are in turn
called from the specific panel creation routines of the modifiers and
constraints (for constraints, the functions are exposed to the RNA).

`uiTemplateCacheFile` now only shows the properties for the file path,
and in the case of constraints, the scale property.

The properties that are only defined per modifier (like the velocity
scale), are shown in the proper modifier layout panel if applicable.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13652
2021-12-23 18:05:26 +01:00
Christoph Lendenfeld
7a71a95f32 Graph Slider Ops: Show error when no valid keys are found
When using graph slider operators like D9374
it showed a warning when no keys were selected.
However since that stops the modal operation it should be an Error.
Also the message was misleading
since it could error for different reasons than stated.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13655
Ref: D13655
2021-12-23 14:31:28 +01:00
d71009d980 Avoid exception when no weight paint settings exist
Just an extra check for `None` before accessing its properties.
2021-12-23 14:10:24 +01:00
025c921416 Cleanup: remove BKE_animdata_driver_path_hack
The `BKE_animdata_driver_path_hack()` function has had almost no effect
since rB51b796ff1528, and basically boils down to:

```
return base_path ? base_path : RNA_path_from_ID_to_property(ptr, prop);
```

Since `base_path` was `NULL` in the majority of cases, it's just been
replaced by a direct call to `RNA_path_from_ID_to_property()`. The
conditional now just appears in one remaining case.

This relates to T91387.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13646
2021-12-23 13:49:58 +01:00
00965c98cb LibOverride: protect better against using on complex inter-dependency cases.
Do not allow 3DView operator to run on the liboverride of an
instantiating Empty object. And tweak behavior in the Outliner
operations too.

Related to T94226.

Note that this remains fairly exotic, bad idea not recommended cases,
such complex inter-dependencies between different libraries inside a
same liboverride hierarchy is just not possible to handle properly.
2021-12-23 10:13:07 +01:00
710e279b19 Fix missing type declaration compile error
rBbd3bd776c893 broke compilation here due to missing type declaration
for basic types as the source file is not including this header. In any
case, it is the responsibility of header files to include headers for
types used by value in function parameters or struct definitions.
2021-12-23 08:01:43 +01:00
41f3164e57 Cleanup: typo in comment 2021-12-23 07:53:47 +01:00
1931387799 Fix: Curve trim node test failure
Caused by 60c59d7d61. The position wasn't copied into the correct
place on each spline. Somehow I didn't catch that in the tests I ran.
2021-12-22 18:38:30 -06:00
8f89196be2 Fix T94232: No selection with set material node empty material list
If the input mesh had no materials already, the new material would
become the only material on the mesh, meaning the material was
added to all of the faces, instead of just the selected faces.

The mesh primitive nodes in geometry nodes already add an empty
slot by default, so this only affects outside geometry.

The fix is just adding an empty slot before the new slot, so the
non-selected material indices can still point to an empty slot.

Differential Revision: https://developer.blender.org/D13654
2021-12-22 18:15:21 -06:00
60c59d7d61 Cleanup: Remove spline add_point method, refactor mesh to curve node
It's better to calculate the size of a spline before creating it, and this
should simplify refactoring to a data structure that stores all point
attribute contiguously (see T94193). The mesh to curve conversion is
simplified slightly now, it creates the curve output after gathering all
of the result vertex indices. This should be more efficient too, since
it only grows an index vector for each spline, not a whole spline.
2021-12-22 17:39:35 -06:00
c593db5a2f Nodes: Add link drag search support for map range node
Previously only the float version of the node was connected to.
This adds connection operations for vector sockets, and exposes
the "Steps" socket properly when it's selected.
2021-12-22 17:22:10 -06:00
6b662ebdb9 Cleanup: Return early 2021-12-22 17:18:37 -06:00
9033d270d5 Fix: Extra space at the front of "Sample Curve" node name 2021-12-22 17:13:16 -06:00
dca5be9b94 Fix: Wrong node link drag search menu items for attribute statistic
Caused by capturing local variables by reference in a function that
outlives the scope it was created in. Also use a more generic function
for the first two inputs.
2021-12-22 16:45:41 -06:00
14621e7720 Fix: Potential use after scope in curve to mesh node
I don't think this has been visible, since I only ran into it after
changing other code that affected this. However, some attributes
can keep a reference to the source component to use when tagging
caches dirty (like the position attribute tagging the normals dirty).
Here, the component was created inside a function, then the attributes
were used afterwards.

Also add some comments warning about this in the header file.
2021-12-22 16:29:00 -06:00
Michael
c6e7fc9744 Fix: Large stack allocation in compositor
When COM_EXPORT_GRAPHVIZ is enabled, DebugInfo::graphviz
uses a char[1000000] as local variable. When this function
is called this is allocated on the stack, which has a size
of just 1MB on mac and may cause a stack overflow.

This patch allocates the memory on the heap and frees
the memory at the end of the function.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D13628
2021-12-22 13:49:52 -07:00
0fd72a98ac Cleanup: Avoid adding points to splines sequentially
This should be faster because it avoids reallocating the internal
vectors when the size is known beforehand, but it may also help
a potential refactor to a different data structure (see T94193).
2021-12-22 14:35:46 -06:00
b4f978e901 Fix: Missing update when toggling node mute
Toggling node mute doesn't cause node trees to reevaluate after
rB7e712b2d6a0d257. Toggling a link mute still works though. To fix this,
the operator tags the node and node with a new update tag function
(that uses an existing tag internally).

Differential Revision: https://developer.blender.org/D13653
2021-12-22 14:00:34 -06:00
586e2face6 Fix T93408: Snap performance regression at high poll rate
Caused by {rBfba9cd019f21f29bad1a6f3713370c5172dbc97f}.

The snap timer was accidentally modified and damaged.
2021-12-22 16:11:05 -03:00
e2a9e7e803 Nodes: Remove unnecessary node tree socket tagging
`SOCK_IN_USE` is now set in `update_socket_used_tags` in
`node_tree_update.cc` when a node tree is changed.
It doesn't need to run every single redraw. Removing this
results in a small speedup of 0.4 ms when drawing a tree
with about 4000 nodes (from about 70 ms total).

Differential Revision: https://developer.blender.org/D13645
2021-12-22 11:25:55 -06:00
6a71b2af66 Mesh: Parallelize bounding box calculation (WIP)
This replaces the single-threaded calculation of mesh min and max
positions with a `parallel_reduce` loop. Since the bounding box
of a mesh is retrieved quite often (at the end of each evaluation,
currently 2(?!) times when leaving edit mode, etc.), this makes for a
quite noticeable speedup actually.

On my Ryzen 3700x and a 4.2 million vertex mesh, I observed
a 4.4x performance increase, from 14 ms to 4.4 ms.

I added some methods to `float3` so they would be inlined, but
they're also a nice addition, since they're used often anyway.

Differential Revision: https://developer.blender.org/D13572
2021-12-22 11:04:03 -06:00
3579a9e0fc Cleanup: Remove debug print. 2021-12-22 17:53:00 +01:00
921708fc76 Fix (unreported) potential bug in collections parenting update code.
Own mistake in rB2ef192a55b2c. Did not seem to have any visible effect
though...
2021-12-22 17:50:10 +01:00
f577abc5cd Cleanup: Use LISTBASE_FOREACH_ macros. 2021-12-22 17:39:53 +01:00
8d3e57f338 Fix T93799: Outliner: Remaping objects could result in duplicates in a collection.
Fix is similar to how CollectionObject with NULL object pointers are handled.

Using one of the 'free' pad bytes in Object_Runtime struct instead of a
gset (or other external way to detect object duplicates), as this is
several times faster.

NOTE: This makes remapping slightly slower again (adds 10 extra seconds
to file case in T94059).

General improvements of remapping time complexity, especially when
remapping a lot of IDs at once, is a separate topic currently
investigated in D13615.
2021-12-22 17:34:13 +01:00
902318f0fd Fix part of T93799: Outliner: Remap Users crash (for ID Type Object).
This commit fixes the crash itself, however this can still lead to a
same collection 'owning' the same object several time.

Issue here was a bad assumption in layer resync code, that would lead to
removing valid objects from the viewlayer's `object_bases_hash` in
`BKE_layer_collection_sync`, when deleting no-more-used bases, in case
of bases duplicate.
2021-12-22 17:03:20 +01:00
978a930d9c Fix: Build issue on 32 bit archs
The cast to size_t leads to a build issue on 32
bit archs. cursor_delim_type_utf8 expects an int
so an additional cast to size_t is not required.

Reported by user frispete on devtalk.
2021-12-22 08:39:33 -07:00
aba91a745a Fix T93999: GPencil Box tool allows decreasing subdiv, but not increase
The problem was the number of points for each edge of the box was wrong and the wheelmouse effect was anulated.

Also fixed the value displayed in the status bar to keep consistency with subdivision value.

Reviewed By: lichtwerk

Maniphest Tasks: T93999

Differential Revision: https://developer.blender.org/D1363
2021-12-22 16:07:48 +01:00
dbbf0e7f66 Nodes: Improve node tree copy performance
When copying a full node tree, we can avoid an O(n^2) loop finding a
unique name for every node if we assume they already have unique names.
That is a reasonable assumption, since unique names are verified
elsewhere when adding a new node.

Copying a node tree with about 4000 nodes took 42 ms before,
now it takes 6 ms.

Differential Revision: https://developer.blender.org/D13644
2021-12-22 08:52:46 -06:00
fdc4a1a590 Nodes: Refactor to remove node and socket "new" pointers
These pointers point to the new nodes when duplicating,
and their even used to point to "original" nodes for
"localized" trees. They're just a bad design decision
that make code confusing and buggy.

Instead, node copy functions now optionally add to a map
of old to new socket pointers. The case where the compositor
abused these pointers as "original" pointers are handled
by looking up the string node names.

Differential Revision: https://developer.blender.org/D13518
2021-12-22 08:47:46 -06:00
d6224db8f1 Geometry Nodes: improve multi socket handling in evaluator
Previously, the values passed to a multi-input socket were stored
in the order that they arrived in. Then, when the values are accessed,
they are sorted depending on the link order.

Now, the ordering is determined in the beginning before execution starts.
Every value is assigned to the right index directly, avoiding the sort
in the end. This makes the ordering more explicit.
2021-12-22 13:16:01 +01:00
2ce2bffc4d Fix T94295: VSE fades error when no suitable sequences selected
This errored out in two scenarios:
- current frame not in strips framerange (this was reported)
- no strips selected at all

Now handle these cases properly in the operator and give appropriate
report info.

Maniphest Tasks: T94295

Differential Revision: https://developer.blender.org/D13642
2021-12-22 09:28:31 +01:00
d2bf60cc17 Cleanup: Clang tidy, restore alphabetical sorting 2021-12-21 14:32:22 -06:00
Germano Cavalcante
6db0919724 Fix T94191: correct (time) translation headers not showing DeltaX
Caused by {rBb0d9e6797fb8}

For the header (both Graph Editor case in general `headerTranslation` as
well as `headerTimeTranslate`) we are interested in deltas values
(not absolute values).

Since culprit commit, `snapFrameTransform` was not working with deltas
anymore, but we have to compensate for this.

For the Graph Editor, this only worked "by accident" in rB7192e57d63a5,
since `ival` is still zero at this point.

So now, reacquire the delta right after the snap operation.

Also use a more appropriate center value in the translate operator.

Maniphest Tasks: T94191

Differential Revision: https://developer.blender.org/D13641
2021-12-21 13:00:51 -03:00
aa7105f759 Cleanup: use BKE_pose_is_layer_visible in more places
This was added in rBd13970de8627, now use in more places.
2021-12-21 16:45:46 +01:00
bdbd0cffda Nodes: Improve performance when freeing a node tree
This commit makes freeing a node tree about 25 to 30 times faster.
Freeing a node tree happens whenever it is edited. Freeing a node
tree with about 4000 nodes went from 30-50ms to about 2 ms.

This was so slow before because for every node that was freed
when freeing the node tree, `node_free_node` looped over all
other nodes to detach frames, and then looped over all links to
remove any links connected to the node. That was all pointless
work because everything else is about to be freed anyway.

Instead, move that "detaching" behavior to the dedicated function
for removing a single node, and to the "local" version of the free
function to be safe, since I know less about what that version expects.

Differential Revision: https://developer.blender.org/D13636
2021-12-21 09:23:48 -06:00
8cf1994455 Fix T93960: Asset Catalogs I/O fails with unicode file paths on Windows
On Windows, encode file paths as UTF-16 before trying to open the file
for reading/writing.

This introduces a new class `blender::fstream`, which wraps
`std::fstream` and provides this UTF-16 encoding. This class should also
be used in other areas, like the Alembic importer/exporter.

Manifest Task: T93960

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13633
2021-12-21 15:54:09 +01:00
d66a6525c3 Assets: log message when catalog definitions cannot be loaded
Log a message (via `CLOG`) when asset catalog definitions cannot be
loaded.

Reviewed by @jacqueslucke in D13633
2021-12-21 15:53:57 +01:00
7e712b2d6a Nodes: refactor node tree update handling
Goals of this refactor:
* More unified approach to updating everything that needs to be updated
  after a change in a node tree.
* The updates should happen in the correct order and quadratic or worse
  algorithms should be avoided.
* Improve detection of changes to the output to avoid tagging the depsgraph
  when it's not necessary.
* Move towards a more declarative style of defining nodes by having a
  more centralized update procedure.

The refactor consists of two main parts:
* Node tree tagging and update refactor.
  * Generally, when changes are done to a node tree, it is tagged dirty
    until a global update function is called that updates everything in
    the correct order.
  * The tagging is more fine-grained compared to before, to allow for more
    precise depsgraph update tagging.
* Depsgraph changes.
  * The shading specific depsgraph node for node trees as been removed.
  * Instead, there is a new `NTREE_OUTPUT` depsgrap node, which is only
    tagged when the output of the node tree changed (e.g. the Group Output
    or Material Output node).
  * The copy-on-write relation from node trees to the data block they are
    embedded in is now non-flushing. This avoids e.g. triggering a material
    update after the shader node tree changed in unrelated ways. Instead
    the material has a flushing relation to the new `NTREE_OUTPUT` node now.
  * The depsgraph no longer reports data block changes through to cycles
    through `Depsgraph.updates` when only the node tree changed in ways
    that do not affect the output.

Avoiding unnecessary updates seems to work well for geometry nodes and cycles.
The situation is a bit worse when there are drivers on the node tree, but that
could potentially be improved separately in the future.

Avoiding updates in eevee and the compositor is more tricky, but also less urgent.
* Eevee updates are triggered by calling `DRW_notify_view_update` in
  `ED_render_view3d_update` indirectly from `DEG_editors_update`.
* Compositor updates are triggered by `ED_node_composite_job` in `node_area_refresh`.
  This is triggered by calling `ED_area_tag_refresh` in `node_area_listener`.

Removing updates always has the risk of breaking some dependency that no
one was aware of. It's not unlikely that this will happen here as well. Adding
back missing updates should be quite a bit easier than getting rid of
unnecessary updates though.

Differential Revision: https://developer.blender.org/D13246
2021-12-21 15:18:56 +01:00
1abf2f3c7c Cleanup: clang format
Missed in rB7c9e4099854a, sorry.
2021-12-21 14:28:04 +01:00
d13970de86 Fix T92930: Outliner "Show Active" bone fails in certain situations
Outliner would frame the armature object instead of the bone if the bone
was on a hidden armature layer.

Similar to issues reported in e.g. T58068 and T80464, this is due to the
fact that `BKE_pose_channel_active` always checks for the armature layer
(and returns NULL if a bone is not on a visible armature layer).

Now propose to make this layer check **optional** (and e.g. from the
Outliner be more permissive). This also introduces
`BKE_pose_channel_active_if_layer_visible` which just wraps
`BKE_pose_channel_active` with the check being ON.

Maniphest Tasks: T92930

Differential Revision: https://developer.blender.org/D13154
2021-12-21 14:07:48 +01:00
fac42e3fa1 Tests: initialise BKE callbacks before loading blend file
Initialise the BKE callback system in
`BlendfileLoadingBaseTest::SetUpTestCase()`. This allows certain tests
to run in debug mode (when `BLI_assert` is enabled).
2021-12-21 11:12:47 +01:00
68f1b2c671 Fix T93757: Do not force-instantiate indrectly linked objects in linking case. 2021-12-21 10:09:01 +01:00
bb4de77b82 Fix T93839: Copy/Paste of empty instantiating a collection.
Do not also instantiate a collection in the view layer, if it is already
instantiated through an empty object.
2021-12-21 09:52:53 +01:00
c0f06ba614 Fix build error in debug builds from recent commit
r7acd3ad7d8e58b913c5 converted a pointer to a reference,
but an assert still compares the variable to a pointer.
2021-12-20 22:48:31 -06:00
e4de5b4657 Fix T94280: Crash when splitting meta strip
This happens because in `SEQ_time_update_sequence` function
`SEQ_get_meta_by_seqbase` returns uninitialized value. This isn't nice,
but it shouldn't happen in first place. Problem is, that
`SEQ_edit_strip_split` does move strips into detached `ListBase`, so
other functions can't see them anymore. Detached `ListBase` is used
solely to preserve relationships during duplication.

Move strips to original `ListBase` immediately after duplication and
return `NULL` if `SEQ_get_meta_by_seqbase` can't find meta strip.

Splitting itself can still rely on fact, that number of original and
duplicated strips is same and they are placed next to each other in
exactly same order at the end of original `ListBase`.
2021-12-21 05:27:46 +01:00
5457b66301 Cleanup: Use span instead of raw pointer
This is a followup to the previous commit.
2021-12-20 18:10:29 -06:00
7acd3ad7d8 Cleanup: Use simpler loops in weld modifier
In this commit I changed many loops to range-based for loops.
I also removed some of the redundant iterator variables, using
indexing inside the loop instead. Generally an optimizing compiler
should have no problem doing the smartest thing in that situation,
and this way makes it much easier to tell where data is coming from.

I only changed the loops I was confident about, so there is still more
that could be done in the future.

Differential Revision: https://developer.blender.org/D13637
2021-12-20 18:03:06 -06:00
59221476b0 Fix T94262: Grease Pencil Blur Effect DoF mode wrong
This was visible outside of camera view and was not respecting the
"Depth of Field" checkbox on the Camera properties.

Now return early if DoF should not be visible.

Maniphest Tasks: T94262

Differential Revision: https://developer.blender.org/D13631
2021-12-20 21:52:42 +01:00
399f84d479 Run clang-format 2021-12-20 14:30:29 -05:00
d93dd85951 Sculpt: split sculpt.c into three files
Sculpt.c is now three files:

* Sculpt.c: main API methods and the brush stroke operator
* Sculpt_brushes.c: Code for individual brushes.
* Sculpt_ops.c: Sculpt operators other than the brush stroke operator.

TODO: split brush stroke operator into a new file (sculpt_stroke.c?).
2021-12-20 14:20:51 -05:00
Wannes Malfait
e9092110ff Fix T94144: Duplicate edges in dual mesh node
The duplicated edges were caused by 'oversubdivided' edges, i.e. edges
where some of the vertices on them are only connected to two polygons.
The fix finds these vertices and 'dissolves' them so that only one edge
is created.

For most 'normal' meshes this shouldn't occurr, or only very little, so
the performance impact of this change should be neglegible. In practice
this is also avoidable by triangulating the mesh first.

Differential Revision: https://developer.blender.org/D13445
2021-12-20 13:08:05 -06:00
bdb5852e28 Cleanup: Remove mesh valid assertions in debug builds
These are useful for development, but when the primitive nodes
aren't actively changing, the performance cost is not worth it.
2021-12-20 12:46:40 -06:00
Piotr Makal
70de992afe Fix: Incorrect assert conditions in NURBSpline
This fix provides better conditions for asserts in `NURBSpline::knots`
method accounting for cyclic NURBS curves.

Differential Revision: https://developer.blender.org/D13620
2021-12-20 12:43:14 -06:00
76cb11e332 Cleanup: Remove unused node type flag
This flag was checked, but not set anywhere.
2021-12-20 11:03:24 -06:00
82fa2bdf3f Cleanup: Comment formatting in node.cc
Also remove a SCOPED_TIMER I added by mistake in a previous commit.
2021-12-20 10:48:01 -06:00
cb96435047 Geometry Nodes: Parallelize mesh grid primitive
On a Ryzen 3700x, this ended up 2.5x faster than before. More
benchmarking details are included in the differential revision.

For smaller grids, all this should do is increase the
code size a bit, and add a few more if statements.

Differential Revision: https://developer.blender.org/D13617
2021-12-20 10:34:31 -06:00
1d25ba175e Cleanup: Remove unused arguments 2021-12-20 09:57:18 -06:00
6c33a0f6d6 Update our USD 21.02 patch to support gcc-11
There are two issues in USD code that break building it with gcc-11,
one (in `demangle.cpp`) was already fixed upstream, the other (in
`singularTask.h`) is still pending (reported upstream, see
https://github.com/PixarAnimationStudios/USD/issues/1721).

CC #platforms_builds_tests_devices project.
2021-12-20 16:17:42 +01:00
edb3ab0617 Fix T94251: Cycles wrong pointcloud normal for instanced objects
Refactor code a bit also so we need to do fewer matrix transforms for shader
data setup of points and curves.
2021-12-20 14:14:43 +01:00
e2e7f7ea52 Fix Cycles OptiX crash with 3D curves after point cloud changes
Includes refactoring to reduce the number of bits taken by primitive types,
so they more easily fit in the OptiX limit.
2021-12-20 14:14:43 +01:00
Maxime Chambonnet
5adc06d2d8 install_deps: Fix OIIO and OSL build with OpenEXR
Root path variables for those libraries is now using the 'standard' naming
scheme.

With tweaks/cleanups from @mont29.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D13591
2021-12-20 12:52:07 +01:00
deb3d566a5 BLI: fix Vector.prepend declaration
Using `&&` there was a typo. With `&&` the `prepend` method
could not be called with a const reference as argument.
2021-12-20 10:46:43 +01:00
ffd1a7d8c8 Fix T93570: VSE image transforms in preview dont autokey
This was basically not implemented, do this via
`ED_autokeyframe_property` in a new dedicated function in
special_aftertrans_update.

Maniphest Tasks: T93570

Differential Revision: https://developer.blender.org/D13608
2021-12-20 09:12:37 +01:00
fdb2167b4a Docs: use doxygen formatting for BLI
Differentiate doc-strings from title/section text.
2021-12-20 19:07:10 +11:00
5c63c0a58c Docs: use doxygen formatting for DNA
Differentiate doc-strings from title/section text.
Also use explicit doxygen references to struct members
so it's not ambiguous which member is being referenced.

Note that these changes aren't complete (some files weren't touched).
2021-12-20 19:07:10 +11:00
528fc35fed Docs: minor correction to doc-string
The text editor no longer accumulates changes.
2021-12-20 17:42:27 +11:00
0b69793487 Fix T94254: Crash using view_all operator in VSE
Caused by `NULL` dereference in `SEQ_meta_stack_active_get()`.

Check if `Editing` is `NULL` before accessing meta stack.
2021-12-20 02:18:59 +01:00
34fac7a670 Fix: Meta strip not created with alpha over blend mode
Meta add function wasn't updated. All strips now use alpha over
blending, so set it in `SEQ_sequence_alloc()`.
2021-12-20 01:52:40 +01:00
cc367908cd Cleanup: Remove more texture nodes preview handling
Similar to the previous commit, this allowed removing a function to set
a single pixel of a node preview.
2021-12-19 18:37:57 -06:00
0966eab8e9 VSE: Clamp sound strip when adding movie strip
When adding multiple movie strips and sound stream is longer than video,
this results in gaps between video strips, which is undesirable.
2021-12-20 01:35:25 +01:00
c27d0cb7b9 Cleanup: Remove more no-op node preview code
This is a follow-up to rB43875e8dd1d76ee, removing some
processing of non-existent node previews in the shader and
texture nodes systems.
2021-12-19 18:11:47 -06:00
eac6aff741 Cleanup: Const arguments, remove unused argument 2021-12-19 17:57:51 -06:00
6878897a6d Cleanup: Clang tidy lamda function name 2021-12-18 17:18:41 -06:00
8a91673562 Cleanup: Move weld modifier to C++
This moves `MOD_weld.cc` to C++, fixing compiler warnings
coming from the change. It also goes a little bit further and converts
the code to use C++ data structures: `Span`, `Array`, and `Vector`.
This makes the code more shorter and easier to reason about, and
makes memory maneagement more automatic.

Differential Revision: https://developer.blender.org/D13618
2021-12-18 13:42:48 -06:00
491b9cd2b9 Fix: Build error from missing include 2021-12-18 13:41:56 -06:00
b9861055ad Fix: Link drag search missing field nodes from function nodes
When dragging from the inputs of function nodes, other function
nodes wouldn't connect, because their socket declaration field types
weren't set correctly. Instead, they relied on code properly checking
the *node* declaration's `is_function_node()` method. However,
that increases complexity and requires passing the node instead of
just the socket in more places. Instead, set the proper field types
in the socket declaration during building.

Differential Revision: https://developer.blender.org/D13600
2021-12-18 13:31:06 -06:00
d15d512a68 Fix T94173: Missing update for frame node size
Before d56bbfea7b, nodes were updated (size calculated and
buttons added) in reverse order. Instead, now calculate the size of
frame nodes after all other nodes. Separating the drawing further
may be a good step to removing the O(n^2) loop later on.
2021-12-18 13:27:05 -06:00
4c3f57ffa7 Cleanup: compiler warnings with clang
Includes use of memcpy to avoid warnings about deprecated members.
2021-12-18 18:36:34 +01:00
3471b0016c Fix T94215: compositer denoise node UI wrongly shows as disabled
After recent refactoring in 4e98d974b5.
2021-12-18 05:53:38 +01:00
214a56ce8c GPU: add memory barriers for vertex and index buffers
This adds memory barriers to use with `GPU_memory_barrier` to ensure that
writes to a vertex or index buffer issued before the barrier are
completed after it, so they can be safely read later by another shader.

`GPU_BARRIER_VERTEX_ATTRIB_ARRAY` should be used for vertex buffers (`GPUVertBuf`),
and `GPU_BARRIER_ELEMENT_ARRAY` should be used for index buffers (`GPUIndexBuf`).

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13595
2021-12-18 00:55:54 +01:00
Christoph Lendenfeld
8e31e53aa0 Function to return a list of keyframe segments
Add a function that returns a list of keyframe segments
A segment being a continuous selection of keyframes
Will be used by future operators in the graph editor

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13531
Ref: D13531
2021-12-17 22:43:02 +00:00
76fd2ff9fa Fix T94184: Outliner: Collection dragging tooltip is not updating
In the context of the dragdrop tooltip, the event referenced to the window
is out of date and contains invalid `mval` values.

Avoid using `win->eventstate` as much as possible.
2021-12-17 19:13:14 -03:00
4b21067aea Fix T94116: Drivers can have multiple variables with same name
The RNA setter now ensures that driver variables are uniquely named
(within the scope of the driver).

Versioning code has been added to ensure this uniqueness. The last
variable with the non-unique name retains the original name; this
ensures that the driver will still evaluate to the same value as before
this fix.

This also introduces a new blenlib function `BLI_listbase_from_link()`,
which can be used to find the entire list from any item within the list.

Manifest Task: T94116

Reviewed By: mont29, JacquesLucke

Maniphest Tasks: T94116

Differential Revision: https://developer.blender.org/D13594
2021-12-17 17:31:15 +01:00
2648d920d8 Theme: Node Group color only needs RGB, not RGBA
The node group alpha theme was used for the overlay drawing in the node
editor. Since this was removed (919e513fa8) the alpha channel doesn't
need to be exposed anymore.

Reported as part of T93654.
2021-12-17 16:47:06 +01:00
Hans Goudey
0aabaa4583 Cleanup: Use signed integers in the weld modifier
The style guide mentions that unsigned integers shouldn't be used to
show that a value won't be negative. Many places don't follow this
properly yet. The modifier used to cast an array of `uint` to `int` in
order to pass it to `BLI_kdtree_3d_calc_duplicates_fast`. That is no
longer necessary.

Differential Revision: https://developer.blender.org/D13613
2021-12-17 12:40:01 -03:00
552dce0de7 Cleanup: quiet warning due to incompatible pointer types 2021-12-17 15:46:00 +01:00
77760194fe Cleanup: use new c++ guarded allocator api in some files 2021-12-17 15:42:28 +01:00
a3ad5abf2f Allocator: simplify using guarded allocator in C++ code
Using the `MEM_*` API from C++ code was a bit annoying:
* When converting C to C++ code, one often has to add a type cast on
  returned `void *`. That leads to having the same type name three times
  in the same line. This patch reduces the amount to two and removes the
  `sizeof(...)` from the line.
* The existing alternative of using `OBJECT_GUARDED_NEW` looks a out
  of place compared to other allocation methods. Sometimes
  `MEM_CXX_CLASS_ALLOC_FUNCS` can be used when structs are defined
  in C++ code. It doesn't look great but it's definitely better. The downside
  is that it makes the name of the allocation less useful. That's because
  the same name is used for all allocations of a type, independend of
  where it is allocated.

This patch introduces three new functions: `MEM_new`, `MEM_cnew` and
`MEM_delete`. These cover the majority of use cases (array allocation is
not covered).

The `OBJECT_GUARDED_*` macros are removed because they are not
needed anymore.

Differential Revision: https://developer.blender.org/D13502
2021-12-17 15:42:28 +01:00
Phil Stopford
c0d96ca9a5 UI: make Remap User dialog in outliner wider
The previous size was too small for common object names.

Differential Revision: https://developer.blender.org/D13604
2021-12-17 15:21:12 +01:00
Alessio Monti di Sopra
3b965ba10b UI: Fix node socket alignment in some cases
The patch fixes some misalignments in the nodes' sockets/options
recently introduced in 26d2caee3b, while maintaining the original
fix for T92268.

The original fix made the top padding always of the same size; while
that works when the first row of the other node is `Socket | Socket`,
it doesn't for other more common cases, `like Socket | Node Option`,
where the text results misaligned.

Differential Revision: https://developer.blender.org/D13451
2021-12-17 08:04:28 -06:00
b386f960f6 Fix error in Cycles geometry update tagging after pointcloud addition
Thanks to Christophe Hery for spotting this.
2021-12-17 14:59:24 +01:00
Michael
67734d1853 Fix T94142, T94182: Cycles metal broken after pointcloud changes
Missing ccl_private form an older patch.

Differential Revision: https://developer.blender.org/D13612
2021-12-17 14:46:52 +01:00
f3c1d0e3a3 Fix T94137: GPencil: Eraser does not erase first point
The eraser checks the current, previous and next point (and sets pc0,
pc1 & pc2 corresponding to that for futher occlusion/brush/clipping
checks). For the very first point, it sets pc0 to pc1 [which makes sense,
there is no previous point, so we should assume the previous segment is
"visible" as soon as the first point is], but does so *before* pc1 is
even calculated. This makes following occlusion/brush/clipping checks
work with zero values [which leads to no earsing in most cases].

Now *first* calculate pc1, *then* set pc0 to pc1.

Maniphest Tasks: T94137

Differential Revision: https://developer.blender.org/D13593
2021-12-17 14:38:11 +01:00
7c9e409985 Outliner ID Remap Users: hide ID type from the UI
The correct type should be set by invoke already, changing it to a non-
matching type (e.g. trying to remap Mesh users with a Camera block) does
not really make sense afaict, reason being that we would be presented
with the "Invalid old/new ID pair" message in such case anyways (code
checks GS(old_id->name) == GS(new_id->name)).

This alone wouldnt be a pressing issue, but since doing this with an
object ID type crashes atm., it seems to make sense to clean this up now
(of course the crash should be looked into, but this is for a separate
patch -- if that is solved, we could also think about adding the "Remap
Users" entry back in the context menu for objects as well [which was
removed in rB17bd5c9d4b1e for some reason]).

Part of T93799.

Differential Revision: https://developer.blender.org/D13512
2021-12-17 13:58:25 +01:00
9690b7c91b Fix (unreported): missed running versioning code in some files
The versioning code was accidentally put not at the very bottom.
That lead to a situation where it wasn't run on some files that happened
to be within a specific short time frame.

Since the versioning code is idempotent, it can just run again on existing
files. Therefore, this commit just moves it back to the bottom so that it
is executed on all files again.

Broken Commit: rB5b61737a8f41688699fd1d711a25b7cea86d1530.
2021-12-17 13:49:53 +01:00
367b484841 Fix T94166: set handle position node crashed after refactor
This was an oversight in rB8e2c9f2dd3118bfdb69ccf0ab2b9f968a854aae4.
2021-12-17 10:40:01 +01:00
b9d6271916 GPU: Sort SSBOs In Shader Interface.
SSBOs weren't sorted, but other types were. This was an
oversight when SSBOs were introduced (GPU compute pipeline).

Issue identified by @fclem.
2021-12-17 08:16:06 +01:00
7788293954 Cleanup: Silenced unused var warnings. 2021-12-17 08:04:35 +01:00
0e1bb232e6 UI: move "undo history" from a custom popup to a menu type
This lets the undo history expand as a regular sub-menu
instead of being a popup.

Also disable the active undo step menu item as this is a no-op.
2021-12-17 17:28:57 +11:00
c536eb410c Cleanup: spelling in comments 2021-12-17 15:26:28 +11:00
6b3c3454d3 Cleanup: use more common naming suffix for item callbacks 2021-12-17 15:11:16 +11:00
Johannes Jakob
1f50c2876e UI: Correct "QuickTime" Spelling
Change the spelling of the QuickTime output video container item from
"Quicktime" to "QuickTime"

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

Reviewed by Harley Acheson
2021-12-16 17:59:06 -08:00
b7e151d876 Cleanup: Simplify logic in set material node 2021-12-16 15:44:50 -06:00
da2c564bb0 Geometry Nodes: Support point clouds in the set material node
Now that point clouds can be rendered with cycles, it makes sense
to allow assigning a material to them. Note that like volumes, they
only support a single material though.
2021-12-16 15:39:59 -06:00
35b1e9fc3a Cycles: pointcloud rendering
This add support for rendering of the point cloud object in Blender, as a native
geometry type in Cycles that is more memory and time efficient than instancing
sphere meshes. This can be useful for rendering sand, water splashes, particles,
motion graphics, etc.

Points are currently always rendered as spheres, with backface culling. More
shapes are likely to be added later, but this is the most important one and can
be customized with shaders.

For CPU rendering the Embree primitive is used, for GPU there is our own
intersection code. Motion blur is suppored. Volumes inside points are not
currently supported.

Implemented with help from:
* Kévin Dietrich: Alembic procedural integration
* Patrick Mourse: OptiX integration
* Josh Whelchel: update for cycles-x changes

Ref T92573

Differential Revision: https://developer.blender.org/D9887
2021-12-16 20:54:04 +01:00
2229179faa Revert "Cycles-X: Add hysteresis to resolution divider algorithm"
This reverts commit d8b4275162. It causes reduced
viewport render resolution. Revert for now until I have time to look into this
more closely.
2021-12-16 18:29:27 +01:00
bd12855110 Cleanup: Move curve.c to C++
I need this for a refactor I'm looking into for bounding boxes.
It may be helpful in the future when using `CurveEval` in more places.

Differential Revision: https://developer.blender.org/D13596
2021-12-16 11:22:48 -06:00
197b3502b0 LibOverride: Further improve creation/resync pre-process speed.
Fully get rid of `BKE_collection_object_find` in
`lib_override_group_tag_data_object_to_collection_init`, even if only
used a few times this function was still noticeable in profiling data.

Now instead loop over collections' objects to build required
object-to-collections mapping.

Adds an extra 5-10% speed-up compared to previous commit rB0624fad0f3ff.

Related to T94059.
2021-12-16 18:15:19 +01:00
9765ddf4eb Fix T94109: 3d cursor crash when using shortcut
Operator was erroneously starting edge_slide operation.

Revert part of the changes in rB3fab16fe8eb4 as obedit_type was being
confused with object_mode.
2021-12-16 13:45:35 -03:00
0624fad0f3 LibOverride: Improve speed of resync and creation of liboverrides.
`BKE_collection_object_find` has extremely bad performances (very high
time complexity). While ideally this should be fixed in that API, for
now cache its results once at the beginning of the resync/creation
process.

This makes loading of complex production files with a lot of
liboverrides to resync three to four times faster.

Thanks to @brecht for the profiling in T94059.
2021-12-16 17:27:38 +01:00
b1f865f9d3 LibOverride: Cleanup log about unfound subitems.
Not finding subitem when its name and index are invalid/unset is
expected behavior, and does happen when e.g. inserting a new constraint
or modifier at the begining of the stack.
2021-12-16 16:48:00 +01:00
0f589f8d3c Fix T94115: Selecting current action in undo history undoes all
When selecting the current undo step there is no need to do anything.

Fix and minor refactor to de-duplicate refreshing after running
undo/redo & undo history.
2021-12-16 23:40:11 +11:00
d6902668e3 UI: support Copy To Selected for id-properties [GN modifier properties]
Both {key Alt} editing behavior as well as `Copy To Selected` were not
working on geometry nodes modifiers (even if these matched exactly -
having the same nodegroup - on multiple objects)

Reason is that code checks pointer equality on the discovered properties
[geometry nodes modifier properties are stored as ID properties], but
these are not the same across objects (since these are fetched from
NodesModifierSettings - which are different on different objects).

note: if general custom properties are "API defined" on existing classes,
this was working, we are getting the exact property for different IDs in
this case

Now be more permissive with ID properties not defined on classes in
general and dont check pointer equality for them. For ID properties on
specific IDs (not the ones defined on classes) this //might// be undesired
(havent spotted issues though, even if equally named ID properies with
different types existed -- this then simply does nothing).

For geometry nodes modifiers, new code also checks if the nodegroups are
the same [since generic naming "Input_XXX" is shared for all modifiers --
and starting to copy over things to unrelated modifiers is not desired
here].

Fixes T93983.

Maniphest Tasks: T93983

Differential Revision: https://developer.blender.org/D13573
2021-12-16 13:18:19 +01:00
6da23db5e0 UI: deduplicate code for Copy To Selected and Alt-button tweaking
This resolves an old TODO to deduplicate code in copy_to_selected_button
& ui_selectcontext_begin.
This is also in hindsight of adding id-property support [incl. Geometry
Nodes modifier properties] for this in the next commit.
No behavior change expected here.

ref T93983 & D13573
2021-12-16 13:18:19 +01:00
3e04d37529 Cleanup: correct docstring for driver_variable_name_validate
No functional changes.
2021-12-16 12:54:25 +01:00
59774d64f0 Docs: add doc-strings for BLI_path functions 2021-12-16 21:58:04 +11:00
21c7689b77 Animation: send notifier when keyframe is inserted
`<some_id>.keyframe_insert()` now sends a notifier that animation data
was changed, so that animation-related editors can properly refresh.

Since this function is quite high-level (if necessary it creates the
Action and FCurves), I thought this would be a suitable location for the
notifier. If high keyframing speed is required, it is still recommended
to use `FCurveKeyframePoints.insert(options={'FAST'})` instead.
2021-12-16 11:26:21 +01:00
1818110459 Fix compile error on Windows. 2021-12-16 10:08:31 +01:00
8dbd406ea0 WM: various changes to file writing behavior
Saving with only a filename (from Python) wasn't being prevented,
while it would successfully write the file to the working-directory,
path remapping and setting relative paths wouldn't work afterwards
as `Main.filepath` would have no directory component.

Disallow this since it's a corner case which only ever occurs
when path names without any directories are used from Python,
the overhead of expanding the working-directory for all data saving
operations isn't worthwhile.

The following changes have been made:

- bpy.ops.wm.save_mainfile() without a filepath argument
  fails & reports and error when the file hasn't been saved.

  Previously it would write to "untitled.blend" and set the
  `G.main->filepath` to this as well.

- bpy.ops.wm.save_mainfile(filepath="untitled.blend")
  fails & reports and error as the filename has no directory component.

- `BLI_path_is_abs_from_cwd` was added to check if the path would
  attempt to expand to the CWD.
2021-12-16 16:27:35 +11:00
15c3617009 Cleanup: simplify file saving logic
Revert part of the fix from 073669dd85
that initialized the file-path on first save as it's no longer needed.

Also remove relbase argument to BLI_path_normalize as the destination
file paths shouldn't use relative locations.
2021-12-16 16:27:35 +11:00
Aaron Carlisle
4e98d974b5 Nodes: Begin splitting composite node buttons into individual files
Currently, most node buttons are defined in `drawnode.cc` however,
this is inconvenient because it requires editing many files when adding new nodes.
The goal is to minimize the number of files needed to add or update a node.

This commit moves most of the node layout functions for composite nodes into their respected
`source/blender/nodes/composite/nodes` file.

In the future, these functions will be simplified to `node_layout` once files have their own namespace.
See {D13466} for more information.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13523
2021-12-15 21:30:29 -05:00
5de109cc2d Remove G.relbase_valid
In almost all cases there is no difference between `G.relbase_valid`
and checking `G.main->filepath` isn't an empty string.

In many places a non-empty string is already being used instead of
`G.relbase_valid`.

The only situation where this was needed was when saving from
`wm_file_write` where they temporarily became out of sync.
This has been replaced by adding a new member to `BlendFileWriteParams`
to account for saving an unsaved file for the first time.

Reviewed By: brecht

Ref D13564
2021-12-16 11:41:46 +11:00
4b12f521e3 Cleanup: spelling 2021-12-16 11:38:09 +11:00
807efa8538 Cleanup: clang-format 2021-12-16 11:38:08 +11:00
366ec5f0f8 Cleanup: unused variable warning 2021-12-16 11:38:06 +11:00
b265b447b6 Fix various cases of incorrect filtering in node link drag search
Some nodes didn't check the type of the link's socket for filtering.
Do this with a combination of manually calling the node tree's validate
links function and using the helper function for declarations.

Also clean up a few cases that added geometry sockets manually
when they can use the simpler helper function.
2021-12-15 18:05:45 -06:00
36a830b4d3 Fix: Compare node missing from link drag search
This was missing from rB11be151d58ec0ca955f.
It uses the same approach as the quadrilateral node.
2021-12-15 17:37:55 -06:00
49311a73b8 Fix: Crash in nodes modifier with missing node group
We cannot depend on node->id being non-null for group nodes.
2021-12-15 15:00:20 -06:00
aa55cb2996 Cleanup: Use const arguments, references
Also slightly change naming to avoid camel case.
2021-12-15 14:51:58 -06:00
43875e8dd1 Cleanup: Remove no-op node preview function calls
This patch removes no-op node editor preview code (`PR_NODE_RENDER`)
and most calls to `BKE_node_preview_init_tree`. The only remaining call is
in the compositor.

 - Shader nodes previews don't seem to do anything.
 - In-node previews for the texture node system doesn't work either.

This is a first step to refactoring to remove `preview_xsize`,
`preview_ysize`, and `prvr` from nodes in DNA, aligned with
the general goal of removing runtime/derived data from data
structs.

Differential Revision: https://developer.blender.org/D13578
2021-12-15 14:27:38 -06:00
b32f5a922f Fix T93995: Cycles camera motion blur not working in right stereo view
Thanks to Michael (michael64) for identifying the solution.

Ref D13567
2021-12-15 20:47:54 +01:00
11be151d58 Node Editor: Link Drag Search Menu
This commit adds a search menu when links are dragged above empty
space. When releasing the drag, a menu displays all compatible
sockets with the source link. The "main" sockets (usually the first)
are weighted above other sockets in the search, so they appear first
when you type the name of the node.

A few special operators for creating a reroute or a group input node
are also added to the search.

Translation is started after choosing a node so it can be placed
quickly, since users would likely adjust the position after anyway.

A small "+" is displayed next to the cursor to give a hint about this.

Further improvements are possible after this first iteration:
 - Support custom node trees.
 - Better drawing of items in the search menu.
 - Potential tweaks to filtering of items, depending on user feedback.

Thanks to Juanfran Matheu for developing an initial patch.

Differential Revision: https://developer.blender.org/D8286
2021-12-15 09:51:57 -06:00
474adc6f88 Refactor: Simplify spreadsheet handling of cell values
Previously we used a `CellValue` class to hold the data for a cell,
and called a function to fill it whenever necessary. This is an
unnecessary complication when we have virtual generic arrays
and most data is already easily accessible that way anyway.
This patch removes `CellValue` and uses `fn::GVArray` to provide
access to data instead.

In the future, if rows have different types within a single column,
we can use a `GVArray` of `blender::Any` to interface with the drawing.

Along with that, the use of virtual arrays made it easy to do a
few other cleanups:
 - Use selection domain interpolations from rB5841f8656d95
   for the mesh selection filter.
 - Change the row filter to only calculate for necessary indices.

Differential Revision: https://developer.blender.org/D13478
2021-12-15 09:34:13 -06:00
d79868c4e6 Fix T93975: add more nested instance limit checks
Differential Revision: https://developer.blender.org/D13585
2021-12-15 15:46:39 +01:00
Michael
5f52684a0f Initialize the fourth and final instance variable of MemoryProxy
The constructor of MemoryProxy initializes 3 of 4 instances variables.
If a MemoryProxy is constructed and MemoryProxy::free is called
on this instance, buffer_ is undefined and 'delete buffer_;' causes errors.

Although this misuse pattern does not exist in the current codebase
it already tripped up the Address Sanitizer on various occasions
while debugging unrelated problems.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D13569
2021-12-15 15:46:28 +01:00
1a833dbdb9 Geometry Nodes: Add Selection to Attribute Statistics
This adds a bool field selection input to the Attribute Statistics node.
This is useful for running calculations on a subset of the input field data
rather that then whole set.

Differential Revision: https://developer.blender.org/D13520
2021-12-15 08:04:49 -06:00
e85d7d5a28 Fix T93971: "Center Cursor & Frame All" fails to redraw
bda9e4238a changed smooth-view
not to redraw when there were no changes made.
Redrawing is needed for repositioning the cursor.

Subscribe to changes to the 3d cursor to ensure all view ports
are updated (not just the current one).
2021-12-16 00:15:13 +11:00
c101ded463 Cleanup: remove disabled code
Originally pointcache wasn't supported when the file wasn't saved.
Remove commented code as this hasn't been the case for a long time.
2021-12-15 23:45:11 +11:00
a9d8ff6e21 Cleanup: unused variable warning 2021-12-15 23:43:31 +11:00
883e4c089a MetaBall: optimize memory allocation for meta-ball tessellation
Double the allocation size when the limit is reached instead of
increasing by a fixed number.

Also re-allocate to the exact size once complete instead of over
allocating. This gives a minor speedup in my tests ~19% faster
tessellation for ~1million faces.
2021-12-15 23:40:39 +11:00
6a885e5d89 Fix meta-ball bound-box calculation reading past buffer bounds
This broke "test_undo.view3d_multi_mode_select" test in
"lib/tests/ui_simulate" and is likely exposed by recent changes to
bounding box calculation.

The missing check for DL_INDEX4 dates back to code from 2002 which
intended to check this but was checking for DL_INDEX3 twice
which got removed as part of a cleaned up.

This could be hidden from memory checking tools as meta-balls
over-allocate vertex arrays.
2021-12-15 23:40:33 +11:00
3a856f7967 Fix compile errors on windows. 2021-12-15 11:51:03 +01:00
6051b80dd2 Cleanup: Use pixel in stead of texels in naming. 2021-12-15 11:19:29 +01:00
723fb16343 Images: 1,2,3 channel support for transform function.
Added support for 1, 2, 3 float channel source images. Destination
images must still be 4 channels.
2021-12-15 11:09:31 +01:00
67b657f07c Fix T94082: Curve to point empty evaluated NURBS crash
This is basically the same as rBee4ed99866fbb7ab04, the fix is
simply to check if the spline has evaluated points when deciding
the offsets into the result points array.
2021-12-14 18:57:45 -06:00
644eb68524 Fix T93949: Preview Image Error When No Screen
Fix an error if "File Preview Type" is "Auto" and there is no screen.

See D13574 for details.

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

Reviewed by Julian Eisel
2021-12-14 13:50:40 -08:00
40aee0b2e9 Fix possible use-after-free on error handling during VR view drawing
Whenever an exception happens in VR session code, we cancel the entire
session. Alongside that, we removed the "surface" item used to draw into
an offscreen context. This would mess up the iterator of the surface
draw loop.
Similar to 7afd84df40.
2021-12-14 20:57:39 +01:00
4cfa21f09b Fix null-pointer dereference on error handling during VR view drawing 2021-12-14 20:44:17 +01:00
7afd84df40 Fix possible use-after-free on error handling during VR view drawing
Whenever an exception happens in VR session code, we cancel the entire
session. Alongside that, we removed the "surface" item used to draw into
an offscreen context. But this may still be stored as active surface,
leading to a use-after-free when deactivating this active surface, for
example.
2021-12-14 20:13:58 +01:00
7e8912eb96 Fix Cycles compilation with CUDA / Optix after recent Map Range additions. 2021-12-14 20:01:30 +01:00
Charlie Jolly
5b61737a8f Nodes: Add vector support to Map Range node
This replaces lost functionality from the old GN Attribute Map Range node.
This also adds vector support to the shader version of the node.

Notes:
This breaks forward compatibility as this node now uses data storage.

Reviewed By: HooglyBoogly, brecht

Differential Revision: https://developer.blender.org/D12760
2021-12-14 18:27:01 +00:00
44232a2ce6 Cleanup: Remove unused arguments 2021-12-14 12:16:28 -06:00
d56bbfea7b Cleanup: Remove runtime uiBlock pointer from nodes
Code is simpler when the uiBlocks used during drawing are simply
stored in an array. Additionally, looping can be simpler when we use
an vector to hold a temporary copy of the tree's linked list of nodes.

This patch also slightly changes how uiBlocks are "named" in
`node_uiblocks_init`. Now it uses the node name instead of the
pointer, which is helpful so we rely less on the node's address.

Differential Revision: https://developer.blender.org/D13540
2021-12-14 11:19:47 -06:00
fdd41ac49e Cleanup: Simplify node group input and output socket verification
This commit refactors the way the socket lists for group nodes,
and group input/output nodes are verified to match the group's
interface.

Previously the `bNodeSocket.new_sock` pointer was used to
temporarily mark the new sockets. This made the code confusing
and more complicated than necessary.

Now the old socket list is saved, and sockets are moved directly from
the old list to a new list if they match, or a new socket is created
directly in the new list.

This change is split from D13518, which aims to remove the `new_node`
and `new_sock` pointers. In the future this code might be removed
entirely in favor of using node socket declarations.

Differential Revision: https://developer.blender.org/D13543
2021-12-14 10:56:12 -06:00
f5ce243a56 Geometry Nodes: support instance attributes when realizing instances
This patch refactors the instance-realization code and adds new functionality.
* Named and anonymous attributes are propagated from instances to the
  realized geometry. If the same attribute exists on the geometry and on an
  instance, the attribute on the geometry has precedence.
* The id attribute has special handling to avoid creating the same id on many
  output points. This is necessary to make e.g. the Random Value node work
  as expected afterwards.

Realizing instance attributes has an effect on existing files, especially due to the
id attribute. To avoid breaking existing files, the Realize Instances node now has
a legacy option that is enabled for all already existing Realize Instances nodes.
Removing this legacy behavior does affect some existing files (although not many).
We can decide whether it's worth to remove the old behavior as a separate step.

This refactor also improves performance when realizing instances. That is mainly
due to multi-threading. See D13446 to get the file used for benchmarking. The
curve code is not as optimized as it could be yet. That's mainly because the storage
for these attributes might change soonish and it wasn't worth optimizing for the
current storage format right now.

```
1,000,000 x mesh vertex:       530 ms -> 130 ms
1,000,000 x simple cube:      1290 ms -> 190 ms
1,000,000 x point:            1000 ms -> 150 ms
1,000,000 x curve spiral:     1740 ms -> 330 ms
1,000,000 x curve line:       1110 ms -> 210 ms
10,000 x subdivided cylinder:  170 ms ->  40 ms
10 x subdivided spiral:        180 ms -> 180 ms
```

Differential Revision: https://developer.blender.org/D13446
2021-12-14 15:57:58 +01:00
8e2c9f2dd3 Geometry Nodes: simplify using selection when evaluating fields
We often had to use two `FieldEvaluator` instances to first evaluate
the selection and then the remaining fields. Now both can be done
with a single `FieldEvaluator`. This results in less boilerplate code in
many cases.

Performance is not affected by this change. In a separate patch we
could improve performance by reusing evaluated sub-fields that are
used by the selection and the other fields.

Differential Revision: https://developer.blender.org/D13571
2021-12-14 15:40:27 +01:00
b44a500988 Fix T93920: Wrong field inferencing state with unavailable socket
This commit ignores unavailable sockets in one more place, to fix the
case in T93920.

Differential Revision: https://developer.blender.org/D13562
2021-12-14 08:30:45 -06:00
b5c18288f5 Fix T93649: Blender freezes when saving with active VR session
Dead-lock when VR viewport drawing and depsgraph updates would fight for
the draw-manager GL lock. This didn't usually cause issues because the
depsgraph would be evaluated at this point already, except in rare
exceptions like after file writing.

Fix this by ensuring the XR surface gets its depsgraph updated after
handling notifiers, which is where regular windows also do the depsgraph
updating.
2021-12-14 15:23:50 +01:00
5cce6894d2 Cleanup: consistent naming for the blender file name 2021-12-14 21:32:14 +11:00
381cef1773 Cleanup: remove oudated comment from early COW development
Added in 161ab6109e
2021-12-14 21:17:06 +11:00
c9e5897bb0 Cleanup: use typed enum for wmDrag.flags
Also use 'e' prefix for enum type name.
2021-12-14 21:08:30 +11:00
f6fd3a84c2 Cleanup: reorganize doxygen modules
- Nest compositor pages under the compositor module
- Nest GUI, DNA/RNA & externformats modules under Blender.
- Remove modules from intern which no longer exist.
- Add intern modules (atomic, eigen, glew-mx, libc_compat, locale,
  numaapi, rigidbody, sky, utfconv).
- Use 'intern_' prefix for intern modules since some of the modules
  use generic terms such as locale & atomic.
2021-12-14 20:56:11 +11:00
a207c1cdaf Cleanup: resolve parameter mis-matches in doc-strings
Renamed or removed parameters which no longer exist.
2021-12-14 18:35:23 +11:00
c097c7b855 Cleanup: correct unbalanced doxygen groups
Also add groups in some files.
2021-12-14 16:17:10 +11:00
c1f5d8d023 Fix T91005: Autosplit produces unusable files
Audio PTS was reset for each new file. This caused misalignment of video
and audio streams. In Blender, these files can't be loaded, other
players will fail to align audio and video.

Since timestamps are reset intentionally, reset also video stream
timestamps.

There were other bugs:
After timestamp was reset for audio, write_audio_frames started
encoding from timeline start until target frame, so each split video
had more audio than it should.

Also audio for last frame before splitting was written into new file.

Differential Revision: https://developer.blender.org/D13280
2021-12-14 01:16:24 +01:00
b647509913 Fix T93844: High memory usage during VSE preview
Since 88c02bf826 FFmpeg handles are freed if image is not displayed.
This change did not work correctly if strips are inside meta strip,
because overlap did not consider meta strip boundary, only strips inside
of meta strip.

Pass frame range to `sequencer_all_free_anim_ibufs`, if strip is inside
of meta strip, frame range is reduced to fit meta strip boundary, but if
meta strip is being edited, range must be set to +/-`MAXFRAME`,
otherwise playback performance would be too bad.
2021-12-14 00:43:54 +01:00
2a0a6a0541 Remove G.save_over
The difference between G.save_over and G.relbase_valid was minor.

There is one change in functionality. When saving the default-startup
file from an already loaded blend file - future save actions will
continue to write to the originally loaded file instead of prompting
the user to select a location to save the file.

This change makes saving the startup file behave the same way
"Save a Copy" does.

Reviewed By: brecht

Ref D13556
2021-12-14 09:42:46 +11:00
a603bb3459 Cleanup: clang-format 2021-12-14 09:42:44 +11:00
e688c927eb Fix T94022: Both options GPU/CPU checked under preferences cause viewport render crash. (ARM/Metal)
This fixes crash T94022 when selecting live viewport render with both GPU & CPU devices selected. It is caused by incorrect `KernelBVHLayout` assignment. Similar to `BVH_LAYOUT_MULTI_OPTIX` for Optix, this patch adds a `BVH_LAYOUT_MULTI_METAL` to correctly redirect to the correct Metal BVH layout type.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13561
2021-12-13 22:34:48 +00:00
Piotr Makal
b8952ecec9 Cleanup: Remove unused curve types from enum
There were a few unused enum values: `CU_CARDINAL` and `CU_BSPLINE`
This commit cleans them up from code as they were not used for
anything meaningful.

Differential Revision: https://developer.blender.org/D13554
2021-12-13 15:13:47 -06:00
0606adceb3 UI: String Search: Add an optional weight parameter
This builds off of rBf951aa063f7, adding a weight parameter which can
be used to change the order of items when they have the same match
score. In the future, if string searching gets a C++ API, we could
use an optional parameter for the weight, since it is not used yet.

This will be used for the node link drag search menu (D8286).

Differential Revision: https://developer.blender.org/D13559
2021-12-13 13:58:30 -06:00
Cody Winchester
a90c356467 GPencil: Add randomize options to Length modifier
This patch adds a randomize factor for the start/end lengths in the Length modifier.

Reviewed By: #grease_pencil, antoniov, pepeland, HooglyBoogly

Differential Revision: https://developer.blender.org/D12928
2021-12-13 17:14:44 +01:00
459af75d1e GPencil: New Shrinkwrap modifier
his new modifier is equals to the existing mesh modifier but adapted to grease pencil.

The underlying functions used to calculate the shrink are the same used in meshes.

{F11794101}

Reviewed By: pepeland, HooglyBoogly

Differential Revision: https://developer.blender.org/D13192
2021-12-13 17:09:22 +01:00
49802af7cd Cycles: add text explaining minimum requirements for Metal when no device found 2021-12-13 15:40:59 +01:00
Brecht Van Lommel
3f96555123 Cycles: enable Metal GPU rendering
This adds the remaining bits to enable Metal on macOS. There are still
performance optimizations and other improvements planned, but it should
now be ready for early testing.

This is currently only enabled on in Arm builds for M1 GPUs. It is not
yet working on AMD or Intel GPUs.

Ref T92212

Differential Revision: https://developer.blender.org/D13503
2021-12-13 13:57:13 +01:00
8ba6302696 Geometry Nodes: fix combining field inputs
This was an oversight in rB7b88a4a3ba7eb9b839afa6c42d070812a3af7997.
2021-12-13 13:51:42 +01:00
8709cbb73e Fix T93704: StructRNA.path_resolve fails silently with missing keys
Resolving the path to a missing pose-bone (for example),
was not raising an error as it should have.

Regression introduced in f9ccd26b03,
which didn't update collection lookup logic to fail in the case the
key of a collection wasn't found.
2021-12-13 23:48:17 +11:00
1686979747 Geometry Nodes: move up destruct instructions in procedure
This implements an optimization pass for multi-function procedures.
It optimizes memory reuse by moving destruct instructions up.
For more details see the in-code comment.

In very large fields with many short lived intermediate values, this change
can improve performance 3-4x. Furthermore, in such cases, peak memory
consumption is reduced significantly (e.g. 100x lower peak memory usage).

Differential Revision: https://developer.blender.org/D13548
2021-12-13 13:28:33 +01:00
e549d6c1bd Fix T93169: Weightpaint falloff popover drawn twice
This came with {rBf8a0e102cf5e}.

The panel was meant specifically for the gradient tool, but since it was
given the ".weighpaint" context, it would also draw as part of generic
header toolsettings drawing.

Now remove this context on purpose and only draw this specifically from
the gradient tools ToolDef.

Maniphest Tasks: T93169

Differential Revision: https://developer.blender.org/D13268
2021-12-13 09:38:17 +01:00
bea5a9997d Cleanup: clang-format 2021-12-13 16:22:21 +11:00
36c6b2e893 Cleanup: spelling in comments
Also move notes about where noise functions come from
into the function body as it's not relavant to the public doc-string.
2021-12-13 16:22:20 +11:00
8ad2642c47 Cleanup: use "filepath" term for Main, BlendFileData & FileGlobal
Use "filepath" which is the current convention for naming full paths.

- Main use "name" which isn't obviously a file path.
- BlendFileData & FileGlobal used "filename" which is often
  used for the name component of a path (without the directory).
2021-12-13 16:22:19 +11:00
27231afce5 Cleanup: remove checks for invalid input for Python Run utilities
These arguments must be non-null for useful functionality,
there is no need for paranoid checks.

The return value in case of invalid input for BPY_run_string_as_number
was also wrong (casting -1 to a bool, when false was expected).
2021-12-13 16:22:18 +11:00
80f1527762 Cleanup: Point cloud vs point-cloud in comments
Point cloud is two separate words, this just changes comments in
a few places where we were inconsistent. A small wording change
to another comment is also included.
2021-12-12 23:00:39 -06:00
d9d4b9899e Cleanup: Remove includes in node_util.h header
This ends up including the removed headers in many unnecessary places.
Also, remove unnecessary extern from function definitions.
2021-12-12 22:56:51 -06:00
f5679838bc Docs: document all Global (G) struct members 2021-12-13 14:05:31 +11:00
bc1e517bb3 Docs: improve on doc-strings for BPY_extern_run.h
Also add ATTR_NONNULL function attributes.
2021-12-13 13:12:09 +11:00
03015a9b22 Cleanup/docs: Add comment to spline lookup factor method 2021-12-12 18:03:30 -06:00
92237f11eb Geometry Nodes: improve memory reuse in procedure executor
This reduces the number of separate memory allocations done
by the multi-function procedure executor (which is used by the
field evaluation).

Now a linear memory allocator is used to allocate all intermediate
values. Furthermore, more buffers are reused when possible. This
reduces the total amount of allocated memory and improves
cache efficiency because the values are more likely to be in cache
already.

The performance improvement of this patch are most noticable
when few elements are processed by many functions. The situation
will improve even more with D13548, because then buffers can actually
be reused in practice. I measured up to 20% faster field evaluation
in extreme cases with this change.
2021-12-12 10:34:02 +01:00
b444e1be0f Cleanup: use struct instead of class
Using `class` and `struct` for the same type can cause issues on windows.
2021-12-12 08:58:55 +01:00
Charlie Jolly
8c55481e33 UI: Add curve handle buttons to CurveMap interface
This patch exposes the vector handle options as buttons
and aligns the UI between CurveMap and CurveProfile more closely.
- CurveMap point editing is on a single row like CurveProfile
- Tools menu is moved to the right hand side on both widgets
- Emboss curve map buttons

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D10980
2021-12-12 07:17:35 +00:00
9df13fba69 macOS: add tilde-based path expander
Replaces `HOME` environment variable usage for user
directories like in D12802.

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13212
2021-12-11 22:29:53 +05:30
23be5fd449 Cleanup: Use const arguments
Also remove unnecessary function to set a node type's
label function that duplicated its definition, and make
another function static.
2021-12-11 09:51:53 -06:00
96387a2eff Cleanup: const, autoreleasepool, remove unneeded cast.
Early return in some places also.
De-duplicate getSystemDir and getUserDir also.

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D13211
2021-12-11 19:07:36 +05:30
7b88a4a3ba Geometry Nodes: remove accidental exponential time algorithm
Calling `foreach_field_input` on a highly nested field (we do that
often) has an exponential running time in the number of nodes.
That is because the same node may be visited many times.
This made Blender freeze on some setups that should work just fine.
Now every field keeps track of its inputs all the time. That replaces
the exponential algorithm with constant time access.
2021-12-11 11:26:55 +01:00
4c705ab8fe Fix compilation error on Windows platform. 2021-12-11 09:48:43 +01:00
8c7d970e2c Sky: Use Gauss-Laguerre quadrature for optical depth calculation
This allows to use fewer evaluations (30 msec down to 23 for me) while giving more accurate results (3x-10x less relative absolute error) compared to classic ray marching.

Not a massive difference, but meh, it's better. For Cycles the speedup doesn't really matter much, but I also have a patch for Eevee support.

I've also tried Gauss-Legendre and Gauss-Lobatto - the latter was always worse, while the former was slightly better at 2deg elevation but notably worse on 15deg.

Unfortunately the same approach can't be used for the integration along the primary ray, since there we also need the accumulated transmission so far at every integration point, not just the total result.

Differential Revision: https://developer.blender.org/D13521
2021-12-11 01:02:11 +01:00
1a02c0d7dd Cleanup: Return early for null check 2021-12-10 16:42:34 -06:00
a8b730e04c Cleanup: Use const argument, rename variables
The const argument makes sense because these are the "source"
sockets, even though a const cast is necessary at one point.
The name "interface_socket" is an improvement over "stemp"
because the latter sounds like "temporary", or it confuses
the old socket template system with a node group's interface.
2021-12-10 14:54:32 -06:00
7c2fb00e66 Cleanup: Remove unnecessary runtime rectangle from nodes in DNA
I assume this `butr` rectangle was used more in the past,
but currently its value is set and used less than 10 lines apart,
so it's trivial to remove 16 bytes from every node. The other
rectangles are also runtime data and could be removed, but
they are more difficult.
2021-12-10 13:52:02 -06:00
5a3d5f751f Revert recent changes to ImBuf transform
This reverts commit 943aed0de3  and f76e04bf4d

The latter caused a test failure: `sequencer_render_transform`
Reverting since the fix is not obvious (to me), and people are
away for the weekend.
2021-12-10 12:55:36 -06:00
5ca38fd612 Cleanup/Docs: Add comments to Mesh header, rearrange fields
Most of the fields in Mesh had no comments, or outdated misleading
comments. For example, "BMESH ONLY" referred to the BMesh project,
not the data structure. Given how much these structs are used, it should
save a lot of time to have proper comments.

I also rearranged the fields in mesh to have a more logical order. Now
the most important fields come first. In the process I was able to
remove 19 bytes of unnecessary padding (31->12). I just had to
change a `short` flag to `char`.

Differential Revision: https://developer.blender.org/D13454
2021-12-10 10:42:28 -06:00
Moritz Röhrich
f886f29355 Fix T93591: Random Value node first and last value proportion
This patch replaces `round_fl_to_int` with `floor` and adjusts the
maximum value accordingly. The call to `round_fl_to_int` is problematic
here because it messes with the probability distribution at the edges
of the value range, meaning the first and last values were only half
as common as all other values. Since `round_fl_to_int` does
`floor(val + 0.5)`, it will not introduce misbehavior in edge cases.

Differential Revision: https://developer.blender.org/D13474
2021-12-10 09:34:30 -06:00
943aed0de3 ImBuf: Extracted UV Wrapping from the Interpolation functions.
Improvement of the IMB_transform function by separating the UVWrapping
method from the color interpolation function. This would allow us to
perform uv wrapping operations separate from the interpolation function.

Currently this wrapping is only supported when interpolating colors.
This change would allow us to perform it on non-color image buffers.
2021-12-10 16:14:36 +01:00
60a9703de8 Added support for large images to openexr. 2021-12-10 15:38:46 +01:00
05df6366a4 Added support for large texture to OCIO. 2021-12-10 15:38:25 +01:00
f76e04bf4d ImBuf: Use templating for IMB_transform.
Reduce the inner loop of IMB_transform by extracting writing to an
output buffer in a template. This reduces a branch in the inner loop and
would allow different number of channels in the future.
2021-12-10 15:19:41 +01:00
37e799e299 Fix crash using 32k images.
Use IMB_get_rect_len to solve overflow issues.
2021-12-10 12:28:48 +01:00
bd2b48e98d Cleanup: move public doc-strings into headers for various API's
Some doc-strings were skipped because of blank-lines between
the doc-string and the symbol and needed to be moved manually.

- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.

Ref T92709
2021-12-10 21:42:06 +11:00
63f8d18c0f Cleanup: move public doc-strings into headers for 'python/intern'
Ref T92709
2021-12-10 21:40:53 +11:00
3060217d39 Cleanup: move public doc-strings into headers for 'nodes'
Ref T92709
2021-12-10 21:40:30 +11:00
715f57371b Cleanup: spelling in comments 2021-12-10 21:28:56 +11:00
b87b33adbf Cleanup: doxygen comments for node_geo_dual_mesh
- Indent text after dot-points.
- Use an unparsed code-block to display the text verbatim in doxygen.
2021-12-10 21:28:56 +11:00
fcf8fc3eaa Fix Crash: Loading Huge Images.
When loading huge images (30k) blender crashed with a buffer overflow.
The reason is that determine the length of a buffer was done in 32bit
precision and afterwards stored in 64 bit precision.

This patch adds a new function to do the correct calculation in 64bit.
It should be added to other sections in blender as well. But that should
be tested on a per case situation.
2021-12-10 10:37:46 +01:00
William Leeson
57f46b9d5f Fix T92036: Magic Texture in Volumetric World Shaders render differently with the CPU and GPU
When rendering volume surfaces in unbounded worlds the volume stepping can produce large values. If used with a magic texture node the values can results in a Inf float which when used in a sin or cos produces a NaN.

To fix this the input values are mapped into the periodic range of the sin and cos functions (-2*PI 2*PI) this stops the possibility of a Inf occurring and thus the NaN. It also improves the accuracy and smoothness of the result due to loss of precision when large values are summed with smaller ones effectively removing the parts of the smaller number (i.e. those in the -2PI to 2PI range) that result in variation of the output of sin and cos.

Reviewed By: brecht

Maniphest Tasks: T92036

Differential Revision: https://developer.blender.org/D12821
2021-12-10 09:09:20 +01:00
566a458950 Cleanup: move public doc-strings into headers for 'depsgraph'
- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.

Ref T92709
2021-12-10 12:19:36 +11:00
dffd032bc9 Geometry Nodes: Remove unnecessary copy when replacing data
In the `replace_mesh`/`replace_curve` etc. methods, the component
was retrieved with write access. Retrieving with write access will
duplicate the data if the component has another user. This means that
the replaced geometry data was often duplicated just to be deleted
a moment later.

I expect this would have a large impact in performance in some specific
situations when dealing with large geometry. In a scene with many small
meshes though, I didn't observe a significant difference.

This also makes replacing a geometry set's data with the same data
that's already in the set safe. It would be valid to assert for that
case instead, but this seems safer.

Differential Revision: https://developer.blender.org/D13530
2021-12-09 17:43:30 -06:00
18412744c8 Fix T93687: Transform Gpencil vertices not working if scale is zero
Solution similar to rBd5cefc1844cf.

Basically the problem occurs because `td->smtx` was set to zero matrix.
2021-12-09 18:17:23 -03:00
74a566d211 Cleanup: Return early in null check
I'm planning to make these functions slightly more complicated,
and it makes sense to return early when checking one of the parameters
for null anyway.
2021-12-09 14:34:15 -06:00
Andrii
b8f41825e8 Fix Cycles wrong adaptive sampling render when using sample offset
Sample offset was not accounted for in the adaptive sampling code and caused
issues, like immediately applied adaptive filtering, with non-zero values.

Differential Revision: https://developer.blender.org/D13510
2021-12-09 20:54:41 +01:00
Andrii
dbd64a5592 Cycles: support merging images rendered with adaptive sampling
This patch adds support for merging images rendered with adaptive sampling to
the merge operator (which is currently only exposed in the Python API).

To do this an sample count buffer is created for each render layer from the
sample count pass if it exists, or from the metadata otherwise. This is then
used for averaging passes.

Differential Revision: https://developer.blender.org/D13457
2021-12-09 20:52:46 +01:00
Andrii
20987b0f29 Cleanup: use more modern C++ in Cycles merge operator
Use structured binding and for-each loop, remove reduntant type casts, use
find_if instead of loop.

Differential Revision: https://developer.blender.org/D13456
2021-12-09 20:52:46 +01:00
bd3bd776c8 Geometry Nodes: Scene Time Node
This node outputs the current scene time in seconds or in frames.
Use of this node eliminates the need to use drivers to control values
in the node tree that are driven by the scene time.
Frame is a float value to provide for subframe rendering for motion
blur.

Differential Revision: https://developer.blender.org/D13455
2021-12-09 11:50:25 -06:00
ad44f22397 Fix T93498: Cycles fast GI add method affected by bounces settings
This is only for the replace method.
2021-12-09 18:17:48 +01:00
4b00a779ec Fix T93890: Cycles error with shadow catcher + OptiX denoise without passes 2021-12-09 18:01:26 +01:00
56fa6f58a0 Fix T93874: Cycles crash with fast GI approximation 2021-12-09 17:46:21 +01:00
e427e4dbb1 Fix T93871: Image.has_data returns True for images that failed to load 2021-12-09 17:36:19 +01:00
fc14d02bc5 Fix T93892: Changing bone name leaves non-functional vertex group
The corresponding vertex group was renamed properly, but the armature
influence was broken for that bone.

Caused by {rB3b6ee8cee708}.

Since above commit, vertex group names are stored on object data (mesh/
lattice/gpencil) and if we update these, we have to inform dependency
graph to have immediate effect.

Maniphest Tasks: T93892

Differential Revision: https://developer.blender.org/D13526
2021-12-09 16:47:06 +01:00
5ce1c63e1b Fix T93691: Crash when loading custom thumbnail in custom library
This was an issue with the mixed list of external assets and assets from
the current file. When closing the File Browser to select the custom
preview image, the assets from the current file would be cleared for
reread, to make sure we display up-to-date file data. That is because
the workspace of the temporary File Browser was deleted, causing a
change in the file data (main data-base). The reread would happen in a
background thread, meaning it might not finish before the custom preview
operator runs and queries the active asset. So the preview operator
would get the wrong active asset from context.

Two fixes were needed:
* Make sure current file data is reread before the operator runs, by
  doing this partial rereading on the main thread.
* Ensure the asset list (in fact file list) order stays consistent over
  rereads. If multiple assets with the same name were shown, the
  operator might also have gotten the wrong asset, also leading to a
  crash.

Additionally the file operation handler should probably poll before
executing, to fail gracefully at least (not crash).
2021-12-09 15:51:00 +01:00
74fa4ee92b Fix (unreported): missing null check
A crash happened when `instance_id_attribute` further down in the
function was null. This issue was probably introduced when the
id attribute starting using generic attribute handling.
2021-12-09 13:54:47 +01:00
d812e46f40 Cleanup: move public doc-strings into headers for 'io/usd'
Ref T92709
2021-12-09 22:47:58 +11:00
74e57efb2d Cleanup: move public doc-strings into headers for 'io/alembic'
Ref T92709
2021-12-09 22:37:24 +11:00
69f55b1b62 Cleanup: Various cleanups to the tree-view API
* Correct URL for documentation (was changed recently).
* Add comments.
* Reevaluate and update which functions are public, protected or
  private.
* Reorder functions and classes to be more logical and readable.
* Add helper class for the public item API so individual functions it
  uses can be made protected/private (the helper class is a friend).
  Also allows splitting API implementation from the C-API.
* Move internal layout builder helper class to the source file, out of
  the header.
* More consistent naming.
* Add alias for item-container, so it's more clear how it can be used.
* Use const.
* Remove unnecessary forward declaration.
2021-12-09 12:35:15 +01:00
9183f9f860 Cleanup/Documentation: Add/move comments for asset files
Adds some basic high-level explanations for editor/UI level asset APIs.
Also moves one such comment from the source file to the header file,
so it's in the same file as other API comments.
2021-12-09 12:35:15 +01:00
50f378e5c8 Cleanup: move public doc-strings into headers for 'io/collada'
Ref T92709
2021-12-09 22:25:45 +11:00
973dac9b5f Cleanup: use doxy section for itasc_plugin
It wasn't obvious all callbacks were part of the plugin-API.
2021-12-09 21:19:46 +11:00
7f4878ac7f Cleanup: move public doc-strings into headers for 'functions'
Ref T92709
2021-12-09 21:17:16 +11:00
Azeem Bande-Ali
b8bad3549d Fix T93519: handle prefix names in autocompletes
Autocomplete entires keep track of the length of the prefix
in `name_prefix_offset`. However, the name matching logic
was comparing the string including the prefix which resulted
in tab-completion not working (when the user didn't also type
in the prefix, typically two whitespaces).

This is fixed by passing in a char pointer after the end of
the prefix.

Additionally, some searchbox logic is moved. Previously,
`ui_searchbox_apply` would clear the entry which would mean
that `ui_searchbox_find_index` would never succeed. Now the
search box is only cleared if no match was found.

Differential Revision: https://developer.blender.org/D13483
2021-12-09 11:15:19 +01:00
65de17ece4 Cleanup: move public doc-strings into headers for 'freestyle'
Ref T92709
2021-12-09 21:09:54 +11:00
bc01003673 Cleanup: move public doc-strings into headers for 'nodes/geometry'
Ref T92709
2021-12-09 20:58:39 +11:00
cd4a7be5b2 Cleanup: move public doc-strings into headers for 'io/gpencil'
Ref T92709
2021-12-09 20:34:14 +11:00
3647a1e621 Cleanup: move public doc-strings into headers for 'geometry'
Ref T92709
2021-12-09 20:23:10 +11:00
8ef8f3a60a Cleanup: spelling in comments 2021-12-09 20:21:26 +11:00
15a428eab0 Cleanup: move public doc-strings into headers for 'gpencil_modifiers'
Removed doc-strings for operator definitions as they didn't provide
useful information in addition to the operators own description.

Ref T92709
2021-12-09 20:11:29 +11:00
8aed5dbcf8 Cleanup: move public doc-strings into headers for 'compositor'
Ref T92709
2021-12-09 20:01:49 +11:00
7c76bdca1b Cleanup: move public doc-strings into headers for 'gpu'
Ref T92709
2021-12-09 20:01:47 +11:00
9f546d6908 Cleanup: move public doc-strings into headers for 'imbuf'
Ref T92709
2021-12-09 20:01:45 +11:00
9e365069af Cleanup: move public doc-strings into headers for 'blenlib'
- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.

Ref T92709
2021-12-09 20:01:44 +11:00
Alaska
d8b4275162 Cycles-X: Add hysteresis to resolution divider algorithm
Adds hysteresis to the resolution divider algorithm to avoid having the resolution bounce around when on the boundary of two resolutions.

Reviewed By: brecht, leesonw

Differential Revision: https://developer.blender.org/D12385
2021-12-09 09:18:47 +01:00
894269ad12 Fix incorrect copying of XR action map items
After using MEM_dupallocN() on the original item, the bindings ListBase
for the new item needs to be cleared and each binding copied separately.
2021-12-09 16:29:05 +09:00
30cebf5747 Cleanup: Remove empty node button layout function
Was unused since the first commit:
rB658b4c0d56dffbcf1476c2a2a019fa0ecfb79376
2021-12-08 22:02:45 -05:00
cf6be711e2 Fix T93869: snap cursor may fail in orthographic view
Float precision issues cause the `ED_view3d_win_to_3d_on_plane` to return
a value even when the view ray is parallel to the plane.

A more general solution might be desired in this case, as other areas that
use `ED_view3d_win_to_3d_on_plane` might have the same problem.

For now, just work around the problem for the snap cursor.
2021-12-08 23:47:26 -03:00
3753a0b72b Fix T93523: Memory leak in Menu Search
Fixes a memory leak introduced by D13225.
Caused by not freeing the hash-map in some cases.

Differential Revision: https://developer.blender.org/D13432
2021-12-09 01:48:11 +01:00
be2213472f Fix T93858: Zstd-compressed .blend files from external tools aren't recognized
The issue here was that after the seek table check, the underlying file wasn't
rewound to the start, so the code that checks for the BLENDER header
immediately reaches EOF and fails.

Since Blender always writes files with a seek table, this bug isn't triggered
by files saved in Blender itself. However, files compressed in external tools
generally don't have a seek table.
2021-12-08 23:35:47 +01:00
f32b63ec58 Fix T93642: value used as transform offset is ignored in some modes
If a transform operator is executed as modal and has a "value" set, that value works as an offset.

However few transform modes were supporting this.

Include more transform modes as supported.
2021-12-08 14:21:57 -03:00
6ebc581b52 Cleanup: Avoid lookup the same property string multiple times
This is a micro-optimization that is useful for operators with many properties.
2021-12-08 14:21:57 -03:00
069d63561a Geometry Nodes: Mesh Island Node
This node is a field input that outputs a separate index for each mesh island.
The indices are based on the order of the lowest-numbered vertex in each island.

Authoring help from @hooglyboogly

Differential Revision: https://developer.blender.org/D13504
2021-12-08 10:14:03 -06:00
72b39d3f92 Fix T93728: Greasepencil separate will loose all vertex groups
Caused by {rB3b6ee8cee708}

The raw data is copied here correctly
[`BKE_gpencil_stroke_weights_duplicate` in
`BKE_gpencil_stroke_duplicate`] but the vertex groups names are missing.
Prior to above commit is was enough to have `ED_object_add_duplicate`
(this seemingly took care of duplicating object's defbase).
Now vertex groups names sit on the `bGPdata` rather than the `Object`,
and since the separate operation creates **new** `bGPdata` we have to
copy vertex groups names - and active index - over [via
`BKE_defgroup_copy_list`].

Maniphest Tasks: T93728

Differential Revision: https://developer.blender.org/D13509
2021-12-08 16:10:07 +01:00
e23b54a59f Cycles: Fix OS version warnings
This patch suppresses OS version warnings and hides currently unsupported Metal GPUs when enumerating devices.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13506
2021-12-08 15:08:12 +00:00
Campbell Barton
5e9dba822d Cleanup: Avoid error prone pointer storage in SnapObjectParams
eed48a7322 caused the `SnapObjectParams` to be stored in the `SnapObjectContext`.

As this pointer is always passing in stack memory, so it seems error prone to keep a reference to this in `SnapObjectContext` since failure to set this will reference undefined stack memory.

So avoid this by moving params out of `SnapObjectContext`.

Differential Revision: https://developer.blender.org/D13401
2021-12-08 12:05:36 -03:00
98bb8e6955 Fix T91680: viewport selection broken in macOS x86 build with Xcode 13
There is an apparent compiler bug here, tweak the code to avoid it. This did
not affect official builds as we were still using Xcode 12.
2021-12-08 15:46:15 +01:00
5b06759473 Cleanup: Use float2 for node view functions
Though the interfacing with `rctf` becomes slightly more complicated,
this should be more helpful as more of this code usese `float2` instead
of two separate floats.
2021-12-08 09:44:02 -05:00
61776befc3 Cleanup: move public doc-strings into headers for 'editors'
Ref T92709
2021-12-09 01:14:10 +11:00
8f1997975d ImBuf: Performance IMB_transform.
This change uses generics to reduce code duplication an increases
flexibility and performance. Performance increase isn't measurable
for end users.
2021-12-08 13:02:55 +01:00
32b1a13fa1 Cleanup: move public doc-strings into headers for 'sequencer'
Ref T92709
2021-12-08 21:05:06 +11:00
e89d42ddff Cleanup: move public doc-strings into headers for 'draw'
Ref T92709
2021-12-08 20:30:05 +11:00
a46ff1dd38 Cleanup: move public doc-strings into headers for 'shader_fx'
Ref T92709
2021-12-08 20:30:05 +11:00
2c0ccb0159 Cleanup: move public doc-strings into headers for 'simulation'
Ref T92709
2021-12-08 20:30:05 +11:00
07726ef1b6 Cleanup: move public doc-strings into headers for 'blentranslation'
Ref T92709
2021-12-08 20:30:05 +11:00
ca0c9757f2 Cleanup: moved IMB_transform to transform.cc.
Part of a refactoring to make IMB_transform more generic to reduce
unneeded branching.
2021-12-08 09:54:52 +01:00
a7b64a714d Cleanup: Silence clang-tidy warnings. 2021-12-08 09:52:38 +01:00
4f48b2992b Cleanup: move public doc-strings into headers for 'blenloader'
Ref T92709
2021-12-08 17:51:45 +11:00
93ba5e2375 Cleanup: move public doc-strings into headers for 'render'
Ref T92709
2021-12-08 17:12:43 +11:00
7e92717439 Cleanup: move public doc-strings into headers for 'windowmanager'
Ref T92709
2021-12-08 17:12:41 +11:00
db795a4727 Cleanup: move public doc-strings into headers for 'makesrna'
Ref T92709
2021-12-08 17:12:40 +11:00
da67a19ed9 Cleanup: move public doc-strings into headers for 'makesdna'
Ref T92709
2021-12-08 17:12:39 +11:00
2545119112 Cleanup: move public doc-strings into headers for 'blendthumb'
Ref T92709
2021-12-08 17:12:37 +11:00
d6c3ea9e7a Cleanup: move public doc-strings into headers for 'blenfont'
Ref T92709
2021-12-08 17:12:35 +11:00
00f3957b8e Cleanup: move public doc-strings into headers for 'modifiers'
Ref T92709
2021-12-08 17:12:33 +11:00
c1279768a7 Cleanup: Clang-Tidy modernize-redundant-void-arg 2021-12-08 00:31:20 -05:00
cbcd74de22 Cleanup: Missing braces in array declaration 2021-12-08 00:30:36 -05:00
b71e29b3da Cleanup: clang-format 2021-12-07 23:12:13 -05:00
47b36ddcce Cleanup: Nodes: clang-tidy modernize-redundant-void-arg 2021-12-07 23:09:19 -05:00
2964c4e1d0 Cleanup: spelling in comments 2021-12-08 13:31:19 +11:00
333dc7b5c4 Nodes: Add Shader Socket to new decleration API
This commit adds the shader socket type to the new socket builder api.

Re commits part of rB0bd3cad04edf4bf9b9d3b1353f955534aa5e6740
2021-12-07 21:05:13 -05:00
0d8c479225 Shader Nodes: Use camel case for file names
Recommits part of rBf60b95b5320f8d6abe6a629fe8fc4f1b94d0d91c
2021-12-07 20:57:25 -05:00
1552c92fb1 Cycles: Fix Metal BVH crash caused by missing WITH_METAL define
Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13505
2021-12-07 21:23:52 +00:00
5568455d63 Cleanup: Extend a few comments in BKE_spline.hh 2021-12-07 15:17:10 -05:00
204ae33d75 Revert "Fix T93350: Cycles renders shows black during rendering huge resolutions"
This reverts commit 5e37f70307.

It is leading to freezing of the entire desktop for a few seconds when stopping
3D viewport rendering on my Linux / NVIDIA system.
2021-12-07 20:49:34 +01:00
b815088416 Tests: add Cycles perspective/ortho/panoramic camera regression tests
Ref D12691
2021-12-07 20:08:12 +01:00
Håkan Ardö
24e0165463 Cycles: add Fisheye Lens Polynomial camera model
This allows real world cameras to be modeled by specifying the coordinates of a
4th degree polynomial that relates a pixels distance (in mm) from the optical
center on the sensor to the angle (in radians) of the world ray that is
projected onto that pixel.

This is available as part of the panoramic lens type, however it can also be
used to model lens distortions in projective cameras for example.

Differential Revision: https://developer.blender.org/D12691
2021-12-07 20:05:57 +01:00
205254150a Build: don't look for CUDA toolkit if not using Cycles CUDA device 2021-12-07 19:52:54 +01:00
763cd2e0be Cleanup: fix compiler warning 2021-12-07 19:52:54 +01:00
5bd41b2e25 Shader Nodes: Create a new bf_nodes_shader library
Re commits rBf72cc47d8edf849af98e196f721022bacf86a5e7 but without the unity build
2021-12-07 13:20:22 -05:00
63bd356faf Cleanup: Missing include
This included is needed for the `ATTR_NONNULL` macro used in the header.
As found in a recent c --> c++ if the includes get ordered in a different order
this could result in an error.

Re commits rBc20098e6ec6adee874a12e510aa4a56d89f92838
2021-12-07 13:20:22 -05:00
b9641cfc37 Cleanup: clang-tidy: modernize-redundant-void-arg
Re commits part of rB0578921063fbb081239439062215f2538a31af4b
2021-12-07 13:20:22 -05:00
7fbb767259 Docs: Add more comments to geometry set header
This adds a bit more information to `GeometrySet` and each of the
geometry components. There is probably still more that can be written,
but this includes the most important information that I could think of.

I'd like to include some more general information about the
attribute API in a separate patch.

Differential Revision: https://developer.blender.org/D13501
2021-12-07 13:04:32 -05:00
Sergey Sharybin
5e37f70307 Fix T93350: Cycles renders shows black during rendering huge resolutions
The root of the issue is caused by Cycles ignoring OpenGL limitation on
the maximum resolution of textures: Cycles was allocating texture of the
final render resolution. It was exceeding limitation on certain GPUs and
driver.

The idea is simple: use multiple textures for the display, each of which
will fit into OpenGL limitations.

There is some code which allows the display driver to know when to start
the new tile. Also added some code to allow force graphics interop to be
re-created. The latter one ended up not used in the final version of the
patch, but it might be helpful for other drivers implementation.

The tile size is limited to 8K now as it is the safest size for textures
on many GPUs and OpenGL drivers.

Differential Revision: https://developer.blender.org/D13385
2021-12-07 19:01:42 +01:00
Mikhail Matrosov
a92805bf24 Fix T93418: Cycles shadow terminator Geometry Offset artifacts with translucency
Differential Revision: https://developer.blender.org/D13468
2021-12-07 19:01:39 +01:00
484714992c Build: remove Cycles CUDA/HIP/OPTIX build options on macOS
So those device types are not listed in the preferences. Metal will be
added instead as the only option.
2021-12-07 19:01:39 +01:00
13af88b23f Build: clean up handling of some Cycles build options
* Don't link embree / OSL when WITH_CYCLES is disabled
* Simplify lite config by disabling Cycles as a whole using this
* Remove code handling the removed WITH_CYCLES_NETWORK option
2021-12-07 19:01:39 +01:00
e14f8c2dd7 Cycles: Reintroduce device-only memory handling that got lost in Cycles X merge
Somehow only a part of rBf4f8b6dde32b0438e0b97a6d8ebeb89802987127 ended up in
Cycles X, causing the issue that commit fixed, "OPTIX_ERROR_INVALID_VALUE" when the
system is out of memory, to show up again.
This adds the missing changes to fix that problem.

Maniphest Tasks: T93620

Differential Revision: https://developer.blender.org/D13488
2021-12-07 18:50:10 +01:00
a37dac0a88 Cycles: add Metal device type to device_type_for_description
Add a `DEVICE_METAL` case to the enum-value-to-string mapping function.
2021-12-07 17:47:35 +01:00
fee4b58627 Cycles: fix build on non-Apple systems
Skip compiling `metal.mm` unless `WITH_CYCLES_DEVICE_METAL` is enabled.
2021-12-07 17:46:52 +01:00
c4cee2e221 Geometry Nodes: Edge Neighbors Node
Creates a new Edge Neighbors node which outputs a field
containing the number of faces connected to each edge.

Differential Revision: https://developer.blender.org/D13493
2021-12-07 10:07:24 -06:00
9558fa5196 Cycles: Metal host-side code
This patch adds the Metal host-side code:

- Add all core host-side Metal backend files (device_impl, queue, etc)
- Add MetalRT BVH setup files
- Integrate with Cycles device enumeration code
- Revive `path_source_replace_includes` in util/path (required for MSL compilation)

This patch also includes a couple of small kernel-side fixes:

- Add an implementation of `lgammaf` for Metal [Nemes, Gergő (2010), "New asymptotic expansion for the Gamma function", Archiv der Mathematik](https://users.renyi.hu/~gergonemes/)
- include "work_stealing.h" inside the Metal context class because it accesses state now

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13423
2021-12-07 15:52:21 +00:00
565b33c0ad Geometry Nodes: new Geometry to Instance node
This adds a new Geometry to Instance node that turns every
connected input geometry into an instance. Those instances
can for example be used in the Instance on Points node.

Differential Revision: https://developer.blender.org/D13500
2021-12-07 15:37:12 +01:00
a8e0fe6a54 Geometry Nodes: move type conversions to blenkernel
The type conversions do not depend on other files in the nodes
module. Furthermore we want to use the conversions in the
geometry module without creating a dependency to the
nodes module there.
2021-12-07 15:22:08 +01:00
2309fa20af Cleanup: Add macro and functions for node storage
The `node_storage` functions to retrieve const and mutable structs
from a node are generated by a short macro that can be placed at the
top of each relevant file. I use this in D8286 to make code snippets
in the socket declarations much shorter, but I thought it would be
good to use it consistently everywhere else too.

The functions are also useful to avoid copy and paste errors,
like the one corrected in the cylinder node in this commit.

Differential Revision: https://developer.blender.org/D13491
2021-12-07 09:09:30 -05:00
Yuchen Wen
6a9775ec6f Fix T93467: Use world bg color for pose library previews
Use the World viewport color when rendering pose library previews.

The World's viewport color is chosen instead of the World shading nodes,
as the latter would require rendering with `OB_RENDER` (instead of
`OB_SOLID`), which would take considerably longer.

Manifest Task: T93467

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D13470
2021-12-07 14:25:00 +01:00
0f48b37aae Revert moving all shader nodes to c++
This reverts to following commits:
* rB5cad004d716da02f511bd34983ac7da820308676
* rB97e3a2d935ba9b21b127eda7ca104d4bcf4e48bd
* rBf60b95b5320f8d6abe6a629fe8fc4f1b94d0d91c
* rB0bd3cad04edf4bf9b9d3b1353f955534aa5e6740
* rBf72cc47d8edf849af98e196f721022bacf86a5e7
* rB3f7014ecc9d523997062eadd62888af5fc70a2b6
* rB0578921063fbb081239439062215f2538a31af4b
* rBc20098e6ec6adee874a12e510aa4a56d89f92838
* rBd5efda72f501ad95679d7ac554086a1fb18c1ac0

The original move to c++ that the other commits depended upon had some issues
that should be fixed before committing it again. The issues were reported in
T93797, T93809 and T93798.

We should also find a better rule for not using c-style casts going forward,
although that wouldn't have been reason enough to revert the commits.
Introducing something like a `MEM_new<T>` and `MEM_delete<T>`
function might help with the the most common case of casting the return
type of `MEM_malloc`.

Going forward, I recommend first committing the changes that don't
require converting files to c++. Then convert the shading node files
in smaller chunks. Especially don't mix fairly low risk changes like
moving some simple nodes, with higher risk changes.
2021-12-07 13:26:39 +01:00
ae5a89e80a Fix T93797, T93809: Crash/undefined-behavior when opening demo file
Error in d5efda72f5. Was changing an iteration that would free items
to an iterator that is not safe for use in such cases.

There still seem to be significant issues with the rendering, but that's
a separate issue to be fixed.
2021-12-07 12:03:10 +01:00
4312cb8545 Fix memory leak when loading large asset libraries 2021-12-07 11:47:06 +01:00
cd494087c1 Fix crash when switching back from render preview.
Issue is that external engine uses the gpu info. but overwrote the
instance data. The draw manager would then detect instance data and
required the engine type to have a instance free callback.

The solution is to save some space in the engine data to hold an empty
and unused instance_data attribute to comply with `ViewportEngineData`
struct.
2021-12-07 11:30:50 +01:00
Jeroen Bakker
b069218a55 DrawManager: Engine Instance Data.
In the original design draw engines had to copy with a limitation that
they were not allowed to reuse complex data structures between drawing
calls. Data that could be reused were limited to:
- GPUFramebuffers
- GPUTextures
- Memory that could be removed calling MEM_freeN (storage list)
- DRWPass

This is fine when the storage list contains arrays or structs but when
more complex data types (vectors, maps) etc wasn't possible.

This patch adds instance_data that can be reused between drawing calls.
The instance_data is controlled by the draw engine and doesn't need to
be limited as described above.

When an engines stores instance_data it must implement the
`DrawEngineType.instance_free` callback to free the data.

The patch originates from eevee rewrite. But was added to master as the
image engine rewrite also has a need for it.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13425
2021-12-07 10:34:38 +01:00
Jeroen Bakker
e2f0b4a0cb Cleanup: Use rcti marking dirty regions when texture painting.
Dirty regions when painting are not using rcti. Meaning less
understandable code. Found issue when refactoring the image_gpu partial
update. In a future change gpu partial update API will be using rcti
also what makes the code even cleaner.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13260
2021-12-07 10:33:23 +01:00
1de3636624 Cleanup: note that functions in BKE_node.h aren't part of blenkernel 2021-12-07 18:55:57 +11:00
512a560cde Cleanup: remove BKE_ptcache_remove
No longer needed as the temporary directory is cleared on exit.
2021-12-07 18:47:01 +11:00
a55d318d71 Cleanup: sort DNA renaming
Add note at the beginning & end so it's not overlooked.
2021-12-07 18:44:28 +11:00
c6a200c693 Cleanup: clang-format 2021-12-07 18:39:16 +11:00
1e7ef83e46 Cleanup: clarify source/destination args for BKE_spacedata_copylist 2021-12-07 18:26:35 +11:00
a37a6fb445 Cleanup: remove incorrect/unhelpful comments 2021-12-07 18:23:57 +11:00
6483dee141 Cleanup: replace int with bool type 2021-12-07 18:15:15 +11:00
ffc4c126f5 Cleanup: move public doc-strings into headers for 'blenkernel'
- Added space below non doc-string comments to make it clear
  these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.

Ref T92709
2021-12-07 17:38:48 +11:00
luzpaz
f159d49f56 Cleanup: Fix various source typos
This is a continuation of D13462 to clean up source typos.

Differential Revision: https://developer.blender.org/D13471
2021-12-06 22:39:52 -05:00
luzpaz
92dae5775f Cleanup: Fix typos in source code
Source typos corrected

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D13462
2021-12-06 22:23:17 -05:00
50fb0fd636 Docs: Incorrect link to context type
Fixes T93773
2021-12-06 22:07:38 -05:00
5cad004d71 Cleanup: clang format 2021-12-06 18:52:08 -05:00
97e3a2d935 Shader Nodes: Migrate shader category to new node socket declaration API
No functional changes, tests passed and I double checked the nodes by hand.
2021-12-06 18:52:08 -05:00
Christoph Lendenfeld
b1696702cd Fix: Remove line from common invoke
The line that sets the factor_prop in graph_slider_ops.c
has been left in the common invoke function by accident.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13477
Ref: D13477
2021-12-06 22:27:04 +00:00
Christoph Lendenfeld
ae6f3056fc Cleanup: renames in graph_slider_ops
rename percentage_prop to factor_prop
rename remove_ratio to factor
remove "graphkeys" prefix from functions

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D13476
Ref: D13476
2021-12-06 22:19:00 +00:00
78ae587649 Cleanup: Use C++ types for multi input socket sorting
The algorithm used is still quite inefficient, but at least the code
is easier to read and a little bit simpler now.
2021-12-06 17:12:46 -05:00
aa23e870ec Cleanup: Remove unused includes 2021-12-06 16:50:44 -05:00
01779970c2 Cleanup: Remove unused node flag 2021-12-06 16:35:38 -05:00
b91ac86cfc Cleanup: Remove unnecessary generic includes from headers 2021-12-06 16:04:14 -05:00
5705db5bb3 Fix: Compile error in field input
Instead of essentially hashing a bool, just use a ternary operator.

Differential Revision: https://developer.blender.org/D13494
2021-12-06 15:47:09 -05:00
0ed254574f macOS: Fix build error in hash functions
Remove unneeded recent static_cast attempt.

Reviewed By: HooglyBoogly
Differential Revision: https://developer.blender.org/D13492
2021-12-07 01:38:14 +05:30
Aaron Carlisle
f60b95b532 Shader Nodes: Split each node into own file
This improves both code finding,  for example "color ramp" now has its own file.
And now each node has its own namespace so function names can be simplified
similar to rBfab39440e94

This commit also makes all file names use snake case instead of camel case.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13482
2021-12-06 14:47:49 -05:00
c3c69fee09 Cleanup: Fix warnings about copied Map loop variables
The `Map::items()` iterator does not return references.
2021-12-06 13:49:37 -05:00
86d520f268 Fix: Attempt to fix build error on macOS 2021-12-06 13:47:53 -05:00
Aaron Carlisle
9792994311 Nodes: Add function to set compact socket flag for vectors
This flag is currently only used for vector sockets
so the function is limited to the vector builder.

The flag is only used by two shader nodes at the moment
and this is needed to port them over to the new socket declaration API.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13490
2021-12-06 13:40:02 -05:00
2d4c7fa896 Geometry Nodes: reduce code duplication with new GeometyrFieldInput
Most of our field inputs are currently specific to geometry. This patch introduces
a new `GeometryFieldInput` that reduces the overhead of adding new geometry
field input.

Differential Revision: https://developer.blender.org/D13489
2021-12-06 19:13:24 +01:00
2814740f5b Geometry Nodes: 4 Field Inputs for Mesh Topology Data
Creates 4 new nodes which provide topology information
for the mesh. Values are interpolated from the primary
domain in each case using basic attribute interpolation.

Vertex Neighbors
  - Vertex Count
  - Face Count
Face Neighbors
  - Vertex Count
  - Neighboring Face Count
Edge Vertices
  - Vertex Index 1
  - Vertex Index 2
  - Position 1
  - Position 2
Face Area
  - Face Area

Differential Revision: https://developer.blender.org/D13343
2021-12-06 11:58:08 -06:00
ee4ed99866 Fix T93521: Single point NURBS crash in resample node
The resample node didn't handle the case of when a spline didn't have
any evaluated points. For poly and Bezier splines we should never hit
this case, but it is expected when the number of NURBS control points
is smaller than its order, so we have to handle the case here.

It's not that obvious what to do in this case, there are a few options:
 - Remove the bad splines from the result
 - Generate empty splines for those inputs
 - Skip resampling the bad splines, copy them to the result
 - Arbitrarily generate single point splines

I chose option three, just skipping the "bad" splines. Since the node
already has a selection input, this can be described by just extending
that. "Splines with no evaluated points are implicitly deselected."
The first option would probably be valid too though.

Differential Revision: https://developer.blender.org/D13434
2021-12-06 12:19:27 -05:00
Aaron Carlisle
0bd3cad04e Nodes: Add Shader Socket to new decleration API
This commit adds the shader socket type to the new socket builder api.

As a test, this commit also converts the Add Shader node to the new API

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13485
2021-12-06 11:59:52 -05:00
Aaron Carlisle
f72cc47d8e Shader Nodes: Unity Build
- Create a new `bf_nodes_shader` library
- Enable unity builds for  `bf_nodes_shader`, gives abount a 2.7x speed up for compile times

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13484
2021-12-06 11:47:45 -05:00
0c703b856b Disable asset indexing in the Asset List
Asset indexing should be disabled, but this was overlooked in the
asset list (used for the pose library in the 3D View).
2021-12-06 17:42:16 +01:00
86992a96b8 Asset Indexer: use fixed-length string for ID code
Use fixed-length string to convert `char[2]` to `std::string`. Otherwise
`strlen()` is called, which is problematic as the `char[2]` is not
zero-terminated.
2021-12-06 17:42:16 +01:00
c2292b2cd6 Cleanup: remove unnecessary extern template implementations
This technique isn't really necessary anymore, because unity builds
avoid instantiating the same template too many times already.
2021-12-06 17:31:42 +01:00
7d1a10a9bb Fix T93314: Thumbnails not drawn with default scale
Decrease threshold for drawing thumbnails.

This was unintended change in daaa43232d that was overlooked.
2021-12-06 17:01:51 +01:00
a5e3899853 VSE: Fix strip with mask modifier not blending
Set `ibuf->planes` to `R_IMF_PLANES_RGBA` because mask modifier adds
transparent areas to image.
2021-12-06 17:01:51 +01:00
Aurelien Jarno
477631d9ec cmake: fix linking with WITH_X11_XF86VMODE and bfd
Fix typos in the variables of the Xxf86vm libray to fix link failure
with bfd. These variables are defined in platform_unix.cmake.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D12911
2021-12-06 16:46:23 +01:00
b9c6ef4e8f Fix T93707: Dragging the tweaked NLA strip causes crash
Earlier code assumed that the active strip was on the active track. This
commit detects when this assumption doesn't hold, and adds a more thorough
search of the active strip.
2021-12-06 15:50:21 +01:00
0e52af097f Fix T93611: Curve modifier crash in editmode in certain situations
Caused by {rB3b6ee8cee708}

Above commit was trying to get the vertexgroup from the mesh that is
passed into `deformVertsEM` (but that can be NULL).
When can it be NULL, when is is non-NULL?
`editbmesh_calc_modifiers` only passes in a non-NULL mesh to
`deformVertsEM` under certain conditions:
- a non-deform-only modifier is handled currently
- a non-deform-only modifier preceeds the current modifier
- a deform-only modifier preceeds the current modifier (and the current
one depends on normals)

So the passed-in mesh cannot be relied on, now get the vertex group from
the context object data (like it was before the culprit commit).

Related commit: rB8f22feefbc20

Maniphest Tasks: T93611

Differential Revision: https://developer.blender.org/D13487
2021-12-06 15:20:30 +01:00
989d510e3e Cleanup: remove some temp dev asserts in new link/append code.
No longer needed now that all code uses that new
BKE_blendfile_link_append module, and that instantiation code in
BLO_readfile has been removed.
2021-12-06 11:29:27 +01:00
9a69c456bd Fix T93388: dropping object on grid in orthogonal view misses the floor plane
`ED_view3d_win_to_3d_on_plane` does not use the `clip_start` and
`clip_end` values of the scene, so the `do_clip` option can be misleading
especially in the orthographic view where the `clip_start` is negative.

For now, don't use the `do_clip` option in orthographic view.
2021-12-05 23:40:43 -03:00
3d8dea9ff9 Fix T93732: Snap Cursor not working after changing Add Object settings
`g_data_intern.state_default.gzgrp_type` is a very specific member and
cannot be set to default.
2021-12-05 23:40:43 -03:00
Aaron Carlisle
3f7014ecc9 Shader Nodes: Declare nodes in their own namespace
Follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5

This puts all static functions in geometry node files into a new
namespace. This allows using unity build which can improve
compile times significantly

- The namespace name is derived from the file name.
  That makes it possible to write some tooling that checks the names later on.
  The filename extension (cc) is added to the namespace name as well.
  This also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file.
- In the register function of every node, I added a namespace alias namespace `file_ns = blender::nodes::node_shader_*_cc`;.
  This avoids some duplication of the file name and may also simplify tooling, because this line is easy to detect.
  The name `file_ns` stands for "file namespace" and also indicates that this namespace corresponds to the current file.

In the future some nodes will be split up to separate files and given their own namespace
This will allow function names to be simplified similar to rBfab39440e94

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D13480
2021-12-05 17:47:33 -05:00
0a8a22fc04 Cleanup: Remove unused next and prev pointers in bNodeType 2021-12-05 17:15:21 -05:00
9a312ba192 Cleanup: Remove unnecesary node type draw callback
As a followup to 338c1060d5, apply the same change to the node
drawing callback. This helps to simplify code when the complexity
of a callback isn't necessary right now.
2021-12-05 17:12:25 -05:00
338c1060d5 Cleanup: Remove unnecessary node type callbacks for drawing
Currently there are a few callbacks on `bNodeType` that do the same
thing for every node type except reroutes and frame nodes. Having a
callback for basic things complicates code and makes it harder to
understand, and reroutes and frames are special cases in larger way.

Arguably frame nodes shouldn't even be drawn like regular nodes,
given that it adds a case of O(N^2) looping through all nodes.
"Unrolling" the callbacks makes it easier to see what's happening,
and therefore easier to optimize.

Differential Revision: https://developer.blender.org/D13463
2021-12-05 16:45:41 -05:00
0578921063 Cleanup: clang-tidy: modernize-redundant-void-arg
This change follows up on recent c --> c++ conversions
2021-12-05 16:38:00 -05:00
c20098e6ec Cleanup: Add missing include
Fixes compilation errors after rBd5efda72f501
Re sorted some includes.
2021-12-05 13:33:15 -05:00
Aaron Carlisle
d5efda72f5 Cleanup: Migrate all shader nodes to c++
This will be useful in the future to use the new socket builder API

Aditional changes:

- Declare variables where initialized
- Do not use relative includes

Differential Revision: https://developer.blender.org/D13465
2021-12-05 12:12:45 -05:00
b32f9bf801 Geometry Nodes: use array instead of map in GeometrySet
`GeometrySet` contains at most one component of each type.
Previously, a map was used to make sure that each component
type only exists once. The overhead of a map (especially with
inline storage) is rather large though. Since all component types
are known at compile time and the number of types is low,
a simple `std::array` works as well.

Some benefits of using `std::array` here:
* Looking up the component of a specific type is a bit faster.
* The size of `GeometrySet` becomes much smaller from 192 to 40 bytes.
* Debugging a `GeometrySet` in many tools becomes simpler because
  one can  easily see which components exists and which don't
2021-12-05 15:10:11 +01:00
d19443074a Fix (unreported): off-by-one error when setting curve handles
The problem is that `current_mask` can become `selection.size()`.
The loop could also be refactored to break out of it when the end
of the selection is reached. This can be done separately.
2021-12-05 14:49:30 +01:00
Aaron Carlisle
5ef5a9fc24 Compositor: Migrate most nodes to new socket builder API
This patch leaves a out a few nodes:

- Group Nodes
- Image input node
- File output node
- Switch View
- Cryptomatte

These nodes above are a bit more complicated and should be worked on individually.

Differential Revision: https://developer.blender.org/D13266
2021-12-03 20:26:38 -05:00
Christoph Lendenfeld
d5920744f4 Create generic modal functions from GRAPH_OT_decimate
This patch extracts the modal functions from GRAPH_OT_decimate
and makes them generic so they can be reused by future operators

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9326
Ref: D9326
2021-12-03 22:24:41 +00:00
56ed4c14d3 Cleanup: Use LISTBASE_FOREACH macro 2021-12-03 16:33:14 -05:00
2d8606b360 Cleanup: Use references in node editor, other improvements
This helps to tell when a pointer is expected to be null, and avoid
overly verbose code when dereferencing. This commit also includes
a few other cleanups in this area:
 - Use const in a few places
 - Use `float2` instead of `float[2]`
 - Remove some unnecessary includes and old code
The change can be continued further in the future.
2021-12-03 16:25:17 -05:00
ca0dbf8c26 Cleanup: Remove unused code
This is very old and is unlikely to be useful in the near future.
2021-12-03 12:31:00 -05:00
d1f118d228 Cleanup: Const, use references, C++ types
Also remove some unnecessary includes
2021-12-03 11:43:10 -05:00
be3f3812dc Cleanup: Comments and ordering in node editor header 2021-12-03 11:31:25 -05:00
cb0fbe1fde Cleanup: Use typed enum for node resize direction 2021-12-03 11:05:59 -05:00
ab927f5ca7 ImBuf: Made Wrapping and Cropping optional in IMB_transform.
`IMB_transform` is used in VSE. It had a required crop parameter
for cropping the source buffer. This is not always needed.

In the image engine we want to use the use the `IMB_transform`
with wrap repeat. Both options are mutual exclusive and due
to performance reasons the wrap repeat is only available when
performing a nearest interpolation.
2021-12-03 13:48:00 +01:00
c4e041da23 Cleanup: move public doc-strings into headers for 'bmesh'
Some minor improvements to doc-strings too.

Ref T92709
2021-12-03 20:10:57 +11:00
Jesse Yurkovich
7c4fc5b58d Fix T93541: Use warning instead of error for exceeding layer limits
Instead of using RPT_ERROR, use RPT_WARNING which will not raise an
exception to Python. This broke some scripts (including FBX import)
which already check for a None return value.

Ref D13458

Reviewed By: campbellbarton
2021-12-03 17:05:18 +11:00
de5d36560f Fix T93574: Asset triangulating a mesh
Correct assert for edit-mesh normal calculation.
2021-12-03 16:55:34 +11:00
56ff954030 UI: Expand tree-view items (e.g. asset catalogs) on click to activate
This actually gives a quite nice behavior in my opinion, especially for
asset catalogs, where activating a catalog makes all assets inside it or
its (grand-)child catalogs visible, so showing the child catalogs then
adds useful information. Maybe this should become a feature for
asset catalogs only, to be evaluated once the tree-view API is used in
more cases. Only asset catalogs are affected by this change right now.

Part of T93582.
2021-12-02 19:49:48 +01:00
c0122cc888 Asset Browser: Don't expand top-level catalogs by default
The "All" item will be expanded of course, and the tree will also be
expanded so that the active item is visible. But feedback was that in
some setups, opening all the top-level catalogs is a bit too much. So
collapse them for a more compact default layout.

Part of T93582.
2021-12-02 19:49:48 +01:00
a159f67ccc Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-12-02 19:37:01 +01:00
f1cca30557 Blender 3.0 - version bump -> release 2021-12-02 19:35:47 +01:00
0988711575 Licenses: Attribution document for Blender 3.0
A few libraries were updated, a few were added, and a few were missing
from the previous license document.
2021-12-02 19:35:01 +01:00
fca6a9fe3f Asset Browser: Remove home icon for "All" item
Originally this wasn't really meant to stay there permanently, but
helped giving things a nicer alignment. Others seemed to like it at
first so it stayed, but after more feedback we decided to remove it
again. The alingment is better now with the previous commit.

Part of T93582.
2021-12-02 19:14:50 +01:00
e38532773b Asset Browser: Nest all catalogs under the "All" item
This makes the relation to the catalogs and the behavior more clear.

Part of T93582.
2021-12-02 19:14:50 +01:00
cef8f5ff50 Docs: add README for HIPEW library 2021-12-02 18:43:42 +01:00
1e98a0cee5 NanoSVG: Mention the version we use 2021-12-02 18:22:05 +01:00
431255e5e8 Docs: 3.0 release description for Linux appdata
Includes a typo fix for 2.93.
2021-12-02 18:02:19 +01:00
27b70428c1 Cleanup: Avoid using C++ keyword as variable name 2021-12-02 11:20:22 -05:00
e6a732daad Merge branch 'blender-v3.0-release' 2021-12-02 16:43:25 +01:00
7e60d8a713 Fix missing Blender logo in Windows store package
D9681 was not properly merged to all branches, leaving a path to a non-existent
icon file in the maniphest.
2021-12-02 16:35:24 +01:00
2fd657db5b Fix T93560: crash with image paint undo and cycles preview render
Cycles preview rendering could free the image buffers being used by drawing in
another thread due to a race condition. This race condition was unlikely before,
but now that preview renders are started right before we draw the image in the
image editor or load it as a texture in the 3D viewport, it's likely to happen.

As we are close to release this is too risky to fix properly, just avoid freeing
the cache for preview renders instead and accept increased memory usage in some
cases.
2021-12-02 16:34:16 +01:00
aec56e562a Fix (unreported): incorrect custom data layer created
Without this fix `CustomDataAttributes::create_by_move`
did not work on named attributes.
2021-12-02 15:32:19 +01:00
a1f0f2eacb Cleanup: Move public docs to BKE_spline.hh header 2021-12-02 09:24:21 -05:00
23ffcb242d Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-12-02 14:40:20 +01:00
61e92eeb3e Fix Action.asset_data["is_single_frame"] set incorrectly
The asset metadata custom property `["is_single_frame"]` was set
incorrectly. Since this is intended for forward compatibility, including
being covered by the asset metadata indexing, it's important to have it
set correctly from the first release of Blender that includes the asset
browser.

Differential Revision: https://developer.blender.org/D13452
2021-12-02 14:35:12 +01:00
1620dcd208 Fix: don't use BLI_strncpy_utf8 for copying file paths
File paths can be any encoding, so using some UTF-8-specific function is
not the right way to go.
2021-12-02 13:02:39 +01:00
c5ec3738d8 Blenloader: move ghost include path from INC to TEST_INC
The Ghost dependency was added to avoid a memory leak (rBc7a1e115b507),
but since that's only for the unit tests, it's better to add the path to
`TEST_INC`.
2021-12-02 12:58:45 +01:00
e130903060 BLI: avoid invoking tbb for small workloads
We often call `parallel_for` in places with very variable
sized workloads. When many elements are processed,
using multi-threading is great, but when processing
few elements (possibly many times) using `parallel_for`
can result in significant overhead.

I measured that this improves performance by >20% in
the refactored realize instances code I'm working on
separately. The change might also help with debugging
sometimes, because the stack trace is smaller and contains
fewer irrevelant symbols.
2021-12-02 12:56:47 +01:00
0f89d05848 Fix T93563: Crash subdividing with overlapping tri and quad
The first loop was left out when finding the split edge boundary.

Error from f2138686d9.
2021-12-02 22:53:44 +11:00
42a6b2fd06 Cleanup: move public doc-strings into headers for 'python' 2021-12-02 22:53:44 +11:00
1766549418 Fix T92308: OptiX denoising fails with high resolutions
The OptiX denoiser does have an upper limit as to how many pixels it can denoise at once, so
this changes the OptiX denoising process to use tiles for high resolution images.
The OptiX SDK does have an utility function for this purpose, so changes are minor, adjusting
the configured tile size and including enough overlap.

Maniphest Tasks: T92308

Differential Revision: https://developer.blender.org/D13436
2021-12-02 12:10:46 +01:00
7da979c070 Merge branch 'blender-v3.0-release' 2021-12-02 11:19:00 +01:00
67c490daaf Fix T93548: Appended (material) assets don't have a fake user
Since our design is to always keep data-blocks marked as assets on exit,
and our technical design for this is to do this via fake users, ensure
the fake user is set for an appended asset.

Reviewed by: Bastien Montagne

Differential Revision: https://developer.blender.org/D13443
2021-12-02 11:18:27 +01:00
68e3755209 Fix T93555: crash when muting nodes with multiple internal links
The crash happened because I was incorrectly and inconsistently assuming
that a socket is part of at most one internal link. However, this is not the case.
In geometry nodes, an input socket can be internally linked to multiple
output sockets. In the general case, an output could also be linked to multiple
input sockets, even though we don't have that in Blender yet.

Dalai gave green light to cherry pick this fix for 3.0.
2021-12-02 11:10:41 +01:00
9f290467ca Blendread: Remove all instantiation logic from BLO_library_link_ code.
Instantiation is now fully handled by BKE_blendfile_link_append module.

Note that this also allows removal of the `BLO_LIBLINK_NEEDS_ID_TAG_DOIT`
flag.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-12-02 11:10:34 +01:00
4fe8c62b56 Cleanup: Readfile: Remove deprecated BLO_library_link_copypaste.
Rewrite of ID paste code in rB3f08488244c0 made this function useless,
ID pasting is now handled by the BKE_blendfile_link_append module too.
2021-12-02 10:27:34 +01:00
198e571e87 Fix T93555: crash when muting nodes with multiple internal links
The crash happened because I was incorrectly and inconsistently assuming
that a socket is part of at most one internal link. However, this is not the case.
In geometry nodes, an input socket can be internally linked to multiple
output sockets. In the general case, an output could also be linked to multiple
input sockets, even though we don't have that in Blender yet.
2021-12-02 09:41:36 +01:00
f1b0b0ffb8 Cleanup: spelling in comments 2021-12-02 16:02:34 +11:00
8f69c91408 Fix T93410: Crash hiding a region from Python used by a popover
Close all active buttons when hiding a region as this can be called
from Python a popover is open from that region.

Failure to do this causes the popover to read from the freed button.

Also rename UI_screen_free_active_but to
UI_screen_free_active_but_highlight since it only frees highlighted
buttons.
2021-12-02 15:53:41 +11:00
0de1d2e84e Cleanup: FIx build with USD after recent refactor
rB218360a89217f4e8321319035bf4d9ff97fb2658 missed a couple renames in USD code paths.
2021-12-01 23:34:51 -05:00
Leon Leno
bb3d03973a UI: Fix scaling of HSV cursor when zooming
The small circle used to choose the hue/saturation and value in the
color widget was drawn with a fixed screen space size. Now scale the
circle used as cursor in the color widget based on the zoom. This
could have been part of a9642f8d61 but the implementation is
different.

Based on a fix provided by Erik Abrahamsson

Differential Revision: https://developer.blender.org/D13444
2021-12-01 22:22:53 -05:00
Nikhil Shringarpurey
26d2caee3b Fix T92268: Group input and output nodes have inconsistent padding
The group output node did not have the same size padding as the group
input, leading to the node looking different and actually being smaller.

Differential Revision: https://developer.blender.org/D13092
2021-12-01 22:04:44 -05:00
218360a892 Cleanup: Rename curve struct fields
These existing names were unhelpful at best, actively confusing at
worst. This patch renames them to be consistent with the terms
used to refer to the values in the UI.
 - `width` -> `offset`
 - `ext1` -> `extrude`
 - `ext2` -> `bevel_radius`

Differential Revision: https://developer.blender.org/D9627
2021-12-01 22:01:35 -05:00
ca9cdba2df Fix: Add tooltip translation marker to disabled hints
This was overlooked, as it seems there's no way for these strings to be
translated currently. Generally it's not that clear whether `N_` or
`TIP_` should be used in this case, but `TIP_` seems more consistent.
To avoid the cost of the translation lookup when the UI text isn't
necessary, we could allow the disabled hint argument to be optional.

Differential Revision: https://developer.blender.org/D13141
2021-12-01 21:55:04 -05:00
b869da0c10 Fix T84710: Instances with only mesh edges or vertices are invisible
Wire-only meshes have a special case in the overlay drawing to give
the wire shader a special color (which avoids the lines being dashed,
somehow). The fast path for duplis didn't have that special case.

Differential Revision: https://developer.blender.org/D13196
2021-12-01 21:47:57 -05:00
70a7685d04 UI: Add an option to display the node editor context path
Since we have the overlays popover, it makes sense to allow toggling the
context path like in the 3D viewport. This commit adds a property,
and turns it on by default in existing files.

Differential Revision: https://developer.blender.org/D13248
2021-12-01 21:45:41 -05:00
2b6c01d98c Fix: Updating geometry nodes test results fails
I ran into this when adding new geometry nodes tests.
The issue was caused by 7168a4fa5c.

Differential Revision: https://developer.blender.org/D13440
2021-12-01 21:22:00 -05:00
70a0d45b69 Merge branch 'blender-v3.0-release' 2021-12-01 21:17:48 -05:00
594656e7a3 Fix T93525: Crash with curve/text armature bone gizmo
The problem is that drw_batch_cache_generate_requested_delayed
is called on the object, which uses the original object data type to
choose which data type to get info for. So for curves and text it uses
the incorrect type (not the evaluated mesh like we hardcoded in the
armature overlay code).

To fix this I hardcoded the "delayed" generation to only use the
evaluated mesh. Luckily it wasn't use elsewhere besides this
armature overlay system. That seems like the simplest fix for
3.0. A proper solution should rewrite this whole area anyway.

Differential Revision: https://developer.blender.org/D13439
2021-12-01 21:16:18 -05:00
fed4fc9c42 Cleanup: Move node_shader_util.c to C++
This will allow using a function I've declared in a C++ header.
2021-12-01 15:08:42 -05:00
8ca8380699 Cleanup: compiler warning 2021-12-01 20:52:31 +01:00
Sebastian Herholz
cb334428b0 Cycles: fix bugs in point and spot light multiple importance sampling
* Spot lights are now handled as disks aligned with the direction of the
  spotlight instead of view aligned disks.

* Point light is now handled separately from the spot light, to fix a case
  where multiple lights are intersected in a row. Before the origin of the
  ray was the previously intersected light and not the origin of the initial
  ray traced from the last surface/volume interaction.

This makes both strategies in multiple importance sampling converge to the same
result. It changes the render results in some scenes, for example the junkshop
scene where there are large point lights overlapping scene geometry and each
other.

Differential Revision: https://developer.blender.org/D13233
2021-12-01 20:20:12 +01:00
9afd6e7b70 Cleanup: clarify material copying for hair and pointclouds
No functional change, just more clear this way it comes from src.
2021-12-01 19:48:48 +01:00
Yuki Hashimoto
7336af3259 Fix some shortcut keys not working on macOS with Japanese input
Differential Revision: https://developer.blender.org/D13414
2021-12-01 19:40:47 +01:00
128ebdb062 Fix: Remove incorrect asserts for empty attributes
While it is an edge case, it isn't incorrect for the attribute storage
to have a zero size, it will just return an empty span or nothing.
2021-12-01 12:44:02 -05:00
bc48da3235 Fix: Instances component does not copy attributes 2021-12-01 12:36:49 -05:00
be6e56b36b Cleanup: Fix errors in previous commit
After 1ef8ef4941 there were build warnings because of unused
arguments. Also missed to change code to iterate `strips` instead of
`seqbase` in 2 functions.
2021-12-01 18:13:09 +01:00
506d672524 Geometry Nodes: deduplicate join geometry code
The Realize Instances and Join Geometry node can share most of their code.
Until now, both nodes had their own implementations though. This patch
removes the implementation in the Join Geometry node in favor of the more
general Realize Instances implementation.

This removes an optimization for avoiding spline copies. This can be brought
back later. The realize instances code has to be rewritten to support attribute
instances anyway.

Differential Revision: https://developer.blender.org/D13417
2021-12-01 17:57:08 +01:00
Wannes Malfait
d54a08c8af Geometry Nodes: Dual Mesh Node
This node calculates the dual of the input mesh. This means that faces
get replaced with vertices and vertices with faces. In principle this
only makes sense when the mesh in manifold, but there is an option to
keep the (non-manifold) boundaries of the mesh intact.

Attributes are propagated:
 - Point domain goes to face domain and vice versa
 - Edge domain and Face corner domain gets mapped to itself
Because of the duality, when the mesh is manifold, the attributes get
mapped to themselves when applying the node twice.

Thanks to Leul Mulugeta (@Leul) for help with the
ascii diagrams in the code comments.

Note that this does not work well with some non-manifold geometry,
like an edge connected to more than 2 faces, or a vertex connected to
only two faces, while not being in the boundary. This is because there
is no good way to define the dual at some of those points. This type
of non-manifold vertices are just removed for this reason.

Differential Revision: https://developer.blender.org/D12949
2021-12-01 11:11:50 -05:00
1757840843 Geometry Nodes: Generalized Compare Node
Replace compare floats node with a generalized compare node. The node
allows for the comparison of float, int, string, color, and vector.

The datatypes support the following operators:
Float, Int: <, >, <=, >=, ==, !=
String: ==, !=
Color: ==, !=, lighter, darker
    (using rgb_to_grayscale value as the brightness value)

Vector Supports 5 comparison modes for: ==, !=, <, >, <=, >=
Average: The average of the components of the vectors are compared.
Dot Product: The dot product of the vectors are compared.
Direction: The angle between the vectors is compared to an angle
Element-wise: The individual components of the vectors are compared.
Length: The lengths of the vectors are compared.

Differential Revision: https://developer.blender.org/D13228
2021-12-01 09:36:25 -06:00
f8dd03d3dd Cleanup: Store instances id attribute with other attributes
Now that we can store any dynamic attribute on the instances component,
we don't need the special case for `id`, it can just be handled by the
generic attribute storage. Mostly this just allows removing a bunch
of redundant code.

I had to add a null check for `update_custom_data_pointers` because
the instances component doesn't have any pointers to inside of
custom data.

Differential Revision: https://developer.blender.org/D13430
2021-12-01 09:27:27 -05:00
Paul Golter
fd8418385c Add layer and pass index parameters to rna_Image_gl_load
This patch adds a layer_idx and pass_idx parameter to the rna_Image_gl_load function. It exposes both to the Python API as optional parameters.
This allows python scripters to specifiy which layer and pass they want to load in to an OpenGL texture. Right now image.gl_load() always takes the first layer and first pass.
This is limiting when working with multilayer openEXRs.

With this patch scripters can do something like this:

```
pass_idx = area.spaces.active.image_user.multilayer_pass
layer_idx = area.spaces.active.image_user.multilayer_layer
image.gl_load(frame=0, layer_idx=layer_idx, pass_idx=pass_idx)
```

As the parameters are optional and default to 0, it should not break existing code.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13435
2021-12-01 14:58:49 +01:00
1ef8ef4941 Cleanup: Remove seq->tmp_flag DNA member
Commit f0d20198b2 used this field to flag rendered strips which were
queried by `SEQ_query_rendered_strips()`. Then operators iterate all
strips and checks state of `seq->tmp_flag`.

Use collection returned by `SEQ_query_rendered_strips` directly.
There should be no functional changes.

This commit adds functions `all_strips_from_context` and
`selected_strips_from_context` that provide collection of strips based
on context. Most operators can use this collection directly.
There is already `seq->tmp` DNA field, but is should not be used unless
absolutely necessary. Better option is to use human readable flag.
Best is to not use DNA fields for temporary storage in runtime.
2021-12-01 12:49:17 +01:00
d5d91b4ae4 Color adjustments for splash for Blender 3.x series
Tweaks by Andy Goralczyk.
2021-12-01 12:46:20 +01:00
02ab4ad991 Fix T92561: unstable particle distribution with Alembic files
When enabling or disabling a Mesh Sequence Cache modifier of an Object
with a hair particle system, the hair would switch positions. This is
caused because original coordinates in Blender are expected to be
normalized, and toggling the modifier would cause the usage of different
orco layers: one that is normalized, and the other which isn't.

This bug exposes a few related issues:
- if the Alembic file did not have orco data,
`MOD_deform_mesh_eval_get`, used by the particle system modifier, would
add an orco layer without normalization
- `MOD_deform_mesh_eval_get` would also ignore the presence of an orco
layer (e.g. one that could have been read from Alembic)
- if the Alembic file did have orco data, the data would be read
unnormalized

To fix those various issues, original coordinates are normalized when
read from Alembic and unnormalized when written to Alembic; and a new
utility function `BKE_mesh_orco_ensure` is added to add a normalized
orco layer if none exists on the mesh already, this function derives
from the code used in the particle system.

Reviewed By: brecht

Maniphest Tasks: T92561

Differential Revision: https://developer.blender.org/D13306
2021-12-01 12:44:32 +01:00
fd22404837 Cleanup: Use int8 type rather than char for buffer
Indicates that this is just a buffer with an element size of 8 bit, not
a displayable/printable string buffer.
2021-12-01 12:19:43 +01:00
51791004ea Fix errors in user preferences after 2.8 hack removal
How to reproduce it:
* Open User Preferences.
* Got to Add-ons tab.

Issue introduced on d723e331f1

Reported via chat by Pedro Alcaide (povmaniac).
2021-12-01 11:38:08 +01:00
9cec9b4d6e Fix(unreported): LineArt intersection mask logic error.
The stroke generation call mistakenly uses all enabled
types to check intersection mask, the correct behavior
is to use individual edge(chain) type.
2021-12-01 15:55:52 +08:00
24b84e4688 LineArt: Use consitent view vector direction.
Now do not invertes view vector in different stages of calculation.
2021-12-01 15:55:16 +08:00
5eeaf4cce6 LineArt: Use consitent view vector direction.
Now do not invertes view vector in different stages of calculation.
2021-12-01 15:53:30 +08:00
386b112f76 Geometry Nodes: Propagate attributes in Instances to Points node
This is part of T92926, and is very similar to 221b7b27fc, except
slightly similar, because it only transfers from one component, and
it doesn't handle multi-threading at the moment.
2021-11-30 23:30:35 -05:00
Aaron Carlisle
d723e331f1 Cleanup: Remove hack to hide pre 2.8 addons in the user preferences
Should be safe to do so now that 2.8+ has been out for 8 releases and over 2 years now.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12984
2021-11-30 22:55:52 -05:00
1cb99f5808 Merge branch 'blender-v3.0-release' 2021-12-01 11:47:28 +11:00
b3d101ac29 Fix T93100: VSE RMB shift-select fails with "fallback tools"
When the select action was set to "Select Tool", shift-clicking
on sequence strips wasn't selecting the strip.

Regression in 2a2d873124

Thanks to @a.monti for the fix.
2021-12-01 11:43:19 +11:00
88e9e97ee9 Geometry Nodes: Add Point Count to Spline Length Node
- Integer Field input of the number of control points on each spline
  in the spline domain.

  - In the point domain, it is the number of points on the spline that
  contains the given control point.

Differential Revision: https://developer.blender.org/D13279
2021-11-30 15:25:43 -06:00
247f37f765 Fix missing subsurface IOR/Anisotropy socket after refactor in c2ab47e 2021-11-30 22:09:18 +01:00
221b7b27fc Geometry Nodes: propagate attributes in Instance on Points node
This is part of T92926.

Differential Revision: https://developer.blender.org/D13429
2021-11-30 18:37:44 +01:00
88b37b639e LibLink/Append: Some cleanup and addition to comments. 2021-11-30 17:37:00 +01:00
1b4734c57d Geometry Nodes: Curve Menu Organize
Put Spline Parameter in the correct position in the Curve menu.
2021-11-30 10:32:12 -06:00
3f08488244 Rewrite ID Paste code to use new BKE_blendfile_link_append module.
No behavioral changes are expected here.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-30 17:18:35 +01:00
b9f54dd48a LibLink/Append: Add a utils to link/append all ID of given types from a given library.
This will be used by the copy/paste code.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-30 17:18:26 +01:00
581fb2da10 LibLink/Append: tweak instantiation of collections in viewlayers.
When appended collections are instantiated in viewlayers, do not add to
viewlayers collections children of other instantiated collections.

This default behavior is required for proper copy/paste behavior. If
previous behavior needs to be brought back for regular append operation,
this can be decided and done, but think this default behavior also makes
sense in normal append case.

part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-30 17:13:28 +01:00
c822e03e2a Fix: Missing handling of dynamic instance attribute size
The attributes need to be reallocated when the size changes.

Differential Revision: https://developer.blender.org/D13390
2021-11-30 10:59:11 -05:00
2fbb52dd86 Merge branch 'blender-v3.0-release' 2021-11-30 15:41:29 +01:00
3788003cda Fix T93368: Dragging Blends Without Previews
Unfortunately the drop logic for file-path based drag & drop checks the
used icon for its logic. This is very bad and should be changed. But
doing this involves some changes that are better not done during bcon4,
so for now stick to it and update the icon check.

Reviewed by: Julian Eisel

Differential Revision: https://developer.blender.org/D13383?id=45314
2021-11-30 15:40:27 +01:00
74039388cd Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-30 15:36:48 +01:00
7863e03e89 Fix(unreported): LineArt intersection mask logic error.
The stroke generation call mistakenly uses all enabled
types to check intersection mask, the correct behavior
is to use individual edge(chain) type.
2021-11-30 22:24:42 +08:00
Bastien Montagne
de7f1e8e07 Fix T93353: Reload Library Override file loses Constraints, take II.
When adding `INSERT` operations over RNACollection items, rna diffing
code did not properly report the properties as not being equals.

This in turn triggered the 'purge unused exiting override properties'
mechanism, thus deleting the exitsting (valid) insert override property
operation.

NOTE: This should also be backported to 2.93, and probably 2.83.

Reviewed By: sybren, jbakker

Maniphest Tasks: T93353

Differential Revision: https://developer.blender.org/D13426
2021-11-30 15:19:44 +01:00
Germano Cavalcante
251c017534 Fix T93477: Viewport X-Ray is influencing snapping even in material mode
The default snap behavior to perform on tools and cursors is to the
final geometry and not edited geometry.

In snapping to edited geometry, there are some specific behaviors that
are not convenient in some cases. For example the general occlusion
test of X-Ray geometries during dragdrop.

This fix also resolves a regression for tools like measure and placement
that were also ignoring the snap to face in x-ray mode.

Differential Revision: https://developer.blender.org/D13410
2021-11-30 11:03:57 -03:00
0704570721 LibLink/Append: Port bpy.data.libraries.load to new BKE_blendfile_link_append module.
Note that this fully replaces the 'PyCapsule' storage of linked/appended items
in the python API code by the generic storage of items in the
`BlendfileLinkAppendContext` data.

Maniphest Tasks: T91414

Differential Revision: https://developer.blender.org/D13331
2021-11-30 15:02:53 +01:00
8cf0d15b60 Fix T93508: Shift+F1 to switch to asset browser randomly crashes 2021-11-30 14:35:29 +01:00
1cd9fcd98d Geometry Nodes: Rename Curve Parameter, Add Index on Spline
- Rename the Curve Parameter node to Spline Parameter.
  - Add "Index on Spline" to the node. This output is the index of
the current point on it's parent spline rather than the entrire curve.

Differential Revision: https://developer.blender.org/D13275
2021-11-30 07:21:14 -06:00
2f7bec04e8 Asset Browser: Fix incorrect user message
Text would display "No asset selected" when it actually inidicates that
there is no asset active (not selected). Changed it to "No active asset"
now.
2021-11-30 13:01:23 +01:00
3692c0521c Fix Asset Browser properties region toggle not showing open/closed state
The button is supposed to be blue (default theme) when the properties
region is open, to indicate that state.
2021-11-30 12:40:57 +01:00
b67dca9b76 Depsgraph: remove shading parameters component
This component served no purpose anymore. It was technical
dept from the early 2.80 days.

Differential Revision: https://developer.blender.org/D13422
2021-11-30 12:14:23 +01:00
4b971bb87c Asset Bundle Copy button: only report each external dependency once
The `ASSET_OT_bundle_install` operator only works when the blend file is
self-contained. It reports any external dependencies. Before this patch:

- every dependency was mentioned, even when it repeated the same
  filename over and over again, and
- multiple dependencies were all mentioned in the error popup,
  potentially filling the screen.

This is now resolved by:

- only reporting each external file once, and
- referring to the console when there are multiple external dependencies.

Reviewed by: severin, dfelinto

Differential Revision: https://developer.blender.org/D13413
2021-11-30 11:50:38 +01:00
Julian Eisel
2e53f8b4b1 Fix T92577: Cannot open shortcut folders on Windows
`file.select()` wasn't handling redirects as it should when it also
opens directories. This was only uncovered by a change in the keymap.

Reviewed By: Bastien Montagne, Harley Acheson

Differential Revision: https://developer.blender.org/D13388
2021-11-30 11:29:40 +01:00
e1cb2a226c Merge branch 'blender-v3.0-release' 2021-11-30 11:17:04 +01:00
d8edc2c634 VSE: Disable interactivity in combined view
Combined view of timeline and preview causes seemingly unpredictable
behavior after some operators have been allowed to run in preview
region.

Disable new features in this combined view, so behavior should be
consistent with previous versions.

ref: https://developer.blender.org/T92584

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D13419
2021-11-30 11:15:20 +01:00
6f460b76fe LibLink/Append: tweak asserts in main BKE link/append functions.
Now that those functions are much widely used, just return early in case
there is nothing to link/append,  instead of asserting over it.
2021-11-30 11:04:41 +01:00
bc1e3238c4 Merge remote-tracking branch 'origin/blender-v3.0-release'
This includes adjustment of rBc12d8a72cef5 to the new path traversal code
introduced in rBe5e8db73df86.
2021-11-30 10:56:14 +01:00
c12d8a72ce BPath traversing: allow skipping weak library references
Add flag to `BKE_bpath_traverse_id()` and friends to skip weak
references (see below). This makes a distinction between "this blend
file depends on that file" and "this blend file references that file,
but doesn't directly use its data". This distinction is for the Asset
Bundle install operator, which refuses to copy the blend file when it's
not self-contained.

Weak references are those that are not directly used by the blend file,
but are still present to allow path rewriting. For example, when an
Asset is loaded its originating blend file is saved in
`ID::library_weak_reference`; this reference is purely for deduplication
purposes, and not for actually loading any data.

Reviewed by: mont29, brecht

Differential Revision: https://developer.blender.org/D13412
2021-11-30 10:41:23 +01:00
d7f0de0e3a Fix T93442: Crash when proxy building is cancelled
If strip is removed while proxy is built, this causes crash when
building is finished. This happens because proxy anims are freed in
`SEQ_proxy_rebuild_finish()`.

Iterate over available strips and check if original strip still exists
by comparing `SessionUUID`.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13408
2021-11-30 10:08:22 +01:00
Jake
7168a4fa5c Tests: add edit-mesh operator tests
Added operator tests for hide, symmetry_snap, tris_convert_to_quads,
uvs_rotate, uvs_rotate, uv_texture_add, uv_texture_remove,
vert_connect_concave, vert_connect_nonplanar, vertex_color_add,
vertex_color_remove, vertices_smooth_laplacian, wireframe,
sculpt_vertex_color_add and sculpt_vertex_color_remove.

Ref D11798

Reviewed By: campbellbarton
2021-11-30 17:43:24 +11:00
500ec993f5 Revert "Fix: Const warning in editmesh_knife.c"
It's important the coordinates the knife is operating on are never
manipulated since it will cause problems which are difficult to
troubleshoot.

Instead, use a cast in the MEM_freeN(..) call.

This reverts commit 8600d4491f.
2021-11-30 16:30:08 +11:00
Matheus Santos
da279927b1 Text Editor: Line number highlight follow selection
Change the current behavior of line number highlighting to follow the
current selected line text->sell, not the current line text->curl.
2021-11-30 14:32:52 +11:00
ac447ba1a3 Cleanup: clang-format, trailing space 2021-11-30 10:15:17 +11:00
e2473d3baf Cleanup: remove blank lines in comment blocks 2021-11-30 10:15:17 +11:00
76471dbd5e Cleanup: capitalize NOTE tag 2021-11-30 10:15:17 +11:00
4e45265dc6 Cleanup: spelling in comments & strings 2021-11-30 10:15:17 +11:00
262ef26ea3 Cleanup: use colon after doxygen params, correct slash direction 2021-11-30 10:15:17 +11:00
35124acd19 Geometry Nodes: Domain Size Node
The Domain Size node has a single geometry input and a selection for
the component type. Based on the component chosen, outputs containing
single values for the related domains are shown.

Mesh:
  - Point Count
  - Edge Count
  - Face Count
  - Face Corner Count
Curve:
  - Point Count
  - Spline Count
Point Cloud:
  - Point Count
Instances:
  - Instance Count

Differential Revision: https://developer.blender.org/D13365
2021-11-29 13:04:25 -06:00
c2001ec275 Merge branch 'blender-v3.0-release' 2021-11-29 19:25:28 +01:00
e7ae9f493a Fix T93310: crash due to broken image paths
The crash was caused by allocating an uninitialized amount of memory.
This fix initializes a bunch of variables that could cause the error.

It should be possible to also fix this in the function that actually uses
the uninitialized memory, but that could cause unknown consequences
that are a bit too risky for 3.0. Just initializing some variables should
be safe though. For more details see D13369.

Differential Revision: https://developer.blender.org/D13369
2021-11-29 19:23:43 +01:00
4fac3be146 Fix Cycles OptiX doing a bit too much work for almost opaque curve shadows
Found in D13353, likely has no significant impact in performance.
2021-11-29 18:41:37 +01:00
2e6f914e37 Fix debug build error after recent Cycles kernel argument changes 2021-11-29 18:41:37 +01:00
0adb356f2e Merge branch 'blender-v3.0-release' 2021-11-29 17:09:53 +01:00
aa7051c8f2 Fix T93439: Armature widgets from hidden collections are invisible
The are few things in the dependency graph which lead to the issue:
- IDs are only built once.
- Object-data level (Armature, i,e,) builder dependent on the object
  visibility.

This caused issues when an armature is first built as not directly
visible (via driver, i.e.) and then was built as a directly visible.
This did not update visibility flag on the node for the custom shape
object.

The idea behind the fix is to go away form passing object visibility
flag to the geometry-level builders and instead rely on the common
visibility flush post-processing to make sure certain objects are
fully visible when needed.

This is the safest minimal part of the change for 3.0 release which
acts as an additional way to ensure visibility. This means that it
might not be a complete fix (if some configuration was overseen) but
it should not make currently working cases to not work.

The fix should also make modifiers used on rigify widgets to work.

The more complete fix will have `is_object_visible` argument removed
from the geometry-level builder functions.

Differential Revision: https://developer.blender.org/D13404
2021-11-29 16:59:50 +01:00
aff6227412 Merge branch 'blender-v3.0-release' 2021-11-29 16:59:09 +01:00
dae9917915 Fix T93384: Objects with Constraints to curves have wrong locations on file load
Regression since 3.93 caused by 752c6d668b.

Follow the code from 2.93 which was always leaving curve modifiers
evaluation with a valid and clean state of the bounding box.

This is also what was proposed and agreed on in the following
design task: T92206: Bounding Box: compute during depsgraph evaluation

Tested with files from T90808 and T93384.

For the 3.0 going with the safest and minimal change. The rest of
the bounding box un-entanglement is to happen outside of the stable
branch.

Thanks The patch is based on the code from Philipp Oeser and
investigation by Germano Cavalcante and Dr. Sybren A. Stüvel,
thanks!

Differential Revision: https://developer.blender.org/D13409
2021-11-29 16:45:31 +01:00
2206b6b9a0 Fix T92628: .blend thumbnail renders black with Cycles 3D viewport render
Don't use Cycles for rendering thumbnails, fall back to Solid shading.

Differential Revision: https://developer.blender.org/D13406
2021-11-29 16:27:55 +01:00
f613c4c095 Cycles: MetalRT support (kernel side)
This patch adds MetalRT support to Cycles kernel code. It is mostly additive in nature or confined to Metal-specific code, however there are a few areas where this interacts with other code:

- MetalRT closely follows the Optix implementation, and in some cases (notably handling of transforms) it makes sense to extend Optix special-casing to MetalRT. For these generalisations we now have `__KERNEL_GPU_RAYTRACING__` instead of `__KERNEL_OPTIX__`.
- MetalRT doesn't support primitive offsetting (as with `primitiveIndexOffset` in Optix), so we define and populate a new kernel texture, `__object_prim_offset`, containing per-object primitive / curve-segment offsets. This is referenced and applied in MetalRT intersection handlers.
- Two new BVH layout enum values have been added: `BVH_LAYOUT_METAL` and `BVH_LAYOUT_MULTI_METAL_EMBREE` for XPU mode). Some host-side enum case handling has been updated where it is trivial to do so.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13353
2021-11-29 15:20:26 +00:00
98a5c924fc Cycles: Metal readiness: Specify DeviceQueue::enqueue arg types
This patch adds new arg-type parameters to `DeviceQueue::enqueue` and its overrides. This is in preparation for the Metal backend which needs this information for correct argument encoding.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13357
2021-11-29 14:56:06 +00:00
Pratik Borhade
03c9563582 Fix T93431: Crash when empty is marked as asset
Make `ED_preview_id_is_supported(ID *)` NULL-safe. It's semantically
valid, as it's not possible to render a preview of a NULL ID.

The crash was introduced in 481f032f5c

Reviewed By: sybren, jbakker

Maniphest Tasks: T93431

Differential Revision: https://developer.blender.org/D13398
2021-11-29 15:25:03 +01:00
f9add2d63e Fix: Missing min value for set spline resolution node 2021-11-29 09:11:51 -05:00
Bastien Montagne
e5e8db73df Refactor BKE_bpath module.
The main goal of this refactor is to make BPath module use `IDTypeInfo`,
and move each ID-specific part of the `foreach_path` looper into their
own IDTypeInfo struct, using a new `foreach_path` callback.

Additionally, following improvements/cleanups are included:
* Attempt to get better, more consistent namings.
** In particular, move from `path_visitor` to more standard `foreach_path`.
* Update and extend documentation.
** API doc was moved to header, according to recent discussions on this
   topic.
* Remove `BKE_bpath_relocate_visitor` from API, this is specific
  callback that belongs in `lib_id.c` user code.

NOTE: This commit is expected to be 100% non-behavioral-change. This
implies that several potential further changes were only noted as
comments (like using a more generic solution for
`lib_id_library_local_paths`, addressing inconsistencies like path of
packed libraries always being skipped, regardless of the
`BKE_BPATH_FOREACH_PATH_SKIP_PACKED` `eBPathForeachFlag` flag value,
etc.).

NOTE: basic unittests were added to master already in
rBdcc500e5a265093bc9cc.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13381
2021-11-29 14:22:38 +01:00
6ae34bb071 Fix drawing annotations on surface
Caused by {rBaa0ac0035a0d}.

Similar solution to {rBc0fdaf700a5}.
2021-11-29 09:43:33 -03:00
7c703b4699 Fix T93417: Strip outline not aligned with image
When using non-uniform aspect ratio, strip outline is not aligned
correctly.

Apply pixel aspect ratio to image quad and origin.
2021-11-29 12:44:42 +01:00
f1118ee51e Nodes: Support internal links for custom sockets
Currently, nodes with custom sockets do not get their internal links
populated. So operators like Delete And Reconnect don't work with such
nodes. This patch put custom sockets into consideration when computing
priorities for internal links such that sockets of the same idname get
connected. Additionally, the patch cleanup the function in the process
to avoid redundant code repetition.

Reviewed By: Jacques Lucke

Differential Revision: https://developer.blender.org/D13386
2021-11-29 13:01:53 +02:00
ab2a7aa0da Fix T93438: Auto linking do not work for custom sockets
Currently, custom sockets are no longer supported for automatic linking
when dropping a node on a link. This is because SOCK_CUSTOM is given a
negative priority and is ignored. To fix this, SOCK_CUSTOM is now given
the lowest priority and the rest of the sockets got their priority
incremented.

Reviewed By: Jacques Lucke

Differential Revision: https://developer.blender.org/D13403
2021-11-29 12:34:11 +02:00
cebe5f5bf4 Cleanup: Silenced clang-tidy warning. 2021-11-29 11:26:35 +01:00
0cbcddd91e Merge branch 'blender-v3.0-release' 2021-11-29 02:14:05 -08:00
b31250feba Fix T93456: Properly translate operator on splash screen
Use the translation API to lookup the string before formatting occurs.

Differential Revision: https://developer.blender.org/D13400
2021-11-29 02:04:32 -08:00
444971aa8e Cleanup: typos in comments. 2021-11-28 19:05:22 +01:00
f7f558e293 Cleanup: Deduplicate instances component in spreadsheet
Currently we have a separate `InstancesDataSource`, which does almost
exactly the same thing as `GeometryDataSource`, except that it hardcodes
a few more columns: "Name", "Rotation", and "Scale". We can easily
replace that with a couple of if statements in the geometry data source.

This also makes named attributes on instances display
in the spreadsheet.

Differential Revision: https://developer.blender.org/D13391
2021-11-27 17:09:35 -05:00
e121b5b66c Merge branch 'blender-v3.0-release' 2021-11-27 21:59:57 +01:00
Brecht Van Lommel
d2e6087335 Fix build error with TBB 2021 and booleans
Linux distributions are using newer TBB versions than official releases, and
TBB 2021 is an API breaking release.

In general we should avoid using TBB directly and go through the abstractions
in BLI_task.hh, though there is no abstraction for this.

For 3.0 the safe option is to just not cancel the task but instead early out
in the lambda function. Given the grain size of 2048 there should be no
significant performance difference.

Differential Revision: https://developer.blender.org/D13382
2021-11-27 19:08:06 +01:00
aa6c922d99 Geometry Nodes: Optimize Cube primitive vertex calculation
This patch gets rid of the O(N^3) complexity
of calculate_vertices. Execution time of the node is
reduced from 250ms to 140ms with 500^3 vertices.
In the future edge calculations could be done manually
and reduce the execution time even further.

Differential Revision: https://developer.blender.org/D13207
2021-11-27 19:06:07 +01:00
d2f4fb68f5 Geometry Nodes: Parallelize "Set Spline Type"-node
Parallelizes the loop that converts splines.
It gives around a 2x speedup on curves with over 1k splines.

Differential Revision: https://developer.blender.org/D13389
2021-11-27 18:17:58 +01:00
2531358297 Attempt to fix Windows new bpath tests failing, take IV.
Follow up to rBdcc500e5a265093bc9cc, rB92daff6ac2adb5bb,
rB61bd5882a20c6f3 and rB08264aaf82da8.

Sorry for the noise, this time should be good.
2021-11-26 22:39:34 +01:00
08264aaf82 Attempt to fix Windows new bpath tests failing, take III.
Follow up to rBdcc500e5a265093bc9cc, rB92daff6ac2adb5bb and rB61bd5882a20c6f3.
2021-11-26 22:07:37 +01:00
61bd5882a2 Attempt to fix Windows new bpath tests failing, take II.
Follow up to rBdcc500e5a265093bc9cc and rB92daff6ac2adb5bb.

Also shortening a bit the macros names...
2021-11-26 21:34:48 +01:00
a0bb6bb4d6 Fix T89564: Spline IK breaks when it is far away from the world origin
The isect_line_sphere algorithm became very imprecise when the line and
the sphere were reasonably far away from the world origin.

This would lead to no intersections being reported even if there was a
guaranteed intersection (line crossing from inside the sphere to the
outside).

To fix this we now use the secant root finding method to get an
intersection point. This is much more stable and robust it seems.
2021-11-26 18:24:58 +01:00
97465046c6 Geometry Nodes: add utility to set remaining outputs
Differential Revision: https://developer.blender.org/D13384
2021-11-26 18:01:59 +01:00
92daff6ac2 Attempt to fix Windows new bpath tests failing.
Follow up to rBdcc500e5a265093bc9cc.
2021-11-26 17:57:40 +01:00
2efc2221cc Fix T93402: Linking Collections instantiate extra sub-collections.
Linking is more relax than appending when it comes to instantiating
indirectly linked collections/objects.
2021-11-26 17:49:18 +01:00
0789f61373 Cleanup: remove warnings
This assert was producing warning in debug builds because
it was never hit under some circumstances.
2021-11-26 17:32:09 +01:00
602ecbdf9a Geometry Nodes: optimize Set Position node
This implements four optimizations in the Set Position node:
* Check whether the position input is the current position and ignore
  it if it is. This results in a speedup when only the Offset input is used.
* Use multi-threading when copying to computed values to the
  position attribute. All geometry types benefit from this.
* Use devirtualization for the offset and position input. This optimizes
  the common case that they are either single values or computed
  in the fly in a span.
* Write to `Mesh->mvert` directly instead of creating a temporary span.
  This makes setting mesh vertex positions even more efficient.

In my simple benchmark I'm using a White Noise node to offset the
position of 1,000,000 vertices. The speed is `20 ms -> 4.5 ms` in the
multi-threaded case and `32 ms -> 22 ms` in the single-threaded case.
2021-11-26 15:33:35 +01:00
eb7827e797 Cycles: Fix film convert address space mismatch on Metal
This patch fixes an address space mismatch in the film convert kernels on Metal. The `film_get_pass_pixel_...` functions take a `ccl_private` result pointer, but the film convert kernels pass a `ccl_global` memory pointer. Specialising the pass-fetch functions with templates results in compilation errors on Visual Studio, so instead this patch just adds an intermediate local on Metal.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13350
2021-11-26 13:58:48 +00:00
12a83db83c Fix T93290: Rotation without contraint after extrude has wrong axis
The default orientation of the mode was being indicated as overridden,
although the one of constraint was used.
2021-11-26 10:49:00 -03:00
f86331a033 Geometry Nodes: deduplicate virtual array implementations
For some underlying data (e.g. spans) we had two virtual array
implementations. One for the mutable and one for the immutable
case. Now that most code does not deal with the virtual array
implementations directly anymore (since rBrBd4c868da9f97a),
we can get away with sharing one implementation for both cases.
This means that we have to do a `const_cast` in a few places, but
this is an implementation detail that does not leak into "user code"
(only when explicitly casting a `VArrayImpl` to a `VMutableArrayImpl`,
which should happen nowhere).
2021-11-26 14:47:15 +01:00
ef88047a97 Fix T89081: Freestyle noise seed of zero crash
This leads to division by zero in Freestyle's NoiseShader which also
crashes blender.

Not sure if we really need a do_version patch for old files, as an
alternative we could also force a positive number in the NoiseShader.
This patch does not do either, just force a positive range in RNA from
now on.

Maniphest Tasks: T89081

Differential Revision: https://developer.blender.org/D13332
2021-11-26 14:40:07 +01:00
a773cd3850 Fix T93130: Frame Selected with selected paint mask does not work
This broke with {rB20fac2eca723} (which landed in 2.63), so long
standing bug.

Convention for paint modes is:
- when no paint mask is active, `Frame Selected` will focus the last
stroke
- when paint mask is active, `Frame Selected` will focus the selected
mask faces

To check the right vert coords we have to offset with `mp->loopstart`.

Maniphest Tasks: T93130

Differential Revision: https://developer.blender.org/D13247
2021-11-26 14:32:49 +01:00
35c3644e78 Fix T93117: Texture paint clone tool crash in certain situation
Caused by {rBaf162658e127}, so long standing bug.

When changing clone slots (report involved a quite complicated sequence
of selecting textures and undo -- but I think this could happen in more
situations) code checks for UV of new clone slot.
However, since above commit the slot and the clone slot were mixed up,
so in this case the responsible NULL check (for when no UV is assigned)
wasnt working.
Now correct this (NULL check the clone slot uv -- instead of the paint
slot UV).

note: not sure why low level CustomData functions actually dont do the
name NULL checks themselves (seems like callers are always responsible).

Maniphest Tasks: T93117

Differential Revision: https://developer.blender.org/D13378
2021-11-26 14:24:46 +01:00
63342861e7 Fix: error in previous commit
Forgot to actually slice the span in rB6b5e1cfacab4c4605ec2d7bfef360389afe849be.
2021-11-26 13:29:24 +01:00
b066d58216 CMake mini-rewrite: Sync code check with BKE_blender_version_is_alpha
Reproduce the logic we already do in C (BKE_blender_version_is_alpha)
and the CMake file.

Otherwise it can get out of sync if we add/rename the non-alpha release cycles.

No functional change.

Differential Revision: https://developer.blender.org/D13379
2021-11-26 13:05:37 +01:00
236be8e9f1 Fix T93380: Texture paint clone tool crash without clone image
This was crashing using the clone tool without a clone image assigned.

Caused by {rB9111ea78acf4}.
Since above commit, `BKE_image_acquire_ibuf` was using `ima->runtime`
without checking for NULL first.
Since callers are not required to check for this, just return early
here.

note: there is still a memory leak using the clone tool without a clone
image assigned (but this was also the case before said commit and needs
to be investigated separately).

Maniphest Tasks: T93380

Differential Revision: https://developer.blender.org/D13377
2021-11-26 11:46:26 +01:00
dcc500e5a2 BKE_bpath: Add minimal unittests.
This is far from a complete coverage, but should catch most of potential
issues when rewriting this code.
2021-11-26 11:08:14 +01:00
Simon Lenz
c6eaa9c552 MaskEditor: draw active layer on top
Instead of drawing the mask layers in the sequence of their occurence, draw the active mask *always* on top.

Implementation:
- move drawing loop for splines to separate static function
- draw active mask last

Example: lowest layer is active, yet still drawn on top.
{F12140355}

This is part of an effort to make mask editing more intuitive & easy to use: https://developer.blender.org/T93097

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13372
2021-11-26 11:08:05 +01:00
658fd8df0b Geometry Nodes: refactor multi-threading in field evaluation
Previously, there was a fixed grain size for all multi-functions. That was
not sufficient because some functions could benefit a lot from smaller
grain sizes.

This refactors adds a new `MultiFunction::call_auto` method which has the
same effect as just calling `MultiFunction::call` but additionally figures
out how to execute the specific multi-function efficiently. It determines
a good grain size and decides whether the mask indices should be shifted
or not.

Most multi-function evaluations benefit from this, but medium sized work
loads (1000 - 50000 elements) benefit from it the most. Especially when
expensive multi-functions (e.g. noise) is involved. This is because for
smaller work loads, threading is rarely used and for larger work loads
threading worked fine before already.

With this patch, multi-functions can specify execution hints, that allow
the caller to execute it most efficiently. These execution hints still
have to be added to more functions.

Some performance measurements of a field evaluation involving noise and
math nodes, ordered by the number of elements being evaluated:
```
1,000,000: 133 ms   -> 120 ms
  100,000:  30 ms   ->  18 ms
   10,000:  20 ms   ->   2.7 ms
    1,000:   4 ms   ->   0.5 ms
      100:   0.5 ms ->   0.4 ms
```
2021-11-26 11:06:16 +01:00
Martijn Versteegh
004172de38 Clarify a confusing comment.
Affect and effect are too confusing for non-native english speakers
(like me). Also BAKING_MASK_MARGIN doesn't exist anymore in the code.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13361
2021-11-26 10:57:17 +01:00
6b5e1cfaca Geometry Nodes: better devirtualization for sliced virtual arrays
Under some circumstances that can lead to more than a 2x
performance increase, because math nodes can better optimize
for the case when the slice is a single value or span.
2021-11-26 10:08:19 +01:00
2cda65a35a Geometry Nodes: avoid allocation when construct varray for single value
Previously, `GVArray::ForSingle` would always allocate a copy of the passed
in value. Now it only does so when the value is too large or not trivial.
2021-11-26 09:59:41 +01:00
8015433f81 Cleanup: Migrate image_gpu.cc to CC.
To prepare for future changes {T92613}.
2021-11-26 08:16:35 +01:00
e3cf7ebdb1 Cleanup: Silence clang-tidy warning. 2021-11-26 08:00:05 +01:00
a073e1e401 Cleanup: Silence clang-tidy warnings. 2021-11-26 07:59:38 +01:00
7b5a6f452a Merge branch 'blender-v3.0-release' 2021-11-25 18:33:19 +01:00
466b50dbc9 Cycles: expose direct light sampling option in Debug panel, tweak panel layout 2021-11-25 18:30:54 +01:00
2fb8c6805a Fix build error with experimental features after recent release cycle bump
Hair, pointcloud and simulation datablock types should be disabled in the
beta cycles already like other experimental features.
2021-11-25 18:24:46 +01:00
e3d3296327 Merge remote-tracking branch 'origin/blender-v3.0-release'
Merge conflict: Makes sure master is still alpha, while 3.0 is rc.
2021-11-25 18:00:33 +01:00
e6a41e1c80 Blender 3.0 bcon4 - change release cycle to release candidate
This is still a rolling release candidate with new builds every day
as a preparation to the final release.
2021-11-25 17:59:49 +01:00
b2bb3e4b72 Fix T90082: Autoscrolling after renaming in the File Browser broken
Caused by 6b0869039a

Above commit introduced selection after renaming. This includes calling
`file_select_deselect_all` [which resorts and refilters].

So now, to have the correct file for scrolling, get it again after
sorting by calling `file_params_find_renamed` again.

Differential Revision: https://developer.blender.org/D13368
2021-11-25 17:32:40 +01:00
4a3f99ad5a Merge branch 'blender-v3.0-release' 2021-11-25 17:26:53 +01:00
5a11c6e558 Fix missing margin below panels
A minor cosmetic fix. When the view was scrolled all the way to the
bottom, the lowest panel would end right on the view edge. The
scrollable view should get the same margin at the bottom as used at the
top.
2021-11-25 17:15:48 +01:00
5514ca58a4 Fix T92313: Heading of redo panel is not aligned properly
This corrects some alignments issues through new margins introduced in
93544b641b. Basic idea of this fix is to only add the new margins when
drawing a panel with background. These margins were added specifically
for the background boxes, so that makes sense.

Alternative fix to D13199.

This also fixes some margings added unintentionally in mentioned commit.
There is a little jump of the toolbar and the tabs in the Properties
when comparing the UI without this fix to 2.93:
{F12158085} {F12158039}
The jump is gone with this fix applied (compare to the 2.93 screenshot):
{F12158064}
While not a serious issue, this confirms that this fix actually tackles
the root of the issue.
2021-11-25 17:09:45 +01:00
94e8db1e86 Fix T92278: Small size of previews in the shading popover
Don't use the side padding for menu item contents when displaying
previews or icons in a row or grid layout. This can cause problems for
the preview drawing and doesn't make sense to draw there anyway.

This not only fixes the mentioned issue, but also too small heighlight
for the collection color tag in the Outliner context menu.

Alternative to and similar to D13125.
2021-11-25 15:55:04 +01:00
3652f5f758 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-25 15:22:40 +01:00
c91d196159 Fix T93274: Assigning asset catalog doesn't mark file as modified
Assigning a catalog to an asset via drag-and-drop in the asset browser
now creates an undo step. Not only does this allow undoing the action,
it also tags the blend file as modified.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D13370
2021-11-25 15:02:23 +01:00
9812a08848 Fix: Crash when muting the Group Output node
This fixes a crash when muting the "Group Output" node.
It should not be possible to mute it so this patch
sets the `no_muting`-variable on it.

Differential Revision: https://developer.blender.org/D13364
2021-11-25 15:01:38 +01:00
e216660382 Merge branch 'blender-v3.0-release'
Conflicts:
	source/blender/windowmanager/intern/wm_files_link.c
2021-11-25 15:00:06 +01:00
e253fb2143 Fix T93353: Reload Library used as source for liboverride loses Constraints.
Liboverride properties and operations list need to be fully up-to-date
before libraries are reloaded, otherwise re-applying those liboverrides
after linked data is reloaded may miss some changes.
2021-11-25 14:56:56 +01:00
3bf10e5d0a Fix T89996, T90063: bugs with multi-button reset and entering values in popups
This reverts the changes to fix T87448, where entering the same value in number
buttons causes an unnecessary update. This is not stable enough for 3.0 and so
is being reverted, better to have an unnecessary update than no update in other
cases.

This effectively reverts the changes from rBeb06ccc32462 and follow up fixes
rBe1a9ba94c599, rBbbb52a462ef9, rBec30cf0b742f, and rB071799d4fc44. The code is
disabled with a comment on how it could be implemented better.
2021-11-25 14:45:19 +01:00
2378f057a0 Merge branch 'blender-v3.0-release' 2021-11-25 14:21:05 +01:00
bc4c20d414 Fix T93360: 'Iteractive Light Track' do not work over empty background
Bug introduced in {rBaa0ac0035a0d}.

The invalid depth fallback was changed to `FLT_MAX` in order to match the
annotation and gpencil operations.

This broke the `Interactive Light Track` operator which invalidates the
operation if the depth value is `1.0f`.

The chosen solution was to change the value tested in the annotation and
gpencil operations.
2021-11-25 10:18:57 -03:00
ffddf9e5c9 Fix T93338: Curve Guide force field crash
Caused by {rBcf2baa585cc8}.

For Curve Guide force fields to work, the `Path Animation` option has to
be enabled. With it disabled, we are lacking the necessary
`anim_path_accum_length` data initialized [done by
`BKE_anim_path_calc_data`] which `BKE_where_on_path` relies on since
above commit.

Now just check for this before using it - and return early otherwise.
Prior to said commit, `BKE_where_on_path` would equally return early
with a similar message, so that is expected behavior here.

Maniphest Tasks: T93338

Differential Revision: https://developer.blender.org/D13371
2021-11-25 14:16:12 +01:00
447378753d BLI: remove special cases for is_span and is_single methods
Those were not implemented consistently and don't really help in practice.
2021-11-25 13:51:23 +01:00
845716e600 Fix T92609 Default Compositing tab shows red overlay when stereoscopy is turned on
This was caused by the drawing not being done on the right frammebuffer.
2021-11-25 13:40:04 +01:00
d6646f7a8a Fix T93367: wrong attribute propagation in Delete Geometry node
This only happened with non-point selections. It used an incorrect
index mapping for the attribute propagation.
2021-11-25 11:32:12 +01:00
1e2376f41f Merge branch 'blender-v3.0-release' 2021-11-25 10:36:30 +01:00
82808e18e6 Fix T93362: crash when capturing attribute after fillet curve node
The issue was that the attribute propagation in the Fillet Curve node seems
pretty broken. I couldn't really make sense of the old code. It changed the
size of the point attribute domains on splines to 1 for some reason which
led to a crash in the next node.

Differential Revision: https://developer.blender.org/D13362
2021-11-25 10:33:05 +01:00
5ffb9b6dc4 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-25 10:22:32 +01:00
Bastien Montagne
a0acb9bd0c Fix T91444: Edge Loop Preview fails with two Mirror Modifiers
The mirror modifiers merge option caused unnecessary re-ordering
to the vertex array with original vertices merging into their copies.

While this wasn't an error, it meant creating a 1:1 mapping from input
vertices to their final output wasn't reliable (when looping over
vertices first to last) as is done in
BKE_editmesh_vert_coords_when_deformed.

As merging in either direction is supported, keep the source meshes
vertices in-order since it allows the vertex coordinates to be extracted.

NOTE: Since this change introduce issues for some cases (e.g. bound
modifiers like SurfaceDeform), this change is only applied to newly
created modifiers, existing ones will still use the old incorrect merge
behavior.

Reviewed By: @brecht

Maniphest Tasks: T93321, T91444

Differential Revision: https://developer.blender.org/D13355
2021-11-25 10:21:49 +01:00
e6cd4761e7 Fix T93321: Modified Mirror modifier behavior break some other tools like bound SurfaceDeform.
Revert "Fix T91444: Edge Loop Preview fails with two Mirror Modifiers"

This reverts commit 1a7757b0bc.

Caused issue reported in T93321, boiling down to the fact that other
operations or modifiers (like the SurfaceDeform one) rely on the order
of the vertices in the mesh to remain consistent.

Changing this in a modifier would mean those operations need to be
reset/re-created (e.g. rebound for the SurfaceDeform case), which is not
doable in `do_version` code.
2021-11-25 10:21:49 +01:00
726bc3a46b Fix T93155: Approximate shadow catcher displayed wrong on CPU and GPU
Was happening during rendering, causing visual artifacts when doing
CPU+GPU rendering, and giving different in-progress results on different
devices.

The root of the issue comes to the fact that math used in the approximate
shadow catcher calculation might have resulted in negative alpha channel,
and negative values for display are handled differently on CPU and GPU.
Such difference in handling is caused by an approximate conversion used on
the CPU for the performance reasons.

This change makes it so no negative alpha is generated by the approximate
shadow catcher. Not sure if we need some explicit clamping somewhere to
deal with possible negative values coming from somewhere else.

The shadow catcher cornell box tests are to be updated for the new code,
but the new result seems to be more accurate.

Differential Revision: https://developer.blender.org/D13354
2021-11-25 10:17:52 +01:00
610e68590b Merge branch 'blender-v3.0-release' 2021-11-25 10:12:57 +01:00
ce5561b815 Fix Py API: wrong doc about type of Collection property.
Collection property only accepts PropertyGroup type, not ID ones.

Reported on IRC by @frameshift, thanks.
2021-11-25 10:12:35 +01:00
f12a6ff5cb Merge branch 'blender-v3.0-release' 2021-11-25 09:51:12 +01:00
40d28b40df Fix black Cycles result when cancelling tiled rendering with shadow catcher
Noticed when was looking into T93155. Steps to reproduce:

- Open the .blend file from the report
- Hit F12 to start rendering
- After some tiles were rendered hit Esc

The issue is caused by "sticky" cancel reported via Progress. This  means
that once user hit Esc all further requests for cancel state will return
truth, which was preventing OIDN denoiser from completing the denoising
task.

Now only allow stopping the denoiser when interactive rendering requests
a very fast stopping.

Aiming the fix for 3.0 branch.

Differential Revision: https://developer.blender.org/D13352
2021-11-25 09:50:33 +01:00
William Leeson
c49d2cbe92 Merge branch 'blender-v3.0-release' to bring in D13042:
Fix performance decrease with Scrambling Distance on
2021-11-25 09:41:03 +01:00
Alaska
b41c72b710 Fix performance decrease with Scrambling Distance on
With the current code in master, scrambling distance is enabled on non-hardware accelerated ray tracing devices see a measurable performance decrease when compared scrambling distance on vs off. From testing, this performance decrease comes from the large tile sizes scheduled in `tile.cpp`.

This patch attempts to address the performance decrease by using different algorithms to calculate the tile size for devices with hardware accelerated ray traversal and devices without. Large tile sizes for hardware accelerated devices and small tile sizes for others.

Most of this code is based on proposals from @brecht and @leesonw

Reviewed By: brecht, leesonw

Differential Revision: https://developer.blender.org/D13042
2021-11-25 09:32:26 +01:00
827c5b399e Merge branch 'blender-v3.0-release' 2021-11-25 00:04:32 +01:00
8f2db94627 Fix T93357: crash when opening search menu
This is the same fix as in rBde35a90f9f56d3ff3ac80c13bf1ae296853ba877
but for the blender-v3.0-release branch.
2021-11-25 00:03:41 +01:00
c26011efcb Fix T92962 Boolean output indices unstable.
A parallel loop to create the interesection meshes for each triangle
meant that with parallelism, the output order of the created meshes
could vary with each execution. Keep the parallelism for doing the CDTs
for interesection, but move the extraction of the new faces into a
serial loop afterwards, for repeatability.
2021-11-24 15:26:12 -05:00
6b1b3383c6 Merge branch 'blender-v3.0-release' 2021-11-24 21:10:24 +01:00
Leon Leno
a9642f8d61 UI: Improve scaling of widgets when zooming
This commit improves the scaling of some ui widgets when
zooming by making the radius of the rounded corners
dependent on the element's zoom level.

Needed to fix T92278 without padding issues, see D13125.

Reviewed By: Hans Goudey, Julian Eisel

Differential Revision: https://developer.blender.org/D12842
2021-11-24 21:06:32 +01:00
c155a5f9d7 Merge branch 'blender-v3.0-release' 2021-11-24 14:53:16 -03:00
752c6d668b Fix T90808: wrong BoundBox after undo curve selection
There are two functions that recalculate the boundbox of an object:
- One that considers the evaluated geometry
- Another that only considers the object's `data`.

Most of the time, the bound box is calculated on the final object
(with modifiers), so it doesn't seem right to just rely on `ob->data`
to recalculate the `ob->runtime.bb`.

Be sure to calculate the BoundBox based on the final geometry and
only use `ob->data` as a fallback

Differential Revision: https://developer.blender.org/D12282
2021-11-24 14:52:49 -03:00
bbadee6fc1 UI: Blend File Icons Thumbnail View
Changes icon used to indicate blend file when overlaid over larger
document icon when in thumbnail view. Only seen when file does not
have a preview.

Followup to {rB611e4ffaab43}

For more details and examples see D13342

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

Reviewed by Julian Eisel
2021-11-24 09:52:27 -08:00
7a7ae4df43 UI: Blend File Icons Thumbnail View
Changes icon used to indicate blend file when overlaid over larger
document icon when in thumbnail view. Only seen when file does not
have a preview.

Followup to {rB611e4ffaab43}

For more details and examples see D13342

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

Reviewed by Julian Eisel
2021-11-24 09:50:02 -08:00
338408772a Merge branch 'blender-v3.0-release' 2021-11-24 18:37:33 +01:00
71c39a9e2e Asset Browser: Activate a catalog when dragging
Without this it's easy to loose track of which catalog you are dragging.
Things feel generally quite jumpy/disconnected, activating the catalog
makes things feel far less like that.
I consider this an important usability fix, therefore I'm adding it to
the release branch.
2021-11-24 18:05:08 +01:00
cae3b581b0 Asset Browser: Fix catalog being renamed when dropping into parent
When dropping catalogs it is ensured that the name of the moved catalog
is unique within the new parent catalog. When dropping a catalog into
the parent, the catalog would not actually move to a different location,
but it would still be renamed. The unique name logic simply isn't smart
enough to ignore the catalog that is about to be moved.
Address this by disallowing dragging a catalog into its own parent. It's
already there.
2021-11-24 17:59:14 +01:00
499c24ce75 BLI: add slice method to index mask and generic span 2021-11-24 17:49:33 +01:00
cbe9a87d28 Geometry Nodes: use simpler types when devirtualizing virtual array
The compiler is more likely to optimize away the function call
overhead when the used type is simpler and not virtual.
2021-11-24 17:46:00 +01:00
01ab36ebc1 Asset Browser: Support dragging catalogs into top level
This was an oversight when I added catalog drag & drop support. I forgot
to add this for dragging catalogs into the top level by dragging into to
the "All" item as well. This made the drag & drop support rather broken
because it wouldn't work for a basic case.
2021-11-24 17:31:28 +01:00
e206a0ae96 Geometry Nodes: reduce thread switching in evaluator
When a node is executed, it usually schedules other nodes.
Right now, those newly scheduled nodes are added to a
task pool so that another thread can start working on them
immediatly.

However, that leads to the situation where sometimes each
node in a simple chain is executed by another thread. That
leads to additional threading overhead and reduced cache
efficiency (for caches that are not shared between cores).

Now, when a node is executed and schedules other nodes,
the first of those newly scheduled nodes will always be
executed on the same thread once the current node is done.
If it schedules more than one other node, those will be
added to the task pool as before.

The speedup achieved by this is hard to measure. I found it
to be a couple percent faster in some extreme cases, not
much to get excited about. It's nice though that the number
of tasks added to the task pool is commonly reduced by a
factor of 4 or 5.
2021-11-24 17:26:41 +01:00
4930cd5db6 Merge branch 'blender-v3.0-release' 2021-11-24 10:40:13 -05:00
a07089dcb1 Fix T92120 (partially): No bone custom shape with curve object meshes
This part of the drawing code assumes that the bone custom object
has only one evaluated geometry component, and it also uses the
object type to check which data to draw, with the functions like
`DRW_cache_object_surface_get` that just take an object input.
Those functions usually work on evaluated objects, which use the
instancing system to access a temporary object with `object.data`
replaced for data types that don't match the original object.

That assumption used to work, but now curve, point cloud, or volume
objects can have an evaluated mesh which is not accessed with the
same object for render engine drawing.

The "correct" solution for the way this code is structured would be to
loop through all of the geometry components and try to get GPU batches
from every one of them. However, that significantly increases complexity
in an area that should probably be refactored anyway. This patch treats
the mesh as a special case, and only draws the evaluated mesh.

The **best** solution in my opinion might be refactoring this area to
use the instancing system with some sort of viewport-only flag so
the custom shape instances aren't added in the render.

The solution is "partial" because the "Wireframe" option only works
for meshes from mesh objects, even after this fix, and because other
data besides meshes is not displayed at all.

Differential Revision: https://developer.blender.org/D13038
2021-11-24 10:39:33 -05:00
7a97e925fd Cycles: Add support for building with OptiX 7.4 SDK and use built-in catmull-rom curve type
Some enum names were changed/removed in OptiX 7.4, so some changes are necessary to
make things compile still.
In addition, OptiX 7.4 also adds built-in support for catmull-rom curves, so it is no longer
necessary to convert the catmull-rom data to cubic bsplines first, and has endcaps disabled
by default now, so can remove the special handling via any-hit programs that filtered them
out before.

Differential Revision: https://developer.blender.org/D13351
2021-11-24 16:33:04 +01:00
56b068a664 Fix inconsistent UI terminology for tiling option
Was meant to be Use instead of Using.
2021-11-24 15:54:53 +01:00
64d9291d26 Cleanup: formatting 2021-11-24 15:54:53 +01:00
Alessio Monti di Sopra
2cc56495f3 UI: Fix alignment for recently added/edited icons
The patch slightly modifies two recently added icons "FILE_BLEND" and
"CURRENT_FILE" to better align them to the pixel grid, and change the
design of "FILE_BACKUP" to avoid alignment and readability issues, as
well as avoiding the outline version of the Blender logo which violates
the official logo guidelines.

Differential revision: https://developer.blender.org/D13346
2021-11-24 15:51:57 +01:00
72acce43bc Animation: allow marking actions as cyclic for Cycle-Aware Keying.
When a manual frame range is set, allow marking an action as having
Cyclic Animation. This does not affect how the action is evaluated,
but the Cycle-Aware Keying option will automatically make any newly
added F-Curves cyclic. This allows using the option from the start
to build the cycle, rather than only for tweaking an existing loop.

The curves are made cyclic when they have only one key, either
after inserting the first key, or before adding the second one.
The latter case avoids the need to manually make the first added
curve cyclic after marking a newly added action cyclic.

Differential Revision: https://developer.blender.org/D11803
2021-11-24 15:58:32 +03:00
5d59b38605 Animation: allow manually setting the intended playback range for actions.
Some operations, e.g. adding a new action strip to NLA, require
knowing the active frame range of an action. However, currently it
can only be deduced by scanning the keyframes of the curves within
it. This is not ideal if e.g. curves are staggered for overlap.

As suggested by Nathan Vegdahl in comments to T54724, this patch adds
Action properties that allow manually specifying its active frame range.
The settings are exposed via a panel in the Dopesheet and Action Editor.
When enabled, the range is highlighted in the background using a striped
fill to distinguish it from the solid filled regular playback range.

When set, the frame range is used when adding or updating NLA tracks,
and by add-ons using `Action.frame_range`, e.g. FBX exporter.

Differential Revision: https://developer.blender.org/D11803
2021-11-24 15:58:32 +03:00
057cb7e5e7 Context: add accessors returning selected actions for animation editors.
Add a new 'selected_visible_actions' property to allow querying
actions that are selected in animation related editors for use in
UI and operators. The 'selected_editable_actions' variant excludes
linked actions (the only reason an action can be read-only).

In the Action and Shape Key editors there is only one action
that is specified by the field at the top of the editor.

In Dope Sheet it scans the channel rows and returns all actions
related to the selected items. This includes summary items for
actions and groups.

In Graph Editor, it lists actions associated with selected curves.

The new property is also used for Copy To Selected and Alt-Click.

Ref D11803
2021-11-24 15:58:32 +03:00
65f547c3fc Geometry Nodes: add utility to show debug messages in node editor
This is only meant to be used for development purposes for now,
not to show warnings to the user.

Differential Revision: https://developer.blender.org/D13348
2021-11-24 13:39:20 +01:00
9fc5a9c78f macOS: Fix build error due to std::optional<T>::value 2021-11-24 17:41:37 +05:30
7ea4342e73 Geometry Nodes: reduce number of scheduled nodes in evaluator
Previously, there were a couple of cases where nodes were scheduled when
that was not really necessary. This change doesn't seem to have a big impact
on performance, but simplifies the code a bit.
2021-11-24 12:57:36 +01:00
833eb90820 Cleanup: removed shadowed variable 2021-11-24 12:57:36 +01:00
simon
25478bdc9a Merge branch 'blender-v3.0-release' 2021-11-24 12:56:19 +01:00
5a50b46376 Fix T93352: Material previews lost render samples
There are few layers of things which lead to the situation
of more noisy material preview: the do-version of the
preview.blend did not happen (at least from the Python
side as we did not investigate the C side deep). This made
Cycles to use default integrator settings for the preview
file ever since the Cycles X was merged. Those settings are
adaptive sampling with max 4K samples, noise threshold 0.01.
Opening the file in Blender 3.0 for edit did run the versioning
code which effectively lowered the number of samples used for
rendering.

This change makes it so the preview file is configured with
the exact effective settings as seen by Cycles prior to the
file was re-saved (adaptive sampling with the parameters noted
above).

This fix does not chaneg the fact that the versioning code is
not used for preview.blend, it only solves the regression in
the quality of previews.

The fix is done and reviewed with collaboration with Dalai and Sergey.
2021-11-24 12:47:30 +01:00
f5e5a0987a Geometry Nodes: decouple Delete Geometry node from Mask modifier
This dependency was a bit ugly and the functions from the mask modifier
did a few things that we don't need in the Delete Geometry node:
* The mask modifier uses `CustomData_copy_data` which the node doesn't need.
* The mask modifier checks for `-2` in some values, but this special value is
  not used by the node.

Differential Revision: https://developer.blender.org/D13335
2021-11-24 12:00:35 +01:00
050b205a97 CMake: add WITH_UNITY_BUILD option to improve compile times
Unity builds are only used in the `bf_nodes_geometry` module for now.
This module has been prepared to support unity builds already.
Usually, there is a 2-4x speedup when building `bf_nodes_geometry`
compared to without unity builds (e.g. 145s to 55s).

For more information about how unity builds work and how they help
with compile times, see D13341.

Differential Revision: https://developer.blender.org/D13341
2021-11-24 11:40:26 +01:00
3850fdd5b9 Assets: Sanitize threaded preview creation with undo
Basically, this fixes disappearing previews when editing asset metadata
or performing undo/redo actions.

The preview generation in a background job will eventually modify ID
data, but the undo push was done prior to that. So obviously, an undo
then would mean the preview is lost.

This patch makes it so undo/redo will regenerate the preview, if the preview
rendering was invoked but not finished in the undone/redone state.

The preview flag PRV_UNFINISHED wasn't entirely what we needed. So I had to
change it to a slightly different flag, with different semantics.
2021-11-24 11:26:37 +01:00
98a5658239 Cleanup: Renamed DefaultDrawingMode ImageSpaceDrawingMode.
Explains more what it does, not how it is used.
2021-11-24 11:23:44 +01:00
cd818fd081 Assets: Sanitize threaded preview creation with undo
Basically, this fixes disappearing previews when editing asset metadata
or performing undo/redo actions.

The preview generation in a background job will eventually modify ID
data, but the undo push was done prior to that. So obviously, an undo
then would mean the preview is lost.

This patch makes it so undo/redo will regenerate the preview, if the preview
rendering was invoked but not finished in the undone/redone state.

The preview flag PRV_UNFINISHED wasn't entirely what we needed. So I had to
change it to a slightly different flag, with different semantics.
2021-11-24 11:20:35 +01:00
75b53542f2 ImageEngine: Remove unneeded check for tiled image.
Regular images are also tiled images, but with a default tile that leads
to the same result.
2021-11-24 11:02:05 +01:00
17770192fb Tests: exclude anonymous attributes from mesh comparison
The set of anonymous attributes on a geometry is not visible to the user.
2021-11-24 10:38:42 +01:00
e0763760e4 Cleanup: IDTypeInfo new asset_type_info member.
Two issues addressed here:

I) `asset_type_info` is sub-data, not a callback. Therefore, move it
before the callbacks in the `IDTypeInfo` struct.

II) More important, initialize this new attribute in *ALL* `IDTypeInfo`
instances. No member of this struct should ever be left implicitely
uninitilazed, ever.

Aftermath of rBa84f1c02d251.
2021-11-24 10:35:47 +01:00
f8dea3fe64 Fix T93345: missing null check for geometry nodes logger 2021-11-24 10:16:14 +01:00
2ddbf81c47 Cleanup: Add info about attributes init in Mesh IDTypeInfo after conversion to C++.
rB6002914f141f totally lost those info, in C++ we use comments by
convention.
2021-11-24 10:09:35 +01:00
f9db7675e0 Cleanup: use lowercase in private functions. 2021-11-24 10:06:17 +01:00
785503a7e4 Cleanup: use lowercase in private functions. 2021-11-24 10:05:45 +01:00
1a887b0088 Cleanup: use nullptr 2021-11-24 10:05:01 +01:00
4d46e8a5e0 Merge branch 'blender-v3.0-release' 2021-11-24 10:02:57 +01:00
4b259edb0a Cleanup: Silent compilation warning in draw_manager. 2021-11-24 10:02:30 +01:00
de35a90f9f Fix crash when opening search menu.
Asset install bundle poll didn't check the space it was running in and
assumed that it was always running in file browser.
2021-11-24 09:27:47 +01:00
ebe5a5eca8 AssetBrowser: Disable asset indexing.
Asset Indexing is disabled for now as it requires {D12990} to support
object snapping.
2021-11-24 08:32:29 +01:00
Jeroen Bakker
dbeab82a89 T91406: Asset Library Indexing
Asset library indexing would store indexes of asset files to speed up
asset library browsing.

* Indexes are read when they are up to date
** Index should exist
** Index last modify data should be later than the file it indexes
** Index version should match
* The index of a file containing no assets can be load without opening
   the index file. The size of the file should be below a 32 bytes.
* Indexes are stored on a persistent cache folder.
* Unused index files are automatically removed.

The structure of the index files contains all data needed for browsing assets:
```
{
  "version": <file version number>,
  "entries": [{
    "name": "<asset name>",
    "catalog_id": "<catalog_id>",
    "catalog_name": "<catalog_name>",
    "description": "<description>",
    "author": "<author>",
    "tags": ["<tag>"]
  }]
}
```

Reviewed By: sybren, Severin

Maniphest Tasks: T91406

Differential Revision: https://developer.blender.org/D12693
2021-11-24 08:21:40 +01:00
Jeroen Bakker
16fc0da0e7 Animation: Add test cases for ED_keyframes_keylist.
This patch adds test cases to detect edge cases when finding
keylist columns.

The patch originated during development of D12052 to make sure
the new implementation matches the old implementation. It would
be good to add these test cases to master so this part is covered
in a next change might influence the expected edges.

The patch covers `ED_keylist_find_next`, `ED_keylist_find_prev`
and `ED_keylist_find_exact` methods.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D12302
2021-11-24 08:02:50 +01:00
21f22759ea Merge branch 'blender-v3.0-release' 2021-11-23 17:17:36 -08:00
60c0b79256 Add tablet data to Wintab fallback cursor movement. 2021-11-23 17:10:30 -08:00
Christoph Lendenfeld
6b4405d757 Extract keyframe segment calculation
extracts the search for keyframe segments (consecutive selection of keys)
It will be reused by future graph editor operators

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9360
Ref: D9360
2021-11-23 21:38:23 +00:00
d144983f8c Cleanup: unused variable 2021-11-23 18:15:59 -03:00
56f66602c7 Fix (unreported): Local preview icons not loading
Bug introduced in {rB9d7422b817d1}.

The solution is not an init thread for preview tasks that won't complete.
2021-11-23 18:11:54 -03:00
9159295c3c Clang Tidy: ignore some passes that changed or were added in version 13
I get hundreds of clang-tidy errors without ignoring those passes right now.
To not forget about the passes, I added them to T78535.
2021-11-23 19:45:05 +01:00
62a04f7aa6 Cleanup: clang tidy
The parameter name was inconsistent with the declaration.
2021-11-23 19:38:22 +01:00
38a3819171 Merge branch 'blender-v3.0-release' 2021-11-23 19:04:44 +01:00
3844e9dbe7 Fix (unreported): unlinked group input is not logged in geometry nodes
Differential Revision: https://developer.blender.org/D13340
2021-11-23 19:03:16 +01:00
ea93e5df6c Asset: Merge asset library/list refresh operators
In rBdcdbaf89bd11, I introduced a new operator
(`file.asset_library_refresh()`) to handle Asset Browser refreshing more
separate from File Browser refreshing. However, there already was
`asset.asset_list_refresh()`, which at this point only works for asset
view templates, but was intended to cover the Asset Browser case in
future too. This would happen once the Asset Browser uses the asset list
design of the asset view template.

So rather than having two operators for refreshing asset library data,
have one that just handles both cases, until they converge into one.
This avoids changes to the Python API in future (deprecating/changing
operators).

Differential Revision: https://developer.blender.org/D13239
2021-11-23 18:57:25 +01:00
60befc8f02 Clean-up: Fix BLI_rect.h collision with windows.h
windows.h `#defines rct1` as a number which is
problematic if we include `BLI_rect.h` after
`windows.h` .

by renaming `rct1/2` to `rct_a/b` we side step
the collision and straighten up the naming with
the functions directly above it.
2021-11-23 10:51:09 -07:00
62b50c612f Cleanup: Else after return, other simplifications
`std::stringstream` already returns a `std::string`, and there is no
particular reason to use short here instead of int.
2021-11-23 12:49:45 -05:00
9e5aae4215 Asset: Merge asset library/list refresh operators
In rBdcdbaf89bd11, I introduced a new operator
(`file.asset_library_refresh()`) to handle Asset Browser refreshing more
separate from File Browser refreshing. However, there already was
`asset.asset_list_refresh()`, which at this point only works for asset
view templates, but was intended to cover the Asset Browser case in
future too. This would happen once the Asset Browser uses the asset list
design of the asset view template.

So rather than having two operators for refreshing asset library data,
have one that just handles both cases, until they converge into one.
This avoids changes to the Python API in future (deprecating/changing
operators).

Differential Revision: https://developer.blender.org/D13239
2021-11-23 18:40:31 +01:00
c09e8a3590 Merge branch 'blender-v3.0-release' 2021-11-23 18:35:56 +01:00
792badcfef Fix broken handling of constraints reordering with library overrides
Alternative to D13291 (description partially copied from there).

New drag & drop reordering code would call constraints reordering
operator with the generic context, and not the one from the panel's
layout. missing the "constraint" member which is mandatory for poll
function to properly deal with override vs. local constraints.

For this to work in a decent way, there needs to be some panel-wide
context that we can restore when executing callbacks outside of the
normal draw context. So similar to uiLayoutSetContextPointer() to set
context on a layout level, this introduces
UI_panel_context_pointer_set() for panel level context (this calls the
former for the current panel root layout as well).

Differential Revision: https://developer.blender.org/D13308
2021-11-23 18:34:51 +01:00
c0a2b21744 Merge branch 'blender-v3.0-release' 2021-11-23 18:04:28 +01:00
fb4851fbbc Fix: The bounding box gizmo breaks if transform pivot is set to cursor
The bounding box transform code assumed that the pivot would always be
the sequence object transform center.

Rework the code so that this assumption is true even if the general
transform pivot is set to be the 2D cursor.
2021-11-23 18:03:36 +01:00
b40e930ac7 Merge branch 'blender-v3.0-release' 2021-11-23 17:52:30 +01:00
cf266ecaa6 Geometry Nodes: fix attribute propagation in Delete Geometry node
Previously, attribute propagation did not work correctly in when only
deleting edges and faces (but not points). Face and face corner attributes
were propagated wrongly or not at all respectively.

In order to keep the patch relatively small for the release branch,
it does not include some small optimizations. These can be done in 3.1:
* Use a `Span<int>` instead of `IndexMask` to avoid creating an
  unnecessary `Vector<int64_t>`.
* Only prepare index mappings when there are actually attributes to
  propagate.

Differential Revision: https://developer.blender.org/D13338
2021-11-23 17:48:09 +01:00
e4986f92f3 Geometry Nodes: Node execution time overlay
Adds a new overlay called "Timings" to the Geometry Node editor.
This shows the node execution time in milliseconds above the node.
For group nodes and frames, the total time for all nodes inside
(recursively) is shown. Group output node shows the node tree total.
The code is prepared for easily adding new rows of information
to the box above the node in the future.

Differential Revision: https://developer.blender.org/D13256
2021-11-23 17:37:31 +01:00
fab39440e9 Cleanup: Simplify geometry node function names
With this commit, we no longer use the prefixes for every node type
function like `geo_node_translate_instances_`. They just added more
places to change when adding a new node, for no real benefit.

Differential Revision: https://developer.blender.org/D13337
2021-11-23 10:55:51 -05:00
a9eb4e6f59 Merge branch 'blender-v3.0-release' 2021-11-23 16:41:53 +01:00
a6b7f32112 Fix T93297: incorrect eevee motion blur with geometry instances
This disables motion blur for geometry instances in eevee, which did
not work correctly anyway. See code comment for more details.

Differential Revision: https://developer.blender.org/D13334
2021-11-23 16:40:21 +01:00
db450c9320 Merge branch 'blender-v3.0-release' 2021-11-23 16:38:30 +01:00
70424195a8 Cycles: Fix possible access to non-initialized light sample in volume
Happened in barbershop file where number of bounces to the light was
reached.

Differential Revision: https://developer.blender.org/D13336
2021-11-23 16:38:15 +01:00
71c80bd939 Merge branch 'blender-v3.0-release' 2021-11-23 16:32:13 +01:00
2cbb9d7a76 Fix T93322: Freestyle Sinus Displacement Division by Zero Crash
This happens if the Wavelength is set to 0.0f.

Not sure if we really need a do_version patch for old files, as an
alternative we could also force a slight offset in the
SinusDisplacementShader. This patch does not do either, just force a
positive range from now on.

Maniphest Tasks: T93322

Differential Revision: https://developer.blender.org/D13329
2021-11-23 16:29:37 +01:00
b716a771b4 Merge branch 'blender-v3.0-release' 2021-11-23 15:46:28 +01:00
Sayak Biswas
3bb8d173e7 Fix T93109: Cycles HIP missing check for correct driver version
21.Q4 is required, older version should not show devices in the preferences.
This adds a check for the file version of amdhip64.dll file during hipew
initialization.

Differential Revision: https://developer.blender.org/D13324
2021-11-23 15:45:37 +01:00
fca8eb0185 Cleanup: Suppress clang-tidy warning. 2021-11-23 15:41:28 +01:00
2c2b79191f Merge branch 'blender-v3.0-release' 2021-11-23 15:41:09 +01:00
1a7c32a0ab Fix T93320: Freestyle LineStyleModifier blend 'Minimum' error
This was just a typo in {rBb408d8af31c9}
Must be 'MINIMUM' (instead of 'MININUM').

Maniphest Tasks: T93320

Differential Revision: https://developer.blender.org/D13328
2021-11-23 15:38:52 +01:00
4b13dcaf02 Merge branch 'blender-v3.0-release' 2021-11-23 15:35:09 +01:00
ceb25cbeba Fix compilation warnings when building without OpenImageDenoiser
Reported by Sybren, thanks!
2021-11-23 15:34:54 +01:00
8897e0aa8f Fix add-on Preferences using the .blend file icon, not the Blender logo
Intention of the icon is to mark add-ons that are official/bundled.
Doesn't make much sense to use the .blend file icon for that. It's
arguable if the Blender logo should be used for this, but the file icon
is definitely the wrong choice.
2021-11-23 15:30:28 +01:00
5efddc4347 Fix add-on Preferences using the .blend file icon, not the Blender logo
Intention of the icon is to mark add-ons that are official/bundled.
Doesn't make much sense to use the .blend file icon for that. It's
arguable if the Blender logo should be used for this, but the file icon
is definitely the wrong choice.
2021-11-23 15:30:05 +01:00
1df8abff25 Geometry Nodes: add namespace for every file
This puts all static functions in geometry node files into a new
namespace. This allows using unity build which can improve
compile times significantly (P2578).

* The name space name is derived from the file name. That makes
  it possible to write some tooling that checks the names later on.
  The file name extension (`cc`) is added to the namespace name as
  well. This also possibly simplifies tooling but also makes it more
  obvious that this namespace is specific to a file.
* In the register function of every node, I added a namespace alias
  `namespace file_ns = blender::nodes::node_geo_*_cc;`. This avoids
  some duplication of the file name and may also simplify tooling,
  because this line is easy to detect. The name `file_ns` stands for "file
  namespace" and also indicates that this namespace corresponds to
  the current file. In the beginning I used `node_ns` but `file_ns` is more
  generic which may make it more suitable when we want to use unity
  builds outside of the nodes modules in the future.
* Some node files contain code that is actually shared between
  different nodes. For now I left that code in the `blender::nodes`
  namespace and moved it to the top of the file (couldn't move it to
  the bottom in all cases, so I just moved it to the top everywhere).
  As a separate cleanup step, this shared code should actually be
  moved to a separate file.

Differential Revision: https://developer.blender.org/D13330
2021-11-23 14:56:01 +01:00
47276b8470 Geometry Nodes: reduce overhead when processing single values
Currently the geometry nodes evaluator always stores a field for every
type that supports it, even if it is just a single value. This results in a lot
of overhead when there are many sockets that just contain a single
value, which is often the case.

This introduces a new `ValueOrField<T>` type that is used by the geometry
nodes evaluator. Now a field will only be created when it is actually
necessary. See D13307 for more details. In extrem cases this can speed
up the evaluation 2-3x (those cases are probably never hit in practice
though, but it's good to get rid of unnecessary overhead nevertheless).

Differential Revision: https://developer.blender.org/D13307
2021-11-23 14:49:26 +01:00
0bedd5d14f Merge branch 'blender-v3.0-release' 2021-11-23 14:39:55 +01:00
436ce22194 Fix T93296: raycast node uses wrong domain for face corner attributes
This changes what domain is used by the raycast mode. This should fix the
behavior for face corner attributes (but may make it a bit slower for other
attributes). I think for 3.0 this is an acceptable trade off. For 3.1 we can do
what the comment suggests already.

Differential Revision: https://developer.blender.org/D13333
2021-11-23 14:38:02 +01:00
dab04bc053 Fix T93231: crash when overwriting vertex group with other domain
The problem was that we forgot to actually remove the vertex group when
it should be deleted. We only removed all the data that was attached to it.

Differential Revision: https://developer.blender.org/D13326
2021-11-23 14:38:02 +01:00
d7b7cbb047 Merge branch 'blender-v3.0-release' 2021-11-23 14:36:57 +01:00
0479a66313 Fix broken versionning after recent refactor of insertion in liboverrides.
rB33c5e7bcd5e5b79 doversion code was incorrectly dealing with 'insert in
first position' case from older blendfiles.

Specifically, a NULL anchor is valid (it means that the new item is the
first of the stored override data, and should be inserted at start of
the list).

Reported as part of T93321.
2021-11-23 14:36:40 +01:00
611e4ffaab Icons: Replace .blend file icons, add "Current File" icon
The Blender icon must not be used to refer to anything that is not
Blender itself. Using the Blender icon on its own to refer to .blend
files or the currently open file is a no-go, which was brought up by
Ton.

This does the following changes to the icon file:
* Add new "Current File" icon
* Change the .blend file icon to contain a file icon with the Blender
  logo, but not merely the Blender logo.
* Change the backup .blend file icon accordingly.

The new "Current File" icon is used in the Asset Browser, but
could/should be used in the Outliner as well. That needs more design
discussion though.
2021-11-23 14:32:35 +01:00
89b927a720 Cleanup: Silence compilation warning.
For now made DRW_notify_view_update_offscreen static.
2021-11-23 14:30:14 +01:00
fecdf9d44b Merge branch 'blender-v3.0-release'
Conflicts:
	source/blender/editors/transform/transform_generics.c
2021-11-23 10:17:24 -03:00
b7c98c87ac Cleanup: clang-tidy warnings
Silenciate warnings of usage of 'else' after 'return'
2021-11-23 10:15:00 -03:00
a6d1a2d3fc Merge branch 'blender-v3.0-release' 2021-11-23 14:08:53 +01:00
Christian Stolze
bba6fe83e2 Fix T89204: slow repeated rendering with GPUOffscreen.draw_view3d.
Reviewed By: fclem
Differential Revision: D13235
2021-11-23 14:08:38 +01:00
6ab3349bd4 Documentation: Remove deprecated glColor* from bgl module.
glColor isn't supported but still part of the documentation. This
patch removes the glColor from the documentation.

Ref {T93315}
2021-11-23 13:03:12 +01:00
cf299bee80 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-23 13:02:25 +01:00
3e65bb86f9 Cleanup: fix clang-tidy warnings
Fix clang-tidy warnings introduced by a recent commit on the release
branch.

No functional changes.
2021-11-23 13:02:00 +01:00
f392ce50c4 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-23 12:39:26 +01:00
cd2849c89b Asset Browser: add operator for installing asset bundles
Add an operator "Copy to Asset Library" for installing asset bundles
into already-existing asset libraries.

The operator is shown when:
- the "Current File" library is selected,
- the blend file name matches `*_bundle.blend`, and
- the file is not already located in an asset library.

The user can select a target asset library, then gets a "Save As"
dialogue box to select where in that library the file should be saved.
This allows for renaming, saving in a subdirectory, etc.

The Asset Catalogs from the asset bundle are merged into the target
asset library.

The operator will refuse to run when external files are referenced. This
is not done in its poll function, as it's quite an extensive operator
(it loops over all ID datablocks).

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D13312
2021-11-23 12:29:44 +01:00
605cdc4346 BKE LibLink/Append: Add mechanism for external code to loop over link/append context items.
Will be required for python's `bpy.data.libraries.load()` refactor.
2021-11-23 12:18:37 +01:00
0452a04f1a BKE link/append: Add optional blendfile handle to libraries.
This enables calling code to deal with the blendfile handle themselves,
BKE_blendfile_link then just borrows, uses this handle and does not
release it.

Needed e.g. for python's libcontext system to use new
BKE_blendfile_link_append code.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-23 12:17:16 +01:00
6c8f73b220 Cleanup: remove unnecessary "extern" 2021-11-23 12:05:50 +01:00
b9b98448a6 Cleanup: add missing pragma once 2021-11-23 12:00:11 +01:00
fbb4a7eb43 BKE link/append: Add optional blendfile handle to libraries.
This enables calling code to deal with the blendfile handle themselves,
BKE_blendfile_link then just borrows, uses this handle and does not
release it.

Needed e.g. for python's libcontext system to use new
BKE_blendfile_link_append code.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-23 10:38:51 +01:00
f657356062 Merge branch 'blender-v3.0-release' 2021-11-23 09:44:04 +01:00
b02ac2d8be Fix T93092: incomplete animation rendering of multi-layer exr composition
This was broken by rB0c3b215e7d5456878b155d13440864f49ad1f230.
The caching of loaded exr files needed some special treatment.

Differential Revision: https://developer.blender.org/D13313
2021-11-23 09:43:00 +01:00
84be741329 Fix T92654: missing padding in spreadsheet cells
This was probably broken by rB5c2330203e11e0d916960218b07d88d2193bf526.
For now just add the padding back in a spreadsheet specific way.

Differential Revision: https://developer.blender.org/D13315
2021-11-23 09:35:47 +01:00
6987060f70 Fix T93090: crash with data transfer modifier and geometry nodes
There was a missing normals layer that was requested by the data transfer
modifier from the target object. The normal layer was correctly added to
the target object. However, it never reached the data transfer modifier
because the mesh was copied in `BKE_object_get_evaluated_mesh`
(in the call to `get_mesh_for_write`) and the copy does not include the normals
layer.

The solution is to not use `get_mesh_for_write` here which was only used
because `BKE_object_get_evaluated_mesh` returns a non-const `Mesh *`.
Mid term, it should actually return a `const Mesh *` to avoid the confusion.

Differential Revision: https://developer.blender.org/D13319
2021-11-23 09:32:12 +01:00
28870a8f89 Cleanup: Use new CollectionRef::empty() method
Use the new CollectionRef::empty() method in all locations where
appropriate.

Differential Revision: https://developer.blender.org/D13276
2021-11-22 23:47:26 -08:00
59754ef0b2 Cleanup: silent clang-tidy warning NULL vs nullptr. 2021-11-23 08:39:26 +01:00
Peter Fog
34370d9fdf VSE: Add drag and drop handler for preview area
For some users, dropping assets into preview area may be more practical
due to space constraints or it may be just more intuitive.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13311
2021-11-23 05:40:08 +01:00
Peter Fog
b42494cf6b VSE: Support drag and drop for datablocks
For using the Outliner and/or the Asset Browser as scene independent
tools to organize a/v source material is necessary for the users to be
able to drag and drop data blocks into the VSE. This was also an
unfulfilled design target for the Outliner Gsoc project.

Datablocks won't be used directly. Path to file will be passed to strip
add operator instead.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13304
2021-11-23 05:39:10 +01:00
d1a4e043bd Merge branch 'blender-v3.0-release' 2021-11-23 00:57:15 +01:00
Sayak Biswas
f749506163 Fix T93244: Cycles HIP not working with multi GPU rendering
Use the correct device function (hipDeviceGet) for multi GPU setups, instead
of hipGetDevice which just returns the default device.

Differential Revision: https://developer.blender.org/D13323
2021-11-23 00:55:56 +01:00
8600d4491f Fix: Const warning in editmesh_knife.c
Fixes a warning caused by freeing a const pointer.
This commit removes the const modifier.

Differential Revision: https://developer.blender.org/D13321
2021-11-22 23:40:21 +01:00
456d5e14b8 Merge branch 'blender-v3.0-release' 2021-11-22 21:26:39 +01:00
481f032f5c Assets: Generate light preview when making light object an asset
We already supported previews for lights, just didn't actually use them
when making a light object an asset. They were only used when making the
light data itself an asset.
2021-11-22 21:14:11 +01:00
34615cd269 Fix grayed out preview generation button for light objects
Mistake in e7bea3fb6e.

We should only skip preview generation for objects that don't support
preview rendering, not completely forbid accessing preview data of such
IDs.
2021-11-22 21:12:36 +01:00
48c2b4012f Merge branch 'blender-v3.0-release' 2021-11-22 21:06:10 +01:00
29681f186e Fix T93283: Cycles render error with CUDA CPU + GPU after recent optimization
BVH2 triangle intersection was broken on the GPU since packed floats can't
be loaded directly into SSE. The better long term solution for performance
would be to build a BVH2 for GPU and Embree for CPU, similar to what we do
for OptiX.
2021-11-22 21:02:46 +01:00
e2b736aa40 Fix part of T93278: transparent glass option not working with environment pass 2021-11-22 20:58:09 +01:00
Takahiro Shizuki
73b1ad1920 IME: Fix Multi-Window Duplicated First Character
Fix problem with duplicated initial character when initiating or
switching to new windows. This is done by updating our copies of state
and modes from the new window when it receives WM_IME_SETCONTEXT
message. This problem and fix are only for the Windows platform.
2021-11-22 10:44:34 -08:00
bfff9ca5f1 Fix confusing new Cycles UI terminology
* Rename "Auto Tiles" to "Use Tiling", it's not really automatic and
  confusing with the old auto tile size add-on.
* Rename "Adaptive" scrambling distance to "Automatic", to avoid confusion
  with adaptive sampling.
2021-11-22 10:44:34 -08:00
Takahiro Shizuki
ee0277271c IME: Fix Multi-Window Duplicated First Character
Fix problem with duplicated initial character when initiating or
switching to new windows. This is done by updating our copies of state
and modes from the new window when it receives WM_IME_SETCONTEXT
message. This problem and fix are only for the Windows platform.
2021-11-22 10:41:11 -08:00
cc6bcb53b2 Geometry Nodes: Rename legacy node files
This will be useful to solve some issues with unity builds,
which compiles different files together to improve build times.
2021-11-22 13:16:54 -05:00
5ad4ca4e02 CurveEval: Add total_length() and total_control_point_size() methods
Add the following methods to the CurveEval class:
total_length() : returns the total length of the curve without needing to
                    allocate a new array
total_control_point_size() : returns the total number of control points without
                    needing to allocate a new array
2021-11-22 12:07:59 -06:00
8a84a61f6b Fix confusing new Cycles UI terminology
* Rename "Auto Tiles" to "Use Tiling", it's not really automatic and
  confusing with the old auto tile size add-on.
* Rename "Adaptive" scrambling distance to "Automatic", to avoid confusion
  with adaptive sampling.
2021-11-22 18:37:47 +01:00
0129178376 UI: Use a map for block name lookups
Use a map to speed up search for UI block names.
Time to redraw the node editor was decreased from
around 75-120ms to 40-70ms in a tree with many
Geometry Nodes.

Differential Revision: https://developer.blender.org/D13225
2021-11-22 18:23:54 +01:00
55c82d8380 Fix T84493 issue with selection after boolean.
According to Blender selection rules, selections should be flushed
to containing elements. Added an EDMB_select_flush() after edit
mode booleans or intersects are done. Hopefully this doesn't break
any scripts that might have been depending on the old (broken) behavior.
2021-11-22 11:47:46 -05:00
1706bf7780 Merge branch 'blender-v3.0-release' 2021-11-22 17:32:23 +01:00
336ca6796a Fix T90308: Cycles crash copying memory from device to host
Happens when device runs out of memory and Cycles is moving some
textures to the host memory.

The delayed memory free for OptiX BVH was moving data from one
device_memory to another, leaving the original device memory in
an invalid state. This was ruining the allocation map in the CUDA
device which is using pointer to the device_memory.

This change makes it so the memory pointer is stolen from BVH
into the delayed memory free list.

Additionally, forbid copying and moving instances of device_memory
and added sanity checks in the device implementation.

Differential Revision: https://developer.blender.org/D13316
2021-11-22 17:26:59 +01:00
25c83c217b Cleanup: Clang-format of the HIP device implementation 2021-11-22 17:26:52 +01:00
059da44fbc BKE Link/Append: Use BLO's LibraryLink_Params.
This allows to reduce signature of several functions, and make it eaiser
to integrate more higher-level usages later on.

This should be a non-behavioral-change commit.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-22 17:14:21 +01:00
d7cf7d4048 Link/Append: Move main linking code (from WM) to use new instantiation code in BKE.
This removes the last main usage of BLO's instantiation code.

Also required some limited refactoring of BKE_blendfile_link_append's
instantiation to make it more modular, and usable by both linking and
appending code paths.

NOTE: This should be a non-behavioral change commit.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.
2021-11-22 16:55:36 +01:00
fe274d91a1 Link/Append: Move most of core link/append code from WM to new BKE_blendflie_link_append module.
This will allow to expose all those advanced features of the WM
operators to other parts of the code, like the python library context
manager, copy/paste code, etc.

This is expected to be a strictly no-behavioral-change commit.

Part of T91414: Unify link/append between WM operators and BPY context
manager API, and cleanup usages of `BKE_library_make_local`.

Maniphest Tasks: T91414

Differential Revision: https://developer.blender.org/D13222
2021-11-22 16:52:17 +01:00
9c2a4d158c Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-22 16:47:50 +01:00
875f24352a Material Preview: Fix Sphere object (squared UV and poles)
A good sphere preview material has a 1:1 UV ratio (so we see squares as
least distorted as possible), as well as good poles.

Square UV:
The original sphere expected a 2:1 panorama to be mapped to it. This
patch changes that (I scaled Y by 0.5) so that square textures look ok.

Poles:
The original sphere had a low initial resolution, so no ammount of
subdivision would fix the poles.

The sphere has a subdivision modifier with 0 resolution. Later (3.1?) I
want to try to change the resolution on-the-fly based on whether the material
has a displacement map.

Old sphere (1.9K vertices):
{F11845752, size=500px}

New sphere (2.0K vertices):
{F11845710, size=500px}

Differential Revision: https://developer.blender.org/D13309
2021-11-22 16:46:49 +01:00
Jeroen Bakker
0624235900 Moviecache: Fix potential memory corruption.
`IMB_moviecache` is implemented as a singleton. When destructing the
singleton via `IMB_moviecache_destruct` it will not be created anymore
resulting inusage of unallocated memory and potentional memory
corruption.

When running blender this doesn't happen, but when creating images in
test cases the moviecache should be able to be recreated after it is
destroyed.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13287
2021-11-22 15:52:30 +01:00
be876b8db6 Painting: Performance curve masks.
This patch separates the static-part from the dynamic-part when
generate brush masks. This makes the generation of brush masks 2-5 times
faster depending on the size of the brush.

More improvements can be done, this was just low hanging fruit.
2021-11-22 15:36:03 +01:00
178947dec3 Merge branch 'blender-v3.0-release' 2021-11-22 09:34:51 -05:00
Henrik Dick
819b9bdfa1 Fix T92631: Fix negative thickness regression in complex solidify
This regression was introduced by D11832, but there was problems before
that as well. I seem to have missed it in review. See the differential
revision for a screenshot of the difference.

Differential Revision: https://developer.blender.org/D13216
2021-11-22 09:33:49 -05:00
77ddc6e350 Fix T93250: Crash in spreadsheet tree view after recent commit
It seems that update_from_old assumed there would be an old
tree view available in the old block. This works for the asset browser
because the tree is always drawn, but for the spreadsheet that depends
on having an active object, which isn't necessarily always true.

Differential Revision: https://developer.blender.org/D13301
2021-11-22 08:47:02 -05:00
7e8f9213e9 Merge branch 'blender-v3.0-release' 2021-11-22 13:49:37 +01:00
7b09213f2f Fix T93198: Frame Selected in greasepencil curve editing does not work
Was not taking into account curve points at all.

Maniphest Tasks: T93198

Differential Revision: https://developer.blender.org/D13281
2021-11-22 13:42:00 +01:00
9b6f3d2d0a Cleanup: Removed unused code in curve mask creation.
Generating curve mask for 2d texture painting had some hard-coded
parameters that eventually weren't used in the algorithm (hardness and
rotation of the brush). This patch removes these parameters.
2021-11-22 11:22:58 +01:00
9bbb5f5a6a Painting: migrated curve mask generation to CPP.
Curve mask generation is done during 2d texture painting. There are some
performance issues in this part of the code. Before addressing those we
move the code to CPP.
2021-11-22 10:46:33 +01:00
29f6ec56e6 Cleanup: Make parameter const (BKE_brush_curve_strength_clamped). 2021-11-22 10:46:33 +01:00
0b246ed813 Revert "Fix (unreported) broken handling of constraints reordering with liboverride."
This reverts commit 6eaa69c66c.

Committed by nistake, sorry for the noise.
2021-11-22 10:39:20 +01:00
31864a40ba Cleanup: use simple data member instead of callback
This really doesn't have to be a callback currently, since it is always
the same `CPPType` for a socket type.
2021-11-22 10:18:08 +01:00
c850189adf Cleanup: make naming more consistent 2021-11-22 09:48:36 +01:00
db20837c3a Merge branch 'blender-v3.0-release' 2021-11-22 09:32:59 +01:00
6c16bb2706 Fix broken NLA RNA code after own rBfa6a913ef19c.
Thanks to @scurest for noticing this mistake!
2021-11-22 09:31:59 +01:00
6eaa69c66c Fix (unreported) broken handling of constraints reordering with liboverride.
New drag&drop reordering code would call constraints reordering operator
with the generic context, and not the one from the panel's layout.
missing the "constraint" member which is mandatory for poll function to
properly deal with override vs. local constraints.

This commit fixes it by generating a temp bContextStore in the panel
re-ordering callback.

NOTE: this fix will have to be extended to modifiers (which happen to
work currently because they have an 'active' status), and gpencil
modifiers (which are also broken currently).

Differential Revision: https://developer.blender.org/D13291
2021-11-22 09:28:27 +01:00
fb470c256a Fix T93256: Instances to points node broken after recent commit
When 97533eede4 added the instance domain, it didn't change
the domain that instance attributes are read from in this node.
2021-11-21 11:37:35 -05:00
873f6148ad Functions: remove test for dynamic name
This was broken in rB6ee2abde82ef121cd6e927995053ac33afdbb438.
2021-11-21 13:08:23 +01:00
940e6525c7 Functions: fix compile error in tests 2021-11-21 13:06:05 +01:00
15011e0b70 Functions: use static string for parameter names
The idea behind this change is the same as in
rB6ee2abde82ef121cd6e927995053ac33afdbb438.

A `MultiFunction::debug_parameter_name` method could be
added separately when necessary.
2021-11-21 12:57:34 +01:00
6ee2abde82 Functions: use static names for multi-functions
Previously, the function names were stored in `std::string` and were often
created dynamically (especially when the function just output a constant).
This resulted in a lot of overhead.

Now the function name is just a `const char *` that should be statically
allocated. This is good enough for the majority of cases. If a multi-function
needs a more dynamic name, it can override the `MultiFunction::debug_name`
method.

In my test file with >400,000 simple math nodes, the execution time improves from
3s to 1s.
2021-11-21 12:48:07 +01:00
d455eadcd8 Cleanup: Move menu search template to C++
This allows the use of better/more readable data structures,
and will also make some refactors to the search button easier.
The build completed on the buildbot for all platforms.
2021-11-20 16:30:53 -05:00
b3ee9f44cf Merge branch 'blender-v3.0-release' 2021-11-20 18:00:46 +01:00
1b2ee3cf20 Fix T92090: Eevee crash with Intel HD 4000 and macOS 10.15.7
A recent security update to macOS 10.15.7 causes crashes when using Eevee and
various other 3D viewport features. It appears that glGenerateMipmap is
broken, causing a crash whenever its commands are flushed/submitted to the GPU.

Ideally this would be fixed in a driver update, however it's unlikely this will
happen. Earlier macOS versions have been receiving security updates for 2 years,
and that window has just passed for 10.15. Further, computers with these GPUs
can't upgrade to a newer macOS version.

As a workaround, disable mipmaps on these GPUs, by setting the mipmap max level
to 0 and not calling glGenerateMipmaps. Effects like depth of field also use
mipmaps, but fill in the mip levels by other means. In those cases we keep the
mipmap level.

Differential Revision: https://developer.blender.org/D13295
2021-11-20 17:50:05 +01:00
e949ac0bfc Cleanup: unset 'FILE_ENTRY_PREVIEW_LOADING' at the end
Although this function only runs on the main thread, it seems safer to
clear the flag only after setting the result.
2021-11-20 10:34:29 -03:00
59ffe1c5b1 Merge branch 'blender-v3.0-release' 2021-11-20 14:05:26 +01:00
Sayak Biswas
f2bb42a095 Fix T92984: Cycles HIP crash with smoke volumes
This fixes the the app crash happening when trying to render smoke as a dense
3D texture. The changes are related to matching up hipew with the actual HIP
headers.

Differential Revision: https://developer.blender.org/D13296
2021-11-20 14:02:38 +01:00
3d447b6335 Merge branch 'blender-v3.0-release' 2021-11-20 12:47:31 +01:00
b20997cb34 Fix T93194: greasepencil channel lists ignoring collection visibility
Same fix as rB0a3b4d4c64f1, but this time for greasepencil.

To repeat: dopesheet in greasepencil mode was ignoring the temporariy
visibility flag of collections. As a result, even though the dopesheet
was supposed to show animation data of visible greasepencils only was
still showing such data of greasepencils that were hidden by hiding
their collection.
2021-11-20 12:31:33 +01:00
3baaab15fc Cleanup: Else after return 2021-11-19 23:48:51 -05:00
411261fb32 Merge branch 'blender-v3.0-release' 2021-11-20 01:45:06 -03:00
092df87534 Fix error in rBfb0ea9
There is no need to multiply the "dash_width" by `UM.pixel size` since the "viewport_size" is already being divided by the DPI.

Ref {rBfb0ea9}
2021-11-20 01:44:35 -03:00
15ecd47b96 Geometry Nodes: Instance attributes in Transfer/Capture nodes
Updates the Transfer Attributes and Capture Attributes nodes
to support attributes from instances.

Differential Revision: https://developer.blender.org/D13292
2021-11-19 23:40:08 +01:00
01df48a983 Refactor: Port spreadsheet data set to UI tree view
This patch removes a bunch of specific code for drawing the spreadsheet
data set region, which was an overly specific solution for a generic UI.
Nowadays, the UI tree view API used for asset browser catalogs is a much
better way to implement this behavior.

To make this possible, the tree view API is extended in a few ways.
Collapsibility can now be turned off, and whether an item should
be active is moved to a separate virtual function.

The only visual change is that the items are now drawn in a box,
just like the asset catalog.

Differential Revision: https://developer.blender.org/D13198
2021-11-19 17:36:11 -05:00
a0780ad625 Fix: Exception in tree view code in new case
This isn't a problem in 3.0 or master, but I'm porting the spreadsheet
data set region to a tree view and ran into this. This line needs to
whether the function is empty before calling it.

Differential Revision: https://developer.blender.org/D13197
2021-11-19 17:28:08 -05:00
cfbc9df60e Cleanup: Use canonical variable name
All `ARegion` variables should be called `region` unless there is
a good reason not to, since that is the convention.
2021-11-19 16:10:37 -05:00
217d0a1524 Cleanup: Use vector instead of linked list 2021-11-19 15:57:31 -05:00
51a7961e09 Cleanup: Simplify node editor link dragging storage
Now that `node_intern.hh` is a C++ header, we can use C++ types
there. This patch replaces the linked list of dragged links with a
vector. Also, the list of drag operator custom data, `nldrag`, doesn't
seem to need to be a list at all, so I just made it a unique pointer.

Differential Revision: https://developer.blender.org/D13252
2021-11-19 15:36:32 -05:00
c3fed4d463 Merge branch 'blender-v3.0-release' 2021-11-19 16:57:33 -03:00
fb0ea94c63 Fix T85855: F-curves too thin on Mac
Use the `GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR` shader instead of `GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR`.
This is just a partial solution as "protected" fcurves still use the dashed shader.

Differential Revision: https://developer.blender.org/D13290
2021-11-19 16:57:05 -03:00
50ad0e15fe Merge branch 'blender-v3.0-release' 2021-11-19 19:24:55 +01:00
00e4d665f4 Fix T91838 Crash when toggling edit mode on object with geometry node modifier, but only if the instanced objects material has a normal map assigned.
This is only a workaround to avoid the crash. The underlying issue is left
unfixed.

New report for tracking the underlying issue is T93223.
2021-11-19 19:24:22 +01:00
fabd088067 Update splash for Blender 3.x development series
CC-BY Blender Studio https://studio.blender.org

Update the splash artwork for the daily builds (`master`) to
celebrate the beginning of a new major series in Blender.

The badges of the Development Fund membership levels have been removed for
a simpler design, and the font matches the one used elsewhere in blender.org
2021-11-19 18:39:14 +01:00
1222c45544 Fix: Use the instances domain in instance transform nodes
Instance attributes exist on the instance domain after rB97533eede44421,
so these fields should be evaluated on that domain.
2021-11-19 12:26:48 -05:00
ba8dd0f24f Spreadsheet: Support instances component viewer node columns
After rB97533eede444217b, instances have their own attribute domain,
but the spreadsheet code worked under the assumption that the component
used the point domain. Old files have to re-select the instances data
source to make it properly active
2021-11-19 12:21:54 -05:00
06a2e2b28c Merge branch 'blender-v3.0-release' 2021-11-19 18:05:17 +01:00
ef687bd7c2 Merge branch 'blender-v3.0-release' 2021-11-19 12:00:35 -05:00
97533eede4 Geometry Nodes: Support custom instance attributes
Adds an attribute provider for instance attributes.
A new domain `ATTR_DOMAIN_INSTANCE` is implemented.
Instance attributes are not yet realized correctly.

Differential Revision: D13149
2021-11-19 17:53:48 +01:00
1b686c60b5 Fix T93046: Cycles world volume rendering very slow in OptiX with some scenes
With very long ray distance, OptiX ends up traversing many BVH nodes due to
a feature that improves precision. However this causes very slow rendering.

We now avoid generating such long rays by rejecting the few samples that have
long ray distances and very low probability of being generated. This should not
meaningfully affect render results.

Thanks to Sergey and Patrick for the investigation.
2021-11-19 17:42:22 +01:00
0f1a200a67 Fix T92682: EEVEE motion blur crash with curve objects
After rBb9febb54a492, the evaluated mesh from a curve is now presented
to render engines as a separate mesh object, but some code still assumed
that a curve object itself could have an evaluated mesh. However, this is
still true for surface objects and metaballs, which don't
use geometry sets yet.

Differential Revision: https://developer.blender.org/D13272
2021-11-19 11:36:29 -05:00
9e3a913b35 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-19 16:39:28 +01:00
1a1ddcb5e2 Asset Browser: don't display linked-in asset datablocks
Datablocks marked as asset, linked from another file, were shown in the
"Current File" asset library. This is now resolved.
2021-11-19 16:29:25 +01:00
ec71054a9b Merge branch 'blender-v3.0-release'
Conflicts:
	source/blender/blenkernel/BKE_blender_version.h
	source/blender/blenloader/intern/versioning_300.c
2021-11-19 16:10:28 +01:00
06ead314b6 Asset Preferences: disallow single file as asset library
Asset libraries should be directories on disk. By manually entering a
file path it was possible to have a single blend file as asset library,
but that was not a designed-for situation, and it doesn't play well
with the asset catalog system.
2021-11-19 16:08:55 +01:00
330290d2a8 Cleanup: typos in comments 2021-11-19 15:55:47 +01:00
33c5e7bcd5 LibOverrides: Refactor how diffing of RNA collections is handled.
Original implementation was a quick prototype which should have never
landed as-is in master. It had very limiting constraints and did not
allow for any real further development.

This commit fixes the internal implementation to make more sensible,
maintainable and evolutive.

NOTE: This commit introduces another forward-incompatibility in the
Blender file format: Files saved after this commit won't open properly
in older versions of blender regarding local inserted constraints or
modifiers into overrides of linked data.

NOTE: Technical details: The 'anchor' item name/index is now stored in
`subitem_reference_` members, and the actual 'source' item name/index is
stored in `subitem_local_` members of the override property operation
data.
Previously, only the `subitem_local_` members were used, storing the
anchor item name/index, and assuming the 'source' item was always the
next in the list.

Milestone I of T82160.

Maniphest Tasks: T82160

Differential Revision: https://developer.blender.org/D13282
2021-11-19 15:41:53 +01:00
d6ea881a74 BLI_listbase: Add utils to search from string or index.
If a valid matching string is found, return that item, otherwise
fallback to the item matching the given index, if any.

This will be useful in RNA override code, and potentially other
areas where data in lists can be referenced by their names or indices.
2021-11-19 15:41:36 +01:00
d7aaa145c6 Merge branch 'blender-v3.0-release' 2021-11-19 15:30:54 +01:00
04ec36f677 Fix T87912: use session id instead of name to identify dropped object
The old code did not work when there were multiple ids with
the same name (which can happen when ids are linked in).
The solution is to use the session ids instead. Those are different
even when two ids have the same name.

Differential Revision: https://developer.blender.org/D11116
2021-11-19 15:28:44 +01:00
0852805ed7 Merge branch 'blender-v3.0-release' 2021-11-19 15:58:37 +02:00
a20e703d1a Fix T93184: Link color not used for custom sockets
D13044 allowed the link color overlay to be used with custom sockets.
This no longer works due to a condition that checks if the socket is
standard or not, which was in place to avoid bad indexing of the
std_node_socket_colors array. Since that array is no longer used, this
condition needs to be removed.

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

Reviewed By: Hans Goudey
2021-11-19 15:55:58 +02:00
06691d1b21 Tests: disable Cycles volume test when WITH_MOD_FLUID is off 2021-11-19 13:21:48 +01:00
1b94c53aa6 Cleanup: fix typos in comments and docs
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D10447
2021-11-19 13:02:16 +01:00
7d5ef64bfb Cleanup: fix typos in comments and docs
Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D13264
2021-11-19 12:46:49 +01:00
fa6a913ef1 LibOverride: Add read-only flags accessors for 'local override' status.
Constraints, modifiers and NLA tracks can now report from RNA whether
they are defined as comming from the override's reference linked data,
or are local to the override.
2021-11-19 12:09:28 +01:00
83e245023c Fix (unreported) wrong behavior of constraints in liboverrides.
All constraints were 'made local', including the ones comming from the
reference linked object.
2021-11-19 12:09:28 +01:00
eb071c9ff4 Merge branch 'blender-v3.0-release' 2021-11-19 10:16:30 +01:00
de3fda29c7 Fix T93054: crash when deleting a missed linked file
This is a bit similar to rBb7260ca4c9f4b7618c9c214f1270e31d6ed9886b.
Sometimes a group node may not reference a node group
because it was linked and can't be found.
2021-11-19 10:15:58 +01:00
48e64a5fb5 Merge branch 'blender-v3.0-release' 2021-11-19 10:09:29 +01:00
4ea6b4ba84 Fix crash in VSE versioning code from recent commit
Caused by {rB4d09a692e22a}.
Greenlit by @sergey in chat.
2021-11-19 10:05:18 +01:00
992634427e Nodes: add bf_nodes_geometry library
Separating geometry nodes into a new library will make it
easier to improve compile times with features like unity
builds and precompiled headers.

Differential Revision: https://developer.blender.org/D13261
2021-11-19 09:09:14 +01:00
b8dc845e57 Merge branch 'blender-v3.0-release' 2021-11-19 06:22:47 +01:00
4d09a692e2 Fix T92847: Meta-strip corrupt
Offsets for meta strip were invalid. No steps to reproduce the issue are
available, but it is quite possible that there are files with incorrect
state after issues with meta strips were fixed.

Ensure correct offsets for meta strips in versioning code.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13257
2021-11-19 06:12:09 +01:00
5ed3a5d023 Cleanup: Add an empty() method to RNA's CollectionRef class
The existing RNA CollectionRef class only offers a length() operation
which is sometimes used for checking if the collection is empty. This is
inefficient for certain collection types which do not have a native
length member; the entire list is iterated to find the count.

This patch creates an explicit empty() method to be used in such cases
for better semantics. Additionally, many collection types will behave
more efficiently when using the new method instead of checking length.

Making use of the new method will follow separately.

Differential Revision: https://developer.blender.org/D12314
2021-11-18 14:32:56 -08:00
3f288e9414 Node Editor: Change minimum zoom
Now with Geometry Nodes in Blender,
trees can become much bigger than before.
This changes the minimum zoom value in the node editor.

Differential Revision: https://developer.blender.org/D13254
2021-11-18 21:24:55 +01:00
b2d37c35d0 Node Editor: Skip socket drawing on low zoom
Socket drawing can be heavy with many nodes.
This patch skips drawing them on scale < 0.2
when they are barely visible anyway.

Differential Revision: https://developer.blender.org/D13255
2021-11-18 21:21:10 +01:00
167ee8f2c7 Merge branch 'blender-v3.0-release' 2021-11-18 19:37:48 +01:00
fd2a155d06 Fix T91797: Cycles volume rendering artifact with overlapping volumes
With the new volume rendering code this was no longer accurate, we always
need to use a new dimension for the next volume segment.
2021-11-18 19:27:37 +01:00
f190f2d267 Revert fixes 2021-11-18 14:19:59 -03:00
0c33411bdd Revert "Revert "Revert "Revert "Allow navigating while transforming""""
This reverts commit 717a971035.
2021-11-18 14:15:08 -03:00
ea42c1a22e Revert "Revert "Revert "Revert "Adjust snap source drawing when adding multiple snap points""""
This reverts commit b8bf40ed4b.
2021-11-18 14:14:57 -03:00
f61a73093b Revert "Revert "Revert "Revert "Transform: interactive mode for editing a 'Snap Source'""""
This reverts commit 701f2dfd5b.
2021-11-18 14:14:51 -03:00
ada6742601 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-18 17:58:26 +01:00
701f2dfd5b Revert "Revert "Revert "Transform: interactive mode for editing a 'Snap Source'"""
This reverts commit 25fa6c74b9.
2021-11-18 13:55:24 -03:00
b8bf40ed4b Revert "Revert "Revert "Adjust snap source drawing when adding multiple snap points"""
This reverts commit c7f9a782aa.
2021-11-18 13:55:21 -03:00
717a971035 Revert "Revert "Revert "Allow navigating while transforming"""
This reverts commit 2a9cfdac7e.
2021-11-18 13:55:17 -03:00
Germano Cavalcante
2a9cfdac7e Revert "Revert "Allow navigating while transforming""
This reverts commit 5e6fdaa07f.
2021-11-18 13:52:39 -03:00
c7f9a782aa Revert "Revert "Adjust snap source drawing when adding multiple snap points""
This reverts commit 77df32548b.
2021-11-18 13:52:30 -03:00
Germano Cavalcante
25fa6c74b9 Revert "Revert "Transform: interactive mode for editing a 'Snap Source'""
This reverts commit 805181bffa.
2021-11-18 13:52:18 -03:00
7c4e4d605c Pose Library: clarify apply/blend operator names
The old names had "{verb} Pose Library Pose"; they are now named
"{verb} Pose Asset", which is shorter & clearer.
2021-11-18 17:52:17 +01:00
3531021d1b Cleanup: Simplify declarations in C++ header
Using `struct` everywhere is unnecessary in C++, and the typedefs
are also unnecessary.
2021-11-18 11:46:44 -05:00
12fc395436 Fix T93152: Cycles baking multiple selected object to active not working 2021-11-18 17:43:27 +01:00
Germano Cavalcante
805181bffa Revert "Transform: interactive mode for editing a 'Snap Source'"
This reverts commit f19bd637e2.
2021-11-18 13:42:45 -03:00
77df32548b Revert "Adjust snap source drawing when adding multiple snap points"
This reverts commit cb3ba68ec4.
2021-11-18 13:42:36 -03:00
Germano Cavalcante
5e6fdaa07f Revert "Allow navigating while transforming"
This reverts commit 1d1855e95f.
2021-11-18 13:42:31 -03:00
Germano Cavalcante
1d1855e95f Allow navigating while transforming
This feature has been desired for some time:
- https://rightclickselect.com/p/ui/Tqbbbc/allow-navigating-while-transforming (See comments);
- D1583;
- T37427;

In short, blocking navigation during transform limits the user to move the object only to visible areas within the screen and hinders the allocation of objects within closed meshes.

The node editor is also impaired because some nodes are far between them and the connectors are too small.

The only disadvantage of this patch (as I see it) is the conflict with the existing key map:
MIDDLEMOUSE:
- enable axis constrain in 3D view;

WHEELDOWNMOUSE, WHEELUPMOUSE, PAGEUPKEY, PAGEDOWNKEY:
- change the threshold of the proportional edit;

So the patch solution was to change these keymaps:
- MIDDLEMOUSE to Alt+MIDDLEMOUSE;
- WHEELDOWNMOUSE, WHEELUPMOUSE, PAGEUPKEY, PAGEDOWNKEY to Alt+(corresponding key);

When you use this new keymap for the first time in the proportional edit, it may seem strange due to the custom of using it (both in View2D and View3D).
But quickly the user gets used to it.

Alternatively we can add an option to the user preferences ([] Allow navigating while transforming). (I'm not much fan of this option).

The patch was done on branch2.8. But maybe it's a good idea to apply it to 2.79

Differential Revision: https://developer.blender.org/D2624
2021-11-18 13:14:18 -03:00
cb3ba68ec4 Adjust snap source drawing when adding multiple snap points 2021-11-18 13:14:18 -03:00
Germano Cavalcante
f19bd637e2 Transform: interactive mode for editing a 'Snap Source'
This patch implements part of what was stated in {T66484}, with respect to `Base Point`.

## Introduction

The snapping feature of the transform tools has a variety of applications:
- Organization of nodes.
- Positioning of frames in precise time units.
- Retopology with snap to face
- Creation of armatures with bone positioning through the snap to volume
- Precise positioning of 3D or 2D objects in the surrounding geometry (CAD modeling)

The goal of this document is to make it more powerful for precision modeling and still supporting the old use cases without extra complexity.
The main topic addressed here is the introduction of a **interactive mode for setting a snap source** (See terminology).

## Terminology

* **Snap Source**: 3d coordinate * we want to snap from. (Currently defined by the `Snap With` options: `Closest`, `Center`, `Median` and `Active`).
* **Snap Target**: 3d coordinate*  we want to snap to. (Vertices, Edges, Faces, Grid...)

## Interactive Mode for Editing a Snap Source

Currently the fixed snap point can only be obtained through the `Snap With` options. So it's a little tricky for the user to define a snap source point having so much geometry on an object.
Because of this, the user needs to resort to impractical solutions to get a point in the geometry.
See example of an impractical use:
{F11714181, layout=left, width=960, alt="The user used the cursor (which can be snapped) to choose the snap origin point."}
The user used the cursor (which can be snapped) to choose the snap source point.

While it is possible to work around this current limitation, it is important to reduce the number of steps and allow the user to set a snap source point through an optional interactive mode during a transformation.

The proposed solution is to be able to move the current snap source point through a modal modifier activated with a key (eg. B).
The snap source point can thus "snap" to the elements in the scene (vertex, mid-edge, Lamp, …) during this mode.
{F9122814, layout=left, width=960, alt="Base Point Snap, example of transform operation via the shortcut (not the tool). After pressing g and the snap base change shortcut (e.g., shift + ctrl) the user set the base point. The base point is then visible until the end of the operation. The z axis constrains the final position."}

## Implementation Details

- The feature will only be available in 3D View.
- The feature will only be available for `Move`, `Rotate` and `Scale` transform modes.
- The snap source editing will be enabled with a single click on the modifier key (B).
- Having a snap point indicated, the new snap origin point will be confirmed with the same buttons that confirms the transformation (but the transformation will not be concluded).
- The snap source editing can be canceled with the same key that activated it (B).
- If the transformation is done with "release_confirm" (common for gizmos), the new feature cannot be enabled.
- During the transformation, when enabling the feature, if the snap option is turned off in the scene, the snap will be forced on throughout the rest of the transformation (unless interactive mode is canceled).
- During a transformation, if no snap target is set for an element in the scene (Vertex, Grid...), the snap targets to geometry Vertex, Edge, Face, Center of Edge and Perpendicular of Edge will be set automatically.
- Snap cannot be turned off during the snap source editing.
- Constraint or similar modification features will not be available during the snap source editing.
- Text input will not be available during the snap source editing.
- When adding multiple snap points (A) the new prone snap source point will be indicated with an "X" drawing.
{F11817267}

Maniphest Tasks: T66484

Differential Revision: https://developer.blender.org/D9415
2021-11-18 13:14:18 -03:00
f0be276514 Fix T93082: Cycles baking not handling transparency correctly
For baking, replace transparent BSDF with holdout for baking. This ensure no
objects behind are baked, and that the baked image has alpha.
2021-11-18 17:13:16 +01:00
ed91e759d1 Fix Cryptomatte accurate option showing for Cycles, only needed for Eevee 2021-11-18 17:13:16 +01:00
67b4eecac9 Cleanup: Use const arguments 2021-11-18 11:03:18 -05:00
Nikhil Shringarpurey
dd31b8bd50 UI: Use full word "Start" instead of "Sta"
Differential Revision: https://developer.blender.org/D13098
2021-11-18 10:45:10 -05:00
5816eb4c56 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-18 16:36:11 +01:00
8d1357ea6b Pose Library: add conversion button to old poselib UI
Add the "Convert Old Pose Library" operator to the old pose library (in
the Armature properties editor). This makes it more discoverable; before
it only was available in the Action editor.
2021-11-18 16:35:56 +01:00
beb9e332ca Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-18 16:21:17 +01:00
31afa1bb9a Asset tags: include partial tag matches
When filtering the asset browser, also include results that have partial
tag matches. So searching for "xite" will include results tagged with
"excited".

This brings the tag filtering in line with other search boxes in
Blender. Later we might want to provide users with more options for
prefix-only ("excite" would match "excited", but "xited" would not) or
only exact matches.
2021-11-18 16:21:00 +01:00
0624acf088 Fix T92442: undo removal of Eevee cryptomatte accurate mode option
The Cycles accurate mode was removed, but the Eevee option for this has
a different meaning and should not have been removed. The Eevee accurate
makes cryptomatte accumulate for every sample, which Cycles has always
done regardless of any option.
2021-11-18 15:59:08 +01:00
b926f54f3c Fix: error when materializing curve point attribute
Differential Revision: https://developer.blender.org/D13271
2021-11-18 15:28:04 +01:00
d1f944c186 Cycles: declare constants at program scope on Metal
MSL requires that constant address space literals be declared at program
scope. This patch moves the `blackbody_table_r/g/b` and `cie_colour_match`
constants into separate files so they can be declared at the appropriate scope.

Ref T92212

Differential Revision: https://developer.blender.org/D13241
2021-11-18 14:38:05 +01:00
d19e35873f Cycles: several small fixes and additions for MSL
This patch contains many small leftover fixes and additions that are
required for Metal-enablement:

- Address space fixes and a few other small compile fixes
- Addition of missing functionality to the Metal adapter headers
- Addition of various scattered `__KERNEL_METAL__` blocks (e.g. for
  atomic support & maths functions)

Ref T92212

Differential Revision: https://developer.blender.org/D13263
2021-11-18 14:38:02 +01:00
c0d52db783 Merge branch 'blender-v3.0-release' 2021-11-18 14:33:43 +01:00
f71813204c Cycles: Don't tile if image area fits into tile area
Previously the check was done based on dimension of image and if any
of dimensions were larger than tile size tiling was used.

This change makes it so that if image does not exceed number of pixels
in the tile no tile will be used. Allows to render widescreen images
without tiling.

Differential Revision: https://developer.blender.org/D13206
2021-11-18 14:27:45 +01:00
3ad2bf1327 Cycles: Fix command line render overshooting time limit
The calculation based on preserving device occupancy was conflicting
with the fact that time limit needs to render less samples at the last
round of render work.

For example, rendering BMW27 for 30sec on i9-11900k was actually
rendering for almost a minute. Now the render time limit is respected
much more close.

Differential Revision: https://developer.blender.org/D13269
2021-11-18 14:27:45 +01:00
bd2e3bb7bd Fix T93045: Cycles HIP not rendering OpenVDB volumes
Build HIP kernels with NanoVDB, and patch NanoVDB to work with HIP.

This is a header only library so no rebuild is needed. The changes are being
submitted upstream to openvdb, so this patch should be temporary.

Thanks Thomas for help testing this.
2021-11-18 13:24:56 +01:00
2b63a76041 Merge branch 'blender-v3.0-release' 2021-11-18 11:53:46 +01:00
e5774282b9 Fix asset preview not showing up for current file data-blocks
For data-blocks from the current file, the image-buffer for dragging
wasn't set at all. This wasn't intentional, dragging things in the Asset
Browser should just always show the preview.
2021-11-18 11:47:21 +01:00
William Leeson
e1a3b697ec Merge branch 'blender-v3.0-release' to pick up D13262. 2021-11-18 09:41:11 +01:00
William Leeson
8c0370ef7b Fix T93102: Principled hair shader stack was built incorrectly
stack_assign_if was used in the middle of creating the shader value blocks.
Which caused stack variables to be inserted in the middle of the shader value data.
This resulted in the shader node data no being in sequential order. This was also
the case for the wave texture wave node.

Reviewed By: brecht

Maniphest Tasks: T93102

Differential Revision: https://developer.blender.org/D13262
2021-11-18 09:31:29 +01:00
Félix
9cf3d841a8 VSE: Add meta.separate() Python API function
This function can be used to "dissolve" meta strip anywhere in strip
hierarchy. This has same effect as `meta_separate` operator.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/T91005
2021-11-18 03:55:48 +01:00
f1f7a8b018 Merge branch 'blender-v3.0-release' 2021-11-18 03:03:13 +01:00
a182b05f07 Fix T90390: VSE Jump operator don't work during playback
Tag dependency graph `ID_RECALC_AUDIO_SEEK` update.
2021-11-18 02:59:50 +01:00
032ab0270d Merge branch 'blender-v3.0-release' 2021-11-18 02:23:17 +01:00
Andrea Beconcini
daaa43232d Fix T92445: Thumbnail height without overlay text
This patch changes the thumbnails' height used for image and movie
strips by choosing the proper size according to the VSE's text overlay
settings: i.e. thumbnails use the whole strip's height when no overlay
text is displayed; otherwise, some space is left for the overlay.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13043
2021-11-18 02:14:11 +01:00
ceec400975 Merge branch 'blender-v3.0-release' 2021-11-18 01:40:37 +01:00
d8fd575af9 Fix T93154: Crash adding multiple movie strips
Some when adding multiple movies at once and only some of them have
audio track, this causes crash on NULL dereference. Issue was introduced
in bdbc7e12a0 to align sound and video properly.

Check if sound is present in movie file. If it's not, don't try to align
sound with video.
2021-11-18 01:32:06 +01:00
d6b5251572 Merge branch 'blender-v3.0-release' 2021-11-18 01:13:22 +01:00
b071083496 Fix T93166: Division by zero when drawing thumbnails
Caused by incorrect step calculation fo too short strips. For these,
step should be equal to strip length not 0.
2021-11-18 01:11:51 +01:00
fa7a6d67a8 Fix Cycles CUDA/HIP compiler error after recent changes 2021-11-17 19:56:18 +01:00
Sebastian Herholz
d9bc8f189c Cycles: add build option to enable a debugging feature for MIS
This patch adds a CMake option "WITH_CYCLES_DEBUG" which builds cycles with
a feature that allows debugging/selecting the direct-light sampling strategy.
The same option may later be used to add other debugging features that could
affect performance in release builds.

The three options are:
* Forward path tracing (e.g., via BSDF or phase function)
* Next-event estimation
* Multiple importance sampling combination of the previous two methods

Such a feature is useful for debugging light different sampling, evaluation,
and pdf methods (e.g., for light sources and BSDFs).

Differential Revision: https://developer.blender.org/D13152
2021-11-17 18:03:56 +01:00
063ad8635e Cycles: reduce triangle memory usage with packed_float3
Depends on D13243

Differential Revision: https://developer.blender.org/D13244
2021-11-17 17:29:41 +01:00
9937d5379c Cycles: add packed_float3 type for storage
Introduce a packed_float3 type for smaller storage that is exactly 3
floats, instead of 4. For computation float3 is still used since it can
use SIMD instructions.

Ref T92212

Differential Revision: https://developer.blender.org/D13243
2021-11-17 17:29:41 +01:00
89d5714d8f Build: match GCC and Clang float conversion warnings in Cycles 2021-11-17 17:29:41 +01:00
ea7efa5569 Merge branch 'blender-v3.0-release' 2021-11-17 15:41:32 +01:00
00a9617f92 Fix: wrong assert in geometry nodes evaluator
It only makes sense to check if all required outputs have been computed
if the node was executed at all.
2021-11-17 15:40:53 +01:00
c3422c48ad Cleanup: remove dummy multi function 2021-11-17 12:33:18 +01:00
e5f05bc7a6 Cleanup: Painting - reduce reallocation of same memory.
Curve mask is freed/allocated every time, but could still reuse the
previous allocated buffer when the diameter of the brush doesn't change.
2021-11-17 12:30:42 +01:00
f5dde382af Cleanup: use same function for updating internal links for all nodes
Previously, node types had a callback that creates internal links. Pretty
much all nodes used the same callback though. The exceptions are the
reroute node (which probably shouldn't be mutable anyway) and some
input/output nodes that are not mutable.

Removing the callback helps with D13246, because it makes it easier
to reason about which internal links are created and when they change.
In the future, the internal links should be part of the node declaration.
2021-11-17 11:52:54 +01:00
83a4d51997 Cleanup: Remove unused show_samples() device code in Cycles. 2021-11-17 11:16:48 +01:00
c2ab47e729 Cleanup: change node socket availability in a single place
This cleans up part of the code that still set the flag manually. Also, this
change helps with D13246 because it makes it easier to tag the node
tree as changed when the availability of a socket changed.
2021-11-17 11:11:28 +01:00
51b8e34fb7 LineArt: Improve certain edge cases in occlusion
This patch includes:
View vector fix for ortho back face.
Point on segment logic correction.
Better handling of boundary cases.

See review page for detailed description.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D13143
2021-11-17 14:31:12 +08:00
473be239c3 LineArt: Improve certain edge cases in occlusion
This patch includes:
View vector fix for ortho back face.
Point on segment logic correction.
Better handling of boundary cases.

See review page for detailed description.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D13143
2021-11-17 14:30:08 +08:00
e3c974b7e4 Merge branch 'blender-v3.0-release' 2021-11-17 05:43:34 +01:00
6e6123b40f Fix T93080: Crash on scrubbing with snapping
Sequencer wasn't initialized, snapping crashed on NULL dereference.
Add Null check.
2021-11-17 05:40:25 +01:00
ecad33f214 UI: Use ampersand instad of 'and' in labels
- When and is used in labels use ampsand
- When used in description use 'and'
2021-11-16 21:38:03 -05:00
61bffa565e Fix T90412: Inconsistency in mask strip color
This seems to be oversight in 271231f58e where strip color was
defined only for light theme.
2021-11-17 03:27:13 +01:00
f72dc00569 Merge branch 'blender-v3.0-release' 2021-11-17 03:12:19 +01:00
9bdf3fa5f0 Fix T91724: Strip height is too limited
This change was introduced in 997b5fe45d, to not display pixelated
thumbnails. However when VSE timeline height is made smaller, this
limits strip height.

Change limit, so one strip can occupy full height of VSE timeline
2021-11-17 02:45:53 +01:00
4c988eb3e1 Fix error with makefiles compilation
Use 'template' keyword to treat 'is' as a dependent template name
2021-11-16 20:46:33 -03:00
luzpaz
dea26253a0 cleanup: fix typos in comments and docs
Followup to https://developer.blender.org/D10288

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D10346
2021-11-16 18:45:10 -05:00
8290edefad Cleanup: Use bool instead of int 2021-11-16 17:20:31 -06:00
2f39b45e8c Merge branch 'blender-v3.0-release' 2021-11-16 17:50:24 -05:00
f829b86039 Cleanup: Correct copy paste error in comment
Mistake from rB2743d746ea4f38c098512f6dd6fc33d5a62429d3
2021-11-16 17:49:51 -05:00
93f26d652e Merge branch 'blender-v3.0-release' 2021-11-16 23:21:13 +01:00
fbf4fe6963 Fix missing Cycles implicit float/double conversion error with Clang
Since these are errors with GCC and Visual Studio.
2021-11-16 23:18:25 +01:00
1e4d1eb398 Fix another Linux build error with double and float comparison 2021-11-16 23:12:50 +01:00
59da22c309 Merge branch 'blender-v3.0-release' 2021-11-16 22:40:08 +01:00
b496c1c721 Cleanup: compiler warnings 2021-11-16 22:29:50 +01:00
3189171a94 Fix build error with strict double to float conversion 2021-11-16 22:25:24 +01:00
cf83719761 Geometry Nodes: Small improvements to object info node
This commit contains a few mostly-related changes to this node:
 -  Add a warning when retrieving the geometry from the modifier object.
 - Only create the output geometry when it is necessary.
 - Decompose transform matrices in a more friendly way.
 - Use default return callbacks like other newer nodes.

Differential Revision: https://developer.blender.org/D13232
2021-11-16 15:09:00 -06:00
c9fb08e075 Merge branch 'blender-v3.0-release' 2021-11-16 14:55:13 -06:00
f30e1fd2f0 Fix T93085: Incorrect geometry nodes modifier warning
It's valid for a node group connected to the modifier not to
have a geometry input, but I didn't consider that case
with the last change I made here, f3bdabbe24.

Differential Revision: https://developer.blender.org/D13231
2021-11-16 14:51:03 -06:00
25d30e6c99 Fix T92857: Deadlock in geometry nodes curve multi-threading
The spline code, especially Bezier splines, often make use of lazily
evaluation and caching. In order to do that, they use mutex locks.
When multi-threading, this can lead to problems. Further detail
can be found in rBfcc844f8fbd0d1.

To fix the deadlock, isolate the task before multi-threading
when holding a lock.

Differential Revision: https://developer.blender.org/D13229
2021-11-16 14:49:58 -06:00
cfd0e96e47 Fix T93125: Cycles wrong remaining render time with high number of samples
Avoid integer overflow.
2021-11-16 20:49:32 +01:00
7293c1b357 Fix T93106: Cycles SSS not working with normals pointing inside 2021-11-16 19:44:45 +01:00
Germano Cavalcante
9d7422b817 File Browser: Improve usage of threads in the creation of thumbnails
Due to asynchronous process, the preview for a given image may be
generated several times.

This regenerates many thumbs unnecessarily.

The solution is to add the `FILE_ENTRY_PREVIEW_LOADING` flag for file
entries that are still in the thread queue.

So this flag is checked not to redraw the thumb when it is still being
created on a different thread.

Differential Revision: https://developer.blender.org/D11150
2021-11-16 14:10:24 -03:00
917218269e Merge branch 'blender-v3.0-release' 2021-11-16 13:59:28 -03:00
1572c4d3d3 Fix T93011: Individual origins being used when pivot point is override
There should be a special `t->around` for this case, but for now let's
just avoid having the individual origins overlap.
2021-11-16 13:56:11 -03:00
bd37553850 Cleanup: better delimit member initialization
The initialization of `t->around` and `t->view` was scattered and with
duplicate code
2021-11-16 13:55:30 -03:00
0335df9384 Transform: better contextualize the status bar
`Remove Last Snap Point` should only be displayed when there is a Snap Point to be removed.
2021-11-16 13:39:10 -03:00
ba6427adfa Merge branch 'blender-v3.0-release' 2021-11-16 17:25:48 +01:00
b3529ecf0e Fix CUDA error when using tiny border in viewport
Need to clamp scaled render buffers window to be above zero
when applying resolution divider.
2021-11-16 17:25:18 +01:00
72ee62e0da Fix crash on freeing hair system
Fix a crash when a hair system's `ParticleSettings` ID datablock was
linked from another file but couldn't be found. This results in default
settings, with `type = PART_EMITTER`, where the particle data still has
a non-NULL `hair` pointer. Previously, copies of such a particle system
would NOT copy hair data for non-hair particle systems, hence the
pointer of the copy pointed to the original data, which got freed (at
least) twice upon closing the blend file.

This is now fixed by always copying the hair data, regardless of the
particle system type.

Reviewed by: mont29

Differential Revision: https://developer.blender.org/D13245
2021-11-16 17:18:01 +01:00
bee7a56687 Cleanup: document that MEM_dupallocN is NULL-safe
Add comment explaining `MEM_dupallocN` is NULL-safe, in that it returns
NULL when it receives a NULL pointer. This is currently true for both
implementations of the function (`MEM_lockfree_dupallocN` and
`MEM_guarded_dupallocN`), and will be expected of other implementations
as well.

No functional changes.
2021-11-16 17:11:45 +01:00
07af45eec5 Asset Browser: hide catalog debug info behind debug option
Add a new "experimental" debug option `show_asset_debug_info`, and use
that to determine the visibility of the active asset's catalog UUID and
simple name. Previously this was only determined by the "Developer
Extras" option, which meant it was visible in too many situations. It's
not really a "developer extra", and really just a debugging tool, so the
new option is more in line with its purpose.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D13242
2021-11-16 16:49:27 +01:00
Michael Jones
64003fa4b0 Cycles: Adapt volumetric lambda functions to work on MSL
This patch adapts the existing volumetric read/write lambda functions for Metal. Lambda expressions are not supported on MSL, so two new macros `VOLUME_READ_LAMBDA` and `VOLUME_WRITE_LAMBDA` have been defined with a default implementation which, on Metal, is overridden to use inline function objects.

This patch also removes the last remaining mention of the now-unused `ccl_addr_space`.

Ref T92212

Reviewed By: leesonw

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13234
2021-11-16 13:42:23 +00:00
85ac9b8584 Merge branch 'blender-v3.0-release' 2021-11-16 14:39:51 +01:00
ce0d817bb7 UI: Fix hard to read text for drag disabled hints
In 499dbb626a, the background color of drag tooltips were changed so
text becomes more readable. But multiple people were touching the same
code, so the disabled hint tooltips didn't get the same tweak. They
would benefit from them even more, since the red text is even harder to
read on the transparent background than the regular, white text.
2021-11-16 14:37:20 +01:00
12a986c9b5 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-16 13:10:35 +01:00
c7a1e115b5 Tests: fix memory leak of GHOST system paths
Dispose of GHOST system paths when tearing down `BlendfileLoadingBaseTest`
and some other test cases. This prevents a memory leak.

A better solution would be to rework Blender's initialisation & teardown
structure, but that's outside the scope of this fix.

No functional changes to Blender.
2021-11-16 13:07:11 +01:00
faa8aa3bb9 Asset Browser: Forbid dragging catalogs into themselves
While there is nothing technically that would cause issues when moving a
catalog into itself (it just changes the path of the catalog, and the
missing parent catalogs will be created), it seems broken to the user.
So disable this in the drag & drop code for asset catalogs.
2021-11-16 13:01:57 +01:00
052c22199d Asset Browser: use one more refresh operator
Refreshing the assets requires `file_OT_asset_library_refresh` in the
asset browser, and `asset_OT_list_refresh` for the asset view. Both
are now done from `ASSET_OT_open_containing_blend_file`.
2021-11-16 12:35:39 +01:00
7da714f387 Merge branch 'blender-v3.0-release' 2021-11-16 10:57:26 +01:00
Diptangshu Dey
da14a482f2 Fix T90866: Python operator templates are not accessible from menus
Python Operator templates made accessible from respective menus
(required to also use F3 search for quick access)
Also fixed Modal Draw Operator id_name (had duplicate name from other template)

Maniphest Tasks: T90866

Differential Revision: https://developer.blender.org/D13182
2021-11-16 10:45:23 +01:00
d4c868da9f Geometry Nodes: refactor virtual array system
Goals of this refactor:
* Simplify creating virtual arrays.
* Simplify passing virtual arrays around.
* Simplify converting between typed and generic virtual arrays.
* Reduce memory allocations.

As a quick reminder, a virtual arrays is a data structure that behaves like an
array (i.e. it can be accessed using an index). However, it may not actually
be stored as array internally. The two most important implementations
of virtual arrays are those that correspond to an actual plain array and those
that have the same value for every index. However, many more
implementations exist for various reasons (interfacing with legacy attributes,
unified iterator over all points in multiple splines, ...).

With this refactor the core types (`VArray`, `GVArray`, `VMutableArray` and
`GVMutableArray`) can be used like "normal values". They typically live
on the stack. Before, they were usually inside a `std::unique_ptr`. This makes
passing them around much easier. Creation of new virtual arrays is also
much simpler now due to some constructors. Memory allocations are
reduced by making use of small object optimization inside the core types.

Previously, `VArray` was a class with virtual methods that had to be overridden
to change the behavior of a the virtual array. Now,`VArray` has a fixed size
and has no virtual methods. Instead it contains a `VArrayImpl` that is
similar to the old `VArray`. `VArrayImpl` should rarely ever be used directly,
unless a new virtual array implementation is added.

To support the small object optimization for many `VArrayImpl` classes,
a new `blender::Any` type is added. It is similar to `std::any` with two
additional features. It has an adjustable inline buffer size and alignment.
The inline buffer size of `std::any` can't be relied on and is usually too
small for our use case here. Furthermore, `blender::Any` can store
additional user-defined type information without increasing the
stack size.

Differential Revision: https://developer.blender.org/D12986
2021-11-16 10:16:30 +01:00
6d35972b06 Merge branch 'blender-v3.0-release' 2021-11-16 09:58:47 +01:00
7d985d6b69 Fix T93066: Alembic export ignores Mantaflow particles
`ABCPointsWriter::is_supported` already checked for valid particle
system types (liquid, spray, foam, bubbles, ...).

`AbstractHierarchyIterator::make_writers_particle_systems` did not
create a writer for these though, so now bring these in line and also
create writers for these.
2021-11-16 09:41:09 +01:00
57ed435def Cleanup: Use C++ matrix identity constructor 2021-11-15 23:24:16 -06:00
7e42ae7c1a Cleanup: Typo in comments 2021-11-15 22:08:28 +01:00
165cacc6f0 VSE: Use alpha over as default blend mode
With transform tools, it is expected to see backgroud image when overlay
is transformed.

Alpha over caused performance to be not optimal when used with opaque
media. This should be addressed with D12914 at least partially. There
may be some corner cases not addressed.

Differential Revision: https://developer.blender.org/D12952
2021-11-15 21:07:25 +01:00
62da6ffe08 VSE: Use early out for aplha over blending
When scaling down image, users expect to see background, which doesn't
currently happen in VSE. This is because strips use cross blend mode by
default, because alpha over is much slower. Reason is, because any area
of image can be transparent, and therefore it can't have early out
implemented in a way that cross blend mode can.

Flag images rendered by codecs that don't support transparency as fully
opaque and implement a form of early out for alpha over blend mode.

When rendering image stack, 2-input effects are ignored on the
"way down". Alpha over needs rendered overlay image to decide whether it
will use only overlay or background too. Therefore overlay can be
rendered safely before it is used. Image flags can be checked and it can
be freed if needed. Freeing doesn't cause any performance degradation,
because image is always stored in cache.

This feature does not improve blend mode performance. In summary, it
only allowes for having alpha over blend mode on background images
without suffering from lower performance.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D12914
2021-11-15 21:03:43 +01:00
46f5f60c13 Merge branch 'blender-v3.0-release' 2021-11-15 20:33:34 +01:00
a040d2a93a Fix T90592: Incorrect scrollbar range with backdrop
`v2d->tot` rect was set for backdrop drawing. Set range before drawing
scrollbars.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D13099
2021-11-15 20:28:11 +01:00
7e148c45c8 Fix T90415: Missing cache invalidation
Some RNA properties and operators did not invalidate cache or did it
incorrectly.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13101
2021-11-15 20:23:57 +01:00
d3c45e1c39 Fix T91405: Block artefacts in WEBM video
Issue was caused by incorrect FFmpeg asynchronous decoding API. In most
cases, decoder returns 1 frame each time it is fed by 1 packet. Here
decoder wanted to return more frames, but our code always expected only
one.

Before sending new packets to decoder, check if there are frames to
receive. If there are, process them, otherwise continue decoding as
usual.

Reviewed By: zeddb, sergey

Differential Revision: https://developer.blender.org/D13079
2021-11-15 20:20:33 +01:00
ef8240e64c Fix T91992: Incorrect clip strip image size
When proxy size lower than 100% is used, clip strips are rendered with
incorrect image size.

This is because if proxies aren't enabled in movieclip, it automatically
falls back on rendering original media. Sequencer doesn't have knowledge
about this and since 9c99292a16 it assumes that image is proxy,
because it explicitly requested this size.

Check movieclip flag to see if proxies are enabled.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D13080
2021-11-15 20:07:46 +01:00
10a6a540af Cleanup: remove unnecessary functions
Those functions were more useful when `FieldInferencingInterface`
was still declared further down in `node.cc`.
2021-11-15 18:04:03 +01:00
8976b72843 Merge branch 'blender-v3.0-release' 2021-11-15 09:10:19 -06:00
62da41d63d Fix: Incorrect socket identifier versioning
There were two issues:
 - The third math node socket does not exist in old enough files.
 - The comment incorrectly referred to the vector math node.

Differential Revision: https://developer.blender.org/D13219
2021-11-15 08:52:58 -06:00
c3472cb11c Fix T93074: Gpencil cutter not using flat caps in middle cuts
When cut an stroke using the option Flat Caps, the falt was not done if the cut was done in the middle of the stroke.

Now the flat is applied to the segments created and also some cleanup of the code done.
2021-11-15 12:17:11 +01:00
Jeroen Bakker
a5c59fb90e Fix T89260: Eevee crashes with custom node sockets.
Cause of this issue is that Custom Node Sockets info type was
initialized as SOCK_FLOAT when registering. Areas within the core that
would ignore custom socket types by checking its type would use the
socket as being a float type.

When custom node sockets have a property called default_value blender
tries to store it as an internal default value what failed in debug
builds.

This patch will set the socket type to SOCK_CUSTOM when registering a
custom socket type and allow, but skip storage of custom default values.
In this case the default values should already be stored as custom
properies.

Reviewed By: campbellbarton, JacquesLucke

Maniphest Tasks: T89260

Differential Revision: https://developer.blender.org/D13174
2021-11-15 08:13:22 +01:00
c2c65cc4bf Merge branch 'blender-v3.0-release' 2021-11-15 02:39:33 +01:00
622e6f05f1 Fix T92750: sculpt vertex colors missing in object mode
The layers were not aliased properly for usage in the shaders.

Regression caused by rB03013d19d167.
2021-11-15 02:38:52 +01:00
7e82c840b7 Fix text editor auto-close with quotes
Back-spacing a quote from the beginning of a line
would delete the quote in-front instead of doing nothing.
2021-11-14 11:26:06 +11:00
2549384baa Cleanup: minor tweaks to auto-close
Spelling and failure to reuse variable missed in review.
2021-11-14 11:11:20 +11:00
73047c69ea BLF: Use Floats for Font Point Sizes
Allow the use of floating-point values for font point sizes, which
allows greater precision and flexibility for text output.

See D8960 for more information, details, and justification.

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

Reviewed by Campbell Barton
2021-11-13 09:39:18 -08:00
e8a8bb67fc Cleanup: Correct order of guard and lock in moviecache_valfree
Fix own mistake in rB7061d1e39fe

In my attempt to quickly address T92838, along with the original bug, I
made a nonsensical choice to use the limiter lock to guard the check
against the cache item itself. While harmless, it is not necessary and
semantically wrong / potentially confusing to future readers of the code.

Differential Revision: https://developer.blender.org/D13122
2021-11-12 20:47:26 -08:00
ab9ec193c3 Fix splash screen showing on startup with files loaded by scripts
Suppressing the splash was only done when passing in an argument from
the command line.

Remove G.file_loaded, as it is misleading, only set once on startup,
replace with G.relbase_valid which is used everywhere else to check
if the file path should be used.
2021-11-13 14:05:27 +11:00
Matheus Santos
c4ea5cb1a3 Text Editor: Auto close relevant characters
Support the ability to close relevant characters like '(', '[' and '{'.

It will also delete the pair character if they're empty.

Ref D13119

Reviewed By: campbellbarton
2021-11-13 13:56:31 +11:00
1143bf281a Cleanup: spelling in comments, comment block formatting 2021-11-13 13:07:13 +11:00
acc800d24d Cleanup: clang-format 2021-11-13 12:47:18 +11:00
dc378bf1a4 Merge branch 'blender-v3.0-release' 2021-11-12 21:57:44 -03:00
0a6f428be7 Fix snapping not performing on selected bones or splines
This is an old issue but never reported as it is only visible in the measure tool snapping.
2021-11-12 21:56:42 -03:00
60b8eb30bb Merge branch 'blender-v3.0-release' 2021-11-12 21:36:35 -03:00
eed48a7322 Cleanup: reference some snap parameters in the snap context itself
This decreases the number of parameters in functions and makes important variables available in more places.
2021-11-12 21:34:19 -03:00
738f4fbc5e Revert "Fix T92636: Vector math node link disconnects when loading old file"
This reverts commit 6b4ca78108.

A simpler fix was used for 3.0, but rBd845ba481c6d2ef already contained
a more complete solution to the problem of inconsistent socket ids.
2021-11-12 17:14:27 -06:00
ebb4aba325 Merge branch 'blender-v3.0-release' 2021-11-12 17:12:39 -06:00
6b4ca78108 Fix T92636: Vector math node link disconnects when loading old file
Previously, unique identifiers for sockets were created automatically,
sometimes using .001 and sometimes _001. Now they are created
manually with the second format, but some files were saved with .001
format. I think this was only an issue in the vector math node.

rBd845ba481c6d fixed this problem in 3.1, but in a more general way.
After I merge this patch to 3.1, I will revert it, since the versioning
added in that commit will make this redundant.

Differential Revision: https://developer.blender.org/D13209
2021-11-12 17:07:38 -06:00
ec432ae998 Merge branch 'blender-v3.0-release' 2021-11-12 14:06:26 -06:00
8d3a771574 Fix: Node Class Type for Select by Handle Type
Change the node class type for Node Select by Handle Type to
NODE_CLASS_INPUT
2021-11-12 14:05:40 -06:00
55c69373e8 Cleanup: split 'initSnappingMode' into more specific functions
This helps to reuse small regions of a function's code elsewhere.

The logic had to be reorganized, theoretically it should behave the same way.
2021-11-12 16:30:01 -03:00
8b13cf5667 Cleanup: move 'imm_drawcircball' to 'gpu_immediate_util.c' 2021-11-12 16:30:01 -03:00
5941c39fbf Cleanup: fix some comments in the transform code 2021-11-12 16:30:01 -03:00
30f9034182 Cleanup: use 't->tsnap.mode' in transform code
This also prevents different snap modes from being used at the same time in the code.
2021-11-12 16:30:01 -03:00
e5a7dd8ab6 Cleanup: unify snap modes to geometry in a single flag
This combination was being repeated in some places.
2021-11-12 16:30:01 -03:00
5b787c24fb Merge branch 'blender-v3.0-release' 2021-11-12 13:26:26 -06:00
888b879f5f Fix: Incorrect transfer attribute error message with curves
The node does support curves, but only in index mode (see T88630)
So add a specific error message for the nearest mode, and let the
node support curves in the declaration.

Differential Revision: https://developer.blender.org/D13205
2021-11-12 13:25:22 -06:00
1b55b911f2 Merge branch 'blender-v3.0-release' 2021-11-12 20:04:05 +01:00
71131b4969 Tests: disable audio system for performance tests 2021-11-12 20:03:46 +01:00
b4d9b8b7f8 Fix T91893, T92455: wrong transmission pass with hair and multiscatter glass
We need to increase GPU memory usage a bit. Unfortunately we can't get away
with writing either reflection or transmission passes because these BSDFs may
scatter in either direction but still must be in a fixed reflection or
transmission category to match up with the color passes.
2021-11-12 20:03:46 +01:00
ef0b8d6306 Fix T92002: no Cycles combined baking support for filter settings 2021-11-12 20:03:46 +01:00
d845ba481c Fix T91826: Inconsistent node socket name identifier separator
Previously both `.` and `_` were used as separators when finding
a unique name for a socket. This removes the use of `.`, since `_`
was more common. It also does versioning for all of a file's node
trees to make sure that they all use the `_` convention.

Differential Revision: https://developer.blender.org/D13181
2021-11-12 12:22:43 -06:00
cbca71a7cf Cleanup: Move remaning node editor files to C++
Differential Revision: https://developer.blender.org/D13200
2021-11-12 12:12:27 -06:00
809ae823b7 Merge branch 'blender-v3.0-release' 2021-11-12 19:00:23 +01:00
9d0d4b8601 Fix T93029: OptiX denoising artifacts at high sample counts in specific scenes
Partially reverts commit rB440a3475b8f5410e5c41bfbed5ce82771b41356f because
"optixDenoiserComputeIntensity" does not currently support input images that are not packed (the
"pixelStrideInBytes" field is not zero). As a result the intensity calculation would take into account
data from other passes in the image, some of which was scaled by the number of samples still and
therefore produce widely incorrect results that then caused artifacts in the denoised image.

Maniphest Tasks: T93029
2021-11-12 18:59:50 +01:00
8a8bf99717 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-12 18:23:44 +01:00
2b394e1108 UI: (Performance) Avoid drawing buttons out of view
The UI was always drawing all buttons in a layout, no matter if they
were scrolled out of view (as in, outside of the visible part of the
region) or not. This means it's doing quite some work that can be
avoided.
UI drawing generally isn't a big bottleneck in Blender, so I don't
expect huge speedups from this. But while playing back animation, we do
redraw a fair bit of the UI, so in cases where there are many buttons
out of view, it may bring a little FPS boost. E.g. say in complex node
trees (the node editor is redrawn on animation playback in case there
are animated values that need updated UI feedback). This also mitigates
the issue in T92922 significantly.

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

Reviewed by: Brecht Van Lommel
2021-11-12 18:21:12 +01:00
Yevgeny Makarov
a89529d8db UI: Do not shade alpha when blending colors
UI_GetThemeColorBlendShade4fv incorrectly changing alpha by the amount
of the shading offset.

See D9944 for more details.

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

Reviewed by Hans Goudey
2021-11-12 08:55:20 -08:00
9f5290e3bc Fix T93007: Cycles not updating for animated Object properties like color 2021-11-12 08:55:20 -08:00
c671b5eee4 Fix Cycles ray visibility panel missing for volume objects 2021-11-12 08:55:20 -08:00
Yevgeny Makarov
896d3f1ce5 UI: Do not shade alpha when blending colors
UI_GetThemeColorBlendShade4fv incorrectly changing alpha by the amount
of the shading offset.

See D9944 for more details.

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

Reviewed by Hans Goudey
2021-11-12 08:51:31 -08:00
76105eb752 Fix T93007: Cycles not updating for animated Object properties like color 2021-11-12 17:09:21 +01:00
d48523cb4d Fix Cycles ray visibility panel missing for volume objects 2021-11-12 16:18:07 +01:00
ddf66cd060 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-12 14:36:55 +01:00
b4cfe80547 Assets: Store Action sub-type in asset metadata
Blender 3.0 will only support single-frame Actions in the pose library.
The goal of this patch is to lay the groundwork for making it possible
for the Asset Browser to reject/hide "animation snippet" Action assets.

Determining whether an Action has one or more frames (i.e. whether it
has a single pose or animation) requires inspecting the Action itself,
and thus loading the data-block itself. This would make it impossible to
quickly determine from the asset browser.

To solve this, the Action is inspected before saving, and a
`"is_single_frame"` boolean (well, 0/1 integer) IDProperty is added.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D13202
2021-11-12 14:36:22 +01:00
c7a88cf91a Merge branch 'blender-v3.0-release' 2021-11-13 00:31:03 +11:00
5f7d5c0809 Gizmo: adjust when gizmo protection flags are displayed
Restore behavior reverted in
0ea60cf6b8 but only for location
as it makes sense to use protection flags in global mode in that case.
2021-11-13 00:28:13 +11:00
a470e3c9d1 Merge branch 'blender-v3.0-release' 2021-11-13 00:20:07 +11:00
0ea60cf6b8 Fix gizmo protection flag use in object mode
Channel protection flags were only used in global mode,
this doesn't make any sense, especially for rotation and scale.

Follow pose-bones, only using protection flags for
local & gimbal orientation.
2021-11-13 00:19:36 +11:00
3fe735d371 Geometry Nodes: Add Outer Points Selection to Star
Adds a boolean field output containing a selection of the
points of the star that are controlled by the outer radius
of the star.

Differential Revision: https://developer.blender.org/D13097
2021-11-12 06:44:41 -06:00
a47359ff36 Merge branch 'blender-v3.0-release' 2021-11-12 11:52:49 +01:00
de8a46c6ad Fix T93008: Cycles: Huge memory spike when saving tile to disk
The root of the problem lies in bug in OIIO which we can work around
from our side (which does not affect pack memory usage).

Thanks Brecht for finding the root cause!

Differential Revision: https://developer.blender.org/D13186
2021-11-12 11:20:01 +01:00
26502f3d89 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-12 10:52:12 +01:00
2b633f12ad Fix crash in asset browser when switching from file browser
When the file browser is in asset browser mode, it sets the callback
`filelist->prepare_filter_fn` to an asset browser specific function. This
function will segfault if there is no current asset library. Switching back
from asset browser to file browser would not reset that callback to
`NULL`, causing it to be called and crash Blender. This is now fixed.
2021-11-12 10:51:09 +01:00
86ca206db8 Cleanup/document BKE_blender_copybuffer.
* Rename the 'copy' functions to make it clear they belong to the same
  'group' and are to be used together.
* Fix `flag` parameter of `BKE_copybuffer_paste` being a short instead
  of an int.
* Improve documentation.
2021-11-12 10:20:49 +01:00
William Leeson
456876208b Fix T92601: Disable profiling when the profiler is deemed not active.
Adds a method to profiler that can be used to check if it is active.
This is used to determine if stop_profiling and start_profiling
should be called.

| patch | Juans Scene UI 256 samples | Juans Scene bg 256 samples | junkshop UI | junkshop bg |
| No patch | 6:16.59 | 4:05.37 | 2:08.48 | 1:59.7 |
| D13187   | 4:12.15 | 3:57.36 | 2:07.25 | 1:58.16 |
| D13185   | 4.11.18 |3:54.74 | 2:07.44 | 1:58.03 |
| D13190   | 4:12.39 | 3:55.42 | 2:07.62 | 1:58.68 |

UI - means rendered from within Blender
bg - means rendered from the command line using ##blender -b scene.blend -f 1##

Reviewed By: sergey, brecht

Maniphest Tasks: T92601

Differential Revision: https://developer.blender.org/D13190
2021-11-12 10:16:01 +01:00
William Leeson
32c7687859 Fix T92601: Disable profiling when the profiler is deemed not active.
Adds a method to profiler that can be used to check if it is active.
This is used to determine if stop_profiling and start_profiling
should be called.

| patch | Juans Scene UI 256 samples | Juans Scene bg 256 samples | junkshop UI | junkshop bg |
| No patch | 6:16.59 | 4:05.37 | 2:08.48 | 1:59.7 |
| D13187   | 4:12.15 | 3:57.36 | 2:07.25 | 1:58.16 |
| D13185   | 4.11.18 |3:54.74 | 2:07.44 | 1:58.03 |
| D13190   | 4:12.39 | 3:55.42 | 2:07.62 | 1:58.68 |

UI - means rendered from within Blender
bg - means rendered from the command line using ##blender -b scene.blend -f 1##

Reviewed By: sergey, brecht

Maniphest Tasks: T92601

Differential Revision: https://developer.blender.org/D13190
2021-11-12 10:01:48 +01:00
a87253942d Cleanup: Remove GHOST_isUpsideDownContext.
GHOST API only has a header definition. No implementation or usage.
2021-11-12 09:38:25 +01:00
ae74ad191c Merge branch 'blender-v3.0-release' 2021-11-12 18:35:22 +11:00
aa1c44a113 Merge branch 'blender-v3.0-release' 2021-11-12 18:35:19 +11:00
5c0d4753cf Merge branch 'blender-v3.0-release' 2021-11-12 18:35:16 +11:00
02333544d1 Merge branch 'blender-v3.0-release' 2021-11-12 18:35:13 +11:00
1061f5a1ba Cleanup: remove redundant loop-index access
Use a counter for loop indices as they're being iterated in order.
2021-11-12 18:33:05 +11:00
1a7757b0bc Fix T91444: Edge Loop Preview fails with two Mirror Modifiers
The mirror modifiers merge option caused unnecessary re-ordering
to the vertex array with original vertices merging into their copies.

While this wasn't an error, it meant creating a 1:1 mapping from input
vertices to their final output wasn't reliable (when looping over
vertices first to last) as is done in
BKE_editmesh_vert_coords_when_deformed.

As merging in either direction is supported, keep the source meshes
vertices in-order since it allows the vertex coordinates to be extracted.
2021-11-12 18:27:47 +11:00
f133c6b094 Fix crash saving blend files in background mode
Reading the windows pixels was attempted in background mode.
2021-11-12 18:05:27 +11:00
d612d92630 Cleanup: use term sequence_strip instead of vse_strip 2021-11-12 17:38:58 +11:00
1e1c870001 Cleanup: Improve comment 2021-11-11 21:57:40 -06:00
0533f2851e Geometry Nodes: change selection output order in Cylinder node
This new order is a bit more intuitive.
2021-11-11 19:53:02 +01:00
d6e682a7b0 Merge branch 'blender-v3.0-release' 2021-11-11 19:50:24 +01:00
bd734cc441 Fix: Attribute Transfer node does not work with a single index
Differential Revision: https://developer.blender.org/D13194
2021-11-11 19:49:20 +01:00
e61da8e4fb Merge branch 'blender-v3.0-release' 2021-11-11 11:47:43 -06:00
f3bdabbe24 Fix: Incorrect modifier warning with non-geometry input first
The code assumed that any geometry input that wasn't the first input
was a second geometry input. Fix by separating the warning for the
first input and for the number of geometry inputs.
2021-11-11 11:47:19 -06:00
50f32025ac Merge branch 'blender-v3.0-release' 2021-11-11 18:27:31 +01:00
393879f30c Fix: wrong field inferencing with unavailable sockets 2021-11-11 18:26:40 +01:00
3d9c8397fc Fix T93005: Cycles shadow catcher not inherited by instances 2021-11-11 18:12:05 +01:00
c9c7658926 Geometry Nodes: Add Offset to Handle Position Node
Adds a vector offset field to the "Curve Handle Position Node".
This vector is added to the incoming position (which is the
implicit handle position if not connected) which will set the
position of the handle. Default is (0,0,0)

Differential Revision: https://developer.blender.org/D13035
2021-11-11 10:58:23 -06:00
3ca41b7312 Merge branch 'blender-v3.0-release' 2021-11-11 10:16:35 -06:00
Peter Sergay
4bc08b79aa UI: Updated Blender Light theme for Spreadsheet
This patch adds list colors to the light theme for the spreadsheet,
which are needed for the data set region. Addresses T92492.

Differential Revision: https://developer.blender.org/D13090
2021-11-11 10:10:28 -06:00
25e7365d0d Cleanup CUDA / HIP comments
Remove outdated CUDA comments for bindless textures and cleanup some HIP comments that still mentioned CUDA.

Differential Revision: https://developer.blender.org/D13189
2021-11-11 16:37:29 +01:00
52c617802f Merge branch 'blender-v3.0-release' 2021-11-11 09:27:42 -06:00
Martijn Versteegh
7aa39b40f4 Fix: Prevent use of uninitialized memory when creating Bezier spline
When Constructing bezier splines from dna, the positions of the
left/right handles were set directly in the internal vectors, by
requesting a reference to them. The problem is that
BezierSpline::handle_positions_left() calls ensure_auto_handles()
before returning the reference. That function does some calculations on
uninitialized memory if the positions array is not yet filled.

Differential Revision: https://developer.blender.org/D13107
2021-11-11 09:25:10 -06:00
ce395c84a3 Merge branch 'blender-v3.0-release' 2021-11-11 15:29:35 +01:00
d26d3cfe19 Fix T92868: Cycles catcher with transparency crashes
The issue was caused by splitting happening twice.

Fixed by checking for split flag which is assigned to the both states
during split.

The tricky part was to write catcher data at the moment of split: the
transparency and shadow catcher sample count is to be accumulated at
that point. Now it is happening in the `intersect_closest` kernel.
The downside is that render buffer is to be passed to the kernel, but
the benefit is that extra split bounce check is not needed now.

Had to move the passes write to shadow catcher header, since include
of `film/passes.h` causes all the fun of requirement to have BSDF
data structures available.

Differential Revision: https://developer.blender.org/D13177
2021-11-11 15:21:35 +01:00
06a74e7816 LibLink/Append tests: Add basic testing of bpy.data.libraries.load code. 2021-11-11 14:54:26 +01:00
9f31b9b7d3 Merge branch 'blender-v3.0-release' 2021-11-11 14:33:28 +01:00
9be6880d02 Fix (unreported) bad handling of reports in libraries.load code.
rB60fee69682ac39 only partially fixed the issue, `BlendFileReadReport
bf_reports` was now properly stored in `BPy_Library` `self` for the
lifetime of the context, but its `reports` member was still referencing
local variable to `bpy_lib_enter` function.
2021-11-11 14:29:14 +01:00
4a98faf9f1 Merge branch 'blender-v3.0-release' 2021-11-11 21:34:05 +11:00
8c240f50b2 Merge branch 'blender-v3.0-release' 2021-11-11 21:34:02 +11:00
b7e2408ea4 Fix T92867: Gimbal rotation broken when used for multiple objects
Support gimbal orientation for objects & bones.
2021-11-11 21:33:09 +11:00
bb64155c63 Cleanup: split gimbal_axis into pose and object
Allow access to a single bones gimbal matrix.
2021-11-11 21:14:08 +11:00
Andrii
c63e735f6b Cycles: Add sample offset option
This patch exposes the sampling offset option to Blender. It is located in the "Sampling > Advanced" panel.
For example, this can be useful to parallelize rendering and distribute different chunks of samples for each computer to render.

---

I also had to add this option to `RenderWork` and `RenderScheduler` classes so that the sample count in the status string can be calculated correctly.

Reviewed By: leesonw

Differential Revision: https://developer.blender.org/D13086
2021-11-11 09:39:25 +01:00
b8d53b703a Merge branch 'blender-v3.0-release' 2021-11-11 15:00:23 +11:00
9787b46f09 Merge branch 'blender-v3.0-release' 2021-11-11 15:00:20 +11:00
03f0be35d6 Merge branch 'blender-v3.0-release' 2021-11-11 15:00:17 +11:00
d753ebd40a Cleanup: spelling in comments 2021-11-11 14:59:30 +11:00
ddf0bacaa9 Cleanup: typo in function name 2021-11-11 14:58:55 +11:00
3929db265f Fix T92954: Loop Cut Tool preview line visible during operation
Apply a local-workaround instead of adding support for this use-case
since pre-selection isn't the intended purpose of gizmos.

This also resolves a glitch where poly-build and loop cut would
briefly show loop-cut or poly-build pre-selection after transforming.

See gizmo_preselect_poll_for_draw note for more details.
2021-11-11 14:58:55 +11:00
e1bd4bbb66 UI: Introduce View pie in more editors
#### Motivation

The View pie menu is a convenient way to access operators such as `Frame Selected` and `Frame All` which are usually mapped to `PERIOD` or `HOME` keys on the right side of most keyboard, making it hard hard to reach with the left hand.

The motivation for this patch comes from working with a 75% keyboard (no numpad). Most laptops face a similar problem.

#### Implementation

The View pie menu has been added to the following editors and sub-modes where applicable:

* Node Editor
* Video Sequencer
* Dopesheet
* Graph
* NLA
* Image
* Clip
* Outliner

More options could definitely be added to this menu for convenience, as long as it maintains the common options in the same place (Frame Selected on the left, Frame All on the right).

For positioning I went with the following layout:
{F11791186, size=full}

I've added `Zoom 1:1`to the Image Editor and the VSE Preview since there is no way to reset the zoom on keyboards without numpad (unless Emulate Numpad is turned on).

The Outliner uses `Show Active` and `Show Hierarchy` which are the closest ones to the equivalent in other editors. Should `Show Active` be renamed to `Frame Selected`?

The shortcut assigned is the same as the 3D Viewport (`ACCENT_GRAVE`).

#### Screenshots

Node Editor
{F11778387, size=full}

Dopesheet
{F11778400, size=full}

Graph
{F11778403, size=full}

Image Editor (Paint and View)
{F11791113, size=full}

Image Editor (Mask)
{F11791114, size=full}

UV Editor
{F11791119, size=full}

Clip Editor (Tracking)
{F11791137, size=full}

Clip Editor (Mask)
{F11791140, size=full}

Clip Editor (Graph)
{F11791151, size=full}
View operators are not yet implemented in Clip Editor Dopesheet mode (left a note about this in the menu poll).

Reviewed By: #user_interface, campbellbarton

Differential Revision: https://developer.blender.org/D13169
2021-11-11 01:18:50 +01:00
f1a8644121 Cleanup: Move interface_region_search.c to C++
This will be helpful for solving a bug with search during animation
playback, T89313. I tested this on all platforms on the buildbot.
2021-11-10 15:49:49 -06:00
1ec7075ff2 Merge branch 'blender-v3.0-release' 2021-11-10 15:44:13 -06:00
22ffd69a91 Fix T89313: Attribute search crash with animation playback
rBc473b2ce8bdbf8fa42 improved the situation somewhat, but
attribute search still crashes during animation playback, because
the UI search data references stale memory. The proper solution
is to allow the search to own data rather than just referencing it,
but I would prefer not to do that for 3.0. In the meantime, just
disable attribute search when animation is playing.

Differential Revision: https://developer.blender.org/D13179
2021-11-10 15:43:18 -06:00
9ca8bf0b29 Merge branch 'blender-v3.0-release' 2021-11-10 22:28:03 +01:00
040630bb9a Fix wrong device check in HIP kernel compile.
Also cleanup some related code, that was falsely copied from CUDA.

Differential Revision: https://developer.blender.org/D13180
2021-11-10 22:24:53 +01:00
3fa86f4b28 Merge branch 'blender-v3.0-release' 2021-11-10 20:19:09 +01:00
7689f501e2 Cycles: enable HIP device and binaries on Windows
We've now done testing to confirm this works with RDNA and RDNA2 AMD GPUs
on Windows. The AMD driver needed for this will soon be released publicly.
2021-11-10 20:16:44 +01:00
Thomas Dinges
e507a789b3 Cycles: disable graphics interop for HIP devices
This is due to a driver bug, so disable it for now until it gets resolved
in a future driver release.

Ref T92972

Differential Revision: https://developer.blender.org/D13167
2021-11-10 20:16:44 +01:00
6b0008129e Fix T92972: Cycles HIP wrong render display after a recent refactor
It's unclear why this fails. Maybe the size of half4 is not the expected
8 bytes and adjacent pixels are overwritten. Or there is some bug in the
HIP compiler writing a struct into global memory, which we probably don't
do elsewhere in the kernel.

Thanks to Thomas, William and Jeroen for helping investigate this.
2021-11-10 20:03:07 +01:00
c8e93da0a7 Fix Cycles assert in denoising fallback to OIDN 2021-11-10 19:56:30 +01:00
abf62d06d1 Merge branch 'blender-v3.0-release' 2021-11-10 11:11:58 -06:00
35ae7ab933 Cleanup: Use bool instead of int 2021-11-10 11:11:35 -06:00
cc17ed26ce Merge branch 'blender-v3.0-release' 2021-11-10 10:52:34 -06:00
20224369d9 Geometry Nodes: Clarify modifier node group errors
This commit adds modifier error messages to some of the cases
where the node group is configured improperly. It also clears the
geometry set when there is an error with the node group. This is
consistent to what we do in nodes themselves, and feels more
intuitive than passing the input geometry through the node group
silently.

Fixes T87142
2021-11-10 10:52:18 -06:00
e9b7e5e0b9 Merge branch 'blender-v3.0-release' 2021-11-10 10:47:09 -06:00
67e5edbaa3 Fix: Incorrect translation search for modifier error messages
This function was renamed in rB2bb9a465e6c0e1ca765, but it looks like
that commit missed changing the corresponding translation regular
expression.

Differential Revision: https://developer.blender.org/D13171
2021-11-10 10:46:49 -06:00
f565620435 Fix T92985: CUDA errors with Cycles film convert kernels
rB3a4c8f406a3a3bf0627477c6183a594fa707a6e2 changed the macros that create the film
convert kernel entry points, but in the process accidentally changed the parameter definition
to one of those (which caused CUDA launch and misaligned address errors) and changed the
implementation as well. This restores the correct implementation from before.

In addition, the `ccl_gpu_kernel_threads` macro did not work as intended and caused the
generated launch bounds to end up with an incorrect input for the second parameter (it was
set to "thread_num_registers", rather than the result of the block number calculation). I'm
not entirely sure why, as the macro definition looked sound to me. Decided to simply go with
two separate macros instead, to simplify and solve this.

Also changed how state is captured with the `ccl_gpu_kernel_lambda` macro slightly, to avoid
a compiler warning (expression has no effect) that otherwise occurred.

Maniphest Tasks: T92985

Differential Revision: https://developer.blender.org/D13175
2021-11-10 15:49:50 +01:00
a6e4cb092e Merge branch 'blender-v3.0-release' 2021-11-10 13:53:44 +01:00
Jeroen Bakker
bc0c06ecbe Fix T91518: crash when recalculating looptris after clearing geometry.
When clearing geometry the runtime mutexes of a mesh were freed. This
resulted in crashes afterwards. The clear geometry is an RNA function so
would only effect when using from scripts.

This patch separates init/freeing of the mutexes from other code so they
can be used when needed.

Reviewed By: mont29

Maniphest Tasks: T91518

Differential Revision: https://developer.blender.org/D13142
2021-11-10 13:50:15 +01:00
53468c2b13 Merge branch 'blender-v3.0-release' 2021-11-10 13:43:08 +01:00
47b8baa5c4 Fix T92864: curve object does not sync correctly in cycles
The issue was that the `object_is_geometry` method was used in two different
contexts that expected the function to behave differently. So a recent change
that fixed `object_is_geometry` for one context, broke it for the other context.
The two contexts are:
* Check if a "real" object can contain a geometry to check if it has to be tagged
  for sync after an update.
* Check if an object/instance actually is a geometry that cycles can work with.

I created a new `object_can_have_geometry` method for the first use case, instead
of trying to adapt the existing object_is_geometry method to serve both uses.
Additionally, I changed it so that a BObjectInfo is passed into `object_is_geometry`
to make it more explicit when this method is supposed to be used.

Differential Revision: https://developer.blender.org/D13135
2021-11-10 13:38:07 +01:00
03e22da665 Merge branch 'blender-v3.0-release' 2021-11-10 12:47:01 +01:00
aa2f6e5977 Fix T92979: Emission Strength Animation read wrong in 3.0
First this was wrong for files written in 2.93 read into blender in 3.0
after the CyclesX merge.
Then this was fixed by versioning in rB6321dd3d4007.
But this caused files written in 3.0 to have this versioning applied as
well (leading to socket shifting).

Now only do the versioning for files created before the CyclesX
merge.

Maniphest Tasks: T92979

Differential Revision: https://developer.blender.org/D13173
2021-11-10 12:45:41 +01:00
ff0c42acfc Merge branch 'blender-v3.0-release' 2021-11-10 21:22:01 +11:00
a49d6a5350 Merge branch 'blender-v3.0-release' 2021-11-10 21:21:58 +11:00
bec72a43ae Fix T92874: Custom normals reset when vertex is deleted
Storing and restoring custom normals was broken by
39b2a7bb7e

This also caused "Sharp Edge" option for Weld by Distance to fail,
reported as T92875.
2021-11-10 21:11:41 +11:00
aa440923c8 Fix: Hide selection value in resample curve node, fix order
Selection sockets are meant to come right after the geometry,
this was missed in review of rBa7672caeb255e3.
Also, the selection value was not hidden.
2021-11-09 17:23:11 -06:00
1f6010e609 Cleanup: Move info_stats.c to C++ 2021-11-09 15:57:58 -06:00
Michael Jones
3a4c8f406a Cycles: Adapt shared kernel/device/gpu layer for MSL
This patch adapts the shared kernel entrypoints so that they can be compiled as MSL (Metal Shading Language). Where possible, the adaptations avoid changes in common code.

In MSL, kernel function inputs are explicitly bound to resources. In the case of argument buffers, we declare a struct containing the kernel arguments, accessible via device pointer. This differs from CUDA and HIP where kernel function arguments are declared as traditional C-style function parameters. This patch adapts the entrypoints declared in kernel.h so that they can be translated via a new `ccl_gpu_kernel_signature` macro into the required parameter struct + kernel entrypoint pairing for MSL.

MSL buffer attribution must be applied to function parameters or non-static class data members. To allow universal access to the integrator state, kernel data, and texture fetch adapters, we wrap all of the shared kernel code in a `MetalKernelContext` class. This is achieved by bracketing the appropriate kernel headers with "context_begin.h" and "context_end.h" on Metal. When calling deeper into the kernel code, we must reference the context class (e.g. `context.integrator_init_from_camera`). This extra prefixing is performed by a set of defines in "context_end.h". These will require explicit maintenance if entrypoints change. We invite discussion on more maintainable ways to enforce correctness.

Lambda expressions are not supported on MSL, so a new `ccl_gpu_kernel_lambda` macro generates an inline function object and optionally capturing any required state. This yields the same behaviour. This approach is applied to all parallel_... implementations which are templated by operation. The lambda expressions in the film_convert... kernels don't adapt cleanly to use function objects. However, these entrypoints can be macro-generated more concisely to avoid lambda expressions entirely, instead relying on constant folding to handle the pixel/channel conversions.

A separate implementation of `gpu_parallel_active_index_array` is provided for Metal to workaround some subtle differences in SIMD width, and also to encapsulate some required thread parameters which must be declared as explicit entrypoint function parameters.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D13109
2021-11-09 21:43:10 +00:00
7b530c6096 Fix: Incorrect assert in dot grid drawing
It's totally valid for the grid levels to be zero.
2021-11-09 13:15:34 -06:00
4648c4990c Merge branch 'blender-v3.0-release' 2021-11-09 13:08:36 -06:00
44239fa106 Fix: Crash with no active object after recent commit
rBaa13c4b386b13111 added a check for the active object
in drawing code, but it missed adding a check for the active
base before trying to retrieve its object.
2021-11-09 12:59:20 -06:00
7c25399576 tests/benchmarks: Fix operation on windows
The test script did not work on windows
since it had some trouble importing the
api module on the blender side of things.

turning the file path to the module into
a raw string literal sidesteps the
backslash issue in the path.

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

Reviewed by: brecht
2021-11-09 09:58:48 -07:00
a356e4fb3f Merge branch 'blender-v3.0-release' 2021-11-09 17:53:15 +01:00
4f246b8bf9 Fix T92908: print warning when instance recursion limit is reached
Currently we have a fixed instance recursion limit. While we want to lift this
limitation at some point, that is out of scope for a bug fix. For now just print
a warning to make it easier to detect the issue.

Differential Revision: https://developer.blender.org/D13162
2021-11-09 17:52:40 +01:00
7383f95443 Merge branch 'blender-v3.0-release' 2021-11-09 11:43:18 -05:00
74fe19b193 UI: use plural form of "Gizmo" in Gizmo display menus
Because the menus list several gizmo visibility settings it makes grammatical sense that the panel name is plural.

This also matches the "Overlays" menu.
2021-11-09 11:42:26 -05:00
fd0ba6449b Cycles: mark both RDNA and RDNA2 as support for HIP 2021-11-09 17:38:25 +01:00
ed0df0f3c6 Merge branch 'blender-v3.0-release' 2021-11-09 10:15:20 -06:00
aa13c4b386 Viewport: Remove different outline color for instances
With instancing becoming more common with geometry nodes,
instances are less of a separate thing and more of an essential part
of evaluated data. Displaying them with a separate outline, while
helpful in some cases, is not worth the lack of visibility or confusion
about selected/active status. Information about the performance
of the scene due to instancing is always available with the statistics
like vertex count, etc.

The problems were compounded by the fact that the instancing
system is used to output geometry components that don't correspond
to the object's original type. So this patch also fixes that problem.

Fixes T92079, T81010
Ref T91310

Differential Revision: https://developer.blender.org/D13133
2021-11-09 10:12:05 -06:00
e5fb5c9d7b Merge branch 'blender-v3.0-release' 2021-11-09 17:07:41 +01:00
Demeter Dzadik
e452c43fd6 Let Unlink Action operator have an undo step
I noticed while rigging a character and editing actions that the Unlink Action operator had no undo step. Doesn't feel intentional, so this patch adds the necessary flags.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D12346
2021-11-09 16:58:39 +01:00
570331ca96 Fix T92928: Geometry nodes animation decorator wrong for vectors
Decorators were only added for the first item of an array.

Decorators for all items of an array are added:
- if the layout is flagged `UI_ITEM_PROP_DECORATE` automatically in
`uiItemFullR` or
- calling `uiItemDecoratorR` (but only in certain situations, see below)

When calling `uiItemDecoratorR` with an index of 0, the following
happens:
- the index is passed to `uiItemDecoratorR_prop`
- that checks with `ui_item_rna_is_expand` if decorators should be added
to all items of an array
- the check fails (because it only permits RNA_NO_INDEX -- which is -1)

So two things we can do:
- remain using `uiItemDecoratorR` (that would require to pass an index
of RNA_NO_INDEX -- a bad level include -- or -1
- just use `uiLayoutSetPropDecorate` to flag the row properly

This patch does later.

Differential Revision: https://developer.blender.org/D13159
2021-11-09 16:54:50 +01:00
0bdf9d10a4 Merge branch 'blender-v3.0-release' 2021-11-09 16:46:58 +01:00
cc949f0a40 Fix: wrong attribute propagation in Distribute node
Currently the Distribute Points on Faces node does not propagate
non-point attributes correctly. That is because it first interpolates the
attributes to the point domain on the input mesh, and then propagates them.

Differential Revision: https://developer.blender.org/D13148
2021-11-09 16:46:04 +01:00
fb0ae66ee5 Merge branch 'blender-v3.0-release' 2021-11-09 16:10:19 +01:00
Pablo Vazquez
368d794407 Cleanup: Remove SMALL_TRI_RIGHT_VEC icon
Since the recent change to context paths to use the arrow icon instead of the triangle (D13106),
the `SMALL_TRI_RIGHT_VEC`is no longer used. This patch removes the icon and all references.

- Replace `SMALL_TRI_RIGHT_VEC` with `RIGHTARROW` in Freestyle UI
- Remove references to `SMALL_TRI_RIGHT_VEC` and `ICON_SMALL_TRI_RIGHT_VEC`.

Fix for built-in add-ons has been done in rBAcc2f71bfe9b0/rBAa84028f8a89a.

This will be added to the list of breaking changes [[ https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Python_API#Breaking_Changes | in the Wiki ]].

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D13130
2021-11-09 16:09:53 +01:00
8eff3b5fe0 Cycles: add AMD driver version info for HIP on Windows 2021-11-09 15:42:48 +01:00
5f44298280 Fix T92645: Cycles OSL crash due use of uninitialized pointer
Thanks to Ilja Razinkov for identifying the problem and solution.
2021-11-09 15:29:41 +01:00
9dc3f454d9 Merge branch 'blender-v3.0-release' 2021-11-09 11:27:25 -03:00
9b2f212016 Fix T92939: Crash on drop when a curve is the active object
The active object was being set as the edited object even though it was
not in edit mode.
2021-11-09 11:26:45 -03:00
07a4338b3a View3D Snap Cursor: make the pool a little more restrictive
The snap cursor tagged overlapping regions to redrawn even though the
cursor itself is not drawn.
2021-11-09 11:26:41 -03:00
Demeter Dzadik
c092cc35b3 Expose BLI_string_flip_side_name as bpy.utils.flip_name
Expose a new function in `bpy.utils.flip_name(name, strip_number=False)
that allows flipping bone names, eg "Bone.L" -> "Bone.R".

Useful for add-ons to avoid re-implementing Blender's name flipping.

Ref D12322
2021-11-10 01:19:04 +11:00
accdd4c1bc Merge branch 'blender-v3.0-release' 2021-11-09 15:08:37 +01:00
41607ced2b Node Editor: Display warning when using Nishita sky texture with Eevee
Nishita sky is not available in Eevee, display a warning to make this clear inside the Sky texture node.

Differential Revision: https://developer.blender.org/D13161
2021-11-09 15:07:29 +01:00
625349a6bd Cleanup: spelling, C style comments 2021-11-10 00:56:17 +11:00
65bbac6692 Cleanup: clang-format 2021-11-10 00:55:38 +11:00
faeb2cc900 Merge branch 'blender-v3.0-release' 2021-11-09 14:49:47 +01:00
440a3475b8 Cycles: Improve OptiX denoising with dark images and fix crash when denoiser is destroyed
Adds a pass before denoising that calculates the intensity of the image, which can be
passed into the OptiX denoiser for more optimal results for very dark or very bright images.

In addition this also fixes a crash that sometimes occurred on exit. The OptiX denoiser object
has to be destroyed before the OptiX device context object (since it references that). But in
C++ the destructor function of a class is called before its fields are destructed, so
"~OptiXDevice" was always called before "OptiXDevice::~Denoiser" and therefore
"optixDeviceContextDestroy" was called before "optixDenoiserDestroy", hence the crash.

Differential Revision: https://developer.blender.org/D13160
2021-11-09 14:49:00 +01:00
9daf6a69a6 Fix T92472: OptiX denoising artifacts with recent GPU driver 495.29.05 or newer on Linux
Adds a workaround for a driver bug in r495 that causes artifacts with OptiX denoising.
`optixDenoiserSetup` is not working properly there when called with a stream other than the
default stream, so use the default stream for now and force synchronization across the entire
context afterwards to ensure the other stream Cycles uses to enqueue the actual denoising
command cannot execute before the denoising setup has finished.

Maniphest Tasks: T92472

Differential Revision: https://developer.blender.org/D13158
2021-11-09 14:47:26 +01:00
0bcf014bcf Merge branch 'blender-v3.0-release' 2021-11-10 00:38:51 +11:00
65c5ebf577 Fix T91923: Save/Apply as Shape Key ignores shape keys
Support virtual modifiers when using applying the modifier as a shape.
2021-11-10 00:33:22 +11:00
0b01b81754 Tests: disable Cycles tests based on more build options
WITH_OPENCOLORIO and WITH_COMPOSITOR are required to run the tests at all,
since they affect many tests.

WITH_OPENSUBDIV WITH_FREESTYLE, WITH_OPENVDB, WITH_OPENIMAGEDENOISE and
WITH_MOD_FLUID selectively disable some tests.
2021-11-09 13:55:35 +01:00
41b0820ddd Merge branch 'blender-v3.0-release' 2021-11-09 13:31:33 +01:00
45bd98d4cf Fix T92934: crash rendering with wrong image path
These null checks were missing in rB0c3b215e7d5456878b155d13440864f49ad1f230.

Differential Revision: https://developer.blender.org/D13157
2021-11-09 13:31:01 +01:00
6c24cafecc Fix T92876: Cycles incorrect volume emission + absorption handling 2021-11-09 13:13:56 +01:00
cb487b6507 Asset Catalogs: add test for proper shortening of simple names
Catalog simple names are supposed to fit into the DNA field `char
AssetMetaData::catalog_simple_name[64]`, and thus should be shortened
appropriately. This was already happening, but is now also covered by a
test.

No functional changes.
2021-11-09 13:13:30 +01:00
09f1be53d8 Fix T92950: spreadsheet shows 0 instances when there are instances
Fix found by @erik85.
2021-11-09 13:10:13 +01:00
c56cf50bd0 Fix T92876: Cycles incorrect volume emission + absorption handling 2021-11-09 13:04:58 +01:00
Demeter Dzadik
de8e13036b Armature Make/Clear Parent: Grey out options that don't do anything
In armature edit mode, the Make/Clear Parent operators don't do anything
in various cases, but only one of these cases was previously indicated,
and it was indicated by hiding the option completely instead of graying
it out.

Clear Parent (Alt+P) problems fixed:
- "Clear Parent" option always showed up, even when none of the selected
  bones had a parent.
- "Disconnect Bone" option always showed up, even when use_connected on
  all selected bones was already false.

Make Parent (Ctrl+P) problems fixed:
- "Keep Offset" option didn't show up when all selected bones' parent
  was already the active bone. This was correct, and this patch tries to
  make all behaviours consistent with this.
- "Connected" option always showed up, even when all selected bones'
  parent was already the active bone, and they all had use_connect set
  to True.

With this patch all options show up all the time, but in cases where
they would do nothing, they will be grayed out.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D6100
2021-11-09 12:16:30 +01:00
Cody Winchester
4e2478940e Alembic: Allow exporting of animated vertex colors
Allow exporting of animated vertex colors to Alembic.

The changes are made to be in line with the way the UV Maps are written.
Each vertex color gets a OC4fGeomParam created and mapped into the
CDStreamConfig to avoid recreating the Param on each frame.

The time sample index is also stored in the config now and set onto the
UV and Vertex Color params each frame. Without this the exports would
get inconsistent timing results where animated UV maps and Vertex Colors
were not playing back at the original speed.

Reviewed By: sybren

Maniphest Tasks: T88074

Differential Revision: https://developer.blender.org/D11278
2021-11-09 10:54:13 +01:00
6b0a6c2ca9 Merge branch 'blender-v3.0-release' 2021-11-09 10:34:07 +01:00
04b4ec7889 Fix T92318: adding layers (UVs, ...) doesn't notify about limit
When adding certain customdata layers (namely UVs, vertex colors and
sculpt vertex colors), the user does not get notified the specific limit
has been hit (blender just silently does nothing).

Now inform the user [decided to not do this in poll() since it could get
messy once operators are extended to operate on all selected objects, so
left this as a visible error in execute() -- or from python].

Maniphest Tasks: T92318

Differential Revision: https://developer.blender.org/D13147
2021-11-09 10:19:51 +01:00
ad679ee747 Merge branch 'blender-v3.0-release' 2021-11-09 10:07:44 +01:00
Fynn Grotehans
486d1e8510 Fix T92559: Tracking camera presets don't work
New tracking-camera presets d486ee2dbd used wrong code because I
copied them from the camera-presets. Now they set the right properties
again, the values stay the same as before.

Differential Revision: https://developer.blender.org/D13139
2021-11-09 10:06:28 +01:00
a7540f4b36 Merge branch 'blender-v3.0-release' 2021-11-09 17:11:35 +11:00
2eb94f3036 Fix T92384: Wrong UV layers used with Boolean Modifier (Fast Solver)
Ensure the layers from the source mesh are used instead of the
object referenced by the boolean modifier.
2021-11-09 17:07:23 +11:00
2772a033c9 Merge branch 'blender-v3.0-release' 2021-11-09 15:49:41 +11:00
8772a6fb9b Merge branch 'blender-v3.0-release' 2021-11-09 15:49:38 +11:00
b3597f310d Fix T92469: Transform tools inaccessible in weight-paint + pose mode
Expose transform tools when in weight paint mode with pose-mode enabled,
displaying transform tools in the toolbar, as is already done in
object & pose mode.

These are only shown when weight-paint + pose mode are active at once.

This allows single key-strokes to activate tools, needed when
tool-access is set as the default action for G/R/S key bindings.

Reviewed By: JulienKaspar

Ref D13028
2021-11-09 15:43:34 +11:00
Jeducious
d5d97e4169 Fix T92704: Redrawing while saving crashes outside the main thread
If the blend file is saved from a script in another thread,
like the render thread for example, Blender will crash on the call that
redraws the UI.

Ref D13140
2021-11-09 15:28:00 +11:00
Jeducious
afc60f9957 Fix T92704: Redrawing while saving crashes outside the main thread
If the blend file is saved from a script in another thread,
like the render thread for example, Blender will crash on the call that
redraws the UI.

Ref D13140
2021-11-09 15:18:15 +11:00
e0dae0f98f Merge branch 'blender-v3.0-release' 2021-11-08 16:57:19 +01:00
ab7214ca2e Fix performance issues with pose library sidebar and many poses
When the asset view in the sidebar of the pose library would contain
more than a few handful poses, interaction and animation playback
performance would be impacted considerably. This was because our icon
drawing scales image buffers using a rather slow method on the CPU.
This commit changes it so the asset icons are scaled using the GPU.

Note that this is a temporary change. I'd like all icon code to use
GPU-side scaling, see D13144. But such a change is too risky to do in
the release branch at this point, so this fix is specifically for the
3.0 release.
2021-11-08 16:56:42 +01:00
fe2ed4a229 Merge branch 'blender-v3.0-release' 2021-11-08 18:44:39 +03:00
abab16f7c7 Fix T92043: Relax/Push Pose does nothing for quaternion rotation.
As can be confirmed by checking generic code for this operation,
it is supposed to blend between the result of Breakdown based on
actual frame range, and the current pose. However for some reason
the quaternion specific code was blending between the current pose
and the current keyframed pose. This means that the operation does
nothing if invoked without modifying the pose first.

This rewrites the code to match the non-quaternion behavior.

Differential Revision: https://developer.blender.org/D13030
2021-11-08 18:44:21 +03:00
33beec1cec Cleanup: remove redundant arg when forcing zero initialization 2021-11-08 12:41:30 -03:00
e1c4e5df22 GPencil: New option to export PDF full scene
This new mode export all frames of the scene.

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D13055
2021-11-08 16:03:30 +01:00
c865577643 GPUTest: Add support to test on Windows.
On windows the OpenGL context wasn't activated when created, on Linux it
is. This patch will activate the context in gpu/draw test cases.
2021-11-08 15:49:51 +01:00
Jarrett Johnson
495e60c0da Basic engine shaders test
This patch adds shader compilation tests for the basic engine in `shaders_test.cc`

Addresses T92701

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D13066
2021-11-08 15:43:50 +01:00
bb6547cb5f Merge branch 'blender-v3.0-release' 2021-11-09 00:25:49 +11:00
c55d0ebea5 Merge branch 'blender-v3.0-release' 2021-11-09 00:25:46 +11:00
393ef4d871 Fix T92481: Memory leak with subdivision surface modifier
Interpolation vertex data on loose edges was writing into already
allocated data.

Resolve this by skipping vertex end-points for custom-data interpolation
which has already been copied from the source mesh.

Reviewed By: sergey

Ref D13082
2021-11-09 00:24:03 +11:00
cd8350764b Docs: improve comments & doc-strings for the tool-system 2021-11-09 00:23:55 +11:00
Bastien Montagne
d6e2210935 Fix inconsistent creation of NodeTreeTypeUndefined type of node tree
Currently, when creating a new node tree ID, its `typeinfo` is set to
`NodeTreeTypeUndefined`, but its `type` enum value is left to `0`,
aka `NTREE_SHADER`.

This patch adds a new `NTREE_UNDIFINED` value, and use it for
`NodeTreeTypeUndefined` types of node trees.

NOTE: While it is not clear whether that actually fixes issues currently,
quite a bit of code still relies on the value of `type`, so think it
makes sense to sanitize this.

NOTE: Would have been ideal to reserve `0` value to undefined type,
but at this point this is not possible anymore, so chose to use `-2` instead.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13123
2021-11-08 12:24:47 +01:00
fc373af8f5 Nodes: store socket declaration reference in socket
Previously, to get the declaration of a socket, one had to go
through `node->declaration`. Now this indirection is not necessary
anymore. This makes it easier to add more per-socket information
into the declaration and accessing it in various places.

Currently, this system is used by socket descriptions and node warnings
for unsupported geometry component types.
2021-11-08 12:24:01 +01:00
09cef0fc00 Fix ASAN issue in image editor.
Adding virtual constructors to base classes.
2021-11-08 11:37:42 +01:00
ee4966d146 Merge branch 'blender-v3.0-release' 2021-11-08 17:19:08 +11:00
c3f5fca8a2 Cleanup: avoid error prone struct declarations in C++
Reference struct members by name instead relying on their order.
This also simplifies moving back to named members when all compilers
we use support them.
2021-11-08 17:00:36 +11:00
de581a2302 Fix reading the 3rd value of 2D cursors when transforming
Out of bounds read and potential out-of-bounds write when transforming
the 2D cursor for image editor and sequencer.

While this didn't cause user visible bugs in my tests,
it's error prone and should be avoided.

Use TransData2D for 2D cursors.
2021-11-08 17:00:36 +11:00
fb4b737518 CMake: add missing headers to CMake lists 2021-11-08 17:00:36 +11:00
27b37517f8 Cleanup: use static sets 2021-11-08 17:00:36 +11:00
42df2a7b57 Cleanup: Grammar in comments 2021-11-07 23:20:29 -06:00
0969dcc861 Fix reading the 3rd value of 2D cursors when transforming
Out of bounds read and potential out-of-bounds write when transforming
the 2D cursor for image editor and sequencer.

While this didn't cause user visible bugs in my tests,
it's error prone and should be avoided.

Use TransData2D for 2D cursors.
2021-11-08 15:22:02 +11:00
8fa8e8bc37 Cleanup: quiet compiler warnings 2021-11-08 14:52:27 +11:00
34d289f98c CMake: add missing headers to CMake lists 2021-11-08 14:52:08 +11:00
c516659b5e Cleanup: use static sets 2021-11-08 14:52:08 +11:00
0f80602632 Cleanup: remove references to non-existent 'mtexpoly' 2021-11-08 14:14:16 +11:00
b24a03e635 Cleanup: remove duplicate doc-strings
Internal struct ObTfmBack had out of sync doc-strings
for members duplicated from Object.

Remove the doc-strings as there is this is just temporary storage.
2021-11-08 14:14:15 +11:00
ed24b7d9a2 Cleanup: spelling in comments 2021-11-08 14:14:14 +11:00
3b726cfee8 Cleanup: compiler warnings 2021-11-08 14:14:13 +11:00
0654c41b0c Cleanup: use doxygen for BLF glyph
- Use doxy formatted functions.
- Use doxy sections.
2021-11-08 13:37:51 +11:00
4f387e66ac Merge branch 'blender-v3.0-release' 2021-11-07 20:45:19 -03:00
56ee96349d Fix snap cursor not active even if gizmo is available
Error introduced in rB69d6222481b4 and partially fixed in rB24310441ddc8.

When gizmo was turned on but the scene has more than one 3D viewport, one of them the snap cursor did not appear.
2021-11-07 20:44:20 -03:00
892da668dc Cleanup: Clang tidy 2021-11-07 00:39:20 -05:00
eddf5ad581 BLF: Refactor blf_glyph.c
Cleanup and Simplification of blf_glyph.c

See D13095 for details.

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

Reviewed by Campbell Barton
2021-11-06 11:29:48 -07:00
6002914f14 Cleanup: Convert mesh.c to C++
This commit renames mesh.c to mesh.cc and makes
it compile in C++. Can be useful in the future to be able
to use C++ functionality in existing and new functions.

Differential Revision: https://developer.blender.org/D13134
2021-11-06 19:16:37 +01:00
f315a46982 Nodes: add preview image storage to node group
This is part of T92811.

Differential Revision: https://developer.blender.org/D13105
2021-11-06 16:43:26 +01:00
81baeec59b Cleanup: remove window_manager & editor includes from BLF
Remove the need to include the window manager & editor functions
in low level font rendering code.

- The default font size is now set when changed in the preferences.
- Flushing cache is set as a callback.
2021-11-06 16:28:02 +11:00
a804a11db1 Merge branch 'blender-v3.0-release' 2021-11-05 17:22:06 -05:00
7a5b8cb202 Cleanup: Decrease variable scope, rename functions 2021-11-05 17:17:37 -05:00
48841c479f Merge branch 'blender-v3.0-release' 2021-11-05 18:00:01 -04:00
6c83001143 Update RNA to user manual url mappings 2021-11-05 17:59:17 -04:00
9e611c5616 Merge branch 'blender-v3.0-release' 2021-11-05 16:33:08 -05:00
Leon Leno
9be49a1069 Fix: Property editor icon jittering in some cases
In the tools tab, the tool icon would be offset when it intersected
the bottom of the editor. With some screen resolutions, the icons on
the left side of the editor would also move when intersecting the
bottom of the editor. This happened because of the truncation in
the implicit conversion from float to int. Instead, use explicit
conversion functions.

Differential Revision: https://developer.blender.org/D11097
2021-11-05 16:32:35 -05:00
97ff37bf54 Cycles: perform CPU film reading in the kernel, to use AVX2 half conversion
Adds a bunch of CPU kernel function to process on row of pixels, and use those
instead of calling unoptimized implementations.

Fixes T92598
2021-11-05 22:04:36 +01:00
d1a9425a2f Fix T91733, T92486: Cycles wrong shadow catcher with volumes
Changes:
* After hitting a shadow catcher, re-initialize the volume stack taking
  into account shadow catcher ray visibility. This ensures that volume objects
  are included in the stack only if they are shadow catchers.
* If there is a volume to be shaded in front of the shadow catcher, the split
  is now performed in the shade_volume kernel after volume shading is done.
* Previously the background pass behind a shadow catcher was done as part of
  the regular path, now it is done as part of the shadow catcher path.

For a shadow catcher path with volumes and visible background, operations are
done in this order now:

* intersect_closest
* shade_volume
* shadow catcher split
* intersect_volume_stack
* shade_background
* shade_surface

The world volume is currently assumed to be CG, that is it does not exist in
the footage. We may consider adding an option to control this, or change the
default. With a volume object this control is already possible.

This includes refactoring to centralize the logic for next kernel scheduling
in intersect_closest.h.

Differential Revision: https://developer.blender.org/D13093
2021-11-05 20:50:19 +01:00
f0bc7f3261 Merge branch 'blender-v3.0-release' 2021-11-05 20:40:02 +01:00
4b56eed0f7 Fix T92566: Cycles distant lights too dim in reflections 2021-11-05 20:24:13 +01:00
f24ad274cb Fix T92503: Cycles OSL crash with object attributes
Can't cast to float4 because it might not have correct alignment.
2021-11-05 20:07:03 +01:00
81bee0e75a UI: Fix minor theme mismatch
Pie menu got wrong item highlight and options settings were outdated.
2021-11-05 19:20:47 +01:00
3211c80a31 Fix T92815: Incorrect handling of evaluated meshes from curves
Evaluated meshes from curves are presented to render engines as
separate instance objects now, just like evaluated meshes from other
object types like point clouds and volumes. For that reason, cycles
should not consider curve objects as geometry (previously it did,
meaning it retrieved a second mesh from the curve object as well
as the temporary evaluated mesh geometry).

Further, avoid adding a curve object's evaluated mesh as data_eval,
since that is special behavior for meshes that is arbitrary. Adding an
evaluated mesh there but not an evalauted pointcloud is arbitrary,
for example. Retrieve the evaluated mesh in from the geometry set
in BKE_object_get_evaluated_mesh now, to support that change.

This gets us closer to a place where all of an object's evaluated data
is stored in geometry_set_eval, and we just have helper functions
to access specific geometry components.

Differential Revision: https://developer.blender.org/D13118
2021-11-05 19:20:47 +01:00
ae899e4bb8 UI: Fix minor theme mismatch
Pie menu got wrong item highlight and options settings were outdated.
2021-11-05 19:10:03 +01:00
8d2a0d9b4c UI: Apply recent theme fixes for Preferences saved in 3.1 builds
Followup to e65230f0c0.

Pablo and I decided it's fine to reset themes again when saved with the
recent 3.1 builds.

This needed to be done a bit careful, since a normal version patch
resetting the theme would've reset the theme for anybody opening
preferences of a 3.0 build (even the final release build) in a 3.1
build. So make sure the theme is at least from a 3.1 build (but not
newer then this commit of course).
2021-11-05 19:00:10 +01:00
cc49c479a7 Cleanup: Use reference for non-optional C++ parameter
A reference makes clear that NULL is not an expected value. So it's the
prefered way of passing a `const` input parameter (at least if it may
not be cheap to copy).
2021-11-05 18:27:55 +01:00
1bc655c5aa Fix T92815: Incorrect handling of evaluated meshes from curves
Evaluated meshes from curves are presented to render engines as
separate instance objects now, just like evaluated meshes from other
object types like point clouds and volumes. For that reason, cycles
should not consider curve objects as geometry (previously it did,
meaning it retrieved a second mesh from the curve object as well
as the temporary evaluated mesh geometry).

Further, avoid adding a curve object's evaluated mesh as data_eval,
since that is special behavior for meshes that is arbitrary. Adding an
evaluated mesh there but not an evalauted pointcloud is arbitrary,
for example. Retrieve the evaluated mesh in from the geometry set
in BKE_object_get_evaluated_mesh now, to support that change.

This gets us closer to a place where all of an object's evaluated data
is stored in geometry_set_eval, and we just have helper functions
to access specific geometry components.

Differential Revision: https://developer.blender.org/D13118
2021-11-05 11:51:34 -05:00
aaf86bad87 Merge branch 'blender-v3.0-release' 2021-11-05 11:19:29 -05:00
c473b2ce8b Fix part of T89313: Attribute search crash during animation playback
During animation playback, data-blocks are reallocated, so storing
pointers to the resulting data is not okay. Instead, the data should
be retrieved from the context. This works when the applied search
item is the "dummy" item added for non-matches. However, it still
crashes for every other item, because the memory is owned by the
modifier value log, which has been freed by the time the exec function
runs.

The next part of the solution is to allow uiSearchItems
to own memory for the search items.
2021-11-05 11:19:12 -05:00
212dcd6075 Merge branch 'blender-v3.0-release' 2021-11-05 10:57:04 -05:00
594ee5f160 Fix T92848: Crash when joining curves with spline domain attributes
The point domain attributes (stored on splines) are sorted so they
have a consistent order on all splines after the join. However, spline
domain attributes were included in the new order, which didn't work
because the length of the attribute lists didn't match. The simple fix
is to only include point domain attributes in the new order vector.
2021-11-05 10:55:51 -05:00
bbd8d33453 Merge branch 'blender-v3.0-release' 2021-11-05 16:23:56 +01:00
Pablo Vazquez
7c75529333 UI: Use arrow icon on context paths
The current `ICON_SMALL_TRI_RIGHT_VEC` uses dark hard-coded colors ([`0.2`, `0.2`, `0.2`])
which makes it impossible to theme and hard to see in dark contexts.

Use `ICON_RIGHTARROW` to match the Outliner's breadcrumbs. This icon uses `TH_TEXT` so it's visible as long as the rest of the text is.

##### Master
(Properties editor background made red on purpose to be able to see the triangle icon)
{F11713038, size=full}

#### This patch
{F11713039, size=full}

Reviewed By: #user_interface, Severin, HooglyBoogly

Maniphest Tasks: T92771

Differential Revision: https://developer.blender.org/D13106
2021-11-05 16:23:22 +01:00
87e2154daf Fix: Viewport stats wrong for Geometry Nodes instances
In some cases when geometry is created in Geometry Nodes
the viewport stats will show 0 because runtime data is not filled.
This patch sets the runtime data on instances.

Differential Revision: https://developer.blender.org/D12738
2021-11-05 16:19:09 +01:00
f415b41a94 Merge branch 'blender-v3.0-release' 2021-11-05 09:59:26 -05:00
616594fcb1 Fix T92850: Curve to mesh incorrect for single point profiles
For single point splines that weren't at the origin, the results were
incorrect. Now take into account the tilt, radius, etc. just like the
general case.
2021-11-05 09:52:25 -05:00
625b2f59f0 Fix GCC warnings after own recent commit
Caused by 4e09fd76bc.
2021-11-05 15:32:11 +01:00
2986924301 Cleanup: Remove misleading comment
Python isn't doing any conversion here. We just do a regular lookup of
the given enum identifier in the RNA enum definition.
2021-11-05 15:32:11 +01:00
29efd26e71 Cleanup: Remove redundant scope qualifiers. 2021-11-05 15:18:58 +01:00
885c79915f Merge branch 'blender-v3.0-release' 2021-11-05 15:08:09 +01:00
e65230f0c0 UI: Various theme fixes related to contrast
* Animation channels (Fixes T92612)
* Curve widget (Fixes T92595)
* Pie menu (Fixes T92590)
* Radio and toggle buttons background
* Checkbox background
* Fix highlighted marker name on Dopesheet (text highlight on Dopesheet)


#### Master
{F11697667, size=full}

#### This Patch
{F11697669, size=full}
{F11697849, size=full}
{F11697833, size=full}
{F11697852, size=full}

Reviewed By: #user_interface, campbellbarton, Severin

Maniphest Tasks: T92595, T92612, T92590

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

# Conflicts:
#	source/blender/blenkernel/BKE_blender_version.h
2021-11-05 15:06:37 +01:00
Pablo Vazquez
b4af70563f VSE: Remove separator lines between rows
The VSE grid theme setting is currently used for two things:

* Indicate time intervals (vertical lines)
* As separator between channels (horizontal lines)

This adds visual noise because for the time interval to be visible, the
grid color needs to be bright, resulting in a rectangle-grid backdrop.

Recently, the VSE got a theme setting to customize alternate-row background color.
This should be sufficient to tell the channels apart without the need for a line in between.

Additionally, this patch makes the VSE background use the theme setting as-is,
without hard-coded darkening, to ease the tweaking of themes.  This aligns the style
of the VSE backdrop with the rest of Blender (Outliner rows, File Browser, Spreadsheet,
Info and animation editors).

Related reports: T92581
Related task: T92792

#### Before
{F11680317, size=full}

#### After
{F11694981, size=full}

Reviewed By: #user_interface, Severin

Maniphest Tasks: T92581

Differential Revision: https://developer.blender.org/D13072
2021-11-05 15:06:37 +01:00
a0f50c1890 Merge branch 'blender-v3.0-release' 2021-11-05 15:06:10 +01:00
da97859656 Fix potential uninitialized memory in link/append code. 2021-11-05 15:05:45 +01:00
4e09fd76bc Cleanup (UI): Add/use type for operator context enum
Adds a `wmOperatorCallContext` typedef for the existing `WM_OP_XXX`
operator context enum. This adds type safety, allows the compiler to
produce better warnings and helps understanding what a variable is for.

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

Reviewed by: Campbell Barton
2021-11-05 14:57:26 +01:00
35198606d5 Cleanup: Remove wrong comments in versioning
This comment is from the block at the end of the versioning functions,
where we have an unversioned block to collect versioning code that
doesn't require immediate version bumping. The comment was probably just
copied over with the code when bumping the version eventually.
2021-11-05 14:53:57 +01:00
00734d5724 Fix T92807: Incorrect display planar tracking.
Issue introduced in {7e66616b7e15} where the shader was replaced with a
2d image shader. This patch reverts several commits that removed the 3d
image shader.
2021-11-05 14:51:55 +01:00
32c90d2d7c Cleanup: Split image engine into ImageEngine, SpaceAccessor and DrawingMode.
Image engine is used to draw an image into a space. The current
structure wasn't clear and couldn't be easilly extended. This refactor
spliced the image draw engine into 3 main components.

- Space accessors: contains an interface to communicate with space data
  (Image editor, UV Editor, Node Editor) in a common way. This reduced
  the branching in the code base.
- DrawingMode: contains an interface to the used tactic to draw an image
  inside the space framebuffer. Currently only one mode is implemented;
  in the future there could be a separate drawing mode for huge images.
- ImageEngine: the core that connects the draw manager with the space
  data and drawing mode.
2021-11-05 13:25:00 +01:00
29e5c330cf GPencil: Fix dash modifier missing vertex color.
The original code did not copy vertex color to the generated stroke,
now fixed.
2021-11-05 20:04:14 +08:00
d7f4fdf845 GPencil: Fix dash modifier missing vertex color.
The original code did not copy vertex color to the generated stroke,
now fixed.
2021-11-05 20:02:35 +08:00
016a575002 Merge branch 'blender-v3.0-release' 2021-11-05 16:05:00 +11:00
3a4dade2f8 Merge branch 'blender-v3.0-release' 2021-11-05 16:04:57 +11:00
b9968b83ad Merge branch 'blender-v3.0-release' 2021-11-05 16:04:52 +11:00
40d090cc72 Merge branch 'blender-v3.0-release' 2021-11-05 16:04:43 +11:00
5cc21b095a Merge branch 'blender-v3.0-release' 2021-11-05 16:04:40 +11:00
68e86c4816 Cleanup: use (s) postfix for messages that may be plural
Ref 01c824ac88
2021-11-05 15:58:01 +11:00
9b1882f986 Cleanup: replace face-map reference in gizmo example
Copy-paste error.
2021-11-05 15:52:17 +11:00
445361c2ac Fix T70768: Python gizmo-groups not working in the sequencer 2021-11-05 15:49:33 +11:00
82efcfc188 Correct assert checking gizmo type 2021-11-05 15:49:04 +11:00
c5ace142e6 Fix PyAPI integer conversion error handling
Non integer types raised an OverflowError, even when non-number
types were passed in.

Now the error from Python is kept.
2021-11-05 15:37:17 +11:00
7061d1e39f Fix T92740: Missing lock around the image CacheLimiter
A recent change exposed this long-standing race. Simply protect the
MEM_CacheLimiter with its lock now. Additionally, guard against
unmanaging an already destroyed cache handle.

Ref T92740, T92838
2021-11-04 20:58:32 -07:00
1b6238edba Merge branch 'blender-v3.0-release' 2021-11-05 13:45:32 +11:00
5b7a14c019 Cleanup: use doxy sections in graph editor module 2021-11-05 13:38:58 +11:00
9d2e325694 Cleanup: spelling/typos 2021-11-05 13:38:58 +11:00
50b0503a11 Revert "Fix T92464: Operators fail after opening blend files via an operator"
This reverts commit 9bd97e62ad.

This caused T92818.

Event handling relies on checking for NULL window to detect file load in
enough different areas of the code that this isn't a practical solution.

Revert this change in favor of an alternative approach.
2021-11-05 13:32:53 +11:00
Christoph Lendenfeld
3364a5bea6 Cleanup: move code in graph_slider_ops
Future operators can use the same code,
so it is moved up to disassociate it from decimate

No functional changes

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12489
Ref: D12489
2021-11-04 21:35:28 +00:00
Christoph Lendenfeld
6986b43b3d Cleanup: renames in graph_slider_ops
This patch renames:
* tDecimateGraphOp to tGraphSliderOp
* dgo to gso (to match with the struct rename)
* decimate_reset_bezts to reset_bezts to indicate it can be used by other functions

No functional changes

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12490
Ref: D12490
2021-11-04 21:20:26 +00:00
df3e30398f Merge branch 'blender-v3.0-release' 2021-11-04 16:56:32 -03:00
e7e3431b29 Cleanup: Move object.c to C++
This is useful to allow the use of features made in C++.

Differential Revision: https://developer.blender.org/D13115
2021-11-04 16:51:37 -03:00
e51735d276 Cleanup: fix typo 2021-11-04 20:36:35 +01:00
Brecht Van Lommel
4960ad420b Cycles: add code to check for supported HIP device architectures
RDNA2 only for now to be conservative, but testing more hardware is underway.

Ref T92393

Differential Revision: https://developer.blender.org/D12958
2021-11-04 20:34:21 +01:00
Brian Savery
36f5198282 Fix Cycles HIP Kernels loading on Arch names with extra options
The kernel file names are search for based on the arch name, for example
gfx1010. However HIP's gcnArchName can contain options such as xnack- in
the name. For example gfx1010:sramecc-:xnack-.

This revision tokenizes the info from gcnArchName and just uses the first
token for choosing the Kernel file to use. Kernels are portable across those
features in the arch name.

Also remove the bit for recompiling ptx as clearly that is not relevant.

Differential Revision: https://developer.blender.org/D13117
2021-11-04 20:24:39 +01:00
556c71a84a GPencil: New option to Merge All layers in active one
This new option allows to combine all layers in the active one. Also the merge down option has been improved.

Reviewed By: mendio, pablo vazquez (UI)

Differential Revision: https://developer.blender.org/D13054
2021-11-04 19:40:55 +01:00
5c34e34195 Fix part of T91797: Cycles CPU and GPU render differences with camera inside volume 2021-11-04 19:03:49 +01:00
1c6d3d614a Minor tweaks to new append code.
* Name generated 'append' collection, instead of getting a generic
  meaningless name.
* Do not check if a collections's objects are already instantiated, when
  we already know that we want to instantiate that collection.
2021-11-04 19:00:22 +01:00
101fa4a425 Merge branch 'blender-v3.0-release' 2021-11-04 18:32:37 +01:00
c7fcc50842 Fix T91986: incorrect syncing of geometry instances
The issue was that some geometries were not synced again even when
they changed. This commit adds a map that keeps track of the geometries
that need to be updated when an object has changed.

Differential Revision: https://developer.blender.org/D13020
2021-11-04 18:32:01 +01:00
b7260ca4c9 Fix T92799: handle undefined node group type in field inferencing
A group node could reference an undefined group when the group
was linked and its source file was not found on load. The field
inferencing code did not handle that case before.

With this change, the file provided in T92799 loads successfully.
2021-11-04 18:25:48 +01:00
2373ce7fcf Merge branch 'blender-v3.0-release' 2021-11-04 17:27:51 +01:00
2eed1afd11 Fix T92778: Cloth Point Cache Name disappears after Make Library Override.
Cloth modifier had a unique, weird and weak way of copying its
pointcache, now make it use `BKE_ptcache_copy_list` like done for e.g.
particles or softbody data.
2021-11-04 17:16:49 +01:00
a72b26527d Merge branch 'blender-v3.0-release' 2021-11-04 16:50:53 +01:00
ffe115d1a8 Fix T92450: Cycles wrong render with overlapping glass, transparency and volumes
We need to store the continuation probability used to make the termination
decision in intersect_closest, instead of recomputing it in shade_surface.
Because otherwise a shade_volume in between can change the throughput and
change the probability.
2021-11-04 16:39:49 +01:00
2becb3e9af Merge branch 'blender-v3.0-release' 2021-11-04 10:10:52 -05:00
b646846646 Fix T92812: Startup has "Standard" View Transform Instead of "Filmic"
A repeat of the problem I caused last time I edited the startup file.
Never do it with a lite build! Also align the toolbar widths in all
editors to the smallest size they snap to.
2021-11-04 10:10:02 -05:00
37b862fa6c Cleanup: Remove operator context override for drop-box operators
Drop-boxes should act on the context determined through the exact cursor
location. There should be no need to override that, basically by the
nature of how drop-boxes work.
So Campbell and I agreed on removing this.

If we wanted to support it, we'd have to restore the operator context
when drawing drop-boxes, see
https://developer.blender.org/T92501#1247581.
2021-11-04 16:02:54 +01:00
db43d19c16 Merge branch 'blender-v3.0-release' 2021-11-04 15:32:50 +01:00
Pablo Vazquez
9e71a07547 UI: Fix UIList item using "regular" widget colors while edited
Simply removing the check for `UI_STATE_TEXT_INPUT` makes it inherit
the "List Item" User Interface theme settings. This patch changes the
default theme to match the colors of text input fields.

#### Master
{F11680556, size=full}

#### This patch
{F11680557, size=full}

All the included commmunity themes seem to work well (only Deep Grey might
need more contrast but that's a different patch).

Related reports: T92720

Reviewed By: #user_interface, Severin

Maniphest Tasks: T92720

Differential Revision: https://developer.blender.org/D13073
2021-11-04 15:31:48 +01:00
d3328fabc9 Attempt to fix failing lib link test on windows.
According to https://docs.python.org/3/library/os.html#os.rename,
`os.rename` has os-specific behavior, and will fail in case you attempt
to rename to an existing file on windows.

So using `os.replace` instead, which should be os-agnostic.

NOTE: Fact that temp test directory is not cleared after tests are
sucessfully ran does not sound great...
2021-11-04 15:06:58 +01:00
8eff1eca52 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-04 14:50:48 +01:00
be4478d1f8 Fix T92814: improve automatic linking when inserting Float Curve node
This solves the issue in a more general that can also be used to solve
similar issues for other nodes in the future. Nodes can specify their
"main" socket in their declaration so that we don't have to rely on
heuristics.

Differential Revision: https://developer.blender.org/D13108
2021-11-04 14:44:21 +01:00
ff4959eeaa Fix T92649: incorrect copying of anonymous attributes in many places
Many modifiers and other places use `CustomData_copy_data` to copy data
between different meshes. This function assumes that assumes that the
source and destination `CustomData` objects are "compatible" in some way.
Usually modifiers use `CustomData_copy` to create a compatible new
`CustomData` on the new mesh. The issue was that the optimization I added
for anonymous attributes broke this compatibility. It avoided copying some
attributes when they are no longer used.

This lead to attributes being copied incorrectly.
D13083 contains ideas for how this could be fixed more generally.
For now I just removed the optimization.

Differential Revision: https://developer.blender.org/D13083
2021-11-04 14:41:56 +01:00
Charlie Jolly
b5162638c5 Fix: Geometry Nodes: Math node smoothmax not working
Function arguments were incorrect.

Noted during @simonthommes live stream.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D13110
2021-11-04 13:40:42 +00:00
80a46955d8 Fix T92501: Crash when dragging material assets over 3D View regions
Issue was that the context used for dropbox handling and polling didn't
match the one used for drawing the dropbox and generating the tooltip
text (which would determine the material slot under the cursor,
requiring context). The mismatch would happen with overlapping regions.

Actually, this patch includes two fixes, each fixing the crash itself:
* Store the context from handling & polling and restore it for drawing.
* Correct the hovered region lookup for drawing to account for overlayed
  regions.

Note that to properly set up context for drawing, we should also account
for the operator context, which isn't done here, see
https://developer.blender.org/T92501#1247581.
2021-11-04 12:20:37 +01:00
c641107c95 Fix T92800: (UI) Radial control values get wrong color assigned
The global theme state didn't get updated or unset properly when drawing
overlays. Now paint cursors use the theme settings of the space they are
in, while global overlays use the global fallback, which is the main 3D
View region.
2021-11-04 11:52:11 +01:00
978ef093db Cleanup: fix compiler warnings
Those were introduced in rBccead2ed9c6121c42a516712da38a2faec877e2f.
2021-11-04 11:29:16 +01:00
2d6d8fc7ca Attempt fix for new lib reload/relocate tests on windows.
Try splitting them into their own class.
2021-11-04 11:25:30 +01:00
82b20b6975 Merge branch 'blender-v3.0-release' 2021-11-04 10:51:40 +01:00
bfb664b65d Fix T92791: collapsed nodes scaling widget wrong with interface scale
Size, position and scale of the "two-line" widget (the one to scale a
node horizontally) was not taking interface scale into account. In the
case of the report, it could happen it draws behind an output socket.

before (at 2.0 interface scale)
{F11698493}

after (at 2.0 interface scale)
{F11698501}

Maniphest Tasks: T92791

Differential Revision: https://developer.blender.org/D13088
2021-11-04 10:46:53 +01:00
feaf5b95e0 Merge branch 'blender-v3.0-release' 2021-11-04 08:35:46 +01:00
74ef424cb7 Revert "GPencil: Change default template for better contrast in header"
This reverts commit 5d42ea0369.
2021-11-04 08:33:59 +01:00
36a6528723 Merge branch 'blender-v3.0-release' 2021-11-04 18:10:07 +11:00
08c4f134d2 Fix T92783: Light size controller doesn't update position
Resolve by tagging the gizmo group map for refresh
when the modal gizmo group changes.

Regression in fb27a9bb98.
2021-11-04 18:08:23 +11:00
d7f9f083d4 Merge branch 'blender-v3.0-release' 2021-11-04 14:51:58 +11:00
7c188d8241 Merge branch 'blender-v3.0-release' 2021-11-04 14:51:55 +11:00
9cd5b3c9b6 Merge branch 'blender-v3.0-release' 2021-11-04 14:51:52 +11:00
682f1548be Merge branch 'blender-v3.0-release' 2021-11-04 14:51:50 +11:00
b849f290c5 Cleanup: capitalize ON/OFF with CMake 2021-11-04 14:50:24 +11:00
27103c56b4 Versioning: remove use of translations when loading preferences
Add note why translations can't be used while versioning.
2021-11-04 14:49:25 +11:00
c0fdaf700a Fix the GPencil stroke not sticking to other strokes
Issue seen when setting `Stroke Placement` of type `Stroke`.

Regression introduced in {rBaa0ac0035a0d3601672a0c732e3f8f932a36fc04}.
2021-11-03 18:51:25 -03:00
3e6907eb8a Fix T92002: Cycles baking certain light passes does not work
When reading pixels for virtual passes like diffuse, that sum diffuse direct
and indirect passes, we do not need them to exist with an offset in the render
buffer.
2021-11-03 22:09:13 +01:00
915f911daa Fix Cycles wrong ray visibility with old .blend files 2021-11-03 22:09:13 +01:00
0c6b815855 Geometry Nodes: Add Length Output to Curve Parameter Node
Adds a length output to the curve parameter node which returns the
length of a spline at each point, or the length of the curve at
each spline depending on the domain.

Differential Revision: https://developer.blender.org/D12882
2021-11-03 15:05:46 -05:00
d6ed9c2b40 Merge branch 'blender-v3.0-release' 2021-11-03 14:41:50 -05:00
a9bda98519 Fix: Startup file geometry nodes viewport inconsistent orientation
Copy the orientation from the "Layout" workspace 3D view.
2021-11-03 14:40:09 -05:00
431524aebc Geometry Nodes: Selection outputs for Cone and Cylinder
This adds Top, Bottom and Side selections to the Primitive
Mesh nodes Cone and Cylinder.
2021-11-03 20:20:15 +01:00
ccead2ed9c Spreadsheet: Display geometry volume component grids
This shows a geometry's volume grids in the spreadsheet.
Three columns are displayed:
 - Name: The text name of each grid
 - Data type: Float, Vector, etc.
 - Class: Fog volume, Level Set, or unkown

In the future, values of the voxels themselves could be displayed,
but that is a much more complex problem, with important performance
implications, etc.

Differential Revision: https://developer.blender.org/D13049
2021-11-03 13:45:51 -05:00
Nikhil Shringarpurey
4e5537d841 Geometry Nodes: Add tooltips to primitive node inputs
Building on the work in rBef45399f3be0, this commits adds
tooltips to the inputs for the default primitives nodes.

Differential Revision: https://developer.blender.org/D12640
2021-11-03 13:25:44 -05:00
7aaedc09c7 Merge branch 'blender-v3.0-release' 2021-11-03 18:16:16 +01:00
c29f9e14e4 Fix T92780: Lost material in case of local object, and missing linked obdata.
By default, when syncing materials slots between object and its obdata,
the amount of slots in obdata is the reference.

Missing linked obdata is replaced by an empty placeholder that has no
material. In that specific case, if we have a valid object ID, we want
to update the (placeholder) obdata's material count from the object one,
and not the other way around.
2021-11-03 18:15:51 +01:00
e10caf6fe3 Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-11-03 18:07:36 +01:00
d17128520d Simplification: Use generic BKE_object_materials_test in object liblink code.
Better avoid own specific logic here, when we already have a proper
'API' function for that.
2021-11-03 17:56:25 +01:00
a7672caeb2 Geometry Nodes: Add Selection Input to Resample Curves Node
Add a boolean input to the resample curve node that indicates which
splines should be resampled and which should be unchanged.

Differential Revision: https://developer.blender.org/D13064
2021-11-03 11:55:24 -05:00
Colin
a827864e6b Fix T89709: avoid double node links after delete and reconnect
Differential Revision: https://developer.blender.org/D13062
2021-11-03 17:55:06 +01:00
Yevgeny Makarov
1e590234f7 UI: Fix padding of version label in splash screen
Differential Revision: D13018
2021-11-03 17:54:03 +01:00
c5d08aa0a3 Fix: muted nodes not handled correctly
This was an error in rBb55bddde40db3eda3531d98caa99be9a8e88a8ee.
2021-11-03 17:47:05 +01:00
de2988ea1b Cleanup: Remove effect-less const
Using `const` on an enum type returned by value doesn't have an effect.
2021-11-03 17:28:52 +01:00
debf4b70db Cleanup: Avoid redundant template parameter in BLI serializing API
The `ContainerValue` template can obtain the type of the contained value
via the given `Container` type, simply using `Container::value_type`.
Use this as the default way to determine the value type which simplifies
using the template. If necessary the value type can be passed explicitly
still.
2021-11-03 17:28:20 +01:00
ec5d2e6872 Add documentation for some 'hidden' RNA properties.
Even never-shown RNA properties should have at least a description, as
this is used by API doc generation scripts.

NOTE: this is more of an opportunistic set of changes than a proper
complete fix of that loack of documentation.
2021-11-03 16:13:46 +01:00
ef30a876b5 I18n: Add some more acronyms to the spellchecker. 2021-11-03 16:13:46 +01:00
2ecaa971f0 I18n: Fix several issues with UI messages extraction script.
* Fix systematic skipping of labels when they are the same as
  the identifier (Some cases are valid, like `RGB` or `HSV` e.g.).
* Add instead heuristics checks to skip non-UI properties (non-capitalized,
  or same name as identifier and Operator properties, mainly).
* Skip `bl_icon` and `icon` properties.
* Properly search for properties in all parent classes (some cases with
  e.g. `Panel` would break due to intermediary utils classes, leading to
  those internal UI properties not being skipped as expected).

Related to T43295.
2021-11-03 16:13:46 +01:00
Germano Cavalcante
aa0ac0035a GPencil and Annotation: Use cached depth to perform depth testing operations
Operations such as erasing with occlusion and drawing on the surface
require reading the depth buffer.

However, this is being done with minimal efficiency.

Currently, to read the depth corresponding to each point of the new stroke,
a ReadPixel is called to send a message to the GPU and read the depth of
the corresponding pixel in the VRAM.

The communication between GPU and CPU is known to be a slow operation so
it is good to be avoided.

Therefore, save the entire depth buffer in a cache to be read directly
from the RAM.

(Also the `ED_view3d_autodist_depth` and `ED_view3d_autodist_depth_seg` have
been removed since they are no longer used).

Reviewed By: antoniov, fclem

Differential Revision: https://developer.blender.org/D10894
2021-11-03 12:10:37 -03:00
8b516d8712 Include node name for socket animation channel UI
The channel names were often indistingushable in animation editors.
Now include the node _name_ (unfortunately, getting the _label_ could
result in bad performance in some circustances -- see previous version
of D13085).
Similar to what rB77744b581d08 did for some VSE strip properties.

ref. T91917

Maniphest Tasks: T91917

Differential Revision: https://developer.blender.org/D13085
2021-11-03 15:03:40 +01:00
b73993bcc9 UI: Refactor how dragging onto text buttons works, fixing issues
There was a bunch of special handling to support dropping data-blocks onto
string or search-menu buttons, to change the value of these. This refactor
makes that case use the normal drop-box design, where an operator is executed
on drop that gets input properties set by the drop-box. This should also make
it easier to add support for dragging assets into these buttons.

In addition this fixes an issue: Two tooltips were shown when dragging assets
over text buttons. None should be shown, because this isn't supported.
2021-11-03 15:00:17 +01:00
2a88343213 Merge branch 'blender-v3.0-release' 2021-11-03 14:24:33 +01:00
04d35f9315 Merge branch 'blender-v3.0-release' 2021-11-03 10:23:55 -03:00
0d8f1414a2 Fix access to current preferences when version patching read preferences
The version patch for 0cf9794c7e was checking and setting a data name
using the macros for translation. These would access the current
preferences which can mismatch the ones currently being version patched.
See discussion in 0cf9794c7e for details.

Don't handle translation in this version patch, which is more of a
"nice-to-have" version patch, no functionality depends on it.
2021-11-03 14:23:53 +01:00
f81190f85f Fix T92760: Crash erasing GPencil when occlusion test is enabled
`pt0` was read when `NULL` and `is_occluded_pt1` could be read even if
it is not initialized.
2021-11-03 10:22:36 -03:00
3532da44ee Merge branch 'blender-v3.0-release' 2021-11-03 22:26:39 +11:00
42d0107ee5 Fix crash dissolving overlapping faces
In rare cases disolving faces would crash, caused by iterator
variable reuse in b29a8a5dfe.
2021-11-03 22:17:10 +11:00
5095e4fc22 UI: Display disabled-hint when dragging material outside object mode
Display a "disabled hint" (text explaining why something isn't possible)
when dragging a material over the 3D View, while being in edit mode or
so (anything that isn't object mode).
2021-11-03 11:57:05 +01:00
bdf6665e3a Merge branch 'blender-v3.0-release' 2021-11-03 10:54:53 +01:00
b55bddde40 Fix T91862: do type conversion when data enters or exists node group
The geometry node evaluator now has access to the entire socket path
from the node that produces a value to the node that uses it. This allows
the evaluator to make decisions about at which points in the path the
value should be converted. Multiple conversions may be necessary under
some circumstances with nested node groups.

Differential Revision: https://developer.blender.org/D13034
2021-11-03 10:54:17 +01:00
2b12b4cd7d Fix: make sure geometry owns mesh before taking ownership
Differential Revision: https://developer.blender.org/D13075
2021-11-03 10:42:48 +01:00
e1f1b0841d Merge branch 'blender-v3.0-release' 2021-11-03 15:56:11 +11:00
68759625b1 Fix T92053: Industry compatible key-map fallback tools don't work
Caused by c9d9bfa84a.

Support for fallback tools with right-click select needed
the industry compatible key-map to be updated.
2021-11-03 15:52:42 +11:00
cea7ee7582 Merge branch 'blender-v3.0-release' 2021-11-03 11:49:58 +11:00
7996b49cb0 Cleanup: spelling 2021-11-03 11:42:07 +11:00
8dbca01531 Fix T92515: Incorrect translation when scaling pose bones 2021-11-03 11:24:29 +11:00
ac0eefe26f Merge branch 'blender-v3.0-release' 2021-11-02 18:22:50 -05:00
11392829ad Fix T92316: Inconsistent name for Set Curve Tilt node 2021-11-02 17:38:58 -05:00
c4b73847d3 BLF: Remove Thread Locking For Font Metrics
This patch removes the need to lock the thread just to get to some
generic (not glyph-specific) font metrics.

See D12976 for more details.

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

Reviewed by Campbell Barton
2021-11-02 14:28:25 -07:00
f674176d77 Fix T85676: Cycles EXR merging not working with some single layer EXRs
If there is only a layer without a name, use metadata from the first cycles
layer in the metadata, if any.
2021-11-02 21:24:08 +01:00
8c58838f6a Merge branch 'blender-v3.0-release' 2021-11-02 15:23:59 -05:00
a72ed0bb7f Cleanup: Improve curve point attribute assert
This properly checks the order of point domain attributes on each
spline, and avoids the map, which makes the code easier to understand.
The assert is also added to realizing instances and the join node.

Differential Revision: https://developer.blender.org/D13071
2021-11-02 15:22:49 -05:00
18392cef17 Fix T92652: Joining curves breaks point attribute order
Currently the curve to mesh node relies on the order of attributes being
the same on every spline. This is a worthwhile assumption, because it
will allow removing the attribute name storage duplication on every
spline in the future.

However, the join geometry node broke this order, since it just created
new attributes without any regard to the order. To fix this, I added a
"reorder" step after all the merged attributes have been created, the
types have been joined, etc. It should be possible to change this code
so that the attributes are added with the right order in the first
place, but I would like to do that after refactoring spline attribute
storage, and not for 3.0.

Differential Revision: https://developer.blender.org/D13074
2021-11-02 15:16:52 -05:00
5cd1210b52 Merge branch 'blender-v3.0-release' 2021-11-02 13:44:17 -05:00
7aa311e539 Cleanup: Add function to get attribute ID from custom data layer 2021-11-02 13:43:54 -05:00
48e2a15160 Fix T77681, T92634: noise texture artifacts with high detail
We run into float precision issues here, clamp the number of octaves to
one less, which has little to no visual difference. This was empirically
determined to work up to 16 before, but with additional inputs like
roughness only 15 appears to work.

Also adds misisng clamp for the geometry nodes implementation.
2021-11-02 18:56:25 +01:00
3dcd042bfc Merge branch 'blender-v3.0-release' 2021-11-02 18:38:59 +01:00
978f2cb900 Fix T89487: Crash adding Rigid Body to object with shared mesh data
Not sure why this bug was only discovered by such an elaborate steps
and why it took so long to be discovered. The root of the issue is
that in the 956c539e59 the typical flow of tag+flush+evaluate was
violated and tagging for visibility change happened after flush.
2021-11-02 18:36:24 +01:00
53fdde3f64 Merge branch 'blender-v3.0-release' 2021-11-02 18:14:59 +01:00
3a454beae7 Fix T91094: missing update after collection changed
Since rBb67fe05d4bea2d3c9efbd127e9d9dc3a897e89e6 collections
have a geometry component that depends on all the geometries
inside the collection. Contrary to what I originally thought
`ID_RECALC_COPY_ON_WRITE` does not trigger a collection geometry
update. This makes sense because a collection may change in ways
that do not require a geometry update.
Instead, we have to trigger the geometry update manually now by
passing `ID_RECALC_GEOMETRY` when appropriate.
2021-11-02 18:13:01 +01:00
0a254109b8 Merge branch 'blender-v3.0-release' 2021-11-02 17:52:03 +01:00
29dff8f844 Fix lots of missing messages i18n handling in uiItemL calls.
Also fix several wrong usages of `IFACE_` (as a reminder, error/info
messages should use `TIP_`, not `IFACE_`).
2021-11-02 17:50:18 +01:00
242ad4bd0f Merge branch 'blender-v3.0-release' 2021-11-02 17:49:52 +01:00
20b163b533 UIMessages/i18n: Fix incorrect part of rBdabfac37e35274b.
My bad, forgot lower-level UI code does not handle translations itself.

Thanks to Hans Goudey (@HooglyBoogly) for the heads up.
2021-11-02 17:49:32 +01:00
27621490c2 Merge branch 'blender-v3.0-release' 2021-11-02 18:33:25 +02:00
980bc5a707 UI: Use socket type info color to draw links
Currently, colored links overlay only supports standard sockets defined
by Blender. Some add-ons like Animation Nodes defines custom sockets for
everything and hence doesn't get colored sockets.

This patch uses the draw color from the socket type info to draw links
in order to support custom sockets.

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

Reviewed By: Hans Goudey
2021-11-02 18:29:35 +02:00
12bf4adbe3 Merge branch 'blender-v3.0-release' 2021-11-02 17:05:03 +01:00
2c23256288 Merge branch 'blender-v3.0-release' 2021-11-02 16:03:17 +00:00
dabfac37e3 Fix more UI message/i18n issues. 2021-11-02 17:02:33 +01:00
cde982d672 I18n: Fix all new cpp files not being parsed by UI message extractor.
The 'new' `.cc`/`.hh` extensions were never added to UI message
extractor.

Related to T43295.
2021-11-02 17:02:33 +01:00
Charlie Jolly
6981bee2c7 Fix T92736: Hole in mesh after Set Position
The geometry node port of voronoi_smooth_f1 function has a
division by zero when smoothness is set to zero.
Using a safe_divide within the function causes issues
and was noted in the original patch D12725.
Solution in this case is to clamp zero smoothness to FLT_EPSILON.

Reviewed By: JacquesLucke

Maniphest Tasks: T92736

Differential Revision: https://developer.blender.org/D13069
2021-11-02 15:58:17 +00:00
c01b3c534b Merge branch 'blender-v3.0-release' 2021-11-02 15:42:09 +01:00
89c9fa8b73 Fix T92462: Cycles crash calculating hair transparency
Need to make sure images needed for hair shaders are loaded
before running the shader.

The naming is a bit misleading, but this is an internal API
and we can change it easily. Submitting minimal patch needed
to fix logic in the code to make it safer to review for 3.0.

Differential Revision: https://developer.blender.org/D13067
2021-11-02 15:41:54 +01:00
1b2342b4d3 Tests: Add basic unittest for library reload and relocate operators. 2021-11-02 15:33:30 +01:00
698b05fc58 BLI: avoid passing nullptr to strncmp
This resulted in an ASAN warning.
2021-11-02 15:07:50 +01:00
a7e92843f7 Fix: Build error on windows.
External symbols in C files need
to be marked as such otherwise
the linker will not find them.
2021-11-02 07:43:44 -06:00
e64d4d0200 Merge branch 'blender-v3.0-release' 2021-11-02 07:59:35 -05:00
efcf36f2e9 Fix T92532: Missing null checks in IDPropertyManager.update_from
Calling it with a None argument, or no arguments, or with a property
that is missing UI data for some reason would fail. There is no
particular reason why ensuring those things don't happen is helpful,
so just add null checks for safety.

Differential Revision: https://developer.blender.org/D13024
2021-11-02 07:59:10 -05:00
0daf429591 Merge branch 'blender-v3.0-release' 2021-11-02 23:38:01 +11:00
2f0f08bc98 Fix T92733: Error moving a completely locked bone 2021-11-02 23:36:22 +11:00
b7dc667eb2 Merge branch 'blender-v3.0-release' 2021-11-02 12:31:05 +01:00
b1bf884889 Images: fix error in previous refactor
Some compositor tests (e.g. `compositor_color_test`) broke
because of rB0c3b215e7d5456878b155d13440864f49ad1f230.
The issue was a heap-use-after-free bug caused by a missing
call to `MEM_CacheLimiter_unmanage`.
2021-11-02 12:30:27 +01:00
7a4ee2fd4f Merge branch 'blender-v3.0-release' 2021-11-02 22:06:35 +11:00
9bd97e62ad Fix T92464: Operators fail after opening blend files via an operator
Operators such as setting the object mode failed after calling
WM_OT_open_mainfile from Python.

Keep the window after loading a file outside the main event loop.
2021-11-02 22:01:38 +11:00
52f4a908f7 Removed compilation warning nullptr check in image engine. 2021-11-02 12:00:07 +01:00
ffd3dd6376 Merge branch 'blender-v3.0-release' 2021-11-02 11:17:53 +01:00
0c3b215e7d Images: refactor how failed image load attempts are remembered
Previously, `ImageTile->ok` and `ImageUser->ok` were used to indicate
whether an image failed to load. There were three possible values
which (probably) had the following meanings:
* `0`: There was an error while loading the image. Don't try to load again.
* `1`: Default value. Try to load the image.
* `2`: The image was loaded successfully.

This image-wide flag did not make sense unfortunately, because loading
may work for some frames of an image sequence but not for others.
Remember than an image data block can also contain a movie.

The purpose of the `->ok` flag was to serve as an optimization to avoid
trying to load a file over and over again when there is an error (e.g. the
file does not exist or is invalid). To get the optimization back, the patch
is changing `MovieCache` so that it can also cache failed load attempts.
As a consequence, `ibuf` is allowed to be `NULL` in a few more places.
I added the appropriate null checks.

This also solves issues when image sequences are used with the
Image Texture node in Geometry nodes (also see D12827).

Differential Revision: https://developer.blender.org/D12957
2021-11-02 11:17:12 +01:00
a2f5a10129 Merge branch 'blender-v3.0-release' 2021-11-02 11:09:09 +01:00
2b3becf2be Fix typo in Cycles PMJ enum define.
Reported by Raimund58 in the chat, thanks!
2021-11-02 11:07:06 +01:00
223f2b27d1 Merge branch 'blender-v3.0-release' 2021-11-02 09:57:16 +01:00
21e168069d Merge branch 'blender-v3.0-release' 2021-11-02 19:52:01 +11:00
8ca6e51ade Cleanup: clang-tidy 2021-11-02 19:50:53 +11:00
a5b996df88 Fix T92608: Image Editor does not display stereo images
Caused by own {rB5aa3167e48b2}.
Related commit: {rBebaa3fcedd23}.

For stereo renders, `BKE_image_is_multilayer` is true, however we seem
to get to down to `space_image_gpu_texture_get` [where this is called]
from `IMAGE_cache_init` with a NULL Image->RenderResult.

So what then happens is that `BKE_image_multilayer_index` is called and
even though it has an appropriate codepath for stereo, it earlies out
and does not set multi_index correctly.

Still a bit puzzled why RenderResult is NULL for a render, but since
other places also check for a valid RenderResult before going down the
_multilayer_ route (and doing _multiview_ instead), now do the same
thing, BKE_image_multiview_index is now called in these cases (and seems
to behave correctly, checked with layers and passes and all seems to
display correctly, either in stereo or choosing individual eyes).

thx @jbakker & @brecht for double-checking.

Maniphest Tasks: T92608

Differential Revision: https://developer.blender.org/D13063
2021-11-02 09:42:32 +01:00
69a7734b75 UI: always show the cursor while transforming the cursor 2021-11-02 19:35:17 +11:00
47d12268e3 Cleanup: Change image engine to CPP.
Added namespace blender::draw::image_engine. Code is still C-a-like.
Only changed the obvious code style to CPP (structs, nullptr, casts).
2021-11-02 09:16:33 +01:00
9cc05fe9c4 Merge branch 'blender-v3.0-release' 2021-11-02 16:08:13 +11:00
af9e0409f1 Merge branch 'blender-v3.0-release' 2021-11-02 16:08:10 +11:00
7b436ead6b Merge branch 'blender-v3.0-release' 2021-11-02 16:08:07 +11:00
2fb43f08e7 Fix "Alt Tool Access" key-map preference with sequencer preview 2021-11-02 16:04:07 +11:00
4511964594 Fix T92721: "Alt Cursor Access" option fails to drag the cursor 2021-11-02 16:04:06 +11:00
a0edddaa0c Cleanup: clang-tidy 2021-11-02 16:04:06 +11:00
5363437555 Merge branch 'blender-v3.0-release' 2021-11-02 00:46:32 -03:00
24310441dd Fix snap cursor still active even when gizmo is not available
The snap cursor continued to appear even when the workspace is changed for example.

So add the region to check in the cursor pool.
2021-11-02 00:43:48 -03:00
75f5edcaf3 Merge branch 'blender-v3.0-release' 2021-11-01 14:48:20 -05:00
348d7c35a9 Geometry Nodes: Support volumes in the set material node
Even though volumes can only have one material, it is still necessary to
allow assigning a material to a prodecurally created volume. This commit
adds volume support and a warning for when a non-constant selection is
used with a volume.

Fixes T92485

Differential Revision: https://developer.blender.org/D13037
2021-11-01 14:46:48 -05:00
6ddbcaa096 Merge branch 'blender-v3.0-release' 2021-11-01 14:42:49 -05:00
55e68f1b70 Fix T92640: Crash with instance input to reverse curve node
`extract_input` can only run once.
2021-11-01 14:42:19 -05:00
e045249a28 Merge branch 'blender-v3.0-release' 2021-11-01 19:54:58 +01:00
1c0be7da4c Fix Cycles integrator presets.
New presets couldn't be added.
2021-11-01 19:52:27 +01:00
b8c573c9cd Fix T92722: Error when saving new render preset
The preset menu name was not renamed in 4ddad5a7ee.
2021-11-01 19:40:23 +01:00
85176c86f0 Fix T92722: Error when saving new render preset
The preset menu name was not renamed in 4ddad5a7ee.
2021-11-01 19:25:11 +01:00
765c2cc6c7 Merge branch 'blender-v3.0-release' 2021-11-01 13:17:54 -05:00
b6c2deef05 Fix T92662: Curve to mesh start cap invalid topology
rBbe3e09ecec5372f switched the order for vertices referenced by the
start cap's corners, but it failed to account for the offset necessary
for edge indices, since the order changed.
2021-11-01 13:13:44 -05:00
6321dd3d40 Fix T92405: Emission Strength Animation of 2.93.5 inherited wrongly in 3.0
CyclesX introduced two new input sockets for the Principled BSDF node in
rB08031197250a. This change is now handled in the versioning code so that
Animation data targeting those sockets are now updated.

Files created with the last Blender release (2.93) or earlier are now
correctly versioned. Files created with 3.0 alpha/beta may need to be
manually updated.
2021-11-01 18:51:58 +01:00
4ed1e19d2f Cleanup: extract versioning code for remapping node socket animation
When node input sockets are animated, they target the socket by index.
As a result, animation data needs to be updated whenever new sockets are
added (except when they're added at the end of the list). The code for
this is now extracted into its own versioning function, so that it can
be used for other versioning steps as well.

No functional changes.
2021-11-01 18:51:55 +01:00
339fd8027f Merge branch 'blender-v3.0-release' 2021-11-01 17:28:40 +01:00
2f667c2bc9 Fix UI messages, typos, etc. 2021-11-01 17:28:07 +01:00
adc540cf7c Fix T92655: spreadsheet_duplicate Split Exception
Check SpaceSpreadsheet's runtime is not null when trying to duplicate
the data when doing an area split.

See D13047 for further details.

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

Reviewed by Jacques Lucke
2021-11-01 08:52:00 -07:00
69e5042258 Fix T92655: spreadsheet_duplicate Split Exception
Check SpaceSpreadsheet's runtime is not null when trying to duplicate
the data when doing an area split.

See D13047 for further details.

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

Reviewed by Jacques Lucke
2021-11-01 08:48:56 -07:00
1704a394d8 Fix T92689: Assert loading file with a sound.
Dummy mistake in rBc8c53ceecc30 (boolean inversion).
2021-11-01 16:44:12 +01:00
d56d3fc6b1 Merge branch 'blender-v3.0-release' 2021-11-01 16:43:26 +01:00
06b183d1ca Fix T91507: Crash when calling context menu from confirmation popup
A typical issue with popup handling: We have to respect the menu-region
and give it priority over the regular region for handling. In this case
there isn't a regular region in context even.
2021-11-01 16:42:46 +01:00
6acba759e0 Merge branch 'blender-v3.0-release' 2021-11-01 11:58:11 -03:00
8fbbd69946 Fix T92629: Crash on mesh separate after rB43bc494892c3.
rB43bc494892c3 switched `BKE_libblock_relink_to_newid` to use new ID
remapping and libquery code.

However, that new code does protect by default against remapping an
objects's data pointer when that object is in Edit mode, since this is
not a behavior that generic BKE code can handle (due to required editing
data for most obdata types when in edit mode).

So specific code that does create new IDs and need remapping in Edit
mode has to pass specific exception flags to remaping code.

This commit adds those remapping flags to `BKE_libblock_relink_to_newid`
and add said exception flag to the remapping call from
`ED_object_add_duplicate` when the object is in edit mode.
2021-11-01 15:46:28 +01:00
e85e126e3f IDRemap: Add option to force remapping obdata in edit mode.
In theory we should never allow remapping of Objects' obdata ID pointer
when the object is in Edit mode. But there are some cases were this is
needed, so adding yet another exception option to remapping flags.

Preliminary change to fix T92629.
2021-11-01 15:46:28 +01:00
c0fbbc53e8 Fix T92605: Snapping not aligning to face extension
Regression indroduced in rB69d6222481b4342dc2a153e62752145aa37ea101
2021-11-01 11:46:12 -03:00
64de6ad4fe Fix use-after-free in image code 2021-11-01 15:36:09 +01:00
2fb725ea30 Cleanup: Unused argument
Fixes strict compiler warnings.
2021-11-01 15:14:49 +01:00
bb3de31f84 Revert "T78995: Enable keylist threaded drawing."
This reverts commit 7f1fe10595.
Fixes: T92549

Root cause hasn't been discovered but assert failed at
keyframes_keylist.cc#793. Like some data is shared between threads.
2021-11-01 15:08:25 +01:00
9de4f64197 Fix compile error on Windows
Caused by 7150f919d3. This undid part of 79a88b5e91. Added a comment
for why this include is needed, to avoid this error from happening
again.
2021-11-01 14:44:18 +01:00
6897c2141e Merge branch 'blender-v3.0-release' 2021-11-01 13:39:24 +01:00
f85c58ab65 Fix Cycles unit test failing after recent changes 2021-11-01 13:38:13 +01:00
fc01801df7 Fix Python error running regression tests after recent changes 2021-11-01 13:21:29 +01:00
7150f919d3 Cleanup: Remove unused headers in asset files
Also move system includes first, like we have it elsewhere in Blender.
2021-11-01 13:21:07 +01:00
0eb63328e8 Merge branch 'blender-v3.0-release' 2021-11-01 13:02:48 +01:00
d5e343be27 Fix T92593: Object preview not re-rendered after "Mark as Asset"
When using "Mark as Asset" the second time on an object (after having
done a "Mark as Asset" and then a "Clear Asset"), the old preview would
be re-used, even if the object was changed meanwhile. This is a bit of a
papercut, so always force previews to be re-rendered on "Mark as Asset".
2021-11-01 13:02:18 +01:00
d07e3bde20 Fix Cycles tests after recent logging changes
The constant folding tests rely on logging sync.
2021-11-01 12:47:03 +01:00
9111ea78ac Localize image mutex lock into runtime field of Image datablock
Allows to avoid a global lock being held while reading files from disk,
solving performance issues when Cycles needs to read a lot of packed
images.

Simple test file F11597666

Differential Revision: https://developer.blender.org/D13032
2021-11-01 12:47:03 +01:00
b6dd5be213 Merge branch 'blender-v3.0-release' 2021-11-01 22:25:27 +11:00
b5eada7f69 Merge branch 'blender-v3.0-release' 2021-11-01 22:25:24 +11:00
Martijn Versteegh
3df587b798 Fix T92681: resolve use of freed filedescriptor in debug builds
Ref D13053
2021-11-01 22:16:34 +11:00
3f0991266f Merge branch 'blender-v3.0-release' 2021-11-01 12:15:09 +01:00
2a4dfaa0e9 Asset Browser: Correct name & tooltip for asset list refresh operator
The name and tooltip were talking about file-lists, which exposes the
fact that the Asset Browser uses the File Browser code in the UI, which
we shouldn't do. This can confuse users.
Instead have a dedicated operator for the Asset Browser with a proper
name and tooltip.
2021-11-01 12:12:28 +01:00
Jarrett Johnson
81bd49d4fe Pointcloud selection support
This patch adds support for selecting pointclouds.

Since pointclouds were not properly drawn to the selection buffer (as diagonsed by output from `glReadPixels` and Renderdoc), they were not able to be selectable by depth picking or occlusion queries. In `basic_engine`, objects were rendered with a shader which draws to a depth buffer but only assumes a single position vertex attribute. Pointclouds, though, require at least another vertex attribute `pos_inst` which provides the instance offsets. Thus, this patch adds another shader variant for pointclouds which supports these two attributes and renders the points appropriately.

{F11652666}

Addresses T92415

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13059
2021-11-01 12:10:34 +01:00
894096a528 GPUState: Fix enum max value for enum operator macro
Simple oversight.
2021-11-01 12:08:46 +01:00
a96b2f39b8 Geometry Nodes: improve check if object has geometry set instances
The improves playback speed in my instance heavy scene from ~3.7 fps to ~3.9 fps.
2021-11-01 12:00:41 +01:00
Jarrett Johnson
7dd84f05aa Pointcloud selection support
This patch adds support for selecting pointclouds.

Since pointclouds were not properly drawn to the selection buffer (as diagonsed by output from `glReadPixels` and Renderdoc), they were not able to be selectable by depth picking or occlusion queries. In `basic_engine`, objects were rendered with a shader which draws to a depth buffer but only assumes a single position vertex attribute. Pointclouds, though, require at least another vertex attribute `pos_inst` which provides the instance offsets. Thus, this patch adds another shader variant for pointclouds which supports these two attributes and renders the points appropriately.

{F11652666}

Addresses T92415

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13059
2021-11-01 11:41:13 +01:00
fe44001215 Revert "Pointcloud selection support"
This reverts commit a50f8b3fd8.
2021-11-01 11:40:34 +01:00
Jarrett Johnson
a50f8b3fd8 Pointcloud selection support
This patch adds support for selecting pointclouds.

Since pointclouds were not properly drawn to the selection buffer (as diagonsed by output from `glReadPixels` and Renderdoc), they were not able to be selectable by depth picking or occlusion queries. In `basic_engine`, objects were rendered with a shader which draws to a depth buffer but only assumes a single position vertex attribute. Pointclouds, though, require at least another vertex attribute `pos_inst` which provides the instance offsets. Thus, this patch adds another shader variant for pointclouds which supports these two attributes and renders the points appropriately.

{F11652666}

Addresses T92415

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D13059
2021-11-01 11:25:23 +01:00
8379eefafb Cycles: Enable debug symbols for Clang
Debug symbols were disabled for Clang at some point due to link issues.
This is no longer the case for any reasonably modern version of Clang.
So this patch removes the check in question.

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

Reviewed By: brecht
2021-11-01 11:38:03 +02:00
5327413b37 Cleanup: Remove Cycles device checks for half float.
All supported devices support half float now, so we can remove the check.

Differential Revision: https://developer.blender.org/D13021
2021-11-01 10:18:30 +01:00
28eaa81f1e Fix Cycles Python warnings when removed OpenCL device was enabled 2021-11-01 08:36:50 +01:00
William Leeson
0b060905d9 Fix T92575: Cycles black pixels when rendering with > 65k samples
Differential Revision: https://developer.blender.org/D13039
2021-11-01 08:36:50 +01:00
0ab1b19de4 Fix T92684: Cycles does not fall back to OIDN if OptiX is not available 2021-11-01 08:36:50 +01:00
cedc80c08d Fix Cycles denoising depth pass missing in compositor 2021-11-01 08:36:50 +01:00
6bc54cddfb Fix Cycles logging some excessive detail with default --debug-cycles 2021-11-01 08:36:50 +01:00
806521f703 Fix T92671: confusing Cycles debug logs about CPU architecture
Instead of printing debug flags listing various CPU and GPU settings that
may or may not be used, print when we are using them. This include CPU
kernel types, OptiX debugging and CUDA and HIP adaptive compilation. BVH
type was already printed.
2021-11-01 08:36:50 +01:00
289f013e64 Merge branch 'blender-v3.0-release' 2021-11-01 17:48:50 +11:00
154a060777 Fix sequencer preview selection drawing ignoring meta-strips
All selection operations respected the currently displayed meta-strip
except for drawing.
2021-11-01 17:43:21 +11:00
49a0453799 Merge branch 'blender-v3.0-release' 2021-11-01 17:22:44 +11:00
Pratik Borhade
6e26c615af Fix T92663: Snap Selected to Active not working properly
Wrong values were passed for use_offset and pivot_point in
2bcf93bbbe

Maniphest Tasks: T92663

Ref D13056
2021-11-01 17:22:03 +11:00
de4793e0e6 Merge branch 'blender-v3.0-release' 2021-11-01 17:16:53 +11:00
55ce05e0bb Merge branch 'blender-v3.0-release' 2021-11-01 17:16:50 +11:00
346a812d7e Fix scale cage gizmo in pose-mode
The active objects matrix was ignored when calculating the cage.
2021-11-01 17:16:45 +11:00
3cd398f16f Fix T92694: Auto Perspective is inconsistent with axis aligned views
Snapping to an axis aligned view with a 45 degree rotation would
set the view orthographic without setting it back to perspective
when orbiting the view as you would expect with auto-perspective.

Now orthographic is only set for views with rotation of 0, 90, 180, -90.

Notes:

- Partially reverts logic from cebd025e02
  at the time RegionView3D.view_axis_roll had not been added,
  so only setting the orthographic with one particular rotation
  was a bigger limitation than it is now.

- Auto-perspective could be supported when snapping the viewport to
  diagonal angles, however that's a larger project.
2021-11-01 17:09:26 +11:00
d052169e7e Fix scale cage gizmo in pose-mode
The active objects matrix was ignored when calculating the cage.
2021-11-01 15:08:28 +11:00
1e749d0602 Cleanup: spelling, use C comments 2021-11-01 14:00:58 +11:00
b99d6e1bed Fix errors in BKE_appdir_font_folder_default
- Missing NULL check for the HOME environment variable.
- The user preference path was written to even when the
  path didn't exist.
2021-11-01 13:43:35 +11:00
e2937ff24f Merge branch 'blender-v3.0-release' 2021-11-01 13:15:10 +11:00
a0633e2484 Fix crash when "HOME" environment variable isn't defined
Accessing the default directory in the file selector
would crash if HOME was undefined.

Add BKE_appdir_folder_default_or_root which never returns NULL.
2021-11-01 13:11:48 +11:00
d4d38e8a34 BLI_path_util: assert to ensure BLI_join_dirfile is used correctly 2021-11-01 12:38:12 +11:00
c312c71969 Fix: Build error on all platforms
Types were used before being declared.
2021-10-31 11:52:24 -06:00
Christoph Lendenfeld
b2e9f35c5e Cleanup: Extract function to store bezt arrays
The code to store an original bezt array previously lived in
`graphkeys_decimate_invoke`.
Since future graph slider operators will need this function as well,
it has been extracted.

No functional changes.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12487
Ref: D12487
2021-10-31 11:28:10 +00:00
Christoph Lendenfeld
1b6daa871d Cleanup: Extract keyframe filter to constant
An int flag is used to filter animation channels for
operators to work on. The flag was duplicated multiple times.
This patch removes the duplication by creating a constant

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12486
Ref: D12486
2021-10-31 11:19:40 +00:00
Christoph Lendenfeld
4e502bb6d2 Merge branch 'blender-v3.0-release' 2021-10-31 11:10:11 +00:00
Christoph Lendenfeld
a06abbac92 fix: pose slider consistent color
Change the way the pose slider gets its color so it is consistent
 between editors
Previously the highlight  color would be different between
the 3D viewport and the graph editor.

Reviewed by: Sybren A. Stüvel, Pablo Vazquez
Differential Revision: https://developer.blender.org/D11878
Ref: D11878
2021-10-31 11:08:57 +00:00
ae9052a33e Cleanup: Simplify logic for adding grid in points to volume node
Instead of creating a separate grid first and then merging the points
to volume grid, use the recently added `BKE_volume_grid_add_vdb`
helper function for this purpose.
2021-10-30 17:26:18 -05:00
9cfffe8468 UI: Open File Browser with Thumbnails for Fonts
When browsing to open a font file, open File Browser in Thumbnail View
and sorting by name, instead of using the last-used states.

See D13040 for more details.

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

Reviewed by Julian Eisel
2021-10-30 14:02:34 -07:00
03a962d8ca Merge branch 'blender-v3.0-release' 2021-10-30 16:45:04 +02:00
945a99386b Fix T92256: rotate Instances node does not take scaling into account correctly
Differential Revision: https://developer.blender.org/D13031
2021-10-30 16:44:17 +02:00
02a9377da0 UI: Default Fonts Folder for Mac and Linux
Initial defaults for userdef->fontdir for Mac and Linux.

See D12802 for more details.

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

Reviewed by Campbell Barton
2021-10-29 17:15:22 -07:00
fcf1ba18f0 Fix: Incorrect component type warning in points to volume node
This node doesn't only support point clouds, it supports any geometry
component type with points, so meshes, curves, and point clouds.
We could explicitly list them to add a warning for volumes, but
that wouldn't really have any practical benefit, and isn't done
elsewhere.
2021-10-29 13:17:33 -05:00
b5f42029b8 Fix T92592: Cycles stereo render not rendering right view 2021-10-29 19:53:14 +02:00
dcdbaf89bd Asset Browser: Correct name & tooltip for asset list refresh operator
The name and tooltip were talking about file-lists, which exposes the
fact that the Asset Browser uses the File Browser code in the UI, which
we shouldn't do. This can confuse users.
Instead have a dedicated operator for the Asset Browser with a proper
name and tooltip.
2021-10-29 16:55:20 +02:00
0c3da7f370 Merge branch 'blender-v3.0-release' 2021-10-29 09:42:24 -05:00
2383628ee1 Nodes: Add translation markers to new socket names and descriptions
As part of the refactor to the node declaration builders, we had hoped
to add a regular expression specifically for these socket names, but
recent discussions have revealed that using the translation marker
macros is the preferred solution.

If the names and descriptions were exposed to RNA, these would not
be necessary. However, that may be quite complicated, since sockets
are all instances of the same RNA types.

Differential Revision: https://developer.blender.org/D13033
2021-10-29 09:41:08 -05:00
837b72fa83 Merge branch 'blender-v3.0-release' 2021-10-29 11:25:32 -03:00
7e94499bb3 Fix snap cursor not working in regions with transparency
Use `BKE_area_find_region_type` instead of using the context region.
2021-10-29 11:23:56 -03:00
d18d87d3e7 Fix T92576: Crash switching from Asset Browser to File Brower
The asset catalog filtering data needs to be cleared when with the other
asset library data of the file list. This is done when changing between
asset and file browser (and in other cases).
2021-10-29 16:00:43 +02:00
e1db6dc11b Fix crash on undo after recent lib_query refactor.
Forgot that scene uses part of its ID looping code for specific undo
handling.

Caused by rBe3b2f0fd6ff9.
2021-10-29 12:54:32 +02:00
c8c53ceecc LibQuery: Remove last 'bool returns' from public API.
Those were used in a very few places to detect whether iteration should
be stopped or not, but one can use `BKE_lib_query_foreachid_iter_stop`
now for that.

Also fix early break handling in embedded IDs processing.

Fix T90922: Fix return policy inconsistency in `scene_foreach_id`.
2021-10-29 11:32:26 +02:00
259731909c LibQuery: Fix potential memleak in recursive case.
In case `library_foreach_ID_link` would return early in recursive
process, it would not properly free its utils data.

Also add proper iteration break in case some sub-calls requested it.

Finally, make this function return a boolean to know whether iteration
should be stopped or not (will be used in future commit to fix this
handling in embedded IDs case).

Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.
2021-10-29 11:32:26 +02:00
e3b2f0fd6f LibQuery: Add macro to help break looping when requested.
The new `BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL` execute the given
statement and then check status of `LibraryForeachIDData` data, and
return in case stop of iteration is requested.

This is very similar to the other `BKE_LIB_FOREACHID_PROCESS_` existing
macros, and allows us to properly break iteration when a sub-function
has requested it.

Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.
2021-10-29 11:32:26 +02:00
51c1c1cd93 Fix potential early-return in WM foreach_id process.
Add a function to check if iteration over ID usages should stop (using
internal `IDWALK_STOP` status flag).

Use it in `BKE_LIB_FOREACHID_PROCESS_` macros, and in
`window_manager_foreach_id` to handle properly the active workspace case
(previous code could skip the call to `BKE_workspace_active_set` in case
iteration over ID usages was stopped by callback on that specific ID
usage).

Part of T90922: Fix return policy inconsistency in `scene_foreach_id`.
2021-10-29 11:32:26 +02:00
eae59645de Cleanup: Add some comments to some sub-function of foreach_id process. 2021-10-29 11:32:26 +02:00
c112418e95 Merge branch 'blender-v3.0-release' 2021-10-29 11:05:20 +02:00
f13826a572 Fix T92476: wrong context in spreadsheet when area is maximized
Now, if a spreadsheet editor is maximized, it looks for its context in
the unmaximized screen "below".
2021-10-29 11:04:37 +02:00
43bc494892 IDManagement: Remove deprecated BKE_libblock_relink_to_newid usages.
Move all usages to new `BKE_libblock_relink_to_newid_new`, and rename
that one to `BKE_libblock_relink_to_newid`.

Fix T91413.
2021-10-29 10:45:48 +02:00
2d42dc4182 Cleanup: remove unused function 2021-10-29 10:39:05 +02:00
7c860ab9d4 Fix T92499: duplicating geometry nodes modifier causes crash
Calling `remove_unused_references` inside the `modify_geometry_sets` loop
was known to be not entirely reliable before. Now I just moved it out of
the loop which fixes the bug.
2021-10-29 10:29:50 +02:00
fb688c8d5c Merge branch 'blender-v3.0-release' 2021-10-29 10:24:37 +02:00
Ankit Meel
be0d5da341 Fix T88877: 2.93: Crash on recent OSX with a non-English locale.
Looks like OSX changed the default format of its locale, which is not
valid anymore for gettext/boost::locale.

Solution based on investigations and patch by Kieun Mun (@kieuns), with
some further tweaks by Ankit Meel (@ankitm), many thanks.

Also add an exception catcher on `std::runtime_error` in
`bl_locale_set()`, since in OSX catching the ancestor `std::exception`
does not work with `boost::locale::conv::conversion_error` and the like
for some reasons.

Reviewed By: #platform_macos, brecht

Maniphest Tasks: T88877

Differential Revision: https://developer.blender.org/D13019
2021-10-29 10:24:08 +02:00
261bb766fb Merge branch 'blender-v3.0-release' 2021-10-29 10:11:26 +02:00
2887d87232 Fix T92324: crash caused by recursive instancing
This fixes one (of possibly multiple) root issues. The collection passed into
the Collection Info node must not contain the current object, because that
would result in a dependency cycle and recursive instancing.
2021-10-29 10:10:58 +02:00
1688cb27cd Merge branch 'blender-v3.0-release' 2021-10-29 09:49:48 +02:00
cf771807b7 Geometry Nodes: do cache invalidation after writing attributes
This is a better and more general fix for T92511 and T92508 than
the ones that I committed before.

Previously, we tagged caches dirty when first accessing attributes.
This led to incorrect caches when under some circumstances. Now
cache invalidation is part of `OutputAttribute.save()`.

A nice side benefit of this change is that it may make things more
efficient in some cases, because we don't invalidate caches when
they don't have to be invalidated.

Differential Revision: https://developer.blender.org/D13009
2021-10-29 09:28:31 +02:00
657923cf93 Merge branch 'blender-v3.0-release' 2021-10-29 15:01:50 +11:00
b546202a9a Gizmo: support showing transform gizmos in pose + weight-paint mode
These can be enabled in the gizmos popover.
2021-10-29 15:00:25 +11:00
57f7650dc7 Merge branch 'blender-v3.0-release' 2021-10-29 14:01:19 +11:00
Gilberto Rodrigues
c8aaa00e00 Report "Startup file saved" in info editor
This is consistent with saving the preferences.

Ref D12896
2021-10-29 13:59:44 +11:00
99fbf1716f Merge branch 'blender-v3.0-release' 2021-10-29 13:54:43 +11:00
38fc19d643 Cleanup: rename blf_utf8_next_fast to blf_glyph_from_utf8_and_step
Calling this 'fast' no longer made sense as the slower code-path
has been removed.
2021-10-29 13:49:31 +11:00
1e2589bfa5 Cleanup: remove redundant BLI_UTF8_ERR check 2021-10-29 13:15:39 +11:00
0e71162e68 Cleanup: resolve cast warnings 2021-10-29 13:14:23 +11:00
70947ebc65 BLF Refactor: blf_utf8_next_fast
Simplification of BLF glyph loading

See D13026 for details.

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

Reviewed by Campbell Barton
2021-10-28 18:49:21 -07:00
59534dbee2 BLF Refactor: blf_kerning_step_fast
Simplification of BLF Kerning

See D13015 for more details.

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

Reviewed by Campbell Barton
2021-10-28 18:20:34 -07:00
bbb5a77896 Cleanup: add sections for tool key-maps 2021-10-29 11:34:20 +11:00
0283a22456 Merge branch 'blender-v3.0-release' 2021-10-29 10:53:42 +11:00
8eb10de739 Merge branch 'blender-v3.0-release' 2021-10-29 10:53:39 +11:00
c1c016b9a4 Fix T92468: Annotation Drag option broken in Node Editors
Also enable fallback tool for link-cut.
2021-10-29 10:52:14 +11:00
b43077ba3a Fix T92552: Spline evaluation with all points at the origin
In this case, the uniform index sampling loop would fail to assign any
data to the samples, so fill the rest with the largest value possible,
corresponding to the end of the spline. Animation Nodes has the same
fix for this case.
2021-10-28 18:23:55 -05:00
adf82fe943 Merge branch 'blender-v3.0-release' 2021-10-28 22:42:04 +02:00
fc36772b06 Tests: minor updates to benchmark script for running on buildbot
* graph command accepts folder of json files as input
* reset command clears log files
2021-10-28 22:41:40 +02:00
35f4d254fd Fix T92513: Cycles stereo pole merge not rotating along with camera 2021-10-28 22:38:07 +02:00
f2cc38a62b Fix T92255: Cycles Christensen-Burley render errors with scaled objects 2021-10-28 21:53:30 +02:00
049510f425 Fix T92491: Cycles panoramic camera inside volume fails with near clipping 2021-10-28 21:43:08 +02:00
673984b222 Fix T92158: Cycles crash with Fast GI and area light MIS 2021-10-28 21:33:52 +02:00
731926e70e Merge branch 'blender-v3.0-release' 2021-10-28 14:25:14 -05:00
Leon Leno
eda8065afc Fix: Improve node socket icon scaling group input/output list
This patch makes `widget_nodesocket` base the size of the drawn
socket icon on the rectangle that’s passed in to allow it to scale
with the rest of the interface.

Differential Revision: https://developer.blender.org/D11734
2021-10-28 14:24:42 -05:00
a6af0e570d Merge branch 'blender-v3.0-release' 2021-10-28 21:20:25 +02:00
690300eb4a Fix install paths for blender thumbnailer when not building a portable install
When doing a non portable build of blender, the executable
blender-thumbnailer would be installed in two locations:
/usr/bin/
/usr/

While cleaning up, also make the blender thumbnailer dll optional on
windows to bring the logic in line with what it is on linux and mac.

Reviewed By: Campbell Barton, Ray molenkamp

Differential Revision: http://developer.blender.org/D13014
2021-10-28 21:13:47 +02:00
ec9357a94e Merge branch 'blender-v3.0-release' 2021-10-28 16:02:06 +02:00
db8be0cdfb Cleanup: compiler warnings in with Cycles OSL and clang 2021-10-28 16:01:07 +02:00
3620ce7f67 Fix T92503: Cycles OSL crash with material previews 2021-10-28 16:01:07 +02:00
cefb0122b4 Fix T92526: Cycles viewport denoiser red tint after recent changes 2021-10-28 16:01:07 +02:00
60b278a3bb Merge branch 'blender-v3.0-release' 2021-10-28 15:52:19 +02:00
43f97393bb Fix 92550: GPencil Vertex Group is not apply as expected when is inverted
When use Invert option, the weight must be inverted not omitted. This change invert the value if the point had assigned weight to get the right result.
2021-10-28 15:51:40 +02:00
e96b7c0092 LineArt: Fix(unreported) Material mask panel logic
The logic should be: show material mask panel if in_front is on,
it was inverted unintentionally.
2021-10-28 19:38:45 +08:00
ddb4eb8a89 LineArt: Fix(unreported) depsgraph camera error
This fixes unintentional line art error when custom camera doesn't
exist, now not adding custom camera relation in this case.
2021-10-28 19:38:45 +08:00
5f1107ffaf Merge branch 'blender-v3.0-release' 2021-10-28 12:01:01 +02:00
aebb3d3062 Fix (unreported) potential issue in new BKE_libblock_relink_to_newid_new
Remapping code could call collection resync code while processing
remapping, which is a good way to crash by accessing no-more-valid
pointers.

Similar issue as with liboverrides resync, fixed the same way by
preventing any collection resync until whole remapping has been done.

This was probably not an issue in practice in current code, since this
is only used by append code currently, which should not affect
layers/collections in current scene yet.
2021-10-28 11:57:20 +02:00
289843119d Python doc generator: add missing selected_ids context key
Add the context key I introduced in rB03c0581c6ed to the Python API docs
generator.

No functional changes to Blender.
2021-10-28 11:24:27 +02:00
2f8ed53d6f Merge remote-tracking branch 'origin/blender-v3.0-release' 2021-10-28 11:23:25 +02:00
be7ce7cb4d View3D Context: use correct data type
`CTX_data_selected_objects()` returns a `ListBase` of
`CollectionPointerLink`, not `PointerRNA`. This caused an alignment
issue, resulting in `owner_id == NULL` reported in T92507. Correcting
the pointer type fixed this.

In the end, the same pointer is used as before this commit, but the way
it is obtained is actually correct.
2021-10-28 11:22:47 +02:00
c1cfb475b3 LineArt: Fix(unreported) Material mask panel logic
The logic should be: show material mask panel if in_front is on,
it was inverted unintentionally.
2021-10-28 17:17:48 +08:00
4b57d5a9a0 LineArt: Fix(unreported) depsgraph camera error
This fixes unintentional line art error when custom camera doesn't
exist, now not adding custom camera relation in this case.
2021-10-28 17:13:22 +08:00
4adde62f60 Python doc generator: add missing selected_ids context key
Add the context key I introduced in rB03c0581c6ed to the Python API docs
generator.

No functional changes to Blender.
2021-10-28 10:32:13 +02:00
2501d00268 Python doc generator: raise explanatory error when context key is missing
When a new key is added to the context, it also needs to be added to the
`sphinx_doc_gen.py` file for generating the Python API documentation.
When this isn't done, the script would raise a generic `KeyError`. Now
it explains what needs to be updated to solve the problem.

No functional changes to Blender.
2021-10-28 10:32:13 +02:00
45439dfe4c Preferences: remove special case for copying previous settings
This was only needed for skipping version numbers when the numbering
scheme changed for 3.0.
2021-10-28 17:59:51 +11:00
5568599015 Merge branch 'blender-v3.0-release' 2021-10-28 17:49:15 +11:00
a7879dea7c Merge branch 'blender-v3.0-release' 2021-10-28 17:49:12 +11:00
8761699eab Cleanup: warning in 2a2d873124 2021-10-28 17:47:56 +11:00
43c603c2ff Merge branch 'blender-v3.0-release' 2021-10-28 17:45:28 +11:00
2a2d873124 Fix T92467: Path Selection broken when Drag is set to Tweak
Ctrl-RMB was getting used by "object" selection in edit-mode.

Remove selection key-map from fallback tools,
rely on the editors key-map for selection.
2021-10-28 17:42:59 +11:00
5aeecc0a29 Fix fallback tools for the sequence editor
Only regions with gizmos were checking for fallback tools.
2021-10-28 17:11:23 +11:00
4979537a65 Merge branch 'blender-v3.0-release' 2021-10-28 16:56:11 +11:00
99b6127b73 Merge branch 'blender-v3.0-release' 2021-10-28 16:56:08 +11:00
f0d20198b2 Sequencer: support basic selection & delete from previews
Expose select & strip menus and shortcuts for sequencer preview.
2021-10-28 16:52:22 +11:00
e1fb7740f8 Cleanup: use sections for key-map definition 2021-10-28 14:40:06 +11:00
c647bd899f Merge branch 'blender-v3.0-release' 2021-10-28 14:08:57 +11:00
16f468fb14 Fix T92514: Edit-mode bone snap to cursor uses the center of the bone
Regression in 2bcf93bbbe.
2021-10-28 14:07:12 +11:00
a2f0f98271 Merge branch 'blender-v3.0-release' 2021-10-27 19:07:40 -03:00
b838eaf2b9 Cleanup: remove 'ED_view3d_cursor_snap_exit'
The callers of `ED_view3d_cursor_snap_active` that must handle the snapping of the cursor.
Forcing release at the end can hide leaks.
2021-10-27 19:07:03 -03:00
b69195dd13 Fix memory leak in cursor snap deactivation
Missed in rB32cc9ff03746
2021-10-27 19:06:47 -03:00
7d2c759054 Merge branch 'blender-v3.0-release' 2021-10-27 23:22:37 +02:00
8f02de3de7 Cleanup: remove redundant variable
`free_tooltip` is no longer needed.
2021-10-27 18:11:47 -03:00
e4a5fd4298 Fix broken Python API doc generation after addition of selected_ids 2021-10-27 22:16:36 +02:00
b02c8a40ff Fix broken Python API doc generation after addition of selected_ids 2021-10-27 21:31:08 +02:00
10789c5329 Cycles: tweak scrambling distance UI grouping, and improve tooltip 2021-10-27 20:52:49 +02:00
a8a1f48479 Build: set correct buildbot submodule and library branches for 3.0 2021-10-27 20:52:49 +02:00
78c9c1012b Asset Browser: Increase size of search button a bit
Before this, the search button was quite small really, not much text would fit
into it. Increase the size a bit, but not too much to still make the layout
work in smaller area sizes.
2021-10-27 19:01:15 +02:00
39c11c03d0 Asset Browser: Increase size of search button a bit
Before this, the search button was quite small really, not much text would fit
into it. Increase the size a bit, but not too much to still make the layout
work in smaller area sizes.
2021-10-27 18:56:41 +02:00
3e32a68f38 UI: Refactor how dragging onto text buttons works, fixing issues
There was a bunch of special handling to support dropping data-blocks onto
string or search-menu buttons, to change the value of these. This refactor
makes that case use the normal drop-box design, where an operator is executed
on drop that gets input properties set by the drop-box. This should also make
it easier to add support for dragging assets into these buttons.

In addition this fixes an issue: Two tooltips were shown when dragging assets
over text buttons. None should be shown, because this isn't supported.
2021-10-27 18:51:44 +02:00
bfd2921d38 Revert "Blender 3.0 bcon3 (beta)"
This reverts commit f7a3450e63.
2021-10-27 18:44:28 +02:00
c346bb1990 Revert "3.0 splashscreen"
This reverts commit 78c1c71988.
2021-10-27 18:43:27 +02:00
17efd14682 Merge branch 'blender-v3.0-release' 2021-10-27 18:43:18 +02:00
78c1c71988 3.0 splashscreen
Credit: Blender Animation Studio
2021-10-27 18:42:24 +02:00
f7a3450e63 Blender 3.0 bcon3 (beta) 2021-10-27 18:41:31 +02:00
dab3591588 Blender 3.1 bcon1 - alpha
Bump the version number for the new release cycle.
2021-10-27 18:40:49 +02:00
f0a37dc31c Revert "Blender 3.1 bcon1 - alpha"
This reverts commit 7b9e3534cf.

This was supposed to go to master, not the 3.0 branch.
2021-10-27 18:40:02 +02:00
7b9e3534cf Blender 3.1 bcon1 - alpha
Bump the version number for the new release cycle.
2021-10-27 18:38:22 +02:00
bfec984cf8 UI: Theme refresh for Blender v3.0
{F11548100, size=full}

To celebrate the beginning of a new series, it feels like the right time to
give the theme a fresh look while improving on what already works.

The aim of this refresh is to keep a familiar look but with polishing touches
here and there. Like new paint on the walls of your well known house.

The theme for Blender 2.8 was well received but presented a few flaws.

* Transparency on menus and tooltips reduce readability
* Mismatch on certain colors, especially outlines of connected widgets
* Active/open menus highlight was not prominent enough
* Header background mismatch in some editors

At the same time we can make use of new features in 3.0:

* Make panels look like panels again (like in v2.3!)
* Make use of roundness in more widgets
* Since nodes are no longer hard-coded to be transparent, tweak opacity and saturation
* Tweak colors for the new dot grid

This update does not include:

* Meshes in edit mode to match greenish object-data color. This needs tweaks in the code to improve contrast.
* A copy of the Blender 2.8x legacy theme. This could be added to the community themes (shouldn't cost much maintenance, I hope)

There will be certainly small tweaks to do here and there, I've been working using this theme
for months but there can be areas that are missing update. The overall style is presented here.

This commit bumps the file subversion.

Reviewed By: #user_interface, Severin

Differential Revision: https://developer.blender.org/D13008
2021-10-27 18:29:18 +02:00
71adad288b Asset Browser: Activate catalog after adding
Adding a catalog should also activate it, like we do it for adding other
data in Blender. The tree-view code will make sure the newly added item
will not have collapsed parents.
2021-10-27 18:27:50 +02:00
bca9ec767c Revert "Asset Browser: Ensure parent catalogs are expanded when adding child"
This reverts commit 487faed6d0.

I changed my mind on how to implement this feature. Adding a catalog
should also activate it, like we do it for adding other data in Blender.
The activation will automatically make it visible then. See the
following commit.
2021-10-27 18:27:36 +02:00
487faed6d0 Asset Browser: Ensure parent catalogs are expanded when adding child
When pressing the '+' icon to add a new child catalog, or when adding it
through the context menu, the new catalog should be visible. So the
this change makes sure the parent is uncollapsed if needed.
2021-10-27 18:09:00 +02:00
defc1b8e18 Fix: Realize instances versioning fails for curve to mesh node
It assumed that the last input socket was a geometry socket, but now
it is the fill caps boolean option.
2021-10-27 10:24:29 -05:00
87470169e0 Geometry Nodes: Rename more geometry sockets
This is a followup to rB827d7e7d252d48. After this we should
be consistent everywhere with the hints in the names of geometry
sockets.
2021-10-27 09:33:50 -05:00
dc37990e24 Geometry Nodes: Add Image Socket to Switch Node
Add the image type to the switch node without field support.

Differential Revision: https://developer.blender.org/D13012
2021-10-27 09:03:29 -05:00
Alaska
974002743e Cycles: Update UI for Scrambling Distance Patch
The current UI for the Scramble Distance patch is grayed out
depending on different settings that are enabled. However it
didn't make much sense to me so I have updated when the UI is
grayed out to hopefully make more sense to the end user.

Differential Revision: https://developer.blender.org/D12963
2021-10-27 15:58:39 +02:00
0d6f2cb303 Cleanup: remove unused function declaration 2021-10-27 15:57:20 +02:00
9beb5e38a9 Geometry Nodes: output Index from ID node if the geometry has no id
This is consistent with all the other places where we use the id attribute:
If it does not exist, use the index instead.
2021-10-27 15:57:19 +02:00
212b02b548 Geometry Nodes: Show hint in empty output attributes panel
This is meant to add something to the sub-panel when it is empty
so it looks more purposeful, but also add a hint that might be helpful
when figuring out how to output a named attribute.

Differential Revision: https://developer.blender.org/D12715
2021-10-27 08:54:24 -05:00
b6bed63b5b UI: Hide labels for subdivision surface node enums
The text is just too long, it doesn't fit in the node width,
and the tooltips display the property names well enough,
since they aren't used as often as other settings.
Also display the text in lite builds too, there is no reason not to.
2021-10-27 08:52:46 -05:00
383985a91b Geometry Nodes: use index field implicitly in Set ID node
That makes the node more useful by default.
One use case is to delete some points after the Set ID node, then instance
with some randomness. Now when deleting different points, the
randomness will remain stable.
2021-10-27 15:49:14 +02:00
ef6e03c8e0 Fix: Show "new" attribute name typed in nodes modifier input search
Previously it wouldn't be displayed at all for inputs, now just display
it without an "add" icon.
2021-10-27 08:43:31 -05:00
059e5a8a4c Geometry Nodes: use true as default in Set Shade Smooth node
The node is typically only added to enable smooth shading. So this
default is much more useful.
2021-10-27 15:42:02 +02:00
62928b618a Spreadsheet: make id column a bit wider
Ids can often be relatively large numbers when they are generated automatically.
2021-10-27 15:40:14 +02:00
827d7e7d25 Geometry Nodes: Rename some sockets
Subdivision surface: Both geometry sockets renamed to "Mesh"
Points to Volume: Use "Points" and "Volume" names
Distribute Points on Faces: Use "Mesh" input name

These are meant to provide a hint to users which type each
node is meant to use.
2021-10-27 08:36:59 -05:00
c1936be0c5 Spreadsheet: use "id" instead of "ID" as column name
The lower case name is the internal name and will be exposed more
to the user once we have instance attributes.
2021-10-27 15:34:28 +02:00
cc6d5bc241 Fix: typo in info message 2021-10-27 15:31:00 +02:00
7cbb01f07e Fix: incorrect warning in Instances to Points node 2021-10-27 15:29:03 +02:00
9217f5c7a3 Geometry Nodes: change default raycast direction
Raycasting downwards (e.g. onto some terrain) is more common than
raycasting in the positive z direction.
2021-10-27 15:26:13 +02:00
f5d8339fa5 Sequencer: various preview selection improvements
- Only cycle items when the cursor hasn't moved.

  This matches object-mode behavior, making it possible to tweak-drag
  the current selection without first cycling to the next sequence strip.
  Successive clicks will still cycle sequence strips.

- For center selection, use a penalty for the active strip.

- Use a temporary selection list to avoid moving the sequence
  strips out of the scene during selection
  (changing their order when added back).
2021-10-28 00:24:52 +11:00
aea7e55522 WM: de-duplicate cursor motion checks for selection picking
Replace local static mouse coordinate storage with a single function.
also resolve inconsistencies.

- Edit-mesh selection used equality check (ignoring `U.move_threshold`).
- Motion to clear tooltips checked the value without scaling by the DPI.

Also prevent the unlikely case of the previous motion check matching
a different area by resetting the value when the active region changes.
2021-10-28 00:24:52 +11:00
2a709c82c3 Fix sequencer selection toggle
Sequence strips weren't being deselected while holding shift.
2021-10-28 00:24:52 +11:00
ff2e8d6510 Fix building WITH_FLUID=OFF 2021-10-28 00:24:52 +11:00
bbd6dc55d1 Nodes: fix menu when there is no node tree
Previously, some submenus were empty.
2021-10-27 15:23:27 +02:00
19a559d170 Fix warning after recent fluid modifier changes 2021-10-27 15:14:54 +02:00
332de3a2da Cleanup: Add static assert for tree-view getter template
These kind of static asserts for the base type of a template parameter
are useful, and can avoid wrong API usage.
2021-10-27 14:56:57 +02:00
aae5f15238 Asset Browser: Support dragging catalogs to move them in the hierarchy
Uses the additions to the UI tree-view API from the previous commit to
enable drag & drop of asset catalogs. The catalogs will be moved in the
tree including children.
A remaining issue is that a catalog with children will always be
collapsed when dropping. I need to find a way to fix that in the
tree-view API.

There are a few improvements I can think of for the tree-item drag &
drop support, but time for these is too short. These can be done as
normal cleanups at some point.
2021-10-27 14:56:57 +02:00
1832e11f39 UI: Support dragging tree-view items
Adds the needed bits to the UI tree-view API to support dragging
tree-view items. This isn't used yet, but will be in the following
commit for asset catalogs.

There will probably be some further tweaks to the design at some point,
for now this should work well enough for our use-cases.
2021-10-27 14:56:57 +02:00
8507336e76 Fix T92423: Blender freeze rendering animation with Mantaflow
Mantaflow could steal tasks from dependency graph, which under
certain conditions causes a recursive lock involving GIL.

Isolate threading done in mantaflow when it is interfaced form
the dependency graph.

Isolation done from the modifier, since the deeper calls are
branching out quite quickly.

Differential Revision: https://developer.blender.org/D13011
2021-10-27 14:52:53 +02:00
William Leeson
82cf25dfbf Cycles: Scrambling distance for the PMJ sampler
Adds scrambling distance to the PMJ sampler. This is based
on the work by Mathieu Menuet in D12318 who created the original
implementation for the Sobol sampler.

Reviewed By: brecht

Maniphest Tasks: T92181

Differential Revision: https://developer.blender.org/D12854
2021-10-27 14:21:15 +02:00
William Leeson
7b1c5712f8 Cycles: Replace saturate with saturatef
saturate is depricated in favour of __saturatef this replaces saturate
with __saturatef on CUDA by createing a saturatef function which replaces
all instances of saturate and are hooked up to the correct function on all
platforms.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13010
2021-10-27 14:05:46 +02:00
18b6f0d0f1 Fix T92264: incorrect field inferencing when muting link between reroutes
Previously, muted links were just ignored considered by field inferencing.
Now muted links behave like normal links in the inferencing process.
2021-10-27 12:43:04 +02:00
051bb46c55 Fix T92241: curve radius and tilt swapped after resampling
This only happened when the spline contained a single point.
2021-10-27 12:36:42 +02:00
c06a86f99f Fix T92328: crash during field inferencing when there is a link cycle
The toposort did not handle link cycles which it should.
2021-10-27 12:29:59 +02:00
d161b5d204 UI: Add padding to the left of tree-rows labels without icon
The label was placed right at the left border of the row highlight,
which looked weird. So add some padding to tree-row labels without icon
or collapse chevron, which makes it look more polished. As additional
benefit, it alignes the labels better with icons of other rows on the
same tree level. And the padding makes it more clear that a child is
indeed a child, not just a sibling without icon.
2021-10-27 12:14:47 +02:00
e16bc136f9 Cleanup: Make UI tree-view item constructor explicit
Constructors that can be called with a single argument should be
explicit, unless there's a reason not to, to avoid unintended
constructions.
2021-10-27 12:14:47 +02:00
933215d6da Cleanup: Move 2.80 doversion code under a MAIN_VERSION_ATLEAST check 2021-10-27 11:44:57 +02:00
8b15b06b20 Fix: missing cache invalidation when there is only one spline
This fixes T92511, but there is still the more general problem
described in T92508.
2021-10-27 11:02:49 +02:00
4d605ef2f4 Fix T92427: Adding new nodes does no edge-panning
Unlike translating existing nodes [which disables cursor wrapping and
enables edge-panning instead since rBSa1cc7042a74], adding new nodes
would still show the old behavior of cursor wrapping.

This has been disabled for the case when the node whould be added
outside (due to menus overlapping other editors).

Now enable edge-panning for adding new nodes as well and make sure
this only starts once the mouse has returned into the inside rect once.

Maniphest Tasks: T92427

Differential Revision: https://developer.blender.org/D13005
2021-10-27 10:22:06 +02:00
b94447a298 Fix T92494: Node Editor dot grid not respecting display resolution scale
This seems wrong and was especially noticeable since transform snapping
does account for it (which was reported in T92494).
Now divide the `DotGridLevelInfo` `step_factor` by the default of 20 for
`U.widget_unit` and scale it later by the actual interface scale.

note: when zooming, this will still always snap to the smallest dot
level (not sure, with a bit more work it could be possible to only snap
to the lowest visible level after fading?)

Maniphest Tasks: T92494

Differential Revision: https://developer.blender.org/D13002
2021-10-27 09:56:58 +02:00
16e1b18dd8 Cleanup: Rename scene.c's FOREACHID_PROCESS macro to FOREACHID_PROCESS_IDSUPER.
Follow-up of rBf11ed418e5fa.
2021-10-27 09:15:21 +02:00
ec77228f0f Fix T92402: copy_particle_systems use_active fails outside the
Properties Editor

Similar to rBf9308a585ecd, use `psys_get_current` if we cant get the
active psys from context (which is only defined for the Properties
Editor). Other solution would be to define a "particle_system" context
member in other editors, but for now, stick with the simplest solution.

thx @mano-wii for additional input

Maniphest Tasks: T92402

Differential Revision: https://developer.blender.org/D13000
2021-10-27 08:50:37 +02:00
b3b2cd1fa9 Fix T88443: Lattice still shows edges with "Bounds" display type
Lattice wires are drawn as part of "Extras". Unlike the other types
details (Cameras, Lights, Lightprobes and Speakers), Lattices actually
have boundingboxes defined, so hide the lattice wires if only the
boundingbox is requested.

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11343
2021-10-27 08:35:50 +02:00
d9799e7706 Cleanup: use UNUSED_FUNCTION(..) attribute
Otherwise this function may fail to compile when other changes are made.
2021-10-27 17:20:38 +11:00
55dda9fdb3 Cleanup: use 'use_' prefix for RNA naming in grease pencil modifiers 2021-10-27 17:19:00 +11:00
526e60d4f0 Cleanup: remove underscore prefix from variable
Avoid using underscore prefix since these typically mean the variable
shouldn't be accessed directly (it may be accessed from a macro,
or memory on the stack which is assigned to a pointer).

In this case a more meaningful name can be used for the argument
that was shadowed.
2021-10-27 17:10:39 +11:00
9cb4624296 Cleanup: add missing break 2021-10-27 16:52:50 +11:00
0d155f274f Docs: add docstring for wmWindowManger.winactive
Also justify rounding up font width.
2021-10-27 15:55:36 +11:00
a3b785bc08 Cleanup: clang-format, clang-tidy, spelling 2021-10-27 15:55:36 +11:00
44ac5830c5 Nodes: Cleanup code for header underline alpha
Use `UI_GetThemeColorBlend4f` instead of manually setting alpha opaque.
2021-10-27 04:33:19 +02:00
99a2a73706 win/make.bat: Add svnfix convenience target
SVN seems to die randomly *a lot* during
large updates for some users, and I'm no
closer to finding out why that keeps happening.

"The internet" seems to imply some AV vendors
may be at fault here but nothing conclusive.

The solution however is repeatedly running
`svn cleanup`and `svn update` in the library
folder to repair the corruption and finish the
update.

This change adds a small convenience helper
to automate the repair.

This is done inside the make.bat code rather
than the shared python based update code, since
python lives in the library folder and may
or may not exist when this corruption occurs.
2021-10-26 17:48:16 -06:00
8d8ce64435 Nodes: Cleanup setting node header alpha
Always draw header opaque, set transparency only once after getting
the color. Helps to unify the color and alpha values.
2021-10-27 01:24:19 +02:00
f195a3a30d Asset Browser: Reduce paddings & margins between previews
The paddings and margins were more than needed, this reduces them a bit. That
way space is used more efficiently, the small differences add up so that more
items fit into a row.
The File Browser should not be affected.

Before/after comparisons:
{F11529986} {F11529988}
{F11529987} {F11529989}
2021-10-27 00:07:17 +02:00
2c2d4bc3a3 Knife: Preserve right click cancel functionality
Currently, the knife does not use right click cancel.
It causes users to accidentally delete entire cuts easily.

This patch allows right click cancel when no cuts have been made.
This makes it consistent with other tools when switching between them.
More info: https://devtalk.blender.org/t/gsoc-2021-knife-tool-improvements-feedback/19047/175?u=hobbesos
2021-10-26 22:30:21 +01:00
3e3ff1a464 Revert "Revert "Eevee: support accessing custom mesh attributes""
This reverts commit e7fedf6dba.

And also fix a compilation issue on windows.

Differential Revision: https://developer.blender.org/D12969
2021-10-26 18:23:59 -03:00
485c634c4c Cleanup: Confusion with knife xray functionality 2021-10-26 21:53:00 +01:00
e7fedf6dba Revert "Eevee: support accessing custom mesh attributes"
This reverts commit 03013d19d1.

This commit broke the windows build pretty badly and I don't
feel confident landing the fix for this without review.

Will post a possible fix in D12969 and we'll take it from there.
2021-10-26 14:49:22 -06:00
7d3d09b69c Geometry Nodes: Get and set nodes for ID attribute
These nodes allow accessing and changing the stable/random ID used
for motion blur with instances and stable randomness.

Since rB40c3b8836b7a, the stable ID is a built-in attribute, so to be
consistent and allow changing it in the node tree like other built-in
attributes, it has get and set nodes.
2021-10-26 15:40:57 -05:00
b37caa3f06 Fix: Knife unused function warning 2021-10-26 21:21:22 +01:00
71fd0f7b7b Fix: Knife measurements broken when a cut point is in space
Knife angle measurements were mis-aligned if a cut point was in space.
Specifically, the arc drawing would not match with the cut line.

Fixed by removing a correction for kcd->prev.cage.
This correction was originally added for panning with measurements to work.
In hindsight it is not needed and only introduces issues like this.
2021-10-26 21:12:48 +01:00
ca2ae350ec Asset Browser: Improve hint for asset library that isn't found
We already show a message when showing an asset library whose path can't be
found on disk. The red text was making it look like some fatal error happened.
And the message could be a bit more useful generally.

So this removes the red color of the text, (arguably) improves the text and
adds a button as shortcut to open the Preferences with the asset library
settings.

Differential Revision: https://developer.blender.org/D12894
2021-10-26 21:57:38 +02:00
d040493cd4 UI: Rename operator to open Preferences window
Renames the operator from "Show Preferences" to "Open Preferences...".  "Open"
is more clear than "Show" (since they could be shown in-place). "..." is
usually used in Blender to indicate that a new Window or popup will be opened.

Note that vanilla Blender doesn't actually show this name anywhere, so this
change shouldn't be visible. That may change, see D12894.
2021-10-26 21:57:38 +02:00
8422b24e1c Fix: Build issue on windows
Empty initializer is not appreciated by MSVC.
2021-10-26 13:44:26 -06:00
0cf9794c7e Assets: Rename "Default" asset library to "User Library"
Feedback was that "Default" is a bit of a weird name, so switching it to "User
Library". Added versioning code which won't be entirely bullet proof (e.g. will
also rename libraries named "Default" by the user), but it doesn't have to be.

Addresses T90298.
2021-10-26 21:01:44 +02:00
319de793d7 Fix T92508: cache invalidation bug in Set Position node
The call to `attribute_try_get_for_output` does some cache invalidation
internally. Under some circumstances the call to `position_evaluator.evaluate()`
recomputed the caches (e.g. when the Normal node was used, the evaluated
handle positions cache on curves were updated). After the positions have
been updated in the Set Position node, the cache was not invalidated again.,
leading to incorrect rendering.

The proper solution will be to do the cache invalidation in `OutputAttribute.save()`
again. That is a bit more involved though. For now just reorder the code a bit
to do the cache invalidation after the field has been computed.
There is a follow up task: T92509.
2021-10-26 20:52:18 +02:00
35aa3bf22d Cleanup: Restore alphabetical order 2021-10-26 13:39:09 -05:00
f81c514bd2 Assets: Disable snap-dragging for linking object assets
The location of a linked object isn't editable, or at least it will be reset
when reloading the file. So the drag & drop shouldn't even pretend like this
would work, so disable the snapping of the object and the bounding-box to show
the snapped object location while dragging.
2021-10-26 20:30:51 +02:00
18ace3b541 Fix linked objects not appearing after dragging in from Asset Browser
When the Asset Browser import type was set to "Link", after dragging in an
object asset the object wouldn't actually appear in the viewport. Do the same
depsgraph tagging (and TODO comment) as the `OBJECT_OT_add_named` operator,
which does similar things.
2021-10-26 20:30:51 +02:00
63de6078da Fix objects not appearing in Outliner after dragging in from Asset Browser
When dragging in an object from an external asset library from the Asset
Browser, the Outliner wouldn't update.
2021-10-26 20:30:51 +02:00
4db4a97355 Node Editor: Style update to nodes
This patch changes how nodes look visually, in an attempt to fix a number of issues:
* The header background is currently drawn using a theme color fully opaque, this limits the colors we can use because the node name/label is drawn on top.
* Hard-coded transparency makes nodes hard to read. The node backdrop already has alpha so if the user wants it they can set it. This patch uses alpha from the theme.
* Better muted status indicator, instead of simply making everything transparent and the wires inside red, draw a red outline around the node, darken the header and backdrop.
* On muted nodes, display wires behind the backdrop to not interfere with text/widgets inside the node.

Nodes:

* Darken header to improve readability of node label.
* Draw a line under the header
* Thicker outline.
* Do not hard-code transparency on nodes, use the theme's node backdrop alpha component.
* Use angle icon instead of triangle (to be consistent with the [[ https://developer.blender.org/D12814 | changes ]] to panels)

Style adjustment to sockets drawing:

* Do not hard-code the socket outline color to black, use `TH_WIRE` instead
* Do not use `TH_TEXT_HI` for selected sockets, use `TH_ACTIVE` (active node outline)
* Do not draw sockets background transparent on muted nodes.
* Thicker outline to help contrast and readability

{F11496707, size=full}

Reviewed By: #user_interface, HooglyBoogly

Differential Revision: https://developer.blender.org/D12884
2021-10-26 20:19:24 +02:00
c7b27f45ae Fix: Show node editor dot grid when there is no node tree 2021-10-26 13:03:09 -05:00
0bfae1b120 Geometry Nodes: geometry component type warning system
Previously, every node had to create warnings for unsupported input
geometry manually. Now this is automated. Nodes just have to specify
the geometry types they support in the node declaration.

Differential Revision: https://developer.blender.org/D12899
2021-10-26 20:00:10 +02:00
be3e09ecec Fix: Inverted normal for one curve to mesh cap 2021-10-26 12:59:46 -05:00
9fa304bf13 Geometry Nodes: Only create instance IDs when they exist
Instance IDs serve no purpose for rendering when they aren't stable from
one frame to the next, and if the index is used in the end anyway, there
is no point in storing a vector of IDs and copying it around.

This commit exposes the `id` attribute on the instances component,
makes it optional-- only generated by default with the distribute points
on faces node.

Since the string to curves node only added the index as each instance's
ID, I removed it. This means that it would be necessary to add the ID
data manually if the initial index actually helps (when deleting only
certain characters, for example).

Differential Revision: https://developer.blender.org/D12980
2021-10-26 12:50:39 -05:00
b6d2bee28f Geometry Nodes: Support instances in the remove attribute node
This node is still hidden, but allowing removing the `id` attribute is
useful for testing, and possibly optimization in the future.
2021-10-26 12:45:47 -05:00
6871f8482b 3D View, Objects menu: Always show Assets sub-menu
Now that object assets are no longer considered experimental, the Assets
submenu can always be shown (regardless of the Extended Asset Browser
experimental feature).
2021-10-26 19:27:01 +02:00
3286150ac9 Assets: Enable object asset support by default
The two blocking issues for object assets are addressed, see T92111 and T90198.
So now, objects can be marked as assets and be used in the Asset Browser.
2021-10-26 19:24:46 +02:00
7bffddfa6e Don't deselect assets in ED_fileselect_activate_by_id
`ED_fileselect_activate_by_id()` activates an asset (i.e. marks it as
the active asset in the asset browser). To avoid an "active but not
selected" state, it also selects it.

Before this commit, the function would also deselect all other assets,
but that's considered doing too much. If deselection is required, the
`ED_fileselect_deselect_all()` function can be called.

Manifest Task: T92152
2021-10-26 19:21:22 +02:00
a062d86230 Drop object assets and associated objects at the cursor location
When dropping asset objects, place them under the mouse-cursor
along with any other objects they link in.

Ref D12935

Reviewed By: Severin
2021-10-27 04:19:45 +11:00
eaed38cbd3 Add Assets menu to 3D View's Object menu
In the 3D Viewport, add an "Assets" submenu to the Objects menu, for the
same operators as available in the outliner: Mark as Asset, Clear Asset,
Clear Asset (Set Fake User).

Since object assets are still considered experimental, the menu is only
shown when the Extended Asset Browser experimental feature is enabled.
2021-10-26 18:56:13 +02:00
730de2e7fd Asset Browser: Show disabled-hint when dragging external assets over catalog
There's now a message displayed in red next to the cursor explaining that only
assets from the current file can be moved between catalogs.

The previous commit prepared this.
2021-10-26 18:55:27 +02:00
11e8a2ec5f UI: Support disabled-hint for dropping in the tree-view API
A tree-view item's drop controller can now return a message for the user
explaining why dropping isn't possible with the dropped data. This is then
displayed in red text next to the cursor.

This isn't actually used yet, the follow up commit will do that.
2021-10-26 18:55:27 +02:00
03c0581c6e Assets: allow Mark/Clear Asset operators from 3D Viewport
Make it possible to run `ASSET_OT_mark` and `ASSET_OT_clear` operators from
the 3D Viewport. There is no menu entry, just compatibility with pressing
F3 and executing the operators from the operator search.
2021-10-26 18:35:13 +02:00
2d5c9e0baf Cleanup: 3D View context, early returns for clearer flow
Refactor `view3d_context()` to use early `return`s instead of a bundle of
`if`/`else if`/`else`, some of which had `return`s and some not.

No functional changes.
2021-10-26 18:35:13 +02:00
5acbc01d0d Cleanup: 3D View context, use enum values
Use explicit enum values instead of returning 0/1 from `view3d_context()`.

No functional changes.
2021-10-26 18:35:13 +02:00
26e3045eb9 3D View context: return "ok" when fetching view3d context dir
`view3d_context()` would return `-1` ("found but not available") when
fetching the context dir. This is incorrect; it should return 1 ("ok").

This is a semantic change in preparation of further cleanup of the code.
2021-10-26 18:35:13 +02:00
03013d19d1 Eevee: support accessing custom mesh attributes
This adds generic attribute rendering support for meshes for Eevee and
Workbench. Each attribute is stored inside of the `MeshBufferList` as a
separate VBO, with a maximum of `GPU_MAX_ATTR` VBOs for consistency with
the GPU shader compilation code.

Since `DRW_MeshCDMask` is not general enough, attribute requests are
stored in new `DRW_AttributeRequest` structures inside of a convenient
`DRW_MeshAttributes` structure. The latter is used in a similar manner
as `DRW_MeshCDMask`, with the `MeshBatchCache` keeping track of needed,
used, and used-over-time attributes. Again, `GPU_MAX_ATTR` is used in
`DRW_MeshAttributes` to prevent too many attributes being used.

To ensure thread-safety when updating the used attributes list, a mutex
is added to the Mesh runtime. This mutex will also be used in the future
for other things when other part of the rendre pre-processing are multi-threaded.

`GPU_BATCH_VBO_MAX_LEN` was increased to 16 in order to accommodate for
this design.

Since `CD_PROP_COLOR` are a valid attribute type, sculpt vertex colors
are now handled using this system to avoid to complicate things. In the
future regular vertex colors will also use this. From this change, bit
operations for DRW_MeshCDMask are now using uint32_t (to match the
representation now used by the compiler).

Due to the difference in behavior for implicit type conversion for scalar types
between OpenGL and what users expect (a scalar `s` is converted to
`vec4(s, 0, 0, 1)` by OpenGL, vs. `vec4(s, s, s, 1)` in Blender's various node graphs) ,
all scalar types are using a float3 internally for now, which increases memory usage.
This will be resolved during or after the EEVEE rewrite as properly handling
this involves much deeper changes.

Ref T85075

Reviewed By: fclem

Maniphest Tasks: T85075

Differential Revision: https://developer.blender.org/D12969
2021-10-26 18:29:30 +02:00
8ddfdfd2b2 Geometry Nodes: Handle multiple grids in the volume to mesh node
In future use cases, a volume can contain many grids that represent the
density information. In this case, it's better if the volume to mesh node
creates a mesh based on all of the grids in the volume.

This is also a benefit to share-ability, since one doesn't have to
specify the grid name in the node. Instead, in the future we can have
a way to split particular grids into separate volumes, if only one
grid should be considered.

The code changes are relatively simple:
 - Move the old volume to mesh node to the legacy folder.
 - Run the volume to mesh node on all instance geometry, like elsewhere.
 - Make the blenkernel's volume to mesh API a bit more specific.

Differential Revision: https://developer.blender.org/D12997
2021-10-26 11:25:44 -05:00
7979dff9dc UI: Let object drop operator display hint why it's disabled
When dragging an object in non-object mode into a 3D View, there will now be
red text explaining that this is only possible in object mode.
The previous commit enabled this.
2021-10-26 18:14:17 +02:00
df2e053935 UI: Improved feedback when dropping is not possible on drag 'n drop
* Allow operators to show a "disabled hint" in red text explaining why dropping
  at the current location and in current context doesn't work. Should greatly
  help users to understand what's the problem.
* Show a "stop" cursor when dropping isn't possible, like it's common on OSes.

Differential Revision: https://developer.blender.org/D10358
2021-10-26 18:14:17 +02:00
ec831ce5df LineArt: Trimming edges right at the image border
This option allows the edge to end right at the border
instead of extending beyond.
Useful when having multiple camera setup where you
want the border to be clean.
Also moved overscan option down inside "Composition" sub panel
so it makes more sense.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12126
2021-10-27 00:10:49 +08:00
3371a4c472 UI: Improve node editor breadcrumbs display
This patch upgrades node editor breadcrumbs to have slightly more
visual weight, to including the base path of object/modifier/world,
etc, have more visually pleasing spacing, and contain icons.

In the code, a generic "context path" is added to interface code.
The idea is that this could be used to draw other breadcrumbs in areas
like the property editor or the spreadsheet, and features could be added
to all of those areas at the same time.

Ideally we would be able to control the color of the breadcrumbs with a
specific theme color, but since they are drawn with the regular layout
system, that is not easily possible.

Thanks to @fabian_schempp for the original patch.

Differential Revision: https://developer.blender.org/D10413
2021-10-26 11:05:11 -05:00
f1a662c157 Fix: Assert on startup from incorrect float property min 2021-10-26 11:03:45 -05:00
01d7211380 Fix T92505: previewing specific node outputs did not work anymore
This was missing from my refactor in rB5bfe09df2244cb9de0b6554a378eecef77b1e75d.
2021-10-26 17:53:41 +02:00
efbd36429a LineArt: Custom Camera
Allows line art camera to be different from scene active camera,
useful when baking multiple shots in different angle as
well as for motion graphics effect.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12047
2021-10-26 23:44:13 +08:00
773f5065f3 LineArt: Fix prop range for stroke_depth_offset. 2021-10-26 23:44:13 +08:00
c3ef1c15f5 LineArt: Stroke offset towards camera.
Allows the user to turn off in_front option for grease pencil object
and offset strokes towards camera to allow depth interaction of the
rest of the scene.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12046
2021-10-26 23:02:17 +08:00
Charlie Jolly
52ccb44501 Geometry Nodes: Add Brick Texture node
Port brick shader node to GN

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12783
2021-10-26 15:39:53 +01:00
a90cb41cb9 Cleanup: clang-format 2021-10-26 16:35:26 +02:00
d89c4999a7 Fix Cycles runtime GPU kernel compilation after recent refactor 2021-10-26 16:22:50 +02:00
dde11219c6 Cleanup: remove files that should not have been added in file renames 2021-10-26 16:22:50 +02:00
William Leeson
366262bef5 Distance Scrambling for for Cycles X - Sobol version
Cycles:Distance Scrambling for Cycles Sobol Sampler

This option implements micro jittering an is based on the INRIA
research paper [[ https://hal.inria.fr/hal-01325702/document | on micro jittering ]]
and work by Lukas Stockner for implementing the scrambling distance.
It works by controlling the correlation between pixels by either using
a user supplied value or an adaptive algorithm to limit the maximum
deviation of the sample values between pixels.

This is a follow up of https://developer.blender.org/D12316

The PMJ version can be found here: https://developer.blender.org/D12511

Reviewed By: leesonw

Differential Revision: https://developer.blender.org/D12318
2021-10-26 16:11:27 +02:00
4094868f73 Fix T92502: Position Pass broken
The kernel was writing it for the first sample only, while the film
accessor was thinking it needs to be filtered.
2021-10-26 16:06:35 +02:00
Dorian
f41d4735e9 Nodes: support transparency for link highlight color
Node links that are connected to selected nodes are highlighted
using the Wire Select theme color. Now it is possible to change the
transparency of this color to allow the actual link color to be visible
through the highlight (or to turn of the highlight entirely).

Differential Revision: https://developer.blender.org/D12973
2021-10-26 15:55:44 +02:00
567bcb9387 Cleanup: skip unnecessary OIIO image setup when not using tiled render 2021-10-26 15:39:58 +02:00
b937b6d069 Cleanup: silence address sanitizer warning about NULL + 0 2021-10-26 15:39:25 +02:00
8de942b11d Cleanup: compiler warning when building without OpenSubdiv 2021-10-26 15:38:37 +02:00
949dbb08d2 Cleanup: remove useless WITH_CYCLES_DEVICE_MULTI 2021-10-26 15:37:59 +02:00
fd25e883e2 Cycles: remove prefix from source code file names
Remove prefix of filenames that is the same as the folder name. This used
to help when #includes were using individual files, but now they are always
relative to the cycles root directory and so the prefixes are redundant.

For patches and branches, git merge and rebase should be able to detect the
renames and move over code to the right file.
2021-10-26 15:37:04 +02:00
d7d40745fa Cycles: changes to source code folders structure
* Split render/ into scene/ and session/. The scene/ folder now contains the
  scene and its nodes. The session/ folder contains the render session and
  associated data structures like drivers and render buffers.
* Move top level kernel headers into new folders kernel/camera/, kernel/film/,
  kernel/light/, kernel/sample/, kernel/util/
* Move integrator related kernel headers into kernel/integrator/
* Move OSL shaders from kernel/shaders/ to kernel/osl/shaders/

For patches and branches, git merge and rebase should be able to detect the
renames and move over code to the right file.
2021-10-26 15:36:39 +02:00
b698fe1e04 Cleanup: compiler warnings 2021-10-26 15:35:31 +02:00
fd477e738d Geometry Nodes: remove reference to anonymous attributes in tooltips
This changes socket inspection for fields according to T91881.

Differential Revision: https://developer.blender.org/D13006
2021-10-26 15:32:01 +02:00
b8b9023d8c Fix drop of dimensionless objects in 3DView
The matrix and location were not being calculated in this case.
2021-10-26 10:07:58 -03:00
af26720b21 UI: Use text highlight theme color for active tab
Currently, both inactive and active tabs are using the `Region Text` theme property.
This patch makes it so active tabs use `Region Text Highlight`.

Since this check is done in other places already but was simply missing in this case, I believe this was just an oversight and not a design decision.

Top is master, bottom is this patch:

{F11520838, size=full}

This allows this kind of tab highlight, not possible before since all tabs would have white text.

{F11520873, size=full}

Reviewed By: #user_interface, Severin

Differential Revision: https://developer.blender.org/D13003
2021-10-26 15:00:46 +02:00
75704091fc Cycles: add additive AO support through Fast GI settings
Add a Fast GI Method, either Replace for the existing behavior, or Add
to add ambient occlusion like the old world settings.

This replaces the old Ambient Occlusion settings in the world properties.
2021-10-26 14:56:43 +02:00
eb1fed9d60 Cycles: restore Denoising Depth pass, when enabling Denoising Data passes
This is still useful in some cases even if not used by OpenImageDenoise. In
the future this may be replaced with a more generic system to control render
passes and filtering, but for now this just does what it did before.
2021-10-26 14:48:44 +02:00
16a8d0fab0 Cycles: change Position render pass to be not antialiased
Similar to the Depth, for compositing the interpolated values between a far
and near object can be non-sensical.
2021-10-26 14:48:44 +02:00
118664e463 Fix custom property editing with Python 3.10 2021-10-26 22:26:35 +11:00
6d3d2988fa Cleanup: spelling in comments 2021-10-26 22:26:35 +11:00
Jeroen Bakker
ddf97d6270 BlenLib: Add JSON Serialization/Deserialization Abstraction Layer.
Adds an abstraction layer to switch between serialization formats.
Currently only supports JSON. The abstraction layer supports
`String`, `Int`, `Array`, `Null`, `Boolean`, `Float` and `Object`. This
feature is only CPP complaint.

To write from a stream, the structure can be built by creating a value
(any subclass of `blender::io::serialize::Value` can do, and pass it to
the `serialize` method of a `blender::io::serialize::Formatter`. The
formatter is abstract and there is one implementation for JSON
(`JsonFormatter`).

To read from a stream use the `deserialize` method of the formatter.

{D12693} uses this abstraction layer to read/write asset indexes.

Reviewed By: Severin, sybren

Maniphest Tasks: T91430

Differential Revision: https://developer.blender.org/D12544
2021-10-26 13:09:10 +02:00
d20fa6c4d4 Geometry Nodes: don't log full fields when not necessary
Previously, the field on every socket was logged for later use. This had
two main negative consequences:
* Increased memory usage, because the fields may contain a lot of data
  under some circumstances (e.g. a Ray Cast field contains the target geometry).
* Decreased performance, because anonymous attributes could not be
  removed from geometry automatically, because there were still fields that
  referenced them.

Now most fields are not logged anymore. Only those that are viewed by a
spreadsheet and constant fields. The required inputs of a field are still
logged in string form to keep socket inspection working.
2021-10-26 12:48:43 +02:00
bird_d
41a4c62c31 Animation UI: Make Ctrl+F use textbox instead of pop-up
Avoid blocking the UI when searching for animation channels with Ctrl+F.

Instead of showing a single text input in a blocking popup, Ctrl+F now
just focuses the search box above the channel list. It feels nicer to
use and has the niceties that come from using that textbox, like
searching per keystroke, compared to the old pop-up method.

As the behaviour of the operator has changed considerably, this also
changes the operator name from `anim.channels_find` to
`anim.channels_select_filter` and updates the keymaps.

Reviewed By: ChrisLend, sybren

Differential Revision: https://developer.blender.org/D12146
2021-10-26 11:56:45 +02:00
816d3f830b CMake: expand instructions for accidental 'cmake' run in source dir
Our CMake setup refuses to run from the source directory (i.e. Blender does
not support in-source builds). Instead, it shows instructions on how to
clean up after an accidental `cmake` invocation. These instructions missed
one directory that should also be removed (`CMakeFiles`), so that's been
added to the message now.

No functional changes to Blender or the build.
2021-10-26 11:46:57 +02:00
5bfe09df22 Geometry Nodes: support viewing field values in spreadsheet
The viewer node has been expanded to have a field input next to the
geometry input. When both are connected (by ctrl+shift clicking on a node)
the spreadsheet will show the evaluated field on the geometry.

The operator to link to the viewer has become a bit smarter. It automatically
detects if it should link to the geometry or field input. In the future some more
smartness could be added, such as automatically relinking the "right" geometry
when viewing a field.

Internally, there are two major changes:
* Refactor of what happens when ctrl+shift clicking on a node to link to
  a viewer. The behavior of the geometry nodes viewer is a bit more complex
  than that of the compositor viewers. The behavior in compositing nodes
  should not have changed. Any change should be reported as a bug (and then
  we can decide if it's worse than before or if it needs fixing).
*  Evaluation, display and caching of fields in the spreadsheet editor.

Differential Revision: https://developer.blender.org/D12938
2021-10-26 11:25:32 +02:00
fee2cedb33 GPencil: Fix(unreported) Dash modifier wrong logic.
When the modifier iterates to an empty layer with no frame it will return,
while the correct logic is to continue.
2021-10-26 17:11:51 +08:00
f11ed418e5 Cleanup: LibQuery: Rename BKE_LIB_FOREACHID_PROCESS to BKE_LIB_FOREACHID_PROCESS_IDSUPER.
More in-line name with the rest of that macro-based API, especially
since this will be extended in the future.
2021-10-26 10:40:36 +02:00
fe68b54edb Cleanup: else after continue. 2021-10-26 10:28:52 +02:00
9ba22bd1f7 Fix crash in liboverride/pointcache handling code after recent changes.
In some cases code would try to access NULL pointer.

Reported by @dfelinto, thanks.
2021-10-26 10:13:44 +02:00
7bc7d1747c Cleanup: forgot to remove empty line in previous commit. 2021-10-26 09:58:03 +02:00
ee743204b0 Cleanup: build warnings.
`NULL` instead of `nullptr` in cpp code, and `else` statements after
returns.
2021-10-26 09:52:08 +02:00
5f9b00a07e Cleanup: Remove unused parameter 2021-10-26 15:05:25 +09:00
89637f40df Cleanup: Improve description for XR absolute tracking 2021-10-26 13:42:09 +09:00
9dbfa05c44 XR: Only show ref space warnings in debug-xr mode
This avoids spamming the console for users who have not set up a
tracking space/boundary for their headsets.
2021-10-26 13:41:02 +09:00
9db13c8d79 XR: Fix potential crash when toggling session 2021-10-26 13:38:59 +09:00
4c0512bc32 XR: Versioning for session draw flags, base scale 2021-10-26 13:37:31 +09:00
7ae2810848 XR: View adjustments for variable viewer scale
This adjusts some calculations and visibility flags for XR viewports in
order to account for a possible scale factor in the XR view matrix.

This scale factor can be introduced via the XR session settings base
scale, which allows a viewer to begin their session at a specific
reference scale, or the XR session state navigation scale, which allows
a viewer to adjust their scale relative to the reference scale during
the session.

Reviewed by Severin as part of D11501, but requested to be committed
separately.
2021-10-26 13:35:12 +09:00
3434a991ec XR Controller Support Step 5: Navigation
Adds navigation transforms (pose, scale) to the XR session state that
will be applied to the viewer/controller poses. By manipulating these
values, a viewer can move through the VR viewport without the need to
physically walk through it.

Add-ons can access these transforms via Python
(XrSessionState.navigation_location/rotation/scale) to use with custom
operators.

Also adds 3 new VR navigation operators that will be exposed to users
as default actions in the VR Scene Inspection add-on. While all three
of these operators have custom properties that can greatly influence
their behaviors, for now these properties will not be accessible by
users from the UI. However, other add-ons can still set these custom
properties if they desire.

1). Raycast-based teleport
Moves the user to a location pointed at on a mesh object. The result
can optionally be constrained to specific axes, for example to achieve
"elevation snapping" behavior by constraining to the Z-axis. In
addition, one can specify an interpolation factor and offset.

Credit to KISKA for the elevation snapping concept.

2). "Grab" navigation
Moves the user through the viewport by pressing inputs on one or two
held controllers and applying deltas to the navigation matrix based on
the displacement of these controllers. When inputs on both controllers
are pressed at the same time (bimanual interaction), the user can scale
themselves relative to the scene based on the distance between the
controllers.

Also supports locks for location, rotation, and scale.

3). Fly navigation
Navigates the viewport by pressing a button and moving/turning relative to
navigation space or the VR viewer or controller. Via the operator's
properties, one can select from a variety of these modes as well as
specify the min/max speed and whether to lock elevation.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D11501
2021-10-26 13:34:58 +09:00
e463d2c16f UI: Change node editor grid into a dot grid
This patch makes the background grid of the node editor a grid of dots
instead of lines. This makes the background look a bit more subtle and
reduces visual complexity. The dots are meant to provide a reference
when panning and zooming. Based on the design of @pablovazquez, and
a patch originally authored by @fabian_schempp.

The "Grid Levels" controls how many levels of dots are drawn. As the
editor zooms in, the higher levels of dots fade in, making them closer
together visually. The zoom factor at which each grid starts and ends
fading in is controllable in the code, and could be tweaked further
in the future. The new default value is 7, out of a range from 0 to 9.

Differential Revision: https://developer.blender.org/D10345
2021-10-25 21:50:05 -05:00
Aaron Carlisle
6f5bf8aa3b Sequencer: Expose preview transform operators in menu
The also moves all the image operators into one menu.
The goal here is to expose the operators in the UI so they
work with the operator search and to make the UI consistent.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12808
2021-10-25 22:19:30 -04:00
4e22a9ab9e Cleanup: Clang format 2021-10-25 22:18:45 -04:00
32cc9ff037 View3D Snap Cursor: don't limit the number of states
The benefit of a flat array in this case is small and limiting, so use a linklist.
2021-10-25 20:16:28 -03:00
40f59b5dad View3D Snap Cursor: sanitize and increase the maximum amount of states
3 is a small amount as each viewport creates a gizmo that creates its own state

Now if the state is not created, the gizmos use the last state.
2021-10-25 19:40:08 -03:00
4468c34378 Geometry Nodes: Optimise Voronoi texture node
This patch improves performance by only assigning
or calculating data for connected sockets.

It is recommended that artists use the lowest dimensions setting
for noise based textures. E.g. Use 2D instead of 3D where possible.

Using a scoped timer and single thread on 256,000 points.
Smooth F1 3D : Debug build
Timer 'Optimised' took 9.39991 s
Timer 'Normal' took 16.1531 s

This optimisation is only for GN and not shaders.

Differential Revision: https://developer.blender.org/D12985
2021-10-25 22:54:49 +01:00
348b5f98f0 UI: Don't use colons at the end of property labels
This was a 2.7x design, now with property split we omit the colon.
2021-10-25 17:23:44 -04:00
8f1284ab78 UI: Make the mesh to volume node slightly narrower
Also use consistent UI names for properties that are similar between
that node and the points to volume node (which happen to be shorter,
allowing the node to be narrower).
2021-10-25 14:20:44 -05:00
3be91d6da5 Cleanup: Remove unused functions, make functions static 2021-10-25 13:39:19 -05:00
046a99d580 Cleanup: silence warnings
```
warning: assignment discards ‘const’ qualifier from pointer target
warning: declaration of ‘co’ shadows a parameter
```
2021-10-25 12:57:05 -03:00
08a1492ae5 Asset Browser: apply search filter to tags as well
The search bar in the asset browser now also matches on asset tags.

- Matching is done on entire tags, so searching for "redder" will not
  show assets tagged with "red".
- All assets are shown that have at least one matching tag. So searching
  for "red green" will show all assets with either "red" or "green" tags
  (or both, of course).
- Searching is case-insensitive.
- Only assets from the active catalog are shown; if all assets should be
  searched through, users can select the "All" catalog.

Manifest Task: T82679
2021-10-25 17:12:56 +02:00
972677b25e UI: Improve layout of custom property edit panel
This patch makes the layout of the custom property panel more coherent
with the rest of the property editor interface, makes it less busy,
allows more space for the buttons for the actual properties, and
simplifies editing values of unsupported property types or long arrays.

 - Remove the box around each property.
 - Use an non-embossed X icon for deleting.
 - Use an "edit" icon instead of the text for the meta-data edit operator.
   The "gear" icon used for editing isn't ideal here.
 - Increase the max array length for drawing the values directly to 8.
 - Add an "Edit Property Value" operator for dictionaries or longer arrays.
 - Replace the "Library Override" text with an icon.
 - Use a proper split factor, the same as the rest of the UI.

Differential Revision: https://developer.blender.org/D12805
2021-10-25 10:01:07 -05:00
Germano Cavalcante
a84f1c02d2 Assets: Snapping with visual feedback while dragging
The drag and drop feature of objects in 3D View has been modified to include:
- Snap the object being dragged.
- Visual feedback through a box and the placement tool grid.

Maniphest Tasks: T90198

Differential Revision: https://developer.blender.org/D12912
2021-10-25 11:57:26 -03:00
b17038db31 Drag Drop: allow customizable drawing 2021-10-25 11:57:26 -03:00
e8027ec2a0 UI Drag Drop: allow customizable drawing
No functional changes.

This commit adds 3 callbacks for `wmDropBox` which allow custom drawing
without affecting the internal dropbox API.

Differential Revision: https://developer.blender.org/D12948
2021-10-25 11:57:26 -03:00
2a7b9f2d45 Cleanup: silence warning in recent commit
Thanks to Dr. Sybren for pointing it out!
2021-10-25 16:52:27 +02:00
6da63b19ff Fix T87627: Asset Browser Search Bar not working
The asset browser search bar was filtering on the filename containing the
asset, and not the asset name. This is now fixed.
2021-10-25 16:39:14 +02:00
1267dfee7c Cleanup: refactor filelist filter functions
Perform a few cleanups:

- Add documentation to explain what returned bools mean.
- Early returns so that flow is clearer and some checks on `is_filtered`
  are no longer necessary.
- Split up `is_filtered_file` and `is_filtered_id_file`, so that they can
  reuse common code, and such that the different filter checks they
  perform can be separated from each other.

The latter is done not only to reduce code duplication, but also as
preparation to fix the asset browser filtering. For that, it helps when
the "filter by file name" and "filter by file type" parts are separate.

No functional changes.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D12991
2021-10-25 16:39:14 +02:00
4758a7d357 UI: Use flat colors for NLA strip drawing
The NLA editor is in need of a design overhaul, hopefully for 3.1 or 3.2.

This should be a project on itself, however, the worst offender currently is the use of
gradients on strips. Something that can be fixed easily.

{F11390293, size=full, loop, autoplay}

A simple replace of `UI_draw_roundbox_shade_x` for `UI_draw_roundbox_4fv` brings strips
in line with how other areas are drawn.

This patch also:
* Remove embossed lines around active action channel.
* Highlight the strip while being moved.

This patch does not include any theme changes. This will be tackled separately.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D12968
2021-10-25 16:29:26 +02:00
1bc28fc73b Fix T92466: Crash snapping to text objects with XRay shading
Should have been addressed along with {rB6cff1d648030}
2021-10-25 11:26:01 -03:00
bc2f4dd8b4 Geometry Nodes: Add "Fill Caps" option to curve to mesh node
This adds an option to fill the ends of the generated mesh for
each spline combination with an N-gon. The resulting mesh is
manifold, so it can be used for operations like Boolean.

Differential Revision: https://developer.blender.org/D12982
2021-10-25 09:10:44 -05:00
4b1ad2dc17 Fix T92361: Zooming nodes clips text labels
While c7d94a7827 exposed this bug,
this was caused by text widths being calculated without taking the zoom
level into account since drawing at a smaller size is often wider than
the width of the larger text scaled by the zoom.
2021-10-26 00:25:29 +11:00
cfde1f9f3b Geometry Nodes: Keep Add menu sorted alphabetically 2021-10-25 15:14:40 +02:00
b15e1861ac Fix T92460: crash when instancing on curves generated from string
Issue is that the Instance on Points node currently expects that all
instance references are used (see `remove_unused_references`).
This should be fixed at some point, but for now make sure that
the String to Curves node does not output unused references.
2021-10-25 15:12:50 +02:00
bd7f1c5cce Fix non-capitalized UI message. 2021-10-25 14:41:47 +02:00
cdcca917cf Tests: assets, add BKE callback init/finalize to test setup/teardown
Add calls to `BKE_callback_global_init()` and `BKE_callback_global_finalize()`
to ensure unit tests mimick Blender (and don't trip the assertions added
in rBbeea601e7253).

No functional changes to Blender.
2021-10-25 14:21:43 +02:00
4100a79219 Assets: Add Author field to asset metadata
This is information you'd typically want to be visible in the UI. It's optional
of course, so if not relevant, it can just remain unset.
2021-10-25 13:51:14 +02:00
e7bea3fb6e Assets/IDs: Don't generate previews for object types with no real geometry
Object types like empties, cameras or lamps will just end up as empty preview
images. We can think about ways to visualize them still, but meanwhile, don't
create such an empty preview.

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

Reviewed by: Bastien Montagne, Sybren Stüvel
2021-10-25 13:33:16 +02:00
60e2103507 Fix: crash in previously added versioning code 2021-10-25 13:30:00 +02:00
5c2330203e Fix T92293: Clipped labels for graph editor modifiers
While c7d94a7827 exposed this bug,
this was caused by a discrepancy in padding where labels would
have additional padding when drawing without emboss.
The padding made widget drawing behave as if the text took up more
room causing it to be clipped.

Now labels are considered the same width with/without emboss.
2021-10-25 22:28:06 +11:00
8cecf88dca Cleanup: clang-tidy, spelling 2021-10-25 22:28:06 +11:00
61bb70e0c7 GPencil: Fix unreported double stroke color in materials panel
There was an extra stroke color in the side panel, but this prop must be visible only in Topbar.
2021-10-25 13:14:54 +02:00
039094c1ec Geometry Nodes: new Image Texture node
This adds a new image texture node for geometry nodes. It does not
reuse the same node that is used in shading, because we want to be
able to expose the image and frame as sockets.

There is a known update issue when a movie or image sequence is
used. That will be fixed separately (also see D12957).

Currently, the image socket is just a pointer to an Image ID data block.
This can contain single images but also movies and image sequences.
In the future, the definition of an image socket can be expanded to
include images that are generated from scratch in the node tree.
For more details read the discussion in D12827.

Some of the code is a direct port from cycles and should be cleaned
up a bit in the future. For example `image_cubic_texture_lookup`.

For still images, the frame input is ignored. Otherwise, the frame
has to be in a valid range for the node to work. In the future we
may add e.g. automatic looping functionality.

Differential Revision: https://developer.blender.org/D12827
2021-10-25 13:03:57 +02:00
2b91445ddd Cleanup: rename Outliner function
Seems like typos in rB32dc085289ac

outline_batch_delete_hierarchy --> outliner_batch_delete_hierarchy

Differential Revision: https://developer.blender.org/D12989
2021-10-25 12:58:52 +02:00
3c2e4f4cfd Fix T91411: Outliner crash using contextmenu operators from a shortcut
Oversight in {rBb0741e1dcbc5}.

This was guarded by an assert in `get_target_element`, but it can be
valid to have these assigned to a shortcut (and then perform the action
without an active outliner element).

Now remove the assert and let the operator polls check if we really have
a target element.

note: this basically makes `get_target_element` obsolete, could call
`outliner_find_element_with_flag` instead in all cases.

Maniphest Tasks: T91411

Differential Revision: https://developer.blender.org/D12495
2021-10-25 12:58:43 +02:00
06ae3c98eb Spreadsheet: fix updating active domain when component type changes
The mesh and instances case wasn't handled before.
2021-10-25 12:46:39 +02:00
892e5f4a9f Asset Catalogs: be more accepting of backslashes as separators
Asset Catalog Paths should only contain forward slashes as separators, but
now the UI is more resilient to people using blackslashes instead.

Manifest Task: T90553
2021-10-25 12:37:35 +02:00
550cbec5c4 Cleanup: asset catalog path test, improve sub-test separation
Put related lines in a block of their own, such that each block doesn't
have access to the variables of the previous blocks.

This makes it easier to correctly copy-paste some tests, as the compiler
forces you to update the code afterwards.
2021-10-25 12:37:35 +02:00
31f6e78370 Fix T92073: Cycles flicker when panning in camera view with border render
Panning in camera view makes the border to be modified, which was causing
the Cycles display to believe the rendered result is unusable.

The solution is to draw the render result at the display parameters it was
updated for. This allows to avoid flickering during panning, zooming, and
camera FOV changes. The suboptimal aspect of this is that it has some jelly
effect, although it is on the same level as jelly effect of object outline
so it is not terrible.

Differential Revision: https://developer.blender.org/D12970
2021-10-25 12:12:10 +02:00
beea601e72 BKE Callbacks: more explicit initialisation check
Add static boolean to track whether the callbacks system has been
initialised. This makes it possible to make the `BKE_callback_remove()`
function more noisy in case of programming errors, and avoids accessing
`funcstore->alloc` when `funcstore` was potentially already freed.

Thanks @campbellbarton for pointing this out.
2021-10-25 12:08:08 +02:00
8e56f3e8a3 Image: Fix Crash During Undo.
Fixes T91294.
2021-10-25 11:41:49 +02:00
b3ca926aa8 Geometry Nodes: use vector socket for offset in Set Position node
This replaces the boolean Offset input in the Set Position node with
a vector input. This makes the node easier to use. Using a "Position"
input as an "Offset" sounds wrong anyway.

The Position and Offset inputs are evaluated at the same time.

The versioning only works correctly when the Offset input was not connected
to something else before.

Differential Revision: https://developer.blender.org/D12983
2021-10-25 11:37:45 +02:00
1ecb4e6fd8 Fix T92446: node editor overlays reset automatically
Caused by rBcf72b10075758be971f9806b97db01f98383aba2.

The fix is to only enable the flags when a new node editor is actually created.
2021-10-25 11:30:41 +02:00
15762e9611 Fix T92430: Infinite recursion in some cases in new append code.
Shapekeys, always shapekeys... Since we cannot deal with them as regular
IDs, we need to handle potential recursion cases ourselves here. sigh.
2021-10-25 10:57:41 +02:00
d16e732638 UI: Refactor dropping support for the tree-view API
Introduces a dropping-controller API for the tree-view items,
`AbstractTreeViewItemDropController`. This reduces responsibilities of the main
tree-view item classes, which are already getting quite big. As I expect even
more functionality to be needed for it (e.g. drag support), it's better to
start introducing such controller types already.
2021-10-25 10:46:52 +02:00
c4fa17c67a Cycles: More accurate volume stack size calculation
The idea is to allow having a lot of non-intersecting volumes without
allocating volume stack to its full size.

With the F11285472 file the memory usage goes from 1400 MiB to 1000
on the RTX6000 card.

The fix makes it so the integrator work memory is allocated after
scene update which has downside of possible less efficient update
when some textures don't fit GPU memory, but has an advantage of
making proper decision and having a clear and consistent internal API.

Fixes memory part of T92014.

Differential Revision: https://developer.blender.org/D12966
2021-10-25 09:27:21 +02:00
8733d310e5 Cycles: Revert all host update specific changes
The approach didn't turn out to be that useful after all as there
are unavoidable dependencies of data from the device. For example,
to know whether object intersects volume or not it is required to
run displacement kernels.

The way of splitting host and device updates caused state where
some data is not yet available, causing confusion and leaving
code to be error-prone.
2021-10-25 09:27:21 +02:00
b714f9bf43 Fix T91931: Thumbnail Missing Region
Fixes a crash when blend thumbnails set to Camera View when there is
no camera, which resulted in use of a null region.

See D12748 for more details.

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

Reviewed by Campbell Barton
2021-10-24 22:12:20 -07:00
Andrea Beconcini
82ae7b990a Fix T90633: Frame all doesn't use meta range
This commit fixes T90633, it changes the behavior of the `Frame All`
operation when the user is tabbed into a metastrip: instead of using
the scene timeline's range, `Frame All` uses the current metastrip's
range.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12974
2021-10-25 06:47:51 +02:00
84f7bf56a8 Fix T90855: Transform effect gives inconsistent output
When using downscaled preview size with proxies, transform effect
doesn't compensate for fact, that pixels are effectively larger. There
was compensation for scene render size already.

Use same compensation method as text effect uses for font size.
2021-10-25 05:35:54 +02:00
4266538ab9 Fix T90835: Strip snaps to first and second frame
This was caused by strips with single frame input like single image
strip or color strip. their length is always 1, and so content length
was calculated to end after first frame.

There was code handling this case, but it was also checking for
`anim_endofs` and `endstill` values. Anim offset values have no effect
on these strips and still frame value was used incorrectly. So these
chacks can be removed completely.
2021-10-25 04:33:43 +02:00
28ad680ff0 Fix T90836: Strip snaps to empty space
This was caused by snap to hold offset feature, which calculates strip
content boundary, but it can be outside of strip boundary.

Clamp content start and end values so they are always inside of strip.
2021-10-25 04:24:41 +02:00
3e75f70acd Geometry Nodes: Remove repeated instance attribute names in search
This commit makes sure that each attribute name is only added once
when logging geometry values for attribute search.

The `attribute_foreach` function for a single geometry component
deduplicated names, but a much more common situation is to have
more than one component in the instances of a geometry set.

Differential Revision: https://developer.blender.org/D12959
2021-10-24 13:24:02 -05:00
6f0dd4f0f0 Fix: memory leak after type conversion in geometry nodes group
The leak happened when two things were true:
* Inside of a node group a socket is linked to a Group Input that has
  a different type.
* The corresponding input on the parent Group node is not linked.

The conversion happened correctly, but the original value wasn't
destructed.
2021-10-24 19:26:07 +02:00
665657812d Cleanup: quiet asan warning because of uninitialized variable 2021-10-24 18:20:06 +02:00
cc388651eb Fix T92327: use default value when field is passed into data socket
Previously, the computed value passed into the data socket could depend
on the actual field a bit. However, given that the link is marked as invalid
in the ui, the user should not depend on this behavior.
Using a default value is consistent with other cases when there are
invalid links.
2021-10-24 17:53:19 +02:00
6ce383a9df Cleanup: cross-reference right pointing arrow literal
This value is defined in the UI module, but happens to be used
in string_search.cc too. Note that these references need to be kept in
sync. Use escaped utf-8 sequence since the literal can be avoided.

Also replace BLI_str_utf8_as_unicode calls with constant assignments
as these values are known there is no need to decode a utf-8 sequence.
2021-10-24 22:38:25 +11:00
1411118055 Cleanup: spelling in comments 2021-10-24 21:04:04 +11:00
e288e392a8 Cleanup: line length in Python scripts 2021-10-24 21:04:04 +11:00
Erik Abrahamsson
dc2524eaae Geometry Nodes: Rename node "String Substring"
This patch renames the node "String Substring" to "Slice String"
to conform to the "verb first" naming convention.
Default length is also changed to 10 to make it easier for users
to understand what the node does.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D12931
2021-10-24 11:43:54 +02:00
8c21667f3c Cleanup: remove unused function
It doesn't have definition either.
2021-10-23 22:02:26 +02:00
a3d0b50d75 Cleanup: use underscore suffix for private data members 2021-10-23 22:02:26 +02:00
dd505a7ebb Fix T92400: Denoise node Prefilter output is always "Fast"
Caused by an accidental renaming in {rB1c42d4930a24d639b3aa561b9a8b4bbc}
2021-10-23 22:02:26 +02:00
7a0cad0989 Fix: Add missing TBB define to geometry module 2021-10-23 12:31:48 -05:00
9ad642c59a Assets/UI: Improve asset library Preferences UI
* Open File Browser when pressing "Add Asset Library". This just makes sense,
  since users have to select a directory for the asset library anyway.
* Move '+' icon back to the right side of the box. Then it is right under the
  'x' icons for each indivdual library, which seems like the more natural
  place.
* Correct tooltip for the "Add Asset Library" operator.
* Mark empty asset library name or paths field in red, to make clear that these
  need to be set.
2021-10-23 18:07:48 +02:00
50e7645211 Fix: Asset using selection in instances to points node
Caused by my own incorrect cleanup when committing the patch.
2021-10-23 00:42:07 -05:00
3bcd264141 GitHub: add PR template
Differential Revision: https://developer.blender.org/D12890
2021-10-23 10:49:51 +05:30
Jarrett Johnson
3af597d16b Geometry Nodes: Add Instances to Points Node
This node takes a geometry set with instances as input and outputs
points located on the origins of the top level of instances in the
geometry set (not nested instances). It also has position and radius
inputs to allow overriding the default, and a selection input to only
generate points for some instances.

The use case for this node is a method to use geometry proximity on
instance origins, but in a more generic way that is flexible and useful
in other situations.

Differential Revision: https://developer.blender.org/D12893
2021-10-23 00:01:59 -05:00
2a7a8a04e3 Fix: Empty geometry nodes input menu with legacy nodes enabled
Caused by a misplaced comma at the end of a line in Python.
2021-10-22 22:35:27 -05:00
231d66d8ba Fix: Support swapped inputs properly in trim curve node
Previously, when the start input was greater than the end input,
the spline was resized to a single point. That is correct, but the
single point wasn't placed properly along the spline. Now, it is
placed according to the "Start" value, as if the trim started, but
couldn't continue because the "End" value was smaller.

This behavior is handled with a separate code path to keep each
simpler and avoid special cases. Any cleanup to reduce duplication
should focus on making each code path shorter separately rather
than merging them.

Also included are some changes to `lookup_control_point_position`
to support cyclic splines, though this single-point method is still
disabled on cyclic splines for consistency.
2021-10-22 17:32:21 -05:00
Xavier Cho
62d64bec2a Docs: Fixes and improvements in API documentation
Fixes several notable mistakes and missing information
regarding the API documentation (*.rst).

This will allow API stub generators like bpystubgen or
fake-bpy-module to produce more accurate result.

Differential Revision: https://developer.blender.org/D12639
2021-10-22 18:27:16 -04:00
1d9e2dc954 Fix: Cyclic single point bezier splines have multiple evaluated points
Because `segment_is_vector` didn't handle the combined cyclic and
single control point case, it returned false, that the "segment" should
have the resolution evaluated point count. To avoid checking the size in
every call, add an assert for the size and check it elsewhere.
2021-10-22 17:13:26 -05:00
cfc64261c1 Asset Browser: Filter options for specific ID types
Adds a filter popup to the header that allows specifiying which data-block
types to show. The menu automatically reflects all supported ID types, so it
shows a checkbox for materials, worlds and actions currently by default, and
all ID types with the "Extended Asset Browser" experimental feature enabled.
2021-10-22 23:56:05 +02:00
c51eac24fe UI: Correct icons of File Browser Link/Append ID filter settings
Wasn't using the same icons as usually used for these IDs, which can be
confusing. Corrected them to be consistent with other usages of these IDs.
2021-10-22 23:54:03 +02:00
ca5d84b31d UI: Show ID filter settings in Link/Append File Browser as icon & checkbox
The checkboxes integrate better with the surrounding layout and are not that
attention grabbing. To my knowledge the only reason not to use checkboxes was
so the icons could be displayed. But this does it just like the Outliner filter
settings: Show the icon before the checkbox.

Also widen the popover a bit to fit longer labels (didn't fit before this patch
even).
2021-10-22 23:53:11 +02:00
3e1fd26828 Fix: Assert for unused field evaluator in resample curve node
Declare it at a lower scope so it doesn't go unused in evaluated mode.
2021-10-22 16:39:39 -05:00
8cd4cee0d5 Fix: Double calculation of UVs in cone primitive 2021-10-22 16:21:37 -05:00
cf72b10075 UI: Turn on overlays by default in new node editors
This was missed in the initial commit adding the node editor overlays.
2021-10-22 16:21:16 -05:00
742b7adbad Cleanup: Remove unused function 2021-10-22 16:01:48 -05:00
7ac4e874db Fix panel pinning showing for instanced panels (e.g. FCurve modifiers)
This was reported for FCurve modifiers, but was also true (in theory) for
other instanced panels (regular modifiers, spreadsheet filters, ...),
these would not show pinning for other reasons (no caterories).

So in the case of the Graph Editor the follwing happens:

`graph_buttons_register` only registers `GRAPH_PT_modifiers`, the panel
itself has no header (PANEL_TYPE_NO_HEADER), further panels for
individual modifiers are added dynamically in `graph_panel_modifiers`.
So when pinning a particular modifier, we would pin e.g. `GRAPH_PT_noise`
(not `GRAPH_PT_modifiers`).
ED_region_panels_layout_ex would only collect panels known to
`graph_buttons_register` (so is not aware of the specific panels of
modifiers). So while I think it should be possible to pin
`GRAPH_PT_modifiers` on top of an individual modifier's panel this would
result in all modifiers being shown in other categories [which would also
be weird]. Panel header layout was also not correct (drawing the pin
icon over the modifier delete icon).

So to resolve this, just dont use pinning for these type of panels.

part of T92293.

Maniphest Tasks: T92293

Differential Revision: https://developer.blender.org/D12965
2021-10-22 19:23:18 +02:00
cca811de98 Fix test print wording that confuses build bot highlighting. 2021-10-22 18:26:12 +03:00
7ef3fe492e Asset Browser: fix issue rebuilding the visible asset filter 2021-10-22 16:40:24 +02:00
cd6fc651ce Asset Browser: add notifiers on catalog edits
Send out notifications on catalog edits. This way all asset browsers will
refresh when catalogs are edited.
2021-10-22 16:35:18 +02:00
85312f2236 Asset Browser: Show "orphaned" assets in "Unassigned" catalog
Show assets that have an unknown catalog ID assigned in the "Unassigned"
catalog.

Another catalog named "Orphans" was considered as well, but that would
clash with the usual handling of Blender (discarding orphan data on
save) and thus that idea was discarded.

Manifest Task: T91949
2021-10-22 16:32:05 +02:00
70aad5f498 Asset Catalogs: support reloading without losing local changes
Keep track of unsaved asset catalog changes, in a more granular way than
just one boolean per asset library. Individual catalogs can now be
marked with a flag `has_unsaved_changes`. This is taken into account
when reloading data from the catalog definition file (CDF):

- New catalog in CDF: gets loaded
- Already-known catalog in CDF:
    - local unsaved changes: on-disk catalog is ignored
    - otherwise: on-disk catalog replaces in-memory one
- Already-known catalog that does not exist in CDF:
    - local unsaved changes: catalog is kept around
    - otherwise: catalog is deleted.

Because this saving-is-also-loading behaviour, the "has unsaved changes"
flags are all stored in the undo buffer; undoing after saving will not
change the CDF, but at least it'll undo the loading from disk, and it'll
re-mark any changes as "not saved".

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12967
2021-10-22 16:31:32 +02:00
16ffa7bb6e Asset Catalogs: push undo step before saving to disk
Since writing asset catalogs to disk also means loading any on-disk
changes, it's a good idea to store an undo step.
2021-10-22 16:31:32 +02:00
76ebc10794 Increase assert epsilon in versioning for D9551.
The epsilon was too optimistic. Snapping to hard-coded (0,-1,0) at
singularity should produce max delta 0.0005, but double it to be safe.
This only affects debug builds obviously.
2021-10-22 17:17:21 +03:00
39f88480bb Cleanup: improve consistency between function node implementations 2021-10-22 15:34:53 +02:00
0c16ac9ddf Cleanup: restore alphabetic ordering 2021-10-22 15:27:10 +02:00
Dorian
781289e31f Geometry Nodes: add Boolean and Integer Input nodes
These nodes just output a single value of their respective types,
making it possible to control multiple inputs with the same value.

Differential Revision: https://developer.blender.org/D12932
2021-10-22 15:01:28 +02:00
01e2a532f5 Fix T92290: Linked Color Palette datablocks can not be used.
* Forbid editing linked palettes.
* Make `color` RNA property of ColorPalette '`LIB_EXCEPTION`', so that
  the color buttons in the palette template remain active on linked data.

NOTE: This incidently makes linked palettes' colors editable from RNA,
not from UI though, so think this is OK for now.
2021-10-22 14:59:40 +02:00
Gilberto Rodrigues
029cf23d71 UI: Fix misaligned icons
This patch corrects the misalignment of some icons.
Some of them can't be centered because they would look blurry, but look better if shifted to the right instead of shifted to the left.

{F10864196 size=full} {F10864202 size=full}

{F10864216} {F10864228}

{F10864231 size=full} {F10864234 size=full}

{F10867008 size=full} {F10867015 size=full}

Reviewed By: #user_interface, pablovazquez

Differential Revision: https://developer.blender.org/D12789
2021-10-22 14:34:22 +02:00
c4b02bb6bc Fix Cycles HIP binaries always recompiling 2021-10-22 14:32:24 +02:00
269f4a3024 Fix VSE left crop not working
Caused by using 3D math on 2D vectors, violating memory boundaries.

Use temporary float[3] variable.
2021-10-22 14:31:04 +02:00
ab1909fe06 Deps: Python, install Cython package
Cython was already bundled with Blender's libraries in SVN (as dependency
of Numpy, see rB5bddfde217b1), but was never actually installed in the
CMake install step. As a result, `import cython` would fail. This is
now fixed.
2021-10-22 14:01:47 +02:00
282516e53e Cleanup: refactor float/half conversions for clarity 2021-10-22 13:03:03 +02:00
65dbeb1d81 Fix T90638: Inconsistent object data behavior when link-duplicating collections.
Camera, lattice and speaker object types were missing there own proper
`USER_DUP_` flags, leading to not properly handling duplication of their
object data.

NOTE: We could probably simply opions here, by using categories (like
'GEOMETRY', 'SHADING', etc.) instead of exact object types. But this is
beyond bugfix scope.
2021-10-22 12:35:40 +02:00
Sayak Biswas
d092933abb Cycles: various fixes for HIP and compilation of HIP binaries
* Additional structs added to the hipew loader for device props
* Adds hipRTC functions to the loader for future usage
* Enables CPU+GPU usage for HIP
* Cleanup to the adaptive kernel compilation process
* Fix for kernel compilation failures with HIP with latest master

Ref T92393, D12958
2021-10-22 12:15:29 +02:00
d1fcf93f03 Geometry Nodes: disable attribute search for non-attribute string sockets
This is a simplified version of D12730 by @erik85.

I added attribute search only to one legacy node for testing purposes.
2021-10-22 11:56:19 +02:00
675a22b341 Nodes: fix link drawing for some socket types
The type of sockets is `-1` in some cases, resulting in a crash
when accessing the `std_node_socket_colors` array.
2021-10-22 11:56:19 +02:00
1133b1478e Cleanup/Fix (unreported) 'make single user' handling of actions.
Actions of duplicated objects would not be properly made single user,
unlike obdata and materials.

Further more, there is no reason to manually handle such animdata
copying here, `BKE_id_copy_ex` can do that for us with the proper flags.
2021-10-22 10:19:15 +02:00
c37121f16c Fix T91410: Make Single User operation ignores linked data-blocks.
Now 'Make Single User' will also create local copy of linked data as
needed.

IMPORTANT: Unlike with local data, this always happen, even if linked
data has only one user. This avoids e.g. cases like two local objects
sharing a same linked mesh, then when calling 'Make Single User ->
Object and ObData' on both objects, yu expect both of your objects to
get localized meshes, not one of them keeping its linked, un-editable
mesh.
2021-10-22 09:59:36 +02:00
622d8b77a6 Cycles: improve communication of supported GPUs in preferences
Mention required CUDA and OptiX compute capability and minimum driver
version. For HIP there is a placeholder until we know the supported
architectures.
2021-10-22 08:56:13 +02:00
fa688fbf06 Build: improve descriptions and organization of Cycles build options 2021-10-22 08:34:31 +02:00
b0d64841d2 Cycles: keep HIP device disabled until we have binaries
And clear communication about supported hardware.

Ref T92397
2021-10-22 08:18:53 +02:00
05ab3356a7 Cleanup: spelling in comments, use C style comments 2021-10-22 10:28:56 +11:00
3e1baa7d53 Fix T92357: assert changing scenes while in edit mode
ScrArea.runtime.tool needs to be updated after switching scenes.
2021-10-22 10:18:59 +11:00
bdbaf0301d Fix crash when creating a new window fails
Also add operator error report.
2021-10-22 10:18:59 +11:00
d9ebe25a0c Fix errors in be171b295f
´´´
error C4133: 'function': incompatible types - from 'float [2]' to 'int *'
error C4133: 'function': incompatible types - from 'const int [2]' to 'const float *'
´´´
2021-10-21 18:23:46 -03:00
f45470472f Cleanup: Compile warnings 2021-10-21 17:00:38 -04:00
94fb47e572 Assets: Enable material and world assets by default
Both material and world assets should be ready to use as non-experimental
feature. They were not enabled by default yet because the work from the
previous commit was needed first.
Objects should follow soon.

Maniphest Task: https://developer.blender.org/T91752
2021-10-21 22:18:59 +02:00
a286148799 Assets: Allow specific data-block types to be enabled by default
Updates UI code so that we can enable the asset UI for specific data-block
types by default, i.e. irrespective of the "Extended Asset Browser"
experimental feature.
"Mark as Asset" and "Clear Asset" are always visible in the Outliner context
menu now, but are grayed out if not applicable and show a disabled hint in the
tooltip.

A known side-effect of this: The "Mark as Asset" and "Clear Asset" operators
are enabled for action data-blocks now, even though only pose actions created
through the Pose Libraries add-on are supported. If this is something worth
addressing is being discussed still.

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

Reviewed by: Sybren Stüvel
2021-10-21 22:18:59 +02:00
9aab1a4626 Cleanup: unused code
Also fixes incompatible types.
2021-10-21 22:02:45 +02:00
0c66885276 View3D Snap Cursor: Fix drawing state incorrectly reset
The viewport was being changed, so it needs to be reset.
2021-10-21 16:37:41 -03:00
be171b295f Cleanup: Use array utility for cursor events 2021-10-21 15:30:17 -04:00
be558d2d97 Fix T92363: OptiX fails with ambient occlusion node, after recent changes
This triggered a compiler bug where it does not handle the sub.s16 PTX
instruction. Instead refactor the code so we don't need to do uint16_t
subtraction at all.

Also update OptiX device to remove the AO pass direct callable.

Thanks Patrick Mours for figuring this out.
2021-10-21 21:25:34 +02:00
aea2287af3 Tests: updated Python bundled modules test
Add the new zstandard module, as well as previously missing ones.

Ref D12777, T88438
2021-10-21 21:25:34 +02:00
0a63297a88 Nodes: Fix missing variable 2021-10-21 21:22:43 +02:00
Pablo Vazquez
9b1b4b9e32 Node Editor: Introduce color overlay and dashed wires theme setting
This patch includes code from D9891 and D12754, so credit goes to Juanfran and Dalai.
I updated the patches to work with `master` and with the new overlay toggle.

The reason to include both changes as part of one patch is that the dimmed dashed lines work much better together with colored wires.

Theme setting for dash opacity:
{F11370574, size=full}

{F11286177, size=full, autoplay, loop}

{F11149912, size=full}

For adding the overlay I used `SpaceImageOverlay` as reference, although I'm not familiar with this code so there might be mistakes.

Reviewed By: #user_interface, HooglyBoogly

Differential Revision: https://developer.blender.org/D12886
2021-10-21 21:00:38 +02:00
1d96a48267 Geometry Nodes: Attribute search in the modifier
This adds attribute search to the geometry nodes modifier
for the input and output attributes. The "New" search item
is only shown for the output attributes.

Some of the attribute search code is extracted to a new file
in the interface code, to avoid some code duplication.

The UI code required two fixes so that the search would work
for dynamic length strings (IDProperties do not have a fixed size).

Since this does changes to the UI layout of the modifier, I also
addressed T91485 here.

Differential Revisiion: https://developer.blender.org/D12788
2021-10-21 13:54:48 -05:00
65490e6270 Fix T92371: Move AZONE_REGION When Overlapped
Overlapped regions have transparent backgrounds, so when placing
AZONE_REGION we need to move them in to the content edge.

See D12956 for details and examples.

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

Reviewed by Hans Goudey
2021-10-21 11:17:38 -07:00
3858bf5c6f Cleanup: Use common define for menu separator arrow 2021-10-21 12:52:08 -05:00
7b9319adf9 Geometry Nodes: Update bounding box to work on individual instances
This commit makes the bounding box node work on each unique geometry
(including instances) individually instead of making one large bounding
box for everything. This makes the node much faster, and is often the
desired result anyway. For the old behavior, a realize instances node
can be used in front of this node (versioning adds it automatically).

The min and max outputs now only output the values from the realized
geometry.

Differential Revision: https://developer.blender.org/D12951
2021-10-21 11:51:56 -05:00
deb7ec312a Suppress the unused parameter warning from D9551.
The parameter is only used in an assert.
2021-10-21 19:27:30 +03:00
594c857f65 Fix tooltip disabled hint not using correct context from the button
To display the "disabled hint" (text explaining why a button is disabled) in a
tooltip, it would run the operator poll callback, which could then set a poll
message. But the context for the poll check wasn't the one from the button, so
the poll may give a different result (and disabled hint) than the check of the
button itself did.
Make sure it uses the exact context from the button.
2021-10-21 16:36:35 +02:00
16c79d3b82 Asset Catalogs: add test for backslashed catalog paths
No functional changes necessary, test already succeeds.
2021-10-21 16:23:56 +02:00
ff46afb4dd Fix: Curve trim crash on splines with no edges 2021-10-21 09:16:58 -05:00
4b48b1079d Asset Catalogs: refresh simple name when renaming catalog
When renaming an asset catalog, also update its simple name.

Catalogs will most likely be created from within Blender, so via the
catalog tree in the asset browser. Here catalogs are always named
"Catalog" until the user renames them, which was reflected in all simple
names being "Catalog".
2021-10-21 16:06:14 +02:00
5ccec8ec6b Asset Catalogs: treat first-loaded catalog as main catalog
When there are multiple catalogs with the same path (so different UUIDs
all mapped to the same catalog path), treat the first-loaded one as the
main catalog for that path, and the rest as aliases.

This ensures that the UUID of a catalog (as chosen in the tree UI and thus
interacted with by users) is stable, regardless of whether by some coincidence
later another catalog with the same UUID is created.
2021-10-21 15:53:16 +02:00
9a1fce698b Cleanup: rename & restructure AssetCatalogPathCmp
Rename `AssetCatalogPathCmp` to `AssetCatalogLessThan`:
- it compares more than paths (so no more `Path` in the name), and
- performs a less-than operation (so no more `Cmp` in the name).

Also restructure its code to make an extra upcoming comparison easier to
add.

No functional changes.
2021-10-21 15:53:16 +02:00
090be2775e Geometry Nodes: fix force-computing multiple non-output sockets
There were some issues when multiple inputs of the same node
were forced to be computed (e.g. for the spreadsheet), but none
of the node outputs (if existant) were used. Essentially the node
was marked as "finished" too early in this case.

This fix is necessary for the improved viewer node (T92167).
2021-10-21 15:50:04 +02:00
6600ae3aa7 Nodes: add utility to find NodeRef for node
In the future `NodeTreeRef` could have a lazy initialized map,
but for now this is good enough.
2021-10-21 15:50:04 +02:00
Brecht Van Lommel
df00463764 Cycles: add shadow path compaction for GPU rendering
Similar to main path compaction that happens before adding work tiles, this
compacts shadow paths before launching kernels that may add shadow paths.

Only do it when more than 50% of space is wasted.

It's not a clear win in all scenes, some are up to 1.5% slower. Likely caused
by different order of scheduling kernels having an unpredictable performance
impact. Still feels like compaction is just the right thing to avoid cases
where a few shadow paths can hold up a lot of main paths.

Differential Revision: https://developer.blender.org/D12944
2021-10-21 15:38:03 +02:00
fd560ef2af Windows: Fix finding python for build helpers
It was still looking for the 3.7 folder
rather than 3.9
2021-10-21 07:36:21 -06:00
7681326acd IDManagement: Assign current Main's lib to newly created IDs.
This is mainly for doversion code, when it needs to create new IDs those
should be considered as part of the same library as the current Main's
one.

No practical changes are expected here, this is more of a general
consistency fix, and a pre-requisite for {T92333}.
2021-10-21 15:22:35 +02:00
10fb5cc58d Fix T92355: Quadriflow crashes with zero length edges
Add a check for zero length edges to the manifold check as quadriflow
doesn't handle meshes with these.
2021-10-21 15:15:29 +02:00
91b4c1841a Fix T92272: Rigid Body Copy to Selected "Margin" crash
Caused by {rB43167a2c251b}

Code from above commit called RNA updates with a NULL scene.
This was already commented (and mostly handled) in rB5949d598bc33, but
the reported case was missing in that commit.

This fixes the crash in a similar manner as rB5949d598bc33.

Maniphest Tasks: T92272

Differential Revision: https://developer.blender.org/D12953
2021-10-21 14:40:04 +02:00
ab0195c78f Fix T92169: "View Selected" on Custom Boneshape with transform wrong
Since the introduction in rBfc5bf09fd88c, `BKE_pose_minmax` was not
taking these custom transforms into account (making "View Selected"
ignoring these as well and focusing on the bone instead).

Now consider these transforms in `BKE_pose_minmax`.

Maniphest Tasks: T92169

Differential Revision: https://developer.blender.org/D12942
2021-10-21 14:39:42 +02:00
a5917175d8 Deps: Python, bundle zstandard package
This package allows Python scripts to handle compressed blend files (see
rB2ea66af742bc). This is for example needed by Blender Asset Tracer to
send files to a Flamenco render farm.

This change includes a new `WITH_PYTHON_INSTALL_ZSTANDARD` build-time
option, to control whether to actually install the package. For this the
already-existing approach for Requests was copied.

Reviewed By: LazyDodo, mont29, brecht

Differential Revision: https://developer.blender.org/D12777
2021-10-21 13:46:33 +02:00
417ce7ffc1 Deps: Python, bump bundled packages to their latest versions
certifi : 2020.12.5 → 2021.10.8
chardet : 4.0.0     → charset-normalizer 2.0.6
cython  : 0.29.21   → 0.29.24
idna    : 2.10      → 3.2
numpy   : 1.19.5    → 1.21.2 (which makes it possible to remove our patch)
requests: 2.25.1    → 2.26.0
urllib3 : 1.26.3    → 1.26.7

Nowadays `requests` no longer depends on `chardet` but on
`charset-normalizer`. That project describes itself as:

> A library that helps you read text from an unknown charset encoding.
> Motivated by chardet, I'm trying to resolve the issue by taking a new
> approach. All IANA character set names for which the Python core library
> provides codecs are supported.

Reviewed By: LazyDodo, mont29, brecht

Differential Revision: https://developer.blender.org/D12777
2021-10-21 13:46:28 +02:00
f81f56751a Deps: Bump Python 3.9.2 → 3.9.7
Bump Python from 3.9.2 to 3.9.7, which is the latest 3.9 release at this
moment.

Updates to bundled Python packages will follow in a separate commit.

Reviewed By: LazyDodo, mont29, brecht

Differential Revision: https://developer.blender.org/D12777
2021-10-21 13:46:16 +02:00
39810b3f51 Cleanup: make HIP and CUDA code more consistent
Ref D12834
2021-10-21 13:08:10 +02:00
Yevgeny Makarov
6ef8c9e646 Fix T65532: can't assign a key on Italian apple keyboards.
Apple's international keyboards have an additional `kVK_ISO_Section`
key. With some (Italian, Spanish) keyboard layouts, this is `\`, `[` keys
which Blender keymap can use.

Right now this key is explicitly set as `Unknown`.

Note that `kVK_ANSI_Grave` is located in a different location.

Differential Revision: https://developer.blender.org/D12905
2021-10-21 13:07:05 +02:00
f6af3d9197 Build: remove cmake messages about disabled tests when feature is disabled
No need to report this, it just adds noise to the cmake config. The messages
that we need to keep are the ones about disabling tests when the test file or
idiff are missing.
2021-10-21 13:06:57 +02:00
641a5be50e IDManagement: Add option to clear asset data when making ID local.
When appending an asset from the asset browser, its asset data needs to
be cleared.

However, linking an asset (or regular append from the file browser)
should not clear such data. In linking case, it would be there again
after a blend file reload anyway.

So this commit introduces a new `BLO_LIBLINK_APPEND_ASSET_DATA_CLEAR`
option.

NOTE: in case the appended ID needs to be copied from its linked data
(instead of making the later directly local), asset data is lost anyway
since it is never copied with the ID currently.

Ref. {T91749} and D11768.
2021-10-21 12:55:15 +02:00
17a96051cf Re-bundle Libmv to ensure it is in sync with the repo 2021-10-21 12:39:28 +02:00
84bb6d7c02 UI: Header / Tool Settings: Show tool icon when tools are collapsed
Show the scaled down tool icon when the tool region is collapsed. Show a
blank space when the tool region is visible.

* Minimize the UI flickering when changing the active tool.
* Show the active tool when the tool region is collapsed.
* Smaler header footprint (the tool name is not visible).

This is a follow up for T91536.

Differential Revision: https://developer.blender.org/D12939
2021-10-21 12:12:05 +02:00
e79e86018e Fix T92387: crash in legacy point distribute node
This was caused by rB40c3b8836b7a36303ea9c78b0932758cbf277f93.
The same fix exists in the Distribute Points on Faces node.
2021-10-21 12:07:03 +02:00
2eb2e861a3 Install_deps: Rename _VERSION_MAX to _VERSION_MEX variables.
We define the minimum exclusive number for our supported dependencies
versions, and not the maximum inclusive number.

Thanks to @sybren for raising this point and finding the 'mex' math
term.
2021-10-21 11:58:06 +02:00
8d2cabcb97 Cleanup: VSE code docstring 2021-10-21 11:28:12 +02:00
98e1c6e935 Cleanup: clang-format 2021-10-21 18:27:46 +11:00
f0f1198867 Cleanup: unused functuion warnings 2021-10-21 17:14:33 +11:00
cfbac9032b Docs: note why BLI_string_join_arrayN needs to nil terminate 2021-10-21 17:10:19 +11:00
5faa333e78 Cleanup: match cursor hide option with naming for the 3D viewport 2021-10-21 17:01:15 +11:00
d71c423c28 Cleanup: Use array as a parameter for event x/y functions
This change simplifies the parameter list for these functions
and reduces the chance of typos mixing up array indices.

Missed in rB69102786047dccdcbaee0df6307a8c3364d28fe0.
2021-10-21 16:57:53 +11:00
3a2b7f35f4 LibLink: ensure objects are selectable when "Select" is enabled
Appended objects could be hidden, making any further operations
potentially skip the newly added objects.

Now FILE_AUTOSELECT asserts when newly added options aren't selectable.
2021-10-21 16:57:53 +11:00
063c4e467d Cleanup: de-duplicate function to instantiate objects
De-duplicates wm_append_loose_data_instantiate_object_base_instance_init
and object_base_instance_init.

Add BLO_object_instantiate_object_base_instance_init which also adds to
a collection since all callers did this.
2021-10-21 16:57:53 +11:00
2a047fadc0 Fix type error in 5297bf318e 2021-10-21 16:57:53 +11:00
33d6d7c6e3 VSE: Add 2D cursor overlay option
Since 2D cursor will be used rarely in VSE and it is adding visual
noise, it will be hidden by default.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12933
2021-10-21 07:49:12 +02:00
ec31f31749 Cleanup: Remove dead code 2021-10-21 01:01:31 -04:00
5297bf318e Cleanup: Use array as a parameter for event x/y functions
This change simplifies the parameter list for these functions
and reduces the chance of typos mixing up array indices.

Missed in rB69102786047dccdcbaee0df6307a8c3364d28fe0
2021-10-21 00:56:31 -04:00
035dcdad90 Cleanup: use underscore separators for event struct members
Improve readability using underscores for separators, e.g.
prev_click_time instead of prevclicktime.
2021-10-21 13:24:17 +11:00
6910278604 Cleanup: Use array as a parameter for event x/y functions
This change simplifies the parameter list for these functions
and reduces the chance of typos mixing up array indices.

Reviewed By: campbellbarton

Ref D12950
2021-10-21 13:15:41 +11:00
2905b493fe Fix failing 'script_validate_keymap' after recent changes
Properties with `_funcs_runtime` are always saved when exporting keymaps.

This is an error since changing one changes all others.

For now, work around the problem by setting the `PROP_IDPROPERTY` flag.
2021-10-20 20:49:59 -03:00
15e71f3d97 Cleanup: Set default snap cursor values during build time 2021-10-20 20:49:59 -03:00
6b761c59d2 Fix: Empty id attribute on curve control points
No virtual array should be returned instead of returning an empty span.
2021-10-20 17:45:14 -05:00
3f8b45d8d1 Fix: Builtin curve attributes unavailable
After the addition of the `id` attribute in rB40c3b8836b7a, the `exists`
function assumed that all attributes were stored in the custom data.
2021-10-20 16:54:04 -05:00
98c53f660a Fix T92369: Raycast node crash with no target attribute
The corrected hit mask should only be generated when there is
data to transfer. Also correct two of the warning messages.
2021-10-20 14:22:25 -05:00
William Leeson
f0df0e9e07 Fix: Add cast to atof for CYCLES_CONCURRENT_STATES_FACTOR env variable parsing.
The conversion from double to float was causing a build failure.

Differential Revision: https://developer.blender.org/D12946
2021-10-20 21:01:39 +02:00
704d077d8f Fix: Crash when retrieving output "id" attribute
The attribute provider needs to handle the case where the data is stored
with just a data type, and the case where it is stored with a name.
2021-10-20 13:15:37 -05:00
010e675b1b Fix missing null-terminator in BLI_string_join_arrayN
Although the documentation says so, the null-terminator was missing.
This could cause crashes when logging shader linking errors as shader
sources are empty in this case.
2021-10-20 20:03:17 +02:00
1de8374374 UI: Remove extra padding on Annotate tool settings
For some reason the Annotate tool has an extra padding when compared to
other tools. This makes the UI to flicker a bit (specially with D12939
applied).

Differential Revision: https://developer.blender.org/D12943
2021-10-20 19:01:53 +02:00
Peter Sergay
9959c5315f Geometry Nodes: Add warnings for instances input in two nodes
Certain geometry nodes don't work properly on inputs that contain
instances, but don't display any warning that they aren't working.

The nodes now will display a warning that explains the situtation
iff the input contains any instances.

Differential Revision: https://developer.blender.org/D12858
2021-10-20 11:48:53 -05:00
7d111f4ac2 Cleanup: remove unused code 2021-10-20 18:15:21 +02:00
0baa876b83 New test for USD import.
Added a basic test for importing a primitive hierarchy from a USDA
file into Blender.  This was reviewed by Sybren in patch D12479.
2021-10-20 12:07:28 -04:00
40c3b8836b Geometry Nodes: Make Random ID a builtin attribute, remove sockets
In order to address feedback that the "Stable ID" was not easy enough
to use, remove the "Stable ID" output from the distribution node and
the input from the instance on points node. Instead, the nodes write
or read a builtin named attribute called `id`. In the future we may
add more attributes like `edge_id` and `face_id`.

The downside is that more behavior is invisible, which is les
expected now that most attributes are passed around with node links.
This behavior will have to be explained in the manual.

The random value node's "ID" input that had an implicit index input
is converted to a special implicit input that uses the `id` attribute
if possible, but otherwise defaults to the index. There is no way to
tell in the UI which it uses, except by knowing that rule and checking
in the spreadsheet for the id attribute.

Because it isn't always possible to create stable randomness, this
attribute does not always exist, and it will be possible to remove it
when we have the attribute remove node back, to improve performance.

Differential Revision: https://developer.blender.org/D12903
2021-10-20 10:54:54 -05:00
1a96045eec Fix T92367: missing Subsurface Anisotropy and IOR sockets with factory startup 2021-10-20 17:50:31 +02:00
0c52eed863 Cycles: more accurately count main paths for adding work tiles
Easy now thanks to the main and shadow path decoupling. Doesn't help
in an benchmark scene except Spring, where it reduces render time by
maybe 2-3%.

Ref T87836
2021-10-20 17:50:31 +02:00
52c5300214 Cleanup: some renaming to better distinguish main and shadow paths 2021-10-20 17:50:31 +02:00
cccfa597ba Cycles: make ambient occlusion pass take into account transparency again
Taking advantage of the new decoupled main and shadow paths. For CPU we
just store two nested structs in the integrator state, one for direct light
shadows and one for AO. For the GPU we restrict the number of shade surface
states to be executed based on available space in the shadow paths queue.

This also helps improve performance in benchmark scenes with an AO pass,
since it is no longer needed to use the shader raytracing kernel there,
which has worse performance.

Differential Revision: https://developer.blender.org/D12900
2021-10-20 17:50:31 +02:00
001f548227 Cycles: reduce kernel reserved local memory when not using shader raytracing
Ref T87836
2021-10-20 17:50:31 +02:00
Charlie Jolly
2537b32392 Geometry Nodes: Add Checker Texture
Port checker shader to GN

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12762
2021-10-20 16:45:35 +01:00
334a8d9b3e Geometry Nodes: Fields version of Curve to Points node
This commit adds an updated version of the curve to points that
supports fields. Only the position and radius are transferred
by default now, which should improve performance. The other outputs
like tangent and rotation are outputted with anonymous attributes.

I took the opportunity to change a few other small things:

 - Name geometry sockets "Curve" and "Points" like other nodes.
 - Remove the radius multiple of 0.1, which was confusing.

Thanks to @Johnny Matthews (guitargeek) for an initial patch.

Differential Revision: https://developer.blender.org/D12887
2021-10-20 10:25:49 -05:00
e00bf04c0f Fix T89771: Cloth disk cache is not read on library overrides when original linked data is already set to use 'Disk Cache'
Yet another try at that hairy issue... See comment in commit for
details, essentially this extend the workaround introduced in Objects'
`lib_override_apply_post` callback to try to also properly 're-use'
`OUTDATED` and `BAKED` flags from old source liboverride into new
destination one.
2021-10-20 17:21:30 +02:00
990b912fd7 Cleanup: Add check whether to remove an anonymous atttribute
Add a higher level check that can be used instead of checking whether
the attribute ID is anonymous and checking whether it has any strong
references.
2021-10-20 09:57:54 -05:00
494c3fb1bd Fix T92368: LMB mouse events (Selecting, doubleclicks etc) are broken 2021-10-20 16:33:20 +02:00
2d46cef2e8 Fix T92347: Append function excludes Collections that do not contain Objects directly.
Collections directly selected by the user should always be
instantiated.

Regression from recent append code refactor.
2021-10-20 15:22:26 +02:00
4539c7cc57 Cleanup: silence Warnings
Warning	C4100 unreferenced formal parameter
Warning	C4242 conversion from 'int' to 'short', possible loss of data
2021-10-20 10:04:03 -03:00
2743d746ea Cleanup: use an array for wmEvent cursor position variables
Use arrays for wmEvent coordinates, this quiets warnings with GCC11.

- `x, y` -> `xy`.
- `prevx, prevy` -> `prev_xy`.
- `prevclickx, prevclicky` -> `prev_click_xy`.

There is still some cleanup such as using `copy_v2_v2_int()`,
this can be done separately.

Reviewed By: campbellbarton, Severin

Ref D12901
2021-10-21 00:00:01 +11:00
3435ea014d Cleanup: unused parameters, nullptr instead of NULL in cpp code... 2021-10-20 14:56:18 +02:00
dfb193f634 Fix T91243: Object modes are not loaded correctly in inactive scenes.
Do not try to preserve edit modes of objects in non-active scenes (at
least for now), except for Pose mode.

Code was also slitghly refactored (reducing indent levels), and
comments about expected behaviors and known limitations were added.
2021-10-20 14:50:41 +02:00
f855e2e06e Cleanup: unused function 2021-10-20 09:19:05 -03:00
40180c3500 Fix crash when reloading with placement tool enabled
Paint Cursors are already released at this stage.
2021-10-20 09:07:41 -03:00
Sayak Biswas
ba4e227def HIP device code cleanup and fix for high VRAM usage
This patch cleans up code for HIP device and makes it more consistent with the CUDA code.
It also fixes the issue with high VRAM usage on AMD cards using HIP allowing better performance and usage on cards like 6600XT.
Added a check in intern/cycles/kernel/bvh/bvh_util.h to prevent compiler error with hipcc

Reviewed By: brecht, leesonw

Maniphest Tasks: T92124

Differential Revision: https://developer.blender.org/D12834
2021-10-20 14:04:28 +02:00
d28aaf6139 Asset Browser: Show current file assets in other asset libraries if contained
If the current file is saved within an asset library, showing that asset
library in the Asset Browser will also display the assets from this current
file now. In fact, it's the latest state of the open file, including all
unsaved modifications.
These assets will show a little Blender icon in the preview image, which is our
usual icon for current file data.

Note that this means an important design change: The "Current File" asset
library isn't the only place to edit assets from anymore. From now on assets
from the current file can also be edited in the context of the full asset
library. See T90193 for more info.

Technical info:
Besides just including the assets from the current `Main`, this requires
partial clearing and reading of file-lists, so that asset operations (e.g.
removing an asset data-block) doesn't require a full reload of the asset
library.

Maniphest Task: https://developer.blender.org/T90193
2021-10-20 13:38:51 +02:00
4f15c24705 Fix T62325, T91990: changing Cycles presets does not update the Blender UI 2021-10-20 13:34:17 +02:00
9001dd7f29 View3D: Cursor Snap Refactor
Make the snap system consistent with the placement tool and leak-safe.

**Changes:**
- Store `SnapCursorDataIntern` in a `static` variable;
- Initialize (lazily) `SnapCursorDataIntern` only once (for the keymap).
- Move setup members of `V3DSnapCursorData` to a new struct `V3DSnapCursorState`
- Merge `ED_view3d_cursor_snap_activate_point` and `ED_view3d_cursor_snap_activate_plane` into `state = ED_view3d_cursor_snap_active()`
- Merge `ED_view3d_cursor_snap_deactivate_point` and `ED_view3d_cursor_snap_deactivate_plane` into `ED_view3d_cursor_snap_deactive(state)`
- Be sure to free the snap context when closing via `ED_view3d_cursor_snap_exit`
- Use RNA properties callbacks to update the properties of the `"Add Primitive Object"` operator
2021-10-20 08:28:58 -03:00
690e1baf72 Fix T91808: Batch Generate Previews fails
Caused by the Cycles-X merge.

The old style of tile rendering was removed, leaving the script to error
out trying to set the tile size.

Tile rendering came back in a new form (but only really relevant for
large resolution rendering), so now leave setting auto_tile & tile_size
alone (since previews are rendered at PREVIEW_RENDER_DEFAULT_HEIGHT 128
-- which should never make a difference here).

Maniphest Tasks: T91808

Differential Revision: https://developer.blender.org/D12937
2021-10-20 12:38:33 +02:00
f605ce7e9a Cleanup: Remove unused file-list array info members 2021-10-20 12:31:55 +02:00
dd728e1539 Asset Browser: UI polish for the asset metadata sidebar
* Show asset path in a (read only) text button. Makes it possible to see the
  full path in the tooltip, brings support for copying the path and integrates
  better with the sourrounding layout. Previous label needed lots of space to
  show the full path without clipping.
* Remove "Details" panel, it only contained one item (description). That is
  moved next to the name and asset path button.
* Use property split layout for name source and description buttons. Now that
  there are multiple buttons, it's better to have a label for them.
* Always show operators for asset previews, just gray them out if not
  applicable instead of hiding. Keeps the layout consistent and graying out is
  less confusing than hiding UI elements.
2021-10-20 12:31:54 +02:00
381965eb56 UI: Activate parent when active child is collapsed
Previously, when an item was active and its parent (or grand parent, etc.) was
collapsed, the active item would simply not be visible anymore. It seemed like
there was no active item. So instead, change the just collapsed parent to be
the active item then, so the active item stays visible.
2021-10-20 12:31:54 +02:00
16eafdadf6 Fix precision issues and a bug in vec_roll_to_mat3_normalized.
When the input vector gets close to -Y, y and theta becomes totally
unreliable. It is thus necessary to compute the result in a different
way based on x and z. The code already had a special case, but:

- The threshold for using the special case was way too low.
- The special case was not precise enough to extend the threshold.
- The special case math had a sign error, resulting in a jump.

This adds tests for the computation precision and fixes the issues
by adjusting the threshold, and replacing the special case with one
based on a quadratic Taylor expansion of sqrt instead of linear.

Replacing the special case fixes the bug and results in a compatibility
break, requiring versioning for the roll of affected bones.

Differential Revision: https://developer.blender.org/D9551
2021-10-20 12:58:19 +03:00
Gaia Clary
df445cc571 Fix T82455: vec_roll_to_mat3_normalized returns NaN when nor close to -Y.
In this case theta is completely unsafe to use, so a different
threshold based on x and z has to be used to avoid division by zero.

Ref D9551
2021-10-20 12:58:19 +03:00
dfa1c7e554 Split and extend unit tests for vec_roll_to_mat3_normalized.
Separate the huge test into huge logical parts and add more cases
to check. Also add a utility to check that the matrix is orthogonal,
with arbitrary epsilon values and calculations in double.

A couple of tests deliberately fail, to be fixed in following commits.

Ref D9551
2021-10-20 12:58:19 +03:00
6cd191a660 Link/Append tests: properly support and test with/without 'recursive' behaviors.
This requires adding an extra ('indirect') library to the test cases for
append.

Aftermath of T92224.
2021-10-20 11:58:06 +02:00
25c173ffd1 Tracking: support editing all selected tracks
This patch adds a "selected_movieclip_tracks" context member and enables
editing properties of multiple selected tracks via the usual Alt-click
editing (as well as the "Copy To Selected" operator). Both use
UI_context_copy_to_selected_list() to gather a list of other selected
items [which are now taken via said new context member]. Strictly
speaking, this could be done without the context member as well [just
gathering other selected tracks in UI_context_copy_to_selected_list()
without relying on a context member], but this might come in handy in
other places (e.g. Addons).

note: some could be desired for markers (e.g. editing pattern/search
areas of all selected track markers, but since this is burried in a
uiTemplate, this is a bit more work for another patch).

Differential Revision: https://developer.blender.org/D12923
2021-10-20 11:36:33 +02:00
2bcf93bbbe View3D: expose snap selection as a utility funciton
This makes it convenient to position appended objects, see: T92111.
2021-10-20 18:21:14 +11:00
943debfab5 View3D: snap with active pivot doesn't need to require a 3D view 2021-10-20 18:01:49 +11:00
6ed93391c4 Fix : Set Curve Handle Position Node Auto Convert
When trying to auto convert Vector to Free or Auto to Align, the
old handle positions needed to be baked in first.
2021-10-19 23:23:14 -05:00
fd7510984a CMake: add WITH_BLENDER_THUMBNAILER option
Make building the thumbnail extraction executable optional,
disable on macOS as this was not linking, further, macOS doesn't use
this for thumbnail extraction so it could be left disabled.
2021-10-20 12:15:33 +11:00
b280699078 Cleanup: use elem macros 2021-10-20 11:16:43 +11:00
ef9269bd62 Thumbnails: refactor extraction to use one code-path for all platforms
Thumbnail extraction now shares code between Linux/Windows,
allowing thumbnails from Zstd compressed blend files to be extracted.

The main logic is placed in blendthumb_extract.cc and is built as static
library. For windows there is DLL which is registered during blender
install and which then reads and generates thumbnails.

For other platforms there is blender-thumbnailer executable file which
takes blend file as an input and generates PNG file. As a result
Python script blender-thumbnailer.py is no longer needed.

The thumbnail extractor shares the same code-path as Blenders file
reading, so there is no need to duplicate any file reading logic.
This means reading compressed blend files is supported (broken since
the recent move Zstd compression - D5799).

This resolves T63736.

Contributors:

- @alausic original patch.
- @LazyDodo windows fixes/support.
- @campbellbarton general fixes/update.
- @lukasstockner97 Zstd support.

Reviewed By: sybren, mont29, LazyDodo, campbellbarton

Ref D6408
2021-10-20 10:31:30 +11:00
bca2701236 GNUmakefile: clarify that order isn't important for multiple targets
Also include example.
2021-10-20 10:04:14 +11:00
93197c4660 Cleanup: spelling in comments 2021-10-20 09:19:21 +11:00
967fec6883 Cleanup: sort cmake file lists 2021-10-20 09:17:46 +11:00
d73f664790 Cleanup: trailing space, use single quotes for enums 2021-10-20 09:17:25 +11:00
d7b4350749 Fix T92354: Missing raycast node in geometry nodes add menu
Was removed by mistake in rB0a6cf3ed0c64
2021-10-19 16:27:37 -05:00
Erik Abrahamsson
a83b405a45 Geometry Nodes: Replace String node
This commit adds a node that can be used to find and replace strings
inside of the input string. One initial use case is to have an easier
way to add line breaks to strings to the string to curves node.

Differential Revision: https://developer.blender.org/D12721
2021-10-19 15:27:47 -05:00
85c8dd6c96 Fix: Display color sockets without labels correctly
Don't build a manual property split layout when the label
for the socket is hidden.
2021-10-19 14:04:03 -05:00
fccc530003 Fix asset catalog operators disabled without experimental feature flag
If the Extended Asset Browser experimental feature was disabled, the asset
catalog operators wouldn't work. This wasn't intentional, catalogs aren't
considered experimental.
2021-10-19 18:54:30 +02:00
Charlie Jolly
67dbb42236 Geometry Nodes: Add Wave texture node
Port shader wave texture node

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12733
2021-10-19 17:30:24 +01:00
Charlie Jolly
56bf34aa17 Geometry Nodes: Add Magic texture node
Port shader node magic texture

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12732
2021-10-19 17:18:33 +01:00
823996b034 Asset Browser: Improved workflow for asset catalog saving
No longer save asset catalogs on blendfile save. Instead:

- extend the confirmation prompt for unsaved changes to show unsaved
  catalogs.
- In the confirmation prompt, make catalog saving explicit & optional,
  just like we do it for external images. {F10881736}
- In the Asset Browser catalog tree, show an operator icon to save the
  catalogs to disk. It's grayed out if there are no changes to save, or
  if the .blend wasn't saved yet (required to know where to save the
  catalog definitions to). {F10881743}

Much of the work was done by @Severin and reviewed by me, then we
swapped roles.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12796
2021-10-19 18:07:22 +02:00
b6c3b41d41 Cleanup: use nullptr in C++ 2021-10-19 18:05:02 +02:00
a3d4ed20f9 Fix liblink tests after recent commit.
NOTE: This needs new tests, no time now, will do tomorrow.
2021-10-19 18:01:26 +02:00
7a61916717 Fix T92345: Crash with only pointcloud in attribute transfer node
The distances array is only allocated if there are mesh distances to
compare to, so it is empty when there is only a point cloud.
2021-10-19 10:42:14 -05:00
a7ade57e11 Asset Catalogs: allow creating catalog in unsaved blend file
Allow creating a new asset catalog in a yet-to-be-saved blend file. The
problem was caused by `AssetLibrary` not having an `AssetCatalogService`
right after creation; only after loading data from disk was this
instance created. It's now always there.
2021-10-19 16:55:46 +02:00
79a88b5e91 Fix compilation error about undefined PATH_MAX 2021-10-19 16:47:17 +02:00
57f1379104 Fix T92265: Outliner crash clicking override warning buttons
`outliner_draw_overrides_buts` uses `uiDefIconBlockBut` but doing so
without defining a function callback to actually build a block.
This will make the button go down the route of spawning a popup, but
without a menu. Crash then happens later accesing the (missing) menu in
`ui_handler_region_menu`.

So while we could dive into making this usage failsafe (carefully
checking `BUTTON_STATE_MENU_OPEN` in combination with
`uiHandleButtonData->menu` being NULL all over), but it seems much more
straightforward to just use `uiDefIconBut` (instead of
`uiDefIconBlockBut`) since this Override Warning buttons seem not to
intend spawning a menu anyways?

Maniphest Tasks: T92265

Differential Revision: https://developer.blender.org/D12917
2021-10-19 16:42:00 +02:00
b3b7319de7 Fix T92224: Refactor of append code unexpectedly changed behavior with 'localize all' off.
In 2.93 and before, when appending wityh 'localize all' off, all linked
IDs (including indirectly linked ones) from initial library would be
made local.
In 3.0, after refactor from rB3be5ce4aad5e, only directly linked IDs
(i.e. user-selected IDs) would be made local.

This change was not intentional (result of confusing code and naming in
previous implementation), and old behavior is used in some workflows to
control which data is kept linked and which data is made local.

This commit revert to 2.93 behavior.

NOTE: there is still an (extreme) corner case where behavior is
different between 2.93 and 3.0:
If you append (at the same time) object A from LibA.blend, and object B
from LibB.blend, and object B uses somehow a material from LibA.blend:
* In 2.93, that material would have been made local (because it belonged
  to one of the 'initial' libraries, even though not the initial lib of
  object B).
* In 3.0, this material will remain linked, since from object B
  persective it comes from a different library.
2021-10-19 16:26:26 +02:00
1c5722ba07 Fix T91197: marking assets from Python may crash
When using `asset_mark` function from a Python script and afterwards
updating the preview image, a crash might happen. The preview image is
generated by the `asset_mark` function. This may happen on a background
thread, introducing potential synchronization issues.

This patch fixes this by separating the preview generation
`ID.asset_generate_preview` from the mark as asset `ID.asset_mark`.

Note: this separation of "mark as asset" and "generate preview" also
applies to the `ED_asset_mark_id()` C function; if it is desired to have
previews rendered after marking as asset, a call to
`ED_asset_generate_preview()` is now also required.

Reviewed By: sybren

Maniphest Tasks: T91197

Differential Revision: https://developer.blender.org/D12922
2021-10-19 16:17:04 +02:00
0a6cf3ed0c Geometry Nodes: Fields version of the raycast node
This patch includes an updated version of the raycast node that uses
fields instead of attributes for inputs instead of outputs. This makes
the node's UI much clearer. It should be faster too, since the
evaluation system for fields provides multi-threading.

The source position replaces the input geometry (since this node is
evaluated in the context of a geometry like the other field nodes).

Thanks to @guitargeek for an initial version of this patch.

Differential Revision: https://developer.blender.org/D12638
2021-10-19 09:01:39 -05:00
9a1d75e0b9 Asset Library Service: make insensitive to trailing slashes
Make `AssetLibraryService::get_asset_library_on_disk(path)` insensitive
to trailing slashes; i.e. `get_asset_library_on_disk("/path")` and
`get_asset_library_on_disk("/path/¨)` will now return the same
`AssetLibrary*`.
2021-10-19 15:53:11 +02:00
a7075a30e2 BKE_callback_remove: prevent crash on Blender exit
`BKE_callback_remove` now checks whether the callback actually is known,
before trying to remove it.

`BKE_blender_atexit()` runs after `BKE_callback_global_finalize()`. When
an at-exit callback tried to unregister its BKE callbacks, these would
already be unregistered, causing a crash of Blender when exiting,
2021-10-19 15:53:11 +02:00
219058c213 Geometry Nodes: Remove implicit realizing and conversion
This commit removes the implicit conversion from points to a mesh
that used to happen before the next modifier. It also removes the
implicit realizing of instances that happened before another modifier.

Now we have specific nodes for both of these operations, the
implicit conversions make less sense, and implicit instance
realizing has already been removed in other nodes.

This adds another geometry nodes modifier before modifiers that would
have realized instances implicitly before. Currently adding another
data-block during versioning after linking means that an assert needs
to be changed. That should be made unnecessary by T92333.

Differential Revision: https://developer.blender.org/D12722
2021-10-19 08:39:10 -05:00
cd36f59027 Cleanup: trailing whitespace 2021-10-19 15:30:46 +02:00
fd77a28031 Cycles: bake transparent shadows for hair
These transparent shadows can be expansive to evaluate. Especially on the
GPU they can lead to poor occupancy when only some pixels require many kernel
launches to trace and evaluate many layers of transparency.

Baked transparency allows tracing a single ray in many cases by accumulating
the throughput directly in the intersection program without recording hits
or evaluating shaders. Transparency is baked at curve vertices and
interpolated, for most shaders this will look practically the same as actual
shader evaluation.

Fixes T91428, performance regression with spring demo file due to transparent
hair, and makes it render significantly faster than Blender 2.93.

Differential Revision: https://developer.blender.org/D12880
2021-10-19 15:11:09 +02:00
d06828f0b8 Cycles: avoid intermediate stack array for writing shadow intersections
Helps save one OptiX payload and is a bit more efficient.

Differential Revision: https://developer.blender.org/D12909
2021-10-19 15:10:55 +02:00
Brecht Van Lommel
943e73b07e Cycles: decouple shadow paths from main path on GPU
The motivation for this is twofold. It improves performance (5-10% on most
benchmark scenes), and will help  to bring back transparency support for the
ambient occlusion pass.

* Duplicate some members from the main path state in the shadow path state.
* Add shadow paths incrementally to the array similar to what we do for
  the shadow catchers.
* For the scheduling, allow running shade surface and shade volume kernels
  as long as there is enough space in the shadow paths array. If not, execute
  shadow kernels until it is empty.

* Add IntegratorShadowState and ConstIntegratorShadowState typedefs that
  can be different between CPU and GPU. For GPU both main and shadow paths
  juse have an integer for SoA access. Bt with CPU it's a different pointer
  type so we get type safety checks in code shared between CPU and GPU.
* For CPU, add a separate IntegratorShadowStateCPU struct embedded in
  IntegratorShadowState.
* Update various functions to take the shadow state, and make SVM take either
  type of state using templates.

Differential Revision: https://developer.blender.org/D12889
2021-10-19 15:09:29 +02:00
6e473a897c Tests: update Cycles GPU tests blacklist so all tests pass
More tests are matching now, mainly due to unified volume sampling.
2021-10-19 15:06:04 +02:00
7fa6794037 Fix failing view layer tests after recent changes to naming convention 2021-10-19 14:55:06 +02:00
5b6dacb9eb Fix splash screen showing language when building without that feature 2021-10-19 14:48:37 +02:00
9e9d003a82 Render: change view layer name convention to ViewLayer_001 to avoid OpenEXR issues
Some compositing applications do not support spaces and dots in layer names, and change
these to other symbols on import. This causes various compatibility issues, including
with Cryptomatte metadata. While technically those could be considered bugs in the
Cryptomatte implementation of other software, where they are not properly accounting for
that layer renaming, it's not ideal.

The OpenEXR channel naming convention is "layer.pass.channel". We get away with dots in
the layer name since we parse this from right to left, but it's a weak assumption.

Now we don't forbid using spaces or dots, and existing files are unchanged. But at
least by default names will be compatible, and hopefully other software catches up in
time to support more flexible layer names.

Ref T68924
2021-10-19 14:30:45 +02:00
8e8932c8ff Render: use "_" as delimiter in AOV names to avoid issues with OpenEXR
OpenEXR uses "." to separate layers/passes/channels, so using AOV.001 is
a problem. Other applications will not be able to parse it correctly.

Default to AOV_001 instead, and don't allow using dots in AOV names.

Fixes T89991
Ref T73266
Ref D12871
2021-10-19 12:59:05 +02:00
6ee181ec24 Cycles: improve sampling pattern description regarding adaptive sampling 2021-10-19 12:59:05 +02:00
a395a1b36b Cleanup: fix compiler warnings 2021-10-19 12:59:05 +02:00
c107a3c4d9 Fix invalid principled diffuse in Cycles OSL
Need to initialize components for the full Diffuse BSDF.

Steps to reproduce:
- Default cube scene
- Switch to Cycles renderer
- Enable OSL backend
- Start viewport render
- Observe cube being much black

Differential Revision: https://developer.blender.org/D12921
2021-10-19 12:10:29 +02:00
765eba5a6e Cleanup: More readable Cycles OSL BSDF definition
A  Clang-Format configuration to make the closure definition block to
be properly recognized as such.

Also small wrapper macro to avoid comma in the actual definition code
which was causing unwanted indentation of parameters definition.

Requires Clang-Format 7 or newer. The version we ship in the libs is
12, so for recommended development setup it should all be good.

Differential Revision: https://developer.blender.org/D12920
2021-10-19 11:59:26 +02:00
abc3128011 Fix T85779: Cycles not using all threads when using OpenImageDenoise
The thread affinity setting in OIDN can break multithreading on some CPUs.
While this leads to somewhat worse performance on CPUs that do work correctly,
it's better than having some CPUs use only half the cores.
2021-10-19 11:39:11 +02:00
d6b54068d4 Cleanup: Unused device argument in host update functions
Better not to tempt anyone from using unsafe access to device
functionality during host update.
2021-10-19 11:30:27 +02:00
6e859f7ff8 Fix invalid OSL shader compilation state
The lookup tables are to be initialized after device free.

On Linux was only noticeable when rendering default cube scene with
an extra assert. On Windows it was causing an assert in STL in debug
builds.

Differential Revision: https://developer.blender.org/D12918
2021-10-19 11:29:39 +02:00
9c8255d486 Cleanup: use 'e' prefix for enum types 2021-10-19 18:35:39 +11:00
695dc07cb1 Cleanup: clang-format 2021-10-19 18:31:15 +11:00
a76bb1a277 BLI: Support removing keys from a set during iteration
This adds the ability to mark slots as removed while iterating through
a mutable set.

Differential Revision: https://developer.blender.org/D12867
2021-10-18 22:15:52 -05:00
da949c3574 Fix crash on file load in unregistering bke::AssetLibraryService
Use mutable iterator to support callbacks removing themselves.
2021-10-19 13:22:36 +11:00
c4f733a76c Fix memory leak in sample tool
When there was no image buffer, sample leaked memory.
2021-10-19 12:50:07 +11:00
b74f2c7d74 Fix image cache margin calculation
This margin was inconsistently calculated: only taking the
visible region and interface scale into account in some cases.
2021-10-19 12:50:07 +11:00
a3457704fb Geometry Nodes: De-duplicate index input nodes during evaluation
We do this in other nodes to reduce overhead of using the same node more
than once. I don't think it will make a difference with index nodes
currently, but at least it's consistent.
2021-10-18 20:13:37 -05:00
482c5f0014 Fix: Build error with MSVC
noise.cc uses std::min and std::max without
including the algorithm header required.

Newer MSVC versions and GCC implicitly include
it somewhere, which isn't something we should
count on. Best to include what you use.
2021-10-18 19:01:18 -06:00
Erik Abrahamsson
c1d138dd92 Fix T91979: Don't mark string nodes as supporting fields
Even though these nodes do support fields internally, there are no
input string sockets that support fields currently, so removing
the diamond sockets for now helps avoid confusion.

Differential Revision: https://developer.blender.org/D12828
2021-10-18 19:08:02 -05:00
d7b231baa8 Cleanup: remove unused member and rearrange function 2021-10-18 18:38:42 -03:00
3a898db363 VSE: Improve thumbnail loading speed
Split thumbnail job in 2 passes. First pass will render visible images
and second part renders set of "guaranteed" equally spaced images.

When viewing larger amount of strips, it is likely that only 1 or 2
images will be rendered in first pass, while in second pass it is up to
30 images.

This results (seemingly) in 3x better performance, but zooming before
set of guaranteed images is done will be slightly more inaccurate.
2021-10-18 23:26:16 +02:00
41eba47a87 Revert "Cycles: optimize volume stack copying for shadow catcher/compaction"
This reverts commit 3065d26097. Causing crashes
in the spring scene.
2021-10-18 22:38:33 +02:00
06356115b7 VSE: Don't draw thumbnails while rendering
During rendering VSE cache is invalidated, so thumbnails would be
removed and thumbnail job would constantly restart.

Even if thumbnails would be preserved, resources should be dedicated
for rendering job.
2021-10-18 22:25:36 +02:00
5f59bf0044 Geometry Nodes: Sort Children in Collection Info
When the 'Separate Children' option is selected, the children of
the selected collection are inserted into the geometry output
sorted alphabetically by name.

One item to note is that the rename function does not trigger a
depsgraph update. This means that the changes are not reflected
in the spreadsheet until another action triggers the update.

Differential Revision: https://developer.blender.org/D12907
2021-10-18 15:11:04 -05:00
ec8a9a0d65 Cleanup: Remove unnecessary constructor argument
All attributes should be writeable, it is now only needed for the
legacy `normal` attribute on meshes.
2021-10-18 12:35:27 -05:00
9f895fbb97 Geometry Nodes: Optimize curve builtin attribute exists check
Calculating the number of points is overkill here, if there are many splines.
The `exists` check just needs to know if there are any points at all.
2021-10-18 12:31:01 -05:00
9a8badc1e4 Cleanup: Rearrange code, rename function
Move the static functions higher in the file so they are usabl
for an upcoming patch, and make it use clearer names instead
of overloading a function name.
2021-10-18 12:22:44 -05:00
3a25501143 Fix T92314: Auto naming of the Vertex Group doesn't work for Grease
Pencil

Not naming the auto-generated vertexgroup after the selected bone was
just confusing (since the group would not have an effect), so now use
similar code that is used for meshes for greasepencil as well.

Maniphest Tasks: T92314

Differential Revision: https://developer.blender.org/D12906
2021-10-18 19:11:19 +02:00
a9cb330815 Cleanup: minor refactoring in preparation of main and shadow path decoupling
Ref D12889
2021-10-18 19:02:10 +02:00
2430f75279 Cycles: reduce GPU state memory a little
* isect Ng is no longer needed for shadows, for main path needed for SSS only
* Reduce rng_offset and queued_kernel to 16 bits

Ref D12889
2021-10-18 19:02:10 +02:00
3065d26097 Cycles: optimize volume stack copying for shadow catcher/compaction
Only copy the number of items used instead of the max items.

Ref D12889
2021-10-18 19:02:10 +02:00
a184d0dd02 Cleanup: fix outdated comment and use of atomics
This is only used by a single device, not need for thread safety.
2021-10-18 19:02:10 +02:00
fc4b1fede3 Cleanup: consistently use uint32_t for path flag 2021-10-18 19:02:10 +02:00
Brecht Van Lommel
1df3b51988 Cycles: replace integrator state argument macros
* Rename struct KernelGlobals to struct KernelGlobalsCPU
* Add KernelGlobals, IntegratorState and ConstIntegratorState typedefs
  that every device can define in its own way.
* Remove INTEGRATOR_STATE_ARGS and INTEGRATOR_STATE_PASS macros and
  replace with these new typedefs.
* Add explicit state argument to INTEGRATOR_STATE and similar macros

In preparation for decoupling main and shadow paths.

Differential Revision: https://developer.blender.org/D12888
2021-10-18 19:02:10 +02:00
44c3bb729b Cleanup: use a common prefix in static functions
This helps identify where the function came from.
2021-10-18 13:43:44 -03:00
2944f3e92b Fix 1 frame delayed orientation in Placement Gizmo
Error in {rB69d6222481b4}
2021-10-18 13:32:56 -03:00
46fe43feca Fix failing AssetLibraryService test by removing test code
Remove the code I had hoped to fix in rB3edae09e, the fix was unreliable.

No functional changes to Blender.
2021-10-18 17:29:24 +02:00
3cbe921899 Cleanup: Use simpler method to create attribute lookups
Instead of switch statements, make use of generic virtual arrays
so the code is shorter and easier to read.

Differential Revision: https://developer.blender.org/D12908
2021-10-18 10:08:57 -05:00
aef8ac7db8 Cleanup: clang format 2021-10-18 17:00:25 +02:00
0071001879 Fix T92246: sculpt crash displaying statistics in certain situations
It seems possible to switch object selection (if `Lock Object Modes` is
turned off) and end up with an object that has a SculptSession but a
NULL PBVH.
(I was not able to repro from scratch, but file from the report was
clearly in that state).

This would crash in displaying scene statistics.

While there might be a deeper fix (making sure PBVH is available early
enough -- possibly using `BKE_sculpt_object_pbvh_ensure`,
`sculpt_update_object` or friends), there are also many checks in tools
for PBVH, so the situation seems to be somewhat vaild/expected also in
other places.
So to fix this, just check for a non-NULL PBVH, returning early
otherwise.
Note: this leaves us with displaying 0/0 Faces & Vertices in the borked
case until an operation takes place that updates the PBVH.

Maniphest Tasks: T92246

Differential Revision: https://developer.blender.org/D12904
2021-10-18 16:52:21 +02:00
fb88ff8f0c Cleanup: fix compiler warning 2021-10-18 16:45:06 +02:00
b246f81412 Fix T92311: Snap to faces in edit mode with x-ray enabled doesn't work
The `use_occlusion_test` parameter test was accidentally removed in
{rB91c33c8b9952}
2021-10-18 11:41:32 -03:00
dd689eeda4 Fix: dangling pointer caused use-after-free
The old code only worked when built-in nodes are only unregistered
at most once while Blender is running. However, this is not the case
when running certain unit tests such as `AbstractHierarchy*`
in `blender_test`.

Found by Sybren, thanks.
2021-10-18 16:19:42 +02:00
ef7e21fd4a UI: Reduce vertical margin between panels
In an attempt to reduce scrolling. This can be re-visited if a kind of switch
between "compact" and "comfortable" UI size is implemented in the future.
2021-10-18 16:16:45 +02:00
3edae09eaa Asset Library Service: fix failing unit test
On GCC in release mode (and maybe also debug mode without ASAN enabled),
allocating an `AssetLibraryService` will reuse the space that should
have just been freed. This made a test fail, as it was testing that new
memory was allocated and not some old instance reused.

To ensure that the calls that should allocate a new block of memory
return a unique pointer, I added some dummy allocation to the test.

No functional changes to Blender
2021-10-18 15:48:06 +02:00
Charlie Jolly
729b2d026d Geometry Nodes: Add shader Musgrave texture node
Port shader node musgrave texture

Differential Revision: https://developer.blender.org/D12701
2021-10-18 14:24:14 +01:00
de6bf5d4d2 Nodes: support sharing node declarations between nodes
Previously, every node had its own declaration. This isn't ideal, because
it's often the case that all nodes of the same type have the same declaration.
That's the case for all nodes using declarations currently. It will not be true
for e.g. group nodes in the future.

Sharing node declarations between nodes makes it a bit more efficient.

Differential Revision: https://developer.blender.org/D12898
2021-10-18 15:22:34 +02:00
e150f171d5 Fix T92250 EEVEE: Render crash with Motion Blur and Overscan
This was caused by `DRW_view_data_texture_list_size_validate` which now
delete everything from the render engine.

This might change in the future but for now we just avoid calling it from
the render loop (when using DRW_cache_restart).
2021-10-18 15:15:04 +02:00
Pablo Dobarro
765b1c6b53 Fix T79005: Vertex color conversion operators changing the colors
CD_PROP_COLOR vertex data is stored in scene linear while legacy vertex
colors are srgb, so both operators also need to do this conversion

Reviewed By: sergey

Maniphest Tasks: T79005

Differential Revision: https://developer.blender.org/D8320
2021-10-18 15:01:37 +02:00
Jan-Willem van Dronkelaar
4de0e2e771 Animation: Motion Paths Refresh All
Adds a button, Update All Paths, to the Motion Paths property tabs and
will always show. The operator goes through all visible objects and
updates their motion paths.

The current implementation has a subtle functional change. Calculating
or updating motion paths for armature objects (through the Object tab,
not Armature tab) now also updates the paths for its bones. We could
preserve the old behavior but it doesn't seem necessary. It seems more
likely that the animator wants to update both anyways.

Reviewed by: sybren

Maniphest Tasks: T83068

Differential Revision: https://developer.blender.org/D11667
2021-10-18 14:36:26 +02:00
f9113c4be8 Assets: add global bke::AssetLibraryService class
Add `blender::bke::AssetLibraryService` class that acts like a
blendfile-scoped singleton. It's allocated upon the first call to
`BKE_asset_library_load` and destroyed in the LOAD-PRE handler.

The `AssetLibraryService` ensures that edits to asset catalogs are not
lost when the asset browser editor closes (or even reloads). Instead,
the `AssetLibrary` pointers it owns are kept around as long as the blend
file is open.

Reviewed By: Severin

Maniphest Tasks: T92151

Differential Revision: https://developer.blender.org/D12885
2021-10-18 14:21:41 +02:00
1f51037676 Geometry Nodes: Endpoint Selection Nodes
The Endpoint Selection node allows for the Selection of an aribitrary
number of endpoints from each spline in a curve. The start and end
inputs are evaluated on the spline domain. The result is outputted
as a boolean field on the point domain.

Differential Revision: https://developer.blender.org/D12846
2021-10-18 06:45:16 -05:00
6f76bcc12c Fix: missing use-attribute property in geometry nodes modifier
The property was missing when a group input changed from not
supporting fields to supporting fields.
2021-10-18 12:58:30 +02:00
Erik Abrahamsson
f9fe755dba Nodes: add default value to string socket declaration
Differential Revision: https://developer.blender.org/D12758
2021-10-18 11:59:49 +02:00
eb0d216dc1 Geometry Nodes: decouple multi-function lifetimes from modifier
Previously, some multi-functions were allocated in a resource scope.
This was fine as long as the multi-functions were only needed during
the current evaluation of the node tree. However, now cases arise
that require the multi-functions to be alive after the modifier is finished.
For example, we want to evaluate fields created with geometry nodes
outside of geometry nodes.

To make this work, `std::shared_ptr` has to be used in a few more places.
Realistically, this shouldn't have a noticable impact on performance.
If this does become a bottleneck in the future, we can think about ways
to make this work without using `shared_ptr` for multi-functions that
are only used once.
2021-10-18 11:46:21 +02:00
746ee29d36 Fix T91700: Strips can be transformed in scope display modes
Hide gizmos & prevent transform & selection in scope display.
2021-10-18 19:29:36 +11:00
4f3f79c382 Keymap: support key-activates-tools for shrink-fatten 2021-10-18 18:42:35 +11:00
3f4ba64ae3 Cleanup: use depends-on-cursor for "Object Transfer Mode" operator
Replace modal operator with the OPTYPE_DEPENDS_ON_CURSOR flag.

This has the advantage of showing the shortcut in the menu.
2021-10-18 17:20:06 +11:00
2a8e5128c1 WM: support setting the operators idle cursor
Support setting a cursor when an operator is waiting for input.
2021-10-18 17:18:48 +11:00
6bf8c95e52 UI: expose additional cursors to the Python API 2021-10-18 17:09:26 +11:00
59c95a8ca2 Cleanup: de-duplicate operator registration
Operators and operator-macros duplicated RNA properties.
2021-10-18 17:09:26 +11:00
Germano Cavalcante
69d6222481 Snap and Placement Gizmo Refactor
Move most of the gizmo snap and placement code to `view_cursor_snap.c`.

Simplify and extend the snap API.

Differential Revision: https://developer.blender.org/D12868
2021-10-18 01:58:00 -03:00
be22e36692 Fix key-shortcut path for sequencer overlay 2021-10-18 15:47:31 +11:00
f5edc69150 Fix frame overlay not refreshing the sequencer preview
Regression in 46aa70cb48
2021-10-18 15:47:29 +11:00
e538b2c3a3 Cleanup: internal sequencer naming for overlays
- Rename RNA SpaceSeq.show_strip_overlay to show_overlays
  matching the 3D View, the term "strip" was misleading as this is used
  for the preview as well.

- Rename various RNA overlay settings to overlay_frame
  since "Frame Offset" is a specific feature, avoid having both
  Editor.show_overlay and SpaceSeq.show_overlays.

- Rename Editing `over_*` -> `overlay_frame_*` in DNA,
  as well as flags.
2021-10-18 15:47:28 +11:00
c5a13ffcb4 Cleanup: spelling in comments 2021-10-18 12:13:10 +11:00
Pablo Vazquez
452c78757f UI: Improve contrast on playhead
Add an outine around the playhead, matching the color of the background (slightly darkened)
to improve the readability of the current frame line when placed against curves or strips
with a similar color.

{F10944336, size=full}

Differential Revision: https://developer.blender.org/D12810
2021-10-17 19:10:31 +02:00
Pablo Vazquez
962b17b3ca UI: Adjust header color when active instead of inactive
Currently, the background color of headers gets darkened when the editor is not active,
this makes it hard to theme, and adds contrast/noise when it's not needed.

This patch makes headers use the regular theme color when the editor is not active, so it
can be made to flush with the background more easily. And lightens the header (by +10,
same value as before) when the editor is active, providing the wanted highlight.

The motivations behind this change are:
* Simplify picking a theme color for headers.
* Widgets already become lighter on mouse hover, this change creates a connection with that concept.

Left: current master, inactive header is darkened.
Right: this patch, inactive header gets the theme color, active editor gets header in a slightly lighter color (like most widgets)

{F11052503, size=full, loop, autoplay}

Reviewed By: #user_interface, HooglyBoogly

Differential Revision: https://developer.blender.org/D12856
2021-10-17 18:49:59 +02:00
93544b641b UI: Visual style update to panels
Back in Blender 2.30, the GUI project brought panels into Blender among other important visual updates.
For the first time it was possible to move the wall of buttons around. Providing a clear separation
between sections (it even allowed the grouping of panels in tabs!)

During the 2.5 redesign, the separation between panels became a line on top of each panel, and panels received
theme settings for background and header colors. The default theme used the same color for both.

In 2.8 the background color of panels was different from headers in the default theme, so the separator
line was removed. While the separator line wasn't elegant (only on top, non-themeable, hard-coded emboss effect),
it provided a sort of separation between panels.

This patch solves the panels-separation by simply adding a margin space around them (not visible in default theme yet).
Even though the margin reduces the width of the working area slightly, it makes room for the upcoming always-visible scrollbars.

Other adjustments:
* Use arrow icon instead of triangle to collapse/expand
* Use rounded corners to match the rest of the UI (editor corners, nodes, etc).

{F10953929, size=full}

Margin on panels makes use of the `style->panelouter` property that hasn't been
used in a while. Also slight tweaks to `boxspace` and `templatespace` style properties so they
are multiples of 2 and operations on them round better.

There is technically no need to update the themes for them to work, so no theme changes are included in this patch.

{F10953931, size=full}

{F10953933, size=full}

{F10953934, size=full}

{F10954003, size=full}

----

A new theme setting under Style controls the roundness of all panels (added it to Style instead of ThemeSpace because I think controlling the panel roundness per editor is a bit overkill):
{F11091561, size=full, autoplay, loop}

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D12814
2021-10-17 18:31:24 +02:00
19740b25c7 Geometry Nodes: bring back lazy evaluation for field types in Switch node
Differential Revision: https://developer.blender.org/D12878
2021-10-17 15:56:37 +02:00
6b0719c0f3 Geometry Nodes: change field visualization when there is an error
This does not change the behavior when there are no mistakes in the node tree.
The visualization does change when a field is connected to an input that cannot
be a field.

Differential Revision: https://developer.blender.org/D12877
2021-10-17 15:51:33 +02:00
3c36803189 Cleanup: Fix unused variable warning in lite build 2021-10-16 22:58:30 -05:00
4a00faca1a Fix: Geometry Nodes Subdiv Surface Crash
If there are no edges in the mesh, the process would crash.
Returning in this case.
2021-10-16 07:26:57 -05:00
5c961b3b58 Revert "Fix T62325, T91990: changing Cycles presets does not update the Blender UI"
This reverts commit 1b6752e599. It is causing
constant redraws due to some ID properties seemingly being edited on every
redraw.
2021-10-16 13:54:29 +02:00
b3c469153e Asset Browser: Use single column for asset library menu
Feedback was that the two column menu felt odd, and that the "Custom" and
"Built-in" headings for each column were more confusing than helpful. So
changing this to a single column menu with separator lines instead of headings.
2021-10-16 09:55:31 +02:00
73753e1a67 Asset Browser: Change default name of tags
Use "Tag" instead of "Unnamed Tag" as default name for tags. Other default
names in Blender also don't add "Unnamed" or similar.
2021-10-16 09:28:05 +02:00
1c18f05f0b Fix T92252: User after free when opening file after Blender starts
Oversight in 6e4ab5b761
2021-10-16 15:35:36 +11:00
4586688323 Fix nonnull-compare warning in DNA_view3d_types.h
Was introduced in rB93a8fd1249f
2021-10-15 19:17:06 -07:00
5fed3aec4a VSE: Fix crash when scene strip is added to meta
Caused by 81514b0e91, missed sanitizing `sound->offset_time` usage in
`seq_update_sound_bounds_recursive_impl()`.
2021-10-16 01:28:59 +02:00
138fdf78ba PyAPI Docs: Fix example not using keyword parameter
Fixes T92238
2021-10-15 17:55:31 -04:00
73fbd3eebd VSE: Hide tool header by default
Tools currently used by VSE don't have much useful settings, but they
use a lot of space. Therefore these headers will be hidden by default.

Property `show_region_tool_header` was added to view menu to enable tool
settings.

This could be resolved by region overlap, but it isn't working well
currently.

Differential Revision: https://developer.blender.org/D12875
2021-10-15 23:42:26 +02:00
Jarrett Johnson
41dc558747 Geometry Nodes: Rotate Euler: Use "Local" instead of "Point"
Since points aren't relevant in function nodes, replace all mentions
of it with "local" to illustrate rotations done in local-space instead.

Differential Revision: https://developer.blender.org/D12881
2021-10-15 16:33:27 -05:00
Josef Raschen
c383397d07 Fix versioning for sequencer color balance modifier.
Commit 213554f24a added slope/offset/power controls to the sequencer
color balance modifier, but colors in this mode were not initialized
with old files.

Initialize colors to default values.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12806
2021-10-15 23:20:45 +02:00
e11b33fec3 Remove math for 2D affine transform
Commit e1665c3d31 added math to do 2D affine transformations with 3x3
matrices, but these matrices are also used for 3D transformations.

Remove added functions and use 4x4 matrices for 2D transformation.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12510
2021-10-15 23:20:45 +02:00
81514b0e91 Fix T91012: Scene strip doesn't play audio
Issue was caused by adding `seq->sound` check in ded68fb102 in
function `BKE_sound_scene_add_scene_sound` as `offset_time` field was
introduced to resolve sub-frame a/v misalignment.

Scene strips don't have `bSound` allocated but also don't suffer from
a/v misalignment.

Remove `seq->sound` check and don't apply any offset for scene strips.

Reviewed By: zeddb, sergey

Differential Revision: https://developer.blender.org/D12819
2021-10-15 23:20:45 +02:00
9a3c7da934 Fix T92184: Cage gizmo doesn't with area light
This is caused by removing `gizmo_cage2d_modal()` code in 482806c816.

Some areas use cage gizmo to modify RNA properties without using
transform operator like area light, image empty, and compositor preview.
This functionality is implemented in code that was removed.

Add this code back.

Reviewed By: zeddb, campbellbarton

Differential Revision: https://developer.blender.org/D12859
2021-10-15 23:20:45 +02:00
9b1b1d9269 Cleanup: remove unused functions 2021-10-15 22:23:30 +02:00
5b9a911c4b Fix T72583: Sun Beams node artifacts
The artifacts are due to the loss of precision when doing some
calculations with float precision.
2021-10-15 22:23:21 +02:00
Jarrett Johnson
88d295f952 Geometry Nodes: Updated Subdivision Surface Node
Replaces the old Subdivision Surface Node.

Changes:
 - Removes implicit instance realization, instead the node runs once
   per unique instance.
 - "Use Creases" becomes a crease field input applied to edges.
   The values are clamped between zero and one.

Addresses T91763

Differential Revision: https://developer.blender.org/D12830
2021-10-15 15:12:04 -05:00
19bab2a536 Geometry Nodes: Object info node optional instance output
The object info node output an instance as a performance optimization.
Before that optimization was (almost) invisible to the user, but now
that we aren't automatically realizing instances, it isn't intuitive
for a single object to become an instance.

I refactored the transform node so its ability to translate/transform
an entire geometry set was more usable from elsewhere and exposed the
function to get a geometry set from an object.

Differential Revision: https://developer.blender.org/D12833
2021-10-15 14:20:53 -05:00
76f386a37a Geometry Nodes: Fields transfer attribute node
This commit adds an updated version of the old attribute transfer node.
It works like a function node, so it works in the context of a
geometry, with a simple data output.

The "Nearest" mode finds the nearest element of the specified domain on
the target geometry and copies the value directly from the target input.

The "Nearest Face Interpolated" finds the nearest point on anywhere on
the surface of the target mesh and linearly interpolates the value on
the target from the face's corners.

The node also has a new "Index" mode, which can pick data from specific
indices on the target geometry. The implicit default is to do a simple
copy from the target geometry, but any indices could be used. It is also
possible to use a single value for the index to to retrieve a single
value from an attribute at a certain index.

Differential Revision: https://developer.blender.org/D12785
2021-10-15 14:09:08 -05:00
47a72ac4fd Cleanup: Refactor use of implicit inputs in geometry nodes
Instead of checking whether the socket value was hidden, use the proper
node declaration to check whether the socket has an implicit input. The
remaining larger change to make is allowing nodes to specify what their
implicit input should actually be.
2021-10-15 13:57:00 -05:00
4682aad432 Fix: Field type inference considers unavailable sockets
If a node had unused/unavailable inputs, they were still considered
when deciding whether the output is a field or not.
2021-10-15 13:54:08 -05:00
Leon Leno
45e16a6c96 UI: Remove extra padding around curve widget
This commit removes the constant padding around to the left and
right of the curve widget. The padding worked in screen space and
didn't take UI scale/zoom into account. This makes the curve widget
consistent with the more recently added curve profile widget used
for bevel profiles.

Differential Revision: https://developer.blender.org/D12883
2021-10-15 13:30:50 -05:00
d9e697fbbd Cleanup: remove accidental comment 2021-10-15 19:07:10 +02:00
1b6752e599 Fix T62325, T91990: changing Cycles presets does not update the Blender UI
Checking RNA_MAGIC is not enough to identify the ID property case which always
needs updates. If the property is already resolved to an RNA property we need
to check the flag too.
2021-10-15 19:00:19 +02:00
4ba7201546 Asset Browser: Hide Import Types menu for "Current File" asset library
This menu doesn't have an effect on the importing while in the "Current File"
asset library. This can be quite confusing.

However, just hiding the menu may be a temporary solution. Decision
actually to instead show a different menu, that allows choosing between
duplicating and reusing data on drop. This is being reviewed here
https://developer.blender.org/D12879.
Meanwhile (or in case we end up rejecting that), this change should
avoid some confusion.

Differential Revision: https://developer.blender.org/D12752
2021-10-15 18:53:55 +02:00
b66b3f547c Fix T92032: Cycles panoramic cameras do not support shift 2021-10-15 18:25:45 +02:00
7bf9c70b14 Fix T92083: Crash renaming bone used in Armature modifier on curve
This is caused by {rB3b6ee8cee708}.

Since rigging curves with armatures only works with envelopes (if I am
not mistaken), this stirs up the question again why we actually give the
choice for vertex groups in parenting. Anyways, curves can have armature
modifiers and renaming bones should not crash.

Now make sure we only go down the route of `BKE_object_defgroup_list`
and `BKE_object_defgroup_find_name` if vertex groups are actually
supported.

Maniphest Tasks: T92083

Differential Revision: https://developer.blender.org/D12876
2021-10-15 16:57:15 +02:00
Charlie Jolly
104887800c Geometry Nodes: Add Voronoi Texture
Port shader Voronoi to GN

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12725
2021-10-15 15:28:20 +01:00
6e4ab5b761 Fix crash handling tool-keymap events
There was a rare crash in WM_event_get_keymap_from_toolsystem_fallback
when wm->winactive was NULL.

This could happen when the event was handled
immediately after closing a window.
2021-10-16 01:13:28 +11:00
Charlie Jolly
d4f1bc5f39 Geometry Nodes: Port shader gradient texture node
Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D12717
2021-10-15 15:03:21 +01:00
Charlie Jolly
78b5050ff4 Cycles: Voronoi noise, fix uninitialised variable
Caused a debug crash in Windows MSVS.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12873
2021-10-15 15:01:10 +01:00
2f36762def Cleanup: refactor BVH2 shadow intersection for upcoming changes 2021-10-15 15:42:44 +02:00
5d565062ed Cleanup: refactor OptiX shadow intersection for upcoming changes 2021-10-15 15:42:44 +02:00
509b637d59 Cleanup: don't copy constant memory to GPU multiple times for displacement 2021-10-15 15:42:44 +02:00
eb71157e2a Cleanup: add utility functions for packing integers 2021-10-15 15:42:44 +02:00
2ba7c3aa65 Cleanup: refactor to make number of channels for shader evaluation variable 2021-10-15 15:42:44 +02:00
70376154a0 Fix Cycles Python error with pinned materials in properties editor 2021-10-15 15:42:44 +02:00
53f25df5bc Fix T92128: Cycles CUDA wrong hair attributes, after recent changes 2021-10-15 15:42:44 +02:00
f834939ceb Geometry Nodes: fix getting mutable geometry component
The previous code did not take into account that they geometry
component may not be mutable because it is shared between
multiple geometry sets.
2021-10-15 13:39:26 +02:00
da3946b710 Fix wrong DNA struct element lookup in versioning
The type of the element is `short`, not `int`. Harmless since this was checking
for a specific version anyway.
2021-10-15 12:38:10 +02:00
aca38148ad Fix T92131: handle node declaration in material properties
The issue was that this menu was only looking at socket templates,
but not at the new node declarations. This fix is to just check those
as well. The fix comes with a small refactor that makes the memory
management a bit simpler.

Differential Revision: https://developer.blender.org/D12866
2021-10-15 12:12:56 +02:00
e46055ae9d UI: Fix offset of vertical scale indicators
`BLF_height_max()` uses the tallest character in the font, and many characters
in our font are taller than numbers. Use `BLF_height` with `0` as reference instead.

Fix by @harley, thanks!
2021-10-15 11:54:07 +02:00
Jesse Yurkovich
93a8fd1249 Cleanup: Commonize code for checking scene lights/world settings
There were several places attempting to check to see if scene lights
and world were enabled for display. This tries to find a common place
for both of these to reduce duplication.

Honestly, I couldn't find a really good spot for these and settled on
DRW_engine. It's not the best spot since they're not strictly drawing
related, but let's start here.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D12658
2021-10-15 11:42:44 +02:00
30bed8761d Fix T92226 EEVEE: AO misaligned on first sample
Caused by tricky state tracking. `GPU_framebuffer_bind()` is updating
the framebuffer on first time and will reset the viewport state of it.
2021-10-15 11:24:10 +02:00
3022e190a2 Fix is_repeat being set for in between mouse-move events 2021-10-15 20:17:51 +11:00
d649b4b066 Fix crash using menu search without an active area 2021-10-15 17:52:01 +11:00
9a76dd2454 Fix some property shortcuts not showing in tooltip
Shortcut lookups for property buttons were only supported for a subset
of RNA types.

Replace inline data-path calculation with
WM_context_path_resolve_property_full.

Now the shortcut for the 3D View's overlay toggle (for e.g.) is shown.
2021-10-15 16:34:15 +11:00
beecd24fc6 Cleanup: use const for context argument 2021-10-15 16:32:06 +11:00
3ca2697001 Cleanup: clang-tidy 2021-10-15 16:32:06 +11:00
3ccdee7532 UI: View2D: Align vertical indicators to view
In editors with vertical scale indicators, such as Graph Editor,
Drivers, or VSE, display the values aligned to the view.

Also add a shadow (similar to the 3D View info) to improve readability when the text is on top of curves, strips, or other content.

{F10987240, size=full}

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12809
2021-10-15 02:54:10 +02:00
2055ef107a Geometry Nodes: Order selection inputs after geometry inputs
While there may be arguments for different positions of the selection
inputs, it's important to be consistent, and putting them right after
the corresponding geometry works well when there are multiple
geometry inputs. Addresses T91646.
2021-10-14 15:36:24 -05:00
89c7c115ce Geometry Nodes: Create empty components less often
Avoiding creating empty components can be a hassle for code that
interacts with a geometry set. One easy way to do that was calling
the functions that retrieved mutable access to geometry data directly,
like get_mesh_for_write. This commit makes it so that sort of direct
function does not create an empty component if there is no data.

Another way to create an empty component was calling the replace_*
methods with a null pointer. It's more convenient to have a nice API
that handles those cases without creating an empty component.

It's still convenient that the regular get_component_for_write adds
the component if it doesn't exist, because that's often a nice way to
add data to the geometry set.

Differential Revision: https://developer.blender.org/D12862
2021-10-14 12:43:36 -05:00
cddda70618 Geometry Nodes: Merge Conflict Cleanup
Removing a line that remained from a merge.
2021-10-14 12:22:33 -05:00
42a05ff6ea Geometry Nodes: Rename Nodes ID Names + Menu Org
Re-alphabetize the main add menu.

Rename Node ID Names:
FloatCompare => CompareFloats
AttributeCapture => CaptureAttribute
Boolean => MeshBoolean
CurveFill => FillCurve
CurveFillet => FilletCurve
CurveReverse => ReverseCurve
CurveSample => SampleCurve
CurveResmaple => ResampleCurve
CurveSubdivide => SubdivideCurve
CurveTrim => TrimCurve
MaterialReplace => ReplaceMaterial
MeshSubdivide => SubdivideMesh
EdgeSplit => SplitEdges

Differential Revision: https://developer.blender.org/D12865
2021-10-14 12:10:52 -05:00
17b8da7196 Geometry Nodes: Field version of mesh to curve node
This commit adds a fields version of the mesh to curve node, with a
field for the input selection. In order to reduce code duplication,
it adds the mesh to curve conversion to the new geometry module
and calls that implementation from both places.

More details on the geometry module can be found here: T86869

Differential Revision: https://developer.blender.org/D12579
2021-10-14 12:06:48 -05:00
1996efe7aa Python API: implement PoseBone.children via Bone.children.
Currently `PoseBone.children` is implemented by a linear scan of
the list of armature bones. This is doubly inefficient, since
not only is it scanning all bones, the `obj.data.bones` list
is actually synthetic and generated from Bone children lists.

Instead, use the `Bone.children` native RNA property.

Differential Revision: https://developer.blender.org/D12727
2021-10-14 19:44:37 +03:00
497d0400bd Fix another error in rB5e12e62a6a4e
The code was ignoring the icremental with small distances.
2021-10-14 13:31:17 -03:00
328b6f672b Fix error in rB5e12e62a6a4e 2021-10-14 13:27:23 -03:00
2289295555 GPUTexture: Fix assert when using stereo viewport with EEVEE
Stereo viewport means the depth buffer is use twice as often as a
framebuffer attachment.
2021-10-14 18:20:49 +02:00
5e12e62a6a Fix regression with incremental snap in Graph Editor
Regression introduced in {rBb0d9e6797fb8}.

Previously the Graphics Editor had a conflict with two different snap
types. Auto-Snap and Snap with Ctrl.

It is now clearer which snap should prevail.
2021-10-14 13:10:19 -03:00
b42ce0c54c Functions: Generic array data structure
Sometimes it's useful to pass around a set of values with a generic
type. The virtual array data structures allow this, but they don't
have logical ownership. My initial use case for this is as a return
type for the functions that interpolate curve attributes to evaluated
points, but a need for this data structure has come up in a few other
places as well. It also reduced the need for templates.

Differential Revision: https://developer.blender.org/D11103
2021-10-14 11:06:18 -05:00
5e8775a8da Fix T92030: crash when hovering over socket
This is the same fix as in rB24a965bb16c22e33752dfb6c22105b96a8649aeb.
2021-10-14 18:02:22 +02:00
a0f269f682 Cycles: Kernel address space changes for MSL
This is the first of a sequence of changes to support compiling Cycles kernels as MSL (Metal Shading Language) in preparation for a Metal GPU device implementation.

MSL requires that all pointer types be declared with explicit address space attributes (device, thread, etc...). There is already precedent for this with Cycles' address space macros (ccl_global, ccl_private, etc...), therefore the first step of MSL-enablement is to apply these consistently. Line-for-line this represents the largest change required to enable MSL. Applying this change first will simplify future patches as well as offering the emergent benefit of enhanced descriptiveness.

The vast majority of deltas in this patch fall into one of two cases:

- Ensuring ccl_private is specified for thread-local pointer types
- Ensuring ccl_global is specified for device-wide pointer types

Additionally, the ccl_addr_space qualifier can be removed. Prior to Cycles X, ccl_addr_space was used as a context-dependent address space qualifier, but now it is either redundant (e.g. in struct typedefs), or can be replaced by ccl_global in the case of pointer types. Associated function variants (e.g. lcg_step_float_addrspace) are also redundant.

In cases where address space qualifiers are chained with "const", this patch places the address space qualifier first. The rationale for this is that the choice of address space is likely to have the greater impact on runtime performance and overall architecture.

The final part of this patch is the addition of a metal/compat.h header. This is partially complete and will be extended in future patches, paving the way for the full Metal implementation.

Ref T92212

Reviewed By: brecht

Maniphest Tasks: T92212

Differential Revision: https://developer.blender.org/D12864
2021-10-14 16:14:43 +01:00
47caeb8c26 Fix T91743: Unify behavior of 'Auto Set Preview Range'
This is available in the DopeSheet, GraphEditor, and NLA Editor.

Currently:
- Dopesheet advertises to take selection into account...
-- ...but doesnt - which might be a mistake in rBe3842d1ca4dd
- Graph Editor does not mention selection...
-- ...and also does not take it into account
- NLA does not mention selection...
-- ...but takes it into account

Now:
- make them **all** take selection into account (you can still do a
quick 'Select All' prior to get the full range -- better than not being
able to set this based on selection)
- mention this for all in the tooltip
- also reword to 'Set Preview Range to Selected' since using the term
'Auto' impilies this would change on selection change.

Maniphest Tasks: T91743

Differential Revision: https://developer.blender.org/D12651
2021-10-14 16:29:04 +02:00
Charlie Jolly
2341ca990c Geometry Nodes: Add White Noise texture
Port White Noise shader to geometry nodes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12719
2021-10-14 14:56:48 +01:00
55cf9bb5e6 Cleanup: fix const discard warning
No functional changes.
2021-10-14 15:34:29 +02:00
Charlie Jolly
25a255c32a Nodes: add boilerplate for image sockets
The sockets are not exposed in any nodes yet.
They work similar to the Object/Collection/Texture sockets,
which also just reference a data block.

Based on rB207472930834

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12861
2021-10-14 14:19:32 +01:00
138aa20959 Cleanup: asset browser, remove invalid assertion
Remove `BLI_assert_unreachable()` in a spot that is actually easily
reachable. To reach, follow these steps:
- Configure three asset libraries (say A, B, and C) in preferences
- Set the asset browser to library C and save the file
- Remove asset library C from the preferences
- Reopen the file.
2021-10-14 15:16:16 +02:00
Paul Golter
240345842d Filebrowser: Expose file select functions for File Browser to Python API.
This patch adds activate_file_by_relative_path(relative_path="") and
deselect_all() function to the space api of the File Browser. While the
first sets the active file and adds it to the selection based on a
relative path to the current File Browser directory the second one
deselects all files but does not change the active file.

Differential Revision: https://developer.blender.org/D12826
Reviewed by: Julian Eisel
2021-10-14 14:42:43 +02:00
9ca567bc4e Geometry Nodes: Reorganize Add Menu
- Move Converters to 'From' menus
  - Create Instances Menu
  - Realphabetize the Curve Menu

  Differential Revision: https://developer.blender.org/D12860
2021-10-14 06:41:52 -05:00
56b35991bc Alembic: avoid crash when Cycles is not enabled
The Alembic/CacheFile modifier supports Cycles procedurals when Cycles
is configured to use experimental features; the check for this would
segfault on builds with `WITH_CYCLES=OFF`. This is now fixed by adding
an extra NULL check.
2021-10-14 12:55:33 +02:00
42d79a6041 Fix T91398 Overlay: Camera BG jitter offset (regression)
This was caused by camera background being rendered in world space, causing
floating point imprecision issues when camera was far from origin.

Adding a uniform to change vertex shader to process everything in viewspace
to fix the problem.
2021-10-14 11:49:34 +02:00
583939c54d Fix T92200: VSE: 2D Cursor position missing viewport update
Was using notifier from wrong space (copy-paste error in rBd04d27b406b8).
2021-10-14 11:03:44 +02:00
aa46459543 Fix shadow catcher behind transparent object on GPU
The assumption about absent shadow path was wrong.

The rest of the changes are to ensure shadow paths are finished prior
to the split, so that they write to the proper passes.

The issue was caught by running regression tests on OptiX.

Differential Revision: https://developer.blender.org/D12857
2021-10-14 09:39:38 +02:00
4f5ef3b018 WM: quiet output of delete object operator
Object deletion was reporting the number of objects deleted,
causing tests to print noisy output.

Now this is information is only included when invoked.
2021-10-14 16:41:40 +11:00
3be2d6078f Cleanup: remove historic reference from makesdna.c
We have mostly removed information about original authors,
as this information isn't so useful.
2021-10-14 16:41:38 +11:00
a620ce7e54 Cleanup: use dot-points for appdir platform specific paths 2021-10-14 16:41:37 +11:00
f12ea3d52e Cleanup: reserve C++ comments for disabled code 2021-10-14 16:41:35 +11:00
5fec6eda55 Cleanup: silence Clang missing-braces warning. 2021-10-14 10:06:16 +05:30
a059d16f65 Geometry Nodes: Add Offset Option to Set Postion
Add a boolean field to the Set Position Node. This value allows
for each point to either have its position set to the input position
value or have the input value added to the current position.

Differential Revision: https://developer.blender.org/D12773
2021-10-13 23:33:46 -05:00
5401fda412 Cleanup: avoid using size for array length in naming
Confusing when array allocation takes two kinds of size arguments.
2021-10-14 14:06:49 +11:00
576142dc85 Cleanup: pass the sizeof(..) as the second arg for array allocation
By argument naming and convention this is the intended argument order.
2021-10-14 13:00:24 +11:00
c6e956bbb1 Fix compile error with 'WITH_CXX_GUARDEDALLOC' 2021-10-13 22:00:21 -03:00
9dff3de6ac Cleanup: clang-tidy, clang-format & spelling 2021-10-14 08:57:50 +11:00
685ceaa2f7 Fix reference counting error for world drag & drop
Error in 986d60490c
2021-10-14 08:57:14 +11:00
8434aa1b78 Fix invalid arguments to ED_gizmotypes_snap_3d_context_ensure 2021-10-14 08:57:13 +11:00
8278ad3dfb Fix T90799: Box/Ellipse Mask node masking is off-centered
This is especially noticeable when using the default center with full
width and height as some borders are masked by 1 pixel.

The relative coordinates are now calculated respect the last ones
instead of the dimensions for centering, and the limits
are inclusive to mask more accurately.
2021-10-13 23:41:14 +02:00
a3610c451a Fix Compositor stack use after scope
Caused by {rBf84fb12f5d72433780a96} after changing
`get_areas_to_render` to return a vector instead of a span.
2021-10-13 23:41:14 +02:00
f609b05b11 Cleanup: use _ suffix for non-public data members in Compositor
For code style and clarity.
2021-10-13 23:41:14 +02:00
1c42d4930a Cleanup: convert camelCase naming to snake_case in Compositor
To convert old code to the current convention and
use a single code style.
2021-10-13 23:41:14 +02:00
a2ee3c3a9f Cleanup: replace members m_ prefix by _ suffix in Compositor
To convert old code to the current convention and
use a single code style.
2021-10-13 23:41:14 +02:00
ea79efef70 Cleanup: remove this-> for m_ prefixed members in Compositor
For cleaning old code style as new code usually omit it.
2021-10-13 23:41:14 +02:00
ecb8a574c7 Cleanup: remove unused includes in Compositor
And move unneeded includes in frequently used headers
to source files.

Slightly reduces compile time.
2021-10-13 23:41:14 +02:00
91c33c8b99 Cleanup: Snap Context Refactor
Move runtime parameters out of context creation.

Not being able to choose another region and v3d limits the use of the
snap API.
2021-10-13 17:43:29 -03:00
988b9bc40c Fix T92192: Inconsistent curve circle primitive direction
Switch sin and cosine so that the points in the circle have the same
direction in both radius and points modes.
2021-10-13 14:34:14 -05:00
1ae79b704a Fix T92180: Curve subdivide incorrect result for poly splines
The node shifted all new points forward in the spline, so the first
point would appear to be removed.
2021-10-13 14:28:05 -05:00
10abaf3ddf Fix T88766 EEVEE: Missing glossy reflections with Shader to RGB & SSR is active.
This was due to the shading evaluation being outdated inside the ShaderToRGBA
glsl code.
2021-10-13 20:51:15 +02:00
d39cd851c0 Fix T89777 EEVEE: Contact Shadows causes wrong shading in Reflection Plane
The planar reflections being rendered at the same resolution as the HiZ max
buffer, do not need any uv correction during raytracing.

However, the GTAO horizon buffer being at output resolution do need the
uv factors in order to match the pixels visible on screen. To avoid many
complication, we increase the size of the GTAO texture up to the hiz buffer
size. This way, if planar reflections need GTAO the texture is big enough.
We change the viewport of the GTAO framebuffer for the main view in order
to not have to modify Uvs in many places.
2021-10-13 19:58:14 +02:00
98a62a5c08 Geometry Nodes: Material Index - minor cleanup
- Add a versioning comment
  - Indexes to Indices
2021-10-13 12:32:28 -05:00
366cea95c5 Geometry Nodes: Fields version of edge split node
This changes the edge split node to have a selection input, which is
more aligned with the other design changes. This loses the ability to
split edges based on an angle, but the edge angle can be added as a
field input node in the future, which will make for a much more
flexible system.

Differential Revision: https://developer.blender.org/D12829
2021-10-13 11:34:29 -05:00
96876305e1 Geometry Nodes: Make attribute capture work on instances
Previously the attribute capture node only worked on realized geometry,
which was very confusing when other nodes worked on each individual
instance. The realize instances node is the way to explicitly change
between the two behaviors. Addresses T92155.

Differential Revision: https://developer.blender.org/D12841
2021-10-13 11:26:23 -05:00
Erik Abrahamsson
78445ebd5f Geometry Nodes: Rotate Instances Node
Adds a node that can rotate each of a geometry's instances in global
(to the modifier object) or local space (of each point) by a specified
angle around a pivot point.

In the future, separating the local-global choice for the pivot and the
rotation might be useful. However, for now the node is kept simple.

Differential Revision: https://developer.blender.org/D12682
2021-10-13 09:42:10 -05:00
51ea08487b Fix T92185: GPencil memory leak removing stroke from python
The API was not removing the weights, points and traingulation data. Only it was removing the stroke itself.
2021-10-13 16:22:31 +02:00
Jesse Yurkovich
92b7bf4856 Cleanup: Remove data duplication from SMAA lookup tables
These 2 large tables, `areaTexBytes` and `searchTexBytes`, contributed
~176kb worth of duplicate data into the `blender` executable due to the
header being used in multiple places. We were lucky that only 2
translation units had included this header so only 1 duplicate copy of
each was wasted.

Define the tables as `extern` to address this.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D12723
2021-10-13 16:20:51 +02:00
Erik Abrahamsson
6c11b320c4 Geometry Nodes: Scale Instances Node
Adds a node that can scale a geometry's instances. With "Local" turned
on, the instance is scaled individually from the center point input,
while when local space is turned off, it's more like the transform
node, except it scales outward from the center point instead of only
from the origin.

Differential Revision: https://developer.blender.org/D12681
2021-10-13 09:10:06 -05:00
d0a4a41b5d Geometry Nodes: Add Selection to Instance on Points
Add a boolean selection field to the Instance on Points node.
This will select which points from the source geometry will be used
to create the instances.

Differential Revision: https://developer.blender.org/D12847
2021-10-13 09:06:09 -05:00
Erik Abrahamsson
9d49fc2ba0 Geometry Nodes: Translate Instances Node
Adds a node that can translate instances in the transform space of
the modifier object, or the local space of their original transform.
One reason to have a special node for instances is that they always
have the existing transform, unlike mesh or point cloud points.

Differential Revision: https://developer.blender.org/D12679
2021-10-13 09:02:29 -05:00
356dce13f0 Fix T92136: Leak accessing evaluated depsgraph data from Python
Copy-on-write data blocks could be referenced from python but were not
properly managing python reference counting.

This would leak memory for any evaluated data-blocks accessed by Python.

Reviewed By: sergey

Ref D12850
2021-10-14 00:53:09 +11:00
c29f20a521 Cleanup: Remove unused code paths in the depsgraph copy-on-write
Seems to be residue from an early 2.80 days: the placeholder code path
is no longer used.

Remove all the tricky code for this, and make it clear that the
`deg_expand_copy_on_write_datablock` is used on an non-expanded
datablock.

Should be no functional changes. And should help simplify D12850.

Differential Revision: https://developer.blender.org/D12852
2021-10-13 15:47:07 +02:00
e659f78d3e Cleanup: use typedef struct for BLODataBlockInfo. 2021-10-13 15:44:36 +02:00
24cc552cf4 Geometry Nodes: Material Index, Set Material
Add Get/Set Nodes for Material Index
Rename Assign Material to Set Material

Differential Revision: https://developer.blender.org/D12837
2021-10-13 08:41:35 -05:00
d4e8390e95 Fix T92153: use-after-free with anonymous attributes
Differential Revision: https://developer.blender.org/D12851
2021-10-13 15:37:17 +02:00
Pablo Vazquez
5183653951 UI: Make menu item use theme roundness
Menu items ignore the roundness setting since they spread left to right.
This patch makes it so menu items use the theme preference instead of
hardcoded square corners. Providing more flexibility to themes.

All built-in and included themes already have this set so no need to update them. For the default themes (Dark/Light) roundness is 0.4.

{F10950727, size=full}

The motivations behind this change are:
* To be more consistent with other widgets.
* Improve themes flexibility.
* Match padding with other elements that have like the Search field:

{F10950746, size=full}

Reviewed By: #user_interface, Severin

Differential Revision: https://developer.blender.org/D12813
2021-10-13 14:31:03 +02:00
72e81a45c4 Extern: Add modifications diff for TinyGLTF
This should have been added in ee49991999.
2021-10-13 20:56:27 +09:00
Bastien Montagne
59113df8ec Fix T92113: On assets, replace "Fake User" button with "Clear Asset" button.
Change is simple enough, but we abuse a bit the UI code here to get a
similar 'look' as the fake user button for the new Asset one, while
still being able to call an operator instead of editing directly a RNA
value.

Reviewed By: Severin, sybren

Maniphest Tasks: T92113

Differential Revision: https://developer.blender.org/D12839
2021-10-13 13:35:17 +02:00
8c0698460b Revert "Fix T92136: Leak accessing evaluated depsgraph data from Python"
This reverts commit 0558907ae6.

Based on discussion with Sergey, having Python references to un-expanded
data should not happen - this change needs to be reconsidered.
2021-10-13 21:29:30 +11:00
f71d479556 Fix Cycles viewport after session reset
Happens i.e. when changing compute device.

A more proper follow-up to the on-demand display driver creation change.
2021-10-13 12:01:18 +02:00
0558907ae6 Fix T92136: Leak accessing evaluated depsgraph data from Python 2021-10-13 20:59:56 +11:00
86536e7859 Fix Cycles assert in viewport after recent change
Create display early on, so that ready_to_reset() passes assert test
for use for display actually configured.
2021-10-13 11:46:38 +02:00
f12513a21c Fix Cycles backing issues when using multiple devices
The pixel accessor was not aware of possible offset in the
pixel padding causing some slices of the result not being
properly padded.
2021-10-13 11:20:25 +02:00
9c412b6e2d Fix possible integer overflow in Cycles baking
Ensure math happens on size_t type instead of int followed by a cast
to the size_t.
2021-10-13 11:20:25 +02:00
William Leeson
3021babf38 Fix: Stops assert when baking in debug mode.
When baking in a debug build running gdb it kept asserting because a GL context was being created outside the main thread.

To fix this the patch only creates the GL context is only created for rendering (when it is actually used).

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D12767
2021-10-13 11:09:22 +02:00
53af51ad50 Geometry Nodes: Add "XYZ" label to instance on points scale 2021-10-12 17:43:41 -05:00
9e3c84a5d6 Geometry Nodes: Add units to set radius node inputs 2021-10-12 17:33:59 -05:00
Erik Abrahamsson
351721d0ea BLI: Overload float4x4 multiplication-assignment operator
This looks a lot nicer than writing `mul_m4_m4_post` instead.

Differential Revision: https://developer.blender.org/D12844
2021-10-12 16:59:06 -05:00
f18ab3470f Fix T91809: Crash on undo with empty field inferencing
Some runtime data that stores which sockets can be fields and which
can't is not stored in the file, but only calculated when necessary.
When opening a file, the node tree update function was called, which
recalculated this data, but that was explicily turned off for undo.

This exposes a fundamental issue with undo, the ID caching system for
undo, and how it relates to node trees in particular. Ideally this call
couldn't be necessary at all. In the future it could be removed by
adding a runtime struct to node trees, and calculating its contents
on-demand instead of preemtively.

Differential Revision: https://developer.blender.org/D12699
2021-10-12 15:38:56 -05:00
9d03990e32 Fix T92160: Geometry Proximity node can produce invalid values
Check when the node fails to create BVH trees, and fill the result
with zero in that case, which is most likely the expected value when
the node encounters an error. Warnings will be added with a separate
patch.
2021-10-12 15:28:11 -05:00
eb56e8cd78 Cleanup: Fix comment formatting and grammar 2021-10-12 14:14:09 -05:00
a6da1884ba Asset Catalogs: Refresh catalog simple name when assigning catalog ID
When assigning a new catalog ID to an asset, also refresh the "catalog
simple name". This "simple name" is stored on the asset metadata next to
the catalog UUID, to allow some emergency data recovery when the catalog
definition file is somehow lost.
2021-10-12 18:07:58 +02:00
Wannes Malfait
5e3877e0c8 Fix T92149: Crash in delete geometry node after curve fill node
There was only a check for the component but not for if it was empty.
Because the curve fill node produces an empty curve component, a
nullptr was read, causing a crash. Generally nodes shouldn't produce
empty components, but currently we cannot rely on that fact.

Differential Revision: https://developer.blender.org/D12838
2021-10-12 10:58:38 -05:00
Wannes Malfait
0c7e836a1d Fix T92150: Incorrect invert in Delete Geometry node
The selection was inverted when deleting points from a spline.

Differential Revision: https://developer.blender.org/D12840
2021-10-12 10:57:12 -05:00
ad80248875 Revert "GHOST: Unify behavior of offscreen context creation"
Commited by mistake

This reverts commit 6535779c92.
2021-10-12 17:54:52 +02:00
72a47fea5d Fix dragging objects from Outliner to 3D View broken
A dragged & dropped wouldn't be duplicated anymore, it would just be moved to
the drop position.

Caused by c8fcea0c33.
2021-10-12 17:49:59 +02:00
c63fb657c8 Cleanup: use nullptr instead of NULL in C++ code. 2021-10-12 17:16:20 +02:00
45f167237f Fix T91981: Crash when using operators that needs scene depth
There was a double lock in the object depth drawing function.
Also the texture read was not reading the texture with the right
format. Now it needs a conversion.

Fix T91981 Particle Edit make Blender Crash
Fix T92006 Light spot interactively point can't use
2021-10-12 16:47:42 +02:00
6535779c92 GHOST: Unify behavior of offscreen context creation
This makes sure the previously bound context is restored after creating a
new context. This follows what is already happening on windows.

All system backend are patched.

This also removes the goto and some code duplication.

Differential Revision: https://developer.blender.org/D12455
2021-10-12 16:47:41 +02:00
a2daf92a57 Fix warning about deleted default constructor declared as default
Since `AssetCatalogPath` isn't default constructible (unlike the
previous `CatalogPath`, alias `std::string`), `AssetCatalog` isn't
default constructible either. But its default constructor is declared
with `= default` which Apple Clang was warning about.

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

Reviewed by: Sybren Stüvel
2021-10-12 16:40:02 +02:00
1db42c9b79 Address warning about breaking copy elision of temporary object
Using `std::move()` on temporary objects prevents copy elision done by
compilers. Apple Clang warns about this.

Generally `std::move()` should be used sparingly:
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
2021-10-12 16:28:48 +02:00
aaf3a63dca Cleanup: Typo in comment. 2021-10-12 16:18:50 +02:00
c1a1644db7 Cleanup: Attempt to fix benign macOS compile warnings 2021-10-12 09:13:21 -05:00
30cd1d10a9 Asset Browser: Remove catalog deletion confirm prompt
This confirmation popup was added when deletion was a destructive action that
would be written to disk immediately, with no way to undo. Now we only write
such changes to disk on .blend file save, plus there's undo/redo support for
catalog edits now. In such cases confirmation popups should be avoided.
2021-10-12 15:49:57 +02:00
b7b2103cf7 Asset Catalogs Undo: add Ctrl+Z and Ctrl+Shift+Z as hotkeys for undo/redo
Allow undo/redo of asset catalog edits with Ctrl+Z/Ctrl+Shift+Z. These
keys are registered in the 'screen' keymap, so that they can take
priority over the global undo/redo operators.

Updated both Blender Default and Industry Compatible keymaps.
2021-10-12 15:12:48 +02:00
7867feae56 Asset Catalogs: mark 'undo push' operator as internal
Mark the `ASSET_OT_catalog_undo_push` operator as internal, as it's not
meant for artists to use directly.
2021-10-12 15:11:13 +02:00
a7300a217d Asset Catalog Undo: send notifiers to redraw the catalog tree
Send notifiers to redraw the catalog tree after undo/redo.
2021-10-12 15:10:50 +02:00
74ea21ec9d Asset Catalogs: expose undo/redo operators to UI
Ensure that catalog operations create an undo snapshot, and show
undo/redo operators in the asset browser.

A hidden operator `ASSET_OT_catalog_undo_push` is also added such that
add-ons can also set undo snapshots if they need.
2021-10-12 14:45:11 +02:00
f1d97a308d Cleanup: asset catalogs, rename store_undo_snapshot to undo_push
Rename `bke::AssetCatalogService::store_undo_snapshot` to `undo_push`.
This makes the function named the same way as the global Blender "undo
push" function.

No functional changes.
2021-10-12 14:42:36 +02:00
3a03d6c851 Fix: Incorrect error message in set spline resolution node
Caused by my own refactoring before committing the patch.
2021-10-12 07:24:25 -05:00
a06435e43a Asset Catalogs: undo stack for catalog edits
Add an undo stack for catalog edits. This only implements the backend,
no operators or UI yet.

A bunch of `this->xxx` has been replaced by `catalog_collection_->xxx`.
Things are getting a bit long, and the class is turning into a god
object; refactoring the class is tracked in T92114.

Reviewed By: Severin

Maniphest Tasks: T92047

Differential Revision: https://developer.blender.org/D12825
2021-10-12 12:42:44 +02:00
b67a937394 Assets: hide low-level catalog info behind "developer extra's"
Hide the catalog UUID and the catalog simple name from the Asset Browser
side-panel, unless "Developer Extra's" is enabled in the user prefs.
2021-10-12 12:17:47 +02:00
cc04399937 Fix missing Cycles volume stack re-allocation
Need to check allocation size, as the features do not change with
volume stack depth detection.
2021-10-12 11:55:23 +02:00
ad1735f8ed Asset Catalogs: recursive deletion of catalogs & children
Recursively delete asset catalogs with `AssetCatalogService:prune_...`
functions. This deletes the catalog and all of its children.

The old `delete_catalog` function has been renamed to
`delete_catalog_by_id()`, and is now a lower-level function (no deletion
of children, no rebuilding of the tree). The `prune_catalogs_by_path()`
and `prune_catalogs_by_id()` do delete children and do rebuild the
catalog tree.

Manifest task: T91634
2021-10-12 11:28:16 +02:00
ac657bee01 Tests: simplify asset catalog tree testing code
Simplify the testing code that verifies the asset catalog tree. It now
prints clearer error messages when things go wrong, and it gets simpler
data to test (instead of having to explicitly pass the parent count, it
just counts the number of separators in the expected path).

No functional changes to Blender.
2021-10-12 11:25:24 +02:00
Jeroen Bakker
29e5dc1b19 WindowManager: Keep track or the source library when appending.
Keep track of the source library allowing other parts of the code to
to make better decisions. This is needed to localize external files.

In this case the file paths are updated when `making local`.
But we should decide based on the source library if we want to
copy the file relative to the new blend file. See D12423.

Reviewed By: mont29, Severin

Differential Revision: https://developer.blender.org/D12765
2021-10-12 09:50:04 +02:00
690382bef5 Fix incorrect commet in appdir.c about cache locations. 2021-10-12 09:46:46 +02:00
e8dc02aa3f Fix build error due to conflicting types 2021-10-12 16:36:56 +09:00
9dda65455b XR Controller Support Step 4: Controller Drawing
Addresses T77127 (Controller Drawing).

Adds VR controller visualization and custom drawing via draw
handlers. Add-ons can draw to the XR surface (headset display) and
mirror window by adding a View3D draw handler of region type 'XR' and
draw type 'POST_VIEW'.  Controller drawing and custom overlays can be
toggled individually as XR session options, which will be added in a
future update to the VR Scene Inspection add-on.

For the actual drawing, the OpenXR XR_MSFT_controller_model extension
is used to load a glTF model provided by the XR runtime. The model's
vertex data is then used to create a GPUBatch in the XR session
state. Finally, this batch is drawn via the XR surface draw handler
mentioned above.

For runtimes that do not support the controller model extension, a
a simple fallback shape (sphere) is drawn instead.

Reviewed By: Severin, fclem

Differential Revision: https://developer.blender.org/D10948
2021-10-12 16:18:05 +09:00
cfa59b3fab Cleanup: remove unused parameter 2021-10-12 16:13:24 +09:00
eb8afc39f8 Tests: remove noisy output from bl_pyapi_idprop_datablock
As part of expected behavior this printed an exception,
making it seem as if there was an error in the test.

Now the exception is suppressed from the output, ensuring it matches
an the expected output.
2021-10-12 17:58:52 +11:00
6139782d81 Tests: script_pyapi_idprop now cleans up after it's self
This test left blend files in the users temporary directory.
2021-10-12 17:58:52 +11:00
3d35d4a9e5 Tests: support running ID-property test without numpy 2021-10-12 17:57:38 +11:00
7b0b050dd5 Tests: quiet warning for UIList class name 2021-10-12 17:57:37 +11:00
fe958d7d99 Fix leak on exit when WITH_PYTHON_SAFETY is enabled
The lead only occurred when Python references were leaking as well.
2021-10-12 17:55:02 +11:00
c1c6c11ca6 Cleanup: spelling in comments 2021-10-12 17:55:02 +11:00
a91c6f1804 Cleanup: quiet undefined warning 2021-10-12 17:52:33 +11:00
Jeroen Bakker
70fd6a313e GHOST: Add option to request (user) cache folder.
Introduces `BKE_appdir_folder_caches` to get the folder that
can be used to store caches. On different OS's different folders
are used.

- Linux: `~/.cache/blender/`.
- MacOS: `Library/Caches/Blender/`.
- Windows: `(%USERPROFILE%\AppData\Local)\Blender Foundation\Blender\Cache\`.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12822
2021-10-12 08:42:25 +02:00
8f66f40318 Silence compilation warning in wm_xr_session. 2021-10-12 08:41:12 +02:00
cdeb506008 XR Controller Support Step 3: XR Events
Integrates XR input actions with the WM event system. With this commit,
all VR action functionality (operator execution, pose querying, haptic
application), with the exception of custom drawing, is enabled.

By itself, this does not bring about any changes for regular users,
however it is necessary for the upcoming VR add-on update that will
expose default controller actions to users.

For add-on developers, this updates the Python API with access to XR
event data (input states, controller poses, etc.), which can be
obtained via the "xr" property added to the bpy.types.Event struct.
For XR events, this property will be non-null and the event will have
the type XR_ACTION.

Further details:
XR-type window events are queued to the regular window queues after
updating and interpreting VR action states. An appropriate window is
found by either using the window the VR session was started in or a
fallback option.

When handling XR events, mouse-specific processing is skipped and
instead a dedicated XR offscreen area and region (see 08511b1c3d) is
used to execute XR event operators in the proper context.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D10944
2021-10-12 13:48:12 +09:00
4b31a21bcd Geometry Nodes: Use a separator in the add menu input category
This can help separate the field inputs from the other nodes,
like some other categories.
2021-10-11 18:14:03 -05:00
Charlie Jolly
f7ef68514b Geometry Nodes: Add Color input node
Adds a color input node with picker.

Differential Revision: https://developer.blender.org/D12793
2021-10-11 23:43:01 +01:00
Charlie Jolly
e005ad5b54 Fix T92103: Update BLI hash_float_to_float functions to be shader compatible
Previously the functions called `hash_float` instead of `uint_to_float_01`.
This meant that the float was hashed twice instead of once.
The new functions are also compatible with Cycles/Eevee.

Differential Revision: https://developer.blender.org/D12832
2021-10-11 22:59:04 +01:00
Jarrett Johnson
ca8e8fd8d4 Fix T92102: Issues with align euler to vector node
For fixed pivots, make sure the correct pivot axis is being used.
Also add continues or invalid rotations.

Differential Revision: https://developer.blender.org/D12824
2021-10-11 13:26:31 -05:00
d993c7b503 Fix recently added File Browser name/path getters not allowing unicode
The `FileSelectEntry.name` and `FileSelectEntry.relative_path` members
should support unicode strings like any file names & paths, but didn't.
2021-10-11 18:28:34 +02:00
db851ccd2a Fix T92056: empty sampling pattern in Cycles when opening some existing files 2021-10-11 18:22:54 +02:00
a94343a8af Cycles: improve SSS Fresnel and retro-reflection in Principled BSDF
For details see the "Extending the Disney BRDF to a BSDF with Integrated
Subsurface Scattering" paper.

We split the diffuse BSDF into a lambertian and retro-reflection component.
The retro-reflection component is always handled as a BSDF, while the
lambertian component can be replaced by a BSSRDF.

For the BSSRDF case, we compute Fresnel separately at the entry and exit
points, which may have different normals. As the scattering radius decreases
this converges to the BSDF case.

A downside is that this increases noise for subsurface scattering in the
Principled BSDF, due to some samples going to the retro-reflection component.
However the previous logic (also in 2.93) was simple wrong, using a
non-sensical view direction vector at the exit point. We use an importance
sampling weight estimate for the retro-reflection to try to better balance
samples between the BSDF and BSSRDF.

Differential Revision: https://developer.blender.org/D12801
2021-10-11 18:22:54 +02:00
73a05ff9e8 Cycles: restore Christensen-Burley SSS
There is not enough time before the release to improve Random Walk to handle
all cases this was used for, so restore it for now.

Since there is no more path splitting in cycles-x, this can increase noise in
non-flat areas for the sample number of samples, though fewer rays will be traced
also. This is fundamentally a trade-off we made in the new design and why Random
Walk is a better fit. However the importance resampling we do now does help to
reduce noise.

Differential Revision: https://developer.blender.org/D12800
2021-10-11 18:22:54 +02:00
40360253ae Fix T86671: Background Scene Dupliface Not Instanced.
Use depsgraph's objects iterator to find sources of dupliobjects,
instead of looping over bases of a viewlayer.
2021-10-11 18:18:51 +02:00
bb6cc67d05 UI: Reduce whitespace in custom node categories
This makes the long "Curve" category take up less space.
2021-10-11 11:10:39 -05:00
Johnny Matthews
c1b4abf527 Geometry Nodes: Add Nodes to Get/Set Built-in Attributes
This commit implements T91780, adding nodes to get and set builtin
attributes. Individual set nodes are used so that the values can be
exposed for direct editing, which is useful for attributes like shade
smooth and spline resolution. Individual input nodes are used to allow
reusing nodes for multiple components, and to allow grouping multiple
outputs conceptually in the same node in the future.

Input Nodes
 - Radius
 - Curve Tilt
 - Curve Handle Positions
 - Is Shade Smooth
 - Spline Resolution
 - Is Spline Cyclic

'Set' Nodes
 - Curve Radius
 - Point Radius
 - Curve Tilt
 - Curve Handle Positions
 - Is Shade Smooth
 - Spline Resolution
 - Is Spline Cyclic

Using hardcoded categories is necessary to add separators to the node
menu.

Differential Revision: https://developer.blender.org/D12687
2021-10-11 11:03:57 -05:00
83f87d9f21 Cleanup: Asset Catalogs, add divider between sections in code
No functional changes.
2021-10-11 18:00:11 +02:00
3de76a067a Cleanup: Asset Catalogs, add type alias for asset catalog maps
Add alias for `Map<CatalogID, std::unique_ptr<AssetCatalog>>` to make the
rest of the code a bit simpler.

No functional changes.
2021-10-11 18:00:11 +02:00
ecedef09e7 Geometry Nodes: Rename 12 Nodes to be "Verb First"
Attribute Capture => Capture Attribute
Curve Fill => Fill Curve
Curve Fillet => Fillet Curve
Curve Reverse => Reverse Curve
Curve Sample => Sample Curve
Curve Subdivide => Subdivide Curve
Curve Trim => Trim Curve
Material Assign => Assign Material
Material Replace => Replace Material
Mesh Subdivide => Subdivide Mesh
Float Compare => Compare Float
Boolean => Mesh Boolean

Differential Revision: https://developer.blender.org/D12798
Task: https://developer.blender.org/T91682
2021-10-11 10:38:45 -05:00
cae4d8637c Cleanup: match parameter name in function declaration and implementation. 2021-10-11 16:08:28 +02:00
4703e125bf Fix active pixels overlay for Cycles viewport
It got missed in some of previous development.

Can not see a reason why the line needed to be removed, maybe just some
accident.
2021-10-11 15:59:07 +02:00
Wannes Malfait
9c00486451 Geometry Nodes: Separate and Delete Geometry for fields
Delete Geometry:
This adds a copy of the old node in the legacy folder and updates the
node to work with fields. The invert option is removed, because it is
something that should be very easy with fields, and to be consistent
with other nodes which have a selection. There is also a dropdown to
select the domain, because the domain can't be determined from the
field input. When the domain does not belong on any of the components
an info message is displayed.

Separate Geometry:
A more general version of the old Point Separate node. The "inverted"
output is the same as using the delete geometry node.

Differential Revision: https://developer.blender.org/D12574
2021-10-11 08:38:02 -05:00
275d0d3397 Cleanup: Spelling in comment 2021-10-11 14:01:42 +02:00
eca2a41964 Cycles: Improve volume stack size calculation
Only count volume objects after shader optimization.

Allows to discard objects which don't have effective volume
BSDF connected to the shader output (i.e. constant folded,
or non-volume BSDF used by mistake).

Solves memory regression reported in T92014.

There is still possibility to improve memory even further
for cases when there are a lot of non-intersecting volume
objects, but that requires a deeper refactor of update
process. Will happen as a followup development.

Differential Revision: https://developer.blender.org/D12797
2021-10-11 14:01:42 +02:00
a82c9e1e40 Fix T91169: bpy_extras.io_utils.create_derived_objects -> duplis error
This function now takes a depsgraph and a list of objects to avoid
inefficient O(n^2) iteration when extracting instances from all objects
in the scene. Returning an object -> instance map.

Note that keeping compatibility with the existing API wasn't practical
in this case since instances can no longer be generated from the scene
and it's objects.
2021-10-11 21:35:38 +11:00
0ceded7bc9 Cycles: Introduce scene host_update function
The longer-term goal is to separate host-only scene update
from device update: make it possible to make kernel features
depend on actual scene state and flags.

This change makes it so shaders are compiled before kernel
load, making checks like "has_volume" available at the
kernel features calculation state.

No functional changes are expected at this point.

Differential Revision: https://developer.blender.org/D12795
2021-10-11 12:27:28 +02:00
Pratik Borhade
f9755add65 Fix T91785: Change max input limit for knife tool angle snapping
Patch changes the Knife Tool angle snapping input limit to 180.

Differential Revision: https://developer.blender.org/D12728
2021-10-11 11:10:37 +01:00
cc6ca13852 Fix T90634: Gizmo.target_set_value() crash without a valid property
Raise an exception when target properties have not been set.
2021-10-11 20:19:19 +11:00
a6d34f4c3f Cleanup: add utility functions to parse gizmos and target properties 2021-10-11 20:14:15 +11:00
6e92a2d591 Cleanup: make format (VSE) 2021-10-11 10:10:54 +02:00
813ca82f1e Fix T92080: Background of Node editors appear brighter than before
In the original code depth=0 meant that there was no parents. But with
BLI_listbase_count we have depth 1 in those cases.

Differential Revision: https://developer.blender.org/D12817
2021-10-11 10:10:13 +02:00
a282efecbc Cleanup: Add const keyword to BKE_packedfile_id_check. 2021-10-11 09:40:22 +02:00
bdd2a7f466 Doc: expand on docstring for PyC_Long_AsBool 2021-10-11 15:33:42 +11:00
fef4dc7269 Fix starting Blender with Python 3.10
URL presets weren't working, raising a Python exception
when the splash screen was displayed.
2021-10-11 12:58:12 +11:00
d2454487d1 Fix: Incorrect custom property edit string to int change
This fixed an error in a corner case, and is a reasonable check anyway.
2021-10-10 20:53:56 -05:00
1bfa9539d3 Fix T91889 Exact boolean sometimes drops triangles.
The problem is that the fast triangulator (based on polyfill)
sometimes makes degenerate triangles. Commit 8115f0c5bd91f had
a check for degenerate triangles but it wasn't thorough enough.
This commit uses a more thorough (and pessimistic) test for
degenerate triangles, using the exact triangulator in those cases.
2021-10-10 19:54:02 -04:00
Jarrett Johnson
79425ed326 Geometry Nodes: Align Euler to Vector Node
This commit introduces the Align Euler to Vector function node which
rotates to a body into a given direction. The node replaces the legacy
"Align Rotation to Vector" node, which only worked on an attribute
named `rotation` internally. The "Euler" in the name is meant to make
it clearer that the rotation isn't interchangeable with a regular
vector.

Addresses T91374.

Differential Revision: https://developer.blender.org/D12726
2021-10-09 14:40:37 -05:00
2561145da8 Fix T91096: VSE use after free with overwrite enabled
Strip was flagged for deletion in `seq_transform_handle_overwrite()`
on `STRIP_OVERLAP_IS_FULL`. Then it is removed in
`SEQ_edit_strip_split()` before it should be.

Handle `STRIP_OVERLAP_IS_FULL` in separate loop.

This may not be complete solution, because in example file overlap is
caused between 2 transformed strips and one that is "static".
Such operation should not be possible in first place. This fixes the
crash at lest, so improvement in behavior can be handled separately.

Differential Revision: https://developer.blender.org/D12751
2021-10-09 10:11:10 +02:00
e541f37529 Fix T91978: VSE box select substract doesn't work
Substract and add modes were not implemented. Add logic to handle these
modes.
2021-10-09 10:08:31 +02:00
27ac80f068 VSE: rename flag for Frame Overlay feature
Rename `SEQ_EDIT_OVERLAY_SHOW` to `SEQ_EDIT_USE_FRAME_OVERLAY` to avoid
confusion between `SEQ_SHOW_OVERLAY` of `SpaceSeq.flag`
2021-10-09 08:41:07 +02:00
13df8616ce VSE: Fix 2D cursor not visible
This was caused by confusing naming of frame overlay feature.
Correct flag to use is `sseq->flag & SEQ_SHOW_OVERLAY`, not
`ed->over_flag & SEQ_EDIT_OVERLAY_SHOW`.
2021-10-09 08:41:07 +02:00
6391949601 Cleanup: Change variable name, comment formatting 2021-10-09 01:01:44 -05:00
728e31e18a Fix: Typo in UI error message 2021-10-09 00:55:11 -05:00
886196b888 Fix T92037: Custom property edit issues with integer soft range
- Fix a typo that used the max instead of the min for the soft max
- Assign the correct "last property type" when the operator starts
- Only check values for the soft range when use soft range is turned on
2021-10-08 15:02:23 -05:00
8f8982d57c Asset Browser: Context menu for catalogs
The context menu is a standard way to expose operations of the clicked
item to the user. They expect it to be there, and we can make use of it
as a place to put more advanced operations in.

The menu contains:
* New Catalog
* Delete Catalog
* Rename

Also removes the 'x' icon to delete a catalog from the right side of a
row. This was just placed there temporarily until the context menu is
there. It's too easy to accidentally delete catalogs with this.
2021-10-08 20:09:42 +02:00
17c928e975 UI: Add context menu support for tree-view items
Tree-view items can now easily define their own context menu. This works
by overriding the `ui::AbstractTreeViewItem::build_context_menu()`
function. See the documentation:
https://wiki.blender.org/wiki/Source/Interface/Views#Context_Menus

Consistently with the Outliner and File Browser, the right-clicked item
also gets activated. This makes sure the correct context is set for the
operators and makes it clear to the user which item is operated on.

An operator to rename the active item is also added, which is something
you'd typically want to put in the context menu as well.
2021-10-08 20:08:22 +02:00
7bd0de9240 Asset Browser: Avoid per-asset context menu on right click in sidebar
The right-click keymap item to display the context menu was added for
the entire area, not just the main region.
2021-10-08 19:48:14 +02:00
3a65571195 Fix T90666: Toggling motion blur while persistent data is enabled results in artifacts
Enabling or disabling motion blur requires rebuilding the BVH of affected geometry and
uploading modified vertices to the device (since without motion blur the transform is
applied to the vertex positions, whereas with motion blur this is done during traversal).
Previously neither was happening when persistent data was enabled, since the relevant
node sockets were not tagged as modified after toggling motion blur.

The change to blender_object.cpp makes it so `geom->set_use_motion_blur()` is always
called (regardless of motion blur being toggled on or off), which will tag the geometry
as modified if that value changed and ensures the BVH is updated.
The change to hair.cpp/mesh.cpp was necessary since after motion blur is disabled,
the transform is applied to the vertex positions of a mesh, but those changes were not
uploaded to the device. This is fixed now that they are tagged as modified.

Maniphest Tasks: T90666

Differential Revision: https://developer.blender.org/D12781
2021-10-08 18:03:06 +02:00
94d2736dfb Fix T92046: Mesh to GPencil fails because materials are not created
This bug was introduced in D12190 because the list of types that support materials did not include GPencil and this caused all materials to be removed after they were created during conversion.
2021-10-08 16:49:45 +02:00
ff57ce8617 UI: Support showing superimposed icons as disabled (with disabled hint)
If the operator poll of a superimposed icon returned `false`, the
superimposed icon would just draw normally and fail silently. Instead it
will now be drawn grayed out, plus the tooltip of the icon can show the
usual "disabled hint" (a hint explaining why the button is disabled).
2021-10-08 16:31:16 +02:00
38c4888f09 Fix crash in the node editor in cases where nodetree was empty
This seems to happen only in a few files, and not so trivial to
reproduce from scratch.

The crash is real though, and this fixes it.

It also fix a wrong comment style that was introduced in the same faulty
commit.

Bug introduced on ebe2374528.

Differential Revision: https://developer.blender.org/D12794
2021-10-08 16:17:08 +02:00
0c684a7046 Fix T91999: wrong Cycles updates with mesh deformation, after recent changes 2021-10-08 16:11:02 +02:00
736be7cf58 Fix T91997: Cycles glass + SSS not rendering correctly 2021-10-08 16:11:02 +02:00
4d71138738 Docs: note that message-bus subscribers are reset on file load 2021-10-09 00:56:00 +11:00
bff3dcf330 WM: always reset message-bus on file load
Previously this was only happening when "Load UI" was enabled,
making it difficult for Python script authors to know when
re-registering subscribers was needed.
2021-10-09 00:55:47 +11:00
f01c4f27f9 Fix Cycles speed regression after dynamic volume stack change
Only copy required part of volume stack instead of entire stack.

Solves time regression introduced by D12759 and avoids need in
implementing volume stack calculation to exactly match what the
path tracing will do (as well as potentially makes scenes with
a lot of volumes ans a tiny bit of deeply nested ones render
faster).

Still need to look into memory aspect of the regression, but
that is for separate patch.

Ref T92014

Maniphest Tasks: T92014

Differential Revision: https://developer.blender.org/D12790
2021-10-08 15:44:03 +02:00
ff9587d28e User Interface: Use theme alpha for the nodes frames background
This bump subversion.
2021-10-08 15:37:43 +02:00
ebe2374528 User Interface: Make the background inside a node group brighter
The breadcrumbs alone may not be enough to indicate that a user is
inside a nodegroup. The original dark green color was a bit overwhelming
but having a different background helps.

This is a follow up to 919e513fa8.
2021-10-08 15:36:18 +02:00
601a6a7dc6 Theme: Fix Blender Light wire color
When using the Blender Light theme the wires seemed too thick.

This is a left over from 4a0ddeb62b.
2021-10-08 15:36:18 +02:00
596446dbc6 Fix wrong Cycles tile highlight with region render
In previous Blender version the tile highlight was stored in the
full frame (un-cropped)  space. This was changed with the Cycles X
development and now the tiles and render result are always measured
relative to the cropped region.

Differential Revision: https://developer.blender.org/D12779
2021-10-08 15:28:53 +02:00
7afde7cd22 Cleanup: asset catalogs, alphabetically order forward declarations
No functional changes.
2021-10-08 15:28:00 +02:00
092424dae3 install_deps: Fix OIIO depending on (system...) openVDB. 2021-10-08 14:52:06 +02:00
2aca08fc1c UI: Support tooltips for superimposed icons
In a couple of places in the UI, we show superimposed icons on buttons
to execute an operation (called "Extra Icons" internally). Hovering them
would show the tooltip of the underlying button, which is misleading and
confusing.
There are cases where it's not obvious what an icon does, so a tooltip
would be quite useful here. It's likely we are going to use superimposed
icons in more places in the future, e.g. see D11890.

The extra icon basically acts as an override for the button in the
tooltip code.

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

Reviewed by: Campbell Barton
2021-10-08 14:18:10 +02:00
86643a4e73 Py doc: document msgbus subscriptions clearing on blendfile load
Document that `bpy.msgbus.subscribe_rna()`-registered messagebus
subscriptions will be cleared whenever a new blend file is loaded.

Passing `options={'PERSISTENT'}` has no influence on this behaviour.
2021-10-08 14:06:30 +02:00
04ad42d83b UI/Assets: Disable undo for tree item buttons
Disables undo for:
* The tree row collapsing - which doesn't make sense to undo, isn't
  supported by the undo system, and just triggers the confirmation
  prompt when closing the file.
* Renaming items - While this may make sense in some cases, users of the
  tree-view API can explicitly do an undo push. For asset catalogs it's
  not supported.
2021-10-08 12:35:19 +02:00
5da58f48ae Cleanup: asset catalogs, move functions to their siblings
Moved function definitions around so that all members of a class are
next to each other. Previously some functions of one class were sitting
between functions of another class.

No functional changes.
2021-10-08 12:34:58 +02:00
482806c816 VSE: Implement the bounding box (xform) tool in the seq preview window
Make the "xform" tool/gizmo available for strip transformations in the
sequencer preview window.

Because of the amount of hacks needed to make the gizmo work nicely with
multiple strips at the same time, it was decided to only show the
translate gizmo when multiple strips are selected.

This is because the transforms with multiple strips would appear buggy
because of our lack of shearing support in the transform system.
There is also currently no way to properly sync the gizmo drawing with
the transform when using multiple strips.

Reviewed By: Richard Antalik, Campbell Barton

Differential Revision: http://developer.blender.org/D12729
2021-10-08 12:14:45 +02:00
a3e2cc0bb7 Asset Catalogs: Fix unit test on Windows
Force native slashes before comparing paths; on Windows mixing
separators caused a unit test to fail.

No functional changes.
2021-10-08 11:32:22 +02:00
bd65d3ce97 Cleanup: Explicit specifier for single argument constructor 2021-10-08 10:01:20 +02:00
3284b5bbde Cleanup: Else after return in Cycles 2021-10-08 10:01:20 +02:00
6c11733dfb Fix T91190: Remove gaps operator not working
Caused by mistake in f49d438ced - `SEQ_query_all_strips()` is not
meant to be recursive.
2021-10-08 09:30:07 +02:00
741fb0d6c9 Sequencer: hide gizmos & cursor during scrubbing & playback
This was distracting prevented easily viewing an animation.
2021-10-08 18:06:50 +11:00
415098abc3 Fix crash switching scenes with sequencer gizmos displayed 2021-10-08 17:24:45 +11:00
ebe216f532 Sequencer: add option to toggle gizmos
Use shortcut matching the 3D view & popover in the header
2021-10-08 17:07:56 +11:00
de07bf2b13 Cleanup: spelling 2021-10-08 13:23:19 +11:00
8f4697e570 Sequencer: only show the 2D cursor with overlays enabled
Also hide when displaying scopes.
2021-10-08 13:20:19 +11:00
2f9fab716d Cleanup: remove deprecated SEQ_DRAW_SEQUENCE value
While drawing cleared this value (as part of temporary fix from 2009),
this was still being checked until recently.

Remove this value in versioning code.

Also clear unused text space flag.
2021-10-08 13:15:19 +11:00
f9f88f50cb Fix sequencer preview/strip checks
- Drawing annotations used a deprecated value to detect
  if drawing was supported.
- ED_space_sequencer_check_show_strip was checking the preview
  image type (which doesn't impact strip display).

Signed-off-by: Campbell Barton <ideasman42@gmail.com>
2021-10-08 13:15:19 +11:00
29e496e768 Cleanup: remove redundant cursor copy, print 2021-10-08 11:57:42 +11:00
23791db145 Fix Cycles random walk SSS differences between CPU and GPU
The Embree logic did not match the GPU.
2021-10-07 21:35:24 +02:00
4ee97f129a Cleanup: remove unnecessary data from LocalIntersection 2021-10-07 21:35:24 +02:00
9708b1f317 Cleanup: Rename enum values
This makes the diff for adding a new version of the attribute transfer
node slightly smaller.
2021-10-07 14:00:11 -05:00
e9daca77d6 Fix: Missing field markers for curve fillet node inputs 2021-10-07 13:44:06 -05:00
0cd3d46246 Nodes: Move texture nodes to C++
Move texture nodes to C++ and use new socket declaration

Brick, Checker, Image, Magic and Wave

Differential Revision: https://developer.blender.org/D12778
2021-10-07 19:19:20 +01:00
ba4e5399fc Fix screenshot editor showing status text in the editor
This caused problems calling screenshot from menu-search
which included the status text in the screenshot.

Now the status text is shown in the global status bar
for any operators called from a screen context.
2021-10-08 04:01:59 +11:00
d04d27b406 Sequencer: 2D cursor for the preview & transform
- Use 2D cursor in the preview space using shortcuts
  matching the UV editor and 3D view.
- Add Cursor tool, cursor transform.
- Support for cursor and bound-box pivot.
- Add pivot pie menu.
2021-10-08 03:27:55 +11:00
919e513fa8 User Interface: Remove the green background when inside a node group
The current background color and parent nodetrees is too distracting and noisy.
It drastically affect the readability of the nested node-trees.

Other techniques (better bread crumbs) can be used instead to indicate
to users that they are inside a node group.

---

The background drawing was introduced in 4638e5f99a as part of the
Python Nodes branch merge. This made its debut in Blender 2.67
(30/May/2021).

At the time the color used for the background was a light gray. Over the
years the color changed to the current dark green, aggravating the
problem further.

Before that, the (expanded) nodegroup already had the partially
transparent background, mingling with the other nodes. The Python Nodes
branch brought this concept with its changes, and would always draw up
to two levels up in the background (the parent nodetree, and its parent
nodetree).

To read the original inspiration for all the changes introduced then:
https://code.blender.org/2012/01/improving-node-group-interface-editing/

Differential Revision: https://developer.blender.org/D12780
2021-10-07 17:35:40 +02:00
cc6a3509a0 Asset Catalogs: change rules for saving catalog definition files
Change the rules for determining where to save a new catalog definition
file (CDF).

Old situation (T91681): if a `blender_assets.cats.txt` file already
exists in the same directory as the blend file, write to that. If not,
see if the blend file is contained in an asset library, and write to its
top-level CDF.

The new situation swaps the rules: first see if the blend file is
contained in an asset library, and if so write to its top-level CDF. If
not, write a CDF next to the blend file.

As before, any pre-existing CDF is not just bluntly overwritten, but
merged with the in-memory catalogs.
2021-10-07 17:04:47 +02:00
1de922f88c Cleanup: asset catalog tests, move teardown function
Move `AssetCatalogTest::TearDown` close to the corresponding `SetUp`
function, so that it's easier to find.

No functional changes.
2021-10-07 17:04:47 +02:00
1b79b4dd30 Fix sequencer preview poll function
sequencer_view_preview_poll returned true even when in the
"Sequence" view.

Now check the preview is visible, also check the region
is expected type so preview actions aren't possible for mixed
sequence/preview display.
2021-10-08 01:58:32 +11:00
c7b237e7d1 Asset Browser: Move Asset Library selector to navigation bar
The menu to select the active Asset Library is now in the left bar (so called
"Source List", although I'd prefer "Navigation-Bar").

This has some benefits:
* All Asset Library navigation is in the left sidebar now, giving nice grouping
  and a top-to-bottom & left-to-right flow of the layout. The header is focused
  on view set-up now.
* Catalogs are stored inside the asset library. Makes sense to have them right
  under that.
* Less content in the header allows for less wide Asset Browsers without
  extensive scrolling.
* This location gives more space to add options or operators for Asset
  Libraries.

Main downside I see is that the side-bar needs to be opened to change
libraries, which takes quite some space. In practice there shouldn't be need to
do this often though.
2021-10-07 16:29:02 +02:00
9f9e2dd25d Cleanup: clang-tidy 2021-10-08 01:25:23 +11:00
0d4c53ecfe Fix wrong tile size calculated in Cycles
Was causing extra overscan pixels, and was confusing multiple workers
check after fix T91994.
2021-10-07 16:21:28 +02:00
0f58cc1594 Cleanup: make format 2021-10-07 16:11:40 +02:00
719c319055 Fix Cycles long start on scene without volumes
The state template iteration had difficult time dealing with 0-sized
arrays, causing iteration for until integer overflows.
2021-10-07 15:54:56 +02:00
c0a5b13b5e Asset Browser: Rework layout & behavior of catalog tree-view
This reworks how tree rows are constructed in the layout and how they
behave in return.

* To open or collapse a row, the triangle/chevron icon has to be clicked
  now. The previous behavior of allowing to do it on the entire row, but
  only if the item was active already, was just too unusual and felt
  weird.
* Reduce margin between chevron icon and the row label.
* Indent child items without chevron some more, otherwise they feel like
  a row on the same level as their parent, just without chevron.
* Fix renaming button taking entire row width. Respect indentation now.
* Fix double-clicking to rename toggling collapsed state on each click.

Some hacks/special-handling was needed so tree-rows always highlight
while the mouse is hovering them, even if the mouse is actually hovering
another button inside the row.
2021-10-07 15:30:59 +02:00
13a28d9e6f Fix proxy to override code being called on undos. 2021-10-07 15:20:54 +02:00
123255be6b Fix T91994: Cycles crash when rendering on multiple devices
The overscan change from D12599 lacked proper handling of window
when slicing buffer for multiple devices.
2021-10-07 15:07:25 +02:00
7fc11744e6 Revert commit, turns out this isn't a bug? 2021-10-07 04:11:49 -07:00
87a36cba1a UI: Fix alignment of buttons in Grease Pencil tool settings
Small fix reviewed on blender.chat by the Grease Pencil team.
2021-10-07 11:44:29 +02:00
00bd631c7c Fix mask expand not properly supporting
both inverse and keep mask modes being on
at the same time.
2021-10-07 02:27:09 -07:00
eadbacdbb0 Fix T91670: Strip text position is incorrect
Use `sseq->timeline_overlay.flag` instead of `sseq->flag`.
Caused oversight in 7cb65e4581.
2021-10-07 06:35:16 +02:00
70cc80ea1c Cleanup: Move VSE disk cache code into own file
No functional changes.
2021-10-07 03:04:34 +02:00
439c9b0b84 Cleanup: VSE iterator semantics
Use `BLI_gset_ensure_p_ex()` instead of `BLI_gset_insert()` after
checking `BLI_gset_lookup()`.
2021-10-07 00:38:33 +02:00
877ba6b251 Fix T91972: Meta changes length when adding strip
`SequencesMeta.new_movie()` API function caused meta strip to change
length. Similar issue has been fixed in transform code by checking
if `MetaStack` exists. `MetaStack` is not used when changing data in
python.

Provide `seqbase` to `SEQ_time_update_sequence()` so the function can
check if change happens inside of meta strip.

This patch also merges `seq_time_update_sequence_bounds()` into
`SEQ_time_update_sequence()`. This is because same issue applies for
both functions and it is confusing to have more time update
functions.re if this will lead anywhere.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D12763
2021-10-07 00:10:37 +02:00
306e9bff46 Fix VSE pan property text printing
Move text into separate label.
2021-10-07 00:04:26 +02:00
04857cc8ef Cycles: fully decouple triangle and curve primitive storage from BVH2
Previously the storage here was optimized to avoid indirections in BVH2
traversal. This helps improve performance a bit, but makes performance
and memory usage of Embree and OptiX BVHs a bit worse also. It also adds
code complexity in other parts of the code.

Now decouple triangle and curve primitive storage from BVH2.
* Reduced peak memory usage on all devices
* Bit better performance for OptiX and Embree
* Bit worse performance for CUDA
* Simplified code:
** Intersection.prim/object now matches ShaderData.prim/object
** No more offset manipulation for mesh displacement before a BVH is built
** Remove primitive packing code and flags for Embree and OptiX
** Curve segments are now stored in a KernelCurve struct
* Also happens to fix a bug in baking with incorrect prim/object

Fixes T91968, T91770, T91902

Differential Revision: https://developer.blender.org/D12766
2021-10-06 17:52:04 +02:00
0fd0b0643a Build: search for hipcc in HIP_ROOT_DIR/bin 2021-10-06 17:44:25 +02:00
8a6f224e26 Fix logic error when trying to find hovered item
Was just comparing this item's and the parent item's names. But if an item has
no parents, only its own name has to match for the check to return true. Make
sure that the number of parents also matches.
2021-10-06 16:55:51 +02:00
bbfa6a92cf Fix T91987: Linking overrides does not apply overrides rules.
Just a matter of calling `BKE_lib_override_library_main_update` in
`library_link_end`.
2021-10-06 16:53:20 +02:00
b7dc0346aa BMain: Add utils to check if a Main is empty or not.
Mostly intended for debug code (asserts).
2021-10-06 16:53:20 +02:00
0194e54fd3 Fix compilation error with MSVC
MSVC does not support variable size array definition.
Use maximum possible stack, similar to the GPU case.

Not expected to have user-measurable difference.
2021-10-06 16:51:07 +02:00
75fbf6f17e Asset Browser: Show catalog add & delete icons on mouse hover (only)
Now the icons to add or delete catalogs are only shown when mouse hovering a
catalog item in the tree. This is convenient for quick creation of catalogs,
and doesn't require activating a catalog to edit it first.

Determining if a tree item is hovered isn't trivial actually. The UI tree-view
code has to find the matching tree-row button in the previous layout to do so,
since the new layout isn't calculated yet.
2021-10-06 16:36:20 +02:00
536109b4ec Fix possibly wrong matching of tree-view item buttons
The UI code to ensure consistent button state over redraws was just comparing
the name of the item, ignoring the parent names. So with multiple items of the
same name, there might have been glitches (didn't see any myself though).

There's a leftover to-do though, we don't check yet if the matched buttons are
actually from the same tree. Added TODO comment.
2021-10-06 16:36:20 +02:00
2012d541ae Asset Browser: Always show icon to add catalog next to "All" item
Feedback was that it's unclear sometimes how to add a new item and that some
people expect a button to add a new item next to the "All" item.
2021-10-06 16:36:20 +02:00
Jacob Lewallen
12c66854bd Pass correct array size to BKE_object_material_remap_calc
This was patch D12460 from jlewallen and fixes T91339 and T90818.
2021-10-06 10:26:15 -04:00
c6275da852 Fix T91922: Cycles artifacts with high volume nested level
Make volume stack allocated conditionally, potentially based on the
actual nested level of objects in the scene.

Currently the nested level is estimated by number of volume objects.
This is a non-expensive check which is probably enough in practice
to get almost perfect memory usage and performance.

The conditional allocation is a bit tricky.

For the CPU we declare and define maximum possible volume stack,
because there are only that many integrator states on the CPU.

On the GPU we declare outer SoA to have all volume stack elements,
but only allocate actually needed ones. The actually used volume
stack size is passed as a pre-processor, which seems to be easiest
and fastest for the GPU state copy.

There seems to be no speed regression in the demo files on RTX6000.

Note that scenes with high nested level of volume will now be slower
but correct.

Differential Revision: https://developer.blender.org/D12759
2021-10-06 15:46:32 +02:00
e41dddd29a Gizmo: remove wmGizmoGroup.use_fallback_keymap
This ended up being a copy of:
`toolsettings->workspace_tool_type == SCE_WORKSPACE_TOOL_FALLBACK`
requiring boiler plate assignment in gizmos refresh callbacks.

Remove this struct member and check `toolsettings->workspace_tool_type`
directly, since so far there has been no advantage in gizmo-groups
being able to control this themselves.
2021-10-07 00:08:23 +11:00
cda20a7af8 Keymap: ignore the fallback keymap when "Active Tool" is set
Resolve regression in c9d9bfa84a,
which added support for tools to be tagged as using a fallback too.

In these cases the "Active Tool" setting was ignored and the fallback
tool would be used (the spin tool would box select for example).
2021-10-07 00:06:45 +11:00
539575b585 Assets: Support Renaming Catalogs in the UI
Catalogs can now be renamed by double clicking them in the Asset
Browser. This is mostly done through the tree-view API, the asset
specific code is very little.

There is some polish left to be done here, e.g. the double click
currently also collapses/uncollapses and activates the clicked item. And
the rename button takes the full width of the row. But addressing these
is better done as part of some other behavioral changes that are planned
anyway.
2021-10-06 14:25:26 +02:00
335f40ebfa Tests: include device type in benchmark graph labels 2021-10-06 14:21:26 +02:00
03f8c1abd0 Build: add ccache support for CUDA kernels on Linux 2021-10-06 14:21:26 +02:00
18c6314e26 Cleanup: don't detect duplicate intersections in Embree
It's unclear why this code was added in the first place, but it seems
unnecessary, it can be restored if we find this breaks something.

The Embree docs mention that the same primitive may be hit multiple times, but
my understanding is that about e.g. curves where both the frontside and backside
may be hit. However those hits would be at different distances.

The context for this change is that we want to add an optimization where we
can immediately update throughput for transparent shadows instead of recording
intersections, and avoid duplicate would require extra work. However there is
an Embree example that does something similar without worrying about duplicate
hits either.
2021-10-06 14:21:11 +02:00
3c4537cd38 Cleanup: Improve readability & comments in UI tree-view header 2021-10-06 13:08:45 +02:00
ac9ec52e9e UI: Draw tree-views (e.g. asset catalogs) in a box
Makes things look more appealing visually. Plus it's a way to visually
group the tree rows together, which can be important if there are more
widgets surrounding the tree.
2021-10-06 13:08:45 +02:00
4ab8212e1a Fix errors in 68dc970219
Swapped preview/timeline keymap and incorrect center measurement.
2021-10-06 21:42:09 +11:00
9ed19db539 Fix handling of overrides during append.
Liboverride references need a special handling during append, since
those pointers should never be made local, nor reampped to newly
localized data. And liboverride references should never be directly made
local either, to ensure their liboverride usages remain pointing to
linked data and not local one.

Issue was reported by the studio, and also probably as part of T91892.
2021-10-06 11:43:42 +02:00
b5ea3d2c09 Fix possible use-after-free when cancelling temporary rename button
If a renaming button was removed via `UI_but_active_only_ex()` and that
button was placed using the layout system, the button was still in the
layout.
So far this didn't cause issues, because all cases where the button may
be removed were not using the layout system.
2021-10-06 11:24:24 +02:00
Mikhail Matrosov
ca0450feef Fix T91064: Cycles low poly meshes having black edges when shade smoothed
Fixes:{T91064}

Caused by {rBcd118c5581f482afc8554ff88b5b6f3b552b1682}

- Applies `ensure_valid_reflection()` to the normal input on all BSDFs for CPU and GPU.
- This doesn't affect hair.
- Removes `ensure_valid_reflection()` from the output of Bump Map and Normal Map nodes for CPU/GPU as it is not needed.
- The fix doesn't touch OSL.

Reviewed By: brecht, leesonw

Maniphest Tasks: T91064

Differential Revision: https://developer.blender.org/D12403
2021-10-06 10:25:09 +02:00
85267ec1ae Correct error in 68dc970219
Included invalid keyword argument.
2021-10-06 18:12:01 +11:00
68dc970219 Sequencer: improvements to preview selection
- Support toggle/deselect/deselect_all options
  (matching 3D viewport object selection).
- Support legacy selection behavior.
- Support selecting by the center in preview views (holding Ctrl).
2021-10-06 18:01:27 +11:00
82f0e4948c UI: Boolean rename "Self" to "Self Intersection"
Better to be more explicit here, also this matches the recent Boolean Node.
2021-10-06 00:00:07 -04:00
ce66075d00 UI: add sequencer preview context menu
This is mostly a place-holder since many items
have not yet been implemented.
2021-10-06 14:54:05 +11:00
c73a550e90 UI: rename sequencer "Select" to "Tweak"
This matches the tweak tool elsewhere.

Match names since this name is shown prominently
in the fall back tool selector.
2021-10-06 14:54:05 +11:00
876b250499 Keymap: fallback tool support for the sequencer
Note that sample is no longer in the sequencer preview keymap,
it is still accessible as a tool.

This conflicted with click-drag to transform.
2021-10-06 14:54:05 +11:00
ba95cf6234 Keymap: remove selection from the common sequencer map
Needed for further changes as selection behaves differently
in the preview region.
2021-10-06 14:54:05 +11:00
8e2a21e862 Keymap: show sequencer tools in key-map editor
Re-order common sequencer key-map to be at the top level
(shared by preview and sequence view).

Without this sequencer tools would be displayed at different levels
in the hierarchy which is confusing and doesn't represent the separation
between "Sequencer" and "SequencerPreview" key-maps.
2021-10-06 14:54:05 +11:00
9161993e02 Sequencer: use pass-through for preview select
Needed for select-drag action as done in the 3D view and UV editor.
2021-10-06 14:54:05 +11:00
0e590f9078 Fix sequencer sample poll function
Sequencer poll was succeeding outside of a preview region.

This meant it couldn't be used in tool key maps which are currently
shared between preview & sequencer regions.
2021-10-06 14:54:05 +11:00
df8f507f41 Cleanup: spelling in comments 2021-10-06 14:54:05 +11:00
bf35dba7fb Nodes: Composite: Fix wrong socket type for color ramp node 2021-10-05 23:28:24 -04:00
b534806ecb VSE: Reduce memory footprint when using thumbnails
Free strip `anim` data immediately after rendering. This doesn't affect
rendering performance, because each new loop would have to seek to start
of strip. Also strips are now freed anyway, but after rendering loop
ends.

With SF edit file, thumbnail rendering used around 60GB of memory.
Now it uses few hundreds MB (depends on movie file resolution, codec,
etc.)

Freeing of strips caused UI to be unresponsive for brief period. This
issue is not removed, but is more spread out so it is less noticable.
2021-10-06 05:07:51 +02:00
0d68d7baa3 Cleanup: clang-format, correct doxy groups 2021-10-06 13:23:13 +11:00
8113b8391a Cleanup: VSE: Move thumbnail drawing to own file
No functional changes.
2021-10-06 04:21:01 +02:00
76de3ac4ce Cleanup: Remove data duplication from various lookup tables in Cycles
This effectively undoes some of the following commit:
rB4537e8558468c71a03bf53f59c60f888b3412de2

The tables in question were duplicated 5-6 times into the blender
executable due to the headers being used in multiple translation units.
This contributes ~6.3kb worth of duplicate data into the binary.

Some further details are in the below revision.

Differential Revision: https://developer.blender.org/D12724
2021-10-05 19:09:01 -07:00
11d31addf8 Cleanup: missing verb in comment 2021-10-06 02:42:18 +02:00
c148eba16f Fix crash when reading non standard Alembic velocity attribute type
Some software may export velocity as a different type than 3D vectors
(e.g. as colors or flat arrays or floats), so we need to explicitely
check for this.

A more robust attribute handling system allowing us to cope with other
software idiosyncrasies is on the way, so this fix will do for now.
2021-10-06 02:42:18 +02:00
b93e947306 Cleanup: rename BKE_font.h -> BKE_vfont.h
Match API naming prefix (BKE_vfont_*) and DNA_vfont_types.h.
2021-10-06 11:18:16 +11:00
dcac86f4f1 Cleanup: remove unused flag argument 2021-10-06 10:55:54 +11:00
fd592538d9 Cleanup: move BLI_vfontdata.h to BKE_vfontdata.h
This didn't belong on blenlib since it uses DNA data types
and included a bad-level call to BKE_curve.h.

It also meant linking in blenlib would depend on the freetype library,
noticeable for thumbnail extraction (see D6408).
2021-10-06 10:55:34 +11:00
26dac33ce1 Cleanup: simplify ED_imbuf_sample_poll
Access the space data directly from the area.

Also remove redundant NULL check.
2021-10-06 09:29:09 +11:00
6d2b486e43 Cleanup: spelling in comments 2021-10-06 09:28:00 +11:00
7b5835c793 Fix: Add missing function node declaration for RGB and Float Curve nodes 2021-10-05 22:38:41 +01:00
432d5bc692 Cleanup: Remove unused DerivedMesh functions
The long term goal is completely removing DerivedMesh, and these
functions are making some refactoring of mesh normals (T91186) more
complicated. They are not used anywhere.
2021-10-05 13:16:50 -05:00
16e7a7b5b1 Cleanup: Clang tidy 2021-10-05 13:15:31 -05:00
88c02bf826 VSE: Free animation strip data if they are not visible
Previously we would only free animation strip data when doing final
renders. If not doing a final render or simply just playing back videos
in the VSE, we would not free decoders or non VSE cache data from the
strips.

This would lead to memory usage exploding in complex VSE scenes.

Now we instead use the dumb apporach of freeing everything that is not
currently visible.
2021-10-05 18:53:58 +02:00
0a1a173e57 Cleanup: Make anim_getnew in the VSE less confusing
It was using dummy image buffers to indicate if an animation container
could be initialized or not.

Use booleans instead.
2021-10-05 18:53:58 +02:00
6eefcd7d78 GPencil: Remove unused spacetype check in Paint operator
The Paint operator only works in SPACE_VIEW3D and this is checked in the poll mtehod, so it's not logic check again.

These checkings were part of the old grease pencil but it was not removed.
2021-10-05 17:11:21 +02:00
11be9edae2 Fix missing proper 'make local' call for liboverrides from outliner.
Also includes minor improvements to
`BKE_lib_override_library_make_local` itself.

This is a complement to rB37458798fa02c.
2021-10-05 17:07:06 +02:00
c11585a82f Add missing "CUDA_ERROR_UNSUPPORTED_PTX_VERSION" to CUEW
This is required for Cycles to report a meaningful error message when it fails to load a PTX module
created with a newer CUDA toolkit version than the driver supports.

Ref T91879
2021-10-05 16:36:33 +02:00
6e268a749f Fix adaptive sampling artifacts on tile boundaries
Implement an overscan support for tiles, so that adaptive sampling can
rely on the pixels neighbourhood.

Differential Revision: https://developer.blender.org/D12599
2021-10-05 16:19:14 +02:00
758f3f7456 Fix T91940: Asset Browser catalogs continuously redraw
Issue was that the `on_activate()` callback of tree-items were
continuously called, because the active-state was queried before we
fully reconstructed the tree and its state from the previous redraw.
Such issues could happen in more places, so I've refactored the API a
bit to reflect the requirements for state queries, and include some
sanity checks.
The actual fix for the issue is to delay the state change until the tree
is fully reconstructed, by letting the tree-items pass a callback to
check if they should be active.
2021-10-05 16:10:27 +02:00
dbe3981b0a Cleanup: Better way to pass activate callbacks to Tree-View items
The `ui::BasicTreeViewItem` took a function-like object to execute on
item activation via the constructor. This was mainly intended to be used
with lambdas. However, it's confusing to just have this lambda there,
with no indication of what it's for (activation).
Instead, assign the function-like object via an explicit `on_activate()`
function.
2021-10-05 16:10:27 +02:00
9a0850c8c2 Cycles: Fix wrong GPU state calculation
Currently was only used for logging, but better to fix the size so
that it matches reality.

The issue was caused by decoupling number of shadow intersections
and using much higher number for CPU. This caused the total state
on GPU to be logged as 10s of gigabytes instead of 100s of megabytes.

Differential Revision: https://developer.blender.org/D12755
2021-10-05 16:09:31 +02:00
b1e6e63c22 Cleanup: Geometry Nodes dashed lines
No functional change, just cleaning up the shader code a bit.

Part of this is removing dead code (the discard was never called), and
part is shuffling mix/max around based on feedback by Sybren Stüvel.
2021-10-05 15:38:09 +02:00
55b8fc718a Cycles: improve detection of HIP compiler for buildbot
And fix various broken things in the HIP kernel compilation.
2021-10-05 13:47:50 +02:00
71cf9f4b3f Fix T91955: Cycles crash with denoising on non-available device
For example, crash when attempting to use OptiX denoiser on systems
without OptiX-capable device.

Perform check that scene update happened without errors.

Note that `et_error` makes progress to cancel, so the code was
simplified a bit.
2021-10-05 10:52:35 +02:00
b6ad0735a6 Fix T86379: When using "Append" not handling properly RigidBody constraints
This was simply never handled apparently.

Also fixes a regression from recent append refactor that prevented RB
objects to to properly handled too (since we instantiate loose objects
in append step now, we need to handle RigidBody ones after that
instantiation stage, otherwise nothing will happen since loose objects
won't be in any scene).
2021-10-05 10:48:10 +02:00
7df6f66ea2 Silenced compilation warning when compiling using ASAN. 2021-10-05 10:36:45 +02:00
9824df49c0 Fix memory leak when running test cases.
Issue is that test cases re-uses draw manager. The new
`DRWRegisteredDrawEngine` struct is only freed when a
valid opengl context was found. what isn't the case
when running test cases.

Also made sure that re-using draw manager would use re-inited
values.
2021-10-05 10:36:45 +02:00
7a66a9f22e Cleanup: remove unused parameter 2021-10-05 16:54:25 +09:00
1d49293b80 DRW: Move buffer & temp textures & framebuffer management to DrawManager
This is a necessary step for EEVEE's new arch. This moves more data
to the draw manager. This makes it easier to have the render or draw
engines manage their own data.

This makes more sense and cleans-up what the GPUViewport holds

Also rewrites the Texture pool manager to be in C++.

This also move the DefaultFramebuffer/TextureList and the engine related
data to a new `DRWViewData` struct. This struct manages the per view
(as in stereo view) engine data.

There is a bit of cleanup in the way the draw manager is setup.
We now use a temporary DRWData instead of creating a dummy viewport.

Development: fclem, jbakker

Differential Revision: https://developer.blender.org/D11966
2021-10-05 09:39:54 +02:00
08511b1c3d XR: Add runtime window area for XR events
This adds an offscreen View3D window area for the VR view in order to
execute XR events/operators in the proper context. The area is created
as runtime data before XR events are dispatched and set as the active
area during XR event handling.

Since the area is runtime-only, it will not be saved in files and since
the area is offscreen, it will not interfere with regular window areas.
The area is removed with the rest of the XR runtime data on exit, file
read, or when stopping the VR session.

Note: This also adds internal types (EVT_DATA_XR, EVT_XR_ACTION) and
structs (wmXrActionData) for XR events.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12472
2021-10-05 16:05:12 +09:00
300403a38b Fix syntax error in caac532565 2021-10-05 17:41:23 +11:00
caac532565 Cleanup: add Params.select_tweak_event
Convenience, use for tool key-maps to avoid overly verbose expressions.
2021-10-05 16:35:05 +11:00
Erik Abrahamsson
1b22650fbf Geometry Nodes: Rename "String Join" node to "Join Strings"
Rename the "String Join" node to "Join Strings" to
go with the verb first naming convention.

Differential Revision: https://developer.blender.org/D12678
2021-10-04 23:54:21 -05:00
2b66b372bc Cleanup: use doxygen sections 2021-10-05 11:10:25 +11:00
2dace5f3ef Cleanup: use 3D dot product (not 4D) when comparing pose-bone axes
Also use more meaningful variable name.
2021-10-05 11:09:31 +11:00
92c449776d Cleanup: quiet shadow warning, trailign space 2021-10-05 10:59:48 +11:00
18959c502d Fix field type in curve resample node 2021-10-04 15:40:09 -05:00
c38d2513c5 Fix T91725: Waveforms are not displayed
Use `sseq->timeline_overlay.flag` for `SEQ_TIMELINE_ALL_WAVEFORMS`
instead of `sseq->flag`.
2021-10-04 22:17:05 +02:00
d1ade756a9 Fix T91920: Missing decorate buttons in sound panel
Add back decorate buttons, move mono and display waveforms to bottom as
they were before.
2021-10-04 22:10:17 +02:00
655ce5dc3e Cleanup: Use LISTBASE_FOREACH macro 2021-10-04 21:57:39 +02:00
c8d59b60b5 Make keyframe inserts/removals less verbose when called from python.
Following operators now only report messages back when they are called via their invoke-methods:

- ANIM_OT_keyframe_insert
- ANIM_OT_keyframe_insert_by_name
- ANIM_OT_keyframe_insert_menu
- ANIM_OT_keyframe_delete
- ANIM_OT_keyframe_clear_v3d
- ANIM_OT_keyframe_delete_v3d

Also removed the attribute confirm_success from the following operators:

- ANIM_OT_keyframe_insert
- ANIM_OT_keyframe_insert_by_name
- ANIM_OT_keyframe_insert_menu
- ANIM_OT_keyframe_delete
- ANIM_OT_keyframe_delete_by_name

Note: addons/scripts possibly need to be updated if they use the above operators AND set the "confirm_success" attribute

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12697
2021-10-04 21:23:44 +02:00
3391a2ef1d Assets: Show all assets indirectly nested inside the active catalog
The asset catalog design was always that the active catalog would also
display all assets of its child catalogs (or grand-childs, etc.). This
is one of the main characteristics that differentiates catalogs from
usual directories.

Sybren prepared this on the asset catalog backend side with
56ce51d1f7. This integrates it into the Asset Browser backend and the
UI.
2021-10-04 20:24:25 +02:00
ffa20de050 Cleanup: Remove unused variable and include 2021-10-04 13:03:13 -05:00
65b5023df4 Fix: Geometry Nodes Handle Type Selection Fix
Fix the selection logic on the Handle Type Selection node to work
as intended:

(Left is Selected AND Left is ChosenType)
OR
(Right is Selected AND Right is ChosenType)
2021-10-04 12:47:35 -05:00
076d797bda Geometry Nodes: Curve Trim Node Update
This update allows the Trim Curve node to use float field inputs
for the start and end inputs. These fields are evaluated on the
spline domain.

Differential Revision: https://developer.blender.org/D12744
2021-10-04 12:01:29 -05:00
301ee97b93 Fix: Unable to select left and right in set handle type node
The "enum" RNA flag was missing.
2021-10-04 11:10:08 -05:00
f2c896a9ad GPencil: Simplify code removing extra function
The function was not doing anything and only was calling another function.
2021-10-04 17:08:16 +02:00
2b6f2072f1 UI Tree-View API: Enforce active item to be un-collapsed
Makes sure that the active item of a tree never has collapsed parent
items, which can be confusing if it happens. E.g. for the asset catalogs
UI, the active catalog decides which assets are visible. Having it
hidden while being the main factor deciding which assets are visible is
quite confusing.

I think it makes sense to have this at the UI Tree-View level, rather
than doing it manually in the asset catalog code for example. Seems like
something you'd commonly want. We can make it optional in the API if
needed.

Renamed the `set_active()` function to make clear that it is more than a
mere setter.
2021-10-04 17:03:12 +02:00
4fd7ce321d GPencil: Remove unused flag
This flag was used in older versions, but now is not used anymore.
2021-10-04 16:43:07 +02:00
0bc4056455 Nodes: Revert some socket declarations to previos API
See T91826, there is a bug in the code where both `.` and `_` are used as a seperator for `BLI_uniquename_cb`.

This resulted in some nodes becoming disconnected on file load.
Until this is resolved, the chnages are reverted to prevent data loss.
2021-10-04 10:35:11 -04:00
4a3464050c Assets: Support dragging assets on "Unassigned" catalog
Dragging assets onto the "Unassigned" catalog tree item will effectively
move the assets out of any catalog. Technically this means unsetting the
Catalog-ID stored in the asset metadata, or more precisely setting the
UUID to be all zeros.
2021-10-04 16:17:09 +02:00
b536605e78 Cleanup: Use static function for asset catalog tree-view helper 2021-10-04 15:29:39 +02:00
4882208633 Cleanup: Separate interface & implementation for asset catalog tree-view
Should make the code a bit more organized and help getting an overview
of the interfaces more quickly.
2021-10-04 15:29:39 +02:00
cc636db8f2 Fix T91823: Regression not showing idblocks when recursion is set to Blend file
Introduced by fc7beac8d6. During code review it wasn't clear why this
branch was needed, so we removed it. Now it is clear why it is needed
so we added it back and added a comment why the branch is needed.

Patch provided by @Severin.
2021-10-04 15:25:40 +02:00
f806bd8261 Fix T91861: Black environment behind shadow catcher
Always sample background pass behind shadow catcher (if the pass
exists, of course), regardless of whether shadow catcher will be
used as approximate or accurate.

Allows to combine accurate shadows into an environment map.

Differential Revision: https://developer.blender.org/D12747
2021-10-04 15:07:32 +02:00
fc4886a314 Fix T91894: Cycles baking normal maps of transformed objects not working 2021-10-04 13:58:37 +02:00
326bd76d3b Fix T89759: baking normals does not take into account mirror modifier 2021-10-04 13:58:37 +02:00
a80a2f07b7 Fix T90815: wrong Cycles OSL normal map render after recent optimization 2021-10-04 13:58:37 +02:00
76238af213 Fix Cycles render time pass being available in UI, but it was removed
This previously only work for CPU rendering, and isn't that practical to get
working in the new architecture.
2021-10-04 13:58:37 +02:00
8ca7250982 Fix T91911: error in image dithering code after recent changes
Thanks to Patrik Olsson for spotting this.
2021-10-04 13:58:37 +02:00
dc4c2815a6 Cleanup: Reverting submodules hash
This partially reverts commit e62ce9e08e.
2021-10-04 12:42:07 +02:00
Simon Lenz
e62ce9e08e Fix camera border bug in passepartout render view
{F10761402}

With active viewport render from camera view, the camera border shows up, even when passepartout and overlays are disabled.

By moving the line-drawing code to the passepartout section, it is effectively disabled when passepartout is off.

Reviewed By: sebastian_k

Differential Revision: https://developer.blender.org/D12745
2021-10-04 12:21:40 +02:00
23d9953c80 I18n tools: Fix issue when extracting messages on release builds.
This was also affecting prototype of buildbot-driven UI messages
extraction...
2021-10-04 12:17:50 +02:00
ce6a24976a Cleanup: Redundant space at the end of comment 2021-10-04 12:02:14 +02:00
f2b86471ea Fix session uuid ghash comparison return value
Because of legacy reasons (C string compare function returning 0 when
strings are equal), the ghash compare function is expected to return
false when hashes are equal.
2021-10-04 11:55:09 +02:00
37003cbbc1 Fix T91867: Error reading tiles with Persistent Data ON 2021-10-04 11:54:11 +02:00
87a3cb3bff Cleanup: Neighbour -> Neighbor. and other minor UI messages fixes.
Blender English should use 'American' variants, not 'British' variants.
2021-10-04 11:14:57 +02:00
8c55333a8e Cleanup: tag unused parameters as such. 2021-10-04 09:43:40 +02:00
fc6228bd85 Fix T91873: Crash when opening properties panel
This patch fixes a crash that was recently introduced by rB5cebcb415e76.
The reason were missing poll functions in the UI and operator.

Reviewed By: ISS

Maniphest Tasks: T91873

Differential Revision: https://developer.blender.org/D12736
2021-10-04 08:15:03 +02:00
93e92ac126 Cleanup: remove unused assignments 2021-10-04 13:15:15 +11:00
357acd1d50 Cleanup: pass arguments as const 2021-10-04 13:15:15 +11:00
e43fcc014a Cleanup: remove redundant assignment 2021-10-04 13:15:15 +11:00
3c3669894f Cleanup: use system includes 2021-10-04 13:14:58 +11:00
6e48a51af7 check_cppcheck: use quiet output
Without this, each cppcheck invocation included all defines/includes
flooding the console with unhelpful information.

Also remove nonexistent directory to exclude.
2021-10-04 13:12:37 +11:00
606271966e check_cppcheck: use '--cppcheck-build-dir'
Use a temporary directory for faster performance.
2021-10-04 13:12:36 +11:00
e0e7a5522f project_source_info: queue_processes() now waits for jobs to finish
queue_processes() - used for some of the "make check_*" utilities,
wasn't waiting for all jobs to finish before returning.

This conflicted with running cleanup operations.
2021-10-04 13:12:35 +11:00
e7274dedc4 Fix possible NULL pointer deference
The pointer was referenced before being checked.
2021-10-04 13:12:34 +11:00
cc8fa3ee90 Fix T91904: Assert when loading empty CurveProfile
Somehow, the file from T71329 has an empty curve profile. While that may
be a problem in itself, it's reasonable to avoid asserts or crashes when
loading or drawing such a CurveProfile. This commit just makes sure the
table always has a single vertex, and adds some checks in drawing code.
2021-10-03 20:28:31 -05:00
dfdc9c6219 Cleanup: Make more functions static
This simplifies the surface of the API for a CurveProfile.
2021-10-03 19:52:59 -05:00
b6195f6664 Cleanup: Replace macro with function 2021-10-03 18:54:52 -05:00
272a38e0c2 Cleanup: Make function static 2021-10-03 18:31:56 -05:00
c9af025936 Cleanup: Add doxygen sections, rearrange functions 2021-10-03 18:23:58 -05:00
1e5cfebf66 Fix key-map with fall-back tool on RMB select
Regression in bffda4185d.
2021-10-04 09:28:33 +11:00
57272d598d Cleanup: rename eRegionType -> eRegion_Type
Match eSpace_Type.
2021-10-04 09:28:33 +11:00
ee79bde54d Keymap: print more verbose output for --debug-handlers
Include the short-cut text and the operator properties to make it easier
to track down the key-map item source that matched the event.
2021-10-04 09:28:33 +11:00
c4dca65228 Asset Browser: Support dragging assets into catalogs
With this it is possible to select any number of assets in the Asset
Browser and drag them into catalogs. The assets will be moved to that
catalog then. However, this will only work in the "Current File" asset
library, since that is the only library that allows changing assets,
which is what's done here.

While dragging assets over the tree row, a tooltip is shown explaining
what's going to happen.

In preparation to this, the new UI tree-view API was already extended
with custom drop support, see 4ee2d9df42.

----

Changes here to the `wmDrag` code were needed to support dragging multiple
assets. Some of it is considered temporary because a) a proper #AssetHandle
design should replace some ugly parts of this patch and b) the multi-item
support in `wmDrag` isn't that great yet. The entire API will have to be
written anyway (see D4071).

Maniphest Tasks: T91573

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

Reviewed by: Sybren Stüvel
2021-10-03 23:58:20 +02:00
3b1a243039 Cleanup: Rename file-list function to better match what it's doing 2021-10-03 23:18:04 +02:00
2305f270c5 Geometry Nodes: Handle Type Selection Node Update
This node creates a boolean field selection of bezier spline points
that have a handle of the given type on the selected 'side' of the
contol point. This is evaluated on the point domain.

Differential Revision: https://developer.blender.org/D12559
2021-10-03 15:01:30 -05:00
adc084a3e9 Cleanup: Move curveprofile.c to C++ 2021-10-03 14:40:08 -05:00
ae86584404 Geometry Nodes: Points to Volume Fields fixes
A few items when OpenVDB is not enabled.
  - Cleanup a compiler warning
  - Add a node warning message
  - Return an empty geometry set
2021-10-03 13:43:51 -05:00
98fe05fb5b Fix T91810 Bevel not working well with certain unbeveled edge positions.
A previous commit, c56526d8b6, which sometimes didn't drop offsets
into 'in plane' faces, as a fix to T71329, was overly aggressive.
If all the intermediate edges are in the same plane then it is fine
to just put the meeting point on the plane of the start and end edges.
2021-10-03 11:30:40 -04:00
1833ebea31 Cleanup: move as_span method out of header
This method does not have to be in a header and results in a relatively
large number of symbols to be generated (42).
2021-10-03 17:07:26 +02:00
bf354cde96 Cleanup: move special methods of geometry set out of header
This reduces the compile time, because fewer symbols have to be generated
in translation units using geometry sets.
2021-10-03 16:58:33 +02:00
64d07ffcc3 Cleanup: move methods out of field classes
This makes it easier to scan through the classes and simplifies
testing the compile time impact of having these methods in the header.
2021-10-03 16:47:54 +02:00
17e2d54a3d Cleanup: use extern templates for typed output attribute
This is very similar to rBa812fe8ceb75fd2b.
This time the number of symbols decreases further from 1335 to 928.
Compile time of the distribute node decreases from ~2.4s to ~2.3s.
2021-10-03 16:30:14 +02:00
a812fe8ceb Nodes: use extern templates for socket declarations
The new socket declaration api generates a surprising amount
of symbols in each translation unit where it is used. This resulted
in a measurable compile time increase.

This commit reduces the number of symbols that are generated in
each translation unit significantly. For example, in
`node_geo_distribute_points_on_faces.cc` the number of symbols
decreased from 1930 to 1335. In my tests, this results in a 5-20%
compile time speedup when this and similar files are compiled
in isolation (measured by executing the command in `compile_commands.json`).

Compiling the distribute points on faces node sped up from ~2.65s to ~2.4s.
2021-10-03 16:05:19 +02:00
2f52f5683c Cleanup: move more method definitions out of their class
This makes it easier to test the impact of moving them out
of the header later.
2021-10-03 15:24:21 +02:00
06c3bac23b Cleanup: move more methods out of classes 2021-10-03 15:14:03 +02:00
fb34cdc7da Geometry Nodes: Points to Volume Fields Update
This update of the Points to Volume node allows a field to populate the
radius input of the node and removes the implicit realization of
instances.

Differential Revision: https://developer.blender.org/D12531
2021-10-03 08:03:46 -05:00
0998856c92 Cleanup: use movable output attribute instead of optional
This simplifies the code a bit and improves compile times a bit.
2021-10-03 15:01:02 +02:00
8fc97a871f Cleanup: make typed output attribute movable
This comes at a small performance cost due to an additional
memory allocation, but that is not significant currently.
2021-10-03 14:49:15 +02:00
5d5a753d96 Cleanup: move AttributeIDRef and OutputAttribute methods out of class
This makes the classes easier to read and simplifies testing
the compile time impact of defining these methods in the header.
2021-10-03 14:39:17 +02:00
e1e75bd62c Cleanup: move resource scope method definitions out of class 2021-10-03 14:23:26 +02:00
a8d6a86981 Cleanup: move StringRef method definitions out of class
This makes the classes more appealing to look at and makes
it easier to see what different methods are available.
2021-10-03 14:10:26 +02:00
c206fa9627 Cleanup: add nolint comment to move semantic test 2021-10-03 14:03:53 +02:00
f2da98d816 Cleanup: remove unused functions 2021-10-03 13:44:44 +02:00
d3afe0c126 Geometry Nodes: Resample Curve Fields Update
This update of the Resample Curve node allows a field to populate the
count or length input of the node depending on the current mode. The
field is evaluated on the spline domain.

Differential Revision: https://developer.blender.org/D12735
2021-10-02 21:45:51 -05:00
e863e05697 Data Transfer: Remove unnecessary noisy error message
I've seen requests to remove this or complaints about this error message
quite frequently. In lots of production files it's just always going off.
It's not an actionable warning, and since "slow" is relative, it isn't
always even correct.

Differential Revision: https://developer.blender.org/D12694
2021-10-02 20:33:15 -05:00
b57b4dfab1 Cleanup: clang-format 2021-10-03 12:13:29 +11:00
f49dff97d4 Cleanup: spelling in strings 2021-10-03 12:13:29 +11:00
74f45ed9c5 Cleanup: spelling in comments 2021-10-03 12:13:29 +11:00
Jarrett Johnson
c5c94e3eae Geometry Nodes: Add Rotate Euler Node
This commit introduces the Rotate Euler function node which modifies
an input euler rotation. The node replaces the "Point Rotate" node.

Addresses T91375.

Differential Revision: https://developer.blender.org/D12531
2021-10-02 20:04:45 -05:00
34cf33eb12 Geometry Nodes: Switch Node Fields Update
This update of the Switch node allows for field compatible types
to be switched through the node. This includes the following:

Float, Int, Bool, String, Vector, and Color

The remaining types are processed with the orginal code:

Geometry, Object, Collection, Texture, and Material

Because the old types require a diffent "switch" socket than the
field types, versioning for old files is included to move links
of those types to a new switch socket. Once fields of other types
are supported, this node can be updated to support them as well.

Differential Revision: https://developer.blender.org/D12642
2021-10-02 17:34:47 -05:00
Leon Leno
54927caf4f Geometry Nodes: Add side and fill segments to Cone/Cylinder nodes
This commit extends the 'Cone' and 'Cylinder' mesh primitive nodes,
with two inputs to control the segments along the side and in the fill.
This makes the nodes more flexible and brings them more in line with
the improved cube node.

Differential Revision: https://developer.blender.org/D12463
2021-10-02 17:29:25 -05:00
12e8c78353 Fix T91888: Pivot point settings shown in timeline
Added to timeline by accident in f9e0981976.
2021-10-01 23:26:59 +02:00
1476d35870 Geometry Nodes: Set Handle Type Node Field Update
This update of the Set Handle Type node allows for a bool field to be
used as the selection of the affected control point handles for
bezier splines. If no bezier splines are provided a info message is
shown.

Differential Revision: https://developer.blender.org/D12526
2021-10-01 14:22:24 -05:00
1fb364491b Geometry Nodes: Set Spline Type Node Field Update
This update of the Set Spline Type node allows for a bool field to be
used as the selection of the affected splines.

Differential Revision: https://developer.blender.org/D12522
2021-10-01 11:59:29 -05:00
eacdc0ab4a VSE: Draw active strips with a different color in the preview window 2021-10-01 18:03:18 +02:00
dc30a9087c Geometry Nodes: Spline Length Input Node
The Spline Length Input node provides a field containing the
length of the current evaluated spline to the Point and Spline
domains.

Differential Revision: https://developer.blender.org/D12706
2021-10-01 09:58:49 -05:00
9e456ca695 Asset Browser: expose current catalog ID in RNA
Add read-only access to the active catalog ID via
`context.space_data.params.catalog_id` in the Asset Browser context.

The UUID is exposed as string to Python.
2021-10-01 16:47:16 +02:00
aae96176e8 Geometry Nodes: Curve Subdivide Node with Fields
The curve subdivide node can now take an int field to specify the
number of subdivisions to make at each curve segment.

Reviewed by: Hans Goudey
Differential Revision: https://developer.blender.org/D12534
2021-10-01 09:43:04 -05:00
e1952c541a Cleanup: unused function declaration
This should have been removed during the recent velocity attribute
refactor.
2021-10-01 16:41:50 +02:00
Johan Walles
fb820496f5 Tracking: Sort motion tracking tracks by start and end frames
Enable sorting motion tracking tracks by start / end times.

Help identifying what cases reconstructed camera jumps, based
on information about whether any track starts/ends at the frame.

Based on revision eb0eb54d96.

{F10563305}

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D12621
2021-10-01 16:29:38 +02:00
f497e471f8 Asset Catalogs: always have an Asset Catalog Tree available
Always create an `AssetCatalogTree` in the `AssetCatalogService`. This
ensures that newly-created catalogs are immediately visible in the UI
(because they insert themselves into an already-existing tree).
2021-10-01 16:15:50 +02:00
3be4cb5b27 Cleanup: Asset Catalog Test, fix clang-tidy warnings
No functional changes.
2021-10-01 15:24:04 +02:00
56ce51d1f7 Asset Catalogs: add catalog filter for the asset browser
Given an "active catalog" (i.e. the one selected in the UI), construct
an `AssetCatalogFilter` instance. This filter can determine whether an
asset should be shown or not. It returns `true` when The asset's catalog
ID is:

- the active catalog,
- an alias of the active catalog (so different UUID that maps to the
  same path),
- a sub-catalog of the active catalog.

Not yet hooked up to the UI.
2021-10-01 15:22:05 +02:00
1c7ce7e0b4 Cleanup: asset catalogs, make function const
Declare `AssetCatalogService::find_catalog()` as `const`, as it's not
requiring modification off the service object.

No functional changes.
2021-10-01 15:22:05 +02:00
271210126e Fix T91834: Appending objects with shape keys into new file is broken.
Recent append refactor 'broke' this, we need special recursive care and
handling of those nasty shpae keys... again.
2021-10-01 14:49:04 +02:00
f9acf21063 Python API Docs: add an example of Bone.convert_local_to_pose usage.
The use case for this method is quite obscure and difficult to
understand without an example. Despite how big looks, this is
actually the simplest example that makes sense.
2021-10-01 15:47:30 +03:00
bdc66c9569 GPU: set 'GL_PACK_ALIGNMENT' 1 as default
This fixes T91828.

The current value of `GL_PACK_ALIGNMENT` may result in crash in the `gpu` module if the buffer is not aligned.

Differential Revision: https://developer.blender.org/D12720
2021-10-01 09:11:37 -03:00
eb3a8fb4e8 Fix T91872: incorrect socket inspection on group nodes
This bug was introduced in rBef45399f3be0955ba8.
2021-10-01 13:21:03 +02:00
798e593002 Fix T87189: Copy/pasting IDs does not handle properly instantiation.
Copy/Paste uses its own code path for ID linking, which was not setting
`LIB_TAG_DOIT` for proper instantiation later on.

Would be nice the make this logic closer to the rest of the link/append
code at some point, but for now this fix will do.
2021-10-01 12:21:08 +02:00
21c29480c3 Fix paste code linking 'direct' IDs with 'INDIRECT' flag.
No idea why this was done that way (it originate from initial paste
commit, rB12b642062c6f).

But the IDs 'selected' as direct paste in `BLO_library_link_copypaste`
should be 'directly' linked, it's similar case to actual append of
selected IDs by the user.

Related to T87189.
2021-10-01 12:21:08 +02:00
928d644895 Append: Fix appended objects potentially auto-instantiated in more than one collection.
Related to T87189.
2021-10-01 12:21:08 +02:00
af0b7925db Fix T87536: incorrect socket types in reroute nodes
This refactors and fixes the code that propagates socket types
through reroute nodes. In my tests it is faster than the previous
code. The difference becomes larger the more reroute nodes
there are, because the old code had O(n^2) runtime, while the
new code runs in linear time.

Differential Revision: https://developer.blender.org/D12716
2021-10-01 11:42:00 +02:00
7843cd63d8 Fix T91839: incorrect active vertex group index
Differential Revision: https://developer.blender.org/D12712
2021-10-01 11:36:10 +02:00
ae4b45145c Cleanup: Asset Catalog Paths, move default constructor to header file
No functional changes.
2021-10-01 10:58:33 +02:00
2e6c6426d3 Asset Catalogs: test that missing catalogs are created once
Add asset catalogs test, to ensure missing catalogs are only created once,
and not for every originally defined catalog.

No functional changes to Blender (the code was already doing the right
thing).
2021-10-01 10:58:16 +02:00
bdb7d262aa Cleanup: clang-tidy warnings 2021-10-01 16:20:31 +10:00
b559fb178e Gizmo: hide 2D gizmos while transforming
Hide gizmos in the sequencer & UV editor while transforming.
2021-10-01 16:19:12 +10:00
4485dc483c Cleanup: use C-style comments, nullptr for C++
Minor changes extracted from D6408
2021-10-01 10:45:09 +10:00
Vitor Boschi
3a59ddb292 Fix: Incorrect warning in curve to mesh node with instances
The node was setting a warning when used with instances on input,
even though it worked fine.

Differential Revision: https://developer.blender.org/D12718
2021-09-30 18:27:58 -05:00
66fe1c79f3 Compositor: Fix Composite node using alpha when "Use Alpha" is off
Alpha input was not receiving the final composite canvas 
as preferred causing a Translate operation being inserted 
for centering. This resulted in a transparent background.
The issue only affects Full Frame mode.
2021-09-30 23:56:53 +02:00
e2df5c8a56 Compositor: Fix Flip node not flipping translation on Full Frame
To match tiled implementation, flip center should not be translated
when canvas has offset. Instead the canvas offset needs to be flipped.
2021-09-30 23:56:53 +02:00
f3274bfa70 Compositor: Fix Dilate/Erode node crash with Step option
It was writing the buffer out of bounds.
Only "Full Frame" mode was affected.
2021-09-30 23:56:53 +02:00
4569d9c0c3 Compositor: Fix Movie Distortion node rendering an empty image
Input area of interest calculation was incorrect because `m_margin`
was uninitialized.
Only "Full Frame" mode was affected.
2021-09-30 23:10:27 +02:00
Pratik Borhade
33dc584b37 Fix T91285: Bad tooltip for VSE Slip operator
This patch is created to change the tooltip for Slip Strip Contents
As per the present info, only active strip will be affected.
But in reality selected strips can be trimmed with this operator.

Word Trim changed to Slip in tooltip

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12450
2021-09-30 21:11:09 +02:00
Josef Raschen
213554f24a VSE: Add ASC CDL color correction method
Add Offset/Slope/Power controls to the color balance modifier. This is
already available in compositor.

Reviewed By: sergey, ISS

Differential Revision: https://developer.blender.org/D12575
2021-09-30 21:09:47 +02:00
8d60ac2bb0 Cleanup: Fix unused variable warning 2021-09-30 14:01:56 -05:00
Brecht Van Lommel
1a134c4c30 Cycles: refactor API for render output
* Add OutputDriver, replacing function callbacks in Session.
* Add PathTraceTile, replacing tile access methods in Session.
* Add more detailed comments about how this driver should be implemented.
* Add OIIOOutputDriver for Cycles standalone to output an image.

Differential Revision: https://developer.blender.org/D12627
2021-09-30 20:53:27 +02:00
a754e35198 Cycles: refactor API for GPU display
* Split GPUDisplay into two classes. PathTraceDisplay to implement the Cycles side,
  and DisplayDriver to implement the host application side. The DisplayDriver is now
  a fully abstract base class, embedded in the PathTraceDisplay.
* Move copy_pixels_to_texture implementation out of the host side into the Cycles side,
  since it can be implemented in terms of the texture buffer mapping.
* Move definition of DeviceGraphicsInteropDestination into display driver header, so
  that we do not need to expose private device headers in the public API.
* Add more detailed comments about how the DisplayDriver should be implemented.

The "driver" terminology might not be obvious, but is also used in other renderers.

Differential Revision: https://developer.blender.org/D12626
2021-09-30 20:48:08 +02:00
ac582056e2 Geometry Nodes: Swap order of geometry proximity inputs
"Target" is the most important, so it goes at the top.
2021-09-30 13:41:55 -05:00
Charlie Jolly
be70827e6f Nodes: Add Float Curve for GN and Shader nodes.
Replacement for float curve in legacy Attribute Curve Map node.

Float Curve defaults to [0.0-1.0] range.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D12683
2021-09-30 19:24:40 +01:00
827e30bd15 Geometry Nodes: Change default for mesh to points node
While "Vertices" may be less useful since mesh vertices are already
points, the output is more easily understandable, so it's a better
default.
2021-09-30 11:53:48 -05:00
6cff1d6480 Fix T91734: Crash snapping mesh if a beveled curve is present
`BKE_mesh_boundbox_get` cannot be called for objects of type Curve.

The BoundBox however does not match the object seen in the scene.
This will be dealt with in another commit.
2021-09-30 02:48:02 -03:00
dd3391dd99 Asset Catalogs: create missing parent catalogs
For every known catalog, ensure its parent catalog also exists. This
ensures that assets can be assigned to parent catalogs, even when they
didn't exist in the Catalog Definition File yet.
2021-09-30 17:34:58 +02:00
4389067929 Fix possible use-after-free in drag-drop handling logic
Would happen when there were multiple drag items in parallel. There was
a listbase constructed with twice the same item, even though that item
would be deleted after it was handled the first time.
2021-09-30 16:39:09 +02:00
4ee2d9df42 UI: Support easy dropping into/onto rows in new tree-view API
Adds an easy way to add drop support for tree-view rows.

Most of the work is handled by the tree-view UI code. The tree items can
simply override a few functions (`can_drop()`, `on_drop()`,
`drop_tooltip()`) to implement their custom drop behavior.

While dragging over a tree-view item that can be dropped into/onto, the
item can show a custom and dynamic tooltip explaining what's gonna
happen on drop.

This isn't used yet, but will soon be for asset catalogs.

See documentation here:
https://wiki.blender.org/wiki/Source/Interface/Views#Further_Customizations
2021-09-30 16:39:09 +02:00
42ce88f15c Cleanup: remove CatalogPath alias
The `CatalogPath` name was an alias for `std::string`, so that it could
be easily switched over to something else. This happened in the previous
commit (switched to `AssetCatalogPath`), so the alias is no longer
necessary.

This commit removes the `CatalogPath` alias.

No functional changes.
2021-09-30 16:34:30 +02:00
628fab696c Asset Catalog: introduce AssetCatalogPath class
So far we have used `std::string` for asset catalog paths. Some
operations are better described on a dedicated class for this, though.
This commits switches catalog paths from using `std::string` to a
dedicated `blender::bke::AssetCatalogPath` class.

The `using CatalogPath = AssetCatalogPath` alias is still there, and
will be removed in a following cleanup commit.

New `AssetCatalogPath` code reviewed by @severin in D12710.
2021-09-30 16:29:14 +02:00
5d42ea0369 GPencil: Change default template for better contrast in header
Patch created by Pablo Vazquez

This change darkens the header area a bit to create more contrast with the texts.

Differential Revision: https://developer.blender.org/D12711
2021-09-30 16:14:44 +02:00
d754d85845 Fix RigidBodyWorld copy using NO_MAIN instead of COW flag for cache handling.
We only want to share caches in case of CoW copying for the depsgraph,
not for regular `NO_MAIN` data.
2021-09-30 16:00:29 +02:00
1a72744ddc Fix T90246: Full Copy'ing a scene confuses physics in the original scene.
Handling of RigidBody data in duplicate of scenes/collections was very
wrong. This commit:
 - Add handling of duplication of RB collections when fully duplicating
   a scene.
 - Fix Object duplication trying to add duplicated RB objects to
   matching RBW collections.

While the later behavior is desired when only duplicated objects, when
duplicating their collections and/or scenes it is actually very bad, as
it would add back new object duplicates to old (RBW) collections.
2021-09-30 16:00:29 +02:00
779ea49af7 Cleanup: move node_common.c to c++
Buildbot compiled without problems.
2021-09-30 15:44:08 +02:00
07c5d02a11 Asset Browser: Support activating catalogs in the "Current File" library
If the "Current File" asset library is selected in the Asset Browser,
now asssets are filtered based on the active asset catalog. Previously
it would just show all assets. This was marked as a TODO in the code
already.

Maniphest Task: https://developer.blender.org/T91820
2021-09-30 15:23:13 +02:00
3453b22b1e Fix: Curve to Mesh node outputs original curve
It should only output the new mesh (and potentially instances
that are processed separately).
2021-09-30 13:33:21 +02:00
9628ef4135 Fix: wrong field input deduplication with Material Selection node 2021-09-30 12:51:09 +02:00
80d7cac22d Fix T91773: improve numerical stability in Curve Spiral node 2021-09-30 12:33:34 +02:00
ae0f944a57 Fix Cycles viewport flickering
Caused by a lack of synchronization between update process which sets
clear flag and the draw code checking the flag outside of a lock.
2021-09-30 11:44:53 +02:00
5f632f9f6e Fix color width regression in 66e24ce35b
Color buttons were drawing single icon width.
2021-09-30 17:45:09 +10:00
af13168a3f Cleanup: remove unused SpaceImage.curtile 2021-09-30 17:32:48 +10:00
e9dac3eab8 Cleanup: reduce Sequence size by 8 bytes
Also use int8_t for color tag.
2021-09-30 17:32:46 +10:00
fdcae48663 Cleanup: isolate UDIM parameters into a struct
Passing multiple UDIM arguments into the packing function
is awkward especially since the caller may not be using UDIM.

Use an argument to store UDIM packing parameters which can be NULL,
which operates without any UDIM support.

Add a function that extracts these parameters out of the image space
allowing for multiple functions to take UDIM parameters in the future.
2021-09-30 17:32:45 +10:00
2c2516bfc9 Fix(unreported): LineArt curve objects garbled result.
This is caused by line art loading curve objects twice from curve and converted mesh instances (when instance option is on). Now only load mesh when instance option is on.
2021-09-30 13:30:10 +08:00
66e24ce35b Fix menu width regression in c7d94a7827
Icon only popup buttons needed to be adjusted too,
add an uiTextIconPadFactor.icon_only to support this.
2021-09-30 12:43:52 +10:00
84dcf12ceb UI: Increase Area Resize Edge Hit Size
This patch increases the size of the Area BORDERPADDING a bit to make
it easier to hit the edges when initiating area resizing.

See D11925 for details and examples.

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

Reviewed by Campbell Barton
2021-09-29 15:05:58 -07:00
81f552e9ad Geometry Nodes: Expose Bezier handle positions as an attribute
This commit exposes left and right bezier handles as an attribute.
Interaction basically works like edit mode. If you move an aligned
handle, it also moves the opposite handle of the control point.
The difference is that you can't edit "Auto" or "Vector" handles,
you have to first use the "Set Handle Type" node. That gives the handle
types a bit more meaning in the node tree-- changing them in edit mod
is more like a "UI override".

The attributes are named `handle_start` and `handle_end`,
which is the same name used in the curve RNA API.

A new virtual array implementation is added which handles the case of
splines that don't have these attributes, and it also calls two new
functions on `BezierSpline` to set the handle position accounting
for aligned handles.

The virtual arrays and attribute providers will be refactored
(probably templated) in the future, as a next step after the last
built-in curve attribute provider has landed.

Differential Revision: https://developer.blender.org/D12005
2021-09-29 15:29:29 -05:00
cd03f5b6e5 Add RNA path funcs for VolumeRender & VolumeDisplay
Without proper RNA paths, Alt-click editing properties on multiple
selected objects doesn not work (as well as the 'Copy To Selected'
operator).

Fixes T91806.

Maniphest Tasks: T91806

Differential Revision: https://developer.blender.org/D12700
2021-09-29 21:39:56 +02:00
0cddbcf1d7 Fix T91803: Freestyle rendering as pass broken after recent changes 2021-09-29 21:14:37 +02:00
a2e321aa6d Cleanup: Compositor: Migrate most converter nodes to new socket builder
This migrates most nodes except for the switch view node.
This node requires dynamic sockets so its implementation will be more involved.
2021-09-29 14:48:30 -04:00
d3d021601d Nodes: Fix Split View missing identifier
Mistake from rB84251acfcc4534059d6ccd6682f8e37d529b9063
2021-09-29 14:48:30 -04:00
19785cb022 Fix Cycles CPU performance regression after recent change for intersections size
This struct is much bigger now, and does not actually need to be fully zero
initialized.
2021-09-29 20:25:16 +02:00
Himanshi Kalra
22c61e8060 Tests: Disable tests for non-compiled libraries
This diff disables tests for Boolean, subdivision surface and volume
when GMP, Opensubdiv and Openvdb are not compiled respectively.
It also changes the existing file structure and adds sub-folders for
boolean and subdivison tests. The volume folder only has one test and
is as unchanged structure-wise.

Reviewed By: JacquesLucke, LazyDodo

Differential Revision: https://developer.blender.org/D12448
2021-09-29 23:52:52 +05:30
6f23e4484d Fix non-finite curve normal causing Cycles to crash
Similar to the previous change in the area: need to avoid ray
point and direction becoming a non-finite value.

Use the view direction when the geometrical normal can not be
calculated.

Collaboration and sanity inspiration with Brecht!

Differential Revision: https://developer.blender.org/D12703
2021-09-29 19:49:59 +02:00
1d478851f8 GPencil: Avoid double depsgraph tag
The eval data is updated at the end of the function and this call just adds a calculation not used.
2021-09-29 19:21:54 +02:00
214baf5422 Assets: Enable recursive reading for the asset view template as well
This makes asset view templates, e.g. as used by the Pose Library add-on
use recursive asset loading, see

Also works around an issue that made assets not show up at all anymore
since fc7beac8d6. I'm creating a separate report for that regression,
but in the Asset Browser and Viewer it shouldn't be apparent currently.
2021-09-29 18:51:10 +02:00
45a312fd8f Fix build failure on Windows + wrong buffer size
Was using `NAME_MAX` which is defined in `limits.h`, which again may be
implicitly included by the compiler. Intend was to use the Blender
define `MAX_NAME`.
2021-09-29 17:49:42 +02:00
9d9f205dc4 Asset Browser: Initial Asset Catalog UI
The Asset Browser now displays a tree with asset catalogs in the left
sidebar.
This replaces the asset categories. It uses the new UI tree-view API
(https://wiki.blender.org/wiki/Source/Interface/Views#Tree-View).
Buttons are displayed for adding and removing of catalogs. Parent items
can be collapsed, but the collapsed/uncollapsed state is not stored in
files yet.
Note that edits to catalogs (e.g. new or removed catalogs) are only
written to the asset library's catalog definition files when saving a
.blend.

In the "Current File" asset library, we try to show asset catalogs from
a parent asset library, or if that fails, from the directory the file is
stored in. See adaf4f56e1.

There are plenty of TODOs and smaller glitches to be fixed still. Plus a
UI polishing pass should be done.

Important missing UI features:
* Dragging assets into catalogs (WIP, close to being ready).
* Renaming catalogs
* Proper handling of catalogs in the "Current File" asset library
  (currently not working well).

The "Current File" asset library is especially limited still. Since this
is the only place where you can assign assets to a catalog, this makes
the catalogs very cumbersome in general. To assign an asset to a
catalog, one has to manually copy the Catalog ID (a random hash like
number) to the asset metadata through a temporary UI in the Asset
Browser Sidebar. These limitations should be addressed over the next few
days, they are high priority.

Differential Revision: https://developer.blender.org/D12670
2021-09-29 17:15:23 +02:00
df9120b365 Fix T89864: Adding an asset referencing other objects adds it to scene but only adds data-blocks of referenced objects.
Link/append code needs proper access to scene/view3d data to handle
collections/objects instantiation.

Note that this is a temporary hack more than a proper fix, which would require
a deeper redesign of drag&drop code.

Also note that this will not handle 'properly' (i.e. as user would
expect it) cases like implicitely appended parent objects, in that only
the explicitely appended object will be dropped to the nes location, the
others will remain at their original coordinates.

Differential Revision: https://developer.blender.org/D12696
2021-09-29 17:10:42 +02:00
6aac892fad Cleanup: Enforce C linkage for internal File Browser header
This will be used by C++ code in the upcoming asset catalog UI commit.
2021-09-29 16:59:48 +02:00
367775ac6a Fix Cycles use of uninitialized value in volume stack intersection on CPU
Could cause an actual bug but probability is low in practice.
2021-09-29 16:37:32 +02:00
4d4113adc2 Cycles: record large number of transparent shadow intersections on CPU
So we can do fewer intersection calls, only on the GPU do we need to save
memory and do this in small steps.

Ref T87836
2021-09-29 16:37:32 +02:00
fe070fe33b Fix Cycles crash in certain hair configurations
The issue was caused by hair shader setup setting normal to a non
finite value, which then gets used to create a ray with non-finite
direction, making BVH traversal to run out of stack memory.

Happens with 150_0040_A.lighting.blend frame 112 of the Sprites
project.

Differential Revision: https://developer.blender.org/D12692
2021-09-29 16:14:23 +02:00
901fa96b7f Keymap: New preference to open folders on single click in file browser
Introduce a new keymap preference to navigate into folders by clicking on them once instead of twice.
Makes browsing folders faster albeit non-standard, so keeping this off by default for now.

Does not affect Industry Compatible or other keymaps.

It is still the possible to right-click to open context menu, hold Ctrl or Shift to select multiple items:

{F10651030, size=full}

----

Keymap preference:

{F10652759, size=full}

Part of T91537

Reviewed By: fsiddi, campbellbarton

Differential Revision: https://developer.blender.org/D12667
2021-09-29 15:57:57 +02:00
1f4545dc9c Cleanup: else-after-return 2021-09-29 15:48:16 +02:00
b80ed8396d Fix T89164: Sculpt "Smooth" brush crash with zero pressure
Caused by {rB3e5431fdf439}

Issue is that sculpting could start with using `SCULPT_smooth` and
(because of the Pressure sensitivity dropping to zero) code would switch
to `SCULPT_enhance_details_brush` at strength zero.
Issue with this though is that this can be in the middle or end of a
stroke and the necessary `ss->cache->detail_directions` are only
initialized for the first brush step (see
`SCULPT_stroke_is_first_brush_step` in `SCULPT_enhance_details_brush`).
With these missing, it could only go downhill from there.

Suggest to prevent the "mode-flip" from `SCULPT_smooth` to
`SCULPT_enhance_details_brush` (happening solely because of pressure
strength) by changing the condition.
Now do `SCULPT_enhance_details_brush` only if strength is **below** zero
and `SCULPT_smooth` else (flipping from enhance_details to regular smooth
is fine).

If inverting the brush in the middle of the stroke will be supported at
some point, the codepath of `smooth` would have to inform the cache that
invert changed and detail_directions would have to be initialized then
(even if not at the start of the stroke).

Maniphest Tasks: T89164

Differential Revision: https://developer.blender.org/D12676
2021-09-29 15:07:45 +02:00
c33a005297 Texts in Outliner dont activate
Texts in Outliner dont activate on selecting (Text Editor did not change
to selected text) which is a bit inconsistent to other ID types.

ref T90862

Maniphest Tasks: T90862

Differential Revision: https://developer.blender.org/D12412
2021-09-29 15:07:13 +02:00
ef29bf9023 Assets: Expose option to reuse data-block data when appending
With 794c2828af & f48a4aa0f9 it's possible to reuse possibly
expensive, nested data of a data-block when appending. E.g. the
texture of a material, or the mesh of an object. Without this it's easy
to bloat memory and the file size. Duplicated textures also cause
unnecessary shader recompilations.

The feature was intended to be the new default behavior for the Asset
Browser, but it wasn't actually added to the UI yet. This patch adds a
new import type option to the Asset Browser. So from the menu in the
header, you can now choose between:

* Link
* Append
* Append (Reuse Data)

The latter is the new default.

Maniphest Task: https://developer.blender.org/T91741

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

Reviewed by: Sybren Stüvel, Bastien Montagne
2021-09-29 15:02:38 +02:00
Falk David
5cebcb415e VSE: Add color tags to strips
This patch adds color tags to VSE strips, an overlay option to toggle the colors
on and off, a section in the theme settings to define the 9 possible colors and
two ways of changing the color tag through the UI. You can change the color
through the right-click context menu, or in the strip side panel next to the
strip name.

Color tags are defined in user preferences and they can be disabled in overlay
settings.

Reviewed By: campbellbarton, ISS

Differential Revision: https://developer.blender.org/D12405
2021-09-29 14:34:01 +02:00
ffb9577ac9 Cycles: Ensure finite displacement and background evaluation
Avoids possible numerical issues in the path tracing kernel, which
is most important for displacement as non-finite values in BVH can
lead to infinite node recursion during traversal.

Differential Revision: https://developer.blender.org/D12690
2021-09-29 14:06:10 +02:00
731325a022 Cycles: Make sure GPU transfer is finished prior display update
Noticed while looking into flickering issues in viewport.

Doesn't seem to solve the flicker issue for me, but is something
what is supposed to be happening anyway.

Differential Revision: https://developer.blender.org/D12673
2021-09-29 14:05:51 +02:00
adaf4f56e1 Support loading catalogs in the Current File asset library
When the Asset Browser shows the "Current File" asset library, now it
also attempts to load an asset catalog definition file from location of
the current .blend file. This happens as follows:
* First, see if the file is inside of an asset library that is "mounted" in the
  Preferences. Load the catalogs from there if so.
* Otherwise, if the file is saved, load the catalogs from the directory the
  file is saved in.
* If the file is not saved, no catalogs will be loaded.

Unit tests are being worked on in D12689.

Creating catalogs from the "Current File" asset library still doesn't work, as
the asset catalog service doesn't construct an in-memory catalog definition
file in that case yet.

Differential Revision: https://developer.blender.org/D12675
2021-09-29 13:18:44 +02:00
Gaia Clary
78b9a8c7b9 Add an option to silence bpy.ops.anim.keyframe_delete_v3d when used in Addons
The issues:

1.) When we want to remove keyframes from a range of frames in an
action,
then we can use bpy.ops.anim.keyframe_delete_v3d to remove the keys
frame by frame. However, whenever the operator hits a frame with no
keyframes, then it generates an error. While when it hits a frame
with keyframes, then it reports the numbner of removed keys.

This creates a lot of unnecessary noise in the Blender console.

2.) Furthermore a related issue is that WM_event_add_notifier() is
called also when no frames where removed. This seems to significantly
slow down the removal of keyframes in a range of frames at least
when i use vscode for debugging.

A proposal for improvement:
This patch adds an attribute 'confirm_success' which controls
if the operator reports back what it did (or did not) while
executing. Silent mode would then be called like this:

bpy.ops.anim.keyframe_delete_v3d(confirm_success=False)

Note: confirm_success is True by default so this patchj does not
change the behavior of Blender, it only gives the option to scripts.

3.) Personal note:
I have chosen the attribute name to be equal as it is used
in other related operators. However i rather would rename the
attribute to "verbose" (preferred) or "with_confirm". But i let this
to be decided by the reviewers. Thanks for your time to review!

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12629
2021-09-29 13:09:17 +02:00
6351c73b75 Fix T88954: Rearranging of modifiers for linked objects no longer works.
There would be no modifier set in context in drag and drop case, in that
case try to get active modifier from active object instead.
2021-09-29 12:53:57 +02:00
0c32e3b312 Fix T91756: String to Curve node produces NaN when size is zero 2021-09-29 12:40:36 +02:00
4cf4bb2664 UI: swap tool and regular header
Swap the tool-header and header order so the tool-header
so the header is always next to the window edge.

Note that files saved in 3.0 will have overlapping headers when opened
in any version of Blender before this commit.

Reviewed By: Severin, fsiddi

Maniphest Tasks: T91536

Ref D12631
2021-09-29 20:03:47 +10:00
eabb134840 Fix T91802: vertex color layer name collides with itself
Vertex colors are already included in `mesh.attributes`. So they don't
have to be added to the collision checks separately.
2021-09-29 11:01:17 +02:00
24a965bb16 Fix T91767: crash when instancing geometry coming from modifier
The issue was that the `GeometrySet` that comes from the modifier does
not have full ownership of the mesh for legacy reasons to avoid copies.
Calling `ensure_owns_direct_data` makes sure that the geometry set
actually owns the geometry so that it can be instanced.
2021-09-29 10:55:32 +02:00
f51bef75f4 Geometry Nodes: instance on points in instances
For consistency with other nodes, we also want to process
all instances in the Points input independently. This allows
for more efficient instancing of many objects but also leads
to nested instancing. All instances are processed in their
local space, so that instances don't have to be realized.

Differential Revision: https://developer.blender.org/D12660
2021-09-29 10:10:12 +02:00
8cbec0beb2 Fix/bypass doversion for wire new colors
Some cases were not covered by the original doversion in
4a0ddeb62b. For now we make it always change the wire color regardless
of whether it was changed before or not.

This do a subversion bump.
2021-09-29 09:58:55 +02:00
Siddhartha Jejurkar
a285299ebb UV: Pack to closest/active UDIM
Implements T78397
Extends the functionality of pack islands operator to allow packing UVs
to either the closest or active UDIM tile.
This provides 2 new options for packing UVs :

* Closest UDIM: Selected UVs will be packed to the UDIM tile they were
  placed on. If not present on a valid UDIM tile, the UVs will be packed
  to the closest UDIM in UV space
* Active UDIM: Selected UVs will be packed to the active UDIM image tile
  In case, no image is present in the UV editor, then UVs will be packed
  to the tile on the UDIM grid where the 2D cursor is located.

Reviewed By: campbellbarton

Maniphest Tasks: T78397

Ref D12680
2021-09-29 17:53:09 +10:00
Siddhartha Jejurkar
bf06f76be6 UV Editor: Grid and snapping improvements
Implements T89789, T89792, custom grid (described as dynamic grid in
T78389) and UV grid snapping (T78391)
Replaces the default UV editor grid with 2 new types of grid :

* Custom grid: Allows the user to create an NxN grid, where the value
  of N is specified by the user.
* Subdividing grid: Subdivides the UV editor grid when the user
  zooms in the viewport and vice versa when zooming out.

UV snapping improvements :
* Increment snapping: Increment values for snapping are calculated based
  on which grid type is being used in the UV editor
  (subdividing or custom). In general the increment value is equal to
  the distance between 2 visible grid lines.
* Absolute grid snap: New toggle added to increment snapping option in
  the UV editor, allows UV grid snapping during translation.

Reviewed By: campbellbarton

Ref D12684
2021-09-29 17:48:35 +10:00
008ae26712 Fix T91237: Wrong Editors could sync animation 'Visible Range'
This was reported for the Outliner.

It was possible to set 'show_locked_time' on any space (via python, not
sure if there are other ways to achieve this).
Navigating in an animation editor obviously ruined the layout in certain
Editors that are not made for this.

Now restrict syncing to editors that support it well (the ones that have
this setting exposed in their menus) and prevent setting this in RNA.

Maniphest Tasks: T91237

Differential Revision: https://developer.blender.org/D12512
2021-09-29 09:12:47 +02:00
eddc3f5bc8 Cleanup: Add constructor for AttributeFieldInput 2021-09-28 23:19:33 -05:00
756c22bb41 Cleanup: Compositor: Migrate color nodes to new socket builder 2021-09-29 00:09:41 -04:00
d1220f795f UI: Update Levels Nodes
- Instead of making the enum expanded leave it in menu form.
- Use full words instead of letters.

Differential Revision: https://developer.blender.org/D12686
2021-09-28 21:36:15 -04:00
8e40bb2dea Nodes: Fix compositor viewer nodes having wrong alpha channel
Default should be black image with an alpha value of 1.
2021-09-28 20:33:42 -04:00
84251acfcc Cleanup: Compositor: Migrate most output nodes to new socket builder
This migrates most nodes except for the file output node.
This node requires dynamic sockets so its implementation will be more involved.
2021-09-28 20:13:42 -04:00
e81533b25e Cleanup: Simplify compositor Z Combine operation conversion 2021-09-28 18:46:10 -04:00
f0f70729b1 Fix: Knife undo with no cut segments left
Now if a user presses the knife tool undo key when there are no more cut segments to undo, the operator exits. Previously, it did nothing.
2021-09-28 23:09:54 +01:00
7f5d62dfc6 Cleanup: Make format 2021-09-28 18:03:33 -04:00
4a48482247 Cleanup: Compositor: Migrate most input nodes to new socket builder
This migrates most nodes except for the image/render layer nodes.
These nodes require dynamic sockets so their implementation will be more involved.
2021-09-28 18:00:14 -04:00
960b21e1d7 Cleanup: sort cmake file lists 2021-09-29 07:30:34 +10:00
6dceaafe5a Cleanup: trailing space, newlines at EOF 2021-09-29 07:30:34 +10:00
b524153d61 Cleanup: use C comments for plain text 2021-09-29 07:30:34 +10:00
79290f5160 Cleanup: spelling in comments 2021-09-29 07:29:15 +10:00
efe3a13b55 Cleanup: Removed redundant if macro 2021-09-28 21:57:42 +01:00
9f0a3a99ab Geometry Nodes: Fields version of attribute proximity node
Add a fields-aware implementation of the attribute proximity node.
The Source position is an implicit position field, but can be
connected with a position input node with alterations before use.
The target input and mode function the same as the original node.

Patch by Johnny Matthews with edits from Hans Goudey (@HooglyBoogly).

Differential Revision: https://developer.blender.org/D12635
2021-09-28 15:21:36 -05:00
283d76a70d Compositor: Full frame Glare node
Part of T88150.
2021-09-28 22:00:17 +02:00
0830211c95 Cleanup: Remove XRange and YRange in Compositor
Mostly unused and originally meant for areas with positive values.
With canvas compositing areas position may be negative.
2021-09-28 22:00:17 +02:00
f84fb12f5d Compositor: Add support for canvas compositing
This commit adds functionality for operations that require pixel
translation or resizing on "Full Frame" mode, allowing to adjust
their canvas. It fixes most cropping issues in translate, scale,
rotate and transform nodes by adjusting their canvas to the result,
instead of the input canvas.

Operations output buffer is still always on (0,0) position for
easier image algorithm implementation, even when the
canvas is not.

Current limitations (will be addressed on bcon2):
- Displayed translation in Viewer node is limited to 6000px.
- When scaling up the canvas size is limited to the
 scene resolution size x 1.5 . From that point it crops.

If none of these limitations are hit, the Viewer node displays
the full input with any translation.

Differential Revision: https://developer.blender.org/D12466
2021-09-28 22:00:17 +02:00
76377f0176 Compositor: Replace resolution concept by canvas
This is a code refactor in preparation of supporting canvas
compositing. See {D12466}.

No functional changes, all canvases are at (0,0) position matching
tiled implementation.

Differential Revision: https://developer.blender.org/D12465
2021-09-28 22:00:16 +02:00
2ecd963d87 Fix error in previous commit
`v_other` -> `v_step`
2021-09-28 16:57:49 -03:00
5cdb2aadfc Fix flag wrongly set in 'BM_face_split_edgenet_connect_islands'
Sometimes the `use_partial_connect` option could trigger the assert:
```
BLI_assert(!BM_elem_flag_test(l_iter->v, VERT_NOT_IN_STACK));
```

This can happen when `v_delimit->e` is not part of edgenet, so `v_other` will not have the flag.
2021-09-28 16:54:23 -03:00
Aaron Carlisle
c7a7c3f5e5 Cleanup: convert compositor nodes to c++
- Many cleanups of to use list base
- Some variable changes

These change is needed to migrate to the new socket builder API

Reviewed By: manzanilla

Differential Revision: https://developer.blender.org/D12366
2021-09-28 15:30:23 -04:00
87e315c237 Cleanup: Sort node types alphabetically 2021-09-28 14:20:29 -05:00
Johnny Matthews
85aac0ef6a Geometry Nodes: Field version of curve reverse node
The updated version has a selection input as a field
and does not realize instances implicitly.

Differential Revision: https://developer.blender.org/D12506
2021-09-28 13:53:20 -05:00
cc653c9b02 Fix potential render tests error with invalid utf-8 characters
In general should not happen, but better to report the actual error instead
of the Python test code failing.
2021-09-28 20:50:38 +02:00
95fca22bfe Geometry Nodes: Remove experimental option for fields
This enables fields as the official workflow for geometry nodes.
While many features are converted to use fields rather than the old
attribute workflow, many are not yet converted. In that case, the
unconverted nodes are still accessible with an experimental option.
In the coming weeks the rest of the nodes will be converted.

Differential Revision: https://developer.blender.org/D12672
2021-09-28 13:22:52 -05:00
86ec9d79ec Fix build without Cycles HIP device 2021-09-28 20:00:55 +02:00
e45ffce5fa Geometry Nodes: Use factor slider for distribution density factor
Though the factor isn't so useful to adjust by itself, and is mostly
useful when used with a field connected, the slider from 0 to 1 can
help to make it clear that it's just used as a multiplier for the max
density after distribution.

Differential Revision: https://developer.blender.org/D12654
2021-09-28 12:44:50 -05:00
Erik Abrahamsson
faedfd5740 Fix VS2017 compile error in String to Curves node
Because of a bug in VS2017 codecvt is replaced with Blender
BLI functions to convert from UTF8 to UTF32.

Differential Revision: https://developer.blender.org/D12655
2021-09-28 12:37:56 -05:00
Brian Savery
044a77352f Cycles: add HIP device support for AMD GPUs
NOTE: this feature is not ready for user testing, and not yet enabled in daily
builds. It is being merged now for easier collaboration on development.

HIP is a heterogenous compute interface allowing C++ code to be executed on
GPUs similar to CUDA. It is intended to bring back AMD GPU rendering support
on Windows and Linux.

https://github.com/ROCm-Developer-Tools/HIP.

As of the time of writing, it should compile and run on Linux with existing
HIP compilers and driver runtimes. Publicly available compilers and drivers
for Windows will come later.

See task T91571 for more details on the current status and work remaining
to be done.

Credits:

Sayak Biswas (AMD)
Arya Rafii (AMD)
Brian Savery (AMD)

Differential Revision: https://developer.blender.org/D12578
2021-09-28 19:18:55 +02:00
262b211856 Geometry Nodes: Mesh Point Cloud Conversion Nodes
This commit adds nodes to do direct conversion between meshes and point
clouds in geometry nodes. The conversion from mesh to points is helpful
to instance once per face, or once per edge, which was previously only
possibly with ugly work-arounds. Fields can be evaluated on the mesh
to pass them to the points with the attribute capture node.

The other conversion, point cloud to mesh vertices, is a bit less
obvious, though it is still a common request from users. It's helpful
for flexibility when passing data around, better visualization in the
viewport (and in the future, cycles), and the simplicity of points.

This is a step towards T91754, where point clouds are currently
combined with meshes when outputing to the next modifier after geometry
nodes. Since we're removing the implicit behavior for realizing
instances, it feels natural to use an explicit node to convert points
to vertices too.

Differential Revision: https://developer.blender.org/D12657
2021-09-28 12:14:13 -05:00
797064544e Geometry Nodes: Only show attribute toggle for field inputs
Change the toggle to switch between an attribute and a single value to
only display for inputs that are fields, as determined statically by
the field inferencing added in rB61f3d4eb7c7db7. This means the field
inferencing must be calculated on file load, since it's used in the UI.

Differential Revision: https://developer.blender.org/D12623
2021-09-28 12:05:42 -05:00
44e4f077a9 Geometry Nodes: Run nodes once on unique instance data
As described in T91672, often it can be much more efficient to run each
node only on the unique geometry of the instances, rather than realizing
all instances and potentially processing redundant data. Sometimes the
performance difference can be completely smooth vs. completely unusable.

Geometry nodes used to hide that choice from users by always realizing
instances, but recently we have decided to expose it. So this commit
makes nodes run once per unique reference in the entire tree of nested
instances in their input geometries, continuing the work started in
rB0559971ab377 and rBf94164d89629f0d2. For the old behavior, a realize
instances node can be added before the nodes, which is done in the
versioning code.

Differential Revision: https://developer.blender.org/D12656
2021-09-28 11:36:28 -05:00
b32b38b380 Fix T89400: Possible to delete objects used by overrides of collections.
This should not be allowed in general, added some initial call to check
when user is allowed to delete a data to search for mandatory override
usages...
2021-09-28 18:30:33 +02:00
f35ea668a1 Geometry Nodes: Move more nodes to legacy
- Curve to Points: Needs output sockets
- Curve Endpoitns: Needs the same output sockets
- Edge Split: Should have a selection input instead
- Subdivision Surface: Should not use "crease" implicitly
All new versions of these nodes should also not implicitly
realize instances.
2021-09-28 11:03:12 -05:00
e694165123 VSE: fix versioning code to the new maximum zoom level (128)
Since we bumped the number of channels to 128, I forgot to doversion the
editors. So new files (new editors) would have this right, but not
existing files.

Fixup to: 8fecc2a852
2021-09-28 17:58:41 +02:00
6ee2f2da96 Cleanup: asset catalog, remove obsolete TODO
No functional changes.
2021-09-28 17:47:34 +02:00
10d926cd4a Cleanup: asset catalogs, move file header definition to constant
Define the standard catalog definition file header in a constant,
separating it from the function that writes the entire file.

No functional changes.
2021-09-28 17:47:34 +02:00
3acf3e9e2f Geometry Nodes: don't realize instances in Instance on Points node
Part of T91672.
2021-09-28 17:46:32 +02:00
330a04d7c7 Fix T91393: Duplicating an action with python crashes Blender.
Own mistake when making NLA overridable, instead of assuming things
about the ID owner of the animation data being processed, properly
return and use the one found by `ED_actedit_animdata_from_context`.
2021-09-28 17:41:40 +02:00
53fa4801a0 Fix: Fluid/Cloth/DynamicPaint: Only share pointcaches in CoW case.
Particle copying code was already properly sharing pointcache between
orig data and its copy only when `LIB_ID_COPY_SET_COPIED_ON_WRITE` is
set, do the same for the other point cache users.

Using `LIB_ID_CREATE_NO_MAIN` here is waaaaaaay to much wide scope for
such a dangerous/advanced behavior, that kind of things has to be
strictly restricted in scope.
2021-09-28 17:41:40 +02:00
34ba6968b2 Cleanup: asset catalog service, remove obsolete write_to_disk function
Remove `AssetCatalogService::write_to_disk()` function. It has been
superseded by `write_to_disk_on_blendfile_save()`; the handful of test
functions that called the old function have been adjusted to use the
new one.

No functional changes to Blender itself.
2021-09-28 17:32:58 +02:00
f17ca53cdd Fix wrong update with shadow catcher and transparent film
This change fixes an issue when scene has a shadow catcher and film is
configured to be transparent. Starting viewport render and making the
background non-transparent will cause bad memory access (wrong render
and possibly crash).

Film passes depends on transparency of background, so check for this.

Demo file: F10650585

Differential Revision: https://developer.blender.org/D12666
2021-09-28 17:06:16 +02:00
640c4ace0b Cycles: Disable tile-level denoising
Only do denoising on the full-frame result. Saves render time.

Can re-consider in the future when/if we'll want to support
denoising during rendering (similar to viewport) to allow artists
to stop rendering when they see image to be good enough. Until
there is a design for that workflow stick to a more time efficient
rendering.

Differential Revision: https://developer.blender.org/D12662
2021-09-28 17:05:47 +02:00
ff7e67afd5 Geometry Nodes: Dashed lines for function flow
Use dashes to represent the function flow (while keeping continuous
lines for the data-flow).

It is important to tell both flows apart (the data and the function
 flow). The sockets help with that, the noodles help this further.

The "data flow" is evaluated at every single node. A user can inspect
the output sockets of those nodes and have a glimpse at their values.

The "function flow" (nodes) however is only evaluated in the geometry
nodes. The noodles are not transporting data in the same sense of the
"data flow". All that can be inspected are the attributes the functions
depend on.

Having this clearly communicated should help users to inspect the
nodetrees, read and understand the different flows in the same tree.

---

Known limitations:

At the moment the dash lines are not equidistant:

* It would be nice to get the "uv.x" to be resampled for the bezier curve
so the dashes are equally distributed in the curve.

* Using distance between the P3 and P0 instead of the real bezier curve
length seems to be fine.

---

Full disclaimer:

Changes with that much of a visual impact tend to be controversial. So
far the main feedback is that dashed lines can be associated to broken
link, and that there are better ways to represent the flows (or
different information that should be visually represented).

I'm fully aware of that. However dashed lines are already used in the
viewport and outliner to indicate (hierarchical) relation. Besides,
other approaches (double-lines, having the data flow to be more
distinct, ...) didn't pan out in the end (or didn't look as good as
this).

---

Impact in other editors:

The compositor uses mostly a "data flow" nodetree, so no change is
expected there.

The shader nodetree is one that could but doesn't have to change its
visual language.

The shader nodetree uses mostly "function flow" with some "data flow" nodes.
One can argue that it should be adapted to follow the
same pattern as geometry nodes (with the new noodles and the diamond
sockets). Oh the other hand, a shader nodetree has a single context.
When a node depends on the "UV", there is only one UV at a time for the
entire nodetree. So it can also be treated as a psedo "data flow"
nodetree if we want to avoid too many changes in other parts of Blender.

Differential Revision: https://developer.blender.org/D12602
2021-09-28 17:03:03 +02:00
728ae33f37 Cycles: Improve handling of tile file error
Expose them to the interface, and stop rendering as soon as possible.

Differential Revision: https://developer.blender.org/D12617
2021-09-28 16:58:27 +02:00
52a702468a Asset Catalog Service: add function to change catalog path
Add `AssetCatalogService::update_catalog_path()` to change the catalog
path of the given catalog, and also change the path of all the catalogs
contained within the given catalog.

Rebuilds the tree structure for the UI, but does not save the new catalog
definitions to disk.

No user-facing changes, just backend preparation for UI work.
2021-09-28 16:09:12 +02:00
d2004326a1 Geometry Nodes: remove empty mesh component in distribute node output 2021-09-28 15:52:31 +02:00
3e78c9e5bb Fix T91766: NLA Editor - Segmentation fault on strip resize
NLA and Dope Sheet use a specific transform operation to scale.

Unlike the conventional resize operation, `TIME_SCALE` operates on `td->val`.

This is a bit outside the convention of transform operators.

The expected thing in this case would be to work in `td->loc` and use the conventional resize operator.

But for now, to fix the problem, use `td->loc` in the `TIME_SCALE` operation.

This commit also brings a cleanup in the style of some comments and removing unnecessary `memset`.
2021-09-28 10:24:02 -03:00
3674347849 Assets: Clear Asset operator variants for clearing/setting Fake User
The Clear Asset operator (`ASSET_OT_clear`) now clears the Fake User.
This makes it symmetrical with the Mark Asset (`ASSET_OT_mark`)
operator, which sets Fake User to ensure assets are always saved to
disk.

Clear Asset now also has a `set_fake_user` boolean option, which allows
users to Clear Asset and set Fake User in one go.

The asset browser now shows these options in the context menu:
- Clear Asset: also clears Fake User. This makes it possible to actually
  remove assets from the blend file without leaving the Asset Browser.
- Clear Asset (Set Fake User): keeps the Fake User bit set. This makes
  it possible to "hide" the asset from the asset browser, without
  loosing the actual data.

Internally, the `ED_asset_clear_id(id)` function now always clears the
Fake User bit. If it was intended that this bit was kept set, it's up to
the caller to explicitly call `id_fake_user_set(id)` afterwards.

Manifest Task: T90844

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12663
2021-09-28 15:04:55 +02:00
73b2ecb297 Cleanup: typo in comment
Noticed by @david_black in D12392, thx!
2021-09-28 14:37:06 +02:00
Vitor Boschi da Silva
9490db1ad2 Cleanup: remove unused variable
As the title says

Reviewed By: lichtwerk, campbellbarton

Differential Revision: https://developer.blender.org/D12665
2021-09-28 14:29:02 +02:00
6a745e54f6 Cleanup: remove incorrect assert
The method works perfectly fine when `resource` is empty.
2021-09-28 13:32:22 +02:00
5d160dec3b Geometry Nodes: move legacy nodes to separate folder
Previously, we were moving them one by one. It's a lot easier
to just move all files at the same time.
2021-09-28 11:31:46 +02:00
b3431a8846 Fix Drivers Editor showing playhead on the X Axis
Currently the Drivers Editor shows this (the blue thing can be dragged
to change frame):
{F10647661}

But the Drivers Editors X axis is the output of the driver [which can be
further tweaked by the curve] not time(frame).
So it seems better to not mix them here, it is just confusing to have
two different units on one axis.
Especially since what we really want to look at in X (the drivers output
value) can be in a totally unrelated range compared to frames, so e.g.
we might be interested in a drivers range from 0.0 to 1.0 and a
framerange of 100 to 200, so putting this on one axis just does not make
sense. Better to use a separate timeline for this.

Note 2.79 also did not do this.

Maniphest Tasks: T91157

Differential Revision: https://developer.blender.org/D12392
2021-09-28 11:14:44 +02:00
6f29801f1b Fix Drivers Editor not hiding vertical part of cursor
When "Show Cursor" is unchecked, the Drivers Editor would still display
the vertical line representing the cursor x.

Probably overseen in {rB65072499c65a} (historically the vertical line
could represent either the current frame of the cursor X in drawing, but
this is now much more separate).

There is no point in seeing part of the cursor in the Drivers Editor if
this is disabled.

Also correct outdated comments.

ref. T91157

Maniphest Tasks: T91157

Differential Revision: https://developer.blender.org/D12391
2021-09-28 11:14:44 +02:00
b91946780c Path util: BLI_path_contains() case-insensitive on Windows
Make `BLI_path_contains()` case-insensitive on Windows. This behaviour
is dependent on the platform Blender is running on, like the rest of
BLI_path, and not on the style of paths (Windows-style paths will be
treated case-sensitively when Blender is running on Linux/macOS).
2021-09-28 11:05:45 +02:00
741fa8180c Fix T91679: Crash when saving bordered render as multilayer exr
The related issue which is fixed by this change is the missing noisy
image pass when denoising and border render is used,

Need to allocate passes after the passes has been copied from the
original render result.
2021-09-28 10:49:01 +02:00
e5ff9f3615 Cleanup: Move VSE channels check into own util function
Differential Revision: https://developer.blender.org/D12661
2021-09-28 10:44:39 +02:00
a64782b133 VSE: Implement sanity check for files with more channels than supported
This is a follow up to 8fecc2a852.

This makes sure future .blend files that have more channels than the
limit won't break Blender.

It can be backported to LTS.

This is part of https://developer.blender.org/D12645

Differential Revision: https://developer.blender.org/D12648
2021-09-28 10:23:13 +02:00
7cd43a9d28 Fix: field inferencing fails when there are undefined nodes 2021-09-28 10:19:16 +02:00
def8fd6330 Cleanup: support moving InstanceReference 2021-09-28 10:17:49 +02:00
e7b9423623 Geometry Nodes: multi-threading when modifying multiple geometry sets
Differential Revision: https://developer.blender.org/D12652
2021-09-28 10:17:00 +02:00
c7d94a7827 UI: avoid excessive padding for labels in headers
Labels in headers reserved space for an icon even when no icon was used.

This is caused by the shared function ui_text_icon_width adding 1.5x
a buttons X-units width the the width of the string.

Menu buttons detected this and subtracted the extra padding.

Instead of adding the same workaround for labels,
add ui_text_icon_width_ex that takes a padding argument.

Add presets for 'default', 'compact' and 'none' to avoid duplicating
padding values.

This allows removal of hard-coded label scaling for the add-object tool.
2021-09-28 14:36:52 +10:00
986d60490c Asset Browser: Allow World assets to be drag/dropped onto the viewport
While World data has always been able to be marked as an asset, there
was no way to actually use them from the asset browser. This change
allows users to drag-drop world assets onto the Viewport and have them
appended/linked to their scene.

Differential Revision: https://developer.blender.org/D12566
2021-09-27 21:00:17 -07:00
c53ffda8a4 Cleanup: Fix incorrect comments 2021-09-27 13:29:53 -05:00
f94164d896 Geometry Nodes: Do not realize instances in the material assign node
Only run the node once for every unique geometry set in the input's
instance heirarchy. This can massively improve performance when
there are many instances, but it will mean that the result is the same
for every instance. For the previous behavior, a "Realize Instances"
node can be used before this one.

This node can be changed without versioning since the old material
assign node was already deprecated and replaced.
2021-09-27 13:22:44 -05:00
5d70a4d7ee Geometry Nodes: Move output attribute names to a subpanel
In a sub-panel it will be clearer that they are outputs, since they
just look like more inputs now. Unfortunately it is not possible to
make sub-panels display conditionally currently, so the output
sub-panel will always be visible whether or not it is empty.

Differential Revision: https://developer.blender.org/D12653
2021-09-27 13:04:58 -05:00
e6aabcae14 Fix part of T91516: Cycles not rendering geometry nodes instances
Part of the fix is by Jacques. This fixes the most obvious case, but it's
still not clear how to deal with non-mesh geometry instances or how to handle
motion blur for such instances.
2021-09-27 19:49:43 +02:00
50b7253257 Cleanup: fix (harmless) uninitialized variable usage 2021-09-27 19:49:43 +02:00
8da23fd5aa Constraints: change default Stretch To rotation type to Swing.
As also explained in D6134, in most case of Stretch To usage in
rigs, it is desirable to use swing rotation, either via the old
method of pairing the constraint with Damped Track, or via the
Swing rotation type introduced in 2.82. This is for instance true
for all usages of the constraint in Rigify.

The reason can be understood by realizing that unlike order-
dependent euler rotations, swing is not biased to an axis, and
isn't affected by gimbal lock effects at merely 90 degrees
of rotation (it has only one singularity at 180 degrees).

Thus it makes sense to change the default for newly created
constraints to the Swing mode. This has no backward compatibility
concerns except for old tutorials and rig generation scripts.

Differential Revision: https://developer.blender.org/D12643
2021-09-27 20:45:03 +03:00
8967bcb755 Update RNA to user manual url mappings 2021-09-27 13:42:41 -04:00
847d355cab File/Asset Browser: Don't deselect other items when dragging
Basically this enables the select-tweaking behavior as per the
guidelines:
https://wiki.blender.org/wiki/Human_Interface_Guidelines/Selection#Select-tweaking.

We use this in most other other editors that allow selecting and
dragging multiple items. But besides the consistency improvement, this
is important if we want to support dragging multiple assets (or files)
in future. We want to support this at least for dragging multiple assets
into an asset catalog for the upcoming asset catalog UI.
2021-09-27 18:52:16 +02:00
c76ccd85be Cleanup: incorrect null check in asset library
Found by clang tidy (P2439).
2021-09-27 18:42:19 +02:00
11bfbc3337 Fix: Incorrect node socket name after recent refactor
Caused by rBc99cb814520480379
2021-09-27 11:21:33 -05:00
c75c08a737 Geometry Nodes: Distribute points once per instance reference
With this commit, the distribute points on faces node runs only
once for every unique mesh in its input. That means if there are
100 instances of the same mesh, it will only run once.

This basically reverts rB84a4f2ae68d408301. The optimization there
didn't end up being worth it in the end, since it complicates code
quite a lot. It's also incompatible with this method of dealing with
instances, and it breaks field evaluation for instances, where we would
have to make sure to handle each instance transform properly otherwise,
evaluating the field separately for every instance.

Differential Revision: https://developer.blender.org/D12630
2021-09-27 11:16:25 -05:00
efa9667c09 Cleanup: Asset catalogs, fix clang-tidy warning
Change `auto &catalog` to `const auto &catalog`.

No functional changes.
2021-09-27 18:14:44 +02:00
10061ee18a Asset Catalogs: write catalogs to disk when saving the blend file
The Asset Catalog Definition File is now saved whenever the blend file
is saved. The location of the CDF depends on where the blend file is
saved, and whether previously a CDF was already loaded, according to the
following rules. The first matching rule wins:

1. Already loaded a CDF from disk? -> Always write to that file.
2. The directory containing the blend file has a
   `blender_assets.cats.txt` file? -> Merge with & write to that file.
3. The directory containing the blend file is part of an asset library,
   as per the user's preferences? -> Merge with & write to
   `${ASSET_LIBRARY_ROOT}/blender_assets.cats.txt`
4. Create a new file `blender_assets.cats.txt` next to the blend file.
2021-09-27 18:14:21 +02:00
90aa0a5256 BKE Preferences: find asset library containing a path
Add `BKE_preferences_asset_library_containing_path(&U, some_path)` that
finds the asset library that contains the given path.

This is a simple linear search, returning the first asset library that
matches. There is no smartness when it comes to nested asset libraries
(like returning the library with the best-matching path), although this
could be a useful feature to add later.
2021-09-27 18:10:47 +02:00
aafbe111fc BLI Path: add function BLI_path_contains()
Add function `BLI_path_contains(container, containee)` that returns true
if and only `container` contains `containee`.

Paths are normalised and converted to native path separators before
comparing. Relative paths are *not* made absolute, to simplify the
function call; if this is necessary the caller has to do this conversion
first.
2021-09-27 18:10:47 +02:00
6578db57cd Fix T91691: Selecting "Remove unused slots" in Materials panel removes slots that are assigned to particle systems/hair.
`BKE_object_material_slot_used` would only check obdata usages, but
particle settings can also (weirdly enough) use objects' material slots.

So now, as its name suggests, `BKE_object_material_slot_used` does take
an object as parameter, and also checks for potential slot usage from
psys in the object.
2021-09-27 18:09:20 +02:00
824733ea47 Assets: Additions/fixes to the catalog system in preparation for the UI
* Fixes missing update of the catalog tree when adding catalogs.
* Adds iterators for the catalogs, needed for UI code.
* Store catalog ID in the catalog tree items, needed for UI code.
* Other smaller API additions for the UI.
* Improve comments and smaller cleanups.

New functions are covered with unit tests.

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

Reviewed by: Sybren Stüvel
2021-09-27 17:49:31 +02:00
5bea5e25d5 Fix T91728: Cycles render artifacts with motion blur and object attributes 2021-09-27 17:40:03 +02:00
0559971ab3 Geometry Nodes: add utility to process all instances separately
This adds a new `GeometrySet::modify_geometry_sets` method that can be
used to update each sub-geometry-set separately without making any
instances real.

Differential Revision: https://developer.blender.org/D12650
2021-09-27 17:35:45 +02:00
2189dfd6e2 Cycles: Rework OptiX visibility flags handling
Before the visibility test against the visibility flags was performed in an any-hit program in OptiX
(called `__anyhit__kernel_optix_visibility_test`), which was using the `__prim_visibility` array.
This is not entirely correct however, since `__prim_visibility` is filled with the merged visibility
flags of all objects that reference that primitive, so if one object uses different visibility flags
than another object, but they both are instances of the same geometry, they would appear the same
way. The reason that the any-hit program was used rather than the OptiX instance visibility mask is
that the latter is currently limited to 8 bits only, which is not sufficient to contain all Cycles
visibility flags (12 bits).

To mostly fix the problem with multiple instances and different visibility flags, I changed things to
use the OptiX instance visibility mask for a subset of the Cycles visibility flags (`PATH_RAY_CAMERA`
to `PATH_RAY_VOLUME_SCATTER`, which fit into 8 bits) and only fall back to the visibility test any-hit
program if that isn't enough (e.g. the ray visibility mask exceeds 8 bits or when using the built-in
curves from OptiX, since the any-hit program is then also used to skip the curve endcaps).

This may also improve performance in some cases, since by default OptiX can now perform the normal
scene intersection trace calls entirely on RT cores without having to jump back to the SM on every
hit to execute the any-hit program.

Fixes T89801

Differential Revision: https://developer.blender.org/D12604
2021-09-27 17:12:43 +02:00
7270ba011c Fix two issues with recent new Append code.
* ID pointer returned by `wm_file_link_append_datablock_ex` was
  improperly extracted from `WMLinkAppendDataItem` before append step.

* Code deleting linked IDs when their local matching version was re-used
  did not properly clear `LIB_TAG_DOIT` beforehand.
2021-09-27 16:36:07 +02:00
4a0ddeb62b Nodes: Change wire color to increase contrast
If the theme used by the user did not touch the wire or the wire outline
colors this will update them as well.

This was supposed to be a part of a bigger UI theme change for 3.0. But
it was expedited because of the recent change in line thickness for the
noodles (2bd0205215).

Theme change by Pablo Vazquez.

Differential Revision: https://developer.blender.org/D12649
2021-09-27 16:09:40 +02:00
3d2ce25afd Geometry Nodes: support creating new attributes in modifier
This patch allows passing a field to the modifier as output. In the
modifier, the user can choose an attribute name. The attribute
will be filled with values computed by the field. This only works
for realized mesh/curve/point data. As mentioned in T91376, the
output domain is selected in the node group itself. We might want
to add this functionality to the modifier later as well, but not now.

Differential Revision: https://developer.blender.org/D12644
2021-09-27 15:39:47 +02:00
43167a2c25 Fix T90570: Constraint validity not updated with library overrides.
For some reason was assuming setting a property in RNA would call its
update callback if any, but this actually needs to be done separately.

So add this call to `rna_property_override_operation_apply`.
2021-09-27 15:33:58 +02:00
5949d598bc RNA: Make is clear that Scene parameter of update callback may be NULL.
There are cases where there is no way to ensure we do have/know about an
active scene. Further more, this should not be required to perform
'real' updates on data, only to perform additional special handling in
current scene (mostly related to editing tools, UI, etc.).

This pointer is actually almost never used in practice, and half of its current
 usages are fairly close to abuse of the system (like calls to
`ED_gpencil_tag_scene_gpencil` or `BKE_rigidbody_cache_reset`).

This commit ensures that the few places using this 'active scene' pointer are
safely handling the `NULL` case, and clearly document the fact that a
NULL scene pointer is valid.
2021-09-27 15:33:58 +02:00
b077f0684e RNA: Fix bad usages of scene pointer in Update callbacks.
Scene passed to the update callback is the active scene it //may// not
be that actual ID owner of the affected data (although in practice it
should always be currently).
2021-09-27 15:33:58 +02:00
a6b53ef994 Cycles: print name of kernels on errors in CUDA queue, for debugging 2021-09-27 15:24:12 +02:00
2bd0205215 Geometry Nodes: make field links thinner than other links
This makes it easier to spot which links contain fields and which
contain data. Actually, the patch makes all other links a bit thicker.
However, with soon-to-be-implemented theme changes, the
perceived thickness will be the same as before.

This is part of T91563.

Differential Revision: https://developer.blender.org/D12646
2021-09-27 15:10:28 +02:00
8fecc2a852 Increase VSE strip channels limit from 32 to 128
The original limit dates back from 2002 when Blender went open source.
After that many years some productions (e.g., Sprite Fright) are already
experiencing limitations for complex edits.

The future plans is to support an initial shorter (2?) number of
channels with support to "unlimited" channels.

Finally, I'm bumping the minimum file requirement since files with more
than 32 channels won't work well in old Blender versions.

In a future commit I will implement a sanitization so that we only read (and write)
128 channels. Making sure future changes of this number won't corrupt Blender.

Differential Revision: https://developer.blender.org/D12645
2021-09-27 14:58:03 +02:00
Peter Fog
0419c74ae8 VSE: Clamp resulting frame in multiply mode
The clamp added will ensure immediate speed direction change on
changing to/from positive/negative speed factor when using the Speed
effect strip's Multiply mode.

Reviewed By: ISS, sergey

Differential Revision: https://developer.blender.org/D12462
2021-09-27 14:41:56 +02:00
4a562f5077 Fix T91714: Cycles direct/indirect clamp distinction not working correctly 2021-09-27 14:25:22 +02:00
2a0db195c9 Fix viewport roll working wrong
Mistake in own {rB69893ef27c91}.
Was mixing screen on region coordinates.
2021-09-27 14:19:38 +02:00
e87783a5ec Cleanup: spelling in comments 2021-09-27 21:04:34 +10:00
95af9317f0 Cleanup: remove unnecessary use of MEM_SAFE_FREE macro 2021-09-27 21:04:34 +10:00
2c2e1b3d61 Fix T81922: Pose bones F-Curves hidden for unselected objects
Whilst in pose-mode, the selection filter only includes other objects in
pose-mode instead of the object selection.

This makes sense as the selection of the pose bones what the user as
acting on in the 3D view.
The object selection only makes sense to use in object mode.

Reviewed By: sybren

Maniphest Tasks: T81922

Ref D12494
2021-09-27 21:04:34 +10:00
32ffb858d6 Keymap: resolve conflict with use_alt_cursor/Ctrl-LMB to add/extrude
While the option allows tools be be activated on press instead of tweak,
this meant box-select was catching Ctrl-LMB which is also used for
add/extrude in edit mode.

Resolve this by always using tweak for selection tools,
only supporting activation on press for other tools.

Note that this doesn't impact the default configuration.
2021-09-27 21:04:34 +10:00
c618075541 Cleanup: make format 2021-09-27 12:43:54 +02:00
a13b9d20b5 Cleanup: Move asset library remove function next to add function
Better to keep such related operations close together in code.
2021-09-27 12:32:21 +02:00
d90f542b04 Cleanup: Remove function declaration without definition
There is no function definition for this declaration. Instead there is
`BKE_preferences_asset_library_remove()`.
2021-09-27 12:31:06 +02:00
5d5504d8a4 3DView: ability to cancel out of viewport roll
This adds the ability to cancel out of the roll using ESC or RMB
(which is not common for viewops -- but makes sense in the case of roll
I think). This resets the view as well as potential locked cameras to
the original orientations (but does not remove potential autokeys --
which no transform does on cancel btw.)

Maniphest Tasks: T89883

Differential Revision: https://developer.blender.org/D12582
2021-09-27 11:54:25 +02:00
69893ef27c 3DView: Use "real" angle for viewport roll
Since its introduction in {rB5c569d227b64}, the view roll was based on
horizontal movement only. Using a "real" angle not only feels more
natural but also has the benefit of getting more precission the further
away from the center you are (just like regular rotation, brush/stencil
rotation etc.). A similar thing has already been implemented in the
Grease Pencil Tools Addon, now make the blender standard roll the same.

Since this is not using the transform system, we are still lacking a
line in the viewport (this could be added but since this is always based
on the center of the view we dont necessarily need this), as well as the
additional Shift-extra-precission behavior.

Fixes T89883

Maniphest Tasks: T89883

Differential Revision: https://developer.blender.org/D12582
2021-09-27 11:53:26 +02:00
8dcddbcc07 Fix T91711: Blender 3.0 - The Rain demo scene breaks (Proxy to Override auto conversion).
Proxy conversion is a fairly particular case of liboverride creation, in
which remapping all local usages of linked data probably makes more
sense, rather than only doing so whitin the overridden 'group' of IDs.
2021-09-27 11:11:43 +02:00
30ef197c7b Kernel: allow unregistering BKE callback functions
Introduce `BKE_callback_remove()`, which undoes the effect of
`BKE_callback_add()`. It also respects `funcstore->alloc` by freeing the
removed `funcstore` when needed.

This allows for shorter-lived objects in memory to unregister their
callbacks at the end of their lifespan.

`BKE_callback_global_finalize()` has been adjusted so that the
responsibility "remove a callback" is given to one function only.

Reviewed by: campbellbarton

Differential Revision: https://developer.blender.org/D12625
2021-09-27 10:57:23 +02:00
617954c143 Geometry Nodes: new Instance on Points node
This adds a new Instance on Points node that is a replacement
for the old Point Instance node. Contrary to the old node,
it does not have a mode to instance objects or collections
directly. Instead, the node has to be used with an Object/
Collection Info to achieve the same effect.

Rotation and scale of the instances can be adjusted in the node
directly or can be controlled with a field to get some variation
between instances.

The node supports placing different instances on different points.
The user has control over which instance is placed on which point
using an Instance Index input. If that functionality is used, the
Instance Geometry has to contain multiple instances that can are
instanced separately.

Differential Revision: https://developer.blender.org/D12478
2021-09-27 10:17:17 +02:00
547f7d23ca Geometry Nodes: support outputting collection children as instances
This adds two new input sockets to the Collection Info node:
* `Separate Children`: When turned off, the entire collection is output as a single
  collection instance (same behavior as before). When turned on, each child of
  the collection is output as a separate instance (children can be objects and collections).
  Toggling this input should not change the visual transforms of the output geometry.
* `Reset Children`: Only used when `Separate Children` is on. When used, the transforms
  of the instances are reset to the origin. This is useful when one wants to e.g. instance
  the collection children separately in the upcoming instancing node.

Part of D12478.
2021-09-27 10:17:17 +02:00
William Leeson
f3ace5aa80 Fixes T91632 by stopping the sample correlation between dimensions which was causing rendering artifacts on simple scenes.
Fix T91632: Stops the sample correlation between dimensions which was causing rendering artefacts on simple scenes.

This is done by increasing the amount of jitter the Cranley Patterson Rotation is allowed to add. Also, it uses the y dimension of the of the sample table for 1D sampling which causes further decorrelation between dimensions. As an additional measure the x and y dimensions are swapped randomly to provide further decorrelation.

Maniphest Tasks: T91632

Differential Revision: https://developer.blender.org/D12610
2021-09-27 09:54:37 +02:00
fe49904646 Fix: wrong socket shape in Vector input node 2021-09-27 09:34:17 +02:00
ddb0dc2527 Fix knife tool missing refresh changing the lock axes 2021-09-27 16:28:01 +10:00
10a26d583d Fix knife tool using an invalid event value check
The events value was checked without checking the expected modal state.
2021-09-27 16:28:01 +10:00
Lasse Foster
037e66999a FIX: T91697 Eevee Generated texture coordinates completly missing
This patch fixes Eevee-regression https://developer.blender.org/T91697

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12634
2021-09-27 08:07:23 +02:00
d2dda0e8b9 Fix T91694: VSE crashes when creating new scene
Crash happened due to NULL dereference. Add NULL checks.
2021-09-27 06:58:07 +02:00
Peter Fog
ad3e5d2bf5 VSE: Expose Zoom to Fit in all display modes
Zoom to Fit is working in all display modes, but was only exposed in
Image mode. This patch exposes it in all Image modes.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12632
2021-09-27 04:40:05 +02:00
f9e0981976 Fix T91666: Missing pivot point in VSE
Add pivot point setting for combined timeline and preview mode.
2021-09-27 04:20:37 +02:00
d046a1f2fa Functions: fail early when multi-function throws an exception
Multi-functions are not allowed to throw exceptions that are not
caught in the same multi-function. Previously, it was difficult to
backtrack a crash to a previously thrown exception.
2021-09-26 23:28:14 +02:00
1cd8a438bb Cleanup: simplify field evaluation 2021-09-26 23:28:14 +02:00
88a2b054da Fix T91732: crash in Set Position node on empty mesh 2021-09-26 23:28:14 +02:00
93b36fad68 Knife: Expose XYZ axis locking in modal keymap
A small quality of life improvement that will allow users to change the keys used for axis locking.
2021-09-26 22:18:24 +01:00
80f7bc6d8e LineArt: Smooth tolerance value for chaining.
smooth out jaggy lines with a given threshold. For each point in a stroke, the ones with in a given distance of its previous segment will be removed,
thus "zig-zag" artefacts can be cleaned up.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12050
2021-09-26 19:43:12 +08:00
505422220d Cleanup: use override/final for derived classes.
This will help detecting missing API changes. Those keywords were added
on classes which did not already use them. Also added missing
`accepts_object_type()` on NURBS reader.
2021-09-25 09:31:00 +02:00
43394e41a8 Fix Alembic point cloud streaming.
Point clouds are not imported and read anymore. This was caused by an
API change in rB128eb6cbe928e58dfee1c64f340fd8d663134c26 which was not
applied to `AbcPointsReader`. It did not cause a compile error as the
base class as a default implementation for this method.
2021-09-25 09:31:00 +02:00
ab09844be8 Cleanup: typos in code and comments.
No functional changes.
2021-09-25 09:31:00 +02:00
a3027fb094 Fix T91662: VSE Image overlay is drawn for backdrop
Don't draw image overlay in timeline, image manipulation only works in
preview.
2021-09-24 21:18:03 +02:00
b314d3e787 Fix T91639: Cycles crash rendering high resolution images with multiple passes
We were writing large 2048x2048 tiles into EXR files, which appears to cause
integer overflow inside the OpenEXR library when there are multiple passes. Now
use smaller tiles in the image file, while still rendering large tiles.

This adds the requirement that the render tile size must be a multiple of 128
or be smaller than 128, this is adjusted automatically.
2021-09-24 21:08:14 +02:00
2dd3968335 Geometry Nodes: Add versioning and legacy warning for random float node 2021-09-24 14:06:41 -05:00
Johnny Matthews
536f9eb82e Geometry Nodes: Random Value Node
This node replaces the deprecated Attribute Randomize node, populating
a vector, float, integer or boolean field with random values. Vector,
float, and integer have min/max settings, which are also field aware.
The boolean type has a probability value for controlling what portion
of the output should be true. All four types have a field seed input
which is implicitly driven by the index, otherwise, all values would
be the same "random" value.

The Random Float node is now deprecated like other nodes, since it is
redundant with this node.

Differential Revision: https://developer.blender.org/D12603
2021-09-24 14:03:42 -05:00
c87e6b23be Assets: Read catalogs immediately when loading a library
Until now, the asset catalogs would only show up after all assets from
the library were loaded. Now the catalogs are read first, which makes
them appear pretty much immediately. This makes the UI more responsive
and feel less heavy.

I added a dedicated file-list type for asset libraries now. While not
necessarily needed, I prefer that so asset library specific stuff can be
handled in there.
2021-09-24 20:17:04 +02:00
Erik Abrahamsson
be16794ba1 Geometry Nodes: String to Curves Node
This commit adds a node that generates a text paragraph as curve
instances. The inputs on the node control the overall shape of the
paragraph, and other nodes can be used to move the individual instances
afterwards. To output more than one line, the "Special Characters" node
can be used.

The node outputs instances instead of real geometry so that it doesn't
have to duplicate work for every character afterwards. This is much
more efficient, because all of the curve evaluation and nodes like fill
curve don't have to repeat the same calculation for every instance of
the same character.

In the future, the instances component will support attributes, and the
node can output attribute fields like "Word Index" and "Line Index".

Differential Revision: https://developer.blender.org/D11522
2021-09-24 12:41:49 -05:00
Erik Abrahamsson
5c0017e85a Geometry Nodes: Special string characters node
This patch adds a new node called "Special Characters" with two string
outputs: "Line Break" and "Tab". This is necessary because the newline
character cannot be easily typed with a keyboard, but is necessary for
the string to curve node.

Differential Revision: https://developer.blender.org/D12620
2021-09-24 11:00:21 -05:00
bdb8ee9717 Fix Cycles memory leak in baking, after recent changes 2021-09-24 17:46:34 +02:00
Johnny Matthews
ef45399f3b Nodes: initial support for socket tooltips
This adds initial limited support for socket tooltips. It's limited
in a couple of ways for now:
* Only works when hovering over the socket shape, not when hovering
  over the value in the socket.
* Only works for built-in nodes that already use the new node
  declaration system. This can later be extended to support pynodes.

Those limitations are well worth it for now, given that the
implementation is quite simple and the impact on usability is quite
large. More complex updates to the layout system, that would allow
showing socket tooltips in the nodes, can be done later. With the
current implementation we can at least start writing tooltips for
geometry nodes now.

This commit already adds tooltips for the Cylinder node as an example.

Differential Revision: https://developer.blender.org/D12607
2021-09-24 17:13:40 +02:00
4a2c63f4bd Nodes: hide socket value when input is a field implicitly 2021-09-24 16:42:20 +02:00
90b410fe74 Fix: field evaluation crash when the domain size is zero 2021-09-24 16:42:20 +02:00
25d4de92fa Cleanup: UUID, add some documenting comments
No functional changes.
2021-09-24 16:34:25 +02:00
c0db8e3b41 Fix T91660: Cycles remaining render time does not take into account time limit 2021-09-24 16:34:15 +02:00
585998987a Cycles: some steps towards getting standalone compiling again
Render output and display still need to be rewritten to work with the new
system.
2021-09-24 16:34:14 +02:00
ab8f24811d Cleanup: remove unused device code and includes 2021-09-24 16:34:14 +02:00
9cf593f305 GPencil: Reorganize list of modifiers
As we have a now a new `Modify` column, we move some modifers to this column.
2021-09-24 16:27:58 +02:00
45e432b894 GPencil: Change Proximity distance properties to distance type
This keep consistency with mesh modifer.
2021-09-24 16:16:40 +02:00
ede14b3856 GPencil: Invert weight in Weight Proximity modifier
In meshes modifer the Lowest is 0 and Highest is 1.0 and this was working inverted for grease pencil. Now, it works equals to meshes modifier.

Also changed the tooltip to keep consistency with meshes modifier.
2021-09-24 16:16:40 +02:00
95ec6e4dd3 Geometry Nodes: make index field more reusable
Some inputs will be the index field implicitly, so we want this
class to be available outside of `node_geo_input_index.cc`.
2021-09-24 16:03:07 +02:00
1a1c546124 Fix T91240: Object duplication was duplicating its action twice.
Weird that this was not reported before, this was creating a lot of
extra actions everytime...
2021-09-24 15:25:49 +02:00
e1e380ba38 Asset Catalogs: write catalogs sorted by path & UUID
When writing asset catalog definition files, order the catalogs by
(path, UUID). This ensures that every write produces the same file, playing
nice with versioning / synchronisation systems.
2021-09-24 14:42:48 +02:00
ab9644382d UUID: add less-than operator
Add `operator<` to C++ class to allow lexicographic ordering of UUIDs.

This will be necessary when writing asset catalogs to disk in a predictable
(i.e. ordered) manner.
2021-09-24 14:42:48 +02:00
2b9ca0f112 Codestyle: Add brackets around body of if statements. 2021-09-24 13:38:03 +02:00
7e904139a3 Nodes: make dot in socket shape circular
Previously, it was a diamond shape when the overall
shape was a diamond.
2021-09-24 13:33:28 +02:00
2b5733ff01 Fix T91192: Context.copy() crashes on file load
The `ui_list` lookup from 87c1c8112f
didn't account for the region being unset.
2021-09-24 21:10:02 +10:00
dfe01628b0 Cleanup: old-style-declaration warning 2021-09-24 21:10:01 +10:00
e8c6e32348 Asset Catalogs: fix trailing slash test case
The "path with trailing slash" test catalog was using the same path as
another catalog, which meant it was ignored after doing the path
cleanup. It's now different in the test file in SVN, so it'll actually
show up in the test.
2021-09-24 12:53:14 +02:00
59387aabe8 LibOverride: deprecate Proxies: Remove 'Make Proxy' operator. 2021-09-24 12:40:04 +02:00
501b0190d6 LibOverride: Deprecate Proxies: Add auto-conversion on file load.
This commit also add an experimental userPreferences to prevent proxies
conversions on file load, and reporting for amount of coverted proxies
(and possible issues).

Note that potentially linked proxies from other libraries are not
hamdled here (this feature seems to be broken anyway in master
currently?).
2021-09-24 12:40:04 +02:00
cdcdd2c479 LibOverride: Add utils to convert all proxies to overrides. 2021-09-24 12:40:03 +02:00
e7ae2840a5 Geometry Nodes: new Distribute Points on Faces node
This adds a replacement for the deprecated Point Distribute node.

Arguments for the name change can be found in T91155.
Descriptions of the sockets are available in D12536.

Thanks to Jarrett Johnson for the initial patch!

Differential Revision: https://developer.blender.org/D12536
2021-09-24 11:50:02 +02:00
d8a5b768f0 BLI: expose more noise hash functions in header
This is a follow up of the previous commit.
These functions are useful for other areas of Blender as well.
2021-09-24 11:24:15 +02:00
bc27bafa54 BLI: make noise hash functions available in header 2021-09-24 10:55:23 +02:00
7ca48a3814 Fix: incorrect socket shape for noise texture input 2021-09-24 10:55:23 +02:00
f8a0e102cf Weightpaint Gradient tool: expose falloff to the UI
By default, we'll always get a falloff like this from the tool:
{F10559413}

But in the context of using vertexgroups in modifiers/modeling, a choice
on how the gradient falloff of the Weightpaint Gradient tool is shaped
would be desirable:
"real" linear:
{F10559416}
Custom:
{F10559421}
{F10559428}

The way the Weightpaint gradient tool works is a bit outside the usual
tools that use brushes [even though it creates a brush on the fly in
`WPGradient_userData`].
However, it does not have an entry in `eBrushWeightPaintTool` and adding
one there does not play nice for the same reasons (not "really" being
integrated in the brush-based tools).

So in order to expose the brush curve in the UI, we would have to do one
of the following:
- [1] try to use `VIEW3D_PT_tools_brush_falloff`, for this to work:
-- make all kinds of exception in python super classes [`FalloffPanel`,
`BrushPanel`, `UnifiedPaintPanel`, ... -- including making real entries
in `eBrushWeightPaintTool`] to get a proper tool mode and...
-- .. to also make sure Falloff Shape and Front-Face Falloff are not
available [which the tool seems to just not support in its current form]
- [2] just have a simple, contained panel for this tool alone

This patch implements [2] and adds it as part of the ToolDef (could also
be done in `VIEW3D_HT_tool_header`, but again, I think this is nice to
keep separate from the usual tools)
{F10559482}
{F10559485}

Testfile:
{F10559442}

Fixes T91636

Maniphest Tasks: T91636

Differential Revision: https://developer.blender.org/D12614
2021-09-24 10:52:12 +02:00
3ac342dc6d Cleanup: clang format 2021-09-24 10:45:36 +02:00
9a45a4c525 Cleanup: asset catalogs, fix clang-tidy warning
Remove unnecessary call to `std::string::c_str()`.

No functional changes.
2021-09-24 10:29:52 +02:00
e161f39660 Cleanup: clang-tidy 2021-09-24 10:25:16 +02:00
Jeroen Bakker
fc7beac8d6 FileBrowser: Reduce Overhead Browsing Libraries.
When Browsing libraries the asset files were opened multiple times.
once to determine the needed groups to query and once for each
group to query the items in the group. For file browsing this makes sense
but for asset browsing this can be reduced.

This patch will load the asset files recursively and only opens them once.
Another change is that only the assets are requested and not filtered out
later in the process.

This patch is needed to simplify the library indexing. Where
we need access to the full library content.

## The numbers ##

Benchmarked by adding scenes of the spring open movie to the default
asset library. Refreshing the asset library would recursively load all the files
there.

| **8bc27c508a** | Processed 317 'directories/libraries' | 7.573986s |
| **Patch** | Processed 42 'directories/libraries' | 0.821013s |

{F10442811}

Reviewed By: mont29, Severin

Maniphest Tasks: T91406

Differential Revision: https://developer.blender.org/D12499
2021-09-24 08:41:40 +02:00
Jeroen Bakker
6a88f83d67 Hair Info Length Attribute
Goal is to add the length attribute to the Hair Info node, for better control over color gradients or similar along the hair.

Reviewed By: #eevee_viewport, brecht

Differential Revision: https://developer.blender.org/D10481
2021-09-24 07:44:22 +02:00
0f764ade1a Fix T91661: Vector rotate output socket diconnects on file load
An incorrect name was used in the socket declaration refactor.
2021-09-23 23:56:15 -05:00
0e039749e3 Fix: Incorrect field visualization for some shader nodes
These need to be tagged as function nodes in their declaration.
2021-09-23 22:23:14 -05:00
bc65c7d0e5 Cleanup: spelling in comments 2021-09-24 11:31:23 +10:00
599d96e8f9 UI: keymap preference tweaks
- Expose option to use shortcuts to activate tools as an enum.
- "Emulate 3 Button Mouse" now disables preferences
  that depend on Alt-LMB.
2021-09-24 11:07:01 +10:00
bffda4185d Cleanup: group convenience assignments in the keymap 2021-09-24 11:07:01 +10:00
26141664f0 Fix: Curve fill node doesn't fill real geometry with instances
A misplaced return in the middle of the function made it so
the node didn't fill real geometry.
2021-09-23 17:45:41 -05:00
f7608276e3 Audaspace: port bugfix from upstream.
Fixes T91615: Instant crash when dragging video file into video editor sequencer
2021-09-23 23:27:49 +02:00
61f3d4eb7c Geometry Nodes: Initial socket visualization for fields.
This implements the update logic for the vizualization of which
sockets pass data or constants directly, and which pass functions.
The socket shapes may still have to be updated. That should be
done separately, because it might be a bit more involved, because
socket shapes are currently linked to keyframe shapes. Currently
the circle and diamond shapes are used with the following meanings:

 - Input Sockets:
    - Circle: Required to be a single value.
    - Diamond: This input supports fields.
 - Output Sockets:
    - Circle: This output is a single value.
    - Diamond: This output may be a field.

Connecting a field to a circle input socket is an error, since a
field cannot be converted to a single value. If the socket shape
is a diamond with a dot in the middle, it means it is currently
a single value, but could be a field.

In addition to socket shapes, the intention is to draw node links
differently based on the field status. However, the exact method for
conveying that isn't decided yet.

Differential Revision: https://developer.blender.org/D12584
2021-09-23 15:21:31 -05:00
c1b925f7ff Fix build error caused by typo 2021-09-23 15:20:57 -05:00
1bdaf0ebec Fix T91638: image editor Open Cached Render not loading some passes
Previously this was only loading built-in render passes. Now instead of trying
to load the scene render passes, load whatever passes exist in the cache file.
2021-09-23 20:45:42 +02:00
Charlie Jolly
7fb2b50e5d Fix: Build issue with MSVC
header for std::function was not included

reported/fixed by Charlie on chat
2021-09-23 12:33:27 -06:00
fc2255135e Paint: prevent RenderResults and Viewers where unappropriate
Using a RenderResult (or a Viewer) was never really working (think you
cant get a real ImBuff from these) -- cannot use it as a clone, stencil
or canvas [Single Image paint texture slot].

In the case of using it as a 2D paint clone image this would also crash
[due to the Image Editor drawing refactor in 2.91].

Now [in the spirit of T73182 / D11179], prevent using these where
unappropriate by using rna pointer polling functions.

Also add a security check for the 2D paint clone image crash in case a
stencil ImBuff cannot be provided for some reason, but generally old
files are now patched in do_versions_after_linking_300 (thx @brecht!).

Fixes T91625.

Maniphest Tasks: T91625

Differential Revision: https://developer.blender.org/D12609
2021-09-23 20:11:45 +02:00
b8a30c7664 Cleanup: Use const in previously committed function 2021-09-23 19:39:26 +02:00
323fd80aad UI: Tree-View API for easy creation of tree UIs
This follows three main targets:

* Make creation of new tree UIs easy.
* Groundwork to generalize tree UIs (so e.g. Outliner, animation
  channels, asset catalogs and spreadsheet data-sets don't have to
  re-implement basic tree UI code) or even other data-view UIs.
* Better separate data and UI state. E.g. with this, tree-item selection
  or the open/collapsed state can be stored on the UI level, rather than
  in data. (Asset Catalogs need this, storing UI state info in them is
  not an option.)

In addition, the design should be well testable and could even be
exposed to Python.

Note that things will likely change in master still. E.g. the actually
resulting UI isn't very nice visually yet.

The design is documented here:
https://wiki.blender.org/wiki/Source/Interface/Views

Differential Revision: https://developer.blender.org/D12573
2021-09-23 19:33:54 +02:00
eb0eb54d96 Fix D12533: Simplify curve object to mesh conversion
This patch simplifies the curve object to mesh conversion
used by the object convert operator and exporters.

The existing code had a convoluted model of ownership, and did quite
a bit of unnecessary work. It also assumed that curve objects always
evaluated to a mesh, which is not the case anymore.

Now the code checks if the object it receives is evaluated. If so,
it can simply return a copy of the evaluated mesh (or convert the
evaluated curve wire edges to a mesh if there was no evaluated mesh).
If the object isn't evaluated, it uses a temporary copy of the object
with modifiers removed to create the mesh in the same way.

This follows up on the recent changes to curve evaluation,
namely that the result is always either a mesh or a wire curve.

Differential Revision: https://developer.blender.org/D12533
2021-09-23 11:41:46 -05:00
ed541de29d Fix T91626: Cycles sss behind fully transparent object renders differently 2021-09-23 18:32:30 +02:00
354c3eee40 Cycles: improve Auto Tile option description
Ref T91645
2021-09-23 18:32:30 +02:00
0a8a726014 bUUID: make it explicit the default constructor produces the nil value
The implicit default constructor zeroes all plain data fields, and now
this behaviour is explicit & tested for in a unit test.
2021-09-23 18:27:19 +02:00
18a4dc869d Cleanup: UUID, fix clang-tidy warnings
Use explicit `uint32_t` instead of `uint`, add a missing end-of-namespace
comment, and change `auto` to `const auto *`.

No functional changes.
2021-09-23 18:27:19 +02:00
502543e46b Geometry Nodes: remove old method to iterate over attributes
The previous commit added a new method to the same in a better way.
2021-09-23 17:59:44 +02:00
38af29df5c Geometry Nodes: simplify looping over attributes in geometry set
This adds three new methods:
* `InstancesComponent::foreach_reference_as_geometry(...)`
* `GeometrySet::attribute_foreach(...)`
* `GeometrySet::gather_attributes_for_propagation(...)`

The goal is that these iteration primitives can be used in places
where we use more specialized iterators currently.

Differential Revision: https://developer.blender.org/D12613
2021-09-23 17:59:44 +02:00
105115da9f UUID: add != operator for comparing UUIDs
Make it possible to unit test with `EXPECT_NE(uuid1, uuid2)`.
2021-09-23 17:58:20 +02:00
bd63944a73 UUID: place C++ code in correct namespace
Put the `bUUID` class in the `blender` namespace, instead of the
`blender::bke` namespace.

As a result, some C++ code now correctly uses the C++ class, where
previously it would use the C struct and use implicit casting where
necessary. As a result, support for initializer lists had to be
explicitly coded and in another place an explicit `::bUUID` was
necessary to avoid ambiguity.
2021-09-23 17:58:20 +02:00
942fc9f467 Cleanup: bUUID, document the constructors
No functional changes.
2021-09-23 17:58:20 +02:00
93997f9d0a Cleanup: asset catalogs, correct assertion message
There is no such thing as a "relative path" when it comes to asset catalog
paths (they're always absolute).

No functional changes.
2021-09-23 17:58:20 +02:00
d7f803f522 Fix T91641: crash rendering with 16k environment map in Cycles
Protect against integer overflow.
2021-09-23 17:48:16 +02:00
6279efbb78 Fix Cycles compiler warning on GCC 11
For shadow rays there are no closures, leave out the closure merging code
there to avoid warnings about accessing closure memory that does not exist.
2021-09-23 17:48:16 +02:00
d0493796a6 Cleanup: Remove hardcoded values and rename keyframe shape shaders
No functional change.

The shader is complicated by itself, having hardcoded values makes it
even more cryptic.

I also renamed the shader because the shader is not for the keyfarme diamond only,
but for all the keyframe shapes.

Differential Revision: https://developer.blender.org/D12615
2021-09-23 17:41:11 +02:00
f11bcb5a80 Fix T91557: Texture Paint Stencil doesnt use assigned UV Layer
Choosing a UV layer would actually affect the overlay in the viewport
and also painting with the mask brush was in that UV space, but the
resulting stencil mask was always applied with the active UV (not the
explicitly selected stencil UV -- the one one is looking at in the
viewport!) to painting.

This has been like that as far as I have checked back (at least 2.79b),
I am surprised this has not come up before, but it does not seem to make
sense at all...

Now use the UV specified for the stencil layer when applying the mask for
painting, so it corresponds to the stencil mask one is looking at in the
viewport.

Maniphest Tasks: T91557

Differential Revision: https://developer.blender.org/D12583
2021-09-23 16:56:03 +02:00
490425d56e Asset Catalogs: explicit version number in catalog definition files
Declare the current format used for asset catalog definition files as
version 1, and write that to the files. Files without that version number
will be rejected.

This makes it much easier to move to different versions later, with the
opportunity to do versioning on file load.

The version is not associated with any version of Blender, but a separate
integer that's simply incremented when a non-backward-compatible change
happens.
2021-09-23 16:06:25 +02:00
aa2493e2e7 Fix unused variable warning in release builds
The variable is only used in debug builds.
2021-09-23 15:04:41 +02:00
Sybren A. Stüvel
9b12b23d0b Assets: add Asset Catalog system
Catalogs work like directories on disk (without hard-/symlinks), in that
an asset is only contained in one catalog.

See T90066 for design considerations.

#### Known Limitations

Only a single catalog definition file (CDF), is supported, at
`${ASSET_LIBRARY_ROOT}/blender_assets.cats.txt`. In the future this is
to be expanded to support arbitrary CDFs (like one per blend file, one
per subdirectory, etc.).

The current implementation is based on the asset browser, which in
practice means that the asset browser owns the `AssetCatalogService`
instance for the selected asset library. In the future these instances
will be accessible via a less UI-bound asset system.

The UI is still very rudimentary, only showing the catalog ID for the
currently selected asset. Most notably, the loaded catalogs are not
shown yet. The UI is being implemented and will be merged soon.

#### Catalog Identifiers

Catalogs are internally identified by UUID. In older designs this was a
human-readable name, which has the problem that it has to be kept in
sync with its semantics (so when renaming a catalog from X to Y, the
UUID can be kept the same).

Since UUIDs don't communicate any human-readable information, the
mapping from catalog UUID to its path (stored in the Catalog Definition
File, CDF) is critical for understanding which asset is stored in which
human-readable catalog. To make this less critical, and to allow manual
data reconstruction after a CDF is lost/corrupted, each catalog also has
a "simple name" that's stored along with the UUID. This is also stored
on each asset, next to the catalog UUID.

#### Writing to Disk

Before saving asset catalogs to disk, the to-be-overwritten file gets
inspected. Any new catalogs that are found thre are loaded to memory
before writing the catalogs back to disk:

- Changed catalog path: in-memory data wins
- Catalogs deleted on disk: they are recreated based on in-memory data
- Catalogs deleted in memory: deleted on disk as well
- New catalogs on disk: are loaded and thus survive the overwriting

#### Tree Design

This implements the initial tree structure to load catalogs into. See
T90608, and the basic design in T90066.

Reviewed By: Severin

Maniphest Tasks: T91552

Differential Revision: https://developer.blender.org/D12589
2021-09-23 15:00:45 +02:00
222fd1abf0 Asset Browser: Disable metadata editing for external asset libraries
Buttons to edit asset metadata are now disabled for assets from an
external library (i.e. assets not stored in the current .blend file).
Their tooltips explain why they are disabled.

Had to do some RNA trickery to disable the metadata properties at RNA
level, not at UI script level.
The basic idea is:
* Local data-block assets set the data-block as owning ID for the asset
  metadata RNA pointer now.
* That way we can use the owner ID to see where the metadata belongs to
  and decide if it's editable that way.
* Additionaly, some Python operators needed better polling so they show
  as grayed out, and don't just fail.

One important thing: Custom properties of the metadata can still be
edited. The edits won't be saved however. Would be nice to disable that,
but it's currently not supported on BPY/IDProperty/RNA level.

Addresses T82943.

Differential Revision: https://developer.blender.org/D12127
2021-09-23 14:46:13 +02:00
059d01d42e Fileops: call BLI_path_slash_native() in BLI_dir_create_recursive()
Make the Windows version of `BLI_dir_create_recursive()` call
`BLI_path_slash_native()` before it tries to handle the path. This
should make it possible to call it with non-native path separators.

This change was provided by our Windows platform maintainer @LazyDodo in
P2414, so I assume he agrees with this change.
2021-09-23 14:42:14 +02:00
83975965a7 Keymap: RMB select option to place cursor on Alt-LMB
This allows most tools to activate on press, removing a small but
noticeable distance between the initial press and detection of a drag
event.

Gizmo tweak no longer actives when Alt is held, to avoid conflicting
with cursor placement.

This has the advantage that the gizmo doesn't get in the way when Alt
is used for activating tools or placing the cursor.
2021-09-23 22:10:56 +10:00
88692baace WM: gestures now activate immediately on mouse press
Some gestures were activating immediately on tweak events,
extend this to mouse-press and click-drag.

Without this change, box-select for example wouldn't be automatically
activated on mouse-press.
2021-09-23 22:08:02 +10:00
b659d1a560 Cleanup: spelling in comments 2021-09-23 22:08:02 +10:00
d431b91995 Cleanup: assign variable for LMB select 2021-09-23 22:06:47 +10:00
4d2ca33a8a LibLink: Modify WM API to link/append one ID to take flag parameter.
There is no reason to lock behavior into a specific configuration in
those calls, make them properly configurable like the rest of the
link/append code.

This also enable users of those functions to activate 'ID reuse'
behavior.
2021-09-23 13:48:41 +02:00
aadb7ef071 Geometry Nodes: add utility to print an attribute id. 2021-09-23 13:46:26 +02:00
e86cf55667 Fix T91629: Crash in "Open Cached Render" function 2021-09-23 13:03:36 +02:00
f48a4aa0f9 LibLink Append: Expose 'reuse ID' through new BLO flag, and add basic tests.
Option is now available to append operator, alsthough hidden and
disabled by default.
2021-09-23 12:56:05 +02:00
cb173d05dc LibLink Append: Fix 'reused ID' case keeping linked data around.
When we re-use a local ID, we need to delete the matching linked data.
2021-09-23 12:54:23 +02:00
6f53988e7a Cleanup: proper handling of LIB_TAG_DOIT in append code. 2021-09-23 12:46:51 +02:00
ce96a75c2c Cleanup: eBLOLibLinkFlags: Add 'space' between APPEND flags and INSTANCE ones. 2021-09-23 12:45:40 +02:00
3558ae3b6c Cleanup: Silence unused var warning in release builds. 2021-09-23 12:30:07 +02:00
b63f777950 Add missing GPencil IDTYPE_FLAGS_APPEND_IS_REUSABLE flag.
Forgot that one in rB794c2828af60.

Noted by Antonio Vazquez (@antoniov), thanks.
2021-09-23 11:28:39 +02:00
b801e86f8b Append: Reuse local data: remove limitation on directly selected data.
in asset context, when user drag & drop a material several time, they
would still expect to re-use existing one instead of getting new copies
of it, even if this material is directly appended (and not an indirect
dependency of an object e.g.).
2021-09-23 11:15:58 +02:00
3042994c91 Link/Append: Refactor flags.
Flags controlling link/append code are split between two enums, one in
`DNA_space_types.h` and one in `BLO_readfile.h`.

This commit:
 - Moves flags exclusively used in WM and BLO code to `eBLOLibLinkFlags`
   in `BLO_readfile.h`. Flags in `eFileSel_Params_Flag` from
   `DNA_space_types.h` are now only the ones effectively used by the
   file browser editor code too.
 - Fixes some internal utils in `readfile.c` still taking `short` flag
   parameter instead of proper `int` one.

NOTE: there are a few other flags that could probably be moved to
`eBLOLibLinkFlags` (at the very least `FILE_LINK`, probably also
`FILE_AUTOSELECT` and `FILE_ACTIVE_COLLECTION`), since those are not
effectively used by the file browser, and control linking/appending
behavior, not filebrowser behavior.

However for now think it's safer to not touch that.
2021-09-23 11:01:00 +02:00
12924ed573 Fix last Cycles tile highlighted while file from disk is being processed 2021-09-23 10:41:06 +02:00
a351023bd5 Fix default surface resolution U/V mis-match
The resolution for surfaces was 12 for U, 4 for V,
where both should have been set to 4.

Regression in 9a076dd95a
2021-09-23 15:54:32 +10:00
754d56dcc1 Cleanup: spelling in comments 2021-09-23 15:42:44 +10:00
bf948b2cef Custom Properties: Rewrite edit operator, improve UX
This commit changes the custom property edit operator to make editing
different properties types more obvious and expose more of the data,
made more easily possible by the recent UI data refactor.

Previously, the operator guessed the type you wanted based on what you
wrote in a text box. That was problematic, you couldn't make a string
property with a value of `1234`, and you had to know about the Python
syntax for lists in order to create an array property. It was also slow
and error prone; it was too easy to make a typo.

Improvements compared to the old operator:
 - A type drop-down to choose between the property types.
 - Step and precision values are exposed.
 - Buttons that have the correct type based on the property.
 - String properties no longer display min, max, etc. buttons.
 - Generally works in more cases. The old operator tended to break.
 - Choose array length with a slider.
 - Easy to choose to use python evaluation when necessary.
 - Code is commented, split up, and much easier to understand.

The custom property's value is purposefully not exposed, since the Edit
operator is for changing the property's metadata now, rather than the
value itself. Though in the "Python" mode the value is still available.

More improvements are possible in the future, like exposing different
subtypes, and improving the UI of the custom properties panel.

Differential Revision: https://developer.blender.org/D12435
2021-09-22 21:57:33 -05:00
6e77afe6ec Applying patch D12600, GSOC Knife Tools branch
This adds constrained angle mode improvements,
snapping to global and local orientation,
visible distance and angle measurements,
undo capability,
x-ray mode,
multi-object edit mode.

See https://developer.blender.org/D12600 for more details.

Note: this project moved some of the default keymappings
around a bit, as discussed with users in the thread
https://devtalk.blender.org/t/gsoc-2021-knife-tool-improvements-feedback/19047
We'll change the manual documentation in the next couple of days.
2021-09-22 21:23:44 -04:00
a78d3c5261 Fix: T91602 ffmpeg crash
Issue caused by our patch in rB1af722b81912
we replaced an array with a memory allocation
but we forgot to update the assert which now
used an invalid method to calculate the array
size.

SVN libs will have to be updated before
T91602 will be fixed for end users.
2021-09-22 17:29:23 -06:00
79bcc19240 Cleanup: Move more shader nodes to socket declaration API
I had to add `no_muted_links` to the declaration API. The name could
change there, but I think it's more obvious than "internal"
2021-09-22 17:34:09 -05:00
6fb4c8f040 Fix: Incorrect socket names after previous commit 2021-09-22 16:58:29 -05:00
c99cb81452 Cleanup: Use new node socket declaration API for some shader nodes
This converts socket declarations for most shader nodes that had already
been converted to C++, but skips those that needed a special flag.
2021-09-22 14:39:09 -05:00
bd01f4761c GPencil: Fix compiler warnings 2021-09-22 21:17:04 +02:00
ee49991999 Cleanup: Silence missing switch case warning 2021-09-22 12:00:21 -07:00
6611f2cb74 Fix T91607: GPencil Tint modifier "apply" removes the effect 2021-09-22 20:07:35 +02:00
f893dea586 BLI: support initializing empty FunctionRef with nullptr
This may sometimes be desired because it is more explicitely
shows that the `FunctionRef` will be empty.
2021-09-22 19:55:44 +02:00
02bde2c1d5 Cleanup: add using declarations 2021-09-22 19:45:47 +02:00
a28ec92088 BLI: avoid warning when copying empty StringRef 2021-09-22 19:45:18 +02:00
188de4bc31 BLI: initialize MutableSpan in default constructor 2021-09-22 19:44:58 +02:00
bd1c4a781f Geometry Nodes: fix evaluating field to span 2021-09-22 18:45:11 +02:00
3180c6b4a7 Cleanup: Themes: Remove invalid theme option
`font_kerning_style` was removed in rBa1e91fbef3dc9a5d5c8456cd9a887aac1bdb652c
2021-09-22 12:33:12 -04:00
e1a0983b3c Fix T91608: Cycles crash with tile size 0 2021-09-22 18:12:46 +02:00
4068b6b5a7 Fix T91598: Decreasing sample count causes viewport to reset
Differential Revision: https://developer.blender.org/D12601
2021-09-22 18:09:06 +02:00
Chandrapal Singh
5033310e8a UI: Add description for Batch rename
Added description for Batch rename which pop-ups when
hovering the mouse over "Batch rename" inside the edit menu.

Fixes T91390

Reviewed By: Blendify

Maniphest Tasks: T91390

Differential Revision: https://developer.blender.org/D12594
2021-09-22 11:35:29 -04:00
ac68b08c5b Fix T91592: Negative Cycles remaining render time
For the default startup was showing -14:-08.-48 as a remaining time.

Was an integer overflow when specifying total number of pixel-samples.
2021-09-22 17:30:00 +02:00
bc1e675bb9 Fix T91603: Cycles crash when volume becomes visible
Making object which uses volume shader invisible will mark the shader
as not having a volume, forcing re-compilation of the shader to bring
it back to a consistent state.

The compilation is happening as part of scene update, which needs to
know kernel features. So there is a feedback loop.

Use more relaxed way of knowing whether there is a volume in the
shader for the kernel features, which doesn't require shader to be
compiled first.

Solves issues from the report, but potentially causes extra memory
allocated if the volume part of graph is fully optimized out. This
downside is solvable, but would need to split scene update into two
steps (the one which requires on kernel, and the one which does not).
It will be an interesting project to tackle, but for a bug fix is
better to use simpler solution.
2021-09-22 17:10:06 +02:00
1eba32c3e9 Fix T91576: Cycles attribute node with name N for smooth normal no longer working
There was an optimization to remove duplicate storage of normals as attributes
when using normal maps. However for named attributes like this we still need to
store the attribute.

Don't request normal attribute from the normal map node now, instead of skipping it
in the geometry code.
2021-09-22 17:05:31 +02:00
4762a9b09f GPencil: Fix unreported missing material panel for new Scene
When a new scene is created, the paint pointers are not available before using them, so the python panel exits because the pointer was None.

Now, the pointer is checked in order to display the materials panel as expected.
2021-09-22 17:05:21 +02:00
794c2828af Initial implementation of local ID re-use when appending.
This commit adds to ID struct a new optional 'weak reference' to a
linked ID (in the form of a blend file library path and full ID name).

This can then be used on next append to try to find a matching local ID
instead of re-making the linked data local again.

Ref. T90545

NOTE: ID re-use will be disabled for regular append for the time being
(3.0 release), and only used for assets. Therefore, this commit should
not change anything user-wise.

Differential Revision: https://developer.blender.org/D12545
2021-09-22 16:55:39 +02:00
707bcd5693 Cleanup: make format 2021-09-22 16:55:09 +02:00
dilithjay
0d350e0193 Geometry Nodes: Curve Fillet Node
This node can be used to fillet splines at control points to
create a circular arc.
The implementation roughly follows T89227's design.

The node works in two main modes: Bezier and Poly
* Bezier: Creates a circular arc at vertices by changing
handle lengths (applicable only for Bezier splines).
* Poly: Creates a circular arc by creating vertices (as
many as defined by the Count fields input) along
the arc (applicable for all spline types).

In both modes, the radius of the created arc is defined
by the Radius fields input.
The Limit Radius attribute can be enabled to prevent
overlapping when the defined radius exceeds the maximum
possible radius for a given point.

Reviewed By: Hans Goudey

Differential Revision: https://developer.blender.org/D12115
2021-09-22 20:11:12 +05:30
204b01a254 Fix T91590: Cycles specular baking not using smooth normal 2021-09-22 16:08:45 +02:00
e57ce464c2 Fix T91600: Cycles viewport not updaing on metaball changes 2021-09-22 16:08:45 +02:00
53e7c64be7 Fix T91597: Cycles volume scatter visibility on lights not working 2021-09-22 16:08:45 +02:00
368b56c9a1 GPencil: Split Weight modifier in two to make more consistent
The old modifier had two modes, but it is better to keep separated as meshes.

The UI has changed to be more consistent, including a new column type of modifiers.

Note: The logic has not changed with the previous version of the modifier, just is a split on two modifiers..

Reviewed By: mendio, pablovazquez

Differential Revision: https://developer.blender.org/D12586
2021-09-22 15:54:34 +02:00
9f6313498a Fix missing samples count pass when using tiles
Samples count pass is normalized to the overall number of samples.
This means that we need to store actual value of the samples in the
tile buffer file.

A bit annoying to pull all those settings to BufferParams and need
to find a more generic solution, but for now this is easiest and a
quickest solution.

Differential Revision: https://developer.blender.org/D12597
2021-09-22 15:07:55 +02:00
Christoph Lendenfeld
f7a492d460 Animation: Pose Slide Operator - Blend to Neighbour
Adds a new operator to the pose slider tools that blends the
current pose with the neighbouring poses in the timeline.
The operator can be called in pose mode with Shift+Alt+E
or from the "pose" menu under "In betweens/Blend to Neighbour"

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9137#inline-105214
Ref: D9137
2021-09-22 14:02:19 +01:00
a6f6c421ef Cleanup: pep8 for the default keymap
Mainly line lengths & indentation.
2021-09-22 22:50:16 +10:00
f7f5024c95 Keymap: support use_key_activate_tools for annotate 2021-09-22 22:38:28 +10:00
9add7c35cc Fix (unreported) crash in outliner after recent changes to ID management core code.
Outliner tree building code abuse the `ID.newid` pointer to store non-ID
data. While this is bad and should be fixed at some point, for the time
being at the very least do not use ID BKE API to deal with this pointer
in that specific case, this needs its own proper code.
2021-09-22 14:37:00 +02:00
2526a355bc Fix bad image drawing during rendering on certain GPUs
Reported by Thomas DInges: the default cube render in Cycles has jagged
edges during rendering. Happens on AMD Radeon RX 5500 XT.

Force linear interpolation at zoom level 1 and less.

Reviewed by @fclem
2021-09-22 14:28:56 +02:00
7633548d60 Revert "Make knife drawing anti aliased (Monkey work based on D11333)"
This reverts commit 96027b2d15.

The patch asserts on different occasions and needs more work.
2021-09-22 13:50:05 +02:00
2884ae971a Custom Properties: fix the tooltip field not initialized in edit dialog.
Initializing the description property was completely forgotten.
It also seems it may be missing sometimes, so use `get`.

Also, clean values when there is no data, and correctly use
the return value of `get_value_eval` in one instance.
2021-09-22 13:22:42 +03:00
90b485845c Keymap: set the default filepath exporting keymaps
Use the key-config name for the file name.
2021-09-22 17:47:52 +10:00
ba313f8a74 Fix crash duplicating sequencer area
Error in 997b5fe45d.
2021-09-22 17:37:10 +10:00
719451f840 Cleanup: use template for hide/reveal keymap items 2021-09-22 17:17:04 +10:00
c0f55400eb Keymap: support use_key_activate_tools for selection tools
Also support sequencer transform tools.
2021-09-22 17:17:04 +10:00
c75e6bcea2 Keymap: add fallback keymap for sequencer tools
This quiets error messages, fall-back tool preference needs to be
further developed.
2021-09-22 17:17:04 +10:00
Jeroen Bakker
0c59386110 Blender Libraries: Add JSON Library.
Several areas within blender can benefit a JSON reader/writer library.
Areas like the asset browser, XR and grease pencil.

After looking at the available options we selected nlohmann's JSON for
modern C++ library. It is actively maintained for over 10 years and
flexible.

This patch only adds the header only implementation of the library so it
can be used by different areas. The asset browser project is planning to
add a small abstraction layer so it will be easier to switch between
several different serialization formats. This is currently in
development in D12544.

In cases the abstraction layer can be an overhead and undesired to be used.
In this case the header file can be directly included.

Reviewed By: Severin

Maniphest Tasks: T91430

Differential Revision: https://developer.blender.org/D12567
2021-09-22 09:07:09 +02:00
Jake
4c156cba21 EEVEE fix gloss low roughness error
Up lower clamp on spec_angle to prevent NaN from being generated on intel GPUs at low roughness.

Fixes T88754

Reviewed By: fclem

Maniphest Tasks: T88754

Differential Revision: https://developer.blender.org/D12508
2021-09-22 08:22:23 +02:00
3fa6426392 Extern: Add TinyGLTF to load XR controller model
The XR_MSFT_controller_model OpenXR extension provides a glTF
controller model that can be displayed to users during a VR session.
There are plans to support this in D10948, which will greatly improve
VR immersion when using a compatible OpenXR runtime.

TinyGLTF (https://github.com/syoyo/tinygltf) was agreed upon as a
simple and sufficient solution for loading this glTF controller model,
which will be performed at the GHOST abstraction layer. Although by
default it has two additional dependencies, stb and json, stb can be
excluded by defining TINYGLTF_NO_STB_IMAGE and
TINYGLTF_NO_STB_IMAGE_WRITE whereas json will be added as a separate
extern lib in D12567.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12344
2021-09-21 22:59:10 -07:00
4d66cbd140 Cleanup: spelling in comments 2021-09-22 14:54:01 +10:00
77061a5621 Cleanup: incompatible-pointer-types warning 2021-09-22 14:46:32 +10:00
4d881d9dad Geometry Nodes: Curve Parameter Node
This commit adds a field input node that outputs the fraction of the
total length of the spline on each control point. This is useful for
anything that involves varying a value depending on how far along
the spline it is.

It also works when evaluated on the spline domain, where it outputs
the fraction of the total length of all of the splines at the start.

The operation isn't as well defined for NURB splines for the reasons
noted in the code comment. That can be said explicitly in the docs.

Differential Revision: https://developer.blender.org/D12548
2021-09-21 17:38:37 -05:00
41e3bf8a8e Geometry Nodes: Add legacy warning and "View Legacy" operator
This commit adds warning messages to "legacy" nodes that will be
removed in the future. The warning is shown in the node header, but
it is not printed in the terminal or displayed in the modifier. It is
also not propogated to node groups, but that is a more general task.

If the modifier's node tree has executed a deprecated node, it will
display a warning and a "Search" button that will select the nodes and
pan to them in the node editor. This doesn't open child node trees and
select nodes in there, because I want to keep this operator simple and
avoid wasting a lot of time perfecting this behavior.

Differential Revision: https://developer.blender.org/D12454
2021-09-21 17:17:40 -05:00
8324ac8457 Audaspace: porting upstream pulseaudio fixes.
Fixes T89045 and T91057.
2021-09-21 22:20:34 +02:00
af95542df3 UUIDs: rename UUID to bUUID
Rename the `UUID` struct to `bUUID`. This avoids a symbol clash on
Windows, which also defines `UUID`. This only pops up when a `UUID`
field is used in the DNA code, which is why it wasn't a problem before
(it will be once D12589 lands).

No functional changes.
2021-09-21 21:54:53 +02:00
6d162d35e2 Geometry Nodes: Fill instances separately in the curve fill node
With this commit, each referenced instance data will be converted to
a geometry instances and processed separately. This should result in
a large speedup when the instances component has many insances
referring to the same data.

This change can act as a blueprint for other nodes that need to
implement similar behavior. It adds some helper functions on the
instances component to make that easier.

Thanks to Erik Abrahamsson for a proof of concept patch.

Differential Revision: https://developer.blender.org/D12572
2021-09-21 14:20:54 -05:00
Erik Abrahamsson
29e3545194 Geometry Nodes: String manipulation nodes
This patch adds four new nodes to a new "Text" category:
 - String Length: Outputs length of a string
 - String Substring: Outputs part of a string
 - Value to String: Converts a value to a string
 - String Join: Concatenates multiple strings with a delimiter

The initial use case of these nodes is the upcoming string to curve
node. However, they could also be used to calculate dynamic attribute
names, or with string attributes in the future.

Differential Revision: https://developer.blender.org/D12532
2021-09-21 14:11:32 -05:00
05ce5276db Geometry nodes: Output curve normals from the normal node
The code is basically the same as rB4d51af68adb273.
2021-09-21 13:39:46 -05:00
4d51af68ad Geometry Nodes: Curve tangent node
This node outputs the direction vector, or tangent of a curve at every
control point. For poly splines this is simply the evaluated tangents,
so it all works very simply. For Bezier splines it uses the tangent at
the evaluated point corresponding to each control point, and NURBS
are interpereted as poly splines built from their control points.

Internally the node is called "Input Tangent" to simplify using it for
mesh tangents as well in the future like the "Normal" node.

Differential Revision: https://developer.blender.org/D12581
2021-09-21 13:11:39 -05:00
29b13fa3ca Cleanup: Clang-tidy warnings 2021-09-21 20:02:46 +02:00
499dbb626a UI: Style drag-drop indicators as tooltips
Currently, the drop indicator colors are hardcoded to white text on semi-transparent black background.
This patch makes the drop indicator use the tooltip theme settings, as they serve a similar purpose.

{F10530482, size=full}

All built-in themes seem to work well and got improved readability.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D12588
2021-09-21 19:53:42 +02:00
b37d36a60f Fix: Add versioning for geometry nodes attribute input toggle
rB8e21d528cab98 neglected to add versioning to add the new
"use_attribute" and "attribute_name" properties to the modifier input
list. Though they are added if the modifier's interface is updated, that
doesn't happen when the file is loaded, so patch adds them manually.
Another solution would be calling `MOD_nodes_update_interface`,
but that would require including the modifiers module.

Differential Revision: https://developer.blender.org/D12535
2021-09-21 12:42:47 -05:00
3642e17428 Cleanup: Move curve to mesh node implementation to blenkernel
I plan to use this for curve object data conversion to mesh in D12533,
and possibly for the implicit curve to mesh conversion in the curve
and text object modifier stack in the future.

Differential Revision: https://developer.blender.org/D12585
2021-09-21 11:56:54 -05:00
fde9c3bc74 Fix: Incorrect versioning for float IDProperty default array
The versioning has to have different behavior for when the old default
value had a float type rather than a double type. Also use memcpy
rather than dupalloc, since it's a bit clearer.
2021-09-21 11:20:34 -05:00
66dbe6e55a Cleanup: else-after-return 2021-09-21 17:55:39 +02:00
3c1e75a230 Functions: make asserts more correct
It is valid to e.g. copy construct an integer in the same place,
because it is a trivial type. It does not work for types like std::string.

This fixes a crash reported in D12584 where it would copy a buffer
into itself. We should probably also avoid doing this copy alltogether
but that can be done separately.
2021-09-21 17:51:15 +02:00
2df7d1ebce Cleanup: mention UUID_STRING_LEN in comment
Mention that `UUID_STRING_LEN` exists in the documentation of
`BLI_uuid_format()`.

No functional changes.
2021-09-21 17:50:23 +02:00
49ab38bf54 Fix T91534: GPencil interpolate Sequence fails if stroke has 0 points
In some cases the stroke has 0 points and this must be skipped in the interpolation.
2021-09-21 17:29:27 +02:00
Henrik Dick (weasel)
2e6a735385 GPencil: Curvature support for length modifier
Extend the stroke following an approximated circluar/helical curve.

This can be used as an effect for lineart or on its own as helix generator.

Reviewed By: Sebastian Parborg (zeddb), Hans Goudey (HooglyBoogly), YimingWu (NicksBest), Antonio Vazquez (antoniov), Henrik Dick (weasel)

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

# 请为您的变更输入提交说明。以 '#' 开始的行将被忽略,而一个空的提交
# 说明将会终止提交。
#
# 位于分支 master
# 您的分支与上游分支 'origin/master' 一致。
#
# 要提交的变更:
#	修改:     source/blender/blenkernel/BKE_gpencil_geom.h
#	修改:     source/blender/blenkernel/intern/gpencil_geom.cc
#	修改:     source/blender/gpencil_modifiers/intern/MOD_gpencillength.c
#	修改:     source/blender/makesdna/DNA_gpencil_modifier_defaults.h
#	修改:     source/blender/makesdna/DNA_gpencil_modifier_types.h
#	修改:     source/blender/makesrna/intern/rna_gpencil_modifier.c
#
2021-09-21 23:03:21 +08:00
84f98e28e3 Fix T87801: Eevee ambient occlusion is incorrect on M1 macMini
The issue was caused by `textureSize()` returning the size of the level 0
even when the min texture level is higher than 0.

Using a uniform to pass the correct size fixes the issue.

This issue also affected the downsampling of radiance for reflections and
refractions.

This does not affect anything other than the recusive downsampling shaders.
2021-09-21 16:39:17 +02:00
33955231f3 Fix T91458: Displaying dope-sheet with sequencer keyframes crashes
Error in e6194e7357.
2021-09-22 00:06:17 +10:00
a25cd206c6 Cleanup ClangTidy warning.
Different parameter name in function declaration and implementation.
2021-09-21 15:56:05 +02:00
Urko
96027b2d15 Make knife drawing anti aliased (Monkey work based on D11333)
Knife tool.

Make the drawing anti aliased and consistent by using
3D_POLYLINE/3D_POINT shaders, and making sure alpha
blending is on.

Monkey work based on [[ https://developer.blender.org/D11333 | D11333 ]]
done by  [[ https://developer.blender.org/p/krash/ | Anthony Edlin (krash)]]

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12287
2021-09-21 15:40:09 +02:00
0803119725 Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.

Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.

Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles

Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)

For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.

Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-21 14:55:54 +02:00
fa6b1007ba Fix script_load_keymap failure from c9d9bfa84a
Scanning the keymap hierarchy (used in the preferences),
caused the test to fail.

Don't attempt add fallback keymaps for dynamic keymap callbacks.
2021-09-21 22:19:40 +10:00
69928307c5 Cleanup: Silence unused variable warning 2021-09-21 14:18:31 +02:00
Aditya Y Jeppu
997b5fe45d VSE strip thumbnails
Draw thumbnails as strip overlay. This works for movie and image strips.
To draw thumbnails, this overlay has to be enabled and strips must be
tall enough.

The thumbnails are loaded from source file using separate thread and
stored in cache.

Drawing code uses only images stored in cache, and if any is missing,
background rendering job is started. If job can not render thumbnail,
to prevent endless loop of creating job for missing image it sets
`SEQ_FLAG_SKIP_THUMBNAILS` bit of `Sequence` flag.

To prevent visual glitches during timeline panning and zooming, `View2D`
flag `V2D_IS_NAVIGATING` is implemented. If bit is set, drawing code
will look for set of evenly distributed thumbnails that should be
guaranteed to exist and also set of previously displayed thumbnails.
Due to volatile nature of cache these thumbnails can be missing anyway,
in which case no new thumbnails will be drawn for particular strip.

Cache capacity is limited to 5000 thumbnails and performs cleanup of
non visible images when limit is reached.

ref T89143

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12266
2021-09-21 10:55:04 +02:00
fa2c1698b0 VSE: Image transform tools
Add tools for image manipulation in sequencer preview region.

This includes:
- Translate, rotate and resize operators, tools and gizmos
- Origin for image transformation
- Median point and individual origins pivot modes
- Select and Box select operator works in preview
- Image overlay drawing

ref T90156

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12105
2021-09-21 10:55:04 +02:00
26f9b1ef49 LibOverride: make view_layer API parameter optional.
This is used to find a valid collection in which to instantiate stray
objects and collections.

In some cases there will be no such active view layer, in which case we
can consider using the Scene's master collections children hierarchy
instead to find a valid instantiated parent collection for those stray
data.
2021-09-21 10:43:34 +02:00
f5c6029cc5 Keymap: preference for keys to set the active tool
With "Keys Activate Tools" preference enabled, keys such as G/R/S
activate the move/rotate/scale tool instead of the modal operator.

Addresses T83692.
2021-09-21 18:24:12 +10:00
8b8a678cdf Keymap: preference for Alt-LMB to use the active tool
With the LMB select key-map some tools required clicking on a gizmo.
With this preference it's possible to hold Alt and click anywhere.

Addresses T83689.
2021-09-21 18:24:07 +10:00
c9d9bfa84a Keymap: preference for fallback-tool with RMB select
Expose a key-map preference "Fallback Tool (RMB)",
disabled by default.

The right mouse button uses the fallback tool
(currently visible selection tool in the toolbar),
instead of always tweaking.

When any selection tool is active, right mouse always tweaks.

To enable fallback selection on RMB, set the "Right Mouse Select Action"
to "Selection Tool".

Internal changes:

- Add fall-back key-maps, separate key-maps needed for when the tool is
  run as a fall-back. This is needed so RMB-select can support fall-back
  tools, so left-mouse can be used when it's the active tool and RMB
  can be used as a fall-back action when another tool is active.
- Add options field to tools so tools without gizmos can enable the
  full-back tool keymap.
- Support multiple key-maps for keymap handlers.
- Fall-back keymaps now co-exist with the tool-keymaps.
  So both keymaps may be active at once - using different mouse buttons.
  When gizmos are in use, a highlighted gizmo prioritizes the
  tool-keymap over the fall-back keymap.

Resolves T83690.

Reviewed By: JulienKaspar

Ref D12493
2021-09-21 18:14:11 +10:00
52bfa750e7 WM: only return PASS_THROUGH on PRESS for selection operators
Some selection operators return (PASS_THROUGH & FINISHED) so the tweak
event isn't suppressed from the PRESS event having been handled.

This is now restricted to events with a PRESS action.
Without this, using CLICK for selection was passing the event through
which could run other actions unintentionally.
2021-09-21 17:26:21 +10:00
5eb505e368 Cleanup: Remove debugging change, add comments 2021-09-20 20:37:49 -05:00
17021adcea Geometry Nodes: Curve Sample Node
This node allows sampling positions, tangents, and normals at any
arbitrary point along a curve. The curve can include multiple splines,
all are taken into account. The node does not yet support transferring
generic attributes like radius, because some more general tooling will
make that much more feasible and useful in different scenarios.

This is a field node, so it is evaluated in the context of a data-flow
node like "Set Position". One nice thing about that is it can easily
be used to move an entire geometry like the follow path constraint.

The point along the curve is chosen either with a factor of the total
length of the curve, or a length into the curve, the same choice used
in the curve trim node.

Differential Revision: https://developer.blender.org/D12565
2021-09-20 20:23:26 -05:00
9e939a614e Functions: Fix incorrect assert for unused output
Since the variable for an output parameter can be null,
it is incorrect to use it later on in a reference.
2021-09-20 20:22:52 -05:00
4472a11017 Fix: Crash with single point bezier spline auto handles
There's no way to calculate auto or vector handles when there is
only one point, and returning early allows avoiding checking for
that case later on.
2021-09-20 20:20:39 -05:00
Victor-Louis De Gusseme
05f3f11d55 Geometry Nodes: Attribute Statistic Node
This nodes evaluates a field on a geometry and outputs various
statistics about the entire data set, like min, max, or even
the standard deviation. It works for float and vector types currently,
though more types could be supported in the future.

 - All statistics are calculated element-wise for vectors.
 - "Product" was not added since the result could very easily overflow.
 - The "Size" output was not added since it isn't specific to an
   attribute and would fit better in another node.

The implementation shares work as much as possible when multiple
statistics are needed.

This node has been in development since the beginning of this year,
with additions from Johnny Matthews and Hans Goudey.

Differential Revision: https://developer.blender.org/D10202
2021-09-20 18:39:39 -05:00
13a4bccdb1 Asset Browser: Redraw sidebars on mode switches
There may be mode specific panels for some assets in the navigation or
the asset metadata sidebar. For example the pose library will likely do
this. So let the regions redraw on mode changes.
2021-09-20 22:10:03 +02:00
15471d9bed Update RNA to user manual url mappings 2021-09-20 13:40:31 -04:00
e43ecca016 Tests: measure time per frame in animation performance benchmark
Instead of a fixed number of frames, so that benchmarking takes about the
same time on any machine.
2021-09-20 19:03:22 +02:00
3b8d702a2f Geometry Nodes: use implicit position input in noise node
This is the same behavior as in shader nodes.
2021-09-20 19:01:08 +02:00
32a4c7f188 Geometry Nodes: implicit position input in Set Position node
This change makes the Set Position node do nothing by default.
Before, the geometry would always disappear, because it all points
would be moved to (0, 0, 0).

Differential Revision: https://developer.blender.org/D12553
2021-09-20 18:56:30 +02:00
a79c33e8f8 UI: Change "Favorites" to "Bookmarks"
Change of File Browser "Favorites" section header in source list
(T panel) to "Bookmarks" to maintain consistency with all the other
bookmark-related text and operations.

See D10262 for more information and alternatives considered.

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

Reviewed by Julian Eisel
2021-09-20 07:42:17 -07:00
7cb65e4581 Cleanup: Refactor VSE overlay settings
Move overlay flags into SequencerPreviewOverlay and
SequencerTimelineOverlay structs.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12569
2021-09-20 16:30:15 +02:00
9642447faf GPencil: Fix error in previous commit
By error I commited the previous version.
2021-09-20 15:37:54 +02:00
c5c189a158 GPencil: Change Rotation tooltip
The tooltip was not clear about in what shading modes  works.

Related to T91467
2021-09-20 15:32:27 +02:00
eaad219ee7 Cleanup: spelling (correct c5c8c68eec)
"iff" was intended as "if and only if". while exact use of abbreviations
isn't clear cut, I assumed this was a typo & it's not used anywhere
else in source/, expand to "only if" (suggested by Sybren).
2021-09-20 22:31:13 +10:00
da4796ebf7 Build: change make update to not print errors regarding submodule branches
Instead of trying to checkout non-existent branches and getting confusing fatal
error prints, check if the branch exists first.

Ref D12560
2021-09-20 14:05:56 +02:00
fc4f82d200 Geometry Nodes: support Noise Texture node
This makes the Noise Texture node available in geometry nodes.
It should behave the same as in shader node, with the exception
that it does not have an implicit position input yet. That will
be added separately.

Differential Revision: https://developer.blender.org/D12467
2021-09-20 13:12:25 +02:00
8c7c4549d1 Geometry Nodes: support Set Position node on instances
Previously, the node would always realize instances implicitly.
Now it can change the position of entire instances.
The Realize Instances node can be used before if the old
behavior is required.

Differential Revision: https://developer.blender.org/D12555
2021-09-20 12:49:28 +02:00
11e11c41f2 make_update: Fix case where a sub-module would not have required branch.
Issue revealed by rB546314fc9669 change, also error itself exited before
that commit.

Now we do accept git command to fail when trying to checkout the
specified branch from sub-modules, and only actually error in case the
fall-back branch (aka master) cannot be properly checked out.

Thanks fot Ray molenkamp (@LazyDodo) for report and initial patch
(D12560).
2021-09-20 12:44:01 +02:00
7da9da2b27 Geometry Nodes: new Realize Instances node
This node has a simple geometry input and output.
If the input geometry contains instances, they will be realized
into actual geometry. When there are many instances, this can
be very slow and memory intensive. Generally, instances should
only be made real when necessary, e.g. when every instance
should be deformed independently.

Differential Revision: https://developer.blender.org/D12556
2021-09-20 12:37:52 +02:00
029d042e85 UUID: add nil value for UUIDs
Add `BLI_uuid_nil()` that returns the nil UUID (used to indicate "not
set") and `BLI_uuid_is_nil(uuid)` to do an equality test with the nil
value.
2021-09-20 12:15:37 +02:00
07b482c2ff UUID: fix seeding the RNG clock on macOS
On Apple machines, call `clock_gettime()` instead of `timespec_get()`.

macOS only introduced `timespec_get()` in version 10.15 (introduced
approx two years ago, so in 2019), even though the function is from C11.
2021-09-20 12:10:25 +02:00
1e3c5fdb85 Cleanup: UUID, prevent "missing braces" warning on macOS
Add braces around initialization of sub-objects, as per the warning
suggestion on macOS.

No functional changes.
2021-09-20 12:10:25 +02:00
4eba920d15 UUID: include 'seconds' field of current time in RNG seed
XOR the 'seconds' and 'nanoseconds' fields of the current time to seed the
RNG used for generating random UUIDs. This ensures a better seed just in
case the clock as no sub-second resolution.
2021-09-20 12:10:25 +02:00
1f51672d71 Fix T91511: GPencil weight_get and Vertex Groups not working at expected
The API was checking the number of total weights with the first point of the stroke and this was not valid because each point can have different number of weight elemnts,
2021-09-20 11:10:39 +02:00
738f1dbeff UI: rename "Save Screenshot (Area => Editor)"
The term "area" isn't normally exposed in the UI.
2021-09-20 19:03:07 +10:00
c5c8c68eec Cleanup: spelling 2021-09-20 16:44:28 +10:00
c773443845 Fix: Incorrect default values for the curve trim node
The default end factor should be 1. The proper value for the default end
length is somewhat arbitrary, but it shouldn't be zero.
2021-09-19 22:08:11 -05:00
f973e0b75a Fix: Spline length calculation fails with no evaluated points
The case that checked whether there were evaluated edges was incorrect,
since two points are needed for an edge. Then also avoid running the
accumulation for an empty span.
2021-09-19 19:01:24 -05:00
c9e835fec1 Fix build error after previous commit
Incorrect renaming and use of enum after search and replace.
2021-09-19 18:59:01 -05:00
25aa943e8c Cleanup: Fix/improve variable names and comments 2021-09-19 18:54:03 -05:00
276eebb274 Compositor: Add OIDN prefiltering option to Denoise node
It's equivalent to the OpenImageDenoise prefiltering option in Cycles.
See D12043.

Prefilter modes:
- None: No prefiltering, use when guiding passes are noise-free.
- Fast: Denoise image and guiding passes together. Improves quality when
guiding passes are noisy using least amount of extra processing time.
- Accurate: Prefilter noisy guiding passes before denoising image.
Improves quality when guiding passes are noisy using extra
processing time.

Reviewed By: #compositing, jbakker, sergey

Differential Revision: https://developer.blender.org/D12342
2021-09-19 21:13:51 +02:00
f256bfb3e2 Compositor: Fix crash exporting buffers on debug
ImBuf allocates 4 channels, use copying to support buffers
with 1 and 3 channels.
2021-09-19 21:13:45 +02:00
942c471ce9 Compositor: Fix Alpha Over node ignoring emissive colors
It was an issue on Full Frame mode only.
2021-09-19 21:13:40 +02:00
257c7753e9 Cleanup: Rename curve node enums
The enum called "interpolate" was really a choice of methods for mapping
inputs to positions on the curve, whereas the "sample" enum was used to
define a way to create a whole set of new points from the curve, without
any input parameters. The "re-sample" vs. "sample" naming makes that
distinction better.
2021-09-19 01:20:06 -05:00
69697fcca9 Revert "GPencil: Curvature support for length modifier."
Reason for revert: accidental push of a intermediate change locally.

This reverts commit 25e548c96b.
2021-09-19 13:19:32 +08:00
25e548c96b GPencil: Curvature support for length modifier. 2021-09-19 13:01:24 +08:00
bdbc7e12a0 Audaspace: added audio file streams functionality.
On the blender side this commit fixes importing video files with audio
and video streams that do not share the same start time and duration.

Differential Revision: https://developer.blender.org/D12353
2021-09-18 21:45:33 +02:00
970c928f27 Py API Docs: Fix audio docs example
After new AUD API changes from 2.8x what "buffer" function used to do
has now become "cache" function (it caches a sound into RAM). Therefore,
the basic aud example should call this new "cache" function instead of
"buffer" function.

Thanks to Michael-Z-Freeman for pointing out.
2021-09-18 19:28:55 +02:00
2618df7d03 Cleanup: add missing includes 2021-09-18 13:36:20 +02:00
136e357d8d Cleanup: typo 2021-09-18 13:35:05 +02:00
a229a9dd64 Fix T91461: Pose Library name filter not working
since `AssetHandle` does not have a `name_property`
(`RNA_def_struct_name_property`), and the UIList is just using the
default `uilist_filter_items_default` it simply cannot filter on names
(`RNA_struct_name_get_alloc` wont succeed).

Adding a name_property also wont work since `AssetHandle` inherits
`PropertyGroup` (which already sets name_property).

So this adds a (temporary) hack exception for RNA_AssetHandle in
uilist_filter_items_default until the design of `AssetHandle` progresses
further.

thx @Severin for additional feedback

Maniphest Tasks: T91461

Differential Revision: https://developer.blender.org/D12541
2021-09-18 08:13:24 +02:00
6cf734a2e5 UI: Always Create Asset Previews
This patch allows Asset Browser previews to be made regardless
of the setting of the (unrelated) "File Preview Type" Preference.

See D12484 for more details.

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

Reviewed by Julian Eisel
2021-09-17 08:08:56 -07:00
6b0aa7ae15 Geometry Nodes: hide Attribute Remove node when fields are enabled 2021-09-17 16:21:20 +02:00
9566e3bc9c Fix (harmless) mistake in recent new Append code.
This code path is not yet used so no harm, but that was a fairly nasty
potential crash-generator.
2021-09-17 16:20:39 +02:00
8ee7f62a63 Cleanup: clang-tidy warnings in UUID code
Use C++ version of C headers, and avoid static function call on instance.

No functional changes.
2021-09-17 14:51:43 +02:00
365443412c Cleanup: fix memory leak 2021-09-17 13:31:17 +02:00
Henrik Dick
9a41b44197 Fix T91481: Grease Pencil Layer Double Transformations
Use the inverse of the grease pencil object. This patch fixes the issue for bones and objects.

Maniphest Tasks: T91481

Differential Revision: https://developer.blender.org/D12539
2021-09-17 13:29:48 +02:00
e1d7ce005f Blenlib: introduce a UUID type
Add `BLI_uuid` and `DNA_uuid_types.h` with a UUID implementation
following RFC4122 (https://datatracker.ietf.org/doc/html/rfc4122.html).

The following features are implemented:
- A struct of 128 bits that can be used in DNA definitions.
- Generation of version 4 UUIDs, that is, purely random ones.
- UUID equality function.
- String to UUID and UUID to string conversion functions that are
  compatible with RFC4122.
- C++ stream operator that outputs the UUID as string.

This UUID will be used by the asset system, to uniquely identify asset
catalogs.

Reviewed By: Severin, jacqueslucke

Differential Revision: https://developer.blender.org/D12475
2021-09-17 12:22:00 +02:00
1cd20b0026 Fix T91448: GPencil Fill simplify not working in render
The simplify was hardcode to be disabled in render.
2021-09-17 11:01:01 +02:00
9dee0a10c8 Fix T85564: FCurve modifier zero influence on restrict range borders
When using FModifier `Restrict Frame Range`, the resulting influence was
zero being exactly on `Start` / `End` range borders (so borders were
**exclusive**).
This made it impossible to chain FModifers together (forcing the user to
specify values slightly below the desired border in following
FModifiers).
This is now corrected to be **inclusive** on Start / End range borders.

Before
{F10234864}
After
{F10234865}
Testfile
{F10234866}

In the case of touching open borders (so [frame A frame B] followed by
[frame B frame C]) both modifiers are evaluated (in stack order).
If the later modifier has full influence (and is not additive) this simply
means the result is the same as the later modifier's value.
If influences below 1 are used (or modifiers are additive) both modifier's
values are interpolated/added accordingly.

technical notes:
- this was caused by the introduction of FModifier Influence/BlendIn-Out
in rB185663b52b61.
- for comparison, see other occurrences of
`FMODIFIER_FLAG_RANGERESTRICT`.
- the following conditions in `eval_fmodifier_influence` for blend in/
out have been changed accordingly.

Maniphest Tasks: T85564

Differential Revision: https://developer.blender.org/D10401
2021-09-17 09:13:24 +02:00
06ac655b8d WM: expose the "any" state of KeyMapItem modifiers
Change KeyMapItem.alt/ctrl/shift/oskey to integer types,
where -1 is used to ignore the modifier when matching key-map items.

It was only possible to set all modifiers to -1 at once from RNA
using the 'any' property.
Afterwards individual modifiers could be set back to true/false.
Although these key-map items could not be exported/imported.

Exposing the values directly avoids the need for cumbersome workarounds.
2021-09-17 16:52:33 +10:00
6dca61b91c Cleanup: remove KM_MOD_SECOND & KM_SHIFT2, KM_CTRL2.. etc
These were added in a1c8543f2a (2007)
but never used.
Nor did they have any meaning in practice.

Note that versioning keymap items isn't needed as these values were
never set. The code-paths that set these values also set KM_MOD_FIRST
causing `keymap_event_set` to only ever assign values of 0 or 1.

These flags complicate further exposing KM_ANY (-1)
which is also a valid value for modifiers.
2021-09-17 13:20:50 +10:00
8bc27c508a UI: expose "Lasso Select" & "Extrude to Cursor" in menus
- Show "Lasso Select" in menus (along with Box & Circle select)
- Show "Extrude to Cursor" (along with other extrude actions).
- Rename operators that add/extrude on Ctrl-Click
  since their names were inconsistent.

This is mainly for discoverability.
2021-09-17 12:57:28 +10:00
f8b51f702c UI: enable the depend-on-cursor flag for some operators
- Bend (Transform).
- Extrude to Cursor.
- Lasso Select (related operators such as node-cut links, mask.. etc).
- Rip Mesh / UV's.
- Vertex/Edge Slide.
2021-09-17 12:57:28 +10:00
180bafe225 UI: split screenshot area into a separate operator
While the screenshot operator showed an "Area" option,
it wasn't usable from the main menu (unless accessed via menu search).

Split screenshot area into an operator that depends on cursor.
2021-09-17 12:57:28 +10:00
da2ba40268 UI: wait for input for operators that depend on cursor location
Support waiting for input so operators that depend on the
cursor location are usable from menus / buttons.

Use an operator type flag which the user interface code checks for,
waiting for input when run from a menu item.

This patch only supports this feature, there are no functional changes.

The motivation for this change is discoverability since some actions
were either hidden or broken when accessed from menus
(where the behavior of the operator depended on the menu location).

In general, waiting for input is *not* an efficient way to access tools,
however there are over 50 operators with a "wait_for_input" property
so this isn't introducing a new kind of interaction,
rather exposing this in a way that does not need to be hard-coded into
each operator, or having modal callbacks added for the sole purpose
of waiting for input.

Besides requiring boiler plate code using a "wait_for_input" property
has the added down-side of preventing key shortcuts from showing.
Only the menu items will enable the property,
causing them not to match key-map items.

Reviewed By: Severin

Ref D12255
2021-09-17 12:57:28 +10:00
633c29fb7b Fix: Nodes modifier ignores input value with new property missing
An issue with the previous commit-- the default value of the type was
used instead of the property value when the "use_attribute" property
was missing.
2021-09-16 21:54:14 -05:00
8e21d528ca Geometry Nodes: Add a toggle to use attributes as input values
This adds a toggle to node group inputs exposed in the modifier to use
an attribute instead of a single value. When the toggle is pressed, the
button switches to a text button to choose an attribute name. Attribute
search isn't implemented here yet.

One confusing thing is that some values can't be driven by attributes
at all, like the size of a primitive node. In that case, we should have
a node warning, but that will be separate since it's more general.
We can also have an option to turn off this toggle in node group
input settings.

The two new properties for each input are stored with the same name
as the value, but with `"_use_attribute"` and `"_attribute_name"``
suffixes. The properties are not added for socket types that don't
support attribute input, like object sockets.

Differential Revision: https://developer.blender.org/D12504
2021-09-16 20:49:10 -05:00
4fa0bbb5ac UI: Automatic Blend Thumbnail Selection
Adds an "Auto" option to blend thumbnail types that will automatically
use Screenshot if there is no camera and 3dview, or workbench render
with shading settings from the largest 3dview.

See D12407 for more details.

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

Reviewed by Campbell Barton
2021-09-16 17:40:19 -07:00
a1c65748c4 Cleanup: Pass const mesh argument
Also remove unnecessary parantheses.
2021-09-16 18:23:53 -05:00
8e2e44b58b Cleanup: Move mesh_convert.c to C++
This should allow easier changes when it's helpful to use C++ types.
The diff is for a test on the buildbot.

Differential Revision: https://developer.blender.org/D12528
2021-09-16 15:44:43 -05:00
7a9cfd08a8 UI: Remove Menus & Show Wait Cursor When Saving
When saving blend files close any menus that might be open, show
"waiting" mouse cursor right away, before creating preview.

See D12507 for more details.

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

Reviewed by Campbell Barton
2021-09-16 13:13:15 -07:00
db7fca3588 Cleanup: Remove unnecessary manual of move constructor
Turns out this isn't actually necessary.
2021-09-16 12:32:40 -05:00
f81bacd6f0 Geometry Nodes: Transfer attributes in the curve to mesh node
This patch allows point and spline attributes to be transferred to the
mesh generated by the curve to mesh node. All dynamic named and
anonymous attributes are transferred. So a user-created attribute will
be transferred, but "radius", "tilt" or the handle position attributes
won't be transferred by default and will need to be copied first.
This trade-off is made for performance, since most of the time, users
won't need these attributes copied.

Generally, attributes are transferred to the point/vertex domain.
However, if they have the same name as a built-in mesh attribute that
only exists on a different domain, like "shade_smooth", then they can
be transferred directly to that domain as well. Conversion directly to
the face corner domain is not necessary because there are no builtin
face corner attributes. I see this conversion directly to other domains
as an optimization we could use behind the scenes in the future as well,
when named attributes are less common.

For performance, I haven't tested which of the following is better:
```
for each spline combination:
    for each attribute:

for each attribute:
    for each spline combination:
```
For now I used the existing loop to avoid more threading overhead.

Differential Revision: https://developer.blender.org/D12363
2021-09-16 12:25:26 -05:00
ddb7cb7e4a Geometry Nodes: Simplify using OutputAttribute in a vector
Store the optional temporary span storage as a unique_ptr and move
it in the move constructor, to avoid the need to add a special move
constructor that clears the "show_warning" fields from it. Maybe this
is very slightly slower, but we'll need this class less often in the future
anyway.
2021-09-16 12:03:32 -05:00
31a0708cb1 Cleanup: Add built-in check for an attribute ID 2021-09-16 11:56:31 -05:00
58043c0637 Rename App Menu to Blender Menu
"App" is a name reserved for the application templates at the moment.
It may become its own term in the near future if Templates are separated
from "Apps".

So since this is a name not exposed to the users we should renamed it
sooner than later.

Note that this will require scripts to update since the name of the
class is renamed here.

This also requires an update in the User Manual.

Differential Revision: https://developer.blender.org/D12523
2021-09-16 18:48:59 +02:00
c9daab7936 Assets: Recursive reading of asset libraries
With this, asset libraries can be directory structures and all assets in
sub-directories will show up in an Asset Browser.

With complex directory structures and many .blend files inside, asset
library reading will be quite slow for now. There's initial work being
done to introduce indexing for this (T82979), other optimizations are
being discussed as well.

Addresses T91406.

Differential Revision: https://developer.blender.org/D12139
2021-09-16 16:41:31 +02:00
73ed076489 Hide empty keymap warnings when running a template 2021-09-16 16:11:41 +02:00
867e6ffe88 App Settings: Edge Resize
This prevents both editor resize as well as regions (e.g., the toolbar).

Note: This option is not visible in the UI.

Differential Revision: D12516
2021-09-16 16:02:33 +02:00
f2cfad77f9 App Settings: Regions Visbility Toggle
The toggle that allow users to "show" the region (header, toolbar, ...)
when it is collapsed can now be configured for the apps.

Note: This option is not visibile in the UI.

Differential Revision: D12516
2021-09-16 16:02:33 +02:00
9fee59a484 Rename show_layout_ui > show_corner_split and remove from UI
This breaks API compatibility. However we are now grouping this setting
in the proper section (preferences.apps), so scripts had to update anyways.

So they may as well do it for the final name.

The reason to remove from the UI is that this is intended for app setup,
and as such it should not be exposed to final users until we have apps
better presented (for 3.1 hopefully).

Differential Revision: D12516
2021-09-16 16:02:33 +02:00
c938d9a0e5 Cleanup: Rename USER_APP_LOCK_UI_LAYOUT
There will be other settings that lock other aspects of the
UI layout (e.g., resizing of editors). So better to name
this setting what it actually handles (the corners).

New name: USER_APP_LOCK_CORNER_SPLIT

Differential Revision: D12516
2021-09-16 16:02:33 +02:00
08aa0eb15d Cleanup: WM append code: de-duplicate post-make-local process a bit. 2021-09-16 15:31:03 +02:00
e97653ccf3 Fix: properly implement the 'only append' execption case for WorkSpaces.
Add needed extra flag and utils to IDType to mark and check an ID type
as only appendable.

Note that this is only a loose user-level enforcement currently, in any
case you need to be able to link an ID to append it currently, so for
low-level code this does not really matter.

Currently only WorkSpace and Screen ID types are marked with the new
`IDTYPE_FLAGS_ONLY_APPEND` flag.
2021-09-16 14:30:56 +02:00
3deb56424f Cleanup/Fix outliner 'make local' code.
While likely harmless, this code was doing extremely bad thing,
by-passing the whole lower-level `BKE_lib_id_make_local` call in case it
would fail and deciding by itself to forcefully make the given ID local.
Bad. Very, very, very bad.
2021-09-16 14:30:56 +02:00
e04a10adab Cleanup: no need to clear new flags and pointers from whole Main when making a single ID local. 2021-09-16 14:30:56 +02:00
27b6636c45 Cleanup: Comment about shpaekey being treated as embedded IDs in BKE_id_newptr_and_tag_clear. 2021-09-16 14:30:56 +02:00
4ec2bdbbda Cleanup: Add comment about 'make_local' callback of Brush doing bad thing.
Callbacks in IDTypeInfo should never affect other IDs if they are not
embedded.

We break this rule in some cases, at least each of those should be
clearly commented about and get some security checks to try to avoid
unexpected issues as much as possible.
2021-09-16 14:30:56 +02:00
1d5cc52ef6 Cleanup: Rename BKE_id_clear_newpoin to BKE_id_newptr_and_tag_clear. 2021-09-16 14:30:56 +02:00
1fce66190a Fix/refactor BKE_id_clear_newpoin and BKE_main_id_newptr_and_tag_clear.
Those were not clearing embdeed IDs flags and `newid` pointers at all...
2021-09-16 14:30:56 +02:00
236a9f0814 IDManagement: refactor: Remove 'test' part from BKE_lib_id_make_local.
Mixing testing and actual action in a single function is just not a good
way to do things, and the 'testing' feature is not used anywhere
anymore, time to get rid of it.
2021-09-16 14:30:56 +02:00
4f38624bf5 IDType: Add BKE_idtype_idcode_is_localizable.
This is the same as `BKE_idtype_idcode_is_linkable` currently, used only
in one place in UI code of IDtemplate.
2021-09-16 14:30:55 +02:00
95c2f0bea8 IDType: Cleanup: Remove useless IDTYPE_FLAGS_NO_MAKELOCAL.
This flag became a full duplicate of `IDTYPE_FLAGS_NO_LIBLINKING`, which
is a good thing (don't think we ever want to be able to link some data,
without being able to make it local...).

So we can now remove it and use `IDTYPE_FLAGS_NO_LIBLINKING` instead.
2021-09-16 14:30:55 +02:00
bfe8f29baf Fix ID-property UI versioning skipping nested meta-strips 2021-09-16 21:48:56 +10:00
860a55d8fc Fix security popup re-displaying after undo
Don't reset these flags when loading a file (or undoing)
rely on BPY_python_reset to reset the flags.
2021-09-16 16:56:38 +10:00
0e329a967e Fix memory leak if an error occurred assigning id-property sequence 2021-09-16 16:39:42 +10:00
0530b67909 Fix bisect gizmo offset while dragging 2021-09-16 16:36:53 +10:00
289f68588a GPencil: Fix dash modifier reading error.
The reference for parent modifier in segment data is not assigned. Now fixed.
2021-09-16 08:42:39 +08:00
28bd74c186 Cleanup: Use function to mark mesh normals dirty 2021-09-15 14:44:56 -05:00
8c5d9fa929 Cleanup: Remove duplicate warning from subdivision surface node 2021-09-15 14:19:08 -05:00
525def99bc Geometry Nodes: Hide values for selection inputs
Toggling the selection off in the node is the same as muting it,
so exposing it there doesn't help, and makes it less clear that it's
meant to be used as a field.
2021-09-15 14:16:16 -05:00
acb8909021 Fix: Division by zero in curve spiral primitive node 2021-09-15 14:12:48 -05:00
Johnny Matthews
231948f33f Splines: Add a method for reversing a Spline
This moved the spline reversing logic out of the Curve Reverse geometry
node and into the spline class. This allows a spline to reverse itself
with a call to `my_spline.reverse()`

The base class will reverse position, radii & tilt, while specialized
versions are created for Bezier and Nurbs splines to reverse the
additional data that these classes encapsulate.

Differential Revision: https://developer.blender.org/D12501
2021-09-15 13:57:01 -05:00
a866a32ff2 Tests: Updated test message for Directory Not Found 2021-09-15 23:04:47 +05:30
4a009b54bc Fix broken WorkSpace use after recent refactor of append code.
Essentially, Workspace (and Screen) types were defined as not
localizable.

In previous code it happended to work by mere chance (code path taken in
`BKE_library_make_local` was conviniently skipping the call to
`BKE_lib_id_make_local` in that case, hence not checking for
`IDTYPE_FLAGS_NO_MAKELOCAL` flag of the localized ID type).

This is a total abuse of this IDType flag, for now removing it.

That specific case (IDtype appendable but nor linkable) requires its own
proper flag, this will be tackled in a later commit.

Issue introduced in rB3be5ce4aad5e.
2021-09-15 19:06:36 +02:00
51f7d24a4e Fix missing passes result when rendering multiple views
Caused by the lazily pass pixels allocation which didn't reset
allocation state of the render result.

Demo file: XXX
2021-09-15 18:53:57 +02:00
b6d890672c Fix crash in 'drag asset' case in new append code from yesterday.
Scene and related pointer parameter can be NULL in link/append code, in
which case there is no instantiation of new objects/collections/obdata.

Link code in blendloader was already checking that, new instantiation
code in WM area from yesterday did not.

Issue introduced by rB3be5ce4aad5e.
2021-09-15 18:47:37 +02:00
Johnny Matthews
a6adb7ecae BLI: Add a reverse method to MutableSpan
Add a method that allows a MutableSpan to reverse itself. This reverses
the data in the original span object. This is a first step in extracting
some functionality from nodes and making it more general.

Differential Revision: https://developer.blender.org/D12485
2021-09-15 11:13:10 -05:00
09f14b38f2 Geometry Nodes: Add fields version of material nodes
This commit moves the old material nodes to a "legacy" folder and adds
versions of the nodes that work with fields.

The "Select by Material" node is a field node now, so it doesn't have
a geometry output. This is an improvement because there are fewer links
to connect, and it's more easily usable in different situations.
It's also called "Material Selection", since it's more of an input
than an action now.

It's sometimes necessary to use the attribute capture node to get a
more predictable interpolation to mesh faces. This is because the
selection field input is always evaluated on the face domain, so
attribute inputs are interpolated before they are booleans, so they
cannot use the new interpolations from rB5841f8656d9580d7b9.

Differential Revision: https://developer.blender.org/D12456
2021-09-15 10:51:52 -05:00
5841f8656d Geometry Nodes: Add special domain interpolation for selections
The generic domain interpolation algorithms didn't quite work for
selections. The interpolation would do unexpected things that
were different than the results in edit mode. The new behavior
is supposed to be the same as edit mode, although we also have
to handle face corner selections here.

Currently the code assumes that all boolean attributes should be
handled that way. I'm not sure of why that wouldn't be the case,
but if we ever need non-selection boolean attributes, that could
be supported too.

Differential Revision: https://developer.blender.org/D12488
2021-09-15 10:28:00 -05:00
e456a9de57 Cleanup: avoid passing redundant parameter 2021-09-15 16:35:33 +02:00
46fff97604 Nodes: refactor socket declarations
This commits adds a few common flags to `SocketDeclaration`
so that they are available for all socket types (hide label, hide
value, is multi input). This allows porting over the remaining
geometry nodes to the new declaration system.

Furthermore, this commit separates the concepts of the socket
declaration and corresponding builders. The builders are used
by nodes to declare which sockets they have (e.g. `FloatBuilder`).
The ready build socket declarations can then be consumed by
other systems such as the versioning code. Both use cases
need different APIs and those will change for independent reasons,
so it makes sense to separate the classes.
2021-09-15 16:09:00 +02:00
5c6cc931b2 Gizmo: add flag to hide the gizmo group during interaction
This allows a hack to be removed that temporarily overwrote
the 3D views gizmo display flag.

Also reverse change from fb27a9bb98
that runs poll on modal gizmo groups as there is some risk
that the poll function unlinks the gizmo.
2021-09-15 22:34:21 +10:00
1bd28a5e0c Cleanup: unused variable 2021-09-15 22:34:19 +10:00
c420399f4d Fix T91421: Length modifier bake influence check.
Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12496
2021-09-15 18:19:56 +08:00
429136c89f Fix Asset Browser cannot open containing file anymore
In {rB9cff9f9f5df0} asset_library was renamed → asset_library_ref.

Missed to update this in assets.py.

Differential Revision: https://developer.blender.org/D12497
2021-09-15 12:09:23 +02:00
e6ca054590 Geometry Nodes: multi threaded field evaluation
This adds a new `ParallelMultiFunction` which wraps another multi-function
and evaluates it with multiple threads. The speeds up field evaluation
quite a bit (the effect is most noticeable when the number of evaluations
and the field is large).

There are still other single-threaded performance bottlenecks in field
evaluation that will need to be solved separately. Most notably here
is the process of copying the computed data into the position attribute
in the Set Position node.

Differential Revision: https://developer.blender.org/D12457
2021-09-15 11:02:39 +02:00
fb27a9bb98 Gizmo: show groups flagged with SHOW_MODAL_ALL during interaction
Follow up to fix for T73684,
which allowed some modal gizmos to hide all others.

Also resolve an issue from 917a972b56
where shear the shear gizmo would be visible during interaction.

Internally there are some changes to gizmo behavior

- The gizmo with modal interaction wont draw if it's poll function fails.
- The WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL flag now causes these gizmo
  groups to draw when another group is being interacted with.
2021-09-15 17:54:24 +10:00
785e7ddf10 Cleanup: replace defines with functions 2021-09-15 17:05:56 +10:00
8cbe55c9e9 Cleanup: correct tracker ID in comment 2021-09-15 17:05:56 +10:00
a2c5c2b406 GPencil: Dot dash modifier.
Create dot-dash effect for grease pencil strokes. User can manually edit the length, gap and styles for each segment of dashed lines.

The values in each segment can all be key-framed to make animations.

Reviewed By: Hans Goudey (HooglyBoogly), Antonio Vazquez (antoniov)

Differential Revision: http://developer.blender.org/D11876
2021-09-15 14:38:32 +08:00
c1cf66bff3 LineArt: Automatic crease with flat/smooth faces.
This allows crease lines to be automatically hidden on smooth surfaces, also provided options for:

- Showing crease on marked sharp edges.
- Force crease detection on smooth surfaces.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: http://developer.blender.org/D12051
2021-09-15 14:03:39 +08:00
202dc3631e PyDocs: Update theme to latest version 2021-09-14 23:16:38 -04:00
94dd30208e UI: Addition Changes to Freestyle Properties
- Material Properties: Use split column layout
- Remove the redundent term 'Options'
- Remove the redundent term 'Freesttle'
2021-09-14 22:57:57 -04:00
56f8d7c705 Fix T89241: Scale to fit overflows into a second line 2021-09-15 11:15:00 +10:00
e1714ce8c9 Cleanup: spelling 2021-09-15 10:56:35 +10:00
97de4f07a3 Cleanup: doxy sections, parameter syntax 2021-09-15 10:53:12 +10:00
e6fa74ffed Fix: Use after free in spreadsheet attribute column ID
A temporary string was created in the attribute_foreach callback
and used in a map at a higher scope. When the callback finished,
the string went out of scope, was freed, then the elements in the
set pointed to freed memory.
2021-09-14 18:13:52 -05:00
Christoph Lendenfeld
7c7348f78d Fix T89027: "factor" field in pose breakdowner not updated
After applying the pose breakdowner,
the "factor" slider in the redo panel wasn't set to the correct value
This would cause the pose to jump around
once you start dragging the slider

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12187
Ref: D12187
2021-09-14 19:24:36 +01:00
0ed089cebd LibLink: Enable unittest that was previously failing in append case.
Previous commit fixed it.
2021-09-14 17:59:18 +02:00
3be5ce4aad LibLink: New Append code.
This commit fully refactors the way linked IDs are made local when
appended.

Previously, `BKE_library_make_local` was (ab)used for this task, but it
was missing some contextual data and doing complex processing to try to
work around this, with limited sucess. Further more, it was nearly
impossibe to extend (e.g. to get new append behaviors necessary for the
asset project).

The new code is a dedicated append step in WM linking process.

NOTE: BPY API (`libray.load()` context manager) uses its own code here,
which still relies on `BKE_library_make_local` for appending.
Unfortunately, merging those two different code paths is not trivial so
for now this API will remain unchanged.

Fix T55629: Append already linked Data is impossible.
2021-09-14 17:49:57 +02:00
cddb792021 ID management: Add new version of relink_to_newid using proper new remapping code.
Current `BKE_libblock_relink_to_newid` is using its own simplistic,
limited and not really correct version of ID remapping.

While doing a full replacement would have been ideal, this is
risky/time-constrained for Blender 3.0 release, so for now we'll have
both versions co-existing.
2021-09-14 17:49:35 +02:00
2d13c823ee Cleanup: fix inconsistent parameter name
Found by clang-tidy.
2021-09-14 16:41:29 +02:00
edaeec3e72 Nodes: cache node declaration on node
Previously, it was necessary to rebuild the node declaration
every time it was used. Now it is cached per node for easy
and fast access.

For more details on what this is, look at the comment in
`DNA_node_types.h`.

Differential Revision: https://developer.blender.org/D12471
2021-09-14 16:34:31 +02:00
dee0b56b92 Cleanup: simplify resource scope methods
Previously, a debug name had to be passed to all methods
that added a resource to the `ResourceScope`. The idea was
that this would make it easier to find certain bugs. In reality
I never found this to be useful, and it was mostly annoying.
The thing is, something that is in a resource scope never leaks
(unless the resource scope is not destructed of course).

Removing the name parameter makes the structure easier to use.
2021-09-14 16:08:09 +02:00
426e2663a0 Fix: use type name instead of variable name
That was a typo in rBfd60f6713a9d9e6f7d706b53bf1311f2f1cd9031.
2021-09-14 15:18:17 +02:00
fd60f6713a Functions: support optional outputs in multi-function
Sometimes not all outputs of a multi-function are required by the
caller. In those cases it would be a waste of compute resources
to calculate the unused values anyway. Now, the caller of a
multi-function can specify when a specific output is not used.
The called function can check if an output is unused and may
ignore it. Multi-functions can still computed unused outputs as
before if they don't want to check if a specific output is unused.

The multi-function procedure system has been updated to support
ignored outputs in call instructions. An ignored output just has no
variable assigned to it.

The field system has been updated to generate a multi-function
procedure where unused outputs are ignored.
2021-09-14 14:52:44 +02:00
90a48fa064 Geometry Nodes: fix memory leak for multi input sockets 2021-09-14 13:33:34 +02:00
1c1be5bdf4 Fix T90862: Texts in Outliner can have wrong icon
In contrast to the Filebrowser, the Outliner (Blender File view) did not
distinguish icons for text-based formats (if they have a filepath this
can be done though).

Maniphest Tasks: T90862

Differential Revision: https://developer.blender.org/D12347
2021-09-14 09:53:57 +02:00
30845b5c8e Doc: expand on comment for why bound-box access could cause issues 2021-09-14 13:27:15 +10:00
917a972b56 UI: keep navigation gizmos visible during modal operators
Hiding viewport navigation gizmos caused the UI to "flicker"
unnecessarily, the axis could also be useful as a reference.

Resolves T73684
2021-09-14 12:49:36 +10:00
9b0b78d58f Update RNA to User Manual Mappings 2021-09-13 19:08:12 -04:00
3ff60bcad8 Asset Template: Extra UI options
This allow users to show/hide:
* Library name / refresh.
* Assets names.
* Filter.

To set them in Python use:
display_options={'NO_NAMES', 'NO_FILTER', 'NO_LIBRARY'}

With contributions by Julian Eisel.

Differential Revision: https://developer.blender.org/D12476
2021-09-13 19:51:46 +02:00
9fe6854a93 Cleanup: Remove duplicate code
Class SEQUENCER_PT_overlay as defined twice.
2021-09-13 17:48:57 +02:00
Germano Cavalcante
4f73d43adc Fix T90736: Problem applying scale to curves
Curve Points of handle of type `Auto` on curves not uniformly scaled
cause the shape of the curve to be modified after applying the scale.

So change these handles to `Aligned` in these cases.

Reviewed By: campbellbarton

Maniphest Tasks: T90736

Differential Revision: https://developer.blender.org/D12281
2021-09-13 12:43:04 -03:00
a78410386b Cleanup: fix typo in comment 2021-09-13 16:49:32 +02:00
1bcdd1c54e Fix T91320: Support flipping sides in mesh bisect
Changing active side was introduced in {rB7ff6bfd1e0af} but was never
working for tools/operators other than the sculpt line mask tool.

While for most tools/operators this actually does not make sense, the
bisect tool/operator can actually benefit from it.

thx @campbellbarton for additional input!

Maniphest Tasks: T91320

Differential Revision: https://developer.blender.org/D12473
2021-09-13 16:42:27 +02:00
503d79cd77 Fix straightline gesture snapping not working for modal tools
This was implemented in {rB14d56b4217f8} but was never working for
tools/operators other than the sculpt line mask tool.

To be precise, the preview actually snapped but the operations (e.g.
mesh bisect, vertex weight gradient) still happened "unsnapped" in
modal. For the sculpt line mask tool this wasnt a problem, because it
only draws a preview while modal, the actual mask was only applied
later.

This solves part one of T91320 (snapping), sculpting also introduced
flipping in {rB7ff6bfd1e0af} which does not make much sense for all
tools, but in bisect this could actually be supported, will add that in
a separate Diff.

ref T91320

Maniphest Tasks: T91320

Differential Revision: https://developer.blender.org/D12470
2021-09-13 16:42:27 +02:00
Iyad Ahmed
6f52ebba19 UI: Freestyle UI Upgrade
Suggested and funded by [[ https://blendernpr.org/| BNPR ]], this patch aims to update the long not-updated Freestyle UI

**Why do the UI upgrade:**

  - Freestyle UI doesn't match the rest of Blender UI, it was neglected for a long time
  - The current UI makes Freestyle workflows tedious and distracting

**Highlights:**

For before/after screenshots see https://developer.blender.org/D10505

Video:
https://youtu.be/qaXhuJW_c9U

Workflow video (older revision): https://youtu.be/IqbjIq_A800

Doc patch (WIP): https://github.com/bnpr/FreestyleUIUpgrade/blob/main/freestyle-ui-upgrade-docs.diff

Reviewed By: #user_interface, Blendify, HooglyBoogly, Severin

Differential Revision: https://developer.blender.org/D10505
2021-09-13 10:37:50 -04:00
c9c890f196 Templates: Set more user preference settings to be swapped
* Splash Disable
* Show gizmo navigate
* ui scale

It is a bit arbritrary now. So those are the flags I'm
setting up for the Blender 101 project (T90025).

Differential Revision: https://developer.blender.org/D12474
2021-09-13 16:18:59 +02:00
4b06420e65 Cleanup: Packedfile don't repeat yourself.
Introduced `BKE_packedfile_unpack` that is called from the specialized
implementation for Image, Sound, Font, Volume etc. This is in
preparation for T91252.
2021-09-13 14:13:58 +02:00
603ae580ce Build: show better "make update" error message when in detached HEAD state 2021-09-13 13:14:17 +02:00
b777df8080 Fix: fix equality operator for fields
Instead of comparing the referenced field node by pointer,
compare the nodes directly instead. This is important
because different field nodes might be the same semantically.
2021-09-13 13:09:18 +02:00
410dc76177 Various UI messages fixes and updates. 2021-09-13 12:40:37 +02:00
f6ebbfe7de Nodes: move some texture nodes to c++
This is necessary to be able to use them in geometry nodes.
2021-09-13 11:54:05 +02:00
9d6e960e2c Fix make_utils.py recent API breackage.
rB546314fc9669 broke `svn_libraries_base_url` utils API compatibility
for no good reasons, making new `branch` argument explicitely optional.

Reported on chat by  Michael Kowalski (@makowalski), thanks!
2021-09-13 11:41:43 +02:00
25550c210a Fix regression test after recent fix
Was cased by 9b2b32a333.
2021-09-13 11:30:32 +02:00
eaa35b27e0 Fix T91311: incorrect batch generation for instances
This was a mistake in {rB5a9a16334c573c4566dc9b2a314cf0d0ccdcb54f}.
2021-09-13 10:42:54 +02:00
9b2b32a333 Fix T84638: Wrong scale for primitives with radius
Creating some primitives allows for a scale value (via python) that will
scale the object accordingly. For objects with a radius parameter
(like cylinders, spheres, etc.) passing a scale different to (1,1,1)
would result in unexpected behavior.

For example:
`>>> bpy.ops.mesh.primitive_uv_sphere_add(radius=2, scale=(1,1,2))`
We would expect this to create a sphere with a radius of 2
(dimensions 4,4,4) and then be scaled *2 along the z-axis
(dimensions 4,4,8). But this would previously create a scaled sphere
with dimensions (2,2,4).

The scale was simply divided by two. Maybe because the "radius"
parameter for creating the primitives was confusingly named "diameter"
(but used as the radius).

The fix adds a scale parameter to `ED_object_new_primitive_matrix`
and also renames the wrongly named "diameter" parameters to "radius".

Reviewed By: campbellbarton

Maniphest Tasks: T84638

Ref D10093
2021-09-13 18:02:27 +10:00
9d336576b5 Cleanup: clang-format 2021-09-13 17:50:02 +10:00
Jon Denning
e0394761b9 GPUShader: Expose name for debugging & identifying shaders
Added optional `name` argument to `GPUShader` constructor
(defaults to `pyGPUShader`), and added `name` getter to `GPUShader`.

Ref D12393

Reviewed By: campbellbarton, jbakker
2021-09-13 16:16:45 +10:00
b5a1c194c5 Cleanup: early return from smoothview when the view is unchanged 2021-09-12 19:51:17 +10:00
2aa7edbe6b Cleanup: spelling 2021-09-12 19:51:16 +10:00
15405685d9 Cleanup: Remove no-op/unused code 2021-09-11 15:00:36 -05:00
b9febb54a4 Geometry Nodes: Support modifier on curve objects
With this commit, curve objects support the geometry nodes modifier.

Curves objects now evaluate to `CurveEval` unless there was a previous
implicit conversion (tessellating modifiers, mesh modifiers, or the
settings in the curve "Geometry" panel). In the new code, curves are
only considered to be the wire edges-- any generated surface is a mesh
instead, stored in the evaluated geometry set.

The consolidation of concepts mentioned above allows remove a lot of
code that had to do with maintaining the `DispList` type temporarily
for modifiers and rendering. Instead, render engines see a separate
object for the mesh from the mesh geometry component, and when the
curve object evaluates to a curve, the `CurveEval` is always used for
drawing wire edges.

However, currently the `DispList` type is still maintained and used as
an intermediate step in implicit mesh conversion. In the future, more
uses of it could be changed to use `CurveEval` and `Mesh` instead.

This is mostly not changed behavior, it is just a formalization of
existing logic after recent fixes for 2.8 versions last year and two
years ago. Also, in the future more functionality can be converted
to nodes, removing cases of implicit conversions. For more discussion
on that topic, see T89676.

The `use_fill_deform` option is removed. It has not worked properly
since 2.62, and the choice for filling a curve before or after
deformation will work much better and be clearer with a node system.

Applying the geometry nodes modifier to generate a curve is not
implemented with this commit, so applying the modifier won't work
at all. This is a separate technical challenge, and should be solved
in a separate step.

Differential Revision: https://developer.blender.org/D11597
2021-09-11 13:54:40 -05:00
c946fdb2e5 Calm Warning: Unused Variable
Calms warning for unused variable in `constraint_copy_to_selected_poll`
by using UNUSED_VARS.

See D12453 for further details

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

Reviewed by Campbell Barton
2021-09-11 09:07:57 -07:00
863460e5a5 Compositor: Full frame previews
Adds full frame implementation to PreviewOperation.

Part of T88150.
2021-09-11 15:42:29 +02:00
cbe05edde5 Compositor: Fix crash when hashing unconnected operations
It was causing some tests to fail when enabling Full Frame mode.
2021-09-11 15:42:23 +02:00
4e78b89e48 Geometry Nodes: add field support for socket inspection
Since fields were committed to master, socket inspection did
not work correctly for all socket types anymore. Now the same
functionality as before is back. Furthermore, fields that depend
on some input will now show the inputs in the socket inspection.

I added support for evaluating constant fields more immediately.
This has the benefit that the same constant field is not evaluated
more than once. It also helps with making the field independent
of the multi-functions that it uses. We might still want to change
the ownership handling for the multi-functions of nodes a bit,
but that can be done separately.

Differential Revision: https://developer.blender.org/D12444
2021-09-11 13:05:20 +02:00
166c8be7ac Cleanup: use nullptr 2021-09-11 12:41:46 +02:00
aeeffb935e Functions: store cursors to previous instructions
Now an instruction knows the cursors where it is inserted instead
of just the instruction that references it. This has two benefits:
* An instruction knows when it is the entry instruction.
* The cursor can contain more information, e.g. if it is linked to the
  true or false branch of a branch instruction.

  This also simplifies updating the procedure in future optimization
  passes.
2021-09-11 11:43:59 +02:00
6ae8de4742 Cleanup: Rename variables, simplify logic
Mostly renaming the variables to improve line wrapping.
But also the "foreach_attribute" loops look simpler now.
Also use `Spline::copy_base_settings` and don't bother
with an extra call to reallocate the attribute arrays.
2021-09-10 23:21:58 -05:00
d475f99460 Geometry Nodes: Support "Evaluated" mode in Resample Curve node
Just like the curve to points node, this mode outputs point locations
based on the input curve's evaluated points (the points you see in the
viewport). This is expected to be faster, since it doesn't have to
sample equal positions on the result, and it's also consistent with
the existing choices in the curve to points node.
2021-09-10 22:58:30 -05:00
cb83313863 Nodes: Add vector min/max support to new socket builder API
Also use it to fix an incorrect min and max in the cube mesh
primitive node.
2021-09-10 22:48:49 -05:00
Nikhil Shringarpurey
eab26f1334 UI: Quad View Option Names Improved
Improvements to Quad View options' titles and descriptions.

See D12381 for more details.

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

Reviewed by Hans Goudey and Campbell Barton
2021-09-10 14:22:21 -07:00
8745bb9628 Cleanup: Split legacy node type defines 2021-09-10 15:58:18 -05:00
6a00e7a428 Fix: Incorrect file subversion for geometry node versioning
rBe2f99c338bd57 should have used the subversion currently defined
in Blender, instead it used one lower, so some files didn't have the
versioning applied.
2021-09-10 13:26:46 -05:00
5e0684b07d Revert startup.blend changes from commit a00507c482
It appears an old version of this file was committed by accident. The
intended change to remove sculpt layers was done in versioning code and
does not require a modified startup.blend.
2021-09-10 18:59:39 +02:00
Henrik Dick
28f773925a Fix Constraints not updating on move in stack
Flag the changed object and its bones to update after moving a
constraint in the stack up or down. The two operators for move up and
move down seem to be unused, but I notices they had the same problem, so
I added the update there as well.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D12174
2021-09-10 18:49:18 +02:00
6b7b4f8e57 VFont: Refactor of check_freetypefont()
Refactor of our Vfont check for font validity.

See D12068 for further details.

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

Reviewed by Campbell Barton
2021-09-10 09:30:21 -07:00
e2f99c338b Geometry Nodes: Add versioning to change legacy node ID names
Recently we have decided to avoid fancier versioning for nodes with
string inputs for attribute names when updating the attribute workflow
for 3.0. In that case we would just duplicate any node that will
have an updated version to work with fields.

We want to be able to use the "proper" ID names for the new versions
of the nodes though, so this patch adds "Legacy" to the IDs of all
nodes that will be replaced in 3.0. This commit also removes the nodes
from the add menu when the fields experimental preference is enabled,
in order to make it clear what has been updated and what hasn't.

Nodes in the "Maybe" categories in versioning_300.c can be renamed
later if necessary. For now it's probably better to be conservative,
and to keep the list complete.

Differential Revision: https://developer.blender.org/D12420
2021-09-10 10:34:49 -05:00
Brecht Van Lommel
128eb6cbe9 Modifiers: export motion blur velocity through attribute
Previously fluid simulation and Alembic modifiers had a dedicated function
to query the velocity for motion blur. Now use a more generic system where
those modifiers output a velocity attribute.

Advantages:
* Geometry and particle nodes can output velocity through the same mechanism,
  or read the attribute coming from earlier modifiers.
* The velocity can be preserved through modifiers like subdivision surface or
  auto smooth.
* USD and Alembic previously only output velocity from fluid simulation, now
  they work with velocity from other sources too.
* Simplifies the code for renderers like Cycles and exporters like
  Alembic and USD.

This breaks compatibility:
* External renderers and exporters accessing these velocities through the
  Python API now need to use the attribute instead.
* Existing modifier node setups that create an attribute named "velocity"
  will render differently with motion blur.

Differential Revision: https://developer.blender.org/D12305
2021-09-10 16:48:30 +02:00
42215d7cb8 Tests: more graceful handling of keyboard interrupting benchmarks
Leave current test result unchanged and stop executing immediately,
so it can be continued.
2021-09-10 16:48:26 +02:00
eb96f0cf06 Add missing bit to own previous commit
Amendment to 7a5216497c.
Removed this before committing, because I thought it wasn't needed. Of
course it was...
2021-09-10 15:01:48 +02:00
0467ff4053 Python: extra check on BPY_thread_save() to ensure proper GIL handling
Use `_PyThreadState_UncheckedGet()` to check that the current thread is
tracked by Python before checking whether it has the GIL. The latter
will abort when the former is false.
2021-09-10 14:58:02 +02:00
ca39aff59d Cleanup: Fix comment in recent commit.
A task is created for each item in a list base. It used to say that a
thread was created for each item.
2021-09-10 14:45:03 +02:00
7a5216497c Fix possible crash displaying asset preview from current file
For some reason the asset preview isn't created or loaded correctly in
some instances. This could be addressed with D9974, but hard to tell
since I only have a failing .blend file, no steps to recreate it from
scratch.

Would crash when opening an Asset Browser, selecting an object asset
(that has an invalid preview stored) and opening the Asset Browser
sidebar, so that the preview is visible there.
2021-09-10 14:44:09 +02:00
Jeroen Bakker
7f1fe10595 T78995: Enable keylist threaded drawing.
This enabled multithreaded building of the keys that needs to be drawn
in the timeline (and other action editors).

On an AMD Ryzen 3800 using a mocap data test file (available in patch)
the performance went from 2fps to 8fps. The performance increase depends
on the number of rows of keyframes that is shown in for example the
timeline editor.

Each row will be using a different thread. Currently the bottleneck is
the summary channel that we could split up in the future even more (
although that is a complex refactoring work).

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D12198
2021-09-10 14:31:00 +02:00
a1167e910a BLI: Add Cycles compatible Perlin noise
This patch adds new Perlin noise functions to BLI. The noises are compatible
with the shading texture noises in EEVEE, SVM, and OSL.

The existing Jenkins hash functions couldn't be used because they are not
compatible with the shading implementations and an attempt at adjusting the
implementation will break compatibility in various areas of Blender. So the
simplest approach is to reimplement the relevant hashing functions inside the
noise module itself.

Additionally, this patch also adds a minimal float4 structure to use in the
interface of the noise functions.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12443
2021-09-10 14:25:32 +02:00
Jeroen Bakker
60cfdf0809 Anim: Keylist drawing optimization by using arrays.
Change data structure of keylists. Reducing the balancing overhead and therefore increases performance.

| **Function** | **Master** | **Patch** |
|`draw_summary_channel`| 0.202105s| 0.083874s |

When adding items to the keylist it will store it in a linked list. This linked list is
accompanied with the length (key_len) and a `last_accessed_column`. last_accessed_column is a cursor
that improve the performance when adding new items as they are mostly ordered by frame numbers.
last_accessed_column is reset when a new fcurve/mask/... is added to the keylist.

Before searching or array access. the listbase needs to be converted to an array.
`ED_keylist_prepare_for_direct_access`. After that the caller can use
`ED_keylist_find_*` or `ED_keylist_array*` functions.

The internal array can also be accessed via the `ED_keylist_listbase` function.
The items inside the array link to the previous/next item in the list.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D12052
2021-09-10 13:28:47 +02:00
a00507c482 Templates: remove masking layers from the default startup file
Remove sculpt mask layer from the default cube, added in
444934632a.
2021-09-10 19:29:45 +10:00
fe4286435c Depsgraph: release GIL when evaluating the depsgraph
Evaluating the dependency graph potentially executes Python code when
evaluating drivers. In specific situations (see T91046) this could
deadlock Blender entirely. Temporarily releasing the GIL when evaluating
the depsgraph resolves this.

This is an improved version of
rBfc460351170478e712740ae1917a2e24803eba3b, thanks @brecht for the diff!

Manifest task: T91046
2021-09-10 11:03:54 +02:00
93d2940603 Link/Append: Fix unreported obdata being instantiated even when already used by linked/appended data.
Do not instantiate obdata when it is not actually loose.
2021-09-10 09:28:44 +02:00
284c9430f9 Cleanup: Silenced compilation warning in ghost. 2021-09-10 09:21:02 +02:00
Jon Denning
db6b3801b3 Update command line argument description for --addons
Changed doc string for Blender `--addons` command line argument
to explain what it does rather than just describing what it expects.

Reviewed By: Blendify

Ref D12445
2021-09-10 14:36:41 +10:00
82ab2c1678 XR: Re-enable SteamVR OpenGL backend for AMD gpus
Addresses T76082.

Since the DirectX backend does not work for AMD gpus
(wglDXRegisterObjectNV() fails to register the shared OpenGL-DirectX
render buffer, displaying a pink screen to the user), the original
solution was to use SteamVR's OpenGL backend, which, as tested
recently, seems to work without any issues on AMD hardware.

However, the SteamVR OpenGL backend (on Windows) was disabled in
fe492d922d since it resulted in crashes with NVIDIA gpus (and still
crashes, as tested recently), so SteamVR would always use the
AMD-incompatible DirectX backend (on Windows).

This patch restores use of the SteamVR OpenGL backend for non-NVIDIA
(AMD, etc.) gpus while maintaining the DirectX workaround for NVIDIA
gpus. In this way, issues are still resolved on the NVIDIA side but
AMD users can once again use the SteamVR runtime, which may be their
only viable option of using Blender in VR.

Reviewed By: Julian Eisel

Differential Revision: https://developer.blender.org/D12409
2021-09-10 13:19:43 +09:00
ee3b4e8420 Windows: Fix VS2022 detection
VS2019 had a compiler update moving it into the
range that was used to detect VS2022. This patch
updates the detection to the current VS2022
preview compiler version.

Reported by Jesse Y on chat.
2021-09-09 17:19:58 -06:00
c9347b9a7f UI: File Browser Options Fix
With D12436 two File Browser properties were renamed but two references
not changed in space_filebrowser.py

See D12449 for details.

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

Reviewed by Hans Goudey
2021-09-09 14:43:34 -07:00
f13eb69269 Revert "Depsgraph: release GIL when evaluating the depsgraph"
It is causing crashes in rendering, when releasing the GIL in render threads
while the main thread is holding it.

Ref T91046

This reverts commit fc46035117.
2021-09-09 19:19:18 +02:00
efcf46fb6d Fix T90317: Confusing File Browser Preferences
Preferences / File Browser section made less confusing.

See D12436 for details and comparisons.

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

Reviewed by Campbell Barton and Julian Eisel
2021-09-09 09:49:45 -07:00
84d03a1298 Fix T88755: Reuse Temp Windows by Type not Title
Reuse temporary windows when they share the same single area type, not
because they share the same title.

See D12401 for more details.

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

Reviewed by Campbell Barton
2021-09-09 09:26:44 -07:00
45c44a5b5b Fix compiler warnings about virtual functions but non-virtual destructor 2021-09-09 17:11:01 +02:00
ed4ef77f49 DNA: allow initializing defaults for deprecated struct members
This can be useful for better forward compatibility.
2021-09-09 17:11:01 +02:00
b4fd8750f9 Geometry Nodes: Allow exposing color sockets to the modifier
This commit allows connecting color sockets to the group input and
changing the input values in the modifier. Before there was an error
since this was more complicated to support with the previous IDProperty
UI data storage method.

Differential Revision: https://developer.blender.org/D12437
2021-09-09 09:43:00 -05:00
62ec88eb84 Cleanup: use NODE_SOCKET_API_ARRAY for array sockets
This prevents copying the arrays when setting new values in the sockets.

No functional changes.
2021-09-09 16:39:45 +02:00
3eb6569b38 Fix build error on Linux
07c6af4136 was missing include.
2021-09-09 23:22:48 +09:00
Ville Kivistö
07c6af4136 XR: Support for Varjo OpenXR extensions
This adds support for two Varjo specific OpenXR vendor extensions:
1) XR_VARJO_QUAD_VIEWS
2) XR_VARJO_FOVEATED_RENDERING

Together these enable human eye resolution rendering on supported
devices (currently mainly Varjo XR-3 and VR-3).

In addition, there's a detection for Varjo OpenXR runtime.

This has been tested on real Varjo XR-3 hardware and Varjo Simulator
and confirmed to function correctly. Foveation works, and the views are
rendered correctly for all the four views.

Reviewed By: Peter Kim, Julian Eisel

Differential Revision: https://developer.blender.org/D12229
2021-09-09 22:49:48 +09:00
fc46035117 Depsgraph: release GIL when evaluating the depsgraph
Evaluating the dependency graph potentially executes Python code when
evaluating drivers. In specific situations (see T91046) this could deadlock
Blender entirely. Temporarily releasing the GIL when evaluating the depsgraph
resolves this.

Calling the `BPy_BEGIN_ALLOW_THREADS` macro is relatively safe, as it's
a no-op when the current thread does not have the GIL.

Developed in collaboration with @sergey

Manifest task: T91046
2021-09-09 14:27:33 +02:00
da50cd86a7 Cleanup: clarify comment about the use of _PyThreadState_UncheckedGet()
No functional changes.
2021-09-09 14:27:33 +02:00
bf47fb40fd Geometry Nodes: fields and anonymous attributes
This implements the initial core framework for fields and anonymous
attributes (also see T91274).

The new functionality is hidden behind the "Geometry Nodes Fields"
feature flag. When enabled in the user preferences, the following
new nodes become available: `Position`, `Index`, `Normal`,
`Set Position` and `Attribute Capture`.

Socket inspection has not been updated to work with fields yet.

Besides these changes at the user level, this patch contains the
ground work for:
* building and evaluating fields at run-time (`FN_fields.hh`) and
* creating and accessing anonymous attributes on geometry
  (`BKE_anonymous_attribute.h`).

For evaluating fields we use a new so called multi-function procedure
(`FN_multi_function_procedure.hh`). It allows composing multi-functions
in arbitrary ways and supports efficient evaluation as is required by
fields. See `FN_multi_function_procedure.hh` for more details on how
this evaluation mechanism can be used.

A new `AttributeIDRef` has been added which allows handling named
and anonymous attributes in the same way in many places.

Hans and I worked on this patch together.

Differential Revision: https://developer.blender.org/D12414
2021-09-09 12:54:20 +02:00
0f6be4e152 Cleanup: Readfile: cleanup some logic checks. 2021-09-09 10:51:39 +02:00
0c0e5a8420 IDmanagement: makelocal: Fix mistake in recent commit.
rB8cc3d2d6f51f introduced option to force make_local code to either copy
or actually make a linked ID local, but logic of boolean options
handling was broken.

This commit simplifies logic here and fixes the issue.

NOTE: Since those new options were not used yet this was a harmless bug.
2021-09-09 10:51:10 +02:00
f8ead736a0 Fix FONT objects cannot use Object Font anymore
Mistake in {rB459974896228}.

To use Object Fonts, (vertex) instancing needs to be enabled.
So bring back the instancing panel and improve the instancing choice
(similar to rB6c0c766bcaa0) by just giving the 'Vertex' choice (or
'None') and explain this is only used for Object Fonts on characters.

Was reported in D11348 itself.

Differential Revision: https://developer.blender.org/D12438
2021-09-09 09:38:48 +02:00
9bb99532a5 Fix typo in BKE_object_as_kdtree
Seems like an oversight in {rB86635402d516}?

Stumbled over this while investigating another report, but this line in
its current form does not make sense (was taking  derivedFinal - not
derivedDeform - prior so I assume this has to be
BKE_object_get_evaluated_mesh now).

(it is now only used for vertex parenting where this should not be an
issue, but best keep this generic).

Differential Revision: https://developer.blender.org/D12425
2021-09-09 08:38:34 +02:00
b813648378 Fix typo checking empty gizmo keymap 2021-09-09 16:27:52 +10:00
3da09f4e29 Cleanup: remove newlines from logging text
Line endings are already added.
2021-09-09 16:26:15 +10:00
bda9e4238a Fix smooth-view failure to add mouse-move events
View operations that left the cursor over a gizmo were not being updated
because the mouse-move event was added while the view was animated
instead of once the animation had completed.
Mouse-move events were also missing when smooth-view was disabled.

This fixes a glitch with the 3D view navigation gizmo where multiple
clicks on the view aligned axis failed to switch to the opposite side
unless the user moved the cursor between clicks.
2021-09-09 15:33:44 +10:00
c8f80453d5 Modifier: add support for vertex groups
Allow blending the imported cache with the modifiers stack above the
MeshCache modifier.

This is particularly useful for instance when dealing with cloth
simulations performed in another software, where some parts of the cloth
are completely pinned (non-simulated, following the armature). Indeed,
this would allow modifying the animation in some areas without having to
rebake the other parts or the cloth, resulting in a much more flexible
workflow.

Reviewed By: #modeling, campbellbarton, mont29

Ref D9898
2021-09-09 14:05:35 +10:00
f9ebd17b4b Gizmo: warn when 2D projection fails with non-invertable matrices
Add a warning to quickly pinpoint the problem.

This would have simplified tracking down this problem in D12105.
2021-09-09 13:14:57 +10:00
df65103bf0 Fix: Incorrect default for exposed geometry nodes vectors 2021-09-08 18:44:35 -05:00
a131e3bec7 Fix GPU Buffer not allowing uint values greater than one byte
Error in format passed in `PyArg_Parse`
2021-09-08 20:28:00 -03:00
4e91cd5c11 Fix T91255: IDProperty UI as_dict() returns step as default value
Another typo in this section of code.
2021-09-08 15:46:02 -05:00
8f785524ae VSE: Adding a panning angle for multichannel audio.
The panning angle allows a more intuitive panning when the output is
surround sound. It sets the angle on the horizontal plane around the
listener. 0 degrees is to the front, negative values go to the left and
positive ones to the right. +/-180 degrees is directly from the back.

Technical detail: the panning value is linear with the panning angle
with a factor of 90 degrees. For stereo this means that -1 is left and
+1 right, since the speakers are exactly 90 degrees to either side.

Differential Revision: https://developer.blender.org/D12275
2021-09-08 21:18:08 +02:00
5bfc3a3421 Fix error running benchmark script with environment variables for builds
Ref D12434
2021-09-08 19:58:27 +02:00
6fc94d1848 Tests: updates for performance benchmarking
* Make "run" command (re-)run all tests, add "update" command to only
  run queued and outdated tests equivalent to the old "run" command.
* Support specifying environment variables for revisions, to easily
  compare multiple parameter values.
* Better sorting of revisions in graph.
2021-09-08 16:40:58 +02:00
6bc6ffc35c Fix T91241: wrong labels and identifiers for id sockets
`nodeAddSocket` expects the name and identifier in a
different order.
2021-09-08 15:57:22 +02:00
96ef184377 USD import: remove unused files.
Removed unused usd_reader_instance.cc and .h files.
2021-09-08 09:29:16 -04:00
ba5d9fa275 Cleanup: typedef enum for eImageType. 2021-09-08 10:35:16 +02:00
b5f2b81751 Cleanup: typedef enum for eImageSource. 2021-09-08 10:34:21 +02:00
60e9fb9929 Cleanup: consisten naming slot -> resolution.
Makes naming consistent with image_gpu.c
2021-09-08 10:28:45 +02:00
Jeroen Bakker
2b2d427bba Fix T90825: Performance texture painting with limited scale.
Improve texture painting/uv editing performance when limited scale is active.
Cause of the slow down is that the image editor draws the image in maximum resolution,
but the 3d viewport uses the limited scale. The variation reuses the same GPU texture
and needed to be uploaded/scaled twice to the GPU.

This patch will adds texture slots that can hold the scaled down and the maximum
resolution image. This would allow better cache hits and reuse of existing caches.

Maximum resolution textures are reused for limited scale when they fit to reduce memory
and CPU footprint.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D12388
2021-09-08 09:56:13 +02:00
Jeroen Bakker
54f5c174a8 Asset: Dropping Material assets on material slot under mouse cursor.
This patch allows dropping material assets from material slot under the mouse
cursor. Before this change the material slot had to be hand-picked from the
properties panel.

For consistency it is chosen to do this in any shading mode as the tooltip shows
what is exactly going to happen during release.

The feature also works for other object types than Meshes as it uses the drawn surface on the
GPU to detect the material slots. Performance of this patch has been tested with AMD GCN3.0
cards and are very responsive.

Reviewed By: fclem, Severin

Differential Revision: https://developer.blender.org/D12190
2021-09-08 08:47:26 +02:00
8d40d61af0 Fix T91225: Quick Favorites and shortcuts are broken for some properties
Caused by {rB3e4d720ae483}.

Before above commit, this had a different path handling and
RNA_path_from_ID_to_struct() was always used [which kind of took care of
this]. Now this is only used if ptr represents an ID itself, so we are
"loosing" part of the path.

This patch adds the path back on the member_id in
wm_context_member_from_ptr() for everthing related to space_data, so
WM_context_path_resolve_property_full() can construct a full path even
for these.

Maniphest Tasks: T91225

Differential Revision: https://developer.blender.org/D12418
2021-09-08 08:25:57 +02:00
7beb4a0e0a Fix non-exiting property in keymap
In e6a1d488ab `deselect_all` property was removed from
`sequencer.select` operator but some keymap items were missed, which was
caught by tests by buildbot.
2021-09-08 01:23:07 +02:00
1680c3d510 UI: Remove label of mode in Point Instance node
There isn't enough space for this label at the default node width, and
it was obvious what the drop-down is doing anyway.
2021-09-07 17:05:58 -05:00
e6a1d488ab Cleanup: VSE select operator
Operator combines more features and it wasn't very transparent which
properties are used in which feature and how they are used.

Features linked_time, side_of_frame and linked_handle are
isolated, logic moved into own function.

deselect_all property was removed as it practically equals to
!extend in all cases.

Functional change: Dragging existing selection will not change active
strip. Previously this could happen if click happened on strip that
wasn't active.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12320
2021-09-08 00:01:00 +02:00
4abbf6d82b Fix T90967: Snapping not working with single strip
Even if `snap_targets` `SeqCollection` is empty, there can be static
snap points defined, so don't condition snapping on non-zero target
count.

Differential Revision: https://developer.blender.org/D12400
2021-09-07 23:39:50 +02:00
Christoph Lendenfeld
adbafe3b43 Animation: Implement generic slider in graph_slider_ops
This patch implements the generic slider from
`ed_draw.c` to the `GRAPH_OT_decimate` operator
This draws a useful UI and enables precision mode and stepping
Overshoot is disabled
The status message is moved to the workspace footer

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9361
Ref: D9361
2021-09-07 20:10:53 +01:00
a392609ab6 Cleanup: Move function to versioning_common.cc 2021-09-07 13:28:14 -05:00
73ef2fc2f4 Fix T91093: off by one error in when resampling curve
The bug existed in the Curve Resample and Curve to Points node.

Differential Revision: https://developer.blender.org/D12416
2021-09-07 16:07:18 +02:00
08acbdc1ff Fix T91219: Crash canceling scale keyframes in dope sheet grease pencil
Caused by {rBb0d9e6797fb8}

Ideally `td->loc` should always be set and point to a 3d array.
2021-09-07 11:04:20 -03:00
2b4afcbb4c Fix T91236: AssetBrowser crash with certain collections
Caused by {rB5a9a16334c57}

Linking/appending an asset made from a collection containing certain
types of objects lacking bounding boxes (camera, light) would crash.

Add simple bbox check to prevent the crash.

Maniphest Tasks: T91236

Differential Revision: https://developer.blender.org/D12415
2021-09-07 13:22:04 +02:00
c2ce68a018 Fix T91238: crash when instancing geometry group input 2021-09-07 13:18:59 +02:00
8cc3d2d6f5 ID management: add options to force make local or force copy IDs when making them local.
This is to be used when calling code already knows whether the 'made
local' linked ID should be copied, or can directly be converted to a
local one.

Currently unused , this is preparation for rewrite of append code.
2021-09-07 10:18:49 +02:00
d7d8eb7de4 GPencil: Change icons missing in previous commit
It was missing to change the modifier itself, not only RNA enum list.
2021-09-06 18:56:45 +02:00
08593e46a3 Fix T91187: incorrect socket identifier 2021-09-06 18:47:06 +02:00
3b1a16833b UI: Area Split and Join Mouse Cursor Feedback
This patch just changes the mouse cursor to a "stop sign" when dragging
to an unsupported location during Join or Split operations.

See D11396 for details and examples.

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

Reviewed by Campbell Barton
2021-09-06 09:40:59 -07:00
5a9a16334c Geometry Nodes: support for geometry instancing
Previously, the Point Instance node in geometry nodes could only instance
existing objects or collections. The reason was that large parts of Blender
worked under the assumption that objects are the main unit of instancing.
Now we also want to instance geometry within an object, so a slightly larger
refactor was necessary.

This should not affect files that do not use the new kind of instances.

The main change is a redefinition of what "instanced data" is. Now, an
instances is a cow-object + object-data (the geometry). This can be nicely
seen in `struct DupliObject`. This allows the same object to generate
multiple geometries of different types which can be instanced individually.

A nice side effect of this refactor is that having multiple geometry components
is not a special case in the depsgraph object iterator anymore, because those
components are integrated with the `DupliObject` system.

Unfortunately, different systems that work with instances in Blender (e.g.
render engines and exporters) often work under the assumption that objects are
the main unit of instancing. So those have to be updated as well to be able to
handle the new instances. This patch updates Cycles, EEVEE and other viewport
engines. Exporters have not been updated yet. Some minimal (not master-ready)
changes to update the obj and alembic exporters can be found in P2336 and P2335.
Different file formats may want to handle these new instances in different ways.

For users, the only thing that changed is that the Point Instance node now
has a geometry mode.

This also fixes T88454.

Differential Revision: https://developer.blender.org/D11841
2021-09-06 18:31:25 +02:00
d9ad77fa58 GPencil: Replace temp icons for final design
New icons for LIneArt and Length modifier
2021-09-06 18:00:50 +02:00
bd79d6067c make.bat: Fix missing quotes in python detection 2021-09-06 17:58:38 +02:00
ce71357711 Fix T90414: New GPencil icons
Designed by @mendio

The new icons are:

* Dot-Dash modifier
* Length Modifier
* Line Art modifier
2021-09-06 17:35:12 +02:00
Erik Abrahamsson
5a02d0da7a Fluid: Parallelizations for Mantaflow functions (D12002)
This update includes part of a performance boost from D12002.
Contributed by @erik85
2021-09-06 17:30:30 +02:00
3e23af4c49 Fluid: Clang-format cleanups
Just cleanup.
2021-09-06 17:30:30 +02:00
a3ca973dec Nodes: fix incorrect id socket update
The issue was that the entire socket was rebuild, even though
only its `SOCK_HIDE_LABEL` flag changed. This broke e.g.
Object sockets from old files.
2021-09-06 17:21:42 +02:00
861b7071a2 Fix crash drawing hair with older GPUs.
Some GPU's have support for compute shaders, but don't support
GLSL 4.3. This resulted in compiler errors and crashes.

This issue could have been solved by supporting older GLSL languages but
that would have been a hassle to get it right. We already have a
fallback in place for GPU's that don't support compute shaders at all.
2021-09-06 15:47:44 +02:00
William Leeson
5eed7cdc8c Division by zero when there are no lights and only emissive surfaces
When rendering the test scene in T79190 which has only emissive surfaces a division by zero occurs. This is a simple patch to remove this.

Reviewed By: brecht

Maniphest Tasks: T79190

Differential Revision: https://developer.blender.org/D11682
2021-09-06 13:14:46 +02:00
e2bbb5b07e BLI: add default hash for shared_ptr and reference_wrapper
This makes it easier to use these types as keys in Map, Set and VectorSet.
2021-09-06 12:54:51 +02:00
4d0497bea4 Cleanup: format, spelling 2021-09-06 20:34:00 +10:00
4f0ec3cea5 Cleanup: use pre-calculated size variable
Oversight in a0912ff566
2021-09-06 20:32:35 +10:00
687f70ceca ImBuf: add IMB_allocFromBufferOwn that takes ownership of the buffer
Avoids duplicating the image buffer when saving thumbnails.
2021-09-06 20:05:58 +10:00
a0912ff566 Cleanup: support passing in arbitrary buffers to IMB_allocFromBuffer
Also remove IB_metadata flag from the resulting imbuf as this image
has no meta-data.
2021-09-06 20:04:25 +10:00
49f1695ed0 BLI_utildefines: add UNUSED_FUNCTION_WITH_RETURN_TYPE
Unfortunately the UNUSED_FUNCTION macro doesn't work for pointer types.

Add UNUSED_FUNCTION_WITH_RETURN_TYPE to workaround this limitation.
2021-09-06 18:58:46 +10:00
81978594a8 Fix tests broken by rB58632a7f3c0f1be6.
Commits breaking RNA API should always run all tests, and do text search
in python code base to ensure everything is updated as needed.
2021-09-06 10:56:02 +02:00
b4c9f88cbe Fix thumbnail screenshot error in 58632a7f3c
Scaling didn't clamp above zero, see T89868.
2021-09-06 17:03:45 +10:00
3e44592cb9 Cleanup: comment unused functions 2021-09-06 15:51:53 +10:00
58632a7f3c UI: Blend Preview Thumbnails Showing Workspace
This adds an option to use a capture of the entire main window as the
blend file preview thumbnail.

See D10492 for details and examples.

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

Reviewed by Campbell Barton
2021-09-05 21:05:50 -07:00
91bca410c0 Cleanup: clang-format 2021-09-05 23:25:36 -04:00
bf0ac711fd UI: Increase Size of Blend File Thumbnails
Increase effective resolution of blend preview images from 128x128 to
256x256 for versions saved in the file system thumbnail cache.

See D10491 for details and examples.

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

Reviewed by Campbell Barton
2021-09-05 19:55:50 -07:00
Aaron Carlisle
4ddad5a7ee UI: Split Output Properties Dimensions panel
I remember when we originally decided on the Dimensions panel,
one of the reasons we combined time and image size properties in the same panel,
was simply because the 2.49 and previous UIs used fixed-size panels,
so we often put two categories of properties inside a panel, using two columns.

Now that we no longer do this, we could clarify and simplify some panels
by splitting them, such as the Output > Dimensions panel

{F6753690}

Reviewed By: brecht, pablovazquez

Differential Revision: https://developer.blender.org/D4440
2021-09-05 21:27:49 -04:00
Aaron Carlisle
d10ea97053 Compositor: New Posterize Node
The posterize node limits the number of colors per channel.
This is useful to generate masks or to generate stylized images

Both the tiled and full-frame implementation are included in this patch

{F10314012}

Reviewed By: manzanilla, jbakker

Differential Revision: https://developer.blender.org/D12304
2021-09-05 15:24:35 -04:00
b7718bbdf5 Cleanup: improve code clarity
Addresses D12341 review.
2021-09-05 14:25:14 +02:00
079bd11556 Fix T91143: Gpencil Set Vertex Color not using Linear
The color was not converted to Linear from Brush color.
2021-09-04 18:28:54 +02:00
b225a7c470 Compositor: Merge equal operations
Some operations can take a lot of time to execute and
any duplication should be avoided.

This patch implements a compile step that detects
operations with the same type, inputs and parameters that
produce the same result and merge them. Now operations
can generate a hash that represents their output result. They only
need to implement `hash_output_params` and hash any parameter
that affects the output result.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12341
2021-09-04 17:09:59 +02:00
d84c79a218 Compositor: Full frame vector nodes
Adds full frame implementation to Map Range, Map Value, Normal and
Normalize nodes. The other nodes in "Vector" sub-menu are submitted
separately.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12233
2021-09-04 17:06:01 +02:00
9d7cb5c4a1 Compositor: Full frame filter nodes
Adds full frame implementation to Anti-Aliasing, Defocus, Denoise,
Despeckle, Dilate/Erode, Directional Blur, Filter, Inpaint and
Vector Blur nodes. The other nodes in "Filter" sub-menu are
submitted separately.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12219
2021-09-04 17:05:58 +02:00
9290b41381 Python: Allow Area Close via Scripting
Screen area maintenance "Close" function allowed to be scripted.

See D12307 for usage example.

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

Reviewed by Campbell Barton
2021-09-04 08:00:22 -07:00
Henrik Dick
54b72fe9ff GPencil: Fix Noise Modifier Randomize Panel disabled
Fix regression introduced in rB34b213d60472

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D12398
2021-09-04 16:03:15 +02:00
Henrik Dick
c23b6596b9 GPencil: Fix subdivision modifier disabled on strokes with 2 points
Fixes the regression introduces in rB29f3af952725 . The subdivision modifier used to work on two point strokes with simple mode but not with catmul clark. Now it will work with simple mode and in case of catmull clark mode it will still use simple mode on these strokes.

Differential Revision: https://developer.blender.org/D12397
2021-09-04 15:41:43 +02:00
Mikkel Gjoel
863d806526 BMesh: optimize edge & face group calculation
This changes the search for unprocessed faces to only search
from the previously found face. Local testing on 1.5 million
triangle meshes gives a 75x speedup
(of the code affected, which is the first half of the work).

The former code would traverse all faces of a mesh until a face was
found that had not been processed. This ended up being slow mainly
because it had to load face-data to determine the state of the flag.
Secondarily, the way it iterated and marked the mesh, it would end up
traversing all previously processed faces to find and unprocessed one.

The same optimization has been made for edge-group calculation.

Reviewed By: campbellbarton

Ref D12379
2021-09-04 23:07:45 +10:00
e6194e7357 RNA: support extracting names from paths without allocating memory
Support extracting identifiers RNA paths into fixed size buffer
since the maximum size of the identifier is known all cases.

- Add BLI_str_unescape_ex to support limiting the destination buffer.
- Add BLI_str_quoted_substr to copy values into a fixed size buffer.
2021-09-04 16:59:54 +10:00
716682365c Fix T91119: Curve to mesh node inverted face normals
Previously I thought I fixed this by reversing the face corner indices
in quads created by the curve to mesh node. But then we fixed a problem
with the transforms used in that node by inverting one of their
components, so the required direction also reversed. This commit
reverts rBcf28398471c84 and reverses the default direction of the
quadrilateral primitive so it's the same as the others.

Tests will be updated.
2021-09-03 16:49:47 -05:00
4fb7217043 UDIM: Show the UV grid even when images are loaded
Allow the UDIM grid to be shown and adjusted when there are images
loaded in UV edit mode. Right now the grid feature disappears once an
image is loaded and many have found this to be confusing.

Based on community and artist feedback, there was support to change this
behavior[1]

This patch does the following:
- Allows the grid to be shown even when images are present
- The max allowable dimensions for the grid has been increased from
10x10 to 10x100 to match the underlying maximum UDIM range that blender
supports

Note: This should not affect other Image editor modes like Paint/Mask or
the Render Result viewer etc. Future work in this area is currently
documented in a dedicated design task[2]

[1] https://devtalk.blender.org/t/the-udim-tile-grid-design-and-feedback-thread/20136
[2] https://developer.blender.org/T90913

Differential Revision: https://developer.blender.org/D11860
2021-09-03 13:03:28 -07:00
235655ee0d Improve message in ob_parbone() about the missing Parent Bone
- lower to warning (might be debatable, but this is not really
malfunctioning and e.g. constraints/modifiers dont spit out errors if
targets are not specified)
- clarify _what_ of the two actualy does not exist

ref. T91101

Maniphest Tasks: T91101

Differential Revision: https://developer.blender.org/D12389
2021-09-03 17:16:42 +02:00
a45dd52cf0 Depsgraph: skip parentbone relation if bone prop is empty
Clearing the Parent Bone field in relations would result in something
like this:

```
add_relation(Bone Parent) - Could not find op_from
(ComponentKey(OBArmature, BONE))
add_relation(Bone Parent) - Failed, but op_to (ComponentKey(OBEmpty,
TRANSFORM)) was ok
ERROR (bke.object): /source/blender/blenkernel/intern\object.c:3330
ob_parbone: Object Empty with Bone parent: bone  doesn't exist
```

Now skip creation of a depsgraph relation if the Parent Bone field is
empty (since this would be invalid anyways).

ref. T91101

Maniphest Tasks: T91101

Differential Revision: https://developer.blender.org/D12389
2021-09-03 17:15:05 +02:00
Leon Leno
ac97893dfc Fix T88411: Draw frame node text when label is empty
This patch fixes the issue described in T88411, that the text in frame nodes is only shown, when the node has a label. This has been caused by rB8f04ddbbc626, because `node_draw_frame_label` not only draws the label, but also all the other text. Therefore skipping it, when the label is empty, also skips drawing the other text.
This is fixed by moving the check for the empty label into `node_frame_draw_label`.

**Patch:** Frame nodes show text despite not having a label.
{F10286204, size = full}

**Same setup in master:**
{F10128099, size = full}

**Test file**
{F10128102}

Reviewed By: #user_interface, pablovazquez

Maniphest Tasks: T88411

Differential Revision: https://developer.blender.org/D11315
2021-09-03 16:18:40 +02:00
ae334532cf GPencil: Smooth thickness when joining strokes
When joining two strokes in paint mode using the auto merge option, the join was very hard if the thickness was too different.

This patch adds a smooth to the join in order to get better transition.

Also fixed the problem to join existing strokes very far from actual stroke.

Some cleanup and rename of old code is included in order to make code more readable.

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D12362
2021-09-03 15:24:13 +02:00
f9ccd26b03 Fix T87768: .path_resolve fails when requested property is None.
Add a version of RNA_path_resolve_full that returns true
when the path resolves to a NULL RNA pointer.
2021-09-03 21:58:52 +10:00
0950cfd9d5 PyAPI: add read-only 'is_valid' attribute to mathutils types
There was no convenient way to check if the owner
of a mathutils type was valid.

Added to support issue reported in T91111.
2021-09-03 21:21:44 +10:00
f530b43550 Fix T91159: GPencil Smooth brush is using Affect Pressure but not used
The parameter wa sin the UI but was not used because it was replaced by Use Thickness.
2021-09-03 12:42:18 +02:00
d97fd305a0 RNA: minor optimize for token extraction of RNA paths
- Split rna_path_token in two,
  extracting bracket handling into it's own function.

- Only handle escape characters for quoted tokens.
  Numbers were copied using BLI_str_unescape which is unnecessary.

- Extract text without without quotes,
  use a return argument so the caller can tell if the token was quoted.
  This avoids having to strip the tokens quotes afterwards.
2021-09-03 20:35:46 +10:00
671640b4c7 Cleanup: use bool for RNA path token extraction 2021-09-03 19:42:54 +10:00
Rajesh Advani
684500837d Cleanup: convert function nodes socket list to use new API
The new API was introduced in rB1e69a25043120cc8dddc3f58622eb50e1443def1.

Differential Revision: https://developer.blender.org/D12380
2021-09-03 10:45:48 +02:00
4a3243f311 Docs: add note to skip_fcurve_selected_data sequence strip check
Without an explanation the sequencer logic looked wrong since
other selection checks don't skip data that can't be found.
2021-09-03 15:15:45 +10:00
6fc92b296f GPencil: Change default Scale Thickness to True in 2D template
This parameter is more logic as true because is better scale thickness when the size of the stroke changes.

Reviewed by: @mendio @pepeland
2021-09-02 16:26:13 +02:00
8849bed671 Revert "PyAPI: GPU Shader: add 'state' parameter to uniform sampler"
This reverts commit 2aad8fc7bc.

It was a commit without proper review.

A better API needs to be discussed.
2021-09-02 10:19:58 -03:00
546314fc96 Build utils: make_update: Add option to choose SVN branch.
Needed for studio sprite-fright frozen branch.

Also do not overwrite branch for git sub-modules when it is defined, and
fallback to `master` branch in case specified branch is not found in a
specific sub-repository.
2021-09-02 14:56:46 +02:00
799a2b07ad Fix possible missing render result with update_result
Need to ensure render result's pixels are allocated prior to merge.

Differential Revision: https://developer.blender.org/D12371
2021-09-02 09:28:42 +02:00
a8739ae6c2 Fix regression in recent change 0708733c46
Adding a mirror modifier in edit-mode crashed.

Freeing meshes that hold a shallow copy happens in multiple places
while calculating modifiers, making it impractical to clear the
edit-mode pointer before freeing the mesh (as done in
BKE_editmesh_free_derived_caches).

Add a struct member to the edit-mesh struct so evaluated copies
don't free the edit-mesh contents.
2021-09-02 16:12:24 +10:00
a2f3aca647 Cleanup: remove redundant edit-mesh memory allocation
This memory was only duplicated to satisfy mesh_data_free
which was incorrectly freeing the pointer (but nothing else).
2021-09-02 15:30:54 +10:00
19e1b5c1fd Fix T90972: Crash calling Mesh.clear_geometry in edit-mode
No longer free the edit-mesh pointer while in edit-mode since this
isn't reliable to keep the object in edit-mode while freeing it's
edit-mesh data.

Users who want to exit edit-mode should do so explicitly.

Caused by 6d2f9b1dfa.
2021-09-02 15:30:54 +10:00
0708733c46 Fix T91123: Freeing meshes in edit-mode leaks memory
Freeing the edit-mesh pointer wasn't free the edit-mesh data it's self.

Unlinking from the outliner or through the Python API leaked memory.

This didn't often cause leaks in practice since ED_editors_exit
exits edit-mode for all objects.

Now freeing mesh data frees the edit-mode data as well,
this matches the behavior of other object types that support edit-mode.
2021-09-02 15:30:54 +10:00
809b33b69a Docs: improve the error when undo poll fails
Calling undo in from Python background-mode would raise an exception
without any information about how to initialize undo.
2021-09-02 15:30:54 +10:00
Johnny Matthews
0ccbf50694 Cleanup: Convert geometry nodes socket list to use new API
The new API introduced in rB1e69a25043120c provides a shorted, more
flexibly way to declare node socket inputs and outputs. This commit
updates all geometry nodes to use the `NodeSocketBuilder` API, except
the four nodes that need `SOCK_HIDE_VALUE` or `SOCK_MULTI_INPUT`.

Differential Revisions: D12377, D12376, D12374, D12373, D12372
2021-09-01 22:53:52 -05:00
4170668776 Cleanup: Grammar 2021-09-01 22:22:35 -05:00
f77de678d8 EditMesh: recalculate normals after running rip
Failure to calculate normals caused an assertion since face
tessellation was being calculated with invalid normals.

In practice the rip-drag action would recalculate normals anyway,
however mesh tessellation should always be performed with valid normals.
2021-09-02 11:45:55 +10:00
011d3a95e0 Cleanup: de-duplicate logic in bpy keyframing logic 2021-09-02 11:41:01 +10:00
6c177838f3 Cleanup: remove redundant alloc argument to SEQ_editing_get
Callers that require lazy initialization can use SEQ_editing_ensure.
2021-09-02 11:29:32 +10:00
baee000001 Fix T90798: calc_loop_triangles is not updated after joining objects 2021-09-02 11:08:38 +10:00
f8dd0d0dba Cleanup: spelling in comments 2021-09-02 11:08:38 +10:00
42546db490 Fix T91054: Editing group custom property gives error
This commit fixes the custom property edit operator for the the case of
editing group properties. Currently this isn't supported very well, the
data is converted to a string, but the operator shouldn't fail anyway.

This allows editing properties created like this:
C.object['abuse'] = {'parent' : ['child1', 'child2']}

These changes reflect some issues with the design of the operator.
Requiring guessing the type of the data does not work well at all, and
makes code more complicated. In the future this operator can be updated
to use a type drop-down.

Differential Revision: https://developer.blender.org/D12364
2021-09-01 11:47:59 -05:00
99c981fd06 Cleanup: Remove redundant property UI data clear
Since the UI data is now stored in the property, and the property is
deleted on the next line, this doesn't need to be called separately.
2021-09-01 11:46:21 -05:00
083a8921ec Fix strict warning about discarding const qualifier
Solved by using const qualifier for arguments which aren't mutable
in PyC functions.

Differential Revision: https://developer.blender.org/D12369
2021-09-01 17:00:08 +02:00
f62eb8ac16 BPY-Docs: Add missing file context members documentation
Context members of the file space would not be shown in the context API
docs.
2021-09-01 16:28:44 +02:00
2aad8fc7bc PyAPI: GPU Shader: add 'state' parameter to uniform sampler
Now you can choose the state of texture (as a filter and repetition) to
render it.

This is important as the original state is very limited.
2021-09-01 10:39:14 -03:00
7ec839adfa File Browser/BPY: Expose list of selected files in context
Since recently it's possible to query the active file (as object, not
just the name), but it's quite useful for scripting to have access to
all selected files.
This introduces `bpy.context.selected_files`, returning a list of file
objects representing files in the File Browser.
2021-09-01 15:13:18 +02:00
79281336c0 File Browser/BPY: Expose relative path of a file via BPY
There were requests to be able to track the file selection in the File
Browser. Just using the file name for that wouldn't if the file browser
has the recursive display enabled. File names could be duplicated then.
So expose the entire path relative to the currently displayed directory.
2021-09-01 15:12:50 +02:00
8355e3fc77 Unittest: Extend and basic linking tests and add basic append tests.
We could check many more things still, but this should already cover
most basic common cases.
2021-09-01 12:51:07 +02:00
e04631f44a Cleanup: clang-tidy utfconv 2021-09-01 17:13:33 +10:00
93c6b12df5 Cleanup: use doxygen sections in py_capi_rna.c 2021-09-01 17:00:47 +10:00
0c5f6f9fa7 Cleanup: Better names for eDRWColorManagement.
Names describe better what will be applied. Previous names were
extracted from the original code, that weren't accurately named.
2021-09-01 08:58:06 +02:00
18a4e5d561 Cleanup: Use nullptr. 2021-09-01 08:54:18 +02:00
89fa9aada5 Cleanup: use "pyrna_enum_*" prefix for RNA utility functions 2021-09-01 16:50:48 +10:00
1730829592 Cleanup: move RNA utility functions into a generic module
Avoid having to include bpy_rna.h for enum utility functions,
recently added to idprop_py_ui_api.c.
2021-09-01 16:33:42 +10:00
5352b33598 BLI_string: return string length from BLI_string_flip_side_name
Useful for callers that need the string length.
2021-09-01 15:24:01 +10:00
2914ec571e Fix errors pasting flipped names in the action editor
Use BLI_str_quoted_substr_range instead of in-line
quote extraction to resolve:

- Bone names containing quotes caused flip to fail.
- Missing NULL check if a matching quote could not be found.
2021-09-01 15:23:59 +10:00
f1cdd49a4e BLI_string: add BLI_str_quoted_substr_range
This is a similar funciton to BLI_str_quoted_substrN
that extracts the range of the quoted string
instead of allocating a new string un-escaped string.
2021-09-01 15:23:58 +10:00
90dac47717 Cleanup: remove redundant strstr calls
Rely on BLI_str_quoted_substrN to detect if the prefix exists since
this function exists early there is no need to check before calling.
2021-09-01 15:23:56 +10:00
838b6ec48a Fix: Incorrect versioning for float IDProperty UI data
The code put the value from the "min" property into the "max"
value. This would have crashed if min was null and max wasn't.
2021-08-31 12:17:05 -05:00
60fba8202c Fix T91088: Assigning custom property value in python resets UI data
Assigning a new value to an IDProperty with the Python API would free
the entire contents of the existing property, which unfortunately
happened to include the UI data. The fix is to extract the UI data from
the existing property before freeing its contents. An alternative
would be adding another argument to `IDP_FreePropertyContent_ex`, but
this solution is clearer and doesn't increase complexity elsewhere.
2021-08-31 11:49:12 -05:00
cfc674408e Fix T91084: Missing versioning for object pose bone property UI data
Objects also have a list of "bone" pose channels embedded directly.
These properties are user visible, so their UI data should be versioned.
2021-08-31 11:12:07 -05:00
596f1878b6 Cleanup: Reduce variable scope 2021-08-31 10:19:31 -05:00
37943b00f2 Fix: Output int for precision in UI data as_dict method
This is stored internally and used as an integer, so there is no need
to convert it to a float for "as_dict". This was just an oversight.
2021-08-31 09:05:03 -05:00
99b1e8428d Cleanup: pass value by ref in draw_color_management 2021-08-31 15:45:05 +02:00
b18122451f Fix T88433: no greaspencil depsgraph evaluation with certain drivers
When the same stroke was used as a driver variable, this could make this
stroke already tagged as built in the course of building driver
variables (via `build_gpencil`), but then important stuff from
`build_object_data_geometry_datablock` could be missed later on (because
both of these funtions use `checkIsBuiltAndTag`). Most importantly,
setting up operations such as GEOMETRY_EVAL would be skipped entirely.

`build_object_data_geometry_datablock` seems to cover greasepencil just
fine (does the same as `build_gpencil` and more). Proposed solution is to
remove `build_gpencil` entirely. In `build_id` it would then also call
`build_object_data_geometry_datablock` for `ID_GD` IDs. Now the covered
types that _call_ `build_object_data_geometry_datablock` match exactly
to what is covered _inside_ `build_object_data_geometry_datablock`.

Think this "duplication" of functionality was just overseen in
rB66da2f537ae8 [`build_gpencil` existed long before and said commit made
greasepencil a real object with geometry and such].

thx @JacquesLucke for additional input!

Maniphest Tasks: T88433

Differential Revision: https://developer.blender.org/D12324
2021-08-31 15:20:02 +02:00
84f826ff23 Fix T90989: Annotation opacity must not be animatable
All props of annotations are not animatable by design and opacity must be equal.

As the opacity is reused by gpencil objects, a new prop has been created in order to use different props for annotations and GP objects.
2021-08-31 14:59:55 +02:00
1be598ba68 Cleanup: DRW color management seperated in multiple functions. 2021-08-31 14:12:14 +02:00
6931a6f3bd Cleanup: Moved DRW_vieport_colormanagement_set to draw_color_management. 2021-08-31 13:26:13 +02:00
63dc286b01 Cleanup: Added const keywork to GPU_viewport_colorspace_set. 2021-08-31 13:24:42 +02:00
a18d88213f Cleanup: Converted draw_color_management to CPP. 2021-08-31 13:24:42 +02:00
3abf56db27 Cleanup: Draw Manager remove do_color_management from drawing context.
The do_color_management option was set, but never read.
2021-08-31 13:24:42 +02:00
9ab31b53b7 Cleanup: Remove unused DRW_state_do_color_management.
Function wasn't used since we migrated to the new color management
pipeline. It is also not expected it would be needed in the current
design.
2021-08-31 13:24:42 +02:00
a7ee49d065 Fix crash in recent commit.
Crash introduced by {rB8e00db42961297facd521139762fe8c42042fc5c}, fixed
with a null check. Object can be null.
2021-08-31 13:14:26 +02:00
b0cb0a7854 Texture Paint: sync changing active texture in the Node Editor to the
Image Editor

When changing to another texture paint slot, the texture displayed in
the viewport changes accordingly (as well as the image displayed
in the Image Editor).

When changing the active texture in the Node Editor though, only the
texture displayed in the viewport changes.

This was mentioned in T88788 and I am not 100% sure this is desired in
all scenarios (or at all), it should be seen in tandem of D11497. This
change makes it so that the Image Editor changes to the image we changed
to in the Node Editor (keeping them in sync).

If this is not desired in all cases, this could be made an option.

ref T88788
ref D11496
ref D11497

Maniphest Tasks: T88788

Differential Revision: https://developer.blender.org/D11498
2021-08-31 12:45:39 +02:00
3b2a01edf6 Texture Paint: sync changing active texture in the node editor to the
active paint slot

When changing to another texture paint slot, the texture displayed in
the viewport changes accordingly (as well as the image displayed
in the Image Editor).

When changing the active texture in the Node Editor though, only the
texture displayed in the viewport changes.

This _can_ be confusing because you can end up painting on a texture
that you are not looking at in the viewport (so you dont have any
feedback whatsoever). Not 100% sure this is desired in all scenarios,
but this change makes it so that the active paint slot changes to the
one that uses the texture we chaged to in the Node Editor (keeping them
in sync).

If this is not desired in all cases, this could be made an option.

ref T88788
ref D11496

Maniphest Tasks: T88788

Differential Revision: https://developer.blender.org/D11497
2021-08-31 12:29:14 +02:00
d8b445e728 Fix missing render result when using region render
Caused by lazy allocation of passes.
2021-08-31 12:12:34 +02:00
af7233368d Fix T91060: GPencil Time Offset Modifier breaks evaluation time
Caused by {rBf3bf87e5887c}.

When using a GPencil Time Offset Modifier, the bGPDlayer>actframe can be
NULL. This can be determined though, but above optimization commit
skipped getting the active frame in this case entirely (with the
intention to only get it if framenumbers did not match).

Now also call BKE_gpencil_layer_frame_get() if actframe is NULL in order
to fetch a valid one if present.

Maniphest Tasks: T91060

Differential Revision: https://developer.blender.org/D12355
2021-08-31 11:55:16 +02:00
f6d133e2d2 Fix possible wrongly highlighted tiles
Run into it when was re-working tiles in the Cycles X project.
Make sure the storage of highlighted tiles is emptied when the
render is finished or cancelled).

The error is only possible to happen if the engine did not do
something correct, but is still good to deal with such situations
more gracefully.
2021-08-31 11:05:57 +02:00
f4eacad48f Fix AssetBrowser UI errors
Steps to reproduce:
- enable Extended Asset Browser
- open a regular File Browser

gives:
"rna_uiItemR: property not found: FileSelectParams.asset_category"

Now do proper poll.

Differential Revision: https://developer.blender.org/D12350
2021-08-31 10:41:12 +02:00
1f0d63b9a1 Cleanup: remove unnecessary obedit argument from ED_space_image_set
This was left over from when changing the image set the faces texture.
2021-08-31 18:29:09 +10:00
8e00db4296 Fix: Weightpaint overlay not visible when display type wire/boundbox.
When the object display type was set to wireframe or boundbox the depth
buffer wasn't updated resulting in not visible weightpaint overlay.

Thanks to Demeter Dzadik for mentioning it.
2021-08-31 10:02:45 +02:00
fa4a35d4c4 Measure tool: Add support to restrict dimension to one axis
Support axis constraints for the measure tool.

Press X, Y or Z to restrict the dimension to that axis,
it's also possible to toggle between orientations matching transform.

Reviewed By: campbellbarton

Ref D10872
2021-08-31 17:21:11 +10:00
fa4f9292e1 Transform: avoid passing the context to extended orientation functions
This makes it possible to calculate orientation from functions
that don't have the context.
2021-08-31 17:02:47 +10:00
d718d6b449 Cleanup: Use C style comments for descriptive text 2021-08-31 14:33:57 +10:00
29590eec6e Fix T91054: List of strings custom property cannot be edited
This commit fixes editing the value of a list of strings custom property
with the "Custom Property Edit" operator. This sort of custom property
isn't very well supported in general, but editing the values should
work properly anyway.

Differential Revision: https://developer.blender.org/D12348
2021-08-30 22:21:11 -05:00
c758b87c5e Cleanup: add CTX_data_pointer_set_ptr & CTX_data_list_add_ptr
Many callers expanded a PointerRNA argument,
so add a version of these functions that takes a PointerRNA.
2021-08-31 13:00:31 +10:00
ea575744b8 Fix assigning shortcuts that include array indices
Assigning a shortcut to bone layers for example,
raised a Python exception when used.
2021-08-31 12:30:45 +10:00
63a5f723d6 Fix T90723: User menus & shortcuts fails for sequences, bones & NLA
Use context members instead of not working well or failing due to:

- Missing "path" functions (in the case of edit-bones).

- Paths containing names (in the case of sequence-strips or pose-bones).

  While technically correct it's not useful for shortcuts or
  menu items to lookup data by name.
2021-08-31 12:07:33 +10:00
3e4d720ae4 Fix logical error resolving RNA paths
Only append RNA_path_from_ID_to_struct to context attributes if those
paths resolve to ID types.

Also simplify creating RNA paths by adding utility functions:

- WM_context_path_resolve_property_full
- WM_context_path_resolve_full

Part of fix for T90723.
2021-08-31 12:06:47 +10:00
aabe6e3b45 Context: add "active_nla_track" & "active_nla_strip" context members
Selection was already accessible but not active.

Add utility functions:

- ANIM_nla_context_track to access the active track,
  following the convention of ANIM_nla_context_strip.

- ANIM_nla_context_*_ptr versions of these functions,
  needed to for creating context members to access the ID pointer.

Part of fix for T90723.
2021-08-31 12:06:47 +10:00
65739ded54 Fix 'WM_window_find_under_cursor'
This function was not working if the window is partially out of screen space.
2021-08-30 22:46:10 -03:00
b08ab49cce Fix T90988: Incorrect speed effect strip math
Math implemented in 929d7597b3 was incorrect, but also inconsistent
with previous behavior.

`SEQ_SPEED_STRETCH` should change length only when right handle is
moved. This is now documented in code.
2021-08-31 03:12:00 +02:00
bd67bf4d10 Fix VSE move_to_meta function moving meta strip
API function `move_to_meta` should move strips without changing context
data like `MetaStack` that tells UI which meta strip should be
displayed and operated upon.

`SEQ_time_update_sequence` relied on `MetaStack` to update meta strip
content length. Instead of changing function `SEQ_time_update_sequence`,
use function `SEQ_time_update_meta_strip_range` directly. This is
because caller would have to be aware of parent meta strip that needs
update anyway.
2021-08-31 00:27:19 +02:00
1541fbb4a0 PyDoc: Fix compliation warning 2021-08-30 18:26:07 -04:00
d374ff5b8f PyDoc: Fix compilation after recent contex_member addition
Fixes missing change needed for rB0a8f53a7b847d9c8bdcefc025de70fd2608012b7
2021-08-30 18:17:11 -04:00
fbcb9c5e3f Cleanup: sequencer operators
- Use name 'strip' instead of 's'
- Assign a variable to 'scene' instead of accessing from context.
- Avoid temporary variable for swapping values.
2021-08-31 07:39:03 +10:00
c84d1ad3db Cleanup: use new active_sequence_strip context attribute 2021-08-31 07:27:55 +10:00
0a8f53a7b8 Context: add "active_sequence_strip" context member
This is an alternative to context.scene.sequence_editor.active_strip
which could be verbose, especially with additional None checks.

Part of fix for T90723, extracted from D12297.
2021-08-31 07:13:31 +10:00
b7cb7b78a8 Docs: GPU Shader: improvements
Changes:
- line break
- enum highlighting
- better description
2021-08-30 17:12:31 -03:00
af3f744b41 Fix: add virtual destructor to base class 2021-08-30 18:26:55 +02:00
171c3bd2b0 Cleanup: clang-tidy
readability-named-parameter
2021-08-30 17:30:04 +02:00
1e69a25043 Nodes: add more flexible method to declare sockets of a node
Previously, built-in nodes had to implement "socket templates"
(`bNodeSocketTemplate`) to tell Blender which sockets they have.
It was nice that this was declarative, but this approach was way
too rigid and was cumbersome to use in many cases.

This commit starts to move us away from this rigid structure
by letting nodes implement a function that declares the sockets
the node has. Right now this is used as a direct replacement
of the "socket template" approach to keep the refactor smaller.
It's just a bit easier to read and write.

In the future we want to support more complex features like
dynamic numbers of sockets and type inferencing. Those features
will be easier to build on this new approach.

This new approach can live side by side with `bNodeSocketTemplate`
for a while. That makes it easier to update nodes one by one.

Note: In `bNodeSocketTemplate` socket identifiers were made
unique automatically. In this new approach, one has to specify
unique identifiers manually (unless the name is unique already).

Differential Revision: https://developer.blender.org/D12335
2021-08-30 17:23:05 +02:00
e8684eff30 Fix T91056: GPencil merge layers doesn't preseve Keyframe type.
Now if the frame does not exist in destination layer, the frame type of merge layer is used. 

For existing frames in destination layer, the existing type is not changed.
2021-08-30 17:04:02 +02:00
Henrik Dick
e76f04c870 Fix T90742: Gpencil ghost point on selection
Reviewed By: fclem, filedescriptor

Maniphest Tasks: T90742

Differential Revision: https://developer.blender.org/D12259
2021-08-30 15:17:14 +02:00
9ad56627cf Docs: retitle 'GPU Shader Module' to 'GPU Module'
We already have a module for GPU Shader (`gpu.shader`).

So, remove the name "Shader" from the title to avoid confusion.
2021-08-30 09:21:38 -03:00
Erik Abrahamsson
a71d2b2601 Geometry Nodes: Curve Fill Node
This node takes a curve geometry input and creates a filled mesh at Z=0
using a constrained Delaunay triangulation algorithm. Because of the
choice of algorithm, the results should be higher quality than the
filling for 2D curve objects.

This commit adds an initial fairly simple version of the node, but more
features may be added in the future, like transferring attributes when
necessary, or an index attribute input to break up the calculations
into smaller chunks to improve performance.

Differential Revision: https://developer.blender.org/D11846
2021-08-29 23:27:35 -05:00
41eb33794c Cleanup: Add comment about suspicious O(n^3) loop 2021-08-29 22:12:53 -05:00
Rajesh Advani
b44406f963 Geometry Nodes: Enhance the cube mesh primitive as a cuboid
This mesh primitive enhances the Cube mesh primitive and allows the
creation of a cuboid with a configurable size and number of vertices
in all 3 directions. The Cube primitive is now similar to the Grid
primitive except that it works in 3 dimensions.

Previously it was possible to create a cube and scale it arbitrarily
along each axis. You could also subdivide the mesh, but the number of
subdivisions was equal along all axes. This meant that making the basic
frame for something like modular buildings wasn't trivial.

Inspired by tutorials and files for modular building creation.

The cuboid is created as a `Mesh` so that large meshes with millions of
faces are created quickly. Though edge calculation could be faster if
implemented here, edges are calculated using `BKE_mesh_calc_edges`
to reduce complexity, and in hopes that they may be calculated lazily
for `Mesh` in the future like vertex normals.

See the differential revision for more information.

Differential Revision: https://developer.blender.org/D11810
2021-08-29 22:08:57 -05:00
Mattias Fredriksson
b42354672e Geometry Nodes: Allow for one vertex in grid node
This commit allows setting the number of vertices in either direction
to 1, so that the primitive grid node will create a line instead of a
grid. To avoid confusion the soft limits of the input sockets are not
changed, so this is purely an increase in flexibility for when it is
helpful.

Differential Revision: https://developer.blender.org/D11772
2021-08-29 16:39:42 -05:00
Mattias Fredriksson
084180874c Fix: Circle mesh primitive outer edges do not render
The outer edges created om the circle mesh primitive node
weren't marked with the flags that makes them show in wireframe
mode.

Differential Revision: https://developer.blender.org/D12152
2021-08-29 16:30:17 -05:00
2f7258d618 Fix BLI_strncpy_wchar_from_utf8 result on Windows
This function was documented to return the length but returned an
error value for WIN32. While this doesn't cause any bugs at the moment,
it could cause problems in the future.

Oversight in 5496d8cd36.
2021-08-29 12:11:09 +10:00
4256eeeec4 UI: Timecodes: Rename "No TC in use" to "None"
Differential Revision: https://developer.blender.org/D12296
2021-08-28 16:38:08 -04:00
457302b67b BLI_string_utf8: add buffer size arg to BLI_str_utf8_from_unicode
Besides helping to avoid buffer overflow errors this reduces complexity
of BLI_str_utf32_as_utf8 which needed a special loop for the last 6
characters to avoid writing past the buffer bounds.

Also add BLI_str_utf8_from_unicode_len which only returns the length.
2021-08-28 22:50:52 +10:00
079791dc30 Fix error scaling thumbnails to zero dimensions
Follow up to fix for T89868.
2021-08-28 21:33:06 +10:00
0b6be26126 BLF: remove checks for blend file relative paths
This was added in b24712a9ca
but is no longer needed as of efc129bc82.

Further, this wasn't reliable as it could fail on linked library data
which has a different base directory.

Assert when blend file relative paths are passed to BLF
(matching imbuf file loading).
2021-08-28 19:21:54 +10:00
eae4e22518 Cleanup: Remove redundant null check 2021-08-27 14:33:06 -05:00
276a862ebc Fix failing alembic test after IDProperty UI data refactor
The default float IDProperty min value rB8b9a3b94fc148d19 for when there
is no UI data was FLT_MIN instead of -FLT_MAX, which meant that animated
custom property values couldn't be less than zero unless they had their
UI data values edited previously.

That's a mistake I won't make again! Also change the int minimums from
-INT_MAX to INT_MIN to sanitize the whole situation.
2021-08-27 14:31:19 -05:00
400605c3a6 UI: Reduce Node Contents Jiggling When Moved
This patch just clamps and rounds node contents and socket locations
so they don't appear to jiggle around when you move them. This issue
happens because node sizing and positioning are in floats while text
content must be pixel-aligned.

See D11684 for more details and comparisons.

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

Reviewed by Julian Eisel
2021-08-27 11:25:30 -07:00
071007e0ef UI: Fix summary overlay wrong range and overlap in Dopesheet
The overlay was drawn twice on top of each other making it hard to see,
hard to theme, and making it more prominent in the wrong areas (before
frame 0, not even start frame). The comment in the code was also wrong
since it said "frame one" but it was 0.

Checked with the Animation module team that it's better to use start/end
frame range instead of frame 0.

There is a TODO note to de-duplicate this section eventually so I left it there.
This fix is currently done for Grease Pencil and Mask modes, but it should
also be fixed for the regular Dopesheet mode (in line 244 if anyone wants to do it).
2021-08-27 19:49:08 +02:00
8b9a3b94fc Refactor IDProperty UI data storage
The storage of IDProperty UI data (min, max, default value, etc) is
quite complicated. For every property, retrieving a single one of these
values involves three string lookups. First for the "_RNA_UI" group
property, then another for a group with the property's name, then for
the data value name. Not only is this inefficient, it's hard to reason
about, unintuitive, and not at all self-explanatory.

This commit replaces that system with a UI data struct directly in the
IDProperty. If it's not used, the only cost is of a NULL pointer. Beyond
storing the description, name, and RNA subtype, derived structs are used
to store type specific UI data like min and max.

Note that this means that addons using (abusing) the `_RNA_UI` custom
property will have to be changed. A few places in the addons repository
will be changed after this commit with D9919.

**Before**
Before, first the _RNA_UI subgroup is retrieved the _RNA_UI group,
then the subgroup for the original property, then specific UI data
is accessed like any other IDProperty.
```
prop = rna_idprop_ui_prop_get(idproperties_owner, "prop_name", create=True)
prop["min"] = 1.0
```

**After**
After, the `id_properties_ui` function for RNA structs returns a python
object specifically for managing an IDProperty's UI data.
```
ui_data = idproperties_owner.id_properties_ui("prop_name")
ui_data.update(min=1.0)
```
In addition to `update`, there are now other functions:
 - `as_dict`: Returns a dictionary of the property's UI data.
 - `clear`: Removes the property's UI data.
 - `update_from`: Copy UI data between properties,
   even if they have different owners.

Differential Revision: https://developer.blender.org/D9697
2021-08-27 08:27:24 -05:00
3f5e0f7d91 Fix crash sampling render result before any pixel was rendered
Caused by recent lazy render result passes allocation change.
2021-08-27 15:07:26 +02:00
57e8714b38 Fix shadowing in sequencer iterator
The __LINE__ was not properly expanded.
2021-08-27 14:44:12 +02:00
c88ba461cf Fix "toggle shading" op not updating VR view
Reason was that the notifier did not set the NS_VIEW3D_SHADING
subtype, which the VR view listens for for a shading update.

In the case of "toggle xray", a notifier was absent altogether.
2021-08-27 20:05:34 +09:00
59cd9c6da6 VSE: Transform overwrite mode
Add mode to overwrite strips on overlap instead of resolving overlap.

When overlap is created, 3 things can happen:
 - On partial overlap, handles of overlapped strip are moved
 - On complete overlap with smaller strip, overlapped strip is split
 - On complete overlap with larger strip, overlapped strip is removed

This mode can be enabled in header.

Reviewed By: fsiddi, mano-wii

Differential Revision: https://developer.blender.org/D11805
2021-08-27 12:59:46 +02:00
7f7370fa26 Cleanup: quiet maybe-used-uninitialized warning 2021-08-27 11:58:40 +02:00
6845aad1a2 Fix T90907: RNA pointers for material slots are not unique across IDs
Caused by {rB1a81d268a19f}.

This caused e.g. ALT-clicking the 'Link' button to not propagate to
other selected objects (same as the 'Copy To Selected' context menu
entry).

If these are not unique across IDs, checks in ui_selectcontext_begin()
or copy_to_selected_button() could fail.

Now offset by ID pointer.

thx @JacquesLucke for clarification on the POINTER_* macros (and why
not to use them)!

Maniphest Tasks: T90907

Differential Revision: https://developer.blender.org/D12321
2021-08-27 11:02:58 +02:00
7dba879829 Fix XR action map index initialization
This reverts 151eed752b. Originally thought it was necessary to
initialize selected/active indices to -1 to prevent out-of-bounds
list access, but this is not needed since null checks are already
performed after obtaining list members via BLI_findlink().

In addition, leaving indices zero-initialized facilitates use of the
Python API, for example when displaying action map information in a
UI list.
2021-08-27 17:16:35 +09:00
7652ee43ec Cleanup: clang-tidy 2021-08-27 17:29:05 +10:00
89dae554f9 Cleanup: utf8 stepping functions
Various changes to reduce risk of out of bounds errors in utf8 seeking.

- Remove BLI_str_prev_char_utf8
  This function could potentially scan past the beginning of a string.
  Use BLI_str_find_prev_char_utf8 instead which takes a limiting
  string start argument.

- Swap arguments for BLI_str_find_prev_char_utf8 so the stepping
  argument is first and the limiting argument is last.
  This matches BLI_str_find_next_char_utf8.

- Change behavior of these functions to return it the start or end
  pointers instead of NULL, which complicated use of these functions
  to calculate offsets.

  Callers that need to check if the limits were reached can compare
  the return value with the start/end pointers.

- Return 'const char *' from these functions
  so they don't remove const from the input arguments.
2021-08-27 17:02:53 +10:00
523bc981cf Fix loading packed fonts for sequencer strips 2021-08-27 13:11:36 +10:00
61f9274d07 Cleanup: use early return 2021-08-27 13:05:12 +10:00
efc129bc82 Fix sequencer font loading using an unexpected path
Reuse the existing font loading function which handles this case.
2021-08-27 13:01:19 +10:00
Henrik Dick
20ef771374 Modifier: smooth interpolation support
Add an option to the mask modifier to use the vertex weights to generate
smooth in between geometry, instead of just deleting non complete faces.

This can be used to make all sorts of smooth dissolve animations
directly with geometry, which are usually hacked together with shaders.
It also allows for implicit function plotting using geometry nodes and
boolean like operations on non manifold geometry with the proximity
modifier.

Reviewed By: campbellbarton

Ref D10979
2021-08-27 11:48:18 +10:00
8949eab27e Cleanup: warnings 2021-08-27 11:47:56 +10:00
2b64b4d90d Fix T90973: GPencil - Add buttons to move up and down vertex groups
These buttons were in Meshes but not for Grease Pencil. This patch add them in order to keep consistency.

Reviewed By: HooglyBoogly

Maniphest Tasks: T90973

Differential Revision: https://developer.blender.org/D12328
2021-08-26 22:00:24 +02:00
e5ed9991ea UI: Consistent Area Move Snapping Locations
Change Area Move snapping locations to even 12ths, rather than current
eights and thirds, so snap distances are consistent sizes. Also adds
snapping at minimum and maximum locations.

see D11938 for details and illustrations.

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

Reviewed by Hans Goudey
2021-08-26 10:52:18 -07:00
Germano Cavalcante
8e5b7ac6e2 Fix error in last commmit 2021-08-26 14:21:45 -03:00
583f694826 Fix T90817: Object Picker Doesn't Work on Second window
Solution similar to the one seen in {rBb94ab93dfb82}.

The idea is to find the window and region under the cursor to use in the
operator.

Reviewed By: brecht

Maniphest Tasks: T90817

Differential Revision: https://developer.blender.org/D12310
2021-08-26 14:13:19 -03:00
aadbdb8048 Cleanup: split eyedropper_color_sample_fl into more specific utilities
The window and region find utility can be used in other eyedropper
operators.
2021-08-26 14:12:21 -03:00
Germano Cavalcante
d7b0567f7c Cleanup: return window in 'WM_window_find_under_cursor'
This better matches other functions like `BKE_screen_find_area_xy`.
2021-08-26 13:49:04 -03:00
06a60fe9f7 PyAPI: GPU: expose clip distances
Now you can get a shader that uses Clip Planes and set the number of
Clip Distanes with `gpu.state.clip_distances_set(value)`.
2021-08-26 13:03:07 -03:00
edb95b3fcb Cleanup: Use ID_IS_LINKED instead of direct id.lib pointer check. 2021-08-26 15:01:14 +02:00
1bb2077250 Add locking fallback atomics implementation
Is used for platforms for which we do not have native implementation,
such as MIPS, for example.

It is possible to test locking implementation on local computer by
defining `ATOMIC_FORCE_USE_FALLBACK` in the atomic_ops_unix.h file.

Run full regression suit with the locking implementation on amd64
Linux platform and all tests passed.

Having non-optimal but working implementation for odd-ball platforms
seems to be a better choice than failing the build entirely.

Differential Revision: https://developer.blender.org/D12313
2021-08-26 14:36:59 +02:00
2419ffa183 Fix T90959: crash when hovering over empty data block socket 2021-08-26 14:35:10 +02:00
da17692a3d Cleanup: use BLI_UTF8_MAX define 2021-08-26 20:41:02 +10:00
1434ac3767 Cleanup: add ATTR_WARN_UNUSED_RESULT to BLI_string_utf8.h 2021-08-26 20:41:02 +10:00
c52db4c4cf Decouple highlighted tiles from RenderPart
Should be no visible change on user side.
Preparing for render parts removal as part of Cycles X project.

Differential Revision: https://developer.blender.org/D12317
2021-08-26 12:09:03 +02:00
ec66b3ef9b Fix issues with absolute time unit
I think there are the following issues with {rB5fa6cdb77a98}:
- if we introduce a PROP_UNIT_TIME_ABSOLUTE unit, shouldnt it be visible
to RNA as well?
- seems like a double entry sneaked into that commit?

This is in preparation to use this for render time limit in cycles-x.

ref. T90701

Maniphest Tasks: T90701

Differential Revision: https://developer.blender.org/D12315
2021-08-26 11:01:32 +02:00
1f2bf2fd73 Cleanup, quiet compile warnings 2021-08-26 10:36:04 +02:00
fe73778095 Cleanup: unused function from 082ddc9379 2021-08-26 16:10:24 +10:00
d3514cd6a7 ToolSystem: increase the inset tool size
The inset tool requires moving the cursor towards the center of the
selection, making it nearly impossible to use the inset tool
when the view was aligned with the vertical handle.

Use custom settings for VIEW3D_GGT_tool_generic_handle_free
to make it draw hollow, as large as the scale tool.

Resolves T87991.
2021-08-26 16:02:35 +10:00
082ddc9379 ToolSystem: support per-tool gizmo group properties
Also add gizmo group example to the tool-template.
2021-08-26 16:02:31 +10:00
f464cac55a Cleanup: redundant update calls adding objects
These update calls are already performed by
ED_object_add_type_with_obdata.
2021-08-26 13:53:15 +10:00
2fb57685e3 Fix "Text to Object" creating invisible object
Newly created objects would not become visible until
another action forced a depsgraph update.
2021-08-26 12:59:22 +10:00
efcac47155 Cleanup: soft CMake file lists 2021-08-26 12:41:26 +10:00
cec35060f5 Cleanup: sort struct blocks 2021-08-26 12:39:45 +10:00
4e16e8b671 Cleanup: warnings 2021-08-26 12:36:58 +10:00
84f048fda5 Cleanup: use C style comments for descriptive text 2021-08-26 12:36:58 +10:00
42032db1c2 Cleanup: remove deprecated flag use in collada 2021-08-26 12:36:58 +10:00
afcd06e1e1 Cleanup: spelling in comments 2021-08-26 12:36:58 +10:00
ff85ac3009 Cleanup: clang-format 2021-08-26 12:27:13 +10:00
e5a5a251d2 Fix T90915: outliner select behaves as if Ctrl is held
Error in 452cc01932
2021-08-26 11:37:22 +10:00
70fbdcb6bf Cleanup: Refactor proximity node to be more data type agnostic
Before, distances from each component were handled in the same loop,
making it more complicated to add support for more component types
in the future (and probably hurting performance by dealing with two
BVH trees at the same time, though I didn't test that).

Now each component is handled in a separate function, so that adding
support for another component type is much simpler.
2021-08-25 18:03:24 -05:00
5b751c95f4 BLF: Remove ASCII-only Code Paths
Remove redundant code for drawing text strings that contain only ASCII.

See D12293 for much more detail.

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

Reviewed by Campbell Barton
2021-08-25 13:30:00 -07:00
518b97e674 Windows/Ninja: Optimize linker performance
The /Zc:inline flag is by default off in the MSVC
compiler however when you build with msbuild it adds
it to the build flags on its own.

Ninja however does not decide on its own to add
flags you didn't ask for and was building without
this flag.

This change explicitly adds the compiler flag so
msbuild and ninja builds are once more building
with the same build flags leading to smaller .obj
files when building with ninja and lightening the
workload for the linker.

This flag is available starting MSVC 2013 update 2
so does not need to be guarded with version checks.
2021-08-25 10:55:45 -06:00
05564c8ca6 Fix wrong length value in the header of the Move operator
Missed in {rB0d36439f95c0}.
2021-08-25 13:01:41 -03:00
8fb9155598 Fix T90248: missing depsgraph update tag for node group
The code assumed that when a node group is is at the highest
level in the node editor, then it is embedded into another data
block and can't be referenced by other node groups. This is true
for shader and compositor nodes, but not for geometry nodes.
2021-08-25 18:00:29 +02:00
0d36439f95 Fix T90911: Move along axis does not display real distance units
Variable was wrongly set to 0.
Caused by {rB7192e57d63a5}.
2021-08-25 12:44:35 -03:00
f49d438ced Cleanup and remove SEQ_ALL_BEGIN macro
We now use a for_each function with callback to iterate through all sequences in the scene.

This has the benefit that we now only loop over the sequences in the scene once.
Before we would loop over them twice and allocate memory to store temporary data.

The allocation of temporary data lead to unintentional memory leaks if the code used returns to exit out of the iteration loop.
The new for_each callback method doesn't allocate any temporary data and only iterates though all sequences once.

Reviewed By: Richard Antalik, Bastien Montagne

Differential Revision: http://developer.blender.org/D12278
2021-08-25 17:30:39 +02:00
796035ad93 Cleanup: else-after-return 2021-08-25 16:00:48 +02:00
0fd1e6a5f4 T90908: Reduce loading times when extracting thumbnails from Blendfiles.
Previously when loading an thumbnails for an asset the whole file was
read. Reason this was done was perhaps a future idea to load
all thumbnails inside a blendfile in a single go. This was never implemented
and currently unneeded disk and cpu cycles was spend with finding out what
preview to load.

This patch adds an early break when the thumbnail that the caller is
interested in has been found. This improves the thumbnail extraction
when looking into large files.

Reviewed By: mont29

Maniphest Tasks: T90908

Differential Revision: https://developer.blender.org/D12312
2021-08-25 15:59:41 +02:00
5a0ec2302e XR: Enable controller profile extensions
Enables all currently documented OpenXR controller profile
extensions (Reverb G2, Vive Cosmos, Huawei Controller) in order to
support bindings for more VR hardware.

This is necessary because, if these extensions are not enabled, the
OpenXR runtime will return an error when creating a binding with one
of these profiles.

Does not bring about any changes for users at the moment, since
default controller actions have not yet been exposed to users (will
be addressed with D10944, D10948, and D11271).
2021-08-25 21:36:53 +09:00
940ba74024 XR: Improve "Invalid stage ref space" warning
Originally mentioned that absolute tracking was disabled, which is
wrong because absolute tracking (skipping application of eye offsets)
is always available, although it may not give the expected result of
persistent tracking origins across sessions if the stage space is
unavailable (hence the need for a warning).

Now, the warning makes no mention of absolute tracking, instead
informing the user that the local space fallback will be used and
that they should define tracking bounds via the XR runtime if they
wish to use the stage space.
2021-08-25 20:59:53 +09:00
d6ace5a7bb Fix: Crash on file read with active VR session
Add null check for runtime data since it could already have been
freed via wm_xr_exit() (called on file read) prior to the session
exit callback.

Also, fix potential memory leak by freeing session data in
wm_xr_runtime_data_free() instead of session exit callback.
2021-08-25 20:59:37 +09:00
cb9c0aa7d0 Fix: XR action map memory leaks
This fixes two memory leaks related to XR action maps.

1. Freeing of action maps needs to be moved from wm_xr_exit() to
wm_xr_runtime_data_free() since the runtime may have already been
freed when calling wm_xr_exit().

2. Action bindings for action map items were not being freed. This
was mistakenly left out of e844e9e8f3 since the patch needed to be
updated after d3d4be1db3.
2021-08-25 20:57:13 +09:00
a34652d6f8 Fix: Incorrect declaration of XrActionMaps RNA
This fixes a mistake in the XrActionMaps RNA struct declaration.

Originally, the XrActionMaps struct SDNA was set as wmXrData to get
access to wmXrRuntimeData. However, this doesn't give a valid pointer
and the XrSessionState RNA pointer needs to be passed instead.

Since XrSessionState itself does not have SDNA, it is necessary to
pass the XrSessionState pointer to the XrActionMaps struct functions
(new(), new_from_actionmap(), ...) instead of simply using
RNA_def_struct_sdna().
2021-08-25 20:56:52 +09:00
452cc01932 Cleanup: skip saving selection properties set in the keymap
Having settings such as "extend" saved between executions causes
keymaps that don't include this setting to remember the value
between execution.

No longer store this setting for selection operations & remove
redundant values from the key-maps, see: T90275.
2021-08-25 18:10:56 +10:00
8d634c1b27 Cleanup: Mentioning incorrect source file in comment.
Code mentions that ID_* were defined in DNA_ID.h but are actually defined
in DNA_ID_enums.h.
2021-08-25 10:00:55 +02:00
e91fd3b816 Cleanup: separate IMB_thumb_load_blend in multiple functions. 2021-08-25 10:00:55 +02:00
a2597f8b83 Keymap: repeat was disabled for Ctrl-Backspace in the text editor 2021-08-25 17:40:55 +10:00
b98b9354b2 Cleanup: Fixed compile error in debug code. 2021-08-25 09:37:46 +02:00
9df063df19 Fix assert caused by 38630711a0 2021-08-25 17:18:26 +10:00
820d50d3cb Correct error in 38630711a0 2021-08-25 15:36:40 +10:00
38630711a0 BLI_string_utf8: remove unnecessary utf8 decoding functions
Remove BLI_str_utf8_as_unicode_and_size and
BLI_str_utf8_as_unicode_and_size_safe.

Use BLI_str_utf8_as_unicode_step instead since it takes
a buffer bounds argument to prevent buffer over-reading.
2021-08-25 15:28:59 +10:00
be906f44c6 BLI_string_utf8: simplify utf8 stepping logic
There were multiple utf8 functions which treated
errors slightly differently.

Split BLI_str_utf8_as_unicode_step into two functions.

- BLI_str_utf8_as_unicode_step_or_error returns error value
  when decoding fails and doesn't step.

- BLI_str_utf8_as_unicode_step always steps forward at least one
  returning the byte value without decoding
  (needed to display some latin1 file-paths).

Font drawing uses BLI_str_utf8_as_unicode_step and no longer
check for error values.
2021-08-25 15:27:18 +10:00
70f890b510 VSE: Set default sound and video export format
Use video format for export instead of image sequence. Settings are same
as defined in h264_in_MP4 preset.

Sound default is AAC with 256kbit bitrate.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D7916
2021-08-25 06:58:43 +02:00
f80c39b74e Cleanup: Use shorter enum item names 2021-08-24 23:40:13 -05:00
891e3e98eb LineArt: Fix (Unreported) Crash when loading objects.
Fix mesh freeing call for obi->original_me so the address is correct.
2021-08-25 11:05:48 +08:00
a2e0f714f2 Cleanup: Remove unecessary variables
Instead of passing separate booleans for whether to store the locations
and distances, check if the spans are empty. And instead of passing a
separate boolean for whether there is valid tree data, pass a pointer
to the data.
2021-08-24 21:57:45 -05:00
5ef3afd87c Fix T90900: Crash when rendering geometry nodes created curve
The comment for data_eval mentions that it should contain a mesh for
curve objects, however with geometry nodes, objects can evaluate to
curves as well (though they are only containers for the `CurveEval`.
That is a larger issue, but with the upcoming geometry instancing patch
the situation changes, so this commit does not correct that. I also hope
to remove this code in favor of the new curve to mesh code soon.

Instead, just check the evaluated data type in this case, which prevents
the crash, though it is hacky.
2021-08-24 13:38:53 -05:00
f53cf5141d Cleanup: Make function static, remove unused arguments 2021-08-24 13:27:29 -05:00
19da434e9c Nodes: Improvements to edge panning in the node editor.
- New operator property to toggle edge panning in the keymap:
  This is disabled by default to avoid edge-panning in cases where it
  gets distracting, such as adding a new node. Only the explicit
  translate operator(s) (GKEY or drag) have this enabled now.

- Restore the initial view rect on edge pan cancel:
  The initial view rect is now stored in the edge pan operator data.
  When an operator with edge panning is cancelled it can now call the
  `UI_view2d_edge_pan_cancel` function to restore the original View2D
  rect.

- Less delay in node editor scrolling:
  Delay is useful when scrolling through long lists, such as in the
  outliner, but makes node scrolling feel sluggish and unresponsive.
  The lower scroll speed here makes a faster response the better option.

- Zoom influence feature:
  Somewhat slower scrolling in UI-space when zoomed out. With the 0.5
  zoom influence factor nodes behave as if zoom factor is halved,
  otherwise it gets too fast when zoomed out. Previously scrolling would
  always be constant-speed in UI space, now it's half-way between UI
  space and node (view) space.
2021-08-24 18:00:05 +01:00
Robert Guetzkow
38bdde852f Fix T90715: Remove correct particle modifier through Python API
Before this patch attempting to remove a particle modifier programmatically
through Python would fail, because it deleted the modifier associated with
the currently active particle system instead of the one passed as an argument
to `bpy.types.ObjectModifiers.remove()`.

This fix  adds an additional argument for the particle system to
`object_remove_particle_system`. This allows to specify which particle system
and its associated modifier shall be removed. In case of
`particle_system_remove_exec` it will remain the currently active particle
system, whereas `object_remove_particle_system` passes the particle system
of the modifier. Hence, the correct modifier will be removed.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D12234
2021-08-24 18:41:22 +02:00
551521cfa4 Cleanup: ID management: Remove useless internal for BKE_lib_id_clear_library_data.
This static internal `_ex` function was not doing anything extra, just
move back whole code to public API `BKE_lib_id_clear_library_data`.
2021-08-24 17:19:41 +02:00
b55c02a206 Cleanup: Remove useless Camera make_local callback.
Not sure why this one was still there, probably just escaped a previous
cleanup somehow.
2021-08-24 17:08:23 +02:00
9327c00f70 Cleanup: Simplify logic 2021-08-24 10:01:08 -05:00
038f9b7f4a Render: Lazily allocate render passes pixels storage
The idea is to only allocate pixel storage only when there is an actual
data to be written to them.

This moves the code forward a better support of high-res rendering when
pixel storage is not allocated until render engine is ready to provide
pixel data.

Is expected to be no functional changes for neither users no external
engines. The only difference is that the motion and depth passes will
be displayed as transparent for until render engine provides any tile
result (at which point the pixels will be allocated and initialized to
infinite depth).

Differential Revision: https://developer.blender.org/D12195
2021-08-24 16:20:57 +02:00
7aff40f410 FFMPEG: Fix building with older versions that need FFMPEG_USE_DURATION_WORKAROUND 2021-08-24 15:15:21 +02:00
3c82725d74 Disable Fade Inactive Geometry overlay by default
This overlay was intended to identify the active objects in modes
like Sculpt Mode, where you don't have any extra visual indication
of what is the current and target object when switching directly
between them.

After having flash on mode transfer on the transfer mode operator,
the visual information this overlays provides is redundant. It is
still available in case some users want to use it like a way of
focusing on the active object.

Reviewed By: JulienKaspar, JacquesLucke

Differential Revision: https://developer.blender.org/D12303
2021-08-24 12:56:36 +02:00
46913bf0a0 Fix T90840: Can't duplicate or copy (Ctrl-C) object from linked file.
We need to separate the flag telling duplicate code to not handle
remapping to new IDs etc., from the one telling the code that we are
currently duplicating a 'root' ID (i.e. not a dependency of another
duplicated ID).

This whole duplicate code/logic is still fairly unsatisfying, think it
will need further refactor, or maybe even re-design, at some point...
2021-08-24 12:23:39 +02:00
4e4ac5a867 Fix invalid mask use for the UV-project modifier
Mistake in a30a817933.
2021-08-24 18:17:54 +10:00
Himanshi Kalra
30d3dd4de1 Added more Geometry Node tests
* Attributes
* Utilities
* Volume

Test folder located in `lib\tests\modeling\geometry_nodes`
It contains around 34 new tests.
* attribute clamp + other attribute nodes
* Curve Primitive nodes
* Mesh Primitive nodes
* delete geometry
* convex hull
* subdivision surface
* boolean intersect
* boolean diff
* volume to mesh

Reviewed By: zazizizou, JacquesLucke

Differential Revision: https://developer.blender.org/D12250
2021-08-24 13:27:36 +05:30
983280b014 PyAPI: remove active area test for script.python_file_run operator
There is no reason running a Python file should require an active area.
2021-08-24 14:53:23 +10:00
de60205f19 Fix buffer size mismatch in SCRIPT_OT_python_file_run
Reading paths over 512 bytes would cause a buffer overrun.
2021-08-24 14:52:02 +10:00
e0a6001a22 Fix reporting Python reference leaks with WITH_PYTHON_SAFETY
Error in f3e26c847b
2021-08-24 14:36:25 +10:00
8b55cda048 Fix BLI_str_utf8_as_unicode_step reading past intended bounds
Add a string length argument to BLI_str_utf8_as_unicode_step to prevent
reading past the buffer bounds or the intended range since some callers
of this function take a string length to operate on part of the string.

Font drawing for example didn't respect the length argument,
potentially causing a buffer over-read with multi-byte characters
that could read past the end of the string.

The following command would read 5 bytes past the end of the input.

`BLF_draw(font_id, (char[]){252}, 1);`

In practice strings are typically null terminated so this didn't crash
reading past buffer bounds.

Nevertheless, this wasn't correct and could cause bugs in the future.

Clamping by the length now has the same behavior as a null byte.

Add test to ensure this is working as intended.
2021-08-24 14:25:15 +10:00
8371df8b1c Cleanup: spelling 2021-08-24 12:49:00 +10:00
a311ab6167 Cleanup: quiet clang-format warnings, unused argument 2021-08-24 12:43:15 +10:00
bffa168157 Fix T90854: Cycles, normal map fails with applied transformations
Prior to rBb8ecdbcd964a normals were stored both in
DeviceScene.tri_vnormal and the float3 attributes buffer. However, the
normals in `DeviceScene.tri_vnormal` might have be transformed to world
space if the object's transformation was applied, while the data in the
float3 attributes buffer were not. This caused shading issues in cases
where the objects did have transformation applied, as the math expects
the normals to be in object space.

To fix this, convert the normals to object space if necessary before
applying the normal map.

Reviewed By: brecht

Maniphest Tasks: T90854

Differential Revision: https://developer.blender.org/D12294
2021-08-24 01:43:57 +02:00
Félix
eec1ea0ccf VSE: Add Sequence.parent_meta() python API function
This function can be used to find metastrip parent of nested strip.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D11985
2021-08-24 01:21:08 +02:00
929d7597b3 VSE: Cleanup speed effect math
Simplify logic of speed effect frame calculation by using discrete math
where possible. Only `SEQ_SPEED_MULTIPLY` mode with animation requires
frame map to be built. Frame map building was simplified by removing
unused branches.

Functional change: Animating strip in negative range will reverse playback.
I assume this was limitation of previous system, where each frame map item
was limited to be within correct frame range. Now frame map can contain
values that point beyond usable range and they are limited by
`seq_speed_effect_target_frame_get`. This way it is possible to control
playback rate in both directions.

Mostly fixes T89120 apart from offset handling.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11939
2021-08-24 01:10:12 +02:00
a57ba4147f Fix T88237: Prefetch crash on rendering scene strip
Prefetch needs to avoid rendering scene strips, because

 - Rendering in background needs own dependency graph, which fails to
   initialize from evaluated data.
 - This locks UI and can make it unresponsive for long time periods.

In T88237 prefetch failed to avoid scene strip, because of effect strip
was attached to scene strip.

Ensure, that no effect that is attached to scene strip either directly
or indirectly would be rendered.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11247
2021-08-24 00:58:01 +02:00
709ce44617 Fix T90407: Split fails on transition strips
When splitting strips, first they are duplicated and then offsets
adjusted. This can fail on cross transitions, because some strips don't
overlap with split frame.

All strips, that relate to each other must be duplicated to ensure
correct relations after splitting, so solution is to delete non
overlapping strips from left or right side respectively.

Since cross transition don't have to overlap with source strips,
splitting such strips would lead to effect being deleted, which
could cause crash when iterating over strips in python. Therefore
splitting of such strips is now forbidden and will generate error.

Splitting of transition will also generate error solely because such
operation is illogical.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D12121
2021-08-24 00:52:24 +02:00
24a3446787 Fix T90646: VSE hangs when strips overlap
When all strips are selected and overlap is caused, this causes VSE to
hang in infinite loop, because such situation should never happen.

To prevent infinite loop, ensure, that strip overlap is not tested
against single overlapping strip itself.

Prevent overlap that can not be handled because of issue described above
by moving overlapping strip between channels.

Reviewed By: campbellbarton

Differential Revision: D12209
2021-08-24 00:46:34 +02:00
a0c8ee057a Fix T90467: Initialize CurveMapping on demand
`CurveMapping.evaluate` function expectes `CurveMapping` to be
initialized, while this wasn't documented.

I don't see any reason for not initializing `CurveMapping` on demand.
Initialization was added in rBf16047c2df1e8be56bf76524f9eb1fa5ecde2176

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12145
2021-08-24 00:37:32 +02:00
Himanshi Kalra
875c2ea5b5 Using relative threshold for floats in mesh comparison
Changes the threshold comparison from absolute to relative.
Removes threshold for MLoopCol comparison.

Adds a compare relative threshold function.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12273
2021-08-24 00:50:03 +05:30
be1891e895 Cleanup: move the buffer list to 'MeshBufferCache'
The cache is used to fill the buffer list.
2021-08-23 13:44:31 -03:00
cbe4036406 Cleanup: Isolate the batch list struct into a struct called MeshBatchList
This allows for a simplification of macros and combines with
`MeshBufferList`.
2021-08-23 13:43:45 -03:00
eb0c50ac78 Cleanup: rename 'MeshBufferExtractionCache' to 'MeshBufferCache'
Matches the existing `MeshBatchCache`.
2021-08-23 13:43:42 -03:00
6e51ef9531 Cleanup: rename 'MeshBufferCache' to 'MeshBufferList'
`MeshBufferList` is more specific and can avoid confusion with
`MeshBufferExtractionCache`.
2021-08-23 13:41:03 -03:00
Germano Cavalcante
ebdae75736 Cleanup: Move 'tris_per_mat' member out of 'MeshBufferCache'
`MeshBufferCache` is a struct representing a list of buffers.

As such, `GPUIndexBuf **tris_per_mat` is out of place as it does not
represent one of the buffers in the list.

In fact this member should be close to `GPUBatch **surface_per_mat` as
they are related.

The code for dependencies between buffer and batch had to be reworked
as it relies on the member's position.

Differential Revision: https://developer.blender.org/D12227
2021-08-23 13:37:32 -03:00
7d17f2addf Fix T89998: Cryptomatte node output values doubled with Multi-View
When using a Cryptomatte node and selecting 2 views in Multi-View,
its output values are doubled. When selecting 3 tripled and so on.
This causes incorrect compositing results for all the views.

The node creates an input operation for each rendered cryptomatte
pass. In Multi-View, passes are rendered for each view but compositor
is executed per view and should only create operations for those
corresponding to the current view being executed. Otherwise duplicated
operations add up later in cryptomatte operation.

Reviewed By: jbakker

Maniphest Tasks: T89998

Differential Revision: https://developer.blender.org/D12216
2021-08-23 17:09:59 +02:00
4c6d207343 Compositor: Fix crash enabling buffer groups on full frame
Full frame doesn't support this option as all operations are already
buffered. UI option will be removed in the future.
2021-08-23 17:09:59 +02:00
42f89b9212 Compositor: Fix incorrect copying of uchar buffers
Row stride and the area x coordinate offset were not taken into
account.
2021-08-23 17:09:59 +02:00
153b45037f Compositor: Full frame matte nodes
Adds full frame implementation to Channel Key, Chroma Key, Color Key,
Color Spill, Cryptomatte, Difference Key, Distance Key, Keying,
Keying Screen and Luminance Key nodes. The other nodes
in "Matte" sub-menu are submitted separately.

No functional changes.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12220
2021-08-23 17:09:59 +02:00
daa7c59e38 Compositor: Full frame Bokeh Blur and Blur nodes
Adds full frame implementation to these nodes operations.

When enabling "extend bounds" node option, tiled implementation
result is slightly different because it's using `TranslateOperation`
with bilinear sampling for centering.
Full frame always uses nearest to don't lose image quality.
It has the disadvantage of causing image jiggling on backdrop
when switching size values as it's not pixel perfect.
This is fixed by rounding to even.

No functional changes.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12167
2021-08-23 17:08:45 +02:00
344aca3b1b Compositor: Full frame distort nodes
Adds full frame implementation to "Displace", "Crop", "Flip",
"Plane Track Deform", "Corner Pin", "Movie Distortion",
"Lens Distortion" and "Map UV" nodes.

The other nodes in "Distort" sub-menu are implemented
separately in other commits.

No functional changes.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12166
2021-08-23 17:07:37 +02:00
064167fce7 Compositor: Full frame transform nodes
Adds full frame implementation to "Rotate", "Transform" and
"Stabilize2D" nodes.
To avoid sampling twice when concatenating scale and rotate
operations, a `TransformOperation` is implemented with all
the functionality.
The nodes have no functional changes.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12165
2021-08-23 16:36:09 +02:00
a95e56b741 Compositor: Add sampling methods for full frame
Current sampling methods have off by one issues on full frame:
- Bilinear sampling do not fully sample bottom and left image border,
 creating edges.
- Single elem buffers are not sampled at all when they should be
 at least on the borders to smooth edges.
- EWA filtering is partially implemented on `ReadBufferOperation`, it
 needs to be moved to `MemoryBuffer` on full frame.

In order to not affect tiled implementation, this commit creates
specific sampling methods for full frame needs.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12164
2021-08-23 16:36:09 +02:00
8f4730e66f Compositor: Full frame convert nodes
Adds full frame implementation to all nodes in "Converter" sub-menu
except "ID Mask" which is implemented separately.
No functional changes.

Part of T88150.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12095
2021-08-23 16:36:08 +02:00
James Partsafas
21d4a888b8 Fix T88107: rename Convertor to Converter nodes to correct spelling
Differential Revision: https://developer.blender.org/D11198
2021-08-23 16:27:33 +02:00
Mikhail Matrosov
cd118c5581 Fix T90423: black pixels after shadow terminator geometry offset
Solves an error in the principled diffuse BSDF, where it was not correctly
rejecting directions outside the hemisphere.

Differential Revision: https://developer.blender.org/D12283
2021-08-23 15:47:34 +02:00
27f138f4c8 Cleanup: rename parameter in transform utility
`inv_unit_scale` is not descriptive.
2021-08-23 09:49:01 -03:00
2f0e350ffd Fix T90872: Dopesheet messes up keyframe handles
Y coordinate was not being constrained.

Caused by {rBb0d9e6797fb866e7a58876c7977c98a190070310}
2021-08-23 09:49:01 -03:00
b4b3f518aa GPencil: Fix memory leak in split & trim functions
Authored by Henrik Dick (weasel)

Reviewed By YimingWu (NicksBest), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12284
2021-08-23 20:46:38 +08:00
5aa3167e48 Fix T90772: Image Editor not sampling color from the the currently
selected pass

Caused by {rBebaa3fcedd23}.

Seems this above commit assumed an ImageUser's multi_index is only used
for Multiview/Stereo? This is not the case, multi_index also stores the
index for layer/pass combination.

If we call both BKE_image_multilayer_index and BKE_image_multiview_index
(even though this is not appropriate/needed for multilayer images?), we
might end up overwriting multi_index again.

note: looking at this I was also wondering why we update the ImageUser
in image-buffer-aquiring funnctions [and not from the UI, e.g.
template_image_layers, but that is a whole different story I guess, see
comment in T90772 as well]

note2: this could also use a utility function (this is not the only
place where this is done), this is fo a cleanup commit.

Maniphest Tasks: T90772

Differential Revision: https://developer.blender.org/D12267
2021-08-23 13:54:52 +02:00
8165333de9 Pipeline: Use more explicit cuda versions. 2021-08-23 13:47:40 +02:00
9564b6cf23 Fix T90651: camera reconstruction crash without scene camera
This was working differently in 2.79, tried tracking this down and it
seems this was wrong since the 2.8 beginning in {rB7907dfc40018}.

This would not only crash without an active scene camera, but would also
result in different tracks from different camera's constraints could not
be selected.

So select id depends on corresponding camera, remove the dependency on
scene camera completely.

Maniphest Tasks: T90651

Differential Revision: https://developer.blender.org/D12230
2021-08-23 12:52:23 +02:00
0682af0d63 RNA: add length augmented to RNA_string_get_alloc
This was noted as a TODO as it wraps RNA_property_string_get_alloc
which takes a length return argument.
2021-08-23 15:08:48 +10:00
62f2204d65 Cleanup: rename len to str_len for BLF functions
Make it obvious which variable this is the length of.
2021-08-23 15:08:28 +10:00
aa067bef5e Cleanup: use BLI_str_utf8 prefix
Rename:

- BLI_str_utf8_invalid_byte  (was BLI_utf8_invalid_byte)
- BLI_str_utf8_invalid_strip (was BLI_utf8_invalid_strip)
2021-08-23 15:02:13 +10:00
0de3d4e8c7 Fix T90847: snap to face of Add Primitive tool not working in edit mode
BVHTree was being created but not balanced.
Error introduced in {rBfcc844f8fbd0}.
2021-08-22 23:48:54 -03:00
b477333473 Cleanup: fix comment about compiler support.
Differential Revision: https://developer.blender.org/D12288
2021-08-22 22:15:28 +05:30
a1e91fbef3 BLF: Remove space_userpref.py font_kerning_style
Remove `font_kerning_style` from `space_userpref.py` since this is no
longer valid.

See more details in D12276

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

Reviewed by Campbell Barton
2021-08-22 09:26:06 -07:00
721fad37a1 Fix Windows builds after Zstandard commits 2021-08-21 23:31:51 +02:00
67c29bc5a2 Use Zstandard compression for the sequencer cache
Reviewed By: campbellbarton, brecht, mont29

Differential Revision: https://developer.blender.org/D5799
2021-08-21 21:39:06 +02:00
2ea66af742 Add support for Zstandard compression for .blend files
Compressing blendfiles can help save a lot of disk space, but the slowdown
while loading and saving is a major annoyance.
Currently Blender uses Zlib (aka gzip aka Deflate) for compression, but there
are now several more modern algorithms that outperform it in every way.

In this patch, I decided for Zstandard aka Zstd for several reasons:
- It is widely supported, both in other programs and libraries as well as in
  general-purpose compression utilities on Unix
- It is extremely flexible - spanning several orders of magnitude of
  compression speeds depending on the level setting.
- It is pretty much on the Pareto frontier for all of its configurations
  (meaning that no other algorithm is both faster and more efficient).

One downside of course is that older versions of Blender will not be able to
read these files, but one can always just re-save them without compression or
decompress the file manually with an external tool.

The implementation here saves additional metadata into the compressed file in
order to allow for efficient seeking when loading. This is standard-compliant
and will be ignored by other tools that support Zstd.
If the metadata is not present (e.g. because you manually compressed a .blend
file with another tool), Blender will fall back to sequential reading.

Saving is multithreaded to improve performance. Loading is currently not
multithreaded since it's not easy to predict the access patterns of the
loading code when seeking is supported.
In the future, we might want to look into making this more predictable or
disabling seeking for the main .blend file, which would then allow for
multiple background threads that decompress data ahead of time.

The compression level was chosen to get sizes comparable to previous versions
at much higher speeds. In the future, this could be exposed as an option.

Reviewed By: campbellbarton, brecht, mont29

Differential Revision: https://developer.blender.org/D5799
2021-08-21 21:39:06 +02:00
2b170f16d6 Refactor low-level blendfile reading into separate files
Instead of handling mmap, compression etc. all directly in readfile.c, refactor
the code to use a generic FileReader.
This makes it easier to add new compression methods or similar, and allows to
reuse the logic in other places (e.g. thumbnail reading).

Reviewed By: campbellbarton, brecht, mont29

Differential Revision: https://developer.blender.org/D5799
2021-08-21 21:38:57 +02:00
34a05f39be Clang: warn about C++20 designated initializers
With the ongoing transition to C++ files, Windows build
breaks often because of designated initializers.
Now we have two compilers to catch the MSVC build error on.

Reviewed By: #platform_macos, brecht, campbellbarton
Differential Revision: https://developer.blender.org/D11940
2021-08-21 14:02:50 +05:30
0b7947e855 Cleanup: minor changes to blf_font.c
- Use early return when kerning isn't used.
- Remove early return that prevented matching acquire/release calls.
2021-08-21 17:46:50 +10:00
47e68537f8 Cleanup: organize blf_font.c functions using doxy-sections
Functions in this file were scattered and not well organized.
2021-08-21 17:41:40 +10:00
c671bfe14e Cleanup: spelling in comments & minor cleanup
Also hyphenate 'mouse-move' use doxy sections in render_update.c &
move function comment from the header to the source.
2021-08-21 13:26:54 +10:00
aed5a27755 Correct build error from 0d7aab2375 2021-08-21 13:22:47 +10:00
0d7aab2375 Refactor: BLF Kerning Cache After Use
Optimization of font kerning by only caching kerning values after a
pair is encountered. Also saves unscaled values so they don't have to
be rebuilt between font size changes.

See D12274 for more details and speed comparison.

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

Reviewed by Campbell Barton
2021-08-20 17:48:42 -07:00
b6a1bf757d DocPy: Cleanup missing newline resulting in wrong html generation 2021-08-20 14:54:46 -04:00
86622467c5 DocPy: Update Dependancies
Updates sphinx and the theme to the latest version along with any of their dependencies.

Note that we will be sticking to sphinx 4.1.1 until sphinx 4.2 for the same reasons listed in:
https://developer.blender.org/rBM8334
2021-08-20 13:46:38 -04:00
Alaska
cd8d9383e7 Fix T90804: small grammatical error in noise threshold description
Differential Revision: https://developer.blender.org/D12277
2021-08-20 17:43:24 +02:00
1b5f17b867 Cleanup, use BKE_scene_uses_cycles_experimental_features 2021-08-20 15:00:58 +02:00
6a404bc633 Cleanup, remove extra code from previous commit
This got accidentally introduced while revising dependencies between
patches for this feature, did not notice until it was too late.
2021-08-20 14:48:47 +02:00
9bfc47c933 Alembic Procedural: basic cache control settings
This adds a setting to enable data caching, and another one to set the
maximum cache size in megabytes.

When caching is enabled we load the data for the entire animation in
memory, as we already do, however, if the data exceeds the memory limit,
render is aborted.

When caching is disabled, we simply load the data for the current frame
in memory.

Ref D10197

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11163
2021-08-20 14:34:43 +02:00
accf3045be Fix memory leak while processing mouse event
Assignment missed.
2021-08-20 09:06:19 -03:00
ef502127dd Fix T90795: Moving keys in Grease Pencil Dopesheet crashes Blender
`td->loc` is referenced but not initialized.
2021-08-20 08:40:37 -03:00
0081200812 Functions: remove multi-function network
The multi-function network system was able to compose multiple
multi-functions into a new one and to evaluate that efficiently.
This functionality was heavily used by the particle nodes prototype
a year ago. However, since then we only used multi-functions
without the need to compose them in geometry nodes.

The upcoming "fields" in geometry nodes will need a way to
compose multi-functions again. Unfortunately, the code removed
in this commit was not ideal for this different kind of function
composition. I've been working on an alternative that will be added
separately when it becomes needed.

I've had to update all the function nodes, because their interface
depended on the multi-function network data structure a bit.
The actual multi-function implementations are still the same though.
2021-08-20 13:14:39 +02:00
7d8c71e800 Geometry Nodes: add missing versioning for subdivision surface node
This was missing from rBfecec1644ce54ea386eaeed5ca6748d4a7b2737b.
2021-08-20 12:19:24 +02:00
c1227fd408 Cleanup: remove duplicate line 2021-08-20 12:05:03 +02:00
d217b34214 Functions: add utility methods to parameter builder 2021-08-20 11:48:31 +02:00
fd51b05a02 Functions: add clear method to vector array 2021-08-20 11:48:31 +02:00
2b6f0cc836 BLI: add utility methods to IndexMask 2021-08-20 11:48:31 +02:00
e95b197e98 Cleanup: Add CLOG to wm_files_link.c 2021-08-20 11:27:42 +02:00
cea24b4b4a Cleanup: use "free_data" suffix when the argument isn't freed
Avoid API misuse that caused leaks in T90791 &
2788b0261c.
2021-08-20 16:37:50 +10:00
e05db0c26b Cleanup: rename BKE_mesh_free_data -> BKE_mesh_free_data_for_undo
This function only makes sense for undo which doesn't
initialize the meshes ID. Otherwise BKE_id_free should be used.
2021-08-20 16:21:29 +10:00
40f0783d51 Cleanup: remove BKE_mesh_free_data use for lineart mesh copies
Even though this didn't leak memory, BKE_mesh_free_data doesn't
handle freeing data that is part of the ID making it error prone.
2021-08-20 16:08:35 +10:00
15a46a8b72 Cleanup: accidentally included printf 2021-08-20 16:02:39 +10:00
9e2cd6b077 Fix memory leak with building springs in the cloth simulator
Error in 2788b0261c.
2021-08-20 16:00:12 +10:00
a48df97ada Fix T90791: Knife project leaks memory with curve/text cutter 2021-08-20 15:19:58 +10:00
ce3a6d7989 Cleanup: rename BKE_mesh_free -> BKE_mesh_free_data
It wasn't obvious this didn't free the memory of the mesh it's self
leading to memory leaks.
2021-08-20 15:08:27 +10:00
44b25b0ea5 Cleanup: unused warnings 2021-08-20 15:03:32 +10:00
fca6b2780f Cleanup: clang-format 2021-08-19 19:27:49 -07:00
f8637cd8af Alembic Procedural: only subdivide if subsurf modifier is present
As subdivision objects are first class citizens in Alembic, to
differentiate them with non-subdivided polygon meshes, the Alembic
Procedural automatically sets up subdivision properties on the generated
Cycles Mesh.

However, for real-time playback subdivision is far too slow, so this
modifies the detection of a MeshSeqCache modifier used to activate the
procedural to allow for a Subsurf modifier right after the cache one. If
present, the procedural will tag the object for subdivision, if absent, the
object will be treated as a regular mesh.

This is a temporary measure for until subdivision surface settings are part
of the Mesh datablock (see T68891).

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11162
2021-08-20 02:40:37 +02:00
5b51df0f33 Cleanup, format 2021-08-20 02:30:11 +02:00
962153dbed Cycles: missing case for ignoring subdivision vertex normals
This was missing from rBb8ecdbcd964a.
2021-08-19 20:36:34 +02:00
c0dd6f1164 Fix T90776: Cycles normal map node produces artifacts
This is caused by a typo in rBb8ecdbcd964a `sd->prim` is the primitive
index, but was used to discriminate the primitive type (stored in `sd-
>type`).
2021-08-19 20:36:34 +02:00
72f73c0b71 UI: Use theme's alpha for Summary instead of a hardcoded value 2021-08-19 20:24:46 +02:00
dbc4f6fdc9 Fix error rendering Cycles shader nodes from before 2013
After the recent changes to use socket identifiers instead of names.
2021-08-19 20:12:50 +02:00
871f7f4ad8 GPencil: Cleanup old printf debug lines
These lines were very old debug code and now it's not required because the code is very tested.
2021-08-19 19:23:13 +02:00
3febcb98ed Image blendwrite: Fix handling of packedfiles.
Packedfiles need some special attention when writing Image to disk.

Source: D12242, Jeroen Bakker (@jbakker), thanks.
2021-08-19 18:00:00 +02:00
0896457c59 Partially fix T90593: Image ID wrongly seen as changed on undos.
Several pure runtime data in this ID type were not properly cleared by
write/read processes.

Note that the initial undo step (the one leading back to initial read
file state) is still forcing re-load of image, for some reasons.

Common investigation together with Jeroen Bakker (@jbakker), thanks. See
also D12242.
2021-08-19 18:00:00 +02:00
214e4aac97 Fix Python error in ./benchmark init after recent changes 2021-08-19 17:45:37 +02:00
479cc9a83e UI: Match row color for Summary in Mask animation editor
The back color of the row was missing.
2021-08-19 17:06:49 +02:00
71655ff8df GPencil: Match row color for Summary in Grease Pencil animation editor
The background of the summary row was different in Grease Pencil mode.

Reviewed by: Pablo Vazquez, Matias Mendiola
2021-08-19 17:06:41 +02:00
7192e57d63 Fix the value in the graphical editor header when transforming
The header did not display the actual value when transforming with snapping
2021-08-19 10:34:13 -03:00
b0d9e6797f Fix T87173: wrong Auto-Snap in animation editors
This was partially broken with {rBde9ea94fc6f}.

The `Frame Step` and `Second Step` snapping options were working as if
they were `Nearest Frame` and `Nearest Second` respectively in the
`Dope Sheet` and `NLA` editors.

In the `Graph Editor` the problem was more serious:
"Second Step: ... The keyframe itself moves along as though in snapping
were active at all, while its handles 'stay behind' until it reaches
the next second boundary, at which point the teleport handles to
'catch up'".

The snapping code for these modes was spread across the transform
mode code and `recalcData` of each data type. Therefore, create a
unified snapping code for these options so that all issues are fixed in
one place.

Differetial Revision: https://developer.blender.org/D12241
2021-08-19 10:34:13 -03:00
119d53263f Transform Convert Action: conventionalize TransData creation
`td2d->loc`, `td2d->loc2d`, `td->loc` and `td->iloc` were not being
initialized as is done with the other conversion types.

This avoids problems with transform modes becoming incompatible.

This avoids problems with incompatible transform modes that could
result in a crash.
2021-08-19 10:34:13 -03:00
Germano Cavalcante
85b044b3ef Fix incremental snap in animation editors
Animation editors have their own snap types and incremental is not
supported.
2021-08-19 10:34:13 -03:00
46aafbbf66 Cleanup: move animation snap utilities to a separate compilation unit
The snap functions of animation editors were scattered in
`transform_mode` and `transform_snap`.
2021-08-19 10:34:13 -03:00
e648e38887 Undo: Clear more ID runtime data on filewrite.
This should help reducing false 'changed' status detection when reading
back a memfile undo step.

Related to T90593 & D12242.
2021-08-19 15:09:33 +02:00
0f49e4832c Cleanup: Blendwrite: Move code deciding if an ID should be written out of ID callbacks.
This was not really useful, and added estra useless steps in case and ID
should not actually be written.

Further more, it prevented clearing the usercount on write, which can be
cause a false positive 'chanhged' detection in undo/redo case.
2021-08-19 15:09:33 +02:00
d5776f4829 LibOverride: Tag all embedded IDs RNA opinters as overridablei, part II.
Not sure how I failed to include those files in rBe5f8db92b696...
2021-08-19 15:09:33 +02:00
51862c8445 Cycles: experimental integration of Alembic procedural in viewport rendering
This patch exposes the Cycles Alembic Procedural through the MeshSequenceCache
modifier in order to use and test it from Blender.

To enable it, one has to switch the render feature set to experimental and
activate the Procedural in the modifier. An Alembic Procedural is then
created for each CacheFile from Blender set to use the Procedural, and each
Blender object having a MeshSequenceCache modifier is added to list of objects
of the right procedural.

The procedural's parameters derive from the CacheFile's properties which are
already exposed in the UI through the modifier, although more Cycles specific
options might be added in the future.

As there is currently no cache controls and since we load all the data at the
beginning of the render session, the procedural is only available during
viewport renders at the moment. When an Alembic procedural is rendered, data
from the archive are not read on the Blender side.

If a Cycles render is not active and the CacheFile is set to use the Cycles Procedural,
bounding boxes are used to display the objects in the scene as a signal that the
objects are not processed by Blender anymore. This is standard in other DCCs.
However this does not reduce the memory usage from Blender as the Alembic data
was already loaded either during an import or during a .blend file read.

This is mostly a hack to test the Cycles Alembic procedural until we have a
better Blender side mechanism for letting renderers load their own geometry,
which will be based on import and export settings on Collections (T68933).

Ref T79174, D3089

Reviewed By: brecht, sybren

Maniphest Tasks: T79174

Differential Revision: https://developer.blender.org/D10197
2021-08-19 14:40:51 +02:00
5b97c00e9f Alembic import: option to always add a cache reader
The current behavior of the Alembic importer is to only create a
`MeshSequenceCache` modifier or a `Transform Cache` constraint to imported
objects if they have some animated properties.

Since static objects do not have a cache reader, when reloading files those
objects are not updated. Currently, the only way to properly reload a file
because of this is to reimport it.

This adds an option to the importer to always add a cache reader, even if
there is no animated data, to ensure that all objects coming from Alembic
archive are linked to them and updated properly upon reloads.

Reviewed by: brecht, sybren

Ref D10197.
2021-08-19 14:29:42 +02:00
4db4123409 Correct assert from 22ab0159a9 2021-08-19 17:56:25 +10:00
cf72194214 Fix T71137: curve minimum twist producing wrong geometry
Originally D11886 by @ghaspias with minor edits applied.
2021-08-19 17:10:34 +10:00
22ab0159a9 Refactor: BLF Without Kerning Modes
Simplification of BLF code after removal of kerning modes.

See D12262 for more details.

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

Reviewed by Campbell Barton
2021-08-18 20:31:47 -07:00
4734de1093 Cleanup: correction to unused warning removal
This broke building without opensubdiv
2021-08-19 13:18:51 +10:00
594790d8a5 UI: add function to access the buttons text without it's shortcut 2021-08-19 12:50:50 +10:00
7a4ef5256a Cleanup: reduce indentation in loops that check region visibility 2021-08-19 12:50:50 +10:00
feaa61a968 UI: Remove "Unfitted" Kerning Style Option
This patch removes the "Kerning Style" option for UI widget font
drawing and uses only the current default of "Fitted", since the other
option of "Unfitted" is just the result of truncation errors.

see D12231 for much more information.

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

Reviewed by Campbell Barton
2021-08-18 19:48:30 -07:00
ac09411368 Cleanup: unused warning 2021-08-19 12:15:15 +10:00
a217e043be Audaspace: porting PulseAudio fixes from upstream. 2021-08-18 22:22:21 +02:00
55f9014616 Alembic procedural: remove Generated attribute creation
The main reason for this is to speed up updates by avoid unnecessary
copies as the Generated coordinates are a copy of the vertices.

Creating this attribute may become optional in the future, with UI
parameters to select which attribute to use from the Alembic archive as
reference.
2021-08-18 21:27:52 +02:00
6b041ad3d0 Cycles: use object coordinates when generated coordinates are missing
This modifies the attribute lookup to use object coordinates if no
generated coordinates are found on the geometry.

This is useful to avoid creating and copying this attribute, thus saving
a bit of time and memory.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12238
2021-08-18 21:20:39 +02:00
b8ecdbcd96 Cycles: avoid copying vertex normals attribute twice to the devices
Vertex normals are needed for normals maps and therefore are packed and send
to the device alongside the other float3 attributes. However, we already pack
and send vertex normals through `DeviceScene.tri_vnormal`.

This removes the packing of vertex normals from the attributes buffer, and
reuses `tri_vnormal` in the kernel for normals lookup for normal maps, which
reduces memory usage a bit, and speeds up device updates.

This also fixes potential missing normals updates following rB12a06292af86,
since the need for vertex normals for normals maps was overlooked.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12237
2021-08-18 21:12:39 +02:00
e5f8db92b6 LibOverride: Tag all embedded IDs RNA opinters as overridable.
Followup to previous commit, rBfffe219bdb8drBfffe219bdb8d

Again this is only for sake of sane ID/overrides managment for now,
the nodetrees themselves are not overridable from user PoV yet.
2021-08-18 17:05:49 +02:00
fffe219bdb LibOverride: Make nodetree of material overrideable again.
This reverts rB6899dbef77cd and makes the pointer explicitely
processable by override & diffing code.

Previous changes & fixes have fixed the 'driver-workaround' case afaict.

Note that this only enables proper generic handling of overrides and
their ID pointers, no node property is actually overridable currently.
2021-08-18 16:49:20 +02:00
1d06d35034 LibOverride: Do not report embedded IDs as non-overridable in 'foreach_id' code.
Embedded IDs (root nodetrees, master collection, etc.) pointer itself is
not editable, but their content may be overridden.

LibOverride code is supposed to know how to handle those embedded IDs.
2021-08-18 16:49:20 +02:00
ba71eb467e LibOverride: Add several missing 'OVERRIDABLE' flags to NodeTrees RNA.
This should be a no-change commit for now, but is required to enable
initial basic support of nodetrees in library override.

NOTE: Proper full support of liboverrides in nodes is yet to be designed
(has UX unresolved issues, since we likely do not want to expose/make
overridable ALL settings of ALL nodes).
2021-08-18 16:49:20 +02:00
9bfd4ae222 LibOverride: tweak resync detection code at apply phase.
This code checks whether an ID pointer property of an override does not
match its linked reference when it is expected to do so.

This is a goiod indication that a resync is needed.

Previous code would falsy detect overrides of IDs referencing themselves
as needing a resync, when this is not effectively the case.
2021-08-18 16:49:20 +02:00
Charlie Jolly
04376c3bac Geometry Nodes: Add shader Color Mix node
Port color mix shader node to Geometry Nodes.

Differential Revision: https://developer.blender.org/D10585
2021-08-18 14:50:52 +01:00
787350dde8 Fix T90737: VSE adding nested strips could have non-unique names
Caused by {rBbbb1936411a5}.

When adding strips via the new SEQ_add_XXX_strip functions, the
`Editing->seqbasep` pointer was passed around.
Following in `seq_add_generic_update` this `seqbasep` pointer was used
to ensure a unique name.
But `seqbasep` is the pointer to the current list of seq's being edited
(**which can be limited to the ones within a meta strip**).

We need unique names across all strips though (since these are used for
RNA paths, FCurves as reported), so now use the scene's `Editing-
>seqbase` (**which is the list of the top-most sequences**) instead.

Unfortunately this might have screwed files to a borked state, not sure
if this could easily be fixed...

Maniphest Tasks: T90737

Differential Revision: https://developer.blender.org/D12256
2021-08-18 14:43:16 +02:00
7bffafab7b Fix T90718: Object selection toggle do not work inside edit mode
The object was not deselected as it was expected that it would be
activated.

But this activation does not happen in edit mode.
2021-08-18 09:39:45 -03:00
Jeroen Bakker
c0f600cad1 T73434: Improve Weight Paint Overlay Drawing.
Master multiplied the weight paint on top of the rendered image. This
reduced readability.

This patch removes the multiplication for weight painting and adds a
hint of the geometry below the overlay.

Reviewed By: Mets, pablodp606, campbellbarton

Maniphest Tasks: T73434

Differential Revision: https://developer.blender.org/D12170
2021-08-18 07:32:23 +02:00
400cb25fc7 UDIM: Support tile sets that do not start at 1001
Removes the artificial requirement that UDIM tile sets start at 1001.
Blender was already capable of handling sparse tile sets (non-contiguous
tiles) so the restriction around starting at 1001 was unnecessary in
general.

This required fixing a few UDIM-related python bugs around manually
updating the `tile_number` field on images as well. See the differential
for details. No script changes are necessary but they will now work,
correctly, in many more cases.

Differential Revision: https://developer.blender.org/D11859
2021-08-17 21:44:36 -07:00
f41beca977 Fix T90695: Lower tile splitting limit for lineart
Lowers tile splitting limit so models with extremely dense mesh
portions could still have reasonable performance while for more
common cases the performance impact should be minimal.

Reviewed By: Sebastian Parborg (zeddb), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12236
2021-08-18 12:02:53 +08:00
24c16f5457 Fix wireframe overlay not blending over paint overlay correctly
When using wireframe opacity, the paint overlay needs to be drawn
before the wireframes in order to alpha blend correctly.
Sculpt overlays were also affected by this, so this commit refactors
this part of the code in case other overlays needs to be added in
the future.

Reviewed By: Mets

Differential Revision: https://developer.blender.org/D12235
2021-08-17 23:54:45 +02:00
809dce5bde Cleanup: move 'recalcData' to 'transform_convert.h'
The `recalcData` function is defined in `transform_convert.c`, so the
header is most expected to be `transform_convert.h`.
2021-08-17 17:23:57 -03:00
Henrik Dick
e3098de2a1 GPencil: Fix unreported switch direction not flipping weights
There was an unreported bug that switch direction would not switch the order of the vertex group weights. This caused join to do it wrong as well.

Changed to use `BLI_array_reverse` function here to reverse both the normal points and the weights, therefore simplifying the code.

Differential Revision: https://developer.blender.org/D12251
2021-08-17 22:20:26 +02:00
23132fcdc1 Fix T77307: Particle Info Node Does Not Consider Time Remapping
`frame_current_final()` should be used to access the Scene time after
remapping, which also matches how the particles system handles time.

Reviewed By: brecht

Maniphest Tasks: T77307

Differential Revision: https://developer.blender.org/D12239
2021-08-17 21:41:18 +02:00
60d6333b80 Fix T82336: Cycles standard attributes missing in displacement shaders
Standard attributes are not added to the attributes requests when
shaders only have displacement. This is because nodes are only
considering the case when the surface socket is connected.

To support this, added `Shader.has_surface_link()` which checks for both
cases (`has_surface` and `has_displacement`) and replaces all checks on
`Shader.has_surface`.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D12240
2021-08-17 21:38:04 +02:00
Henrik Dick
88dc274d05 GPencil: Convert from Mesh copying Vertex Groups
This patch adds the missing ability to keep the vertex groups when converting to a grease pencil object. This is increadible useful to create rigged grease pencil objects which move together with rigged meshes.

Differential Revision: https://developer.blender.org/D12249
2021-08-17 20:20:47 +02:00
96d0cd57dc Fix T90719: Boost sources dowload address needed to be updated. 2021-08-17 18:01:42 +02:00
e98824d6c4 CMake: add missing headers 2021-08-18 00:37:04 +10:00
7f38872533 RNA: de-duplicate enums in generated source
Reuse existing enums instead of expanding them since it bloats the binary.

The icons enum for example contains over 900 items and was being
expanded 17 times (once for each function that takes an icon argument).
Similar with the event type enum which contains over 200 items and was
duplicated 7 times.

makesrna.c now matches enum definitions from declarations in
RNA_enum_items.h, using their identifiers when found.

The overall space saving on my system is 776kb
(tested with a stripped release build).

Reviewed By: brecht

Ref D12245
2021-08-18 00:23:50 +10:00
0246128b7f Fix wrong Anim Auto-Snap Ctrl toggle
This was not working like elsewhere in both NLA and Graph Editor
(meaning that when snapping was already enabled, {key Ctrl} during
transform did not disable it).

Now use getAnimEdit_SnapMode() for this in NLA and GE as well.

Maniphest Tasks: T87173

Differential Revision: https://developer.blender.org/D12244
2021-08-17 15:52:28 +02:00
f8dd0080a9 Cleanup: clang tidy
The parameter name was inconsistent between declaratation
and implementation.
2021-08-17 11:12:59 +02:00
6028ac44a1 Cleanup: unused defines 2021-08-17 17:45:57 +10:00
7304541f66 Edit Mesh: skip unselected meshes for "Tris to Quads"
Also move property assignment out of the object loop.
2021-08-17 17:12:36 +10:00
32844d32c1 Edit Mesh: skip unselected meshes for "Set Normals from Faces" 2021-08-17 17:12:24 +10:00
4443831c6b Edit Mesh: skip normals to vector with unselected meshes for "Delete"
Meshes with unselected elements are skipped but still called
BM_custom_loop_normals_to_vector_layer.
2021-08-17 17:11:49 +10:00
6baa62245f Edit Mesh: skip flipping custom normals for meshes with no selection
Also split out normal calculation into functions.
2021-08-17 17:10:59 +10:00
cb40c7ca1f Fix memory leak in edit-mesh dissolve degenerate 2021-08-17 16:46:52 +10:00
4c8d68c032 Cleanup: replace degenerate check with assert
Use an assert since this should never happen.
2021-08-17 15:16:34 +10:00
736b6a70a4 Docs: improve word wrap comment 2021-08-17 15:11:54 +10:00
nutti
69fdcea978 Docs: add API docs for gpu.capabilities
Adds Python API documentations for gpu.capabilities module.

Ref D12226
2021-08-17 15:04:35 +10:00
ba055493a0 Cleanup: clang-format 2021-08-17 14:46:46 +10:00
nutti
d60e28093f Docs: add API docs for gpu.platform
Adds Python API documentations for gpu.platform module.

Ref D12222
2021-08-17 14:45:40 +10:00
869b84452a Cleanup: compiler warnings 2021-08-17 14:42:12 +10:00
eaa1527385 UDIM: Fix tile number calculation when adding a range of image tiles
When adding a range of tiles, the operator could incorrectly calculate
the end_tile. It would not account for the start_tile itself and the
IMA_UDIM_MAX value was 1 too small. This is most noticeable when
attempting to fill the entire supported range of tiles.

Differential Revision: https://developer.blender.org/D11857
2021-08-16 21:19:39 -07:00
4dba206011 PyAPI: GPUShader: make 'uniform_vector_*' less restricted
Buffers larger than required may be allowed without restriction.
2021-08-16 13:57:25 -03:00
b5117660da PyAPI: GPU Buffer: Buffer protocol support
The code was commented due to lack of testing and short release deadline.
2021-08-16 13:57:25 -03:00
035d4c28ab Add sanity NULL checks when loading sound sequences
Would cause crashes in files that had lingering invalid sound sequences around.
For example our tests/render/volume/fire.blend test file.
2021-08-16 16:52:38 +02:00
df3884d512 Fix T90689, T90705: Cycles math node with 3 inputs broken after recent changes
Thanks Charlie Jolly for finding the fix.
2021-08-16 15:54:18 +02:00
7db3746033 Cleanup: spelling 2021-08-16 23:46:28 +10:00
394a0b0da5 Fix building without audaspace 2021-08-16 23:19:54 +10:00
118946d195 Fix T87967: M2T video seeking is broken
Bug caused by integer overflow in ffmpeg_generic_seek_workaround().
Function max_ii() was used to limit int_64tvalue.

After fixing the issue there was another issue, where near-infinite loop
was caused by requested_pos being very large and stream being cut in a
way, that it was missing keyframe at beginning.
This was fixed by checking if we are reading beyond file content.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D11888
2021-08-16 15:12:19 +02:00
2946f72a2a VSE: Use lines to draw waveform
Refactor and improve waveform drawing.

Drawing now can use line strips to draw waveforms instead of only
triangle strips. This makes us able to properly visualize thin waveforms
as they would not be visible before. We now also draw the RMS value of
the waveform.

The waveform drawing is now also properly aligned to the screen pixels
to avoid flickering when transforming the strip.

Reviewed By: Richard Antalik

Differential Revision: https://developer.blender.org/D11184
2021-08-16 15:12:19 +02:00
ded68fb102 VSE: Fix audaspace not reading ffmpeg files with start offset correctly
The duration and start time for audio strips were not correctly read in
audaspace.

Some video files have a "lead in" section of audio that plays before the
video starts playing back. Before this patch, we would play this lead in
audio at the same time as the video started and thus the audio would not
be in sync anymore.

Now the lead in audio is cut off and the duration should be correctly
calculated with this in mind.

If the audio starts after the video, the audio strip is shifted to
account for this, but it will also lead to cut off audio which might not
be wanted. However we don't have a simple way to solve this at this
point.

Differential Revision: http://developer.blender.org/D11917
2021-08-16 15:10:58 +02:00
6df81ddb84 VSE: Fix seeking issues.
The seek pts was not correctly calculated.
In addition to that we were not seeking in the video pts time base.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11921
2021-08-16 14:52:57 +02:00
a01cf90fd8 VSE: Fix video strip duration calculation
The video duration was not read correctly from the video file.

It would use the global duration of the file which does in some cases
not line up with the actual duration of the video stream.
Now we take the video stream duration and start time into account when
calculating the strip duration.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11920
2021-08-16 14:52:57 +02:00
43ad345caa VSE: Fix memory leak when adding bad image/movie strips
If the add strip operator errored out, we wouldn't free custom data allocated

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11919
2021-08-16 14:52:57 +02:00
e314260fa7 VSE: Fix "off by one" error when encoding audio
Before we didn't encode the audio up until the current frame.
This lead to us not encoding the last video frame of audio.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11918
2021-08-16 14:52:57 +02:00
08af3e6e92 VSE: Flush audio encode after finishing video export
We didn't flush audio after encoding finished which lead to audio
packets being lost.

In addition to this the audio timestamps were wrong because we
incremented the current audio time before using it.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11916
2021-08-16 14:52:56 +02:00
Eitan
fecec1644c Geometry Nodes: Add UV Smooth, Boundary Smooth options to subdivision node
Replaces the boolean option with enum menus for consistency
with the subdivision modifier (rB66151b5de3ff,rB3d3b6d94e6e).
Adds all UV interpolation options.
Original patch by Eitan. Updated by Himanshi Kalra <calra>.
{F9883204}

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D10417
2021-08-16 14:31:50 +05:30
ddecd7aaca Cleanup: shadow variable warning 2021-08-16 18:06:10 +10:00
Himanshi Kalra
c48a01a88a Add cutom data color property for mesh comparison
Add color data type comparison for meshes, adding it as
part of comparing meshes with geometry nodes applied.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12192
2021-08-16 12:28:12 +05:30
c0016a8581 BLF: avoid unnecessary lookups in blf_kerning_cache_new
blf_kerning_cache_new was performing many unnecessary hash lookups,
calling blf_glyph_search 32768 times. Use a lookup table to reduce this
to the number of ASCII characters (128 calls).
2021-08-16 14:35:38 +10:00
4300050e20 Cleanup: rename kerning table to ascii_table
It wasn't obvious this was only for ASCII characters.
2021-08-16 14:35:38 +10:00
87adcbc94f BLF: use fast ASCII kerning for word-wrap calculations
While this wasn't a bottleneck, using the fast version of this function
removes some duplicate code that doesn't use the look-up table.
2021-08-16 14:35:38 +10:00
6aebbe6a0a Cleanup: replace macros with inline functions for font drawing
Also assert blf_font_ensure_ascii_kerning has been called in
blf_kerning_step_fast.
2021-08-16 14:35:38 +10:00
eb278f5e12 XR: Color Depth Adjustments
This addresses reduced visibility of scenes (as displayed in the VR
headset) that can result from the 8-bit color depth format currently
used for XR swapchain images.

By switching to a swapchain format with higher color depth (RGB10_A2,
RGBA16, RGBA16F) for supported runtimes, visibility in VR should be
noticeably improved.

However, current limitations are lack of support for these higher
color depth formats by some XR runtimes, especially for OpenGL.

Also important to note that GPU_offscreen_create() now explicitly
takes in the texture format (eGPUTextureFormat) instead of a
"high_bitdepth" boolean.

Reviewed By: Julian Eisel, Clément Foucault

Differential Revision: http://developer.blender.org/D9842
2021-08-16 11:46:09 +09:00
899935d5d0 Fix wrong usage of 'sizeof'
The intention was to use `ARRAY_SIZE`.

No functional changes.
2021-08-15 20:08:17 -03:00
3f0d785d23 Fix T90658: selection of some 3D gizmos failing
Small error due to wrong variable usage.

Introduced in rBfcd2d63b644e.
2021-08-15 17:55:09 -03:00
d5261e973b BLF: Do Not Preload Glyph Cache
This patch turns off the preloading of ascii glyphs and instead caches
each glyph the first time it is actually used.

See D12215 for much more detail.

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

Reviewed by Campbell Barton
2021-08-14 13:50:51 -07:00
8f2b60ddbf Cleanup: Variable names, formatting, reduce indentation 2021-08-13 21:46:59 -05:00
6a4533dd02 BLF Cleanup: Size Defines, Comments, etc
This patch makes some non-functional changes to BLF code. Some size
defines added, comments changed, simplification of macro
BLF_KERNING_VARS.

See D12200 for more details.

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

Reviewed by Campbell Barton
2021-08-13 14:31:10 -07:00
ae3472998a Cleanup: rearrange includes
Bring the includes from the same project together.
2021-08-13 17:36:35 -03:00
Germano Cavalcante
0ed2df81cc Fix T90637: Outliner: VSE context menu options are not working
Some of the enum options in the context menu operations are not
supported for all element types.

`TSE_SEQUENCE`, for example, only supports the `Select` option.

So, populate the enum list dynamically depending on the type.

Also add some calls that were missing for the `TSE_SEQUENCE` type.
(`WM_event_add_notifier` and `ED_undo_push`).
2021-08-13 17:28:46 -03:00
5655b3d1c5 Cleanup: fix typos in static variables
_desps --> _deps
2021-08-13 15:45:07 -03:00
5225e459da Fix T86883: Add/fix suport of liboverrides in relocate/reload library case.
There was already some code for that, but it was broken, and proper
resync was completely missing.

There might still be more resync needed in library linking operators
though.
2021-08-13 16:37:29 +02:00
bb0e29c922 Blendloader: Option to reports to skip list of recursively liboverride-resynced libs.
This extra info is not always needed/convinient to use, and requires
special attention to free the list, so allow not generating it.
2021-08-13 16:37:29 +02:00
7772880d69 ViewLayer resync: Add sanity checks for objects/bases mappings.
Add a debug-only check regarding consistency of the cache (mapping from
objects to their bases) for a given ViewLayer.

Issues can happen otherwise when some code does remapping of objects,
and forgets to call `BKE_main_collection_sync_remap()` (which clears
those caches) instead of `BKE_main_collection_sync()`.
2021-08-13 16:37:29 +02:00
77744b581d Fix T90595: some VSE strip properties do not identify strip name in anim
channel names

Working with multiple strips keyframes was unneccessarily difficult in
Animation Editors (since some anim channels could not be distinguished).

Namely `Crop` and `Transform` are nested structs (nested under
`Sequence`), so these were just displaying the raw struct name.
Also strip modifiers did not have their strip name in their channel
names. Now include the strip name for these.

before
{F10277439}

after
{F10277441}

Maniphest Tasks: T90595

Differential Revision: https://developer.blender.org/D12193
2021-08-13 15:17:00 +02:00
Matteo F. Vescovi
0b3c7544b5 Fix FTBFS on mips64el architecture
While trying to get Blender 2.93.x LTS to build fine on all release architectures in Debian, I noticed that the misleading use of "mips" as integer variable caused problems when compiling on mips64el. The patch should fix the issue.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D12194
2021-08-13 14:33:50 +02:00
4cadccebfa Revert "Mesh: replace saacos with acosf for normal calculation"
This reverts commit 41e6509818.

This broke "CubeMaskFirst" test.

Any value even slightly outside the [-1.0..1.0] range
caused the result to be nan, which can happen when calculating
the dot-product between two unit length vectors.
2021-08-13 19:45:01 +10:00
b9486c39bc Cleanup: Unused function parameter warning 2021-08-13 11:16:01 +02:00
fd29a161cc Fix Action Editor unlink button when in tweak mode
When in NLA tweak mode, the action unlink button in the Dopesheet /
Action Editor should be a mere shortcut to exiting tweak mode [nothing
else].

Instead, it was also clearing the action fully, not returning to the
previous edited action before going into tweak mode.

Now dont "flush" by clearing the action, instead exit tweakmode, clear
the scenes SCE_NLA_EDIT_ON flag (if this isnt done some NLA operators
like pushdown were not immediately available because their poll checked
this flag) and send appropriate notifier to have everything update nicely.

Part of T87681 (Bug 4/5/6).

Maniphest Tasks: T87681

Differential Revision: https://developer.blender.org/D11052
2021-08-13 11:07:27 +02:00
00f264ea42 Cleanup: correct comment exiting NLA tweakmode
Comment was pasted from entering tweakmode.
2021-08-13 10:52:53 +02:00
0ae23636e7 Fix missing animation UI update in the Properties Editor
Animation indicators as well as decorators for properties were not
updating correctly in the following cases:
- NLA pushdown (this was reported in T87681)
- NLA enter/exit tweakmode
- Outliner unlinking/setting action

These actions all send a ND_NLA_ACTCHANGE notifier which the Properties
Editor was not listening to [which is now added].

part of T87681.

Maniphest Tasks: T87681

Differential Revision: https://developer.blender.org/D11040
2021-08-13 10:09:12 +02:00
5f6033e091 Keyframe: Reduce GPU context switches.
This change reduces the GPU context switches when drawing keyframes.
In the previous situation the keyframe blocks and keyframe keys were
drawn per channel. With this patch first all the keyframe blocks are
drawn for all channels and after that the keyframe keys are collected
for all channels and send to the GPU in a single draw call.
2021-08-13 09:37:38 +02:00
7b5acc8009 Cleanup: remove unused draw_gpencil_channel.
Code is integrated with draw_scene_channel since 2.80.
2021-08-13 08:34:10 +02:00
160d57d33c Docs: tooltip update missing from 3e775a4fc5 2021-08-13 16:01:45 +10:00
3e775a4fc5 PyAPI: remove the .py extension requirement for startup registration
This was left over from when these scripts were loaded as modules,
where their names needed to be compatible with Pythons module naming.

Version patch existing files so text with register enabled
without a `.py` extension wont start executing on startup.

Resolves T89532.
2021-08-13 15:51:08 +10:00
41e6509818 Mesh: replace saacos with acosf for normal calculation
The clamped version of acos isn't needed as degenerate (nan) coordinates
result in zeroed vectors which don't need clamping.
2021-08-13 15:39:39 +10:00
8fa05efe0a Docs: note that normalize_v# functions zero out input containing nan 2021-08-13 15:15:54 +10:00
92f4abc37f Cleanup: remove unused BKE_mesh_calc_normals_mapping functions
This supported calculating normals for MPoly array which was copied to
an MFace aligned array.

Remove the functions entirely since MFace use is being phased out and
these function isn't used anywhere.
2021-08-13 14:41:42 +10:00
b51a473e29 Cleanup: remove use of BKE_mesh_calc_normals_mapping_simple
Use BKE_mesh_calc_normals instead of
BKE_mesh_calc_normals_mapping_simple for curve modifier calculation.

This only made sense for derived-mesh which is no longer used.
2021-08-13 14:37:30 +10:00
ab344775c2 Cleanup: code-comments
Use capitalization, remove unnecessary ellipsis.
2021-08-13 13:55:25 +10:00
ed38d0c25d Cleanup: split BKE_mesh_calc_normals_poly function in two
Remove the 'only_face_normals' argument.

- BKE_mesh_calc_normals_poly for polygon normals.
- BKE_mesh_calc_normals_poly_and_vertex for poly and vertex normals.

Order arguments logically:

- Pair array and length arguments.
- Position normal array arguments (to be filled) last.
2021-08-13 13:33:03 +10:00
399b6ec76c Mesh: optimize normal calculation
Optimize mesh normal calculation.

- Remove the intermediate `lnors_weighted` array, accumulate directly
  into the normal array using a spin-lock for thread safety.
- Remove single threaded iteration over loops
  (normal calculation is now fully multi-threaded).
- Remove stack array (alloca) for pre-calculating edge-directions.

Summary of Performance Characteristics:

- The largest gains are for single high poly meshes, with isolated
  normal-calculation benchmarks of meshes over ~1.5 million showing
  2x+ speedup, ~25 million polygons are ~2.85x faster.

- Single lower poly meshes (250k polys) can be ~2x slower.

  Since these meshes aren't normally a bottleneck,
  and this problem isn't noticeable on large scenes,
  we considered the performance trade-off reasonable.

- The performance difference reduces with larger scenes,
  tests with production files from "Sprite Fight" showing
  the same or slightly better overall performance.

NOTE: tested on a AMD Ryzen TR 3970X 32-Core.

For more details & benchmarking scripts, see the patch description.

Reviewed By: mont29

Ref D11993
2021-08-13 10:21:30 +10:00
1275ce61b1 Cleanup: Remove unused includes
I noticed this file was recompiling when adding a node.
2021-08-12 14:12:14 -05:00
e0fd5fef12 Geometry Nodes: tag normals dirty after join
Under some circumstances the normals were not tagged dirty
even though they are.
2021-08-12 17:36:53 +02:00
f801d40daf Fix T89241: 3D Text "Scale to Fit" wraps onto the second line
Disable wrapping when "scale to fit" is used, assert the error is
small so an invalid scale-to-fit value wont go by unnoticed.
2021-08-13 01:07:30 +10:00
3930b8c69e Fix NLA action cannot be unlinked in certain cases
The poll for unlinking calls `nla_panel_context` without providing an
adt pointer, and there is a check for this pointer in
`nla_panel_context` leading to never returning true if it is not
provided. (this is fine if there are tracks already, poll would succeed
in this case, `nla_panel_context` goes a different code path then)

Same call to `nla_panel_context` is also done in the beginning of the
corresponding unlink exec function (but this time providing the pointer
because it is used later), so it makes sense to do the same thing in the
poll function. Equal check is also done in the panel poll function, so
now these are all in sync.

Part of T87681.

Maniphest Tasks: T87681

Differential Revision: https://developer.blender.org/D11041
2021-08-12 16:46:28 +02:00
333c3c92ab Fix T89805: NLA crash without active track
Was reported for a file which does not have an active track set in
AnimData even though it was in strip twek mode (but this was accessed in
is_nlatrack_evaluatable()).

Root cause for this is not totally clear, but I assume the situation is
described as part T87681 (and is fixed in D11052).

This patch here just prevents the crash for files that are already in the
borked state.

Reviewers: sybren

Maniphest Tasks: T89805

Differential Revision: https://developer.blender.org/D12085
2021-08-12 16:41:49 +02:00
dc8844f8ef Fix T88498: 'Clear Parent' does not clear parent_bone
Clearing the parent from the UI using the X (or from python) clears the
`parsubstr` and set `partype` back to `PAROBJECT`.

Using the Clear Parent operator would leave the `parsubstr` (and thus
`parent_bone`) untouched even though this operator claims to "clear
parenting relationship completely" (it also removes parent deform
modifiers for example).

So now, also clear `parsubstr` and set back to `PAROBJECT` [which is
default].

Maniphest Tasks: T88498

Differential Revision: https://developer.blender.org/D11503
2021-08-12 16:33:20 +02:00
Henrik Dick
d6891d9bee Add Extras Dropdown Menu to Constraints
Add Apply Constraint, Duplicate Constraint, and Copy To Selected
operators, and include them in a menu similar to the menu for modifiers.
The shortcuts in the extras menu are also matched to modifiers.

All the here added operators are intended to work exactly like the
analogous ones for modifiers. That means the apply operator should apply
a constraint as if it was first in the list, just like modifiers do. I
have added the same warning message as for modifiers when that happens.

The decision to use this approach of appling the constraint as if it was
first, was made for consistency with modifiers. People are already used
to how it works there. Is also provides more intricate control over the
applied transforms, then just applying all constraints up to that one.
Apply all constraints is already kinda implemented in Bake Animation.

Reviewed By: HooglyBoogly, sybren, #user_interface

Differential Revision: https://developer.blender.org/D10914
2021-08-12 14:24:27 +02:00
215734bc52 Fix T88386: Continuous Grab occasionally jumping on Arm64 MacOS
During the processing of a continuous drag event, other mouse move
events may be in the queue waiting to be processed.

But when a mouse wrapping happens, these waiting mouse move events
become out of date as they report a mouse position prior to wrapping.

The current code ignores these events by comparing their `timestamp` to
the time recorded in the last mouse wrapping.

The bug happens because the computed value in
`mach_absolute_time() * 1e-9` for some reason is incompatible with the
value of `[event timestamp]`.

Since macOS 10.6, we have a new way to get the amount of time the
system has been awake. `[[NSProcessInfo processInfo] systemUptime]`.

Using this updated method fixed the problem.

Differential Revision: https://developer.blender.org/D12202
2021-08-12 08:52:50 -03:00
6293cf6131 Fix T90630: Crash loading certain user preferences
Clearing the window was done in wm_file_read_post which was deferred.

This was needed as it left the context in an invalid state
where the window was set but the screen wasn't.

Crashing when setting up keymaps that attempted to access the
scene from the window in the property update function.

Regression in 497bc4d199
2021-08-12 20:43:16 +10:00
ad2fb92e9c Cleanup: remove redundant variable 2021-08-12 17:42:04 +10:00
04ef718226 RNA: include base types in RNA_struct_type_find_property search
Add RNA_struct_type_find_property_no_base for use in the rare situations
when this isn't desired.

Resolves T90617, where sequence strip sub-types weren't detecting
properties that exist in the base "Sequence" types.
2021-08-12 17:14:15 +10:00
806bf3f452 datadoc: add newlines to generated source files 2021-08-12 16:23:08 +10:00
83603ba26a Cleanup: comments/disabled code
- Remove old comment for editors with weak syntax highlighting.
- Remove disabled code to initialize Blender with a file path.
- Remove file name references to function names since these
  were outdated, modern development environments can look up this info.
2021-08-12 16:15:01 +10:00
497bc4d199 Fix T89046: Startup file with Python drivers crashes on load
Resolve order of initialization error reading startup file,
support postponing running wm_file_read_post until Blender
has been initialized.

Deferring updates allows duplicate initialization
to be removed from WM_init.

Reviewed By: mont29

Ref D12184
2021-08-12 14:59:08 +10:00
216414c65a Cleanup: use parameters struct for wm_homefile_read
Also add wm_homefile_read_ex which is only needed for the first
execution at startup.
2021-08-12 14:38:58 +10:00
c741558509 Cleanup: spelling in comments 2021-08-12 14:34:43 +10:00
1ef275963d Cleanup: use C++ style comments for disabled code 2021-08-12 14:34:41 +10:00
4f61843a7e Cleanup: remove *.orig file from 6a9d7139f7 2021-08-12 14:34:39 +10:00
45d100208e Makesdna: Fix detecting 32 bit padding issues.
Makesdna fails to detect issues in 32 bit code that can
only be resolved by adding a padding pointer.

We never noticed since we ourselves no longer build for
32 bit, but debian's 32 bit builds got bitten by this

A rather extensive explanation on why this is alignment
requirement is there can be found in this comment:

https://developer.blender.org/D9389#233034

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

Reviewed by: sergey, campbellbarton
2021-08-11 19:20:51 -06:00
48c8f9fc9a Fix: DNA struct alignment on 32 bit
Some of the dna structs were not properly
aligned for 32 bit builds causing issues
for some of the 32 platforms Debian builds
for.

Reviewed By: sergey, brecht
Differential Revision: https://developer.blender.org/D9389
2021-08-11 16:57:56 -06:00
cd1bb63159 BLF: Do Not Cache Unused Rendered Glyphs
The loading of a font size or style renders bitmaps of the characters
0-255 and stores them in a cache. But glyphs 128-255 in this cache are
not accessible. What used to be ansi high-bit characters are now multi-
byte UTF-8 sequences.

Therefore this patch reduces the glyph_ascii_table size to 128 and
only caches characters 32-127, the visible portion of ASCII, which
greatly reduces the time to load a font.

See D12189 for more details.

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

Reviewed by Campbell Barton
2021-08-11 13:55:58 -07:00
Jeroen Bakker
bb487bc2bc Fix T89984: Improve Icon previews reflective and transmissive materials.
Before this commit rendering material icons the floor will is hidden.
This reduces the readability of reflective/refractive materials.

check patch for additional screenshots and notes.

This patch will switch the floor material that uses ray visibility tricks to render a floor for reflective rays.

Eevee uses screen space reflections that makes this a different problem. There is nothing else drawn in
the scene in screen space so we need a different trick. Using math we convert a reflective ray to UV space
and generate a world that projects a checker pattern to infinity.

As now the floor is in the world it is being reflected via
a cubemap. As the film is transparent the background (including the floor isn't rendered)

In the future when Eevee supports vulkan raytracing we can re-evaluate and perhaps remove this
approximation.

We tried lightprobes but that wasn't able to do the trick.
Using the compositor would lead to more memory usage (render layers and intermediate buffers) and slower performance.
Solution has been validated with Simon

Reviewed By: sybren, Severin

Differential Revision: https://developer.blender.org/D11988
2021-08-11 16:59:57 +02:00
e53afad241 Cleanup: moved keyframe drawing to a draw list.
In preparation to do threaded drawing preparation. There should not be any
functional changes.
2021-08-11 16:47:12 +02:00
c9a9d5332b PyAPI: GPU: Expose builtin shaders
Expose `3D_POLYLINE_SMOOTH_COLOR` and
`3D_POLYLINE_FLAT_COLOR` builtins.

Requested by addon developers.
2021-08-11 11:39:51 -03:00
Pedro A
e6bbbd965a Cycles: OSL metadata support for UI labels and checkboxes
To improve the presentation of nodes in the node editor. Recognize the
following metadata from the OSL specification:

* [[ string label = "UI Label" ]]
* [[ string widget = "checkBox" ]]
* [[ string widget = "boolean" ]]

Ref T89741

Differential Revision: https://developer.blender.org/D12074
2021-08-11 16:12:27 +02:00
6d24017529 Cleanup: use socket identifier instead of names in Cycles shader export
Will be required when we support setting different names and identifiers
for OSL.

Ref D12074
2021-08-11 16:12:27 +02:00
6a9d7139f7 Cleanup: ID management: remove unused old BKE_libblock_copy_for_localize function. 2021-08-11 14:49:56 +02:00
Michael Kowalski
bbcb60fb22 Fix T90519: USD Exporter Error
Fixes: `Error: metersPerUnit does not match retrieved type float`
2021-08-11 09:40:27 -03:00
62cb5c5c4a Enable Asset Browser by default for poses, rest stays experimental
Idea for 3.0 is to disable all functionality that isn't well polished
and focus on those parts first. Starting with poses.

* Adds a new experimental option "Extended Asset Browser", replacing
  "Asset Browser".
* Unlike the previous option, this isn't enabled by default anymore.
  This didn't work well in practice and caused plenty of confusion.
* "Mark as Asset" and "Clear Asset" are hidden if the option is
  disabled.
* Same for the category selection in the Asset Browser.
* Always show display the "Only Assets" option in the File Browser while
  browing inside .blend files. That way you can hide data-blocks that
  are not pose assets.
* The Asset Library setup UI in the Preferences is always visible now,
  it's needed for pose library access.

Addresses T90181, T90180 and T90300.

Differential Revision: https://developer.blender.org/D12120
2021-08-11 14:32:07 +02:00
48ba341d15 Cleanup: Keylist Drawing - Split up in multiple functions. 2021-08-11 13:34:11 +02:00
6aae140278 Cleanup: Minor comment update on LIB_TAG_NEW. 2021-08-11 11:23:31 +02:00
f3e26c847b PyAPI: report unreleased ID's with WITH_PYTHON_SAFETY enabled
This would have made T88033 more straightforward to track down.
2021-08-11 17:37:38 +10:00
cbc671947a Fix T88033: Python reference memory leaks for non main data-blocks
ID data-blocks that could be accessed from Python and weren't freed
using BKE_id_free_ex did not release the Python reference count.

Add BKE_libblock_free_data_py function to clear the Python reference
in this case.

Add asserts to ensure no Python reference is held in situations
when ID's are copied for internal use (not exposed through the RNA API),
to ensure these kinds of leaks don't go by unnoticed again.
2021-08-11 17:10:02 +10:00
18fbcaf7b9 Cleanup: rename BKE_collection_{free => free_data}
This function doesn't free the collection, only it's memory.
2021-08-11 16:09:23 +10:00
Henrik Dick
2f39f7f815 Modifier: use high quality normals for vertex offset
Using high quality normals for vertex offset when set
for higher precision offsets.

This was only used for calculating even-offset.

Reviewed By: campbellbarton

Ref D12176
2021-08-11 10:26:49 +10:00
d480f03952 Cleanup: clang-format 2021-08-11 10:11:12 +10:00
55615e2600 Cleanup: trailing space, remove BOM 2021-08-11 10:11:11 +10:00
fcd2d63b64 Fix 'GPU_matrix_unproject_3fv' not working with out-of-bounds points
To solve this, the unproject code was redone in order to simplify and optimize.
2021-08-10 18:06:52 -03:00
8652e69d8b Fix T90447: 3D view transform locks do not use driver colors
Caused by rB6942dd9f4900.
2021-08-10 12:33:47 -05:00
32c687b5ec Clean-up: Remove UTF8-BOM markers
Done at the request of Sergey.
2021-08-10 11:27:18 -06:00
946da86e02 Win32 IME: Replace Usage of Language IDs
This is a slight refactoring of the Win32 IME code to remove the use of
Language IDs, which is now strongly deprecated. Instead this uses the
new recommended Locale Names, ie ISO-639-1 2-letter abbreviated names
like "en" for English rather than ID 0x09.

See D12143 for more details.

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

Reviewed by Ray Molenkamp
2021-08-10 08:54:03 -07:00
6806459246 UI: hide Viewport Display Bounds for object types that dont have
bounding boxes

These are namely 'LIGHT', 'CAMERA', 'EMPTY', 'SPEAKER' and 'LIGHTPROBE'.

Note that Empties are included here despite the fact that they have
instancing capabilities ('Display As' can be 'Bounds' for example which
then displays all instanced geometry with boundingboxes -- this however
is not meant to work with the 'Bounds' checkbox and the display bounds
type, these are only affective for the object itself, not its instances)

Issue came up in T88443.

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11344
2021-08-10 17:30:43 +02:00
b6538e1492 Fix T90572: "Render Region" is broken due to compositing
It was using viewer instead of render border. A copy-paste error.
2021-08-10 16:16:23 +02:00
eb03529ab9 Compositor: Full frame output nodes
Adds full frame implementation to "Composite", "File Output" and
"Split Viewer" nodes.
The other nodes in "Output" submenu are implemented separately.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12091
2021-08-10 16:16:23 +02:00
d481c6651d Compositor: Full frame color nodes
Adds full frame implementation to "Alpha Over",
"Hue Saturation Value", "Invert", "Tonemap" and "ZCombine" nodes.
The other nodes in "Color" submenu are implemented separately.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12092
2021-08-10 16:16:23 +02:00
8f6cc16490 Compositor: Full frame curve nodes
Adds full frame implementation to "RGB Curves",
"Vector Curves" and "Hue Correct" nodes.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12093
2021-08-10 16:16:23 +02:00
b81d88a8e2 Compositor: Fix memory leaks when initializing tiles multi-threaded
It was only affecting tiled fallback on full frame mode. If tiles from a
constant operation were multi-thread initialized, its buffer
was inflated multiple times.
2021-08-10 16:16:23 +02:00
1a9b9dd64d Compositor: Full frame input nodes
Adds full frame implementation to "Bokeh Image" node, "Track Position"
node, `SetVectorOperation` and `MovieClipAttribute`.
The other nodes in "Input" submenu are implemented separately.

`MovieClipAttribute` needs resolution to calculate its constant value, it can't be constant folded,
which requires it to be a `ConstantOperation`. Now `ConstantOperation` contemplate this case
and any operation that is always constant without depending on inputs should implement it.
If in the future an operation needs to get an input constant element during
`determineResolution` it must first determine its input resolution.

The nodes have no functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12090
2021-08-10 16:16:22 +02:00
5deb3229a0 Compositor: Full frame Mask node
Adds full frame implementation to this node operations.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11751
2021-08-10 16:16:22 +02:00
079f35572b Compositor: Full frame Bilateral Blur node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11634
2021-08-10 16:16:22 +02:00
0116a567dd Compositor: Full frame Sun Beams node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11694
2021-08-10 16:16:22 +02:00
6c0c766bca UI: hide instancing options for empties which cannot be used
Empties can only instance a collection, instancing on "Vertices" or
"Faces" does not make sense for empties, make that clear in the UI.

ref D11348

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11349
2021-08-10 16:05:01 +02:00
4599748962 UI: hide object instancing panel for object types that dont support instancing
Basically, only meshes, empties and pointclouds support direct
instancing atm., no need to have the panel for other types.

note: prior to rB2eca054e14b1, collection instancing was possible on all
types (but that was removed in said commit)

note2: for empties, rna_Object_instance_type_itemf should also be
tweaked so we dont get "Vertices" and "Faces" options, but that can be
done in a separate commit

Maniphest Tasks: T88443

Differential Revision: https://developer.blender.org/D11348
2021-08-10 16:04:45 +02:00
Himanshi Kalra
e38de11f05 Refactor: Custom data comparison in meshes
Added the comparison of non-generic attributes with generic
attributes in the same loop to avoid issues with different
order in layer->types of the two meshes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12149
2021-08-10 19:22:29 +05:30
9c0f11344e Fix T90564: Crash when linking 2 node inputs
Caused by {rB37570a73170e}.

Above commit wasnt taking into account that at this point the link could
still be NULL.

Maniphest Tasks: T90564

Differential Revision: https://developer.blender.org/D12180
2021-08-10 15:44:53 +02:00
05879f2c36 File/Asset Browser: Select/Activate File on Right Click for Context Menu
Right clicking would spawn the context menu under the cursor, but some
operators would actually act on the active asset/file which wasn't
the one clicked on.

When multiple files are selected and one of them is right-clicked on,
selection is not changed to allow operations on multiple files. E.g.
deletion.

This makes the File/Asset Browser match the Outliner (in behavior, not
implementation).

For the right-click selection keymap:
* The context menu still only spawns on W.
* Bonus: Right click now does something, it actually selects files!
  I could have done additional changes here to avoid this, but it seems
  like a good addition.

This is also a better alternative to rB5edfde58fe60, which didn't work
properly either. Using rename from the context menu would only work if
the clicked on file was also active...

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

Reviewed by: Campbell Barton
2021-08-10 13:04:49 +02:00
fe1740ae6a Cleanup: use give_object_under_cursor when dragging materials.
It used to invoke give_base_under_cursor, but only accessed the `object` from the base.
2021-08-10 12:07:13 +02:00
aab7540b7a Fix crash: mouse is over file space during startup.
When blender starts and the mouse is over a file/asset browser it
crashes. This is because blender wants to highlight a file, but the
layout isn't initialized yet.
2021-08-10 12:03:40 +02:00
895d3cd11e Fix T89253: template_list allows arbitrary data changes
Blender forbids property changes in .draw() methods. But they weren't
caught after a call to .template_list() with a custom list type.

Support nested calls that disallow writes.
2021-08-10 19:53:08 +10:00
182edd4c35 Fix T89284: Greasepencil top bar draw tool settings missing
Caused by {rBe3faef686d38}.

Error was getting the preview [which wasnt there yet]
These only appeared once the material tab in the Properties Editor was
used (since this ensured a valid preview icon).

Above commit changed behavior for RNA icon getter (this does not create
data anymore), so ensure the preview by hand here.

Maniphest Tasks: T89284

Differential Revision: https://developer.blender.org/D12178
2021-08-10 11:37:03 +02:00
76d52cbcb4 Cleanup: Comment COW/LOCALIZED ID tags.
This was really missing there (some COW tags behavior was also
documented in some code using them, like in `sound.c`, but not in their
definition).

Ref. T88555.
2021-08-10 10:07:10 +02:00
7c2c66cdb8 Fix T90268: Mesh.from_pydata error using numpy array for edges/faces
Technically not a bug but worth supporting.
2021-08-10 17:51:48 +10:00
61040a36aa PyDoc: fix for renamed context member
Missing change from 9cff9f9f5d.
2021-08-10 17:28:09 +10:00
128ca8c7f6 Fix T90551: Dopesheet displays keyframes differently.
Regression introduced by {rB73b047bcd431}. Missing a check when
converting the file to use LISTBASE_FOREACH.
2021-08-10 08:42:06 +02:00
692e926b18 Silensed compilation warning in gpu test case. 2021-08-10 07:57:41 +02:00
49ea8e4fea Edit Mesh: multi-object edit-mode support for knife project 2021-08-10 15:10:20 +10:00
b83ee724a4 Fix T90418: macOS codesign fails with dylib next to executable
Change the dylib folder relative to `Blender` executable to be
the same as before rB652fbc200500497a67bd11d18b786587ba34e3d9 and same
as bpy.so : `@loader_path/../Resources/${BLENDER_VERSION}/lib`
2021-08-10 10:30:55 +05:30
4ca19c7153 Fix T90493: Undo a knife-project operation crashes
The crash occurred calling because mesh_get_eval_final in edit-mode
freed all derived mesh data without tagging the object for updating.

However meshes in edit-mode weren't meant to be used as knife-project
source-data, adding support for multi object edit-mode  caused this.
2021-08-10 14:44:36 +10:00
3335f852a1 Cleanup: mixing enum/non-enum type warning in conditional expression 2021-08-10 12:04:17 +10:00
26fea4de63 Cleanup: unused function warning 2021-08-10 11:57:33 +10:00
d9930cddfd Fix invalid string comparison in cd692c6954 2021-08-10 11:47:09 +10:00
cb7b4064d6 VSE: Fix cache invalidation
Blend mode replace is done in preprocessing stage, but property update
function invalidated composite cache.
2021-08-10 01:26:49 +02:00
Wannes Malfait
cd692c6954 Geometry Nodes: Add labels for switch node texture sockets
This makes texture sockets have a label by default. This can be changed
by adding the SOCK_HIDE_LABEL flag to the socket. With this change the
switch node now shows the labels "True" and "False" like for the other
types of sockets.
2021-08-09 17:30:44 -05:00
3b87fd376a Cleanup: Remove unecessary RNA get and set functions 2021-08-09 15:25:05 -05:00
Rob Ranieri
8e3dea27ec Docs: Blend-File: Fix typo
Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D12162
2021-08-09 15:36:42 -04:00
2d867426b1 UI: Clip Editor: Expose 2D Cursor Location to RNA and UI
To be consistent with the image editors and 3D viewport
the cursor location can be changed from the sidebar.
This was missing from the clip editor, but support has been added in this commit.
Previously, the only way to precisely set the cursor was
to call the set cursor operator then use the redo panel to adjust the value.
2021-08-09 15:33:06 -04:00
ce95a2b148 UI: Clip Editor: Move Annotation Panel to new View tab
To be consistent with all other editors the annotation
layers pannel should be placed in a "View Tab".
In my next commit, this tab will be expanded to include other options.
2021-08-09 15:33:06 -04:00
b04997cca4 Fix T90547: Add node errors when compiled without OpenVDB or Bullet
These were added in other places but were overlooked here.
2021-08-09 13:42:19 -05:00
fddd5eb692 UI: Image Editor: Fix missing 2D cursor in mask edit mode
The 2D cursor should be visible in both mask and uv edit modes.

This was likely and oversight when splitting the image editor
into the UV and Image editors
2021-08-09 11:53:28 -04:00
ff594715b8 Build: macOS library upgrade fixes
* Revert back to OpenMP 9.0.1 due to bug causing cloth physics test to fail.
* Skip flex build on macOS to avoid link error, only reason we build this is
  due to old flex version on Linux CentOS 7.
* Fix PNG cmake argument that expects lowercase on instead of ON.

 Ref T90507, T88438
2021-08-09 16:50:31 +02:00
71e2c366f7 Cleanup: Fix compiler warning 2021-08-09 15:28:12 +02:00
6fe00939b0 PyAPI: resolve build error with Python 3.10
Resolves T89931
2021-08-09 22:55:41 +10:00
6deb37474e Cleanup: spelling in comments 2021-08-09 22:55:38 +10:00
e2a411570e Cleanup/fixes in UI messages. 2021-08-09 14:42:47 +02:00
3886ab05b4 Cleanup: Spelling and typos in comment 2021-08-09 14:32:12 +02:00
73b047bcd4 Cleanup: Changed keyframe_keylist to CPP.
Just a straight-forward change. Not utilizing CPP features.
2021-08-09 13:00:30 +02:00
22ed1c7b61 Cleanup: filelist, pass FileListReadJob to job functions
Pass `FileListReadJob` to the `read_job_fn` callback, instead of exploding
the struct into its individual fields, passing those as parameters, and
marking a bunch of those as unused again.

No functional changes.
2021-08-09 12:37:23 +02:00
0e4a250279 Fix invalid helps and description of session UUID verification
A copy-paste error.
2021-08-09 12:09:02 +02:00
7ea577eef3 Fix depsgraph check for tag during evaluation
- Only do print when asked for tags debugging.
- Add missing newline to the message.
2021-08-09 12:09:02 +02:00
d6f162dfa9 Fix T90540: NoneType object error with entering grease pencil draw mode
The preview was not ready when the panel was displayed.

Just need to check if None.
2021-08-09 12:08:08 +02:00
0986992dbd Cleanup: document FileListReadJob::tmp_filelist
Add a comment to document what `FileListReadJob::tmp_filelist` is for,
and how it's freed.

No functional changes.
2021-08-09 11:32:16 +02:00
909e0819ae Fix T90532: Crash editing meshes with auto-smooth
Caused by fix for T90256 and a misunderstanding in D11928.

Don't skip tagging edges when the auto-smooth angle is 180 degrees
since this skips topology checks which are needed for properly
calculating edge loop normals.
2021-08-09 18:32:53 +10:00
52c349cfcd Fix T90511: Cycles preview does not update once preview is done
Caused by 4f64fa4f86.

Was a bad backport from the Cycles X branch: the fact that CPU and GPU
has different reset code paths was not taken into account.
2021-08-09 10:28:54 +02:00
b417fb9251 Cleanup: return True/False from gpencil toolbar function
This was returning None/False which could cause problems in the future.
2021-08-09 15:05:04 +10:00
64d750fb73 Cleanup: indentation 2021-08-09 15:03:47 +10:00
d3a699925d Cleanup: use 'cls' for class methods first argument 2021-08-09 15:03:32 +10:00
eb165f574b Cleanup: remove redundant imports
The module was importing it's own functions.
2021-08-09 15:02:31 +10:00
Yuki Hashimoto
8830cfe541 Fix text object inserting multiple characters with a selection
`bpy.ops.font.text_insert(text="multiple characters")` wasn't working.

When the text is selected does not correctly insert multiple characters.

- When the text was selected from left to right,
  the cursor only move one position next to the selected text.
- When the text is selected from right to left,
  a part of the selected text remain.

Ref D12161
2021-08-09 14:31:57 +10:00
ff9bc901f4 Cleanup: grease pencil app-template versioning
- Remove check for screens being None as this would raise an error.
- Replace loop over `area.spaces` with `area.spaces.active`.
- Loop over grease pencil data directly instead of accessing
  through the scenes objects.
- Split versioning into functions.
- Use `update_factory_startup_*` prefix for function names
  as this isn't versioning existing files.
2021-08-09 12:45:06 +10:00
3ea6cf7d41 Cleanup: avoid using context in versioning code
Also extract versioning into a function that makes it's purpose clear.
2021-08-09 12:01:11 +10:00
4c26bb0232 UI: Show Mask Display Options Conistently
This commit makes the display options for mask only show in the header for the clip and image editors.
Prior to this change they would display in the header for the clip editor and in the sidebar for the image editors.
2021-08-08 16:09:23 -04:00
Aaron Carlisle
0be26f563e UI: Sequencer: Fix placement of display options in sequencer & preview mode
This commit does two things, first it removes the proportional editing tool settings.
This is not accessible code and is has not been used since the grease pencil/annotations changes in 2.8.

Second, this patch reorders the if statements so that the display options are always shown on the rightside.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D12163
2021-08-08 13:30:52 -04:00
76e24609fd Cleanup: Remove stale/dead code
This seems to be really old code from 2.4 or earlier.
I was unable to find when it was removed gitk and git blame both couldnt find anything.
However, it is safe to say that this code is long gone.
2021-08-08 13:29:29 -04:00
3f1873111e Cleanup: Fix comment typo 2021-08-08 15:11:50 +02:00
b541b5f875 GPencil: Fix memory leak in previous commit 2021-08-08 15:09:34 +02:00
a7aeec2655 GPencil: New Select Random operator
Select strokes or points randomly (similar to meshes).

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D12157
2021-08-08 14:56:33 +02:00
a7bb537a61 Cleanup: unnecessary double pointers in XR module
No functional changes.
2021-08-07 21:30:15 +09:00
nutti
b33b70ed07 PyDoc: Fix poll_message_set API documentation to consistent with Python style
Fix poll_message_set API documentation to consistent with Python style

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D12150
2021-08-06 20:18:31 -04:00
d245782b80 Windows: Add support to compile python api docs from make file
This adds support to compile the html python api docs from the command line by running `make doc_py` matching support between windows and unix.

This patch also makes it so the compiler is not needed if you set the `blender_bin` variable, this affects icon generation as well.

In the future, I want to move away from generating the build output in the build directory but that can come in a later change.

Reviewed By: LazyDodo

Differential Revision: https://developer.blender.org/D12144
2021-08-06 13:55:14 -04:00
3fab16fe8e Fix T90477: Cursor vertex snapping not working in UV editor
`t->obedit_type` is read to indicate if we are in uv edit mode.

Also fixes a crash introduced in {rBdd14ea18190ff27082009f73a556569a43377a71}.
2021-08-06 11:44:26 -03:00
4f64fa4f86 Cycles: Fix for possible viewport dead-lock
This is a backport of recent development in the Cycles X branch.

Fixes possible dead-lock in viewport rendering when exiting at an
exact bad moment (couldn't reproduce in master branch, but in the
cycles-x branch it was happening every now and then).

Differential Revision: https://developer.blender.org/D12154
2021-08-06 16:26:51 +02:00
69c9363e39 Cleanup: Use conventional naming for private Session members
Makes it consistent with the guidelines and the Cycles X branch, and
allows to backport fix for the viewport update from the branch. Will
cause a merge conflict, which should be simple accept-ours in the
branch.
2021-08-06 15:56:00 +02:00
335379d8fc Cleanup: Add missing newline at end of file 2021-08-06 15:32:28 +02:00
3fbe6f513d Move NanoSVG lib to extern
The library has some modifications and it has been included in a diff.

Reviewed By: campbellbarton

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

(Some minor changes done in the patch)
2021-08-06 15:29:54 +02:00
9cff9f9f5d Cleanup: rename FileList::asset_libraryasset_library_ref
In the `FileList` struct, rename the `AssetLibraryReference
*asset_library` field to `asset_library_ref` -- it's a description of
which asset library is used, and not the asset library itself.

This is to make space for a future `AssetLibrary *asset_library` field,
which will point to an actual asset library struct/class.

No functional changes.

Reviewed by: Severin

Differential Revision: https://developer.blender.org/D12151
2021-08-06 15:20:39 +02:00
2796ee7da0 Fix error setting the ID name in disabled alembic nurbs importe
This corrects code that's currently disabled, see `USE_NURBS` define.

The name passed to `BKE_curve_add` was overwritten,
bypassing uniqueness and utf8 encoding checks.

Longer names would cause a buffer overrun as the length of the source
data was passed to `BLI_strncpy` instead of the destination.

Reviewed By: sybren

Ref D12125
2021-08-06 23:01:57 +10:00
01c1b1e82e Fix shortcut for Asset Details not showing in Asset Browser pulldown
The shortcut wouldn't show up in the Asset Browser's "View" pulldown for
the "Asset Details" item. It's the "N" key to toggle the right sidebar.
2021-08-06 14:39:09 +02:00
f4adb35f28 Fix T90476: intermittent wrong generated texture coordinates with modifiers
This caused Cycles texture_space_mesh_modifier and panorama_dicing tests to
randomly fail.

The issue was introduced with D11377, due to a missing dependency. Now ensure
we first copy the texture space parameters, and only then use or recompute then.

In general it seems like this dependency should have already been there, since
parameter evaluation includes animation and drivers, and geometry evaluation
may depend on that (even if you would not typically animate e.g. an autosmooth
angle).

Thanks Campbell for tracking this one down.
2021-08-06 13:59:25 +02:00
b0df8f53ba Cleanup: rna_xr.c
- Rename functions to use RNA identifiers
- Use SET_FLAG_FROM_TEST macro
- Specify max string length for relevant function params
2021-08-06 17:56:06 +09:00
4c675bc356 Fix missing function param definition in rna_xr.c
Was accidentally left out in rBe844e9e8f3bb.
2021-08-06 17:55:32 +09:00
151eed752b Fix invalid XR action map indices after alloc
Although the relevant structs (wmXrRuntime/XrActionMap/
XrActionMapItem) are zero-allocated, the selected and active action
map indices need to be initialized to -1 to prevent potential
out-of-bounds list access.
2021-08-06 17:55:00 +09:00
d98791a106 Cleanup: clang tidy
`bugprone-signed-char-misuse`
2021-08-06 10:20:24 +02:00
6188c29603 Cleanup: use const result in ED_keyframes_find_* functions. 2021-08-06 09:54:56 +02:00
1ab75c1d49 Cleanup: use range2f in ED_keylist_find_any_between. 2021-08-06 09:46:36 +02:00
bb8ce95b5e Cleanup: const pass keyframes_keylist. 2021-08-06 09:10:28 +02:00
bc97d78329 Cleanup: use MEM_SAFE_FREE macro 2021-08-06 14:24:16 +10:00
99738fbfdc Fix memory leak from rB263fa406cd2b 2021-08-05 21:10:54 -05:00
1f8485ae82 Geometry Nodes: Select by Handle Type Node
Just like the "Select by Material" node, this node outputs a
boolean attribute for control points that have a matching handle
type. By default left and right handles are considered, but it's
possible to only check one side with the toggle in the node.

Differential Revision: https://developer.blender.org/D12135
2021-08-05 18:42:20 -05:00
Mattias Fredriksson
bc0d55e724 Fix: Avoid floating point error in some mesh primitive nodes
Some mesh primitives created using geometry nodes use loops to create
vertices and accumulates positions/angles in FP variables. This allows
rounding errors to accumulate and can introduce significant errors.

To minimize changes from original implementation, variables allowing
errors to accumulate are replaced by: delta * index. Affected Mesh
Primitives nodes are Line, Grid, Cylinder, Circle, Cone, and UV-Sphere.

Differential Revision: https://developer.blender.org/D12136
2021-08-05 18:34:32 -05:00
263fa406cd Fix T90087: Assigning object data doesn't copy vertex groups
Assigning a mesh seems to do its own parameter copying, which
means we need to manual copy its vertex groups here, which was
just overlooked in rB3b6ee8cee708.

Differential Revision: https://developer.blender.org/D12110
2021-08-05 18:27:07 -05:00
Himanshi Kalra
92edf37997 Add custom data comparison for generic attributes
Generic attributes CD_PROP_* comparison is added in customdata_compare
Checks for built-in as well as user created attributes.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12137
2021-08-06 00:07:40 +05:30
Germano Cavalcante
89014b51f1 Xcode: support cmake options for grouping in folders
The Xcode IDE can also benefit from the options:
- WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS
- WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS

So add suport to these options and also renames them as they are no
longer limited to just Windows and Visual Studio.

Reviewed By: brecht, ankitm

Differential Revision: https://developer.blender.org/D12132
2021-08-05 15:31:41 -03:00
cf10eb54cc Action Constraint: add Split Channels Mix choices from Copy Transforms
Practice shows that when combining actions and direct animation
it is usually best to combine location, rotation and scale
separately, which is implemented by the Split Channels modes
recently introduced in D9469 for Copy Transforms. This completes
the same set of 6 choices for the Action Constraint.

The default for new constraints is changed to the newly
added Before Original (Split Channels) mode.

The original patch is motivated by Loic Pinsard, who created
an addon that does the equivalent of this feature by splitting
the action into two, separating location and rotation+scale.

Differential Revision: https://developer.blender.org/D7547
2021-08-05 21:21:29 +03:00
d01781129f Fix T90235: Smooth Brush not working with interior vertices with two adjacent edges
The exception to automatically pin vertices of grid corners also
has to take into account that the vertex is in a boundary.

Reviewed By: JacquesLucke

Maniphest Tasks: T90235

Differential Revision: https://developer.blender.org/D12044
2021-08-05 20:10:02 +02:00
4dd6c9ad45 Fix T90236: Sculpt automasking failing when the stroke does not start over the mesh
The active geometry element are usually updated by the cursor drawing
code (as they are needed for the cursor preview) and when an sculpt
operator starts. For brushes, this was not happening. This was making
brushes rely by default on the last cursor drawing update, which can
be incorrect if the mouse moved after starting the stroke without
hovering the active geometry.

Reviewed By: JacquesLucke

Maniphest Tasks: T90236

Differential Revision: https://developer.blender.org/D12045
2021-08-05 20:08:36 +02:00
6844f7bedb PyDoc: document how parameter are used for 3D and 2D textures
Improves on rB171433e841379e7efad069bbda9880fb271e2fc4
2021-08-05 13:06:13 -04:00
Eitan
bd44e82b25 Geometry Nodes: Add more warnings for out of bounds parameters
Add warning(info) to nodes that don't work when an input value is
out of range. For example, the grid node doesn't work with Vertices X
or Verices Y less than 2.

These are purposefully added as "Info" warnings, because they don't
show in the modifier and they aren't printed to the terminal.

Differential Revision: https://developer.blender.org/D11923
2021-08-05 10:44:59 -05:00
c15635bd8d BMesh: support laplacian smooth for n-gons
Follow the same logic already used by the modifier.
2021-08-06 01:43:13 +10:00
04c24bec07 Cleanup: replace short with boolean for zero area array
Also remove redundant fabsf on the area of a quad/tri &
reduce indentation using continue in for loop.
2021-08-06 01:42:01 +10:00
ff2265f0a9 Cleanup: comment blocks & spelling 2021-08-06 01:36:43 +10:00
8158211198 Cleanup: quiet array-parameter warning 2021-08-06 01:32:04 +10:00
ca64bd0aac Render: move Cycles visibility, holdout and shadow catcher properties to Blender
The immediate reason for this is that we want to be able to initialize them
to different defaults for light objects, which is hard with Python properties.
But in general it is useful to be able to share these with other renderers.

As a side effect, Eevee now supports a per-object holdout instead of only
per-collection.

Differential Revision: https://developer.blender.org/D12133
2021-08-05 17:22:38 +02:00
6c326ba0a2 Fix T83164: Spline IK joint_bindings parameter is broken.
Code freeing the array would not properly reset its length value to
zero.

Note that this corrupted data could also be saved in .blend files, so
had to bump fileversion and add some doversion code too.

Fix T90166: crash when creating a liboverride.
2021-08-05 17:21:25 +02:00
834523e239 Cleanup/Fix RNA array length accessors returning non-zero values in invalid cases.
This was apparently done in two places only, with a very cryptic comment
(`/* for raw_access, untested */`), and... I cannot see how returning a
non-zero length value for an array that does not exist or is not
accessible at least, would be anything but an obvious source of issues.

Note that both commits adding those lines are from stone ages (2009):
rBcbc2c1886dee and rB50e3bb7f5f34.
2021-08-05 17:21:25 +02:00
27b9cb7a1e GPencil: New Merge Layer keymap: Shift+Ctrl+M
The keymap is available in: Draw, Edit, Sculpt, Weight Paint and Vertex Paint modes.

The keymap is not available in Object mode to avoid any conflict.

Reviewed By: pepeland

Differential Revision: https://developer.blender.org/D12128
2021-08-05 17:12:34 +02:00
03d7561708 Fix build error when WITH_XR_OPENXR not defined 2021-08-06 00:08:56 +09:00
b4f950cbbe GPencil: New Caps icons
These icons are used to define the type of caps.

Designed by: Matias Mendiola
Reviewed by: Pablo Vazquez
2021-08-05 17:07:21 +02:00
Germano Cavalcante
cc4e674e41 DRW: New Select Debug Engine
This is a simple engine used only to debug the texture of select ids.

It is only used when the `WITH_DRAW_DEBUG` option is enabled and the
debug value is 31.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D5490
2021-08-05 11:56:51 -03:00
e844e9e8f3 XR Controller Support Step 2: Action Maps
Addresses the remaining portions of T77137 (Python API for Controller
Interaction), which was partially completed by D10942.

Adds an XR "action maps" system for loading XR action data from a
Python script. Action maps are accessible via the Python API, and are used
to pass default actions to the VR session during the
xr_session_start_pre() callback.

Since action maps are stored only as runtime data, they will be
cleaned up with the rest of the VR runtime data on file read or exit.

Reviewed By: Julian Eisel, Hans Goudey

Differential Revision: https://developer.blender.org/D10943
2021-08-05 23:40:17 +09:00
0cff7c2a22 LibOverride: Make it reasonably impossible for users to create overrides of scenes.
This is not supported currently,doing so through RNA API remains
possible, but from regular UI operations it should not be doable
anymore.

Ref. T90459.
2021-08-05 15:26:08 +02:00
720ea8a67d Fix T89963: crash when library override is applied to an object from a linked scene.
LibOverride of scenes is not really supported currently, there are many
issues with it.

Will disable most user-accessible ways to create such overrides in a
following commit.
2021-08-05 15:26:08 +02:00
be6409a748 Fix fix invalid index use for edit-mesh laplacian smooth
Only vertex indices were ensured to be correct.
2021-08-05 22:39:24 +10:00
fb1822ddeb XR: Controller Data Improvements
Provides two key improvements to runtime controller data.

1. Separates controller poses into two components, "grip" and "aim",
which are both required to accurately represent the controllers
without manual offsets.

Following their OpenXR definitions, the grip pose represents the
user's hand when holding the controller, and the aim pose represents
the controller's aiming source.

2. Runtime controller data is now stored as a dynamic array instead
of a fixed array. This makes the API/functionality more adaptable to
different systems.

Does not bring about any changes for users since only internal
runtime functionality is currently affected.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D12073
2021-08-05 21:11:01 +09:00
f45860fba9 Cleanup: Remove unused members in FileSelectParams 2021-08-05 12:52:58 +02:00
ed9759349b Fix T89214: Smooth Vertices (Laplacian) produces NaN coordinates
Vertices with no connected faces would attempt to divide by the combined
face area causing a divide by zero.

Use the same weight for wire vertices as vertices connected
to zero area faces.
2021-08-05 20:49:20 +10:00
02e0c6f42e Fix T90430: Crash when dragging material
Was trying to get asset information even when there was none, i.e. when
the material wasn't an asset or not dragged from the Asset Browser.
2021-08-05 12:14:11 +02:00
317f09ebf9 Fix T90170: RNA_property_pointer_get creating data in non-thread-safe way.
Protect this accessor with a local static mutex when it needs to
create/write data.

Ideally accessors should never create or modify data, but there are some
cases where this bad behavior is currently unavoidable.

This is the case of the Pointer accessor when the actual IDProperty has
not yet been created.

NOTE: this fixes a memory leak in liboverride diffing process when
several different overrides use a same linked reference ID.

Differential Revision: https://developer.blender.org/D12060
2021-08-05 12:12:13 +02:00
03e2f11d48 Fix T89835: Crash after Instancing to Scene after making linked Collection local.
Even though the ID itself remain the same after being made local, from
depsgraph point of view this is a different ID. Hence we need to tag all
of its users for COW update, as well as rebuild depsgraph relationships.

Should be also backported to LTS 2.93 (and 2.83 if possible).
2021-08-05 11:31:49 +02:00
647a8bff06 Fix T90256: faces are flat shaded in edit mode with auto smooth
Regression in 39b2a7bb7e.
2021-08-05 18:21:17 +10:00
f5acfd9c04 Cleanup: remove redundant parenthesis 2021-08-05 16:54:34 +10:00
d8582d966f Fix slicing with negative indices
Negative indices that remained negative after adding the sequence length
caused incorrect slicing.

With the default scene for example:

   bpy.context.scene.objects[-4:2]

Gave a different result to:

   tuple(bpy.context.scene.objects)[-4:2]

Clamp indices above zero so loops that step forward works as intended.
2021-08-05 16:44:03 +10:00
2b51124d6a Fix T89450: Crash slicing BMEditSelSeq
Slicing with indices greater than the length of the sequence would crash.
2021-08-05 16:44:01 +10:00
450593ddf0 Cleanup: Fix Clang braced-scalar-init warning 2021-08-05 11:00:56 +05:30
d3d4be1db3 XR: Action Binding Improvements
Provides several important improvements to the runtime action
bindings operation and internal API.

Moves input-specific action data (input thresholds, input regions,
pose offsets/spaces) from actions to more granular action bindings.
This allows a single action to be mapped to a variety of inputs,
without having to share a single input threshold, region, or space.

Also removes the need for action space creation API, as spaces for
pose actions will be automatically created with the bindings.

The correct action data for the current inputs is set by calling
xrGetCurrentInteractionProfile() to get the current profile and then
retrieving the corresponding mapped data.

Does not bring about any changes for users since only internal
runtime functionality is currently affected.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D12077
2021-08-05 13:14:26 +09:00
d1c5e2e050 Cleanup: license headers
These were removed globally in 65ec7ec524.

Some files re-introduced these conventions since.
2021-08-05 12:03:41 +10:00
604ae5f7b6 Cleanup: tab indentation for CMake / GNUmakefile 2021-08-05 12:03:41 +10:00
1def985d78 Windows: Add icons and icons_geom to make.bat
This adds support for building the icons from make.bat
unlike bash there is no passing environment variables
on the command line.

The scripts go out of their way to locate both blender
and inkscape however if they are not found, the user is
given a helpful error message telling them how to set
the variables.

Although some extra help can be given there, if your
normal build is a 2019 full build running

`make 2019 full icons`

will help it find the blender executable as well.

finally if you know the name of your build folder
running

`make builddir build_windows_Lite_x64_vc16_Release icons`

will also work, if all fails you can point directly to
the blender executable by running

`set BLENDER_BIN=c:\where\blender\lives\blender.exe`

before running `make icons` or `make icons_geom`

The python scripts needed some small modifications since
without the PATHEXT, SystemRoot and SystemDrive
environment variables python will not initialize properly
on windows. (Not blender related, even mainline python
won't start without those)
2021-08-04 19:32:24 -06:00
438d645a36 PyDoc: Update GPU Example of draw_view3d
This function was changed in rBc8004ab4078c98c54a70113c12bbb186403e90cf but didnt update the example.

Part of T84227
2021-08-04 20:25:50 -04:00
171433e841 PyDoc: Improve description of texture.evaluate
Inspired by the old 2.49 docs: https://docs.blender.org/api/249PythonDoc/Texture.Texture-class.html#evaluate
2021-08-04 19:26:01 -04:00
d6ca7ab20e Cleanup: make format 2021-08-04 19:24:19 -04:00
07b702f828 Win32 IME: Rename SetInputLanguage()
GHOST_ImeWin32::SetInputLanguage() has a confusing name because it does
not set the input language. It actually retrieves the current input
locale from the OS and caches the value of the current input language
ID. Therefore this patch renames it to "UpdateInputLanguage"

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

Reviewed by Ray Molenkamp
2021-08-04 14:30:16 -07:00
1d1020b79f Win32 IME: Remove ime_status_
This removes one member of GHOST_ImeWin32 that is not used and cannot
be used in the future. It is holding the result of ImmIsIME, which is
whether an input language supports IME. It does not indicate that one
is in use, turned on, composing, in English mode, etc.

see D12131 for more information.

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

Reviewed by Ray Molenkamp
2021-08-04 13:20:45 -07:00
49acc52e02 Cycles: make object Fast GI Approximation panel a subpanel of Shading 2021-08-04 20:52:29 +02:00
8abf6efcf6 Cleanup: rename restrict to hide/visibility in Object, Collection, MaskLayer
This makes the internal naming consistent with the public API. And also gives
us a visibility_flag rather than restrictflag that can be extended with more
flags.
2021-08-04 19:18:34 +02:00
Romain Toumi
10b9621079 Fix Cycles material slots list being too short
Bring it in line with Eevee.

Differential Revision: https://developer.blender.org/D11982
2021-08-04 18:43:39 +02:00
ae920d789e VSE: Allow Wingdings and Symbol Fonts
This patch makes us less restrictive on the allowed types of FreeType
font character maps we allow, rather than primarily unicode-only. This
allows us to use some legacy, symbol, specialty, and proprietary fonts
like Wingdings. Note we were a little less restrictive with vfonts,
used for 3D Text Objects, so this patch primarily helps VSE.

See D12124 for details and examples.

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

Reviewed by Brecht Van Lommel
2021-08-04 09:31:01 -07:00
b5bfb5f34c UI: VFont Display Names
When displaying the names of fonts for 3D Text objects, use the same
format as shown in File Browser: Family name + Style name. They are
currently shown with Postscript Name, which doesn't match well.

see D12069 for more details.

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

Reviewed by Campbell Barton
2021-08-04 08:34:28 -07:00
c18d91918f Cycles: More flexible GI Approximation AO distance control
The goal: allow to easily use AO approximation in scenes which combines
both small and large scale objects.

The idea: use per-object AO distance which will allow to override world
settings. Instancer object will "propagate" its AO distance to all its
instances unless the instance defines own distance (this allows to
modify AO distance in the shot files, without requiring to modify props
used in the shots.

Available from the new Fats GI Approximation panel in object properties.

Differential Revision: https://developer.blender.org/D12112
2021-08-04 17:26:24 +02:00
58ba75f9e3 LibOverride RNA API: add removal of properties and operations.
This should complete the basics of RNA API for library overrides.

Ref. T86656.
2021-08-04 16:57:08 +02:00
a8185d2d74 LibOverride: Add RNA API to reset/delete overrides.
Ref. T86656.
2021-08-04 16:57:08 +02:00
2af789d1f3 Added some TODO remarks. 2021-08-04 16:05:49 +02:00
c1730ed165 GPencil: New Brush option to define Caps type
This is used to set the default caps type for the stroke. Before always was rounded and only could be changed later in Edit mode

Two new buttons has been added to topbar.

NOTE: New icons are been designed (T90414)

The buttons are expanded to list in Properties panel.

Reviewed By: mendio, HooglyBoogly

Differential Revision: https://developer.blender.org/D11999
2021-08-04 15:54:54 +02:00
145270d8d7 Fix T90427: Center View to Mouse broken
rBfb87d236edb7 made the values returned by `projmat_dimensions` more
standardized following the documentations. But the functions in Blender
that called `projmat_dimensions` followed a proposal that these values
corresponded to a distance of 1m of clip.

Adjust these functions to follow the new algorithm.
2021-08-04 10:46:54 -03:00
e5d4a0c559 BLI: add double version of 'scaleform'
No functional changes. New utility.
2021-08-04 10:46:54 -03:00
26c2c617b4 Fix T90421: edit-mode auto-smooth crash when angle set to 180degrees
Error in 39b2a7bb7e
which failed to set edge flags with single threaded calculation,
used for low poly models.
2021-08-04 22:40:25 +10:00
Gavin Li
76dcf70dac Fix transparent faces on certain AMD cards
This patch fixes an issue with missing faces when assigning a material slot other than the first to faces on AMD TAHITI cards. Refer to T78390 and T74024 for a description of this issue.

This patch also incorporates fix from T78390 for KAVERI.

{F9029258}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9305
2021-08-04 13:22:44 +02:00
d2130c5327 Cleanup: remove *.rej from cb67bfdba2 2021-08-04 21:09:21 +10:00
add719e31a Tweak to recent liboverride API addition: naming.
Rename new API function introduced in recent rB3b0fab6dfaa0 to match our
convention to put the action (verb) at the end of names:
`operations_update`.

Sorry for not catching that during review.
2021-08-04 12:38:13 +02:00
ac6b263906 Cleanup: inconsistent parameter name 2021-08-04 12:32:25 +02:00
557e7f135e Cleanup: initialize variable to quiet warning 2021-08-04 12:31:48 +02:00
051141acde Outliner/LibOverrides: Fix logic of checks for drag'n'drop of Collections.
Previous check was too blunt, preventing e.g. re-organization of
collection overrides inside a local parent collection, which is
perfectly valid operation.

Reported by @hjalti from the studio, thanks!
2021-08-04 11:42:13 +02:00
d9a530c55e Fix compile error without WITH_OCEANSIM enabled
Was changed in 218df99410.
2021-08-04 11:30:24 +02:00
Pratik Borhade
8c21076add Fix T87635: Rename shader node "Specular" to "Specular BSDF"
Node name edited in Specular node definition

Reviewed By: fclem

Maniphest Tasks: T87635

Differential Revision: https://developer.blender.org/D11022
2021-08-04 11:21:44 +02:00
Gottfried Hofmann
c8004ab407 Expose Color Management as argument for gpu.types.GPUOffScreen.draw_view3d()
Fix for https://developer.blender.org/T84227

The problem was that https://developer.blender.org/rBe0ffb911a22bb03755687f45fc1a996870e059a8 turned color management for offscreen rendering off by default, which makes it non-color-managed in some cases. So the idea here is that script authors get the choice wether they want color managed non-color-managed output. Thus this patch introduces a new argument do_color_management as a bool to gpu.types.GPUOffScreen.draw_view3d().

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11645
2021-08-04 11:20:22 +02:00
Anthony Edlin
b867df903f Make loopcut drawing consistent between gizmo and operator.
Loopcut drawing from gizmo had thicker lines because
it was using line smoothing without alpha blend, compared
to thin jagged lines from operator.

Make the drawing anti aliased and consistent by using
3D_POLYLINE/3D_POINT shaders, and making sure alpha
blending is on.

Reviewed By: #eevee_viewport, fclem

Differential Revision: https://developer.blender.org/D11333
2021-08-04 11:19:24 +02:00
cb67bfdba2 Viewport normal drawing with constant length
Patch for: T37878

{F10169694}

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D11487
2021-08-04 10:55:05 +02:00
218df99410 Modifier: warn if the ocean simulation fails to allocate memory
While most modifies don't handle out of memory cases, ocean simulation
could attempt huge allocations: 2048 gb at the maximum resolution.

Resolves T83952.
2021-08-04 18:29:43 +10:00
3b0fab6dfa Override: API update_operations.
The update_operations function will update the override structure of the
local object. When working with overrides the override structure is only
updated when the work-file is stored. When using scripts you might want
to enforce the update of override properties and operations.

This function removes a hack on the test cases.

Reviewed By: mont29

Maniphest Tasks: T86656

Differential Revision: https://developer.blender.org/D10848
2021-08-04 09:28:18 +02:00
effc048710 T90371: Asset: Drop Material Tooltip.
This patch changes the drop named material tooltip to give feedback to
the user what is going to happen when they invoke the change.

There are 3 states:
* "": Operator will be canceled as not all data is present (dropping on
  background.)
* "Drop <named material> on <object name> (slot <slot number>, replacing
  <current material in slot>).
* "Drop <named material> on <object name> (slot <slot number).

Reviewed By: Severin

Maniphest Tasks: T90371

Differential Revision: https://developer.blender.org/D12106
2021-08-04 08:58:39 +02:00
cd92b2350f Cleanup: use C comments for descriptive text 2021-08-04 13:34:02 +10:00
10464843dd Cleanup: add comment to fix for T90417 2021-08-04 13:34:02 +10:00
Johnny Matthews
0f45576590 Geometry Nodes: Curve Set Spline Type
This node sets the selected (or all) splines in curve to a chosen target
spline type. Poly, Bezier, and NURB splines can be converted to any of
the other types. This is meant to be a building block node, useful in
many procedural situations.

In the future the node could be optimized with multi-threading, or by
avoiding copying in many cases, either by retrieving the curve for write
access or by passing the raw vectors to the new splines where possible.

With edits from Hans Goudey (@HooglyBoogly)

Differential Revision: https://developer.blender.org/D12013
2021-08-03 23:14:03 -04:00
26f1a5e2c8 Fix T90417: font loading creates duplicate ID names
Also repair any errors in existing files.

Error from e0dd3fe587.
2021-08-04 13:02:59 +10:00
5950b3ab73 Cleanup: de-duplicate ID renaming utility for versioning 2021-08-04 12:43:07 +10:00
71dc134f89 Icons: add license headers to utilities 2021-08-04 11:45:43 +10:00
7389fd9a35 Icons: resolve various issues for generating icons
- INKSCAPE_BIN environment variable was ignored by
  alert_icons_update & prvicons_update.
- `make icons` wasn't regenerating alert icons.
- Updating SVG icons failed using blender built with ASAN.
2021-08-04 11:35:05 +10:00
8a1c1279b3 Icons: update alert icon script
Missed from c549d736cf.
2021-08-04 11:03:23 +10:00
0d2589d08c Cleanup: spelling 2021-08-04 10:03:07 +10:00
fb87d236ed Fix calculation of 'projmat_dimensions'
`r_left`, `r_right`, `r_bottom` and `r_top` were ignoring `clip_near` value
when in perspective view.

Also rename `projmat` to `winmat` in these cases.
2021-08-03 17:35:35 -03:00
18d900caca macOS: Fix OpenMP dynamic loader error. 2021-08-04 01:22:27 +05:30
41357d556f Fix broken logic in Windows directory query function
Mistake in a5bbdd6998
2021-08-03 19:37:34 +02:00
39e914cee7 Fix select engine buffer having wrong vertex size
The theme used was wrong and the vertex size is twice as set in the theme.
2021-08-03 13:37:55 -03:00
57281b73c4 Install_deps: Always re-create shortcuts to installed lib paths.
For some reasons looks like those shortcuts could get out of sync, which
created weird hard to understand building errors.

So for sake of simplicity and security, just re-create them all the
time, just like we update ld paths.
2021-08-03 17:22:48 +02:00
652fbc2005 macOS: Portable builds with dynamic libraries.
For Blender.app: dropping libomp.dylib next to Blender executable is
enough for it getting picked up since `@executable_path` is an rpath.

For non-distributed binaries datatoc, makesdna, tests etc, code for
copying libomp.dylib to build folder is removed and replaced by
CMake's rpath option for *build* tree.

For bpy.so, the post build rpath change has also been replaced by CMake
rpath option for *install* tree.

Since -id has been changed in D11748, remove the
`install_name_tool -change ...` command.

Any dylib can just be dropped at `MAC_BLENDER_TARGET_DYLIBS_DIR`
hereafter. Appending dylib path to `CMAKE_BUILD_RPATH` will be needed
for datatoc etc if linked against one (instead of copying the
dylibs around).

Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D11997
2021-08-03 20:49:40 +05:30
a25a1f39aa Cleanup: interface, reduce indentation of copy_to_selected_button()
Reduce cognitive complexity of `copy_to_selected_button()` by flipping
conditions, returning early, and using `continue`.

No functional changes.
2021-08-03 17:12:08 +02:00
4e1a1821e0 Fix T90313: Align to Transform Orientation Axis Property Doesn't Work
`Orientation Axis` is a property incompatible with `Align` mode and
should not be visible.
2021-08-03 11:29:36 -03:00
391af6bea2 Cleanup: Replace int with bool for pointcache function
Was using an int for boolean return value.
2021-08-03 15:51:25 +02:00
7724251af8 WM: don't store selection properties typically set in the key-map
While this was already the case for the most part
some selection operators stored common settings for reuse such as
"toggle", "extend" & "deselect".

Disabling storing these settings for later execution
as it means failure to set these options in the key-map re-uses
the value of the shortcut that was last called.

Skip saving these settings since this is a case where reusing them
isn't helpful.

Resolves T90275.
2021-08-03 23:33:40 +10:00
d3dd735fea UI: building without Python again
Also quiet some warnings.
2021-08-03 22:45:37 +10:00
cec103d5a9 Silenced clang-tidy warnings. 2021-08-03 13:56:46 +02:00
0342fb5d20 Fix T90387: division by zero when trying to invert scale
Fix division by zero when `BKE_bone_parent_transform_invert()` inverts a
scale vector with zero components.

Zero values in the to-be-inverted vector are now simply skipped, i.e.
remain zero after inversion. This at least ensures that
`invert_v3_safe(invert_v3_safe(vector))` results in the same vector.

This commit does NOT fix the conceptual problem that an inversion of a
potentially non-invertible vector is relied upon. It just avoids the
division by zero.
2021-08-03 13:43:42 +02:00
dbd34a5acb Fix T90364: buttons (partially) behind animchannel search block search
When channels are scrolled to be (partially) behind the search bar,
their widget buttons would still be interactive, preventing the seach
buttons to be usable.

We have to make sure the events are consumed from the search and dont
reach other UI blocks.
We can do so by flagging the block `UI_BLOCK_CLIP_EVENTS` -- but also
have to make sure the bounds are calculated correctly (otherwise the
check relating `UI_BLOCK_CLIP_EVENTS` in `ui_but_find_mouse_over_ex` wont
trigger properly.

Maniphest Tasks: T90364

Differential Revision: https://developer.blender.org/D12103
2021-08-03 13:20:50 +02:00
b35a96e195 Fix T90346: particle force field self effect amount off by one
When calculating the particle step in `get_effector_tot`, we have to
round up (otherwise we might get an extra round in the for-loop in
`BKE_effectors_apply` for certain cases).

Example from the report:
- 10.000 particles, Effector Amount 3
- was rounding the step down to 3333
- going into the for-loop for 0, 3333, 6666 and 9999 (4 times)
- now rounding the step up to 3334
- going into the for-loop for 0, 3334 and 6668 (3 times as desired)

Maniphest Tasks: T90346

Differential Revision: https://developer.blender.org/D12113
2021-08-03 13:07:46 +02:00
20d5d7b8ec Blender Readfile: Fix annoying useless Object reading error messages.
Extend the 'reading error' container to produce the generic short
message in the popup directly visible by the user, and move all detailed
info the `INFO` reports that only show up in the console and Info
editor.
2021-08-03 12:54:05 +02:00
c6f64d46ed Cleanup: USD importer, consistent naming of function parameter
Rename function parameter `flags` to `read_flag` in the declaration, to
be consistent with the definition.

No functional changes.
2021-08-03 12:44:16 +02:00
Michael Kowalski
ea54cbe1b4 USD: add USD importer
This is an initial implementation of a USD importer.

This work is comprised of Tangent Animation's open source USD importer,
combined with features @makowalski had implemented.

The design is very similar to the approach taken in the Alembic
importer. The core functionality resides in a collection of "reader"
classes, each of which is responsible for converting an instance of a
USD prim to the corresponding Blender Object representation.

The flow of control for the conversion can be followed in the
`import_startjob()` and `import_endjob()` functions in `usd_capi.cc`.
The `USDStageReader` class is responsible for traversing the USD stage
and instantiating the appropriate readers.

Reviewed By: sybren, HooglyBoogly

Differential Revision: https://developer.blender.org/D10700
2021-08-03 12:33:36 +02:00
28b9dd7b1f Cleanup: Remove redundant checks in File Browser UI script
Was already checking these preconditions in the poll method.
2021-08-03 12:25:38 +02:00
c0900a64ce Fix T90341: Crash opening 2.4 file with File Browser editor open
The file selection parameters (e.g. `context.space_data.params`) are
expected to be unset in certain cases. Reading 2.4 files seems to be one
of them. Hence, code using it should check it's set first. Also added an
assert to a File Browser UI template printing a message when the
parameters are unset, to help debugging the issue.
2021-08-03 12:25:38 +02:00
b1a607ce04 Cleanup: deduplicate type conversion logic 2021-08-03 10:38:37 +02:00
f8abc3fb2f Fix T85436: Separate by loose parts doesn't show new objects
Only the "changed" state from the last edit-object was used,
this meant the operator would not perform the necessary update
with multi-object edit-mode.

Use "changed" & "changed_multi" naming convention.
2021-08-03 18:13:06 +10:00
d6e97a53ab Correct task ID in 00b57136e4 2021-08-03 18:13:06 +10:00
b54e741a8b UI: Add light count to viewport statistics
Even though lights were part of `SceneStats`, they were not used when
rBfd10ac9acaa0 was committed.

This patch adds the light count back into the statistics. When a light is
the active object, it will display the total number of lights in the
scene, as well as how many lights are currently selected.

{F10141354}

Reviewed By: #user_interface, Severin, Blendify, harley

Maniphest Tasks: T88512

Differential Revision: https://developer.blender.org/D11387
2021-08-03 09:42:53 +02:00
00b57136e4 Revert "Fix spin-gizmo not allowing click events to select vertices"
This reverts commit 0b903755a9.

This caused T86030, left-mouse selection override clicking,
which is used for creating a full revolution.
2021-08-03 16:34:26 +10:00
Jeroen Bakker
6f50969406 Cleanup: Hide implementation details for ED_keyframe_keylist.
For T78995 we want to change the data structure of keylists to
improve performance. (Probably a Vector with bin-search capabilities).

This patch hides the internal structure of the keylists behind `AnimKeylist`
structure. This allows us to change the internals without 'breaking' where it is
being used.

The change adds functions to create, free, find and walk over the
keylist.

Reviewed By: sybren

Maniphest Tasks: T78995

Differential Revision: https://developer.blender.org/D11974
2021-08-03 08:10:21 +02:00
Jeroen Bakker
ebd55b4acd T90372: Assets: When dropping material use active material slot.
Currently when dropping an asset the first material slot is always updated.
This patch changes that logic to update the active material slot.

In future the behavior will be updated to use the material slot of the face under the cursor.
That requires better feedback tot he user.

Reviewed By: Severin

Maniphest Tasks: T90372

Differential Revision: https://developer.blender.org/D12056
2021-08-03 08:08:20 +02:00
Miguel G
a53feb0aff Fix T89691: Solidify modifier simple/complex inconsistency
Maintain the sign when clamping non zero offset.

Reviewed By: campbellbarton, weasel

Ref D11832
2021-08-03 16:00:32 +10:00
c1a477b497 Cleanup: use C++ comments or 'if 0' for commented code 2021-08-03 15:27:20 +10:00
1973fd89df Fix crash adding custom normals
Caused by error converting this file to C++
eccdced972.
2021-08-03 15:01:39 +10:00
04c75c5ce7 Edit Mesh: Correct normal calculation for "Set From Faces"
Setting normals from faces wasn't weighting the faces contribution
by the corner angle, giving lop-sided results in some cases.

This removes the epsilon check for CLNORS_VALID_VEC_LEN,
in favor of matching the behavior of vertex normals exactly.
2021-08-03 12:22:11 +10:00
223f048138 Fix annotations placement option in the Movie Clip editor
In rB6ee14c966d05362228511756c4906e043b87e346 the enum items were renamed/removed, this change was not propagated to this setting
2021-08-02 20:15:11 -04:00
efd7c95bb2 Cleanup: Remove duplicate special case check 2021-08-02 15:45:25 -04:00
a4813379f9 Fix T90042: Spline tangent calculation assert with coincident points 2021-08-02 15:43:37 -04:00
4f6f445120 Cleanup: Make spline settings copy function public
It will be useful in the spline type conversion node. Theoretically it
could become protected again if that conversion moves out of a node,
which might be a nice improvement after an initial version.
2021-08-02 14:21:19 -04:00
8b93265c19 Mesh: Tag normals dirty instead of calculating
Because mesh vertex and face normals are just derived data, they can
be calculated lazily instead of eagerly. Often normal calculation is
a relatively expensive task, and the calculation is often redundant
if the mesh is deformed afterwards anyway.

Instead, normals should be calculated only when they are needed. This
commit moves in that direction by adding a new function to tag a mesh's
normals dirty and replacing normal calculation with it in some places.

Differential Revision: https://developer.blender.org/D12107
2021-08-02 13:47:32 -04:00
a2203a27d9 Fix T90356: Frame selected includes active strip
Don't include active strip in this operator.

This was confusing due to name of operator and inconsistent with other
editors.
2021-08-02 18:51:00 +02:00
67d56eb71e Cleanup: Remove unused/unecessary OpenVDB C API
This commit uses OpenVDB more directly for the voxel remesher, without
the extra indirection of copying to a Blender API. This makes the code
simpler, shorter, and easier to understand (though I didn't observe any
performance improvement).

This also removes the rest of the unused and undocumented OpenVDB C API,
which was written when Blender's code didn't really use C++, and doesn't
serve a purpose anymore. Those features will be implemented as nodes in
the future anyway (see D12100).

Differential Revision: https://developer.blender.org/D12097
2021-08-02 12:26:28 -04:00
77187718e4 Fix T78469: Output Metadata: Strip Name no longer accessible
Caused by rB7fc60bff14a6.

This has actually been reported and closed, but that was clearly a
misunderstanding (above commit changed a checkbox to be an enum, but a
second checkbox was simply removed)

Maniphest Tasks: T78469

Differential Revision: https://developer.blender.org/D12084
2021-08-02 17:26:50 +02:00
eccd8af828 Revert "GHOST/X11: enable EGL"
This is causing issues for some users launching Blender, because EGL indirectly
requires GLVND, which is not installed by default on e.g. Ubuntu.

This reverts commit 0b18a618b8.

Fixes T90374

Ref D12034
2021-08-02 17:19:17 +02:00
1062649b5e Fix T87041: Driver Editor not updated in realtime
Caused by {rBbbb2e0614fc3}

Since above commit only the playhead is updated as an overlay in
animation playback (was moved out of drawing of the main region for
perfomance reasons).
The driver value "debug" visualization is very useful to have during
playback though but was left in main region drawing as part of
`draw_fcurve` (thus does not update in realtime anymore).

Moving `graph_draw_driver_debug` into the overlay is not feasible
because it requires animation filtering which has significant overhead
which needs to be avoided in the overlay which is redrawn on every UI
interaction.

Now tag the whole main region for updates in the Driver Editor during
playback instead (which will make the Drivers Editor as slow during
playback as before rBbbb2e0614fc3 -- but with realtime updates of the
debug visualization).

Maniphest Tasks: T87041

Differential Revision: https://developer.blender.org/D12003
2021-08-02 17:11:58 +02:00
3ff5d8f719 Asset Browser: Proper context menu for assets
Add a context menu dedicated to asset operations to the Asset Browser.
There are two separate context menus to keep things separated well and
avoid confusing if-else logic (similar to D12057 & D12059). Their polls
make sure they are displayed for the right contexts only.

Also (to be committed as followup cleanup): Remove now unused special
handling for assets in file delete operator.

Differential Revision: https://developer.blender.org/D12062
2021-08-02 17:00:20 +02:00
ceb049133c Asset Browser: Don't show inapplicable filter and display settings
So far the Asset Browser just showed the same popups and settings as the
File Browser. Not all of them made sense for the Asset Browser though.

* Don't show inapplicable recursion toggle.
* Don't show sorting options, which don't work with assets anyway.
* Don't show the Filter popover, there are currently no applicable items
  in there.

Just like in D12057, I decided to add separate classes for the Asset
Browser case.

Differential Revision: https://developer.blender.org/D12059
2021-08-02 17:00:20 +02:00
d8bf332f86 Asset Browser: Adjust header pulldowns to be Asset Browser specific
So far the Asset Browser just showed the same menus as the File Browser.
Not all of their entries made sense for the Asset Browser though. I
decided to just give them entirely different classes to avoid confusing
if-else checks everywhere. I think the code duplication this adds is a
minor issue, it's better to keep things seperated clearly IMO.

* View menu: Add "Asset Details" toggle for the sidebar region.
* View menu: Remove recursion sub-menu
* View menu: Remove "File Path" region toggle, which doesn't apply for
  the Asset Browser.

Differential Revision: https://developer.blender.org/D12057
2021-08-02 17:00:20 +02:00
James Monteath
0e4f7b4a4b Delete pipeline_config.json file. The yaml file is now used.
Update README.md.
2021-08-02 16:57:29 +02:00
11cfa6c718 Fix T90332: Auto-smooth crashes in edit-mode
Regression in 39b2a7bb7e
that meant non-manifold edges were not being tagged
when they should have been.
2021-08-02 23:58:55 +10:00
d60a7a8744 WindowManager: Support Dynamic tooltips when dragging.
Originally the operator name was drawn next to the dragging content.
After that there was an option to add custom, static text with the
dragging content. This patch allows dynamic text to be drawn.

The custom text was implemented as out parameter of the poll function
what made the code unclear. This patch introduces a tooltip function
that separates tooltip generation from the poll function.

NOTE: the text should always be returned in its own memory block. This
block will be freed after it is copied in the drag struct.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12104
2021-08-02 15:13:21 +02:00
8edb2222ae Cleanup: simplify subclassing CPPType
`CPPType` can wrap any C++ type so that code can work
with the wrapped type in a generic way. The goal of subclassing
`CPPType` is to provide additional methods for some types.
For example, the `CPPType` for `Array<int>` could have a `.element_type()`
method that returns the `CPPType` for `int`.
2021-08-02 12:44:17 +02:00
aa60416361 Revert "Asset Catalogs: loading a catalog definition file"
This reverts commit 1f0d6f7635 and the
cleanup 06cb48e1b2. Committed too early on
Monday morning, still has issues that should be resolved first.
2021-08-02 12:07:55 +02:00
06cb48e1b2 Cleanup: Asset catalogs, C++ to C-style comments
No functional changes.
2021-08-02 11:15:50 +02:00
1f0d6f7635 Asset Catalogs: loading a catalog definition file
Initial, limited implementation of loading a single asset catalog
definition file. These files are structured as follows:

  CATALOG_ID virtual/path/of/catalog
  SUBCATALOG_ID virtual/path/of/catalog/child
  SOMETHING_ELSE some/unrelated/hierarchy

These virtual paths will be used to show the catalog in a tree
structure; the tree structure itself is not part of this commit. Each
asset will have one catalog ID that determines where in that tree the
asset shows up.

Currently only a single catalog definition file can be read; merging
data from multiple such files, and writing them out again after changes
are made, is for future commits.

This commit only contains the code to load a single file, and unittests
to check that this actually works. No UI, no user-facing functionality
yet.
2021-08-02 11:08:02 +02:00
3fd5c93f9c Geometry Nodes: increase threshold to make regression tests pass
The real fix here is to use some kind of relative error in `customdata_compare`
instead of the absolute error used now. If vertex coordinates get larger in magnitude,
the allowed error should increase as well.
2021-08-02 10:38:11 +02:00
de91cdd930 Cleanup: separate base and geometry nodes specific socket cpp type
This simplifies changing how geometry nodes handles different socket types
without affecting other systems.
2021-08-02 10:34:50 +02:00
48722e8971 LineArt: Prevent depsgraph warning when camera is NULL. 2021-08-02 13:45:30 +08:00
1cf45fe10f Cleanup: spelling 2021-08-02 15:22:54 +10:00
Takahiro Shizuki
836aeebf70 IME Win32: Fix Duplicated Initial Character
When entering characters using IME on Windows, Japanese and Chinese
will both usually result in the first keystroke being duplicated. The
problem is that we are informed too late, after the first key is
pressed, that we are IME composing. This patch ensures we are entering
non-English characters using ImmGetConversionStatus() and then deals
with editing keys (like arrows and backspace) on a per-language basis.

see D11929 for more details.

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

Reviewed by Brecht Van Lommel
2021-08-01 11:52:22 -07:00
79277986c2 Cleanup: Sort node types alphabetically 2021-07-31 23:22:36 -04:00
17243337d7 Cleanup: Remove unecessary helper function
Retrieving a mesh's looptris now take's a const mesh after
rB5f8969bb4b4, which removes the need for this function.
Since it's only two lines, avoiding the use of a separate function
in this case is simpler.
2021-07-31 14:26:01 -04:00
2f63303e25 Cleanup: Use const mesh arguments
These functions do not change their source or input mesh,  so it can
be passed with const, which means in one case that a function doesn't
have to be responsible for freeing its argument mesh, which is a clearly
better separation of concerns.
2021-07-30 23:26:35 -04:00
8063f10166 Cleanup: Remove unused includes 2021-07-30 22:28:25 -04:00
37e2fec090 Cleanup: Voxel remesh function naming
- Remove BKE prefix for static functions
- Make specific intermediate functions static
- Avoid unecessary "_to_mesh_nomain" suffix
2021-07-30 22:18:44 -04:00
7c961e716d LineArt: Fix(unreported): Child object respect collection visibility. 2021-07-31 10:02:47 +08:00
524908146c Cleanup: Reorder functions
The Quadriflow remeshing was in the middle of the voxel remesh code.
2021-07-30 21:51:47 -04:00
d91c266986 LineArt: Material flag versioning correction.
By the patch made it in master the version value already advanced (see https://developer.blender.org/D11839), so this versioning code needs to be moved down to that point.
2021-07-31 09:29:39 +08:00
e9dc6a0e09 UI: Show a notification when saving preferences
So far the only way to know if they were saved properly was
to check the terminal.

Also notify when preferences fail to save.
2021-07-31 03:15:10 +02:00
35894dc700 Cleanup: Simplify logic, follow style guide for integer types
- Use `int` instead of `unsigned int` for mesh indices
- Use C++ types (Array, float3, IndexRange)
- Use range based for loops
2021-07-30 15:08:43 -04:00
54bd5efa68 Fix build error in debug builds and uninitialized structs
This BMesh iterator hadn't been used in C++ code yet, and needed
a macro for a proper cast. The parameter structs need to be initialized
when declared without designated initializers.
2021-07-30 14:28:55 -04:00
549e2b7539 Compositor: Buffer iterators tests
See D11882 for a description of the iterators.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D12001
2021-07-30 20:20:27 +02:00
d2675c3c5d Cleanup: unneeded default constructor definitions 2021-07-30 20:20:27 +02:00
5762e7a679 Compositor: Fix wrong number of threads during constant folding
The variable was uninitialized at that point of execution.
2021-07-30 20:20:27 +02:00
4dbf4eb100 Assets: Rename "Mark Asset" operator to "Mark as Asset"
This naming change was agreed on during the asset workshop. See
https://code.blender.org/2021/06/asset-browser-workshop-outcomes/#terms-definitions.
2021-07-30 20:18:22 +02:00
96fb21f3af UI: Move Mark/Clear asset out of ID Data in Outliner context menu
They are now always shown in the top-level of the Outliner context menu.
Having them in the ID Data submenu was just a hassle to work with, and
often confusing to users - even if technically correct (the asset status
is part of the ID data).

Part of T82680.
2021-07-30 19:41:19 +02:00
a9ea310d30 Cleanup: Move remesh files to C++
This will be helpful for some cleanups I'd like to do, including
removing the unecessary C API for OpenVDB and unifying some
attribute transfer code.
2021-07-30 13:15:01 -04:00
0b10a96474 Assets: Disable File Browser only operators for asset browsing
These operators shouldn't be available in the Asset Browser.

https://developer.blender.org/T83556

Added a comment to each operator poll assignment to explicitly mention
the intention. That should also remind devs to decide if the operator
should apply for both file & asset browsing when copy & pasting operator
definition code.
2021-07-30 19:07:51 +02:00
f7836019b3 Fix incorrect poll function used for file path dropping
The operator to drop file paths into the File Browser was just checking
if there's an active window. This wasn't really an issue since the
operator was only used as drop-operator for the File Browser. But the
operator would show up in the operator search. Plus, for asset browsing,
we'll also have to check the file browsing mode, so the more specific
poll function will be needed.
2021-07-30 19:07:51 +02:00
9ac782b823 Fix EGL version being printed on every startup
After the switch to enable EGL over GLX. No need to print this debugging
information always.
2021-07-30 18:44:26 +02:00
c1ec2e9d5f Cleanup: compiler warnings 2021-07-30 18:44:26 +02:00
3848507511 Cleanup: clarify license and origin of voronoi and dithering code 2021-07-30 18:44:26 +02:00
b90887da5a Cleanup: Refactor logic of file deletion poll callback
* Early exit instead of complex if-else blocks.
* Avoid iterating over entire file list.
* Use `true`/`false` for boolean values.
* Declare variables in smaller scopes.
2021-07-30 18:42:38 +02:00
3b2a6bf8e8 UI: Don't show Windows file association operator in search on other OSes
The Windows-specific "Register File Association" operator would show in
the search menu of other platforms. Decided to not disable it at
compile-time, like we do it with "Toggle System Console" (another
Windows-only operator), because that would require workarounds for the
translation tools. Instead the operator poll function always returns
false on unsupported platforms now.
2021-07-30 16:43:05 +02:00
3316e28418 Preferences: Move "Register File Association" to preferences level
The operator was register as a "file" operator, which are by convention
used for File Browser operators only. Move it to the "preferences"
operators, where it's displayed in the UI too.
2021-07-30 16:25:34 +02:00
e7e9364d23 Cleanup: remove disabled code from property lookup
This allowed custom ID-properties to share a name-space
with regular properties which won't work well as the names may collide.
2021-07-31 00:23:23 +10:00
4c3d4ebefc Cleanup: remove redundant ifdef check
The define that was tested no longer exists.
2021-07-31 00:15:23 +10:00
eb2a6f454b Fix T90318: Dragging asset while Asset Browser is still loading crashes
This partially reverts cb0b017d8f: We can't store the asset handle in
the drag data, because the file pointer it wraps may be freed as the
Asset Browser generates its file list.
2021-07-30 15:54:54 +02:00
4647ffd918 Cleanup: Remove unused file description storage
This isn't used at all in the current File and Asset Browser design.
2021-07-30 14:34:33 +02:00
c8b7745172 Cleanup: headers, use 'pragma once', remove argument to '\file' 2021-07-30 22:29:30 +10:00
5aa45c43f2 Cleanup: missing leading '*' from comment blocks 2021-07-30 22:20:31 +10:00
88e774aa34 Cleanup: workaround for unstable formatting in clang-format
Running multiple times would re-indent differently.
2021-07-30 21:56:14 +10:00
Flix
a787bcbf5c Fix: script.reload() operator reloads current app template
Ref D12040
2021-07-30 21:43:22 +10:00
James Monteath
8796a2827f Update REAME.md file 2021-07-30 13:40:48 +02:00
b98735ec29 Kernel: include header file in BKE_appdir.h defining size_t
In `BKE_appdir.h`, include `<stddef.h>` as that defines `size_t`. This
follows the "include what you use" principle, and makes it possible to
use `BKE_appdir.h` without having to bother with its dependencies.

No functional changes.
2021-07-30 13:16:14 +02:00
020431408f Cleanup: limit scope of temporary variables
Also remove early return as it duplicates cleanup calls.
2021-07-30 16:44:39 +10:00
93eb460dd0 Cleanup: clang-format (re-run after v12 version bump) 2021-07-30 16:19:19 +10:00
f81a6a2ff1 Cleanup: spelling in comments 2021-07-30 16:16:38 +10:00
63f7eceb53 PyAPI: defer freeing existing properties on registration
Registering a property could remove the existing property,
then fail to parse one of the arguments of the new property -
leaving the struct without a property.

Now freeing the existing property is deferred until immediately
before the new property is registered.
2021-07-30 16:04:08 +10:00
d06b03f80d PyAPI: include the property name & type in registration errors
This gives useful context in errors,
also remove newline endings from exceptions.
2021-07-30 16:04:00 +10:00
9764d90fda Cleanup: use pyrna_enum_value_parse_string parser for enum args 2021-07-30 16:03:56 +10:00
228edcaedd Cleanup: bpy.props variable names
- Use `default` instead of `def` abbreviation.
- Rename `BPYPropArrayLength` to `BPyPropArrayLength`
  in keeping with other local structs.
- Remove _PyArg_Parser.fname value accidentally left in
  (harmless as it's not used).
2021-07-30 16:03:52 +10:00
a2b8dad469 PyAPI: support accessing the original value for RNA enum parsing
Needed in siturations when the input argument is needed for exception messages.
2021-07-30 16:03:47 +10:00
ddcb6b1023 Cleanup: replace macros with converter callbacks for bpy.props
Macros were used for expanding shared logic for some properties.

Replace this with Python converters & a funciton that handles
deferred registration.

Add generic converter functions for RNA enums:

- pyrna_enum_value_parse_string
- pyrna_enum_bitfield_parse_set
2021-07-30 11:57:43 +10:00
5280d4bf0b GPencil: Fix unreported problems painting after import SVG
After doing an import, the bounding box of the stroke was not calculated and any operation related to brushes (Sculpt, Weight Paint and Vertex Paint) was not working as expected because the bounding box of the stroke was wrong.

This problem was solved automatically after any edit operation, but must be solved in the import process.
2021-07-29 22:30:48 +02:00
8f05520083 Fix T89213: Some modifier properties have wrong subtype
This commit resolves these RNA warnings:
```
offset: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65536' matches no enum in 'FloatProperty', 'offset', 'subtype'
project_limit: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65536' matches no enum in 'FloatProperty', 'project_limit', 'subtype'
falloff_radius: "", WARN (bpy.rna): ...\source\blender\python\intern\bpy_rna.c:1505 pyrna_enum_to_py: current value '65567' matches no enum in 'FloatProperty', 'falloff_radius', 'subtype'
```
2021-07-29 17:16:08 -03:00
0b18a618b8 GHOST/X11: enable EGL
This will replace GLX with EGL for X11. GLEW does not support GLX and EGL
at the same time. Most distributions build GLEW with GLX support, so we
have to use the externally provided GLEW and build with EGL support.
This effectively sets WITH_SYSTEM_GLEW to OFF for all Linux configurations.

Differential Revision: https://developer.blender.org/D12034
2021-07-29 17:39:55 +01:00
c7b12e31e6 Fix T89976: Mirror Keys By Value performs wrong scale conversion
In the graph editor, Mirror Keys by Value would convert the value to mirror
over, to account for different units for linear & rotational properties.
The conversion was done in the different direction, though, resulting in
values that were too large by a factor of (180/pi)^2.
2021-07-29 18:34:10 +02:00
cae18abef4 deps/win: Remove media foundation dep for ffmpeg
This caused a blender load error on windows N,
given we do not use these codecs they can safely
be disabled.

This will fix T90200 once the new libraries are
in SVN
2021-07-29 10:21:43 -06:00
8f12457c25 Fix T90295: inconsistent render pass order between Cycles and Eevee 2021-07-29 17:59:03 +02:00
0b0c2901f6 Render: remove unused Blender Internal view layer settings
These should have been removed earlier but were forgotten.
2021-07-29 17:59:03 +02:00
646f7ef73c Render: disable Z pass by default, leave only Combined
It was somewhat arbitrary to have this one pass enabled that adds a bit of
additional memory and render time overhead, even though it's not necessarily
more important than others.
2021-07-29 17:59:03 +02:00
2d3e5eda3f Assets/UI: Resolve major asset view UI template limitation
Before this, all asset view templates showing the same asset library
would show the same assets, even if they should show different ID types.
That was a major limitation since the design did forsee that this
template can be put anywhere in the UI to display various sub-sets of
assets.

Initially I did the ID type filtering close to the asset-list reading,
because I wanted to optimize reading so that we would only actually read
asset information from disk of the ID type to be shown. But this will be
quite complex and I'm not sure if I'll get to work on this anytime soon.
So this commit moves the filtering to the template display level solving
this limitation.

Note: This also adds the code to filter by tags, together with the ID
type. But it's not actually used anywhere yet.
2021-07-29 17:35:06 +02:00
8cb4e3d046 Cleanup: Remove unnecessary code for asset view UI template
From what I can tell there is no reason anymore to do this. The design
has changed since this was added.
2021-07-29 17:35:06 +02:00
49c0b9ec43 Assets/UI: Sanity check argument for UILayout.template_asset_view()
Was already doing some sanity checks, but wasn't checking if the passed
property actually is a collection property, which is important.
2021-07-29 17:35:06 +02:00
5be54cce36 Cleanup: Pass asset handle to asset iterator, rather than wrapped file
This iterator was introduced before `AssetHandle` existed, so it was
dealing with the file data directly. Now we want as little code as
possible to deal with the file data, all access should happen via the
`AssetHandle`.
2021-07-29 17:35:06 +02:00
b361b2f214 Cleanup: Consistent indent style for asset CMakeLists file
Was mixing 4 and 2 space indent in a single file.
2021-07-29 17:35:06 +02:00
33322086f6 install_deps: update OIDN to 1.4.1, and ISPC to 1.16.0.
Ref. T88438.
2021-07-29 17:00:49 +02:00
ceec7cabf5 install_deps: Update OSL to 1.11.14.1.
This has been a huge pain to get working, for several reasons (new flags
needed, patching is now mandatory, etc.).

Further more, discovered that debian OIIO package is now silently
relying on OpenCV, without even proper handling of this dependency (at
least in the `-dev` package), so had to revert to force-build own OIIO
again on that distro for the time being.

Ref. T88438.
2021-07-29 17:00:48 +02:00
b60e72100b Cleanup: OSL buildlib patch: Remove .rej part.
This patch contained changes for an `.rej` rejection file generated by
failed patch apply... Definitly nothing to do here.
2021-07-29 17:00:48 +02:00
21b4799793 install_deps: Update OIIO to 1.1.15.1.
Ref. T88438.
2021-07-29 17:00:48 +02:00
bd2bfa469f install_deps: Update llvm to 12.0 (with minimal now being 11.0).
Ref T88438.
2021-07-29 17:00:48 +02:00
12d93e44d0 Install_deps: add flex dependency.
Was already installed on Debian-like and Fedore/Suse actually, now also
explicitely required on Arch and listed in docs.

Ref. T88438.
2021-07-29 17:00:48 +02:00
4d28703277 Install_deps: Add zstd dependency.
Ref T88438.
2021-07-29 17:00:48 +02:00
Germano Cavalcante
1775c39986 Fix 'BLI_task_parallel_mempool' keeping 'user_chunk' unchanged
When `BLI_task_parallel_mempool` does not use threading, the
`userdata_chunk` is allocated locally simulating a TLS.

However `func_reduce` is not called so the original chunk is ignored.

`task_parallel_iterator_no_threads` is another function that doesn't call
`func_reduce`. It also ignores `userdata_chunk_local` in the main iterator.

The solution in these cases is not to create a `userdata_chunk_local`.

This fixes T90131

Differential Revision: https://developer.blender.org/D12067
2021-07-29 11:37:10 -03:00
0f1c84f171 deps: Reduce llvm/clang footprint for windows
We shipped the whole bin folder for llvm/clang
while we only needed clang-format, by shipping
just the bits we need we save about 700 megabytes
off our svn lib download.
2021-07-29 07:45:38 -06:00
cafb1bc47f Data-block Preview: Create preview using current frame
The preview was always using frame 1, but maybe the object has changed and it's better create preview using the current frame.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12018
2021-07-29 15:08:12 +02:00
24ba931f40 Cleanup: Remove debug-only code 2021-07-29 14:46:54 +02:00
810c88b5f1 Fix building without Cycles logging
Ideally can use assert() checks instead of suppressing the check entirely,
but for now just fix compilation error quickly.
2021-07-29 14:32:10 +02:00
3f84f0123e Cleanup: Fix build warning
Introduced in 3964785a14
2021-07-29 13:11:55 +02:00
jim man
9cc8d50a04 cleanup: editor_image : Remove unused draw functions
These functions are unused currently..

Reviewed By: deadpin, jbakker

Differential Revision: https://developer.blender.org/D11968
2021-07-29 12:46:24 +02:00
5116b7a4c2 Fix Cycles crash with fluid object motion blur disabled
Motion attributes expects mesh to have non-zero number of motion steps,
which was violated in the case when fluid mesh had motion blur disabled.

This is a bit of annoying fix, because of the order of updates. More
ideal solution would be to handle cached and fluid velocities in the
sync_mesh_motion() which ensures all the dependencies between settings.
2021-07-29 12:28:46 +02:00
0491052a96 VSE: Change grid line drawing
Add overlay option to disable grid drawing.
Reuse drawing code from other editors (timeline editor)
Add argument `display_minor_lines` to function
`UI_view2d_draw_lines_x__discrete_frames_or_seconds`
This way minor line drawing can be disabled and so it doesn't cause
too much visual noise. Also spacing seems to be too fine, so VSE uses 3x
what is defined in preferences.

Reviewed By: fsiddi, Severin

Differential Revision: https://developer.blender.org/D11790
2021-07-29 11:38:43 +02:00
5c9979ff03 VSE: don't snap by default
Snapping by default goes against convention, so this setting was
re-evaluated. Also snapping by default can conflict with new image
transform system, see T90156

There wasn't consensus, so disable snapping by default to follow
established convention.

ref T89665

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12054
2021-07-29 11:38:43 +02:00
3964785a14 UI: Fix time labels drawing
Calculate frequency of time/frame label drawing, such that labels have
at least 10px margin and don't overlap.

Change timecode format:
- Use at least `mm:ss` format
- Don't display frames if all labels would end with +00

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D11792
2021-07-29 11:38:43 +02:00
a70f37bd8a Fix T89952: GPencil channel box selection offset
The channel box selection was offset for grease pencil layers.

This is a proposed fix by @yann-lty

Before:
{F10227973}

After:
{F10227974}

Reviewed By: #grease_pencil, antoniov

Maniphest Tasks: T89952

Differential Revision: https://developer.blender.org/D11962
2021-07-29 10:42:05 +02:00
d5fd09ab58 Fix memory leaks in Python gizmo get/set handlers 2021-07-29 14:32:25 +10:00
3c50687073 Fix gpu.types.GPUTexture crash when the size argument was too big
Missing length check on the size argument before copying it
into a fixed size buffer.
2021-07-29 14:11:37 +10:00
fd0b2b8dfd Cleanup: use PyC_AsArray_FAST function where possible
Oversight in 2453dc1b0e.
2021-07-29 13:41:48 +10:00
bc0a7d3fae PyAPI: support multi-dimensional arrays for bpy.props vector types
- Multi-dimensional boolean, int and float vector types are supported.
- A sequence of int's for the "size" is used to declare dimensions.
- Nested sequences are required for default arguments.

Now it's possible to define matrix properties, for e.g:

  bpy.props.FloatVectorProperty(size=(4, 4), subtype='MATRIX')
2021-07-29 11:09:21 +10:00
2453dc1b0e PyAPI: add multi-dimensional array conversion utility functions
Add array conversion functions that take dimension arguments.

- PyC_AsArray_Multi (version of PyC_AsArray).
- PyC_Tuple_PackArray_Multi_* (version of PyC_Tuple_Pack_*).
2021-07-29 11:04:33 +10:00
0358951b9e Cleanup: spelling 2021-07-29 10:52:08 +10:00
8aa1c0a326 Fix T75028: Improved Font Names in File Manager
When viewing font files in the File Manager, this patch uses the font's
family and style names to show the same type of string shown to users
in operating system lists. For example "Book Antiqua Regular" instead
of "BKANT.ttf"

see D12020 for details and examples.

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

Reviewed by Campbell Barton and Julian Eisel
2021-07-28 11:16:04 -07:00
073bf8bf52 Cycles: remove WITH_CYCLES_DEBUG, add WITH_CYCLES_DEBUG_NAN
WITH_CYCLES_DEBUG was used for rendering BVH debugging passes. But since we
mainly use Embree an OptiX now, this information is no longer important.

WITH_CYCLES_DEBUG_NAN will enable additional checks for NaNs and invalid values
in the kernel, for Cycles developers. Previously these asserts where enabled in
all debug builds, but this is too likely to crash Blender in scenes that render
fine regardless of the NaNs. So this is behind a CMake option now.

Fixes T90240
2021-07-28 19:27:57 +02:00
3bf9675849 Cleanup: Remove unnecesary undefs
Macros `SEQ_ALL_END` and `SEQ_ALL_BEGIN` no longer use `seq->tmp`.
Therefore they are safe to use regardless from where they are called.
2021-07-28 18:16:48 +02:00
40ef71f465 Assets: Improve error message when "Clear Asset" fails
When using "Clear Asset" from the Asset Browser but with an asset
selected that is not stored in the current file, we can show a more
informative error message.
2021-07-28 18:05:25 +02:00
0088b412ff VSE: Fix audio not recalculated
Changing strip offsets with RNA properties didn't tag depsgraph to
update for new strip start/end points.
2021-07-28 17:45:22 +02:00
08154d237f Cleanup: VSE cache invalidated twice
Multiple RNA update function invalidated cache twice.
2021-07-28 17:20:23 +02:00
Wannes Malfait
b304616f2a Fix T90221: geometry viewer node links to other socket types
The viewer node in geometry node trees only supports geometry nodes.
This patch ensures that when ctrl shift clicking on a node, it will only
link to geometry sockets.

Differential Revision: https://developer.blender.org/D12055
2021-07-28 15:54:17 +02:00
3db37075f6 Remove the code in BKE_collection_move to preserve LayerCollection flags.
This code was actually buggy (forcefully re-enabling excluded layers in some
cases).

Further more, it should not be needed now that layerCollection resync code
reuses as much as possible existing layers instead of deleting and
re-creating them all the time.

Differential Revision: https://developer.blender.org/D12016
2021-07-28 15:51:06 +02:00
b18d0244fc LayerCollection: Refactor of resync-with-Collection-hierarchy process.
The goal of this refactor is to improve resync of LayerCollections
hierarchy to match again Collection one.

Current code would destroy and re-create valid layers whenever a parent
collection would be removed, which leads to losing way too often
layer-related settings when editing collection hierarchies.

While this could be partially addressed from operators side, there was
no way to fix those issues from lower level, more generic ID management
code like ID remapping or library override resync processes.

The new code builds a shallow wrapper around existing (aka old) layers
hierarchy, does a set of checks to define the status of all existing
layers, and try to find the closest matching unused layer in cases where
layers and collections hierarchies do not match anymore.

The intent is to both re-use as much as possible existing layers, and
to pick the 'best' possible layer to re-use, following those heuristics:
 * Prefer layers children of current one first (in old hierarchy), and only
   use those from other higher-level hierarchies if no (grand-)child is found.
 * Prefer to use closest layers available in the old hierarchy.

NOTE: The new code is about 12%-15% slower than the previous one, which is
expected given the increased complexity. Note that this would not be an
issue in practice if this code was not called way too often (needs to
be converted to lazy update instead, which is a long known TODO).

NOTE: The LayerCollectionResync code uses its own built-in version of
FIFO queue, as performances in this code is currently a critical point
(it can get called tens of thousands of times during a single (heavy)
ID management operation currently, in a production file e.g.).

Differential Revision: https://developer.blender.org/D12016
2021-07-28 15:51:06 +02:00
Wannes Malfait
31fcb934a4 Fix T89415: update multi input indices after deleting a node
When deleting a node, links attached to that node are deleted, but if one
of those links was connected to a multi input socket, the indices of the
other links connected to it were not updated. This adds updates both in
the case of a normal delete as well as after a delete with reconnect.

Differential Revision: https://developer.blender.org/D11716
2021-07-28 15:43:24 +02:00
f9308a585e Fix particle system duplication duplicates all systems
Followup to rB3834dc2f7b38 (where getting the proper particle system was
fixed for the Adjust Last Operation panel in the Properties Editor). But
since this operator can also be called from the 3DView, get a current
particle system there as well.

Without this, _all_ particle systems would be copied when executing from
the 3DView (which was never really intended [operator description uses
singular] -- it just happens to use `copy_particle_systems_to_object`
internally as well -- same as the `Copy Active/All to Selected Objects`
operators)).

ref. T83317

Maniphest Tasks: T83317

Differential Revision: https://developer.blender.org/D12033
2021-07-28 15:06:35 +02:00
dfc597202f Fix T90154, T90213: curve issues since recent cleanup commit
Caused by {rB8cbff7093d65}.

Since above commit only one modifier would get calculated and the
displaylist boundingbox was calculated wrong.

Maniphest Tasks: T90154

Differential Revision: https://developer.blender.org/D12037
2021-07-28 14:59:50 +02:00
7d0765cbdc Fix menu poll function being ignored for UILayout.menu
Using `UILayout.menu()` [1] or `UILayout.menu_contents() [2], the menu
would just always be added, the `poll()` check not being executed. As
API user I would expect the `poll()` to deterimine visiblity of the
menu.

[1] https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.menu
[2] https://docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.menu_contents

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

Reviewed by: Campbell Barton
2021-07-28 14:44:45 +02:00
8e9d06f5a0 LineArt: Camera Overscan
Expand camera effective region to a portion beyond image frame so strokes won't end right at the border.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D12049
2021-07-28 19:55:29 +08:00
544ddcdaac Fix (studio-reported) liboverride resync crash after recent changes.
Recent own rBabf3ce811f6e prevented any LayerCollection update during
the whole liboverride resync process, for both performances and feature
reasons.

However that means that the various runtime caches like the Base GHash
are not cleared anymore during ID remapping process, so we need to call
`BKE_main_collection_sync_remap` instead of `BKE_main_collection_sync`
when we finally are ready for this update.

Reported by @eyecandy (Andy Goralczyk) from Blender studio, thanks!
2021-07-28 12:33:16 +02:00
91dd1a1ba3 VSE: Add tooltips for add_effect_strips operator
This patch adds propper tooltips to the effect strips in the "Add" menu.
Note that not all effect strips are actually in the "Effect Strips"
submenu like color strips, text strips or transitions. For these types
of effect strips, a dediacted tooltip is especially useful.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D11714
2021-07-28 10:16:43 +02:00
ce68888d1b Cleanup: reduce indentation in bpy.props
Remove unnecessary NULL checks.
2021-07-28 13:38:35 +10:00
f5cc348610 VSE: Draw strips transparent during transform overlap
While transforming a strip, draw the background semi-transparent
if it overlaps with another strip. It's convenient to see what's
underneath, especially with the upcoming Overwrite feature.

Thanks to @iss for the help and review.
2021-07-27 20:14:22 +02:00
ae034d27d2 Deps: ensure osl/bin/oslc is using static libpng
Pass `-DLINKSTATIC=ON` to the OSL CMake, to ensure it statically links to
our libpng. Previously this was only applied on Windows, it's now on all
platforms.
2021-07-27 19:49:29 +02:00
7e91a60be6 Add StringRef::trim() functions
Add three functions that trim characters from the front & end of a
`StringRef`. All functions return a new `StringRef` that references a
sub-string of the original `StringRef`.

- `trim(chars_to_remove)`: strips all characters from the start and end
  that occur in `chars_to_remove`.
- `trim(char_to_remove)`: same, but with a single character to remove.
- `trim()`: remove leading & trailing whitespace, so same as
  `trim(" \r\n\t")`

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D12031
2021-07-27 19:49:29 +02:00
c6ba7359ae Fix LLVM 12 symbol conflict with Mesa drivers, after recent Linux libs update 2021-07-27 17:45:17 +02:00
f4abd3cfc4 Fix LibOverride crashing in some cases where reference linked data gets MIA.
When the root of an override hierarchy disapears, there is no way to do
a proper resync, just abort.

Reported by studio, thx.
2021-07-27 17:41:15 +02:00
Himanshi Kalra
4a02b9ffeb Regression Testing: Running tests based on blend files
Runs tests based on blend files with minimum python interaction.
Developed as part of GSoC 2021 - Regression Testing of Geometry Nodes.
Earlier, tests were built from scratch by adding a modifier/operation
from the Python API.
Now, tests can also be created inside blender and are compared using
Python script.

Features: Automatically adding expected object if it doesn't exist.
This patch adds tests for the following Geometry Nodes category:
* Curves
* Geometry
* Mesh
* Points

The implemented UML diagram for refactoring of mesh test framework.
{F10225906}

Technical Changes:
SpecMeshTest: It adds the modifier/operation based on the Spec provided.
BlendFileTest: It applies already existing modifier/operation from the blend file.

Test folders hierarchy with tests. This folder should be extracted to `lib\tests\modeling`
{F10240651}
Note: The `geometry_nodes` folder might lie under another `geometry_nodes` folder while extracting, please double check. Use the inner-most one.
The hierarchy should be:
-`lib\tests\modeling\geometry_nodes\mesh`
-`lib\tests\modeling\geometry_nodes\points`
and so on.

* From `ctest` the tests should be run as `ctest -R geo_node -C [Configuration]` on Windows.
* Each single test can be run with its entire name e..g `ctest -R geo_node_geometry_join_geometry`.(just an example). Run `ctest -N -R geo_node` to see all tests.
* From blender, the tests can be run `blender -b path\to\blend\file --python path\to\geo_node_test.py`

Reviewed By: zazizizou, JacquesLucke

Differential Revision: https://developer.blender.org/D11611
2021-07-27 21:01:15 +05:30
d6d44faff0 Fix memory leak with Python RNA property get callback errors
Failure to return a list of the expected size & type wasn't
decrementing the value, leaking a reference.

Caused by 127b5423d6 a workaround for the
real error that was fixed f5e020a7a6.
2021-07-28 01:12:26 +10:00
Charlie Jolly
766e67e55d Geometry Nodes: Add node labels to Attribute maths nodes
This adds the operator name to the node label which is consistent with the shading nodes.
The vector node has `Vector` as a prefix.

The Attribute nodes already have a different coloured header.

The same label is used when collapsing nodes, this helps readability.

Reviewed By: pablovazquez

Differential Revision: https://developer.blender.org/D10749
2021-07-27 14:34:08 +01:00
07688ca2d2 Added YAML builtbot config file.
Builtbot is switching over from json to yaml. Both
configuration files should be kept in sync for now.

The json file will be removed when everything works as expected.
2021-07-27 15:06:43 +02:00
db4fe8e322 BlenRead: Add GHash-based search for already read linked IDs.
Ths commit adds a new `IDNameLibMap` to `Main`, used during file reading
to quickly find already read linked IDs.

Without that, search would use string-based search over list of linked
data, which becomes extremely slow and inneficient in cases where a lot
of IDs are linked from a same library. See also {T89194}.

Extrem-usecase reported in T89194 is now about 4 times faster in linked
data reading (about 2 times faster for the whole .blend file loading).

More normal cases (like Sprites studio production files) have barely
measurable speed improvements, a few percents at best.

NOTE: `main_idmap` API was extended to support insertion and removal of
IDs from the mapping, avoids having to re-create the whole thing several
time during libraries expansion in readcode.

Differential Revision: https://developer.blender.org/D11757
2021-07-27 14:53:49 +02:00
e37c876cd7 PyAPI: support different int sizes for PyC_AsArray 2021-07-27 22:38:50 +10:00
58eacb8e7c Cleanup: pass sizeof array element to PyC_AsArray
Replace the is_double argument which was only used for single/double
precision floats.

This allows supporting different sized int types more easily.
2021-07-27 22:36:01 +10:00
b1a2abd6b2 Fix missing passes update on Use Denoising change
Makes it so Render Layers node in the compositor is updated as soon
as Use Denoising is changed for the final render.

Differential Revision: https://developer.blender.org/D12010
2021-07-27 11:48:14 +02:00
c5e5ac4a17 Deps builder: OIIO/OSL/ISPC/OIDN/LLVM/Flex updates
This diff somewhat snowballed out of updating OIDN to 1.4.1 it had some
changes that allowed us to remove the arm hacks we had in place and
revert to using identical versions for a whole bunch of deps. But that
required an update to ISPC which needed a newer LLVM and if we're
updating LLVM we may as well update OSL, and when we update OSL, OIIO
may as well be dragged in soo......anyhow...

This diff updates:

LLVM 9.0.0 (11.0.1 for mac/arm) -> 12.0.0
OIIO 2.1.15.0 -> 2.2.15.1
OSL 1.11.10.0 -> 1.11.14.1
winflex_bison 2.5.5-> 2.5.24 (ispc needed newer bison, windows only dep)
OIDN 1.4.0 -> 1.4.1
ISPC v1.14.1(random hash for mac/arm) -> v1.16.0
Flex 2.6.4 (ISPC needed newer Flex than available on CentOS 7)

and removes most of the "special arm/mac" versions. I think just ssl and
embree are left with special versions.

notable changes:
@LazyDodo included some clang headers in the linux/mac harvest which are
needed to start writing custom clang based tooling like D9465 these were
already shipping on windows, but not the other platforms.

[macOS] Change the `LC_ID_DYLIB` of OpenMP  for {D11997}. This changes
where the executables look for dylibs.

Reviewed By: sebbas, LazyDodo

Differential Revision: https://developer.blender.org/D11748
2021-07-27 10:15:31 +02:00
5a07174ce3 Cleanup: add note from T85517 fix 2021-07-27 18:14:08 +10:00
b331acf477 Cleanup: comment spelling & punctuation 2021-07-27 18:06:29 +10:00
675d8a9c43 LineArt: Occlusion accuracy fix.
This patch fixes occlusion function to handle one specific case (when an edge shares a point with triangle) better,especially when there's overlapping edges in this case.
2021-07-27 14:02:34 +08:00
Aaron Carlisle
6ee14c966d Anotations: Fix a several issues with stroke placement
Previously, this option was not exposed in the UI, only for the clip editor.
There were also multiple rna properties that did the same thing for each of the 2D editors.

There was also an issue where the property enum items were the same as the 3d view which didnt make much sense.

Reviewed By: antoniov

Differential Revision: https://developer.blender.org/D12027
2021-07-26 18:53:30 -04:00
05315af81d Fix compile error on macos introduced in last commit
std::optional::value() is not available on macos.
2021-07-26 22:44:56 +02:00
Christoph Lendenfeld
6a903d9088 Fix: Instantly hide bones after hitting H key in pose sliding
When using a pose slider it is possible to hide bones with the 'H' key.
Before this patch the screen didn't update, so you had to move the mouse 1 pixel to update.
This patch makes it so it updates right away

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D12024
Ref: D12024
2021-07-26 21:42:04 +01:00
a4a72bffd3 Compositor: Full frame Box Mask node
Adds full frame implementation to this node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11627
2021-07-26 21:43:30 +02:00
e33814ef6b Compositor: Full frame Levels node
Adds full frame implementation to this node operations.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11749
2021-07-26 20:13:55 +02:00
883fb49d4f Compositor: Fix memory leak when exporting operations on debug 2021-07-26 20:13:03 +02:00
a117794f8c Compositor: Full frame Scale node
Adds full frame implementation to this node operations.
No functional changes.

Includes a new operation method `init_data` used to initialize any data
needed after operations are linked and resolutions determined.
Once tiled implementation is removed `initExecution` may be renamed
to `init_rendering` and `init_data` to `init_execution`.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11944
2021-07-26 20:13:03 +02:00
cf74cd9367 Cycles: upgrade CUDA to 11.4
This fixes a performance regression on Ampere cards, on specific scenes like
classroom. For cycles-x there is little difference, but this is still helpful
for LTS releases, and we need to upgrade at some point anyway.
2021-07-26 19:46:51 +02:00
Nikhil Shringarpurey
6eb94d8df2 Cleanup: fix compiler warnings due to implicit cast
Differential Revision: https://developer.blender.org/D11950
2021-07-26 18:04:40 +02:00
22b03e1c68 Fix Python error in benchmark executable detection after recent changes 2021-07-26 18:04:40 +02:00
abf3ce811f LayerCollections: Add a way to prevent their resync with Collection hierarchy.
This is an easy & safe, yet not-so-nice way to address the
LayerCollections vs. Collections hierarchy resync problem.

Currently this resync is enforced everytime something changes in the
Collections hierarchy, which is extremely inneficient, and can even
produce 'loss' of LayerCollection data during complex Collection
processes.

Current example is during Library Overrides resync process. New code:
 * Makes resync significantly faster (between 10 and 15%).
 * Fixes 'disappearing' layer collections settings on sub-collections'
   layers.

NOTE: This is not a proper fix for the underlying issue. However,
implementing and testing the 'lazy update' solution as proposed by
{T73411} requires a significant amount of time (especially in testing
and tracking all places where code would need to ensure LayerCollections
are up-to-date), which is not possible currently.

Differential Revision: https://developer.blender.org/D11889
2021-07-26 17:36:46 +02:00
cee67f3be2 Cleanup: Fix compiler warning in previous commit 2021-07-26 17:25:56 +02:00
a14ee85ccd Fix T90127: Merge Down layer doesn't take the transform location into account
Now the layer transformation is applied before the merge.
2021-07-26 17:20:00 +02:00
231b313c55 Mantaflow: Remove Noise Type Option
Mantflow only supports wavelet noise, thus the parameter with only one option is no longer useful.

Differential Revision: https://developer.blender.org/D6770
2021-07-26 10:59:49 -04:00
Germano Cavalcante
3059853732 Cleanup: Rearrange mesh extraction files
In the draw module, it's not easy to identify what its header is, and
where the shared functions are.

So move `draw_cache_extract_mesh_extractors.c` and
`draw_cache_extract_mesh_private.h` to the same folder as the extractors
and rename these files to make them more identifiable.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11991
2021-07-26 10:25:39 -03:00
a9121640be macOS Cleanup: Remove old version specific code
Reviewed By: #platform_macos, brecht
Differential Revision: https://developer.blender.org/D12021
2021-07-26 18:39:08 +05:30
14f94fd1ca VSE: Fix snapping bugs
Fix hold offset check causing missing snapping point when strip have
only still frames.

Fix effect strips of transformed strips causing snapping to prevoius
strip positions.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11948
2021-07-26 14:57:13 +02:00
1b53fde9fc Cleanup: missed comment in D12029
No functional change.
2021-07-26 13:25:57 +01:00
71d7505487 Geometry Nodes: Fix vector math project bug
Implementation is incorrect compared to Cycles/Eevee.

Reported by @DrDubosc in comments of T88922.

Differential Revision: https://developer.blender.org/D12029
2021-07-26 13:06:15 +01:00
a0cba9fb95 VSE: Fix truncated label
Label for snapping current frame to strips was cut off and not very readable.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11951
2021-07-26 12:57:48 +02:00
faa65f151d Revert "cmake: enable Wayland by default"
This reverts commit a2ccd0e495.

This change was part of the still-under-review patch D11489, which
hasn't been accepted yet.
2021-07-26 12:18:53 +02:00
c17a266e29 Revert "GHOST/wayland: use Wayland only when 'BLENDER_WAYLAND' is set"
This reverts commit c971c851d3.

This change was part of the still-under-review patch D11489, which
hasn't been accepted yet.
2021-07-26 12:16:42 +02:00
Stefan Werner
1a3cb90e4e Cycles: Fixed memory leak in ColorSpaceManager
Cached OCIO processors were not freed, instead the color spaces were freed twice.

Reviewed By: brecht, sergey

Differential Revision: https://developer.blender.org/D12011
2021-07-26 11:45:29 +02:00
12afb19959 Cleanup: clang tidy 2021-07-26 11:43:51 +02:00
Himanshi Kalra
6abf63f463 Fix T85517: Cannot type Space while holding Shift key in text-field like spaces.
Fix for T85517
Bug: Couldn't type space while holding down the shift key in text spaces (e.g. when saving a file, changing the name of object).

Changes: Removing the key combination of Shift + space in `WM_event_is_ime_switch` method.

Reviewed By: harley, mont29

Maniphest Tasks: T85517

Differential Revision: https://developer.blender.org/D10452
2021-07-26 09:33:03 +02:00
501bca9f5b Cleanup: clang-format 2021-07-26 12:41:49 +10:00
828c66f393 Cleanup: spelling in comments 2021-07-26 12:32:42 +10:00
471d4b105a Cleanup: use doxy comments 2021-07-26 12:32:40 +10:00
a77d203932 UI: Line Art: Rename "Baking" panel to "Bake"
Avoid using verbs for panel names, and be consistent with the
"Bake" panel in Cycles, Ocean Modifier, etc.
2021-07-26 00:03:17 +02:00
0cb25a51de UI: Line Art: Always use Material icon on picker
The Material picker shouldn't change icon based on it's state,
it should always display the Material icon.
2021-07-25 23:59:53 +02:00
6a673b6000 UI: Fix button alignment on Grease Pencil modifiers 2021-07-25 23:57:32 +02:00
8fda1f363a UI: Line Art Modifier: Tweaks to labels and tooltips
- Clearer tooltips for Source Object/Collection.
- Remove redundant Source/Target on labels.
- Always write Grease Pencil with title case.
2021-07-25 23:55:23 +02:00
4886ed2863 Fix T86768, bevel doesn't loop slide sometimes.
Six years ago, Bug T44961 about unwanted spikes had me not do a loop
slide if the angle was too extreme, to avoid unwanted spikes.
The current bug showed that that angle was much too big, and limited
desired behavior in many cases. Changing the angle from 0.25 radians
to 0.0001 radians (about 0.006 degrees) still fixes the original bug
and seems very unlikely to be limiting desired behavior now.
2021-07-25 15:14:37 -04:00
0aad8100ae Fix T89391, etc. Boolean bugs when objects have negative scale.
The old modifier code, now just used for Fast, has code in it to
flip faces of arguments when their tranform's negativity differs
from the main object's transform's negativity.
I had neglected to put that logic in when I made the change that
skipped the round trip through BMesh.
Fixing this means that the results are more what the user expects
when some or all operands have negative scales.
2021-07-25 13:29:45 -04:00
Christoph Lendenfeld
aa32121174 Fix: Remove automatic hiding of bones when using the pose slider
This patch addresses the issue raised in T88340.
When entering a pose sliding operator bones would automatically get hidden.
While technically not a bug it was decided that it is too confusing.
Hiding with 'H' is still possible though, just won't happen automatically

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D11883
Ref: D11883
2021-07-24 21:25:23 +01:00
c971c851d3 GHOST/wayland: use Wayland only when 'BLENDER_WAYLAND' is set 2021-07-24 12:30:14 +01:00
a2ccd0e495 cmake: enable Wayland by default 2021-07-24 12:30:14 +01:00
1029577a51 GHOST/wayland: explicitly delete 'GHOST_SystemWayland' when fallback to X11 2021-07-24 12:30:13 +01:00
05c7d935e7 Cleanup: fix warning -Wparentheses 2021-07-24 19:16:13 +09:00
8fe0aecfde UI: Do not abbreviate/shorten wording
Abbreviations are harder to read and understand thus it is best to be direct.
For example without understanding and context it is hard to know exactly what "Len" means.
2021-07-23 20:46:09 -04:00
ede1ce6e9a GTest: Use INC/INC_SYS for Libmv/OSD tests
This change transitions libmv/osd tests to our
blender_add_test_executable macro that explicitly
takes the include directories as a parameter.

This is in preparation for future clean-up of
global include directories.

Differential Revision: https://developer.blender.org/D12012
Reviewed By: sergey
2021-07-23 16:50:13 -06:00
8031326262 Revert "VSE UX: Make Speed Effect strips more user friendly."
This reverts commit 3123f33380 and
a092baa7f9.
2021-07-23 19:00:13 -03:00
Fredrik Hansson
2beff6197e Weld Modifier: add "loose_edges" option
This improve the cloth modeling workflow by allowing you to weld only the
edges that are used for the sewing forces.

Reviewed By: mano-wii, weasel

Differential Revision: https://developer.blender.org/D10710
2021-07-23 18:52:25 -03:00
3123f33380 Many tweaks to f-curve drawing code 2021-07-23 18:47:07 -03:00
Germano Cavalcante
a092baa7f9 VSE UX: Make Speed Effect strips more user friendly.
**Drawing Changes:**
- F-curve drawing for Stretch, Multiply, Length and Frame Number.
- Value drawing when no keyframes for Stretch, Length and Frame Numbers.

General view of the new drawing for each speed effect mode:
{F9796642, size=full}

Detail of the horizontal zero (blue) line in the new `Multiply` mode:
{F9798520, size=full}

Nice to have (but I don't know how):
- Auto adjusting of endframe when using Multiply or Boost.

Differential Revision: https://developer.blender.org/D6110
2021-07-23 18:47:07 -03:00
5e3d0840a3 PyDocs: Fix syntax errors resulting in warnings 2021-07-23 16:50:10 -04:00
c41b93bda5 XR: Fix for Viewport Denoising Artifacts
Addresses T76003. When using VR with Eevee and viewport denoising,
scene geometry could sometimes be occluded for one eye. Solution is
to use a separate GPUViewport/GPUOffscreen for each VR view instead
of reusing a single one for rendering.

Reviewed By: Julian Eisel, Clément Foucault

Differential Revision: http://developer.blender.org/D11858
2021-07-24 00:12:17 +09:00
eb43477851 Fix T89393: crash when selecting edges when geometry nodes has "on cage" turned on
The core problem is that the geometry nodes modifier sometimes support
"mapping" (i.e. it remembers which new vertices correspond to edit mode
vertices) and sometimes it does not, depending on what the nodes are doing.
Also see rB07ce9910f7cc.

The solution here is that the fallback case in `BKE_mesh_foreach_mapped_edge`
does not call the callback with "invalid" indices.

Differential Revision: https://developer.blender.org/D12007
2021-07-23 16:15:18 +02:00
239a74a130 Fix T90065: disable attribute search in places where there is too little context
Differential Revision: https://developer.blender.org/D12008
2021-07-23 16:13:04 +02:00
6ac378e685 Fix: avoid creating improper rotation matrix
This might change the rotation of some instances after a Curve to Points.
Unfortunately, there is not much we can do about that, the math before
was just wrong. The forward and up axis stayed the same though.

Differential Revision: https://developer.blender.org/D12006
2021-07-23 16:10:03 +02:00
25fc77f46c Fix T89829: wrong active context path check in spreadsheet
The problem was that the modifier was reevaluated all the time, even
between showing the attribute search and clicking on the attribute
name. This freed the data referenced by attribute search. The real bug
here was that the dependency graph was tagged for update even
though nothing changed. This was because the spreadsheet thought
its active context has changed and it wanted to compute the new
value to be shown in the spreadsheet.

The reason for the bug was that I confused how the tree-path of a
node editor works. The second element in the tree path contains
the name of the group node in the root tree that we're in (instead
of the first element).

Differential Revision: https://developer.blender.org/D12009
2021-07-23 16:06:41 +02:00
de2c4ee587 Another slight increase in speed for Delaunay CDT.
When the new "need_ids" flag is false and the output type is not
one of the valid BMesh kinds, there is no need to propagate even
a dummy id to all of the faces.
2021-07-23 08:31:40 -04:00
f23b14091f Cleanup: double spaces in strings 2021-07-23 17:04:21 +10:00
ced94bc11c Cleanup: code comments punctuation / spacing 2021-07-23 17:03:51 +10:00
7ce0d9d791 Cleanup: de-duplicate code for edge-split tagging
Share functionality for single and multi-threaded edge-split tagging.

Remove logic that ensured vert & loop indices in bm_mesh_edges_sharp_tag
(missing from fd9fc809b7).
2021-07-23 16:40:51 +10:00
36c0649d32 XR: Reference Space Improvements
Improves control over the XR reference space by using the stage ref
space (user-defined tracking bounds) instead of local ref space
(position at application launch), if available. Also adds an
"absolute tracking" session option to skip applying eye offsets that
are normally added for placing users exactly at landmarks.

By enabling absolute tracking, users can define the tracking origin
in a way that is not linked to the headset position. Instead, the
tracking values given by the XR runtime are left unadjusted and a
user can manually calibrate an "origin" landmark object to adjust to
their real world space.

Can be useful for applications that use external tracking systems
and those that primarily only need to use controllers and not the
headset (e.g. motion capture).

The absolute tracking option requires an update to the VR
Scene Inspection addon to be accessible by regular users.

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D10946
2021-07-23 14:54:56 +09:00
66548007a8 Cleanup: "position tracking" typo in enum member 2021-07-23 14:54:24 +09:00
eea65cbd42 Cleanup: remove unused BM_mesh_loop_normals_update function
The only difference with BM_loops_calc_normal_vcos was passing in
custom coordinates which may be NULL.
2021-07-23 15:10:59 +10:00
66dfef10a7 Fix error setting sharp edges in recent normal calculation changes
bm_mesh_edges_sharp_tag was called with setting sharp edges enabled.
Error in 39b2a7bb7e.
2021-07-23 15:02:04 +10:00
fd9fc809b7 Cleanup: remove normal assignment from bm_mesh_edges_sharp_tag
This was added in 0b7f581397
but seems not to be needed as the assignment was never correct
since only one corner on either side of the smooth edge had the
vertex normal written to it.
2021-07-23 14:36:40 +10:00
39b2a7bb7e Edit Mesh: multi-thread auto-smooth sharp-edge calculation
Merge the sharp edge tagging into bm_mesh_loops_calc_normals,
this has the advantage that edge tagging can be performed as part of
walking over each vertices edges - instead of tagging in a separate loop.

Even though this will tag edges twice (once for each vertex),
the computation isn't heavy as it's only calculating a dot-product
between the two face users to compare the angle.

This change combined with 4ba06ad0a8
makes BM_loops_calc_normal_vcos around 5.68x faster,
with an overall speedup over 2.6x when transforming a high poly mesh.
(tested on a system with 32 cores).

Reviewed By: mont29

Ref D11970
2021-07-23 12:55:58 +10:00
4ba06ad0a8 Edit Mesh: multi-thread auto-smooth & custom normal calculations
Supported multi-threading for bm_mesh_loops_calc_normals.

This is done by operating on vertex-loops instead of face-loops.

Single threaded operation still loops over faces since iterating
over vertices adds some overhead in the case of custom-normals
as the order used for accessing loops must be the same as iterating
of a faces loops.

From isolated timing tests of bm_mesh_loops_calc_normals on high
poly models, this gives between 3.5x to 10x speedup,
with larger gains for meshes with custom-normals.

NOTE: this is part one of two patches for multi-threaded auto-smooth,
tagging edges as sharp is still single threaded.

Reviewed By: mont29

Ref D11928
2021-07-23 12:54:17 +10:00
3fb47956c0 Man Page: Fix spelling 2021-07-22 20:13:14 -04:00
Christoph Lendenfeld
fafd21b14c Animation: Generic Slider implementation
Extract the slider gui implemented for the pose slide tools.
Generalise it so it can be used by other tools as well.

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D9314
Ref: D9314
2021-07-22 23:44:53 +01:00
49e68f15f2 Geometry Nodes: Display Node Warnings in Modifier
With this commit, node warnings added to nodes during evaluation
(not "Info" warnings) will also draw in the modifier. In the future
there could be a "search for this node" button as well.

Differential Revision: https://developer.blender.org/D11983
2021-07-22 17:53:35 -04:00
f76dfe8fb4 Cleanup: Add function to check a curve's spline types
The need for this has come up a few times.
2021-07-22 17:20:04 -04:00
524d172742 Fix: "Bake" automatically calculated handles in set handle node
Because these handles are calculated lazily, we need to make sure they
are calculated before switching to a manually positioned mode.
I doubt it would ever be necessary, but theoretically this could happen
on a per-point level, to avoid calculating handles not in the selection.
2021-07-22 17:11:26 -04:00
Germano Cavalcante
f013e3de81 VSE: Speed Effect layout updates
**Changes:**
- New enums correspond to 4 modes: `Stretch`, `Multiply`, `Frame Number` and `Length`.
- "`Multiply Factor`" has been removed;
- Value corresponding to "`use as speed`" enabled is now the value appended to the `Multiply` enum;
- Value corresponding to "`use as speed`" disabled is now the value appended to the `Frame Number` enum;
- Value corresponding to "`Scale to Length`" enabled is now the value appended to the `Length` enum;
- Except `Stretch` each mode has now its respective control values.

Differential Revision: https://developer.blender.org/D11856
2021-07-22 17:51:07 -03:00
e77a1dc6b0 Fix name used when parsing arguments 2021-07-22 15:29:09 -03:00
1b44b47f69 PyGPU: new method 'GPUFrameBuffer.read_depth'
Method requested by users in order to port addons to new API.
2021-07-22 15:17:48 -03:00
1a91c57320 Compositor: Fix crash when using empty input sources
It's the case of Image or Movie Clip node when not selecting any
source or an empty one.
Render methods expect an output buffer with size, only render
operations with resolution.
2021-07-22 18:51:51 +02:00
b1bf4c2a05 Compositor: Full frame Texture node
Adds full frame implementation to this node operation.
No functional changes.
2021-07-22 18:51:51 +02:00
48e27ad122 Compositor: Full frame Movie Clip node
Adds full frame implementation to this node operation.
No functional changes.
2x faster than tiled fallback.
2021-07-22 18:51:51 +02:00
91e2b1dcaf Compositor: Fix buffer area iterating past the end 2021-07-22 18:51:51 +02:00
5f28a90b34 Compositor: Add coordinates to BuffersIterator
Allows to cover many use cases where iterating both buffers and
coordinates is needed.
2021-07-22 18:05:55 +02:00
97712b018d Fix T90026: attributes added in editmode are lost on modeswitch
When exiting editmode, customdata [and thus attributes] are copied from
**BMesh** to **Mesh** (in `BM_mesh_bm_to_me`).
When adding attributes, these were always added via
`CustomData_add_layer_named` only.
Instead (if we are in mesh editmode), we need to go through
`BM_data_layer_add_named` to properly update the **BMesh** (see
`update_data_blocks`) so we have stuff available to copy back to
**Mesh** when exiting editmode.
Same is done for removing (also going through BMesh).

This is now done, DomainInfo is updated to point to BMesh (instead of
Mesh) customdata when in editmode.

Maniphest Tasks: T90026

Differential Revision: https://developer.blender.org/D11998
2021-07-22 17:57:46 +02:00
Johnny Matthews
0e8d1c6bcf Geometry Nodes: Set Bezier Handle Type Node
This node takes a curve and a point selection and allows you to set the
specified (or all) points left/right or both handles to a given type.

Differential Revision: https://developer.blender.org/D11992
2021-07-22 10:55:50 -04:00
320f34af86 Tests: continue running benchmarks if some tests fail to build or run
Convenient when testing many revisions where some might be broken.
2021-07-22 16:35:00 +02:00
19b597c55d Tests: improve finding of Blender executables in benchmarking
* Allow specifying a folder and automatically setting the proper executable
  name depending on the operating system
* Use executables from configs for listing devices instead of a blender
  command being available
2021-07-22 16:34:57 +02:00
f2cce48698 Versioning: move "until next subveresion bump" code
Move "until next subveresion bump" code into the 300.13 version block.
This should have happened in rB8d5b9478a25.
2021-07-22 15:19:58 +02:00
0eccf57161 Cleanup: Silence warning - unused parameter 2021-07-22 08:59:43 -03:00
Yann Lanthony
574995478a Fix T89733: Py API: bpy.data.orphans_purge argument parsing
On Windows, using `bpy.data.orphans_purge` with some arguments (eg: `do_recursive=True`) does not produce the expected results. This is due to arguments not being parsed correctly on this platform with the current code.

The proposed fix is based on how other functions with boolean attributes are exposed to the Python API.

Reviewed By: #python_api, mont29

Maniphest Tasks: T89733

Differential Revision: https://developer.blender.org/D11963
2021-07-22 12:52:37 +02:00
Philipp Oeser
57668d84cf Make polls for removing mesh data layers consistent
This was reported in T90026 for attributes, but was also true for:
- UVMaps
- Vertex Colors
- Sculpt Vertex Colors
- Face Maps

For Vertex groups and Shapekeys this was already done (in that their
remove poll would check if there is a vertex group or shapekey to begin
with), now make this consistent across all mentioned types.

Thx @vvv for the initial patch (where this was done for attributes only)

ref T90026

Reviewed By: HooglyBoogly

Maniphest Tasks: T90026

Differential Revision: https://developer.blender.org/D11990
2021-07-22 10:11:44 +02:00
8d5b9478a2 Bump subversion to avoid infinite enabling pose_library add-on
Bump Blender's sub-version to make sure the pose_library add-on isn't
auto-enabled on every run of Blender.
2021-07-22 09:51:52 +02:00
64bb49fa4e Cleanup: Move reorganize asset files
I'm trying to move away from general files with lots of things in them,
and instead have many small & focused files. I find that easier to
work with since everything has clear responsibilities, even if there is
some minor overhead in managing all these files.
I also try to differentiate more clearly between public and internal
files. So source files and internal headers are in a `intern/`
sub-directory, public functions are in a number of headers one level
higher.
For convenience and to make this compatible with our existing general
headers in `editors/include`, I made the `ED_asset.h` there include all
these public headers.
This is of course a bit of an experiment, let's see how it works in
practice.

Also corrected the name of `ED_asset_can_make_single_from_context()`.
2021-07-21 20:41:29 +02:00
Germano Cavalcante
178086d581 Draw Cache: extract tris in parallel ranges
The `ibo.tris` extraction in multithread is currently only done if the
mesh has only 1 material.

Now we cache a map indicating the index of each polygon after sort and
thus allow the extraction of tris with materials in multithreaded.

As caching is a heavy operation and was already being performed in
multi-thread for triangle offsets, no significant improvements are
expected.

The benefit will be much greater when we can skip updating the cache
while transforming a geometry.

**Profiling:**
||master:|PATCH:
|---|---|---|
|large_mesh_editing_materials:|Average: 13.855380 FPS|Average: 15.525684 FPS
||rdata 9ms iter 36ms (frame 71ms)|rdata 9ms iter 29ms (frame 64ms)
|subdiv_mesh_final_only_materials:|Average: 28.113742 FPS|Average: 28.633599 FPS
||rdata 0ms iter 1ms (frame 36ms)|rdata 0ms iter 1ms (frame 35ms)

1.1x overall speedup

Differential Revision: https://developer.blender.org/D11445
2021-07-21 15:09:43 -03:00
785d87ee42 Fix T90017: Bone widget drawing inconsistent with editing
The `lines_loose` extractor did not trigger loose geometry caching.
2021-07-21 14:46:53 -03:00
c830c5b16b Cleanup: Move loose geometry cache creation to render data task
This centralizes caching functions.
2021-07-21 14:46:53 -03:00
e850c2b06d Cleanup: Centralize/unify asset library reference from/to enum code
This was an open TODO, I wanted to have code for translating asset
library references from and to enum values in a central place, and
access that in the same way from both the Asset Browser and the
Workspace RNA code.

* Adds own file for the related functions.
* Adds doxygen comments.
* Updates RNA callbacks to properly use these functions.
* Let these functions call each other, avoid duplicating logic.
2021-07-21 19:35:39 +02:00
10e28bd270 Assets: Replace duplicated asset library reference type from DNA
Since recently it's possible to access assets from outside the
File/Asset Browser, via the asset view template. So we are slowly
moving away from file space specific code to dedicated asset system
code. I introduced `AssetLibraryReference` as a duplicate of
`FileSelectAssetLibraryUID`, with a plan to delete the latter in a
separate cleanup commit. That's exactly what this commit is.

This will cause Asset Browsers to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
2021-07-21 19:35:39 +02:00
8de2b6a020 Assets: Rename workspace active asset library DNA variable
This new variable was introduced with 7898089de3. We don't usually use
an `active` prefix variable. Plus, this makes the name match the one of
the Asset Browser active library variable, so we can use the
`rna_def_asset_library_reference_common()` helper for both.

This will cause Asset Views to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.
2021-07-21 19:35:39 +02:00
952ded57de Cleanup: Add missing doxygen file/group comment in new asset file 2021-07-21 19:35:39 +02:00
581a6da804 Fix incorrect use of BLI_assert with error strings
Some asserts were never raised because of invalid checks.
2021-07-22 00:47:29 +10:00
63da2c4082 Cleanup: replace BLI_assert(test || !"text") with BLI_assert_msg(test, text) 2021-07-22 00:46:45 +10:00
Yuki Hashimoto
22bef356ae Cleanup: correct the comment in ghost
The same comments were written in clientToScreen and screenToClient in
GHOST. I corrected them.

Ref D11986
2021-07-21 23:14:03 +10:00
3cfd6439c6 Fix bug in assert in delaunay test.
Assert was trying to say x coords of arcs lined up, and didn't do that.
2021-07-21 08:33:29 -04:00
16804297e6 Cleanup: Split set_preview_visibilty. 2021-07-21 14:12:24 +02:00
d1e1d6c491 Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text") 2021-07-21 20:59:19 +10:00
bbcc8330f7 Cleanup: spelling 2021-07-21 20:42:11 +10:00
e7082fbdb0 Cleanup: replace BLI_assert(0 && "text") with BLI_assert_msg 2021-07-21 20:39:51 +10:00
ab101d444d Fix T89881: ignore unavailable sockets when searching for link cycles 2021-07-21 11:28:26 +02:00
8b0fac4116 Fix compile issue. 2021-07-21 11:09:52 +02:00
82ff5dd911 Fix i18n utils_cli mistake.
Reported by James Monthea (@jmonteath), thanks.
2021-07-21 10:37:45 +02:00
9aa0a3f533 Cleanup Preview rendering: Separate world preparation.
Small cleanup that moves world preparation out of scene preparation.
2021-07-21 09:35:21 +02:00
75e41b1279 Cleanup: use named enum types.
Added ePreviewRenderMethod and ePreviewType.
2021-07-21 08:18:34 +02:00
265c3a4724 Cleanup: replace NB with NOTE in comments 2021-07-21 13:10:32 +10:00
Smitty van Bodegom
dc8a924efa UI: Use more descriptive wording for particle modifier conversions
Currently the wording is a bit unclear: it doesn't specify //what// the particles will be converted into. This clarifies it by stating what the particles will be converted into: they will either be converted to a mesh or the instances will be made real.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11795
2021-07-20 17:39:25 -04:00
Romain Toumi
14d5a45750 UI: Fix Cycles Materials menu Layout
Fix an incoherence between the Eevee Materials menu and the Cycles Materials menu :

Eevee :
{F10230448}

Cycles :
{F10230449}

Simply Fixed by replacing the Cycles UI code by the Eevee UI code.

Thanks to @Brainzman for helping me create this diff and translate

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11979
2021-07-20 17:23:34 -04:00
807bb450a0 Fix API doc generation after recent context additions 2021-07-20 22:07:41 +02:00
bfe6b55aa7 Fix T89827: Attribute transfer node crash on mesh with no faces
Just add a check for whether the mesh has faces when retrieving an
attribute on the corner domain. In the future there could be an info
message in the node in this case, since maybe it's not intuitive.
2021-07-20 15:56:36 -04:00
d3445496b1 Fix memory leak with asset view template operator properties 2021-07-20 21:50:09 +02:00
cb0b017d8f Cleanup: Store asset-handle in drag data
Would previously pass a few properties that are available via the
asset-handle now. This asset-handle is also required for some of the
asset API, e.g. the temporary ID loading. This will probably be needed
before too long.
2021-07-20 21:30:04 +02:00
0af08cea40 Cleanup: Use asset utility function to get the asset .blend path
For this to work, the utility function needs to be callable without
context, which is only needed for a File Browser specific hack anyway
(doesn't apply to this usage of it).
2021-07-20 21:30:04 +02:00
e99801390c Cleanup: Move asset-handle functions to own file
Keeps files minimal and focused. I much prefer that over having all
kinds of stuff in general files like `asset_edit.cc`.
2021-07-20 21:30:03 +02:00
5a1b1c0ed2 Cleanup: Getters for asset-handle data
While the asset-handle design is supposed to be temporary (see
35affaa971), I prefer keeping the fact that it's nothing but a file
entry pointer an implementation detail that is abstracted away. So this
introduces getters for the file data we typically access for
asset-handles.
2021-07-20 21:30:03 +02:00
207df439e1 Cleanup: Use const for internal file data of asset-handle
Note that the current asset-handle design is temporary, see
35affaa971. I still prefer this to be const, as code outside the
asset-list/file-list code should never mess with the file data of an
asset.
2021-07-20 21:30:03 +02:00
36fb03e2b9 Asset: Clearly describe RNA property description as temporary
The asset handle design is only temporary (see 35affaa971) and this
RNA property is only needed for internal, technical reasons of the asset
view template. So although not nice, at least make it clear in the RNA
property description that this should not be used.
2021-07-20 21:30:03 +02:00
8ffc3ee257 Cleanup: Correct asset TODO comment, move setter next to getter 2021-07-20 21:30:03 +02:00
aeee7f390d Fix T89993: Failed assert drawing single point cyclic splines
The same check used for the curve to mesh node.
2021-07-20 14:54:01 -04:00
cf28398471 Fix T89687: Curve to mesh node incorrect face orientation
The new faces should have a winding direction that points them outward,
the fix was swapping the order of each face's edge and vertex indices.
2021-07-20 14:39:24 -04:00
1e063a0242 Cleanup: Use const arguments and less sequential iteration
Using const indexes and offsets helps to make the logic less sequential,
which is hopefully easier to understand and possibly easier to parallelize
in the future. Also order return arguments last.
2021-07-20 14:28:33 -04:00
b65ec08bbb Armature test: properly initialize bone hierarchy
Fix segfault in `BKE_armature_find_selected_bones_test` by property
initializing the bone hierarchy listbases.

No functional changes to Blender.
2021-07-20 19:02:43 +02:00
Jagannadhan Ravi
26b2a35dd4 Speedup rigid body "Copy from Active" operator
If there were lots of selected objects without an existing rigid body,
we would add rigid bodies to them one by one.

This would be slow in python, now we instead do this as a batch
operation in C.

On my (Intel) MacBook it used to take 60 seconds and with this change it
takes about 0.3 seconds.

Reviewed By: Sebastian Parborg

Differential Revision: http://developer.blender.org/D11957
2021-07-20 18:57:12 +02:00
f53ca7e41c Cleanup: Fix missing braces warning on Clang 2021-07-20 21:03:47 +05:30
6754d7aef6 Pose Library: remove assumption about Action group names
Remove the assumption of the pose library that Action groups are named
after the bones in the armature. Even though this assumption is correct
when the keys are created by Blender, action groups can be renamed. Keys
created by Python scripts can also use arbitrary group names.

Since there is more code in Blender making this assumption, and looping
over selected bones is also a common occurrence, this commit contains
some generic functionality to aid in this:

- `BKE_armature_find_selected_bones`: function that iterates over all
  bones in an armature and calls a callback for each selected one. It
  returns a struct with info about the selection states (all or no bones
  selected).
- `BKE_armature_find_selected_bone_names(armature)` uses the above
  function to return a set of selected bone names.
- `BKE_pose_find_fcurves_with_bones()` calls a callback for each FCurve
  in an Action that targets a bone, also passing it the bone name.
2021-07-20 17:12:01 +02:00
c4f71f3193 Cleanup: fix clang-tidy warning readability-qualified-auto
No functional changes.
2021-07-20 17:11:29 +02:00
3e4c98429b Cleanup: fix clang-tidy readability-else-after-return
No functional changes
2021-07-20 17:11:29 +02:00
f763929486 Cleanup: fix clang-tidy warning modernize-use-nullptr
No functional changes.
2021-07-20 17:11:29 +02:00
3ea4c6b9c9 Pose backup: convert from C to C++
Convert `pose_backup.c` (in C) to `pose_backup.cc` (in C++). This will
make future improvements easier. For now, it's the same code with just
some additional explicit casts (C++ doesn't allow implicitly casting
`void *`), `NULL` changed into `nullptr`, and some other simple changes.

No functional changes.
2021-07-20 17:11:29 +02:00
f164188a6d Fix T89981: missing refresh on the compositors render layer node when adding/removing AOVs
Just refresh the node's outputs via ntreeCompositUpdateRLayers().

Maniphest Tasks: T89981

Differential Revision: https://developer.blender.org/D11973
2021-07-20 17:00:01 +02:00
3e29175af3 Fix T89982: Geometry Nodes: 'New' Button tries to create node_tree on active modifier, rather than button context
When done from the Properties Editor, the context's modifier should be
used (this is where the button is located), when done from elsewhere,
the active modifier is still the way to go (since the context modifier is
not available then)

Maniphest Tasks: T89982

Differential Revision: https://developer.blender.org/D11972
2021-07-20 16:53:34 +02:00
Johnny Matthews
83b6fcc70c Fix: Bezier segment node adds handles incorrectly
This caused the "cyclic" attribute to appear dysfunctional.
2021-07-20 09:58:24 -04:00
76a3ff70d5 Fix T89979: Assert in edit mode with curve to mesh node
The node tagged polys normals dirty,  but the function to calculate the
normals didn't clear the dirty flags for polys. Now clear the poly and
corner dirty normal flags.
2021-07-20 09:37:40 -04:00
c3a400b73f Cleanup: use single back-tick quoting in comments
While doxygen supports both, conform to our style guide.

Note that single back-tick's are already used in a majority of comments.
2021-07-20 22:58:14 +10:00
48a45c43e4 Cleanup: use doxygen style parameters in noise.c
These used their own ad-hoc syntax.
2021-07-20 22:54:48 +10:00
9e1fdd1f14 Cleanup: added const keyword to BLI_dlrbTree search functions. 2021-07-20 14:49:49 +02:00
6c5f8bf5aa Cleanup: Remove redundant forward declarations. 2021-07-20 14:49:49 +02:00
9471715720 Fix crash in delaunay C interface test.
The test forgot to set the new need_ids field, which luckily
exposed a bug in the C api for delaunay when that field is false.
Fixed the bug and the test, and added a test for the need_ids false
case.
2021-07-20 07:28:46 -04:00
75c9788c27 Compositor: Fix crash when connecting multiple constant inputs
Operation receiving inputs was being folded more than once
when it was constant foldable.
2021-07-20 12:31:40 +02:00
d218ba8009 LineArt: UI cleanups.
Wording on the UI, slider consistency and material mask switches layout.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: http://developer.blender.org/D11839
2021-07-20 13:06:45 +08:00
77e927b58f Cleanup: reserve C++ comments for disabled code
Use C comments for plain text.
2021-07-20 15:01:05 +10:00
fe2f43a15c Cleanup: use '#if 0' for disabling multiple lines 2021-07-20 15:01:03 +10:00
59eb71afa1 Cleanup: Make function static, use const object argument
Also use `const Curve *` instead of `const Object *`, since the
function works at a lower level than objects anyway.

And also remove another unused function. Since this section of code
for converting curves to meshes will likely be replaced, it's nicer to
see which parts actually remain used at this point.
2021-07-19 21:19:59 -04:00
0e9c04a3ea Cleanup: spelling 2021-07-20 11:12:24 +10:00
cf8ea741f2 Cleanup: quiet GCC maybe-uninitialized warning
Function signatures for snap callbacks used `const` incorrectly
which was hidden by casting function types.

This made it seem as if the input arguments wouldn't be change and
wouldn't be initialized.

Name return arguments with an `r_` prefix, order them last,
remove function casts and correct `const` usage.
2021-07-20 11:12:24 +10:00
0733926a34 Cleanup: Remove unused function 2021-07-19 20:51:57 -04:00
24aae7ed63 Docs: Update RNA to user manual mappings 2021-07-19 18:41:58 -04:00
3021f9b48c Cleanup: Clang format 2021-07-19 17:12:01 -04:00
468765d29e Compositor: Export operation results as debug option
When fixing issues, seeing operation results can be helpful for
detecting which operation went wrong.

This commit adds an option for exporting all operations results to
image files.
Exceptions are:
- Output operations: They are already exported or can be seen in UI.
- Constant operations: There are too many and is rarely useful.

They are exported to "<temp session folder>/COM_operations/"
with filenames "<operation class name>_<operation id>.png".
Only works on full frame execution mode.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11722
2021-07-19 22:05:39 +02:00
9aa88a6604 Compositor: Full frame Brightness node
Adds full frame implementation to this node operation.
No functional changes.
2.4x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11677
2021-07-19 22:05:39 +02:00
b35efa932e Compositor: Full frame Mix node
Adds full frame implementation to this node operations.
No functional changes.
2.3x faster than tiled fallback on average.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11686
2021-07-19 22:05:39 +02:00
300fe84bf0 Compositor: Full frame Viewer node
Adds full frame implementation to this node operation.
No functional changes.
No performance changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11698
2021-07-19 22:05:39 +02:00
b848d5cdf5 Compositor: Full frame Double Edge Mask node
Adds full frame implementation to this node operation.
No functional changes.
No performances changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11750
2021-07-19 22:05:39 +02:00
0a0c2c0217 Compositor: Full frame Ellipse Mask node
Adds full frame implementation to this node operation.
No functional changes.
3x times faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11635
2021-07-19 21:26:58 +02:00
45b46e5de9 Compositor: Buffer iterators
Currently we mostly iterate buffer areas using x/y loops or through
utility methods extending from base classes.

To simplify code in simple operations this commit adds wrappers for
specifying buffer areas and their iterators for raw buffers with any
element stride:
- BufferRange: Specifies a range of contiguous buffer elements from a
 given element index.
- BufferRangeIterator: Iterates elements in a BufferRange.
- BufferArea: Specifies a rectangle area of elements in a 2D buffer.
- BufferAreaIterator: Iterates elements in a BufferArea.
- BuffersIterator: Simultaneously iterates an area of elements in an
 output buffer and any number of input buffers.
- BuffersIteratorBuilder: Helper for building BuffersIterator adding
 buffers one by one.
For iterating areas coordinates it adds `XRange` and `YRange` methods
that return `IndexRange`.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11882
2021-07-19 20:06:21 +02:00
582c5530b6 Cleanup: Move asset library reference C++ wrapper to own files
Although currently only the asset list code uses the asset library
reference wrapper, it can stand on its own and may be used in more
places in the future. So I prefer to give it its own source & header
file.

Also removed unused includes, added proper namespaces as per our C++
style guidelines, and removed an unnecessary TODO comment.
2021-07-19 18:28:27 +02:00
ebe32e01e1 Cleanup: Remove unused function, unused declaration 2021-07-19 11:56:52 -04:00
07a77816a1 Fix some mesh edition macro operators incorrectly setting an empty description string.
No operator or macro should be missing description. But if they do, then
they should use NULL pointer, and not an empty string.

This behavior was already enforced (through an assert) for operators,
previous commit made it the same for macros.
2021-07-19 16:05:24 +02:00
bae1b64525 Fix broken 'undocumented' case in registration of Macro opertators.
Code dealing with macro operators missing description field was slightly
different than the one from Operator registration.

This lead to invalid memory accesses in some python introspection cases
like the i18n messages extraction code in `bl_i18n_utils` module.
2021-07-19 16:05:24 +02:00
132522cba8 Cleanup: Separate keyframes_draw and keyframes_keylist.
The keylist functions are used in other places for none drawing related
stuff. Fe pose_slide uses it.
2021-07-19 15:53:04 +02:00
ceb612a79c Revert "Depsgraph: Implement 'ID_RECALC_GEOMETRY_DEFORM'"
This reverts commits
 bfa3dc91b7,
 52b94049f2,
 ae379714e4,
 a770faa811,
 4ed029fc02,
 101a493ab5 and
 62a2faa7ef.

And fixes T89955.

Changing the dependency graph is a can of worms and the result is
a kind of unpredictable.

A different solution will be planned.
2021-07-19 10:17:38 -03:00
62a2faa7ef Object update: Remove fallback from batch_cache_deform_tag
Falback is not really necessary, and causes
`BKE_object_data_batch_cache_dirty_tag` to run multithreaded in an
unsafe way.

No functional changes.
2021-07-19 09:50:53 -03:00
101a493ab5 Fix T89941: No path`s bevel update, when I change bevel profile curve
Update was skipping the batch cache.
2021-07-19 09:47:56 -03:00
ff01070b5c Cleanup: minor correction to delaunay_2d_cdt doc-string
Use more conventional syntax for default arguments.
2021-07-19 11:57:28 +10:00
ee857cc266 Cleanup: remove unused pathlib import 2021-07-19 11:30:27 +10:00
ad7455cd14 Cleanup: remove unused MTex.pmapto, pmaptoneg & defines
These have not been in use since 2.57
fafbd9d71b.
2021-07-19 11:24:24 +10:00
83883ae66a Fix: memcpy overlapping region ASAN warning in curve trim node 2021-07-18 19:24:11 -04:00
75ae328d62 Cleanup: Make curve trim node code more semantically correct
The code used `Spline::LookupResult` in a way that referred to evaluated
points and control points interchangeably. That didn't affect the logic,
but the code became harder to read. Instead, introduce a local struct
to contain the data in a more obvious way.
2021-07-18 19:20:57 -04:00
76f0ef294a Update documentation string for mathutils.geometry.delaunay_2d_cdt. 2021-07-18 15:24:12 -04:00
72d1ddfc9c Make it optional to track input->output mapping in delaunay_2d_calc.
Some uses of delaunay_2d_calc don't need to know the original verts,
edges, and faces that correspond to output elements.
This change adds a "need_ids" value to the CDT input spec, default true,
which tracks the input ids only when true.
The python api mathutils.geometry.delaunay_2d_cdt gets an optional
final bool argument that is the value of need_ids. If the argument
is not supplied, it is true by default, so this won't break old uses
of the API.

On a sample text test, not tracking ids save about 30% of the runtime.
For most inputs the difference will not be so dramatic: it only really
kicks in if there are a lot of holes.
2021-07-18 15:10:34 -04:00
4ed029fc02 Fix T89929: Crash when hiding in the render a previously keyframed volume
Regression introduced in {rBbfa3dc91b754}.

`ID_RECALC_GEOMETRY` should tag all operations of the `GEOMETRY`
component and not just the operation of node `GEOMETRY_EVAL_INIT`.
2021-07-18 15:11:44 -03:00
Angus Stanton
e7a800c52f Geometry Nodes: Curve Trim Node
This node implements shortening each spline in the curve based on
either a length from the start of each spline, or a factor of the
total length of each spline, similar to the "Start & End Mapping"
panel of curve properties.

For Bezier curves, the first and last control points are adjusted
to maintain the shape of the curve, but NURB splines are currently
implicitly converted to poly splines.

The node is implemented to avoid copying where possible, so it outputs
a changed version of the input curve rather than a new one.

Differential Revision: https://developer.blender.org/D11901
2021-07-18 14:09:38 -04:00
24801e0a4a Speed up Delaunay raycast.
From Erik Abrahamsson, this uses parallel loops for raycasting.
It speeds up one example with many crossings of a bezier curve,
from 0.68s to 0.28s.
2021-07-18 12:13:41 -04:00
fc32567cda Versioning: fix vertex group name loss in linked duplicates.
After rB3b6ee8cee708 by @HooglyBoogly vertex groups were moved
to mesh data, and versioning code was provided to upgrade old
files. However, it fails to consider the case of linked duplicates
having different name lists, and dependent on the object order
can cause some of the names to be lost. This can even be all of
them, if there is a duplicate without any names, which can be
easily created by lazy Python code.

To fix this, change the code to use the longest available name list.

Differential Revision: https://developer.blender.org/D11958
2021-07-18 19:09:56 +03:00
Angus Stanton
9eafdb985d Fix: Incorrect logic in spline lookup function
This section of code deals with evaluated points,
so that is the size it should use.
2021-07-18 11:59:23 -04:00
3c8d261557 Greatly improve speed of Delaunay when have a lot of holes.
Using part of a patch from Erik Abrahamsson, this replaces the
use of linked lists for original id tracking by Sets.
I had thought that the lists were unlikely to grow to more than
a few elements, but when the mesh has a lot of holes (whose
original ids go *outside* the hole, and therefore, most of the
mesh), this assumption can be very wrong.
On a Text regression test, the time went from 11.67s to 0.16s
with this fix. I also tested to make sure that Boolean didn't
slow down with this, and found it actually had a very slight speedup.

Using Sets exposed a dependency on the ordering of the items
in the id lists, luckily caught by a mesh intersect regression test,
so fixed that.
2021-07-18 10:48:57 -04:00
Jesse Yurkovich
e82c5c6607 Fix T89868: Crash showing thumbnail of wide-aspect image
Scaling down images could create images with a width or height of zero.

Clamp at 1 to prevent a crash, also add an assert to scaling functions.

Ref D11956
2021-07-18 10:44:02 +10:00
118803893e Cleanup: Simplify realizing of pointcloud instances
Just a small change to make the function slightly shorter.
2021-07-16 15:29:42 -04:00
0793ced8ad Fix T89624: Vertex painting causes mesh to flicker
The `ibo.lines_paint_mask` extractor doesn't have a callback to iterate
bmesh faces, this made `filter_into` ignore the extractor.
2021-07-16 16:20:05 -03:00
e7b441a05c Cleanup: Simplify logic, use C++ types
Also remove an unecessary null check, and make inner loop simpler.
2021-07-16 13:32:25 -04:00
53743adc29 VSE: Fix multicam splitting all selected strips
`split_multicam` used split operator, where if more strips than
multicam were selected, all would be split, which is undesirable.

Add `Sequence.split()` RNA API function. to split individual strips.
Function accepts `frame` and `split_method arguments`. Returns right
strip after splitting.

In case when strip being split have effects, these will be split too, so
no invalid state should be created.

Selection is not handled, this is by design up to user.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11926
2021-07-16 19:16:35 +02:00
1dcf0f9cf1 Fix T89722: Duplicate macro can cause strips to overlap
Bug caused by 78693d524c accidentally removing overlap handling when
transform operator is canceled.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D11899
2021-07-16 19:16:35 +02:00
feba1fe974 Cleanup: Move gpencil_geom.c to C++
This will help enable development on optimizations to the perimeter
calculation here. Using C++ data structures like Array can make the
code easier to read as well.

Longer term, this can help improve integration with attributes
and possibly the new curve code (since strokes and curves are
quite similar in theory).

Differential Revision: https://developer.blender.org/D11941
2021-07-16 13:00:33 -04:00
c4df8ac1a4 Fix T89899: Crashes when accessing vertex groups from objects
We need to be more strict about trying to retrieve a list of vertex group
names from objects now, as only three object types support them.
This commit adds a check for vertex group support in a few places, the
data transfer operator/modifier, copying vertex groups to selected
objects, and the vertex group remove and clear functions.

Differential Revision: https://developer.blender.org/D11947
2021-07-16 12:23:55 -04:00
6025897cd6 Cleanup: Get vertex group names directly from grease pencil data 2021-07-16 12:05:21 -04:00
802a59a58a Cleanup: Remove redundant logic
The object type was checked twice unnecessarily. Also use a function
for the check to be more explicit.
2021-07-16 12:02:38 -04:00
1ab6d5c1dc Surface Deform: support sparse binding mode for improving performance.
When a vertex group is used to limit the influence of the modifier
to a subset of vertices, binding data for vertices with zero weight
is not needed. This wastes memory, disk space and CPU cycles.

If the vertex group contents is known to be final and constant,
it is reasonable to optimize by only storing data group vertices.
This has to be an option in case the group can change.

Supporting this requires adding a vertex index field and spliting
the vertex count into mesh and bind variants, but both happen to
fit in available padding. The old numverts field is renamed to the
new bound vertex count field to maintain the array length invariant.
Versioning is used to initialize the other new fields.

If a file with sparse binding is opened in an old blender version,
it is corrupted into a non-sparse bind with vertex count mismatch,
preventing the modifier from working until rebind.

Differential Revision: https://developer.blender.org/D11924
2021-07-16 16:12:00 +03:00
a770faa811 Fix T89875: False dependency cycle on particle systems
`POINT_CACHE_RESET` pointed to `GEOMETRY_EVAL_INIT` while
`GEOMETRY_EVAL_INIT` pointed to `POINT_CACHE_RESET`.

Now `POINT_CACHE_RESET` points to the same nodes pointed to by
`GEOMETRY_EVAL_INIT` thus avoiding the dependency cycle.
2021-07-16 09:53:00 -03:00
15cfb375a3 Fix T89782: Segfault populating popup menu with dimensions above the opengl limit
The crash happens because `GPU_offscreen_create` is called with `err_out` `NULL`.

This patch proposes a solution within the `GPU_offscreen_create` itself
and raises an error report in the interface if a menu is called with
dimensions beyond what is supported.

Ref T89782

Maniphest Tasks: T89782

Differential Revision: https://developer.blender.org/D11927
2021-07-16 09:53:00 -03:00
e78e235cc5 Cleanup: preview rendering, update assumptions in comment
The `action_preview_render()` function used to just render, but now it
also temporarily applies the pose. Its comment is now updated for this.

No functional changes.
2021-07-16 14:48:03 +02:00
3ec9681ac4 Rename UI error message on attributes panel for name collisions
* Name Collisions > Name collisions
* Info icon > Error icon
2021-07-16 14:36:44 +02:00
038345fa56 Fix T89861: Checking face selection breaks UV stitch operator 2021-07-16 17:47:42 +10:00
38131cc5e5 Fix T70356: Scaling up 1x1 pixel image reads past buffer bounds
Also resolve a crash when when displaying thumbnails, see T89868.
2021-07-16 16:58:06 +10:00
f61f4c89bb Cleanup: reduce variable scope in task_iterator.c
Would have prevented the error in
15cdcb4e90.
2021-07-16 14:39:57 +10:00
e26887598f Fix error using uninitialized state in BLI_task_parallel_mempool
Single threaded operation used the state before it had variables
written into it.

Error in 15cdcb4e90.
2021-07-16 12:07:03 +10:00
42017b006e Cleanup: sort struct declarations 2021-07-16 11:48:54 +10:00
bf5b1fa726 Cleanup: remove redundant parentheses 2021-07-16 11:45:52 +10:00
09b89da349 Cleanup: spelling in comments 2021-07-16 11:45:51 +10:00
d3c454d66c Cleanup: compiler warnings 2021-07-16 11:45:03 +10:00
Aidan Haile
98c4224ff0 Fix T49944: Compositor ID Mask Anti-Aliasing not working
Replaces current ID Mask node Anti-Aliasing operation by SMAA
operations with default settings as proposed by Jeroen Bakker.
SMAA produces smoother edges.

Reviewed By: manzanilla

Differential Revision: https://developer.blender.org/D11881
2021-07-15 22:23:31 +02:00
Red Mser
eccd03a826 UI: Flip driver editor debug lines
In driver editor, vertically flip the value debug lines to align
them with the timeline header values. This makes it easier to read
the values. Also set the line width explicitly, which was incorrect
in some cases.

Differential Revision: https://developer.blender.org/D8877
2021-07-15 15:20:37 -04:00
7d618b4dde Cleanup: Clang tidy 2021-07-15 13:40:30 -04:00
a566dc25aa Cleanup: Remove use of designated initializers in C++ code
Does not compile on Windows.
2021-07-15 13:36:40 -04:00
9d9c879f4b Cleanup: Move UI list template code to own file (C++)
This move was already prepared with 788d380460 and 26b098c04f. The
template is quite big already, better to give it its own file. Plus it
could use some C++ features like RAII and maybe some more object
oriented code. I plan further refactoring there.
2021-07-15 19:09:49 +02:00
0cc2a72f94 Fix failing tests from vertex group name parameter copy
It turns out `BKE_mesh_copy_parameters` can be called while other
tools are running calculations, which meant that it was called at the
same time as `armature_deform_coords_impl`. Beause of that, we
shouldn't do any freeing (of the old vertex group names) there.

Since the materials are copied in the "for_eval" version anyway,
it seems to make sense to copy the vertex group name list there also.

Fixes T89877, and also the failing `deform_modifiers` test.

Differential Revision: https://developer.blender.org/D11936
2021-07-15 12:25:36 -04:00
3af0e1f6fd Cleanup: unused variable capture 2021-07-15 18:07:03 +02:00
34771cc9f5 Animation/add-ons: Enable the poselib add-on by default
The new Asset Browser-based pose library is partially implemented in an
add-on. This commit enables the add-on by default, as the old pose
library was built-in and thus always enabled.

The ability to disable the add-on is there mostly for cases where
people/studios want to use their own custom pose library.
2021-07-15 16:19:08 +02:00
72c34068cb Fix T88281: Pose Library 'flip pose' sometimes flips wrong
Correct cases where the X-axis of the bone (in pose space) aligns with
the pose-space Y or Z-axis. In these cases the decomposition of the
matrix fails, and a negative scale of the X-axis turns into a 180°
rotation around the Y-axis. An extra -1 scale to the X and Z axes of the
resulting matrix seems to fix things.
2021-07-15 16:12:37 +02:00
f52e3aa210 Asset Browser: Python mixin utility for category-specific panels
Using this mixin for a panel definition, it's possible to set in which
categories the panel should appear. This is used by the Pose Library
add-on.
2021-07-15 16:12:36 +02:00
8925d3b7bf UI/Assets: Initial Asset View UI template
The asset view UI template is a mini-version of the Asset Browser that
can be placed in regular layouts, regions or popups. At this point it's
made specifically for placement in vertical layouts, it can be made more
flexible in the future.
Generally the way this is implemented will likely change a lot still as
the asset system evolves.

The Pose Library add-on will use the asset view to display pose
libraries in the 3D View sidebar.

References:
* https://developer.blender.org/T86139
* https://code.blender.org/2021/06/asset-browser-project-update/#what-are-we-building
* https://code.blender.org/2021/05/pose-library-v2-0/#use-from-3d-viewport

Notes:
* Important limitation: Due to the early & WIP implementation of the
  asset list, all asset views showing the same library will show the
  same assets. That is despite the ID type filter option the template
  provides. The first asset view created will determine what's visible.
  Of course this should be made to work eventually.
* The template supports passing an activate and a drag operator name.
  The former is called when an asset is clicked on (e.g. to apply the
  asset) the latter when dragging (e.g. to .blend a pose asset). If no
  drag operator is set, regular asset drag & drop will be executed.
* The template returns the properties for both operators (see example
  below).
* The argument list for using the template is quite long, but we can't
  avoid that currently. The UI list design requires that we pass a
  number of RNA or custom properties to work with, that for the Pose
  Libraries should be registered at the Pose Library add-on level, not
  in core Blender.
* Idea is that Python scripts or add-ons that want to use the asset view
  can register custom properties, to hold data like the list of assets,
  and the active asset index. Maybe that will change in future and we
  can manage these internally.

As an example, the pose library add-on uses it like this:
```
activate_op_props, drag_op_props = layout.template_asset_view(
    "pose_assets",
    workspace,
    "active_asset_library",
    wm,
    "pose_assets",
    workspace,
    "active_pose_asset_index",
    filter_id_types={"filter_action"},
    activate_operator="poselib.apply_pose_asset",
    drag_operator="poselib.blend_pose_asset",
)
drag_op_props.release_confirm = True
drag_op_props.flipped = wm.poselib_flipped
activate_op_props.flipped = wm.poselib_flipped
```
2021-07-15 16:12:36 +02:00
6bd42baaeb Cleanup: Use const for UI icon getter function 2021-07-15 16:12:36 +02:00
26b098c04f UI: Support defining UI lists in C
So far all UI lists had to be defined in Python, this makes it possible
to define them in C as well. Note that there is a whole bunch of special
handling for the Python API that isn't there for C. I think most
importantly custom properties support, which currently can't be added
for C defined UI lists.

The upcoming asset view UI template will use this, which needs to be
defined in C.

Adds a new file `interface_template_list.cc`, which at this point is
mostly a dummy to have a place for the `ED_uilisttypes_ui()` definition.
I plan a separate cleanup to move the UI-list template to that file.
2021-07-15 16:12:36 +02:00
bc4f99aa86 UI: New button/widget type for Asset Browser like preview tiles
This button type shows a preview image above centered text, similar to
the File Browser files in Thumbnail Display Mode or the default Asset
Browser display. In fact we may want to port these over to use the new
button type at some point.

Will be used by the asset view UI template that will be added in a
following commit. That is basically a mini version of the Asset Browser
that can be displayed elsewhere in the UI.
2021-07-15 16:12:36 +02:00
0c83ef567c UI: Auto-scroll to keep active text buttons in view
If a text button is activated that is not in view (i.e. scrolled away),
the scrolling will now be adjusted to have it in view (with some
small additional margin). While entering text, the view may also be
updated should the button move out of view, for whatever reason. For the
most part, this feature shouldn't be needed and won't kick in, except
when a clicked on text button is partially out of view or very close to
the region edge. It's however quite important for the previously
committed feature, that is, pressing Ctrl+F to start searching in a UI
list. The end of the list where the scroll button appears may not be in
view. Plus while filtering the number of visible items changes so the
scrolling has to be updated to keep the search button visible.

Note that I disabled the auto-scrolling for when the text button spawned
an additional popup, like for search-box buttons. That is because
current code assumes the button to have a fixed position while the popup
is open. There is no code to update the popup position together with the
button/scrolling.

I also think that the logic added here could be used in more places,
e.g. for the "ensure file in view" logic the File Browser does.
2021-07-15 16:12:36 +02:00
89fd3afd1e UI: Support pressing Ctrl+F over UI lists to search
Adds an operator invoked by default with Ctrl+F that while hovering a UI
list, opens the search field of the list and enables text input for it.
With this commit the search button may actually be out of view after
Ctrl+F still. The following commit adds auto-scroll to solve that.

A downside is that in the Properties, there also is Ctrl+F to start
the editor-wide search. That's not unusual in Blender though (e.g.
scolling with the mouse over a UI list also scrolls the list, not the
region).
2021-07-15 16:12:36 +02:00
87c1c8112f UI: Support UI list tooltips, defined via Python scripts
Makes it possible to create tooltips for UI list rows, which can be
filled in .py scripts, similar to how they can extend other menus. This
is used by the (to be committed) Pose Library add-on to display pose
operations (selecting bones of a pose, blending a pose, etc).

It's important that the Python scripts check if the UI list is the
correct one by checking the list ID.
For this to work, a new `bpy.context.ui_list` can be checked. For
example, the Pose Library add-on does the following check:
```
def is_pose_asset_view() -> bool:
  # Important: Must check context first, or the menu is added for every kind of list.
  list = getattr(context, "ui_list", None)
  if not list or list.bl_idname != "UI_UL_asset_view" or list.list_id != "pose_assets":
    return False
  if not context.asset_handle:
    return False
  return True
```
2021-07-15 16:12:36 +02:00
8edcb3af96 UI: Support left-right arrow key walk navigation in UI lists
Add improved arrow key walk navigation in grid layout UI List templates.
Pressing up or down walks the active item to the adjacent row in that
direction, while left and right walk through the items along the columns
wrapping at the rows.

Note from Julian:
In combination with the following commit, this has the important
limitation that the list's custom activate operator won't be called when
"walking over" an item that is scrolled out of the list. That is because
we don't actually create any buttons for those that could be used for
the handling logic. For our purposes of the pose libraries that should
be fine since the asset view list is always made big enough to display
all items. Solving this might be difficult, we don't properly support
nesting boxes with proper scrolling in regular layouts. It's all just
hacked a bit for UI-lists to work. Overlaps quite a bit with T86149.

Differential Revision: https://developer.blender.org/D11063
2021-07-15 16:12:36 +02:00
ae1dc8f5f9 UI: Internal support for custom UI list item drag & activate operators
For pose libraries, we need to be able to apply a pose whenever
activating (clicking) an item in the Pose Library asset view and blend
it by dragging (press & move). And since we want to allow Python scripts
to define what happens at least when activating an asset (so they can
define for example a custom "Apply" operator for preset assets), it
makes sense to just let them pass an operator name to the asset view
template. The template will be introduced in a following commit.
2021-07-15 16:12:36 +02:00
00c7ea68a8 UI: New UI list layout type for big preview tiles
This new layout type is meant for the upcoming asset view UI template.
With it it is possible to show big asset previews with their names in a
responsive grid layout.

Notes:
* The layout is only available for C defined UI lists. We could expose
  it to Python, but I think there are still some scrolling issues to be
  fixed first. (The asset view template doesn't use scrolling for the UI
  list.)
* I'd consider this a more usable version of the existing `GRID` layout
  type. We may remove that in favor of the new one in future.
2021-07-15 16:12:36 +02:00
788d380460 UI: UI list refactor & preparations for asset view template
This is more of a first-pass refactor for the UI list template. More
improvements could be done, but that's better done separately. Main
purpose of this is to make the UI list code more manageable and ready
for the asset view template.

No functional changes for users.

* Split the huge template function into more manageable functions, with
  clear names and a few structs with high coherency.
* Move runtime data management to the template code, with a free
  callback called from BKE. This is UI data and should be managed at
  that level.
* Replace boolean arguments with bit-flags (easily extendable and more
  readable from the caller).
* Allow passing custom-data to the UI list for callbacks to access.
* Make list grip button for resizing optional.
* Put logic for generating the internal UI list identifier (stored in
  .blends) into function. This is a quite important bit and a later
  commit adds a related function. Good to have a clear API for this.
* Improve naming, comments, etc.

As part of further cleanups I'd like to move this to an own file.
2021-07-15 16:12:36 +02:00
6e01b52100 Assets: temporarily apply pose when generating preview image
When generating a preview image for a pose, temporarily apply it to the
armature. Contrary to the usual pose application, this ignores the
selected bones and always applies the entire pose.
2021-07-15 16:12:36 +02:00
f3610a23d1 Animation: new pose library based on Asset Browser
Introduce new pose library, based on the Asset Browser. Contrary to the
old pose library (in `editors/armature/pose_lib.c`), which stored an
entire library of poses in an `Action`, in the new library each pose is
its own `Action` datablock. This is done for compatibility with the
asset browser, and also to make it easier to attach preview images,
share datablocks, etc. Furthermore, it opens the door to having
animation snippets in the pose library as well.

This commit contains the C code for the pose library; in order to fully
use it, an addon is required as well (which will be committed shortly).
2021-07-15 16:12:36 +02:00
28dc07a153 Animation: add function to blend Action into pose
Add function `BKE_pose_apply_action_blend()`, which blends a given
Action into current pose. The Action is evaluated at a specified frame,
and the result is applied to the armature's pose.

A blend factor can be given to blend between the current pose and the
one in the Action. Quaternions are interpolated with SLERP; it is
assumed that their FCurves are consecutively stored in the Action.

This function will be used in the upcoming new Pose Library.
2021-07-15 16:12:36 +02:00
9473c61b36 Animation: apply pose to all or selected bones of armature
New function `BKE_pose_apply_action_all_bones()`, which will be
necessary for the upcoming pose library v2.0.

This renames the function `BKE_pose_apply_action` to
`BKE_pose_apply_action_selected_bones`, to reflect that it only works on
selected bones, to contrast it to the new function.
2021-07-15 16:12:36 +02:00
b40e05fcd1 Assets: Open Blend File operator
Add operator 'Open Blend File' to the Asset Browser. This operator:
- starts a new Blender process,
- opens the blend file containing the asset,
- monitors the new Blender process, and when it stops,
- reloads the assets to show any changes made.
2021-07-15 16:12:36 +02:00
637731dc61 Assets: Abstraction for temporary loading of asset data-blocks
This is an editor-level abstraction for the `BLO_library_temp_xxx()`
API for temporary loading of data-blocks from another Blend file. It
abstracts away the asset specific code, like asset file-path handling
and local asset data-block handling.

Main use-case for this is applying assets as presets that are based on
data-blocks, like poses. Such preset assets are an important part of the
asset system design, so such an abstraction will likely find more usage
in the future.
2021-07-15 16:12:36 +02:00
55d48defc5 File/Asset Browser: Extend file-entry and asset handle Python API
Adds the following to `bpy.types.FileSelectEntry`:
* `id_type`: The data-block type the file represenets, if any.
* `local_id`: The local data-block it represents, if any (assets only).

And the following to `bpy.types.AssetHandle`:
* `local_id`: The local data-block the asset represents, if any.

This kind of information and the references are important for asset related
operators and UIs. They will be used by upcoming Pose Library features.
2021-07-15 16:12:36 +02:00
a26a059244 Assets: Initial Asset List as part of the Asset System design
Implements a basic, WIP version of the asset list. This is needed to
give the asset view UI template asset reading and displaying
functionality.

See:
* Asset System: Data Storage, Reading & UI Access - https://developer.blender.org/T88184

Especially the asset list internals should change. It uses the
File/Asset Browser's `FileList` API, which isn't really meant for access
from outside the File Browser. But as explained in T88184, it does a lot
of the stuff we currently need, so we (Sybren Stüvel and I) decided to
go this route for now. Work on a file-list rewrite which integrates well
with the asset system started in the `asset-system-filelist` branch.

Further includes:
* Operator to reload the asset list.
* New `bpy.types.AssetHandle.get_full_library_path()` function, which
  gets the full path of the asset via the asset-list.
* Changes to preview loading to prevent the preview loading job to run
  eternally for asset views. File Browsers have this issue too, but
  should be fixed separately.
2021-07-15 16:12:36 +02:00
add6fa0924 Assets: Show asset path in asset browser sidebar
It's useful to know where an asset is stored in, before this there was no way
to tell this. This could probably be displayed nicer in the UI but we're
currently unsure how. But at least the information is there now.
2021-07-15 16:12:36 +02:00
35affaa971 Assets: AssetHandle type as temporary design to reference assets
With temporary I mean that this is not intended to be part of the
eventual asset system design. For that we are planning to have an
`AssetRepresentation` instead, see T87235. Once the `AssetList` is
implemented (see T88184), that would be the owner of the asset
representations.

However for the upcoming asset system, asset browser, asset view and
pose library commits we need some kind of asset handle to pass around.
That is what this commit introduces.
Idea is a handle to wrap the `FileDirEntry` representing the asset, and
an API to access its data (currently very small, will be extended in
further commits). So the fact that an asset is currently a file
internally is abstracted away. However: We have to expose it as file in
the Python API, because we can't return the asset-handle directly there,
for reasons explained in the code. So the active asset file is exposed
as `bpy.context.asset_file_handle`.
2021-07-15 16:12:36 +02:00
3feb3ce32d Assets: Expose active asset library in context
For the Asset Browser, this returns the active asset library of the
Asset Browser, otherwise it returns the one active in the workspace.

This gives simple access to the active asset library from UI code and
Python scripts. For example the upcoming Pose Library add-on uses this,
as well as the upcoming asset view template.
2021-07-15 16:12:36 +02:00
7898089de3 Assets: Add an active asset library per workspace, for the UI to use
This per-workspace active asset library will be used by the asset views
later. Note that Asset Browsers have their own active asset library,
overriding the one from the workspace.

As part of this the `FileSelectAssetLibraryUID` type gets replaced by
`AssetLibraryReference` which is on the asset level now, not the
File/Asset Browser level. But some more work is needed to complete that,
which is better done in a separate commit.
This also moves the asset library from/to enum-value logic from RNA to
the editor asset level, which will later be used by the asset view.
2021-07-15 16:12:36 +02:00
Robert Sheldon
59f9a5e6ac Fix T88188: Allow keyframing vertex mass in cloth sim
Update vertex weights between simulation steps if they have changed.
This allows for animated vertex weights in the cloth sim.

Reviewed By: Sebastian Parborg

Differential Revision: http://developer.blender.org/D11640
2021-07-15 16:09:24 +02:00
60fee69682 Library loading: Fix access of out-of-scope memory in py context manager
The `__enter__` function of the `bpy.data.libraries.load` context manager
was storing a pointer to a stack-allocated variable, which was subsequently
used in the `__exit__` function, causing a crash. This is now fixed.

Thanks @Severin for the patch.
2021-07-15 16:04:22 +02:00
Paul Golter
3df40cc343 Fix: Subtitles: Order of channels in the .blend file will be kept in the .rst file.
If text strips have the same start frame but are stacked on top of each
other in different channels the order in which they are written in the
.rst file was random before.

Reviewed By: Richard Antalik

Differential Revision: https://developer.blender.org/D11903
2021-07-15 15:49:25 +02:00
Heinrich Schuchardt
468d59e496 Add support for RISC-V architecture
* On RISC-V GCC 10.3 does not define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n.
* Avoid a build error
  "Please add support for your platform in build_config.h"
  Cf: https://github.com/sergeyvfx/libNumaAPI/pull/3

Differential Revision: https://developer.blender.org/D11910
2021-07-15 14:22:35 +02:00
709e443152 Cleanup: LayerCollection resync: Proper r_ prefix for return function parameter. 2021-07-15 14:06:09 +02:00
ddc7e5f1b6 Cleanup: improve comments, remove debug printf 2021-07-15 21:09:39 +10:00
e509f9c3a0 Keymap: use Shift-Tab to toggle snap in the sequencer
Match the same shortcut for the 3D view & UV editor.
2021-07-15 20:58:13 +10:00
e7e5fd96c4 Cleanup: LayerCollection resync code.
Mainly naming (also droping the `layer_collection`  in favor of just
`layer` for internal code, this is clear enough and much shorter). Add
proper parent/child identifiers, `r_` prefix for parameters also used as
return values, etc.

Also made some parameters const.
2021-07-15 12:49:43 +02:00
2e8641e45e Fix: crash when creating new node links
This was a regression in rBc27ef1e9e8e663e02173e518c1e669e9845b3d1f.
2021-07-15 12:43:59 +02:00
ae30f72c80 Fix T89870: Vertex groups lost when opening 3.0 files in 2.93
The original refactor for vertex groups (3b6ee8cee7)
forgot to bump the minimum file requirement.

I'm also bumping the subversion to 12 so everyone can switch to a
working subversion number.

Differential Revision: https://developer.blender.org/D11931
2021-07-15 12:23:34 +02:00
49b798ca7e macOS/glog: Silence syscall deprecation warning
Upstream will release the fix in 0.6 which will take time.
Silence two warnings.

Differential Revision: https://developer.blender.org/D11246
2021-07-15 15:23:06 +05:30
c614eadb47 Keymap: use Alt-Q instead of D for transfer mode operator
This now works in all modes (not just sculpt) and activates on press
instead of release. See design task T89757.
2021-07-15 19:13:22 +10:00
757ec00f83 Revert "Keymap: use D-Key for view-pie menu"
This reverts commit f92f5d1ac6.

See: T89757 for rationale for reverting this change.
2021-07-15 19:13:22 +10:00
de913516dd Fix: missing null check
This was a regression in rB3b6ee8cee7080af200e25e944fe30d310240e138.
2021-07-15 11:07:41 +02:00
c27ef1e9e8 Geometry Nodes: dim links whose start and end sockets are not visible
This makes node trees with long links that cross other nodes easier to work with.
Dimmed links will be ignored by various modal operators like cut and reroute insertion.

Differential Revision: https://developer.blender.org/D11813
2021-07-15 11:00:23 +02:00
d5e626b243 Cleanup: use raw strings, quiet clang-tidy warnings 2021-07-15 18:29:20 +10:00
8e8a6b80cf Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text")
This shows the text as part of the assertion message.
2021-07-15 18:29:01 +10:00
a63a0ee24b Cleanup: clang-format 2021-07-15 18:14:51 +10:00
d35b14449e Cleanup: ensure one newline at end of file, strip trailing space 2021-07-15 17:53:26 +10:00
41e0a5b5ed CMake: update config for checking utility 2021-07-15 17:52:27 +10:00
15cdcb4e90 BLI_task: add a callback to initialize TLS
Useful when TLS requires it's own allocated structures.
2021-07-15 14:45:46 +10:00
5cd1aaf080 BLI_memarena: support merging memory arenas
Useful when thread-local storage has it's own memory arena containing
data which is kept after the multi-threaded operation has finished.
2021-07-15 14:37:26 +10:00
4be166b6b5 deps_builder: zstd 1.5.0
Having zstd available is a requirement for landing D5799

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11079
2021-07-14 18:22:23 -06:00
4e65b1ef6c GHOST/wayland: create mmap-ed file manually if memfd_create is unavailable 2021-07-14 23:15:00 +01:00
ebf7673f83 CMake: Have CMake Control the C++ version.
We were manually setting the compiler flags
for C++17 support for this previously. CMake
can do this for us in a uniform way without
having to worry about compiler specifics.

Setting these flags manually somehow brought
out some unwanted behaviour (CMake switching
back to C++14) in the nightly CMake builds.

Unsure if that's a CMake bug or planned
new behaviour for future version, but best
to play it safe.

These flags are supported since CMake 3.1
so should not break anything.

Reviewed by: Campbell Barton

Differential Revision: https://developer.blender.org/D11891
2021-07-14 15:17:02 -06:00
093074aefe Bezier Spline: Add a more generalized insertion utility
This logic is from the curve sundivide node, used to add points with
proper handles in between two existing points. However, the same logic
is used for trimming of Bezier splines, and possibly interactive point
insertion in the future, so it's helpful as a general utility.

The logic is converted to depend on a bezier spline instead of being
static. A temporary segment spline can be used for the latter use case.
2021-07-14 15:13:17 -04:00
2829caa9f8 Cleanup: Layer resync: Split object/base resync part in own function.
No behavioral change expected here.
2021-07-14 17:49:57 +02:00
c202d38659 Python API: Add functions to ensure and clear IDProperties
This adds id_properties_clear() and id_properties_ensure() functions
to RNA structs. This is meant as an initial change based on discussion
in review of D9697. However, they may be useful in other situations.

The change requires refactoring the internal idproperties callback to
return a pointer to the IDProperty pointer, which actually turns out
to be quite a nice cleanup.

An id_properties attribute could be added in the future potentially.

Differential Revision: https://developer.blender.org/D11908
2021-07-14 10:51:28 -04:00
37a5ff4a84 Tests: support graphing peak memory in Cycles performance tests
The general graphing mechanism will create one graph for each output
variable. So it's not limited to time and memory, but that is what the
Cycles tests now output.
2021-07-14 16:12:10 +02:00
2acebcae24 Cleanup: Avoid duplication in line art stroke generation
The BKE_gpencil_stroke_add_points API function worked well for
creating the primitives in the add object menu, but it expected a
specific data format that doesn't make sense in a dynamic context.
As evidence of that we can see the way source data was duplicated
in the line art file just to use this API function.

This commit solves that problem in two ways:
 - Clean up the line art function (this should make it faster too).
 - Move/rename the function so its intended use is more clear.

Differential Revision: https://developer.blender.org/D11909
2021-07-14 10:11:41 -04:00
3de3c3c23a Fix (unreported) LibOverride diffing generating operations for non-editable properties.
Non-pointer-like properties that are not editable should never generate
override operations.

While harmless (those would never be applied back anyway), better not
clutter override operations list, and also enjoy the symbolic
performances improvement here.

NOTE: Pointer-like properties (pointers and collections) remain
processed as usual here since they usually imply recursivity. We could
make an exception to the exception for ID pointers, but for now I don't
think this is worth it.
2021-07-14 14:23:19 +02:00
c9e9a42215 Fix T89771: Cloth disk cache is not read on library overrides in some cases.
Issue would happen when the original, linked data already had 'Disk Cache'
setting enabled. Override would then see no difference with linked data,
and not create any rule for it (as expected).

Root of the issue was that in Cloth modifier copy code, those disk cache
settings were not copied at all, so every time local overrides were
re-generated by copying linked data, those flags would be reset to their
default values.

NOTE: this might exist in other PointCache usages as well, but this code is
in such a bad state that I'd rather do minimal strictly needed changes
there, on a case-by-case basis. Proper recode of that whole system is
wayyyyy out of scope here.
2021-07-14 14:23:19 +02:00
f0ddbcb31d Cleanup: Turn PointCache flags defines into an anonymous enum. 2021-07-14 14:23:19 +02:00
7cd91a06eb Fix T88908: Incorrect path handling in adding strips
When image strip is added from python using `image_strip_add` operator
and directory path is not terminated with slash, last part of directory
was ignored.

Use `BLI_join_dirfile` instead of simple string concatenation.
2021-07-14 13:56:09 +02:00
efe90944ee Fix crash displaying invalid enum value with translations enabled
Found loading a cycles-x .blend file saved with different integer values for
enum items.
2021-07-14 13:54:52 +02:00
765406cb51 Fix T88088: Cycles and Eevee Vector Rotate node inconsistent with zero axis
Pass along the unmodified vector in this case.
2021-07-14 13:54:52 +02:00
2761679180 Fix T89826: VSE snapping with constrained axis
Constraining to X axis caused snapping to not work at all. Constraining
to Y axis caused snapping indicator to be drawn, when snapping doesn't
occur.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11898
2021-07-14 13:22:40 +02:00
5583d51773 Fix T89851: Geometry nodes: wrongly detected "Node group has unidentified
nodes or sockets" error

rBfe22635bf664 introduced a utility to check for this (but it was always
returning true).

This wasnt a problem in master (since it is unused there), but in the
2.93 branch, this utility is actually used and the error results in all
geometry nodetrees to appear with the "Node group has unidentified nodes
or sockets" message (and being unusable).

Now return false in has_undefined_nodes_or_sockets if all nodes and
sockets have been successfully checked.

This commit then needs to end up in the 2.93 branch.

Maniphest Tasks: T89851

Differential Revision: https://developer.blender.org/D11911
2021-07-14 11:55:07 +02:00
192f0c9e17 Fix T89734: incorrect dependency cycle with id property on modifier
Differential Revision: https://developer.blender.org/D11851
2021-07-14 11:25:15 +02:00
271f34f77e Geometry Nodes: initial socket inspection
Socket inspection helps with debugging a geometry node group.
Now, when hovering over a socket, a tooltip will appear that provides
information about the data in the socket. Note, socket inspection only
works for sockets that have been computed already. Nodes that are not
connected to an output are not computed.

Future improvements can include ui changes to make the tooltip look
more like in the original design (T85251). Furthermore, additional
information could be shown if necessary.

Differential Revision: https://developer.blender.org/D11842
2021-07-14 11:21:10 +02:00
3e125d12af Fix T89849: Time offset not working with Bake Object transform to Grease pencil
The bake animation was not using the remap of time done by grease pencil time modifier.
2021-07-14 11:09:25 +02:00
6644e96f01 Cleanup: use BMLoop.next/prev for BMesh auto-smooth logic
Use more direct access to next/previous vertices.

- `BM_edge_other_vert(l_curr->e, l_curr->v)` -> `l_curr->next->v`.
- `BM_edge_other_vert(l_curr->prev->e, l_curr->v)` -> `l_curr->prev->v`.

Add asserts to keep the intention clear.
2021-07-14 14:22:13 +10:00
ae379714e4 Transform: Identify more safely when the mesh is deform only
Depending on the modifiers, geometry can be destructive which is not safe.
2021-07-13 18:59:42 -03:00
96a4b54cfb Compositor: Full frame Render Layers node
Adds full frame implementation to this node operations.
No functional changes.
2.5x faster than tiled fallback on average.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11690
2021-07-13 22:34:28 +02:00
538f452ea9 Compositor: Full frame Translate node
Adds full frame implementation to this node operation.
No functional changes.
2021-07-13 22:34:28 +02:00
2ea47057d3 Compositor: Fix pixels being wrapped outside buffer area
Not causing issues in current master because all buffer areas are at
(0, 0) position and `Extend` is not used. But areas may be at any
position in future developments and it will crash.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11784
2021-07-13 22:34:28 +02:00
209aff0a35 Compositor: Fix convert resolutions linking different socket datatypes
Link sockets are always connected to inserted translate or scale
operation `Color` sockets even when they have different data type.
This causes crashes on full frame mode when operations read inputs 
with non expected datatypes.

Because data type conversions need to be executed before, convert
resolutions must ensure same datatypes are linked.
2021-07-13 22:32:53 +02:00
3b6ee8cee7 Refactor: Move vertex group names to object data
This commit moves the storage of `bDeformGroup` and the active index
to `Mesh`, `Lattice`, and `bGPdata` instead of `Object`. Utility
functions are added to allow easy access to the vertex groups given
an object or an ID.

As explained in T88951, the list of vertex group names is currently
stored separately per object, even though vertex group data is stored
on the geometry. This tends to complicate code and cause bugs,
especially as geometry is created procedurally and tied less closely
to an object.

The "Copy Vertex Groups to Linked" operator is removed, since they
are stored on the geometry anyway.

This patch leaves the object-level python API for vertex groups in
place. Creating a geometry-level RNA API can be a separate step;
the changes in this commit are invasive enough as it is.

Note that opening a file saved in 3.0 in an earlier version means
the vertex groups will not be available.

Differential Revision: https://developer.blender.org/D11689
2021-07-13 12:10:34 -04:00
52b94049f2 Fix 'Correct Face Attributes' option
With this option enabled, updating the geometry is no longer deform only.
2021-07-13 12:51:29 -03:00
2373a2196e Cleanup: duplicate checks, unused initialization 2021-07-13 22:41:48 +10:00
6a0fe79db5 Cleanup: replace BKE_customdata.h in BKE_editmesh.h
Only DNA_customdata_types.h is needed for BMEditMesh.
2021-07-13 22:23:17 +10:00
10428ca472 Cleanup: reduce indentation 2021-07-13 22:14:42 +10:00
d31abfef2c Fix x/y mismatch in retract region tracker
Correct X/Y mismatch in RetrackRegionTracker.

NOTE: This isn't used at the moment.

Reviewed By: sergey

Ref D11895
2021-07-13 21:58:45 +10:00
6a5e1bf9a1 Cleanup: improve BMEditMesh docstrings
Also remove white-space added last commit.
2021-07-13 21:24:46 +10:00
488690c864 Cleanup: minor changes to recent sequencer clipboard addition
- Make the variable to store the name 'static'.
- Use STRNCPY macro.
- Set the first character to nil instead of memset for the while string.
2021-07-13 21:23:35 +10:00
d374469f4c VSE: Make pasted strip active
When adding texts or various simple effects I often copy-paste strips
to reuse properties from a template such as font or position. I assume
this is common workflow. Issue with this workflow is, that active strip
is not changed after pasting, so when adjusting property, it is original
strip that is being modified.

This is not issue when duplicating strips - selection state is
transfered to duplicate strips, such that duplicate of active strip is
set to be active and duplicate of selected strip is set to selected.

Implement same selection transfering behavior in paste operator, that
exists in duplicate operator.

Since strip can be deleted after copying, it is not possible to rely
on sequencer state. This is true even when pasting strips to different
scene. Therefore active strip name must be stored in clipboard.

Reviewed By: sergey, Severin

Differential Revision: https://developer.blender.org/D11781
2021-07-13 12:53:56 +02:00
af42b35e53 Fix UV snapping broken
Caused by fba9cd019f, then fixed by 0e4245bc28, but without
subversion bump, so some files were still broken after fix.

Repeat fix again, but this time also bump subversion.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D11864
2021-07-13 12:52:57 +02:00
71b4a1687e Cleanup: clang-tidy, comments 2021-07-13 20:51:24 +10:00
25c2875e0f Edit Mesh: use partial updates editing vertices with number buttons
Use the same partial-update functions used by transform when
editing vertex locations with the number buttons.

This avoids unnecessary calculations for normals and tessellation.

This gives around 1.44x overall speedup on high poly meshes.
2021-07-13 20:17:30 +10:00
8839b4c32a UI: support persistent state during number/slider interaction
Support for begin/update/end callbacks allowing state to be cached
and reused while dragging a number button or slider.

This is done using `UI_block_interaction_set` to set callbacks.

- Dragging multiple buttons at once is supported,
  passing multiple unique events into the update function.

- Update is only called once even when multiple buttons are edited.

- The update callback can detect the difference between click & drag
  actions so situations to support skipping cache creation and
  freeing for situations where it's not beneficial.

Reviewed by: Severin, HooglyBoogly

Ref D11861
2021-07-13 20:03:40 +10:00
1b4d5c7a35 Undo System: avoid redundant decoding on undo
In most cases the undo system was loading undo steps twice.

This was needed since some undo systems (sculpt, paint, text)
require stepping out of the current undo step.

Use a flag to limit this to the undo systems that need it.

This improves performance for other undo systems.
This gives around 1.96x speedup in edit-mesh for high-poly objects.

Reviewed by: mont29

Ref D11893
2021-07-13 19:43:05 +10:00
f9c9e000ca Undo: optimize edit-mode undo
- Tag the object data instead of the object when decoding
  (this avoids duplicating mesh object-data on each undo-step).
- Calculate face normals as part of multi-threaded tessellation.

This gives ~11% speedup with 1.5x million polygons.
2021-07-13 17:10:30 +10:00
7a4fc9f59d Cleanup: quiet stringop-overflow compiler warning 2021-07-13 16:54:25 +10:00
22c4323b21 Cleanup: remove commented code
Replace with brief note in warning.
2021-07-13 15:27:38 +10:00
7a084c2eee Cleanup: minor changes to edit-mesh API calls
Rename:

- EDBM_mesh_free -> EDBM_mesh_free_data
  BKE_editmesh_free -> BKE_editmesh_free_data

  Since this doesn't free the edit-mesh pointer.

- BKE_editmesh_free_derivedmesh -> BKE_editmesh_free_derived_caches

  Since this no longer uses derived-mesh, match naming for the related
  object function BKE_object_free_derived_caches.

Also remove `do_tessellate` argument from BKE_editmesh_create,
since the caller can explicitly do this if it's needed,
with the advantage that it can be combined with normal calculation
which is faster on high-poly meshes.
2021-07-13 15:13:33 +10:00
b90b1af25c Event Simulate: and a --time-actions command line argument
When enabled, print the time taken between running actions.
2021-07-13 14:50:52 +10:00
5098678308 Cleanup: Use correct _WIN32/64 defines for MSVC
Docs: https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros

Differential Revision: https://developer.blender.org/D11460
2021-07-12 21:01:18 -07:00
dc679f6247 Cleanup: Use C99 format string for the SIZET_FORMAT macro
All platforms support the proper format string and it's already used in
various other places.

Differential Revision: https://developer.blender.org/D11460
2021-07-12 20:32:37 -07:00
2e7e7a6fb6 Fix object "Set Origin" operating on linked library data
Regression in d25747ee75
2021-07-13 13:03:39 +10:00
d6b1d35bf8 Cleanup: Use C++ float3 type, use prefix for return argument 2021-07-12 17:24:45 -04:00
Germano Cavalcante
bfa3dc91b7 Depsgraph: Implement 'ID_RECALC_GEOMETRY_DEFORM'
During a mesh transformation in edit mode (Move, Rotate...), only part of
the batch cache needs to be updated.

This commit allows only update only the drawn batches seen in
`BKE_object_data_eval_batch_cache_deform_tag` if the new
`ID_RECALC_GEOMETRY_DEFORM` flag is used.

This new flag is used in the transforms operation for edit-mesh and
results in 1.6x overall speedup in heavy subdiv cube.

Differential Revision: https://developer.blender.org/D11599
2021-07-12 18:05:13 -03:00
7b6c77aa84 Fix T88015: Round end caps on Freestyle lines not shaped as documented
This might be an artistic choice, but round end caps are supposed to be
a "half circle centered at the end point of the line" as documented
here: https://docs.blender.org/manual/en/dev/render/freestyle/
parameter_editor/line_style/strokes.html#caps

They are a shashed half circle instead.

This patch makes this pure half circles [and also fixes the case where
thickness of beginning was used for both beginning and end of the
stroke]

Maniphest Tasks: T88015

Differential Revision: https://developer.blender.org/D11340
2021-07-12 22:14:57 +02:00
7b954ba7a1 GHOST/wayland: remove unused 'input-event-codes.h' header
This was accidentally committed by rBecbf838feefc.
2021-07-12 20:20:08 +01:00
5e1702e7a5 Fix T87844: Cycles losing 1 bit of precision when loading packed byte images
This could lead to colors that are supposed to be exactly white to be slightly
darker.
2021-07-12 19:19:04 +02:00
Johnny Matthews
2a41ab5e6c Geometry Nodes: Curve Primitive Quadrilateral
This commit adds a curve primitive node for creating squares,
rectangles, trapezoids, kites, and parallelograms. It also includes
a mode where the four points are just vector inputs.

Differential Revision: https://developer.blender.org/D11665
2021-07-12 13:11:52 -04:00
a072e87e04 Fix T89040: dependency graph not handling time remapping correctly
In this bug report it resulted in rendering animations stopping too early,
but this affected more areas.

After the previous cleanup commit, it becomes clear that frame and ctime
values were mixed up.
2021-07-12 17:41:26 +02:00
2ea565b0ec Cleanup: improve naming and comments of scene frame/ctime functions
Confusingly, BKE_scene_frame_get did not match the frame number as expected by
BKE_scene_frame_set. Instead it return the value after time remapping, which
is commonly named "ctime".

* Rename BKE_scene_frame_get to BKE_scene_ctime_get
* Add a new BKE_scene_frame_get that matches BKE_scene_frame_set
* Use int/float depending if fractional frame is expected
2021-07-12 17:41:15 +02:00
f709f12d93 Fix T89736: Cycles error with persistent data, displacement and motion blur 2021-07-12 15:56:31 +02:00
45a47142fc Fix T89396: Cycles missing passes with multiple view layers and persistent data 2021-07-12 15:40:45 +02:00
5f3f5db95d Cleanup: Clang format
Sorry, missed this in 53cf8e83b3.
2021-07-12 14:40:26 +02:00
8e69409eed Fix T89775: geometry nodes logging crash during render
Under some circumstances (e.g. when rendering) the geometry
nodes logger is not used. This was missing a simple null check.
2021-07-12 14:29:28 +02:00
280dac323c Blenlib: Add BLI_assert_msg() for printing an extra string if the assert fails
It always bothered me that we'd do the `BLI_assert(... || !"message")` trick to
print a message alongside the assert, while it should be trivial to have a way
to pass an extra string as additional argument.

This adds `BLI_assert_msg()` with a second argument for a message. E.g.:
```
BLI_assert_msg(
    params->rename_id == NULL,
    "File rename handling should immediately clear rename_id when done, because otherwise it will keep taking precedence over renamefile.");
```

On failure this will print like this:
```
0   Blender                             0x00000001140647a3 BLI_system_backtrace + 291
[...]
13  Blender                             0x00000001092647a6 main + 3814
14  libdyld.dylib                       0x00007fff203d8f5d start + 1
BLI_assert failed: source/blender/editors/space_file/file_ops.c:2352, file_directory_new_exec(), at 'params->rename_id == ((void*)0)'
  File rename handling should immediately clear rename_id when done, because otherwise it will keep taking precedence over renamefile.
```

Reviewed by: Sybren Stüvel, Jacques Lucke, Sergey Sharybin, Campbell Barton

Differential Revision: https://developer.blender.org/D11827
2021-07-12 11:46:24 +02:00
c4f9bfcf5e Fix T89765: boolean modifier collection refcount issue
The 'collection' property is flagged PROP_ID_REFCOUNT, so the
modifiers foreachIDLink functions should walk with IDWALK_CB_USER
(instead of IDWALK_CB_NOP).

Otherwise the modifier wont be included as a user for the collection
(e.g. on file read); removing the collection from the modifier will
decrement usercount though (which in worst case scenario makes the
collection orphan and will result in data loss)

Maniphest Tasks: T89765

Differential Revision: https://developer.blender.org/D11877
2021-07-12 10:48:27 +02:00
2289e26fa3 Cleanup: correct spelling in comments, remove profanity 2021-07-11 15:31:36 +10:00
0f201049b4 Edit Mesh: tag the object data for updating instead of the object
When editing vertices with number buttons, tag the mesh, not the object.

This prevents the evaluated mesh being re-created for the object
and is correct as the mesh is being edited not the object.

Note that all tags for updating object geometry should be checked
to see if this change should be applied there too.

From a simple test on a high-poly mesh this gives around 1.3x
overall speedup.
2021-07-11 15:22:20 +10:00
49a363f0e0 LineArt: Fix edge type panel use_cache prop.
The name was mistakenly written as `use_cached_result`. Fixed.
2021-07-10 21:52:35 +08:00
77a28f34d5 LineArt: Fix modifier apply.
After cache implementation line art apply will not show strokes properly, now fixed.

# Conflicts:
#	source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
2021-07-10 14:04:23 +08:00
62d9dabc7d UI: Clip: Fix checkbox wrongly greying out entire column
The Pattern and Search display options in the Clip Editor display settings
are independent and should not be grayed out since those options
remain relevant even with path display turned off.

Alternative solution were propoesed in D11630 and D11715
but each of those patches had downsides.
This solution is the simplest and does not break muscle memory.
2021-07-09 19:23:08 -04:00
d5e91ae883 make.bat: Update detection order of MSVC
VS2019 is the preferred version to use these
days, look for it before looking for 2017
and 2022.
2021-07-09 15:17:05 -06:00
53cf8e83b3 Fix channel packed images display in the Image/Node editor
Channel packed images should not have their RGB affected by alpha.
rendering in Cycles and Eevee was fine already, but displaying these was
not right in the Image and Node editors.

Not 100% sure what to do for the "Color and Alpha" mode, but I guess
this should stay like it was before (applying the alpha).

"Color", "R", "G", and "B" modes were changed to not have color be
affected by alpha though.

ref. T89034

Maniphest Tasks: T89034

Differential Revision: https://developer.blender.org/D11871
2021-07-09 22:00:04 +02:00
Johnny Matthews
d7f88982a8 Geometry Nodes: fix direction mode in curve primitive line node
Differential Revision: https://developer.blender.org/D11872
2021-07-09 18:34:40 +02:00
4c716ced09 Fix a compiler warning on Windows for Exact Boolean.
For some reason, the Windows compiler didn't like the
static function being used in the parallel_reduece.
2021-07-09 09:29:33 -04:00
09082f6e85 Fix: crash when using empty attribute search 2021-07-09 15:21:25 +02:00
c749c24682 Walk Navigation: Z axis correction
Fly navigation has always had this option. They is particularly useful
when users use "Trackball" as their orbit method.

For walk navigation this works as a one off option. Not as a toggle like
for fly navigation.

Differential Revision: https://developer.blender.org/D11863
2021-07-09 15:03:50 +02:00
Sybren A. Stüvel
c04cceb40e Fix T89435: Reordering FCurves can cause crash or corruption
Correctly reset `prev` and `next` pointers of action group FCurves when
separating them into distinct `ListBase`s per `bActionGroup`.

These `NULL` pointers are necessary to temporarily demarcate the start &
end of the `bActionGroup::channels` list. Having them still point to
other FCurves caused ordering issues when moving curves towards the
start/end of a group.

This commit corrects the above issue and adds versioning code to rectify
any ordering issues that may have been caused. For this purpose the
`BKE_action_groups_reconstruct()` function is rewritten to avoid relying
on the `bAction::curves` list order or `prev` link integrity.

Differential Revision: https://developer.blender.org/D11811
2021-07-09 12:21:12 +03:00
b69ab42982 Deps: upgrade OpenXR 1.0.14 → 1.0.17
Simple upgrade of OpenXR to 1.0.17. A version bump was enough, no
Blender code had to change.

Reviewed By: LazyDodo, mont29

Differential Revision: https://developer.blender.org/D11848
2021-07-09 11:06:40 +02:00
16099c00d0 Fix cycles crash when changing viewport display pass
It was possible that render buffers and scene kernel data will be out
of sync because reset and scene update happens in different locks.

This is similar issue we've fixed in the Cycles X branch, so backported
relevant changes from there.

This change removes what seems to be unused feature kernel.

Differential Revision: https://developer.blender.org/D11828
2021-07-09 10:43:47 +02:00
8dd941cac0 Tracking: Fix "Lock to Selection" option from header causing jump
This change makes the behavior consistent between shortcut and
option from space clip's header.

The only caveat is that the "Lock to Selection" is removed from the
Display popover. This is because it is rather hard to make operator
to render same as regular checkbox. However, shouldn't be a problem
because the setting in popover was redundant.

Differential Revision: https://developer.blender.org/D10423
2021-07-09 10:37:36 +02:00
249a7e2307 Cleanup: Walk Navigation define remame
WALK_MODAL_TOGGLE > WALK_MODAL_GRAVITY_TOGGLE
2021-07-09 10:27:29 +02:00
8225b610dd Fix typo in Fly mode tooltip
The bug was always around and was introduced with the original code
e2a7168e96 (2009).
2021-07-09 10:21:02 +02:00
07faa3c5ac Nodes: Moved group interface panel code to python.
The node group interface panels were still implemented in C.
Now they ported over to python for easier maintenance.

Differential Revision: https://developer.blender.org/D11834
2021-07-09 07:57:29 +01:00
d0c5c67e94 Make Single User: support object data animation
In addition to _object_ animation, now _object data_ (mesh, curve, ...)
animation can now be made single user as well.

This came up in T89369 and while it is possible to do this via the
Outliner [where all actions have to be selected individually], this
seems to be more convenient to be done from the 3DView.

note: usercount of the action is checked now, if it single-user already,
no copy takes place (same thing could/should be done for
single_object_action_users as well).

note2: obdata is made single user as well (otherwise duplicated actions
will be assigned to the same shared obdata - which does not result in
unique animadata which is what we are after here)

ref. T89369

Maniphest Tasks: T89369

Differential Revision: https://developer.blender.org/D11683
2021-07-09 08:09:43 +02:00
0416aa767f Cleanup: use 'uint' for BLI_array 2021-07-09 13:37:52 +10:00
7592a5097c BLI_array: add BLI_array_deduplicate_ordered utility & tests 2021-07-09 13:35:54 +10:00
ab70133db0 Cleanup: rename BKE_animdata_{add=>ensure}_id
Use the term `ensure` as existing data is used when present.
2021-07-09 11:53:16 +10:00
af8fb707da BLI: avoid calling deleted copy constructor in some compilers
Previously, this did not compile in VS 2017, because
`new T(initializer_())` would try to call the copy constructor of `T`.

Now, `initializer_` will construct the `T` inplace.
2021-07-08 19:54:09 +02:00
Pratik Borhade
4e5537d0ed Fix T89169: Rename Compositor Node "View Switch" to "Switch View" in search panel
Renaming compositor node in search panel "View Switch" to "Switch View"
for better consistency.

Reviewed By: dfelinto

Differential Revision: https://developer.blender.org/D11717
2021-07-08 14:59:26 +02:00
80d0b68290 GPencil: Support camera "Frame Selected" and object previews
Using the "Camera Fit Frame to Selected" operator didn't work for Grease Pencil
objects. The same issue caused grease pencil preview thumbnails to be useless
(e.g. when using "Mark Asset" on a Grease Pencil object).
Reason was that there was no logic to handle grease pencil data and its strokes
for the object display-point iterators used for the "Frame Selected" logic.

Addresses T89656.

Reviewed by: Antonio Vazquez, Campbell Barton

Differential Revision: https://developer.blender.org/D11833
2021-07-08 14:20:14 +02:00
5d54f38949 Fix: instances are made real when they shouldn't be
The original assumption that the `modifyMesh` function is only
called when the modifier is applied was wrong. There are still a
couple of other places calling it through `BKE_modifier_modify_mesh`.

Now there is an extra check that makes sure instances are only
realized when the modifier is actually applied.
2021-07-08 13:11:21 +02:00
c304807099 Fix compositor backdrop gizmo refresh problem when toggling sidebar
The backdrop image gizmo was not following the backdrop image, it
needs to be refreshed whenever the view changes. The region init
callback is executed whenever the region size changes, so that should be
a reliable place to do that.

Reported as part of T87591.
2021-07-08 13:08:10 +02:00
4c8a8950cf Cleanup: remove trailing spaces from install_deps.sh
No functional changes.
2021-07-08 11:38:48 +02:00
b6a35a8153 Outliner: use 'compacted' row for bones as well
In a collapsed hierarchy, some type of data are listed as one icon per
item (2.79 did this for all data),
others are 'compacted' as a single icon with a counter (also indicating
if the active item is down that collapsed hierarchy) from 2.80 on.

Not quite sure if {rB92dfc8f2673e} was meant to do this (if it was, this
was not working though because relevant code would only get executed for
object hierarchies it seems), so now this is done for bones as well.

Fixes T88413.

Maniphest Tasks: T88413

Differential Revision: https://developer.blender.org/D11404
2021-07-08 10:41:38 +02:00
7489427e4d Cleanup: spelling 2021-07-08 13:31:38 +10:00
c3cb565250 CMake: add missing headers, sort file lists 2021-07-08 13:21:22 +10:00
8346417d09 Fix crash displaying the sequencer without a valid 'scene->ed'
Regression in 45d54ea67f
2021-07-08 10:15:03 +10:00
nutti
695e025c82 Docs: Fix minor incorrect syntax errors
This patch fixes the incorrect syntax in documentations.

Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D11822
2021-07-07 19:41:46 -04:00
51019fbfce Cleanup: Consolidate tablet walk mode rotate factors.
Walk rotate speed for tablets was being modified at runtime by scaling
the user preference mouse_speed by a constant factor; this consolidates
scaling into the the compile time tablet scale factor in walkApply.

No change in behavior.
2021-07-07 16:33:50 -07:00
139c3f791e Cleanup: Remove wrong File Browser comment
Accidentally included this in rB01e1944cd455, it came from a merge
conflict.
2021-07-07 19:49:28 +02:00
54fa5041e2 Cleanup: Correct comment in earlier commit (f4cb3ccd9c)
Comment was based on an older version of the patch.
2021-07-07 19:38:37 +02:00
2b41b2f05b Cleanup: Code-style correction in Ghost (Clang-format) 2021-07-07 19:26:47 +02:00
f4cb3ccd9c Assets: Keep assets active after renaming, ensure they are scrolled into view
When renaming an ID somewhere in the UI after marking it as asset, it would
often get lost in the Asset Browser (scrolled out of view). It would also get
deactivated.
This patch makes sure that if an asset is active whose ID gets renamed, it is
kept active and visible. That is important for a fast, uninterrupted asset
creation workflow, where users often rename assets while working in the asset
browser.

Old code stored the new file-name to identify a file after re-reading the
file-list after the rename. For assets that doesn't work because there may be
multiple assets with the same name. Here the simple solution of just storing
the pointer to the renamed ID is chosen, rather than relying on the file-name
in this case. (Should be fine with undo, since the ID * reference is short
lived, it's not stored over possible undo steps. If it turns out to have
issues, I rather switch to a rename_id_uuid, but keep that separate from the
file->uid).

Reviewed by: Sybren Stüvel

Differential Revision: https://developer.blender.org/D11119
2021-07-07 19:24:06 +02:00
fb98f22ddd MSVC: Fix build issue with TBB
TBB includes in windows.h which will by
default define min/max macro's by default,
which collide with stl's min/mac functions.

this change instructs windows.h not to
add the offending macros
2021-07-07 10:55:27 -06:00
6b0869039a File Browser: Select files and directories after renaming
(Note: This is an alternative version for D9994 by @Schiette. The commit
message is based on his description.)

Currently, when a new directory is created it is not selected.
Similarly, when renaming an existing file or directory, it does not
remain active/highlighted blue after renaming.

This change makes sure the file or directory is always selected after
renaming, even if the renaming failed or was cancelled.
This has some usability advantages:
 - Open the newly created directory without having to select it (ENTER).
 - If you make a naming mistake, you can immediately fix that (F2)
   without having to click it again.
 - If you create a directory and forget to name it, you can fix that
   (F2) without having to select it.
 - This is consistent with many common File Browsers.

Further, selecting the item even after renaming failed or was cancelled
helps keeping the file in focus, so the user doesn't have to look for it
(especially if the renaming just failed which the user may not notice).
In other words, it avoids disorienting the user.

Also see D11119 which requires this behavior.

We could also always select the file/directory on mouse press. This
would make some hacks unnecessary, but may have further implications. I
think eventually that's what we should do though.
2021-07-07 18:41:27 +02:00
13672f8b32 Cleanup: Move file deselection function to more appropriate file
`filesel.c` seems like the place that should contain file selection
functions. Previously it was in `file_ops.c` because that was the only
file that actually used it. But a followup commit needs it from a
different file.
2021-07-07 18:41:27 +02:00
cffbfe5568 Fix crash accessing sequencer strips
Was caused by recent clange sequences_all iterator in RNA (D11793).
2021-07-07 14:22:52 +02:00
ecbf838fee Cleanup: comment on source of button event codes 2021-07-07 13:21:57 +01:00
0153e99780 Geometry Nodes: refactor logging during geometry nodes evaluation
Many ui features for geometry nodes need access to information generated
during evaluation:
* Node warnings.
* Attribute search.
* Viewer node.
* Socket inspection (not in master yet).

The way we logged the required information before had some disadvantages:
* Viewer node used a completely separate system from node warnings and
  attribute search.
* Most of the context of logged information is lost when e.g. the same node
  group is used multiple times.
* A global lock was needed every time something is logged.

This new implementation solves these problems:
* All four mentioned ui features use the same underlying logging system.
* All context information for logged values is kept intact.
* Every thread has its own local logger. The logged informatiton is combined
  in the end.

Differential Revision: https://developer.blender.org/D11785
2021-07-07 11:20:19 +02:00
77834aff22 Fix T89397: animation in geometry nodes modifier does not update
The geometry nodes modifier uses id properties for the inputs to node groups.
That is because the set of properties changes depending on which geometry
node group is selected.

The animation was not updated correctly because the `ANIMATION_EVAL`
depsgraph node was not evaluated, because nothing depended on it in the
depsgraph. This patch makes sure that the proper link to the geometry
component is inserted.

Differential Revision: https://developer.blender.org/D11831
2021-07-07 10:56:45 +02:00
3fe0088cab Fix T89559: Outliner shows extra view layer column when it shouldn't
This issue happened because of some miscommunication during the original
patch review. Since we have the parent element in other outliner modes
(Blender File, Data API) I was on the fence here. Rolling this back now
so that when Show All View Layers is off we don't see the current View
Layer top element.

The fix is simple, but it was better to format the code around to
follow the style in this file.

Differential Revision: https://developer.blender.org/D11830
2021-07-07 10:41:12 +02:00
8f94724f22 Cleanup: Sort nodes alphabetically 2021-07-06 23:33:02 -05:00
89831fae0c Cleanup: update filename references 2021-07-07 14:08:47 +10:00
0b1050bf09 Geometry Nodes: Rename nodes for clarity between mesh and curve
Rename the mesh circle to "Mesh Circle", mesh line to "Mesh Line",
and mesh subdivide to "Mesh Subdivide". Previously they looked exactly
the same in the search menu, and the nodes themselves had the same
label. This is a "deep" rename that also renames internal defines and
function names to match the UI.
2021-07-06 23:00:27 -05:00
Jagannadhan Ravi
eccdced972 Cleanup: Moving mesh_evaluate and mesh_normals to C++
No functional changes.

Reviewed By: HooglyBoogly

Ref D11744
2021-07-07 13:58:18 +10:00
5bbbc98471 Cleanup: spelling in comments 2021-07-07 13:42:46 +10:00
Angus Stanton
63a8b3b972 Geometry Nodes: Curve Endpoints Node
This node is quite similar to the curve to points node, but creates
points for only the start and end of each spline. This is a separate
node because the sampling from the curve to points node don't apply,
and just for ease of use.

All attributes from the curves are copied, including the data for
instancing: tangents, normals, and the derived rotations. One simple
use case is to make round caps on curves by instancinghalves of a
sphere on each end of the splines.

Differential Revision: https://developer.blender.org/D11719
2021-07-06 22:24:04 -05:00
31e6f0dc7a makesdna: fix parsing 'const', 'struct', 'unsigned' as a prefix
DNA parsing assumed any identifier which starts with
(`struct`, `unsigned`, `const`) was that identifier.

So a struct called `constTest foo;` would be parsed as `est foo;`.

Add utility function to check identifiers are not
part of a larger identifier.

This also supports skipping these identifiers in any order.

Reviewed By: LazyDodo

Ref D11837
2021-07-07 12:35:03 +10:00
f85ef3d442 Cleanup: clang-tidy, unused function 2021-07-07 12:34:00 +10:00
cd38daeff4 Fix T89702: Curve to points node assert on single point spline
This function could be refactored slightly if we assumed the input was
always sorted, but a special for a single point input is also fine.
2021-07-06 21:09:01 -05:00
0521272ab3 Fix: Curve Resample Node: Copy attributes to 1 point results
The curve resample node neglected to copy attributes to single point
result splines. That could have caused errors if some of the splines
in the result had only one point but others had more.
2021-07-06 20:42:33 -05:00
4e80573a76 VSE: Use snapping settings for scrubbing
Use "Snap Playhead to Strips" option to enable playhead snapping.
Change behavior of CTRL key to invert snapping similar to transform operator.

Currently this option is disabled by default. It makes editing quite unpleasant
for me personally, but ideally I should gather feedback from more users.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D11745
2021-07-07 03:26:14 +02:00
c5b2381703 VSE: Remove seq->tmp usage from RNA code
This field was used to reference "parent" meta strips in `sequences_all`
RNA collection iterator functions.

Use `SeqIterator` wrapped in `BLI_Iterator` to iterate over elements.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11793
2021-07-07 03:14:05 +02:00
45d54ea67f VSE: Fix cache bar not visible
Cache bar was only visible when Frame overlay was enabled

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11779
2021-07-07 03:02:01 +02:00
6ac3a10619 Compositor: Fix constant folded operations not being rendered
Many operations do not expect single element buffers as output.
Use full buffers with a single pixel instead.
2021-07-07 01:09:43 +02:00
1657fa039d Compositor: Fix crash when executing works in constant folding
Work scheduler needed initialization and execution models are
not created during constant folding. This moves work execution
method to execution system.
2021-07-07 01:09:31 +02:00
f49f406f67 GPencil: Rename BKE_gpencil_visible_stroke_iter
Renamed to  BKE_gpencil_visible_stroke_advanced_iter

Also created a simple version of the iterator to be used without multiframe and onion skin.
2021-07-06 22:18:49 +02:00
Vincent Blankfield
4a24c6fe37 UI: Center the Status Bar Progress Text
This patch horizontally centers the text inside the progress bar
widget. It is currently left-aligned and offset to the middle, which
doesn't center properly.

see D11205 for details and examples.

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

Reviewed by Julian Eisel
2021-07-06 12:17:42 -07:00
46a261e108 Compositor: Fix execution system unset during constant folding 2021-07-06 20:22:43 +02:00
40de5742af Fix: Crash when geometry nodes NURB spline has no evaluated points 2021-07-06 13:12:27 -05:00
586cf8b190 Nodes: Adds button to groups to change type of sockets.
The menu lists all socket types that are valid for the node tree.
Changing a socket type updates all instances of the group and keeps
existing links to the socket.
If changing the socket type leads to incorrect node connections the
links are flagged as invalid (red) and ignored but not removed. This is
so users don't lose information and can then fix resulting issues.
For example: Changing a Color socket to a Shader socket can cause an
invalid Shader-to-Color connection.

Implementation details:
The new `NODE_OT_tree_socket_change_type` operator uses the generic
`rna_node_socket_type_itemf` function to list all eligible socket types.
It uses the tree type's `valid_socket_type` callback to test for valid
types. In addition it also checks the subtype, because multiple RNA
types are registered for the same base type. The `valid_socket_type`
callback has been modified slightly to accept full socket types instead
of just the base type enum, so that custom (python) socket types can be
used by this operator.

The `nodeModifySocketType` function is now called when group nodes
encounter a socket type mismatch, instead of replacing the socket
entirely. This ensures that links are kept to/from group nodes as well
as group input/output nodes. The `nodeModifySocketType` function now
also takes a full `bNodeSocketType` instead of just the base and subtype
enum (a shortcut `nodeModifySocketTypeStatic` exists for when only
static types are used).

Differential Revision: https://developer.blender.org/D10912
2021-07-06 18:36:11 +01:00
933eddc9a1 cmake: use harvested 'wayland-protocols' if system version is insufficient 2021-07-06 18:17:27 +01:00
c26b46ddca cmake: add 'wayland-protocols' to 'make deps' 2021-07-06 18:17:27 +01:00
257bfb65b2 doc: add Wayland dependencies
The wayland support requires the following development packages:
libwayland-dev, wayland-protocols, libegl-dev, libxkbcommon-dev,
libdbus-1-dev, linux-libc-dev
2021-07-06 18:17:21 +01:00
a069fffcc4 GHOST/wayland: define BTN event codes manually 2021-07-06 18:17:21 +01:00
9182c882fe Geometry Nodes: Allow 3 points in curve star primitive 2021-07-06 12:11:09 -05:00
1364f1e35c Fix T89592: Can't remove keyframes without active keying set
Partially revert 7fc220517f, as it
introduced two issues:

- Deleting keys without active keying set was no longer possible, and
- there was no more confirmation popup.

Pressing {key Alt I} in the 3D Viewport now executes
`ANIM_OT_keyframe_delete_v3d`, adjusted to suit both T88068 and T89592:

- If there is an active keying set, delete keys according to that keying
  set.
- Otherwise, behave as `ANIM_OT_keyframe_delete_v3d` did before, that
  is, delete all keyframes of the selected object and in pose-mode also
  of selected bones.
2021-07-06 18:20:26 +02:00
563ef943c7 Cleanup: Keyframing, remove duplicate code
Remove duplicate code from the `ANIM_OT_keyframe_delete` operator. The
actions of the removed code are already performed by the preceding
`keyingset_get_from_op_with_error()` call.

No functional changes.
2021-07-06 18:20:26 +02:00
e2c4a4c510 Compositor: Graphviz improvements
Graphs are usually large, needing a lot of horizontal scrolling and
they can include more information for debugging.

This patch makes graph more compact horizontally by splitting
labels in lines and removing namespaces.
Furthermore it adds following information:
- Operation ID.
- SetValueOperation float value.
- Optionally, operation node name.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11720
2021-07-06 18:11:49 +02:00
5780de2ae0 Compositor: Enable constant folding on operations
Only on current full frame operations that can be constant.
2021-07-06 18:11:49 +02:00
fc5be0b598 Compositor: Constant folding
Currently there is no clear way to know if an operation is constant
(i.e. when all rendered pixels have same values). Operations may 
need to get constant input values before rendering to determine 
their resolution or areas of interest. This is the case of scale, rotate
and translate operations. Only "set operations" are  known as 
constant but many more are constant when all their inputs are so.
Such cases can be optimized by only rendering one pixel.

Current solution for tiled implementation is to get first pixel
from input. This works for root execution groups, others
need previous groups to be rendered.

On full frame implementation this is not possible, because buffers
are created on rendering to reduce peak memory and there is
no per pixel calls.

This patch evaluates all operations that are constant into primitive
operations (Value/Vector/Color) before determining resolutions.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11490
2021-07-06 18:11:49 +02:00
a070dd8bdd Cleanup: Set execution system as operations member in Compositor 2021-07-06 18:04:37 +02:00
1af722b819 Deps builder: macOS/ ffmpeg: Fix linker warning
ld: warning: could not create compact unwind for _ff_rl_init_vlc: stack
subq instruction is too different from dwarf stack size
Similar to rB2de5de57c58521862e0fecc95fc474ea347b7468

Differential Revision: https://developer.blender.org/D11796
2021-07-06 21:13:31 +05:30
Bastien Montagne
b05ba2ef0e Rename Scene's embeded collections from "Master Collection" to "Scene Collection"
Note that this name is essentially never used anywhere, besides as 'information'
mostly accessible from python console. Those embedded IDs are not in Main, so they
are not accessible by name ever, and mostly unusable from animation perspective
(either drivers or fcurves).

Therefore, no breakage is expected in user scripts or addons, nor when
loading in older versions of Blender.

Reviewed By: dfelinto, brecht

Differential Revision: https://developer.blender.org/D11812
2021-07-06 17:24:26 +02:00
7af40ccf5f GPU: Fix crash when using EGL with --gpu-debug flag.
During initialization of the platform a debug message is generated and
interpreted by de callback. Here the platform is checked what requires
an initialized platform.

Fixed by giving the platform check less priority in the check.
2021-07-06 14:24:42 +02:00
8f5a4a2453 Alembic export: evaluation mode option
This option will determine visibility on either render or the viewport
visibility. Same for modifer settings. So it will either evaluate the
depsgrah with DAG_EVAL_RENDER or DAG_EVAL_VIEWPORT.
This not only makes it more flexible, it is also a lot
clearer which visibility / modfier setting is taken into account (up
until now, this was always considered to be DAG_EVAL_RENDER)

This option was always present in the USD exporter, this just brings
Alembic in line with that.

ref. T89594

Maniphest Tasks: T89594

Differential Revision: https://developer.blender.org/D11820
2021-07-06 13:22:22 +02:00
834e87af7b Alembic: remove non-functional "Renderable Objects" only option
When introduced in {rB61050f75b13e} this was actually working (meaning
it checked the Outliner OB_RESTRICT_RENDER flag and skipped the object if
desired).

Behavior has since then been commented in rBae6e9401abb7 and apparently
refactored out in rB2917df21adc8.

If checked, it seemed to be working (objects marked non-renderable in
the Outliner were pruned from the export), however unchecking that
option did not include them in the export.

Now it changed - for the worse if you like - in rBa95f86359673 which
made it so if "Renderable Objects" only is checked, it will still export
objects invisible in renders. So since we now have the non-functional
option with a broken/misleading default, it is better to just remove it
entirely.

In fact it has been superseeded by the "Visible Objects" option (this
does the same thing: depsgraph is evaluated in render mode) and as a
second step (and to make this even clearer) a choice whether
Render or Viewport evaluation is used can be added (just like the USD
exporter has). When that choice is explicit, it's also clear which
visibility actually matters.

This is breaking API usage, should be in release notes.

ref. T89594

Maniphest Tasks: T89594

Differential Revision: https://developer.blender.org/D11808
2021-07-06 13:22:07 +02:00
ae8fa7062c Fix incompatible type passed to XR haptic
Likely caused by recent fixed-size types changes.
Seems to be no-functional-changes since the function is unused.
2021-07-06 12:36:42 +02:00
3382b07ad6 Cleanup: rename 'count' to 'len'
Reserve the term count for values that require calculation
(typically linked lists).
2021-07-06 12:09:52 +10:00
432bfbf7a3 Cleanup: pep8 2021-07-06 12:05:27 +10:00
36584bbc2d Cleanup: quiet discarded-qualifiers warning 2021-07-06 12:05:25 +10:00
4eeec6e9b5 Fix macOS builds after removing Ghost integral types. 2021-07-05 15:24:39 -07:00
ceff86aafe Various Exact Boolean parallelizations and optimizations.
From patch D11780 from Erik Abrahamsson.
It parallelizes making the vertices, destruction of map entries,
finding if the result is PWN, finding triangle adjacencies,
and finding the ambient cell.
The latter needs a parallel_reduce from tbb, so added one into
BLI_task.hh so that if WITH_TBB is false, the code will still work.

On Erik's 6-core machine, the elapsed time went from 17.5s to 11.8s
(33% faster) on an intersection of two spheres with 3.1M faces.
On Howard's 24-core machine, the elapsed time went from 18.7s to 10.8s
for the same test.
2021-07-05 18:09:36 -04:00
cf17f7e0cc Fix T89671: Crash when using Denoise node on Full Frame mode
Tiled fallback doesn't support single element buffers.
Ensure tiles are initialized as full buffers.
2021-07-05 23:36:43 +02:00
3d9ecf1cf2 Compositor: Full frame Color Balance node
Adds full frame implementation to this node operations.
No functional changes.
1.3x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11764
2021-07-05 23:36:43 +02:00
0c90aa097d Compositor: Full frame Color Correction node
Adds full frame implementation to this node operation.
No functional changes.
1.4x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11765
2021-07-05 23:36:43 +02:00
bf75106ae9 Compositor: Full frame Exposure node
Adds full frame implementation to this node operation.
No functional changes.
1.7x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11766
2021-07-05 23:36:43 +02:00
c94877ae3d Compositor: Full frame Gamma node
Adds full frame implementation to this node operation.
No functional changes.
1.5x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11767
2021-07-05 23:36:43 +02:00
00c6cbb985 Compositor: Add base operation for updating buffer rows
Simplifies code for operations with correlated
coordinates between inputs and output.
2021-07-05 23:36:43 +02:00
61afbf55f1 Cleanup: Use enum for UI block emboss type 2021-07-05 14:52:21 -05:00
Nicholas Rishel
f3ec0d8e58 Replace Ghost integrals with stdint fixed width integers.
Also replace integer with bool in Ghost API when only used as boolean,
and uint8* with char* in Ghost API when variable is a string.

Reviewed By: brecht

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

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2021-07-05 11:00:45 -07:00
b66c21f8b0 Geometry Nodes: Use same shape as mesh line in curve line node
The line starts at the origin and ends at (0,0,1m), just like the mesh node.
2021-07-05 12:42:33 -05:00
Johnny Matthews
29d6750134 Geometry Nodes: Curve Primitive Line
This node creates a poly spline line in one of 2 modes:
 - Line between two points
 - Start Point, Direction, and Length

Both modes create splines with only start and endpoints.
A resample node can be used afterward to increase the point count.

Differential Revision: https://developer.blender.org/D11769
2021-07-05 12:27:12 -05:00
de70bcbb36 Cleanup: Clang tidy, unused include
Also a stupidly-included change I made when committing the patch.
2021-07-05 12:05:28 -05:00
Nikhil Shringarpurey
fd0370acc2 Geometry Nodes: Add explicit Float to Int conversion node
This patch adds a very simple node that explicitly converts a float to
an int. While this may seem redundant, it would offer 2 benefits to the
current requirement to use implicit float conversions:
 1. It makes the node tree's intent more clear and self-documenting
    (especially if changes in the future require integer inputs).
 2. It eliminates undefined behavior in current/future nodes from float
    inputs by guaranteeing that the input is an integer.

The node offers a variety of rounding techniques to make it more flexible.

Differential Revision: https://developer.blender.org/D11700
2021-07-05 11:52:10 -05:00
08241b313c Fix (studio reported) missing object's parent handling in readfile expand code.
This would prevent loading a parent that would only be referenced by
children during a linking operation.

Looks like this missing bit of code has been there since the stone ages,
it is fairly baffling to find that such critical low-levels mistakes can
survive decades in a codebase...

Note that such fully-indirectly linked parent object is not instantiated
in scene currently, this is fairly bad I think, but kind of a different
issue.
2021-07-05 18:07:02 +02:00
Yuki Hashimoto
0ef794b553 macOS: support Chinese and Korean input for text buttons
This patch extends D11695 to provide full support for Chinese and Korean
input on macOS.

Chinese input notes:

You can input symbolic characters (such as '! , '$') during Chinese input.

The difference from Japanese input is that multiple `insertText` may be
called with a single key down (`keyDown` method). This happens when you input
a symbolic character (such as '! , '$') during conversion.

The conversion is confirmed (`insertText`) and the symbolic character is
entered (`insertText`). To solve this problem, I have `result_text` to
concatenate the strings and store them in `result`.

Korean input notes:

Korean does not display a conversion suggestion window.

Like Chinese, Korean input may call multiple `insertText` methods. Also,
in Korean, the previous confirmation (`setMarkedText` and `insertText`) and
the next conversion is processed (`setMarkedText`) may be called
simultaneously with a single key down (`keyDown` method).

For example:
1. press g ㅎ (`setMarkedText`)
2. press k 하 (`setMarkedText`)
3. press t 앗 (`setMarkedText`)
4. press k 하세 (`setMarkedText`, `insertText`, `setMarkedText`)

Fixed so that the `insertText` and the last `setMarkedText` are processed.

Also, if a control character (such as Arrow, Enter) is input during Korean
input, the conversion will be confirmed (`setMarkedText`, `insertText`) and
the original control character will be processed.

In other words, if you press the left arrow key while typing in Korean, the
cursor will move to the left after the character is confirmed. Therefore, I
modified the `keyDown` method so that the `handleKeyEvent` is called again
after the `insertText` is processed in the `interpretKeyEvents` method.

Differential Revision: https://developer.blender.org/D11699
2021-07-05 17:24:34 +02:00
Yuki Hashimoto
83e2f8c993 macOS: support Japanese input for text buttons
Blender did not support to input East Asian characters (Chinese, Japanese,
Korean) on macOS. This patch adds support for Japanese input, by implementing
the appropriate processing for the NSTextInputClient protocol.

Technical notes:
* The conversion candidate window is drawn by the input method program calling
  `firstRectForCharacterRange`.
* The string before confirmation (called `composite` in blender) is handled in
  the `setMarkedText` method called by the input method program.
* The string after confirmation (called `result` in the blender) is processed
  in the `insertText` method called by the input method program.

Ref T51283

Differential Revision: https://developer.blender.org/D11695
2021-07-05 17:24:27 +02:00
Yuki Hashimoto
ac1ed19eae Fix: macOS wrong IME candidate window position on first display
IME conversion candidate window was displayed at the mouse position, instead of
below the cursor or text selection.

Blender need to tell the input method program where the conversion candidate
window is during Japanese and Chinese input.

In macOS, the `firstRectforCharacterRange` is called when input by the input
method starts, and the position of the conversion candidate window is
specified. Therefore, it is necessary to set the position of the conversion
candidate window before input starts. This patch changes it so that the position
of the conversion candidate window is always set when the cursor is drawn.

Differential Revision: https://developer.blender.org/D11697
2021-07-05 17:20:05 +02:00
673c254c7d Cleanup: Rename ambiguous "params" variable in File Browser notifier listeners
File Browser code uses the term "params" for its file selection parameters a
lot. Avoid confusion/ambiguity by calling the notifier listener parameters
"listener_params".
2021-07-05 16:45:15 +02:00
cadda7aa5c Assets: Disable file renaming operator for Asset Browsers
This operator only works with renaming files, not assets.
2021-07-05 16:06:47 +02:00
b8115f0c5b Fix performance regression in Exact boolean due to exact triangulation.
Went back to using Blender's polyfill for triangulation, which is much
faster (time for a 3.1M face boolean went from 103s to 48s).
Had to put in detection for the case that needs the exact triangulator
(bug T86805), and also a fix for non-convex quads (bug T89330).
2021-07-05 10:00:29 -04:00
dac81ad71b EditMesh: extract restore logic out of EDBM_redo_state_free
Split mesh restore logic into a new function:
`EDBM_redo_state_restore_and_free`.
2021-07-05 23:45:21 +10:00
d27db03444 LineArt: Fix occlusion effectiveness for culled triangles. 2021-07-05 20:43:03 +08:00
Yuki Hashimoto
2d0b9faaf6 Fix: IME conversion candidate window not correctly placed on macOS
Blender needs to tell the input method program where the conversion
candidate window is during Japanese and Chinese input.

In macOS, there are displays where the window size and the native pixel size
are different, so the candidate window may appear in an unnatural position.

This patch converts the cursor position x and y for matching macOS window
coordinate. On Windows, GHOST_GetNativePixelSize returns 1, so it has no effect.

Differential Revision: https://developer.blender.org/D11696
2021-07-05 14:32:35 +02:00
Yuki Hashimoto
32124b940e Fix: IME input displays text after cursor before cursor
When inserting text using IME on a button, the character after the cursor is
displayed before the cursor.

This bug seems to have occurred during the refactoring in D765.

Differential Revision: https://developer.blender.org/D11072
2021-07-05 14:32:35 +02:00
bd0de99b52 Cleanup: spelling, punctuation 2021-07-05 22:27:03 +10:00
2ecc33d84b Cleanup: move repeated assignment out of nested for loop 2021-07-05 22:02:57 +10:00
6eb8340ef4 Cleanup: use const arguments 2021-07-05 22:02:57 +10:00
416e006a2a Cleanup: use 'use_' prefix for RNA booleans 2021-07-05 22:02:57 +10:00
92b775d319 Cleanup: remove unnecessary bmesh operator comments 2021-07-05 22:02:57 +10:00
ab6a011b3b GPencil: Fix memory leak in trim and split functions.
`dvert->dw` from old strokes are not freed properly, fixed.
2021-07-05 19:56:41 +08:00
aad8b8405c Fix T89655: tweak Cycles transparent bounces UI for clarity
Transparent bounces are independent of other bounces, so don't group
them together.
2021-07-05 13:42:54 +02:00
2eca9c7ed4 Cleanup: Move common File Browser renaming code into functions
Code would manually do the same things in a couple of places, obvious case of
unnecessary code duplication.
2021-07-05 13:35:41 +02:00
Yuki Hashimoto
2c6c1b6cc0 Cleanup: replace NSTextInput with NSTextInputClient
This revision replaces the deprecated protocol NSTextInput with
NSTextInputClient in Cocoa Text View. No functional changes.

For more information of the methods, please see:
https://developer.apple.com/documentation/appkit/nstextinputclient

Differential Revision: https://developer.blender.org/D11407
2021-07-05 13:10:08 +02:00
Yuki Hashimoto
c1ba68dd04 Cleanup: use arrayWithObject to reduce the code
Similar code is found in Apple's code samples.

Differential Revision: https://developer.blender.org/D11434
2021-07-05 13:10:08 +02:00
24a77745a4 Functions: add utility to create string from value of generic type 2021-07-05 13:02:16 +02:00
fb46c047bd BLI: wrap more features off tbb::enumerable_thread_specific
* Make the wrapper enumerable.
* Support an initializer function.
2021-07-05 13:02:16 +02:00
ded4dc7761 BLI: add conversion constructor for destruct_ptr
This allows converting between different `destruct_ptr` types (which is
just a `std::unique_ptr` with a custom deleter).

The most common use case is to convert from a derived type to
the type of the base class.
2021-07-05 13:02:16 +02:00
dc3f46d96b Tests: performance testing framework
These are scripts for benchmarking Blender features on real-world .blend
files. They were originally written for benchmarking Cycles performance, and
were made generic so they can be used for more Blender features.

The benchmarks can be run locally by developers. But the plan is to also run
these as part of continuous integration to track performance over time.

Currently there are tests for Cycles rendering and .blend file loading.

Documentation:
https://wiki.blender.org/wiki/Tools/Tests/Performance

Main features:
* User created configurations to quickly run, re-run and analyze a selected
  subset of tests.
* Supports both benchmarking with existing builds, and automatic building of
  specified git commits, tags and branches.
* Generate HTML page with bar and line graphs from test results.
* Controlled using simple command line tool.
* For writing tests, convenient abstraction to run a Python function in Blender
  with arguments and return value.

Ref T74730

Differential Revision: https://developer.blender.org/D11662
2021-07-05 12:32:32 +02:00
bb971bead9 Fix T89523: Cycles OpenCL compile error after shadow terminator changes 2021-07-05 11:26:40 +02:00
e785569c95 Cleanup: clang-tidy 2021-07-05 19:09:24 +10:00
c9eaf04afb Cleanup: remove outdated comment 2021-07-05 19:08:19 +10:00
a87593e62a Fix early return in reverse-color where continue was intended 2021-07-05 18:54:53 +10:00
9009ac2c3d Geometry Nodes: new Viewer node
This adds a viewer node similar to the one in the compositor.
The icon in the headers of nodes is removed because it served
the same purpose and is not necessary anymore.

Node outputs can be connected to the active viewer using
ctrl+shift+LMB, just like in the compositor. Right now this collides
with the shortcut used in the node wrangler addon, which will
be changed separately.

As of now, the viewed geometry is only visible in the spreadsheet.
Viewport visualization will be added separately.

There are a couple of benefits of using a viewer node compared
to the old approach with the icon in the node header:
* Better support for nodes that have more than one geometry output.
* It's more consistent with the compositor.
* If attributes become decoupled from geometry in the future,
  the viewer can have a separate input for the attribute to visualize.
* The viewer node could potentially have visualization settings.
* Allows to keep "visualization points" around by having multiple
  viewer nodes.
* Less visual clutter in node headers.

Differential Revision: https://developer.blender.org/D11470
2021-07-05 10:46:36 +02:00
04313f1bb5 BMesh: remove redundant mesh-backups from EDBM_op_* API
Using BMesh operators through the edit-mesh API created a full copy
of the mesh so it was possible to restore the mesh in case
one of the operators raised an error.

Remove support for automatic backup/restore from the EDBM_op_* API's
as it adds significant overhead and was rarely used.

Operators that need this can use the BMBackup API to backup & restore
the mesh in case of failure.

Add warning levels to BMO_error_raise so operators can report problems
without it being interpreted as a request to cancel the operation.

For high-poly meshes creating and freeing a full copy is an expensive
operation, removing this gives a speedup of ~1.77x for most operators
except for "connect_verts" / "connect_vert_pair"
which still uses this functionality.
2021-07-05 18:36:33 +10:00
afe7387be8 BMesh: remove redundant copy-on-write tagging
The evaluated meshes no longer store a copy of the edit-mesh
so tagging when a BMesh operator fails can be removed.
2021-07-05 18:31:44 +10:00
b29a8a5dfe BMesh: dissolve faces no longer fails when some faces can't dissolve
Previously, any face groups that could not be merged into a face
caused the entire operation to report an error and do nothing.

Now these cases are skipped over, dissolving faces where possible.
2021-07-05 18:31:44 +10:00
9075f63e8f Cleanup: unused variable 2021-07-05 10:29:21 +02:00
76f7b22989 Cleanup: minor improvements to BMesh dissolve faces
- Only create arrays with groups of two or more faces.
- Remove raising exception for zero length arrays.
- Remove redundant exception check (assert there is no exception).
- Use a struct for face array & it's length instead of a NULL
  terminated array (removes the need to count faces in a loop).
2021-07-05 15:54:57 +10:00
dccadc9e78 Cleanup: update comment formatting
- Replace '[mce]' with "Mike Erwin".
- Remove references to turn-table author as it isn't useful information,
  the author was credited in the commit message.
2021-07-05 15:54:57 +10:00
5b2d2b2319 Cleanup: remove temporary header 2021-07-05 15:54:57 +10:00
2929cfe5de Cleanup: remove unused defines 2021-07-05 15:54:57 +10:00
f0f7282d9d Cleanup: spelling in comments 2021-07-05 15:54:57 +10:00
b73dc36859 GPencil: Add weight factor to Offset randomize
Now, The weight is used in the randomize parameters of the offset modifier. 

This is useful to generate effects like explosions.

Related to the new Vertex Weight modifiers.
2021-07-03 17:41:12 +02:00
9b89de2571 Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXX
Also use doxy style function reference `#` prefix chars when
referencing identifiers.
2021-07-04 00:43:40 +10:00
05f970847e GPencil: Fix unreported PDF export offset
When exporting a PDF, the image was displaced towards top right a few pixels.

Also removed is_orthographic variable because is not needed now.
2021-07-03 12:32:44 +02:00
2d146b61d8 Cleanup: Use simpler method to retrieve attribute domain 2021-07-02 23:16:39 -05:00
5f5cf21a83 Cleanup: Remove unused transform matrix from objects
This was the only reference to this matrix.

https://developer.blender.org/D11770
2021-07-02 13:27:56 -05:00
55f27617cf Geometry Nodes: Add mesh input warning to curve to mesh node
A point of confusion about this node is that it doesn't work on the
output of the mesh circle primitive node. This patch adds a warning to
help with that. This avoids adding a warning when the geometry set
input has no mesh.

Differential Revision: https://developer.blender.org/D11771
2021-07-02 13:24:42 -05:00
00e30f122b Build: upgrade NanoVDB library to latest revision
This includes improved handling of OpenVDB trees with inactive voxels,
which previously could throw an error.

Ref T89581, T88438
2021-07-02 19:06:08 +02:00
82466ca2e5 Fix T89581: Cycles crash rendering some OpenVDB files with inactive voxels
Print an error message instead.
2021-07-02 19:01:53 +02:00
0c84939117 Cleanup: use template utility function to handle OpenVDB grid types in Cycles 2021-07-02 19:01:53 +02:00
8221d64844 Cleanup: Further use of const when accessing evaluated mesh
Also resolve a warning from the previous commit. The next blocker to
using const is `BKE_mesh_wrapper_ensure_mdata`.
2021-07-02 11:56:29 -05:00
5f8969bb4b Cleanup: Use const mesh to ensure BVH and triangulation cache
As noted in a comment now, these functions only update a cache, so they
don't change the logical state of the mesh, which is "it will have the
data when necessary." Using a const argument will help const correctness
when accessing an object's evaluated mesh.
2021-07-02 11:37:01 -05:00
a1609340b4 Cleanup: Fix variable redeclaration warning 2021-07-02 10:07:43 -05:00
a96b52e37f GPencil: Fix compiler warnings in previous commit 2021-07-02 16:32:57 +02:00
88c855174d Cleanup: Remove unused/unneeded code from old Asset Engine design
This code was written for the File Browser together with the Asset Engine
design, that is not part of the Asset Browser/System design anymore. Updated
comments accordingly.

`FileDirEntryRevision` was actually used, but I removed it and moved the used
members to the parent `FileDirEntry`, since there is no concept of revisions
currently.

There should be no functional changes.
2021-07-02 15:42:22 +02:00
5a693ce9e3 Constraints: support a new Local Space (Owner Orientation) for targets.
Add a new transformation space choice for bone constraints, which
represent the local transformation of the target bone in the constraint
owner's local space.

The use case for this is transferring the local (i.e. excluding the
effect of parents) motion of one bone to another one, while ignoring
the difference between their rest pose orientations.

The new option replaces the following setup:

* A `child` bone of the `target`, rotated the same as `owner` in rest pose.
* A `sibling` bone of the `target`, positioned same as `child` in rest
  pose and using Copy Transforms in World Space from `child`.
* The `owner` bone constraint uses Local Space of `sibling`.

(This analogy applies provided both bones use Local Location)

Differential Revision: https://developer.blender.org/D9493
2021-07-02 15:15:05 +03:00
bc8ae58727 Copy Transforms: implement Remove Target Shear and more Mix options.
This constraint can be naturally viewed as a prototype for a future
4x4 matrix math node (or subset thereof), since its basic semantics
already is matrix assignment. Thus it makes sense to add math options
to this constraint to increase flexibility in the meantime.

This patch adds support for several operations that would be useful:

- An option to remove shear in the incoming target matrix.

  Shear is known to cause issues for various mathematical operations,
  so an option to remove it at key points is useful.

  Constraints based on Euler like Copy Rotation and Limit Rotation
  already have always enabled shear removal built in, because their
  math doesn't work correctly with shear.

  In the future node system shear removal would be a separate node
  (and currently Limit Rotation can be used as a Remove Shear constraint).
  However removing shear from the result of the target space conversion
  before mixing (similar to Copy Rotation) has to be built into
  Copy Transforms itself as an option.

- More ways to combine the target and owner matrices.

  Similar to multiple Inherit Scale modes for parenting, there are
  multiple ways one may want to combine matrices based on context.
  This implements 3 variants for each of the Before/After modes
  (one of them already existing).

  - Full implements regular matrix multiplication as the most basic
    option. The downside is the risk of creating shear.
  - Aligned emulates the 'anti-shear' Aligned Inherit Scale mode,
    and basically uses Full for location, and Split for rotation/scale.
    (This choice already existed.)
  - Split Channels combines location, rotation and scale separately.

  Looking at D7547 there is demand for Split Channels in some cases,
  so I think it makes sense to include it in Copy Transforms too, so that
  the Mix menu items can be identical for it and the Action constraint.

Differential Revision: https://developer.blender.org/D9469
2021-07-02 15:15:05 +03:00
01e1944cd4 File Browser: Refactor file "UUID" code (which wasn't really a "UUID")
To some degree these are changes in preparation of further Asset Browser
related changes, see D11119. But also, the current UUID design was written for
the old Asset Engine design, which isn't part of the current Asset
Browser/System design anymore.
And lastly, "UUID" are a well established standard
(https://en.wikipedia.org/wiki/Universally_unique_identifier) which this
implementation didn't follow. What we have here is more of an index, or a
unique identifier (https://en.wikipedia.org/wiki/Unique_identifier).

So this does the following changes:
* Renames "UUID" to "UID"
* Changes the type of the UID to (a typedef'ed) `uint32_t`, which is more than
  enough for our current asset system design and simplifies things.
* Due to the new type, we can avoid allocations for hash-table storage.
* Add/use functions for UID handling

Note that I am working on a major rewrite of the file-list code. Meanwhile we
want to keep things sensible.
2021-07-02 13:49:30 +02:00
29b65f5345 GPencil: New modifier to generate weights dynamically
his new modifier allows to generate weights base on:

* Angle of the stroke relative to object or world orientation. For example, if the value is 90, the maximum weights will be for vertical lines and minimum for horizontal lines.

* Distance to Target object. The distance calculated is normalized to get valid weights between 0 and 1.0.

The weights are created in an existing vertex group and the data can be replaced or mixed with the existing value to combine different weight effects. The minimum parameter, allows to define the minimum weight generated. This is useful to avoid very low weights.

The generated weights can be used in any modifier. For example, the angle weight value can be used to mimic FreeStyle Caligraphy modifier using the weight with the thickness modifier.

Also some modifier has been changed to inlude a new option to use the weights as factor of the effect.
As result of this change, the fading option has been removed from Thickness and Opacity modifiers because this can be done using the new modifier, it's not logic to repeat the same.

Reviewed By: mendio, filedescriptor

Differential Revision: https://developer.blender.org/D11604
2021-07-02 12:04:07 +02:00
9f5c0ffb5e Cleanup: Use const variables for object's evaluated mesh
Generally the evaluated mesh should not be changed, since that is the
job of the modifier stack. Current code is far from const correct in
that regard. This commit uses a const variable for the reult of
`BKE_object_get_evaluated_mesh` in some cases. The most common
remaining case is retrieving a BVH tree from the mesh.
2021-07-01 23:03:27 -05:00
016a2707f5 Cleanup: refactor edit-mesh copy functions into functions 2021-07-02 12:51:44 +10:00
841b2cea7b Cleanup: compiler & clang-tidy warnings 2021-07-02 12:15:29 +10:00
addb1a5c9a Cleanup: spelling in comments 2021-07-02 12:15:29 +10:00
b39d66adde Fix T88909: Win32 getTitle() UTF8 Support
In the Win32 platform our setTitle() can properly assign a Unicode
utf-8 window title. Unfortunately our getTitle() will only read regular
8-bit character strings. This means that we can never compare what we
set to what we get. This patch updates getTitle() to use Unicode-aware
GetWindowTextLengthW and GetWindowTextW.

see T88909 for an example of this affecting user experience.

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

Reviewed by Ray Molenkamp
2021-07-01 18:08:29 -07:00
0ff1c38fcc Cleanup: Move bvhutils.c to C++
This will be useful when adding a utility to create a BVH tree from a
`CurveEval` for the attribute proximity and attribute transfer nodes.
2021-07-01 16:46:55 -05:00
7eecf77f0b VSE: Fix handle size calculation
Handle width calculation was incorrect in drawing code. This caused
handles to be invisible when zoomed out.

After fixing math, handles become too large, so now they are constrained
to quarter of strip width, which feels more natural and represents
clickable area more closely.

`sequence_handle_size_get_clamped()` did not return size in pixels, but
in 2D-View space, this comment was corrected.
2021-07-01 23:38:06 +02:00
fd1fec5600 Cleanup: Clang tidy, remove typedef 2021-07-01 16:33:07 -05:00
b7b5c23b80 Fix memory leak in VSE transform code
SeqCollection wasn't freed.

It wasn't easy to find culprit so added argument to
SEQ_collection_create() to pass function name.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11746
2021-07-01 22:14:29 +02:00
519c12da41 VSE: Snapping feedback
Address initial feedback:
 - Use checkboxes instead of radio buttons
 - Hide snapping distance control from UI
 - Tweak snapping line color - use selected strip color, 50% transparency. Similar to other editors
 - Draw 2px thick line, since strip outline is also 2px thick

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11759
2021-07-01 22:08:11 +02:00
4a7951fede Cleanup: Separate each extractor into specific compile units
Makes code cleaner and easier to find.
2021-07-01 11:13:58 -03:00
4617172740 Fix race condition when loading multiple File/Asset Browsers at once
When multiple File or Asset Browsers would load at once (e.g. when loading a
file with two File Browsers open) and they would load multiple directories or
.blend files (using the Recursions option in the File Browser or loading an
asset library with multiple .blends), often only one File/Asset Browser would
correctly load all files. Others would be incomplete or entirely empty. That
was because of a race condition, where the directories or .blend files would be
loaded concurrently and the first one that finished would cancel the other
ones. This again happened because they used the job system with the same
"owner", which by design makes all jobs with the same owner cancel as soon as
the first is finished.
Address this by making sure they have different owners. That is, not the scene
anymore, but the filelist the job belongs to. Doesn't make much sense to use
the scene as owner for scene-unrelated file loading anyway.

Steps to reproduce were:
* Open two File Browsers as regular editors.
* In the Display Settings popover, set "Recursions" to 2 or 3 levels.
* Navigate to a directory with plenty of subdirectories in both File Browsers.
* Save the file.
* Reload the file, one of the File Browsers likely has an incomplete file list.

Alternatively, use Asset Browsers and open an asset library containing multiple
.blends.
2021-07-01 15:22:12 +02:00
a112adf16a Audaspace: porting pulseaudio fixes from upstream. 2021-07-01 14:26:13 +02:00
19d19970e4 Fix T88887: Audio causes issues with Playback when PC put to Sleep, Hibernate or when Screensaver appears
Porting WASAPI device reinitialization from upstream.
2021-07-01 14:26:13 +02:00
8c3855dc6e Fix broken physics modifiers after cleanup commits
4f3ec0110 and 5a64c687dd should have removed the entire conditional to skip
time depedent modifiers, rather than always enable it.
2021-07-01 12:58:42 +02:00
Paul Golter
229c0580e2 Fix: Export subtitles timecode relative to scene start frame, ignore muted strips
This patch writes the timecode in the .srt file relative to the start
frame of the scene. If the timecode is global but scene does not start
at frame 0 the subtitles don't match if they get loaded in an external
video player. Muted strips will be ignored. Don't allow negative
timecodes in .srt.

Reviewed By: Richard Antalik
Differential Revision: http://developer.blender.org/D11762
2021-07-01 12:21:31 +02:00
96d487b3ae Cleanup: remove redundant calls to BMO_error_clear 2021-07-01 17:25:27 +10:00
aaa8ee1307 Cleanup: remove bmesh-operator error code
The error codes could be used to look up messages from a table
of messages however this wasn't especially useful.

Now all calls to BMO_error_raise must inclue a message.
2021-07-01 17:01:19 +10:00
927456491a Fix edit-mesh partial update regression when snapping to normals
Edit-mesh partial update logic assumed translate didn't need normals
to be recalculated (for faces with all vertices being transformed).

However translate can optionally rotate which requires
all transformed normals to be updated.

Check for this case and use the previous partial-update method
when it modified extra geometry, so the normals are properly reset.
Further updates need not recalculate them.
2021-07-01 14:53:01 +10:00
02df67875a Cleanup: replace booleans with enum for storing translate rotation 2021-07-01 13:30:19 +10:00
f578e31a8e Correction to T89571 fix 4546f176eb
Supporting both object & edit-mode is more involved.
Both cases are now supported with object mode tracking the last-used
state for rotation so it's only reset once when rotation is disabled.
2021-07-01 12:58:10 +10:00
4546f176eb Fix T89571: Align Orientation to Target keeps rotation when toggled 2021-07-01 11:54:05 +10:00
1e532eb37a BLI_linklist_stack: use cast to prevent warnings when used in C++ 2021-07-01 11:24:54 +10:00
aa112dc77c Cleanup: spelling 2021-07-01 11:16:25 +10:00
39188f3c99 Cleanup: rename playhead to current-frame 2021-07-01 11:06:04 +10:00
930ecef9b5 Cleanup: outdated IPO references in comments 2021-07-01 11:06:04 +10:00
753806c731 Cleanup: spelling 2021-07-01 10:25:49 +10:00
a689b5932d Cleanup: remove unused internal grease pencil definitions 2021-07-01 10:25:49 +10:00
dba675fb65 Cleanup: split normal calculation into it's own file
Normals now includes many functions including normal splitting &
custom normal manipulation split this into it's own file
to centralize related functions.
2021-07-01 10:25:49 +10:00
924596abad Cleanup: clang-format, clang-tidy 2021-07-01 10:25:49 +10:00
Johnny Matthews
c1fc180861 Geometry Nodes: Curve Primitive Circle
This node has two modes: the first mode computes a circle from three
locations and a resolution. The second takes radius and resolution.
The first mode also outputs the center of the computed circle as
a vector.

Differential Revision: https://developer.blender.org/D11650
2021-06-30 19:22:13 -05:00
5a64c687dd Cleanup: Fix compiler warning from previous commit
The use_deform argument was always passed as zero or one, so the "< 0"
check is no longer necessary.
2021-06-30 18:03:45 -05:00
4f3ec01101 Cleanup: Use bool instead of int, rename variable
The "useDeform" argument was only passed as 1 or 0, so even though
there was an odd "< 0" comparison, it can be passed as a boolean.
2021-06-30 16:41:53 -05:00
17a67bf778 UI: custom free function improvements
This changes `UI_but_func_tooltip_set` so that it allows passing a custom free function, which has two benefits:

* The caller can pass `null` to indicate that the value should not be freed.
* Arbitrary c++ data can be passed to the callback (before the struct had to be trivially destructible).

I added `uiFreeArgFunc` and used it in other places where appropriate.

Differential Revision: https://developer.blender.org/D11738
2021-06-30 17:46:59 +02:00
ca12d70af0 Cleanup: variable naming for texture/material SocketPropertyType
Copy-Pasting error in rB3025c348253a

Maniphest Tasks: T88701

Differential Revision: https://developer.blender.org/D11755
2021-06-30 17:29:14 +02:00
5737193d81 Fix bad versioning of snapping flags
If the value of a macro has changed. We need to change all references to
that macro in the versioning code.
2021-06-30 10:42:09 -03:00
8de8ab38f6 Fix T89535: FCurve.mute UI text wrong
Copy-paste mistake in rB4e9817a4fb29 (copied from fmodifier).

Maniphest Tasks: T89535

Differential Revision: https://developer.blender.org/D11753
2021-06-30 15:38:06 +02:00
0e4245bc28 Fix T89554: UV snapping broken
Caused by {rBfba9cd019f21}.

Above commit reordered toolsettings snapping flags but missed remapping
these for the UV toolsettings in versioning code.

Differential Revision: https://developer.blender.org/D11756
2021-06-30 15:15:32 +02:00
be451354c9 Fix T89153: Follow Path for empty works only in negative values
The old code only clamped cyclic curves
2021-06-30 11:20:42 +02:00
918d9291d6 Cleanup: store the result of isLockConstraint for reuse
This was being called for every element in some situations.
2021-06-30 18:40:16 +10:00
c57b0cae28 Cleanup: rename transform mode variables
Use the term 'mat_final' for calculated matrices used for transforming.
Also rename 'pivot' to 'pivot_local'.
2021-06-30 18:18:30 +10:00
4f9ef65dac Transform: support multi-threading for bend 2021-06-30 18:01:14 +10:00
2d4ec90497 Transform: support multi-threading for most modes
Multi-threading support for transform modes: bevel-weight, crease,
push-pull, rotate, shear, shrink-fatten, skin-resize, to-sphere,
trackball & translate.

This is done using a parallel loop over transform data.

From testing a 1.5million polygon mesh on a 32 core system
the overall performance gains were between ~20-28%

To ensure the code is thread-safe arguments to shared data are const.

Reviewed By: mano-wii
2021-06-30 16:53:55 +10:00
501d2443d0 Cleanup: use const arguments for accessor functions 2021-06-30 16:42:19 +10:00
df9597cfba Cleanup: use const for datatoc declarations 2021-06-30 16:42:19 +10:00
Johnny Matthews
8884d2d61b Geometry Nodes: Curve Primitive Bezier Segment
Creates a Curve with 1 Bezier Spline from four positions (start,
start handle, end handle, end) and a resolution. The handles are
aligned and mirrored automatically. An "Offset" mode is also included
to allow specifying the handles relative to the control points.

The default settings recreate the existing default Bezier Curve in the
3D viewport add menu.

Differential Revision: https://developer.blender.org/D11648
2021-06-30 00:03:55 -05:00
c36d2a9a7a Cleanup: rename 'count' to 'len'
Reserve the term count for values that require calculation
(typically linked lists).

Without this convention it's difficult to know if using a length
accessor function in a loop will be O(N^2) without inspecting the
underlying implementation.
2021-06-30 14:39:32 +10:00
77ac1f39c4 Cleanup: unused arg warnings 2021-06-30 14:32:53 +10:00
Johnny Matthews
d3788207aa Geometry Nodes: Curve Primitive Quadratic Bezier Segment
This patch is for a node that creates a poly spline from a
3 point quadratic Bezier. Resolution is also specified.

Curve primitives design task: T89220

Differential Revision: https://developer.blender.org/D11649
2021-06-29 22:39:26 -05:00
Johnny Matthews
21ebee2580 Geometry Nodes: Curve Primitive Spiral
This node creates a curve spline and gives control for the number of
rotations, the number of points per rotation, start and end radius,
height, and direction. The "Reverse" input produces a visual change,
it doesn't just change the order of the control points.

Differential Revision: https://developer.blender.org/D11609
2021-06-29 22:22:28 -05:00
Johnny Matthews
86c6769e20 Geometry Nodes: Curve Primitive Spiral
This patch adds a Curve Primitives menu in Geometry nodes with an
initial entry of a star primitive.

The node is a basic star pattern node that outputs a poly spline.
Options control the inner and outer radius, the number of points,
and the twist of the valleys.

Differential Revision: https://developer.blender.org/D11653
2021-06-29 22:00:29 -05:00
2d35eed34d Cleanup: split uses of _snap_sequencer_apply according to transform mode
The `applySnap` callback of each mode was overwriting the value
calculated in `transform_snap_sequencer_apply`.
2021-06-29 18:08:41 -03:00
929d9ec0c7 Cleanup: Deduplicate code 2021-06-29 17:42:48 -03:00
dd14ea1819 Cleanup: split CalcSnapGeometry in smaller functions 2021-06-29 17:38:34 -03:00
fba9cd019f VSE: Improved Snapping
Change snapping behavior to snap strip edges when they are close to snap point.
Default behavior is, that each transformed strip is snapped to any other strip.

Implement snapping controls in sequencer tool settings. These controls include:

 - Snapping on/off
 - Ability to snap to playhead and strip hold offset points
 - Filter snap points by excluding sound or muted strips
 - Control snapping distance

Snapping controls are placed in timeline header similar to 3D viewport

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11646
2021-06-29 20:30:31 +02:00
ea43ae4194 Fix crash on link/append for asset data-blocks in Thumbnails mode
Same fix as 03a83b4eb5, but for the Thumbnails display mode.
2021-06-29 20:09:07 +02:00
516a060bb3 Fix T89523: Cycles OpenCL compile error after recent changes
Also correctly used inverse transposed matrix for normal transform.
2021-06-29 19:47:11 +02:00
999f1f7504 Win32: Window Placement DPI and Scale Adjustment
When using multiple monitors that differ in scale and/or dpi, the
varying sizes of the window titles and borders can cause the placement
of those windows to be out by a small amount. This patch adjusts for
those differences on Windows 10 and newer.

see D10863 for details and examples.

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

Reviewed by Ray Molenkamp
2021-06-29 09:29:40 -07:00
2ff714269e UI: Support setting operator properties for UILayout.operator_menu_enum()
`UILayout.operator_menu_enum()` now returns the operator properties, just like
`UILayout.operator()`. This makes it possible to set options for the operator
displayed in the menu. In C it can be done through the new
`uiItemMenuEnumFullO()` or `uiItemMenuEnumFullO_ptr()`.

It's reasonable to have this, probably just a small thing never bothered to
add. D10912 could use it, the following comment can be addressed now too:
https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/space_nla/nla_buttons.c$583-586
2021-06-29 18:20:56 +02:00
63aa6dd845 Cleanup: Win32 Window Creation
This is just some cleanup of the Win32 window creation code. After
CreateWindowExW() this patch uses some early exits to replace some
potentially confusing if blocks. No functional changes.

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

Reviewed by Ray Molenkamp
2021-06-29 08:51:51 -07:00
ae636994cd Fix Cycles hair render error on GPU after recent changes
Volumes primitive needs to be part of traceable primitives.
2021-06-29 16:35:06 +02:00
037035921b Cleanup: Remove unused function in lineart_cpu.c 2021-06-29 22:32:38 +08:00
e7fc15e2ef Fix T70615: Cycles ignores BSDF inputs when nodes are optimized
When compiling BSDF nodes, we only assing stack space to the normal and
tangent inputs if they are linked. However, it could be that the
ConstantFolder removed the link, so checking if there is a link fails
to take this into account.

To fix this, added a flag to ShaderInput to keep track of whether a
constant was folded into the input, and use it as well to verify that
the socket is linked when assigning stack space.

Reviewed By: brecht

Maniphest Tasks: T70615

Differential Revision: https://developer.blender.org/D11731
2021-06-29 16:24:21 +02:00
d1e0059eac LineArt: Filtering intersection lines using mask numbers
Mask value works just like transparency mask.

You are able to select intersection lines inside a
collection or, between collections.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11309
2021-06-29 20:47:55 +08:00
5d5cf53081 Fix T89484: NLA "Remove Empty Animation Data" missing Outliner refresh
Similar to rBb4530deec478, just add appropriate notifier.

Maniphest Tasks: T89484

Differential Revision: https://developer.blender.org/D11724
2021-06-29 14:37:00 +02:00
8f6a9c5176 Fix T89526: "Toggle Maximize Area" clears context screen properties
Removed in b787581c9c as it's comment
noted it was bad code, the reason for it's necessity was no longer valid.

Add this back with comment explaining why it's still needed.
2021-06-29 21:09:00 +10:00
5130bb116a Cleanup: unused warnings 2021-06-29 21:09:00 +10:00
df7db41e1b LineArt: Use separate sub panel for line types.
Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11735
2021-06-29 18:48:59 +08:00
f2c52aa0e1 Cleanup: use 'const' arguments in transform calculation
Use const arguments to simplify further optimizations.

Transforming elements shouldn't need to change their containers
data-structures.
ElementResize for grease pencil stroke thickness was
modifying TransInfo.num & TransInfo.values_final.

Now copies are operated on to preserve const correctness although
it's worth investigating if this can be avoided altogether.
2021-06-29 20:23:30 +10:00
855f7fee63 Cleanup: clang-format 2021-06-29 20:13:24 +10:00
203d405299 Cleanup: spelling 2021-06-29 20:12:51 +10:00
66d48b272e Cleanup: GPU Shader Log Parsing.
- Added functions to check if the cursor is at a number.
- Added function to parse a number.
- Joined skip_separator functions.
- Added function to check if cursor is at any given set of characters.
2021-06-29 09:52:31 +02:00
ee0c3081b0 Fixed issue in previous commit.
During development a test was disabled. Enabling it again.
2021-06-29 09:08:33 +02:00
2262d6c45a Fix T89405: Viewport Render Preview glitching (AMD)
AMD Drivers didn't report an additional space in the rendered. This made
testing for the HQ workaround fail and the issue appeared back on
certain cards.

This fix will test with surrounding spaces or if the renderer name
endswith the given string. If any of these are the case the hq normals
workaround will be enabled.
2021-06-29 09:04:24 +02:00
28135c06bb Typo in function identifier: mutli -> multi
Fixing small typo of word "multi" in function identifier by renaming
"count_mutli_input_socket_links" to "count_multi_input_socket_links"

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

Reviewed by Hans Goudey
2021-06-28 20:58:17 -07:00
24c321cfe9 Cleanup: Use function name for allocation strings
This is simpler, more consistent, and takes up less space.
2021-06-28 22:45:02 -05:00
91b31173e9 LineArt Cleanup: Rename floating->loose
see comment in https://developer.blender.org/rB841df831e89dfc4011c323203c2efb8265dc1878
2021-06-29 11:40:59 +08:00
34b213d604 Cleanup: use "use_" prefix for boolean types 2021-06-29 13:31:53 +10:00
c109a39995 Cleanup: translate comments
It wasn't so clear why the POINT_INIT check was disabled,
move this into the code comment.
2021-06-29 13:31:53 +10:00
f8d8f28e2c Curves: Avoid duplication of control points during evaluation
This commit avoids duplicating the deformed control point
list twice by modifying the list in the object curve cache directly.

For curves, the original control point data was duplicated into a
local listbase, deformed, used to create the "bevel list" data, and
then duplicated again for the object-level storage of deformed
control points. Text objects and surface objects had a similar
unnecessary duplication.
2021-06-28 22:22:06 -05:00
a3a7e19f07 Cleanup: Avoid freeing curve evaluation data twice
The curve bevel list was freed, and then freed again in a call to the
function that recalulates it. The curve "anim path" data was freed
only to be freed again in its calculation function as well. Also move
the anim_path calculation directly after the bevel list creation to
make its requirements more explicit.
2021-06-28 21:46:12 -05:00
3471ff1a5c Cleanup: Split curve and surface data evaluation functions, rename
Surface objects were already handled by an early return in the main
"curve types" function. This commit splits them, renames the funtions
to match (and be more consistent with other names), and sanitizes the
checking of object types.
2021-06-28 21:31:59 -05:00
d6480167ad Cleanup: Order return arguments last, use r_ prefix 2021-06-28 21:17:19 -05:00
60a2038fba Cleanup: clang-tidy 2021-06-29 10:37:00 +10:00
515d9f9a35 Cleanup: resolve discarded-qualifier warning 2021-06-29 10:23:22 +10:00
e1a719c043 Fix T89465: Loss of mouse movement when window left with pen.
When a window is left with a WinPointer pen, the inrange check
prevents resetting pen info.
2021-06-28 15:09:59 -07:00
2271b9b584 Cleanup: Avoid ASAN report when converting displist to mesh
Don't call `memcpy` with a null destination (and 0 size).
2021-06-28 16:56:30 -05:00
d0e6b59cd1 Cleanup: Replace paranoid check with assert
Every call to `BKE_displist_make_curveTypes` already checks the object
type beforehand, there is no need to check it again. Also removed an
outdated comment.
2021-06-28 15:21:14 -05:00
d2e473a2dd Cleanup: Remove unused "for_orco" argument to curve evaluation
`BKE_displist_make_curveTypes` had a `for_orco` argument that was
always false in calls to the function. Removing it allows the curve
displist and modifier evaluation code to become simpler. There are
some related cleanups in rBdf4299465279 and rB93aecd2b8107.
2021-06-28 15:14:43 -05:00
a0c45a2d54 Cleanup: Add function to create a CurveEval from a nurbs list
Sometimes the current spline list isn't part of the original curve, like
when using the deformed control points, etc. This will be helpful in
the curve modifier stack.
2021-06-28 14:28:52 -05:00
790cb28766 Curve: Add functions to retrieve const access to spline list
While the const correctness of `ListBase` is quite limited, it's helpful
to have a way to retrieve the `Nurb` list from curve object data without
casting away const from the curve.
2021-06-28 14:15:58 -05:00
dc0c81337d Cleanup: Use const arguments 2021-06-28 13:47:48 -05:00
Jesse Y
643720f8ab UI: Do Not Resize Already-Open Temporary Windows
There is no longer a need to resize windows that are _already_ open,
since temporary windows can no longer take over the space used by other
already-open temporary windows. This primarily affects Preferences and
Render windows.

see D11721 for more details.

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

Reviewed by Julian Eisel
2021-06-28 11:43:45 -07:00
c0fb8375f6 Fix T89515: Clicking on Favorites in File Browser will rename them
Likely uncovered by 6c97c7f767, the actual mistake would be from
6942dd9f49.

The hacks to display text buttons for renaming in UI-Lists used the emboss of
the text button for handling logic. It relied on the emboss `NONE` but we also
introduced `NONE_OR_STATUS` with 6942dd9f49. Both values need to be treated
equally for the logic of this hack to work.

The change in `interface_layout.c` is actually not needed for this exact issue,
but it's the correct thing to do. There may actually be more cases where `NONE`
and `NONE_OR_STATUS` need to be treated equally. Something to be checked still.
2021-06-28 19:47:13 +02:00
578ccdf75b Fix T89516: Crash on append
Caused by 37458798fa, was doing a NULL-pointer dereference because it used
the wrong pointer to check if the data-block is linked.
2021-06-28 19:30:56 +02:00
a5ed075110 Fix T87194: custom attributes not accessible with Cycles Volume
Custom properties defined on objects are not accessible from the
attribute node when rendering a volume in Cycles. This is because
this case is not handled.

To handle it, added a primitive type for volumes in the kernel,
which is then used in the initialization of ShaderData and to
check whether an attribute lookup is for a volume.

`volume_attribute_float4` is also now checking the attribute
element type to dispatch to the right lookup function.

Reviewed By: #cycles, brecht

Maniphest Tasks: T87194

Differential Revision: https://developer.blender.org/D11728
2021-06-28 19:09:15 +02:00
afb17552e1 Fix T89449: File Browser preview image not responsive to click
Logic in the main `switch` for button handling was wrong and would execute for
other button types than the new data-set row button type.
2021-06-28 18:38:53 +02:00
37458798fa LibOverride: Fix crash in ShapeKeys when making a mesh override local.
Weird 'embedded for overrides' flag of embedded IDs (including ShapeKeys
in override context) was not properly cleaned up when making an override
fully local.

Reported by studio, thanks.

@jbakker should be backported to 2.93LTS if possible.
2021-06-28 17:03:10 +02:00
e8d75b957f Fix UI glitch in outliner when hiding excluded collections.
In ViewLayer view, overrides of excluded collections would then show one
level higher, due to bad handling of those excluded collection in draw
code.

Reported by studio, thanks.

@jbakker should be backported to 2.93LTS.
2021-06-28 17:02:50 +02:00
6c97c7f767 Fix T89350: Emboss color missing from icon buttons without emboss
Passing `emboss=False`set `UI_EMBOSS_NONE` in the layout, which
completely disables button background colors for things like animation
state. This commit changes that to `UI_EMBOSS_NONE_OR_STATUS`,
which effectively restores the behavior to what it was prior to the
addition of that flag, with the added option to completely disable
the status emboss with `UI_EMBOSS_NONE`.
2021-06-28 10:00:15 -05:00
6ce4d39e6b Geometry Nodes: initial attribute list for meshes
This adds a new Attributes panel in the mesh properties editor.
It shows a list of all the generic attributes on the mesh.
In the future, we want to show built-in and other attributes in the
list as well. Related technical design tasks: T88460, T89054.

There is also a new simple name collision check that warns the user
when there are multiple attributes with the same name. This can be
problematic when the attribute is supposed to be used in geometry
nodes or during rendering.

Differential Revision: https://developer.blender.org/D11276
2021-06-28 16:53:25 +02:00
0afe4e81cb Fix name of UI emboss RNA enum item
This was a stupid mistake in my original commit that added this item.
While this is an API breakage, the name is simply wrong, and it is only
6 months old, and slightly niche.

Differential Revision: https://developer.blender.org/D11701
2021-06-28 09:51:39 -05:00
222c39fe70 Transform: Move "Proportional Size" and "AutoIK-Len" values to the beginning of the header
This prevents the text from shaking while transforming.
2021-06-28 11:48:32 -03:00
8de878e202 Draw: make 'ibo.lines_loose' extracting safer
No functional changes.
2021-06-28 11:48:32 -03:00
413bd71aaf Cleanup: remove unused macro parameters 2021-06-28 11:48:32 -03:00
cf21ba37ef LineArt: Occlusion effectiveness support
This patch adds a function where you can specify occlusion effectiveness from 0 to 255 layers per face for a given mesh material.

Reviewed By: Sebastian Parborg (zeddb)

Ref D11308
2021-06-28 22:26:23 +08:00
Mikhail Matrosov
9c6a382f95 Cycles: reduce shadow terminator artifacts
Offset rays from the flat surface to match where they would be for a smooth
surface as specified by the normals. In the shading panel there is now a
Shading Offset (existing option) and Geometry Offset (new).

The Geometry Offset works as follows:
* 0: disabled
* 0.001: only terminated triangles (normal points to the light, geometry
  doesn't) are affected
* 0.1 (default): triangles at grazing angles are affected, and the effect
  fades out
* 1: all triangles are affected

Limitations:
* The artifact is still visible in some cases, it could be that some quads
  require to be treated specifically as quads.
* Inconsistent normals cause artifacts.
* If small objects cast shadows to a big low poly surface, the shadows can
  appear to be in a wrong place - because the surface moved slightly above
  the geometry. This can be noticed only at grazing angles to light.
* Approximated surfaces of two non-intersecting low-poly objects can overlap
  that causes off-the-wall shadows.

Generally, using one or a few levels of subdivision can get rid of artifacts
faster than before.

Differential Revision: https://developer.blender.org/D11065
2021-06-28 14:05:22 +02:00
ce25b5812b Fix Cycles not rendering motion vector passes after recent changes
Causing regression tests to fail.
2021-06-28 13:57:12 +02:00
7d281a4f7d Functions: improve CPPType
* Reduce code duplication.
* Give methods more standardized names (e.g. `move_to_initialized` -> `move_assign`).
* Support wrapping arbitrary C++ types, even those that e.g. are not copyable.
2021-06-28 13:16:32 +02:00
f7e2559fd6 BLI: improve enum operators
* Use unsigned integer types for bit operations.
* Use 64 bit integer instead of 32 bit.
* Support scoped enumes (aka `enum class`) by adding some more casts.
2021-06-28 13:16:32 +02:00
2dbb492268 Fix T89455: Cycles crash when rendering a Mesh with autosmooth
The crash was caused by a mistake in 5f9677fe0c
where the pointers to the custom data layers would be overwritten with the one
for the first layer, as CustomData_duplicate_referenced_layer is only about the
first layer. customData_duplicate_referenced_layer_index should be used instead
to duplicate the right layer.
2021-06-28 13:12:07 +02:00
1b942ef90c GPU: Refactored +cleanup compilation log parsing.
Old implementation has a single parser of many different
formats. With the introduction of Vulkan this would lead
to another parser in the same function. This patch
separates the log parsing using a visitor pattern so the
log parsing can be configured per GPU backend or even
per driver.

With Vulkan we manage the compiler our self so the parsing
will become more straight forward. The OpenGL part depends
on many factors (OS, Driver) and perhaps even GPU.
2021-06-28 12:23:10 +02:00
dbd4ff4163 GPU: Separate compiler log from shader.
Current compiler log parser is to complex to follow. Moving it to its
own compile unit before refactoring.
2021-06-28 12:23:10 +02:00
c4d56199cc Cleanup: use doxy sections for editcurve_select.c
Signed-off-by: Campbell Barton <ideasman42@gmail.com>
2021-06-28 20:19:47 +10:00
Piotr Makal
98cd0fed36 Fix edit-mesh random select regression in random seed use
Fix regression in 9c20228128
that wasn't using the random seed correctly.
2021-06-28 19:57:46 +10:00
Piotr Makal
1c8c91384c Apply random selection precisely for curves, lattices & objects
This patch is part of: T87228.
Support accurate random selection for:

- CURVE_OT_select_random
- LATTICE_OT_select_random
- OBJECT_OT_select_random

Ref D11685
2021-06-28 19:51:49 +10:00
Piotr Makal
ab31c24322 BLI_rand: support for randomizing bitmaps
Add utility functions:

- BLI_bitmap_randomize
- BLI_rng_shuffle_bitmap

Part of D11685
2021-06-28 19:35:43 +10:00
addb2034a7 Cleanup: Fix const warnings in buttons_context.c 2021-06-28 17:34:15 +08:00
c297769d22 UI: Hide collection tab when scene master collection is active
CollectionLineart does not care about the configurations
in master collection.
Other options are not applicaple for master collection as well.
Hence hiding it.

Reviewed by Dalai Felinto (dfelinto)

Differential Revision: https://developer.blender.org/D11702
2021-06-28 15:51:34 +08:00
bb2648ebf0 Outliner: View Layers filter for View Layer Mode
This option allow users to see the view layer in context to the
others. It is particularly useful to see which view layers have which
collections enabled, and their render settings (holdout, ...).

This option is off by default.

Differential Revision: https://developer.blender.org/D11708
2021-06-28 09:34:44 +02:00
2ff490f9e3 Fix: Crash Requesting GPU_SHADER_GPENCIL_FILL builtin shader.
Shader doesn't have any shader code. Requesting the shader
would crash blender. Solved by removing the enum_value.
2021-06-28 08:55:13 +02:00
b2cd225623 GPU: Testcases for builtin shaders.
Adding compiler test (does it compile?) test for all builtin shaders.
2021-06-28 08:55:13 +02:00
f53bd31690 Cleanup GPU/Draw test cases.
In preparation of supporting vulkan. Draw/GPU tests should use
GPU_TEST or DRAW_TEST macros. These macros will run the test
on available drawing context backends like OpenGL or Vulkan.

As in master there is only an OpenGL backend nothing changed.
2021-06-28 08:55:13 +02:00
e94ec79341 Cleanup: use view3d_navigate prefix for walk/fly operators
Use matching file-name prefix as these operators are closely related.
2021-06-28 16:13:01 +10:00
7beb57f3bd Cleanup: update comments 2021-06-28 16:11:18 +10:00
6f42e69b58 Cleanup: de-duplicate 3D-view depth calculation function 2021-06-28 15:46:16 +10:00
7efc87dcd2 Cleanup: typos in RNA enums 2021-06-28 15:46:16 +10:00
1d8648b13a Cleanup: repeated terms in code comments & error messages 2021-06-28 15:46:08 +10:00
23c4854f45 UI: Cleanup: Phrasing of tooltips in line art modifier
Start the tooltip with a verb instead of a gerund, other small changes
for consistency and readability.
2021-06-27 23:48:46 -05:00
7223a0348f Fix T89330 Exact Boolean fails on a simple model.
The problem was an optimization I put in to triangulate quads.
It was wrong if the quad, after projecting onto a 2d plane, was
not convex. Handling quads the same as other faces fixes the bug.
Unfortunately, this will slow down Exact Boolean when the input has
many quads (the usual case, of course).
Will attempt to fix that with a later change, but for now, this
at least restores correctness.
2021-06-26 17:49:52 -04:00
abc6200331 Cleanup: spelling 2021-06-26 21:50:48 +10:00
46a222afd7 Cleanup: remove redundant/outdated comments 2021-06-26 21:50:48 +10:00
624bce6b4d Cleanup: redundant use of static constant 2021-06-26 21:50:48 +10:00
f1e4903854 Cleanup: full sentences in comments, improve comment formatting 2021-06-26 21:50:48 +10:00
fae5a907d4 GPencil: Duplicate Masks when separate Layer/Strokes
Now, the mask layers are copied and later a cleanup is done in order to verify all mask layer exist in destination object. If the layer mask does not exist, it's removed from the list.

This is related to T89234.
2021-06-26 11:38:37 +02:00
b5542c1ea4 Edit Mesh: optimize common use-cases for partial updates
Skip updating normals & tessellation for contiguous geometry regions
for operations such as translate & uniform scale.

This means when all geometry is selected, no updates are needed
as the relative locations of vertices aren't being modified.

Performance:

As this is skipping a multi-threaded operation,
larger improvements are noticeable on systems with fewer cores.

- ~1.15x to ~1.3x overall gain for 32 cores.
- ~1.7x to ~2.2x overall gain for 1 core (limited using `-t 1` argument).

Details:

- Rotate & non-uniform scale only skip tessellation.

- Proportional editing and axis-mirror have special handling
  ensure geometry is properly grouped before considering
  a face part of a single group that can be skipped.

- Loose vertices always need their normals to be recalculated
  since they're calculated based on the location.

- Non-affine transform operations such as shrink-fatten & bend,
  don't take advantage of this optimization.

- Snap projection also disables the optimization.
2021-06-26 17:07:05 +10:00
c1fe582446 Cleanup: move snap with projection check into a function 2021-06-26 16:57:03 +10:00
a287c8d3c1 BMesh: skip partial updates when there is nothing to do 2021-06-26 16:55:14 +10:00
3826fcf035 Cleanup: RNA warning 2021-06-26 16:53:48 +10:00
5759bbe9f9 Fixes a bug where the instances count in the spreadsheet
editor dataset region always showed 0. This was caused by a conditional
statement that needed a domain to be set, which is not the case for
Instances component type.

Reviewer: Hans Goudey (Hoogly Boogly)

Differential Revision: https://developer.blender.org/D11710
2021-06-25 22:57:47 +02:00
eae7090464 Fixes a warning where dst array size was wrong in the
signiture of BLI_str_format_attribute_domain_size.

Reviewer: Hans Goudey (Hoogly Boogly)

Differential Revision: https://developer.blender.org/D11710
2021-06-25 22:56:50 +02:00
cb548329ea UI: Improved File Browser Preview Image Scaling
This patch enables sample filtering when scaling preview images in File
Browser, improving the result a bit. Reduces blockiness and other
artifacts when enlarging the images.

see D11706 for details and examples.

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

Reviewed by Julian Eisel
2021-06-25 10:37:43 -07:00
9586472b9a Cleanup: Clang format 2021-06-25 12:11:13 -05:00
23042a3fb1 Cycles: add view layer option to disable motion blur, in the Filter panel 2021-06-25 18:47:54 +02:00
f863ef8a34 Cleanup: make format
string.c still needs cleanup, but I will leave to the original
author of the latest chagnes to do it since it needs
some tags to skip formatting.
2021-06-25 18:42:30 +02:00
74450265d0 Fix T87185: value assigned to modal Scale does not work properly
`t->values` does not necessarily represent a final value of the
transformation, as each mode treats this value differently.

So, unfortunately, we cannot have a generic offset solution for modal
transform operations. Offset needs to be handled by each mode.

Note: Currently only, `Move`, `Rotate` and `Resize` support this.
2021-06-25 12:52:27 -03:00
20e68d848e Fix T89430: Realizing NURBS curve instances is broken
The "copy_data" function for nurbs splines was incorrect,
it always set the destination's knots vector as "not dirty,"
even if the source's was.
2021-06-25 08:56:40 -05:00
Mihnea Stoian
5ec6c8d267 Linux: prefer using dedicated GPU when launching Blender
Adds "PrefersNonDefaultGPU" and "X-KDE-RunOnDiscreteGpu" to the .desktop file.
Similar hints for macOS and Windows exist already, to prefer using a dedicated
GPU over a slower integrated GPU.

See: https://gitlab.freedesktop.org/xdg/xdg-specs/-/merge_requests/13

Differential Revision: https://developer.blender.org/D11643
2021-06-25 15:28:19 +02:00
5f9677fe0c Fix T88756: crash when baking with autosmooth
When baking some data, we create a new Mesh with edits and modifiers applied.
However, in some cases (e.g. when there is no modifier), the returned Mesh is
actually referencing the original one and its data layers. When autosmooth is
enabled we also split the Mesh. However, since the new Mesh is referencing the
original one, although `BKE_mesh_split_faces` is creating new vertices and edges,
the reallocation of the custom data layers is preempted because of the
reference, so adding the new vertices and edges overwrites valid data

To fix this we duplicate referenced layers before splitting the faces.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11703
2021-06-25 14:16:07 +02:00
3558bb8eae LineArt: Filtering feature lines with face mask
User can specify filtering options inside line art modifier,
like inverting selection and including face mark region border.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11307
2021-06-25 18:48:20 +08:00
ae085e301c Spreadsheet: Dataset region for spreadsheet editor
This patch adds a left aligned sidebar to the spreadsheet editor. This
Sidebar can be used to navigate the geometry component types and
attribute domains. It also provides a quick overview of domain sizes.
It replaces the two dropdowns in the regions header.
Next step will be to add the domain cycling shortcut
using the CTRL + mouse wheel.

Reviewer: Dalai Felinto (dfelinto), Julian Eisel (Severin),
Hans Goudey (HooglyBoogly).

Differential Revision: https://developer.blender.org/D11046
2021-06-25 07:57:24 +02:00
841df831e8 LineArt: More type & related chaining improvements
This patch includes: Floating edge type support,
Special chaining option for floating edge,
Chaining option for reducing jagged edges when floating
edges are involved.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11306
2021-06-25 13:15:25 +08:00
3d7021b4ec GHOST/XR: support Wayland via XrGraphicsBindingOpenGLWaylandKHR 2021-06-24 18:40:05 +01:00
b129a0b397 GHOST: remove unused EGL context includes in Win32 and Cocoa 2021-06-24 18:40:05 +01:00
5f27a5fff7 GHOST/EGL: store pointer to GHOST_System for downcast tests 2021-06-24 18:40:05 +01:00
b801db1181 GHOST/Wayland: auto-select highest supported OpenGL version 2021-06-24 18:40:05 +01:00
b5840f9b5b Cleanup: compiler warnings with clang
* Mark either all or no class methods with override
* Don't use zero sized array since it has a different size in C and C++.
  Using a little more memory here is not significant.
* Don't use deprecated mechanism to mark private GSet members in clang
  just like we don't for MSVC, it warns even for simple zero initialization.
2021-06-24 19:35:23 +02:00
Leon Zandman
beb6399ae5 Fix T89129: file dialog displays in-progress Safari downloads as a folder
In-progress Safari download files/packages are now recognized as bundles
and therefore not treated as directories.

Differential Revision: https://developer.blender.org/D11613
2021-06-24 19:05:49 +02:00
Thomas Lachmann
15868b1ff4 Fix wrong default value for RenderEngine.bl_use_image_save
Differential Revision: https://developer.blender.org/D11680
2021-06-24 19:03:07 +02:00
7b524d9b71 Cleanup: move and simplify some draw_cache macros 2021-06-24 10:54:08 -03:00
a13314a03f Fix T89390: crash when join geometry node has only muted inputs 2021-06-24 15:45:43 +02:00
cbdddc5648 Workaround for assert from 27da305a40
This worked for existing scenes but adding new objects was asserting
needs further investigation.
2021-06-24 21:01:48 +10:00
51568030e9 Depsgraph: remove redundant mesh data duplication in edit-mode
This resolves a bottleneck where every update while transforming
copied the entire mesh data-block, which isn't needed as the edit-mesh
is the source of the data being edited.

Testing shows a significant overall speedup when transforming:

- ~1.5x with a subdivided cube 1.5 million vertices.
- ~3.0x with the spring mesh (edit-mode with modifiers disabled,
  duplicated 10x to drop performance).

Reviewed By: sergey

Ref D11337
2021-06-24 20:23:00 +10:00
27da305a40 Depsgraph: support flushing parameters without a full COW update
Avoid computationally expensive copying operations
when only some settings have been modified.

This is done by adding support for updating parameters
without tagging for copy-on-write.

Currently only mesh data blocks are supported,
other data-blocks can be added individually.

This prepares for changing values such as edit-mesh auto-smooth angle
in edit-mode without duplicating all mesh-data.
The benefit will only be seen when the user interface no longer tags
all ID's for copy on write updates.

ID_RECALC_GEOMETRY_ALL_MODES has been added to support situations
where non edit-mode geometry is modified in edit-mode.
While this isn't something user are likely to do,
Python scripts may change the underlying mesh.

Reviewed By: sergey

Ref D11377
2021-06-24 20:23:00 +10:00
67b352f9c5 Fix T87486: Can't open file with modifiers to a grease pencil library override
Very stupid typo in override apply code on GP modifiers (typical
copy/paste mistake from original modifiers code).

@jbakker this should be back-ported to 2.93LTS.
2021-06-24 12:10:38 +02:00
8cdb99d51c Fix linking code after own recent commit.
More stupid mistake in recent enhanced reports for file load code,
rB82c17082ba0e left some read-after-free situations.
2021-06-24 12:10:06 +02:00
3a8347f823 CMake: link bf_blenkernel from bf_depsgraph
Without this tests fail to lknk in D11377. Commit separately as the
depsgraph is using BKE it should link to it.
2021-06-24 19:38:26 +10:00
6570159929 Cleanup: update clang-format so PyObject_HEAD indents properly 2021-06-24 17:12:04 +10:00
1f778dbefc Cleanup: use Blender's code style for doxygen commetns in freestyle 2021-06-24 15:59:34 +10:00
4b9ff3cd42 Cleanup: comment blocks, trailing space in comments 2021-06-24 15:59:34 +10:00
2e99a74df9 Cleanup: use '#if 0' for commented code-block 2021-06-24 15:53:26 +10:00
879b89e967 Cleanup: correct variable name in comments 2021-06-24 15:53:26 +10:00
0469f2392f Cleanup: remove outdated/redundant comments 2021-06-24 15:53:26 +10:00
55bffa82da Cleanup: clang-format, spelling 2021-06-24 15:53:26 +10:00
de6c6501f0 LineArt: Bound box visibility check when loading
This patch enables bound box check when loading geometry
into line art. Works with overscan as well. Will discard
object if its bbox completely lies in one side of the
clipping space frustum.

Reviewed by: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11545
2021-06-24 13:17:29 +08:00
de05e261ec Line Art: Discard out of frame edges.
For scenes that have a lot of edges, this could potentially
save some time generating individual strokes that are outside
camera frustum.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11525
2021-06-24 13:09:25 +08:00
f7fbb518c8 Fix failure when baking actions with Bendy Bones
682a74e090 renamed Bendy Bones properties and replaced existing float
properties with float-vector properties. This updates the property names used
by the action baking operator (`NLA_OT_bake`).
2021-06-24 00:10:11 +02:00
d6212f67a9 Remove window iteration in WM_DISPLAYCHANGE.
Iteration was incorrectly calling the same object. Had it called every
window it would still be unnecessary as WM_DISPLAYCHANGE is sent to all
broadcast receiving windows.
2021-06-23 10:12:21 -07:00
ef7fcaf8e6 Voxel Remesher: Make smooth shading output automatic
Previously the smooth shading of the voxel remesher was controlled by a
mesh property. With this change, the output will try to match the
current shading of the object. This only takes into consideration the
shading mode of the first polygon of the model, but it is probably what
most users expect as it works as intended with the shade smooth/flat
object mode options.

Reviewed By: JulienKaspar, JacquesLucke

Differential Revision: https://developer.blender.org/D11626
2021-06-23 18:42:40 +02:00
6e4b9f5836 Fix T89221: Sculpt tools symmetry failing with non symmetrical meshes
SCULPT_nearest_vertex_get expects a distance, not a distance squared.
This should make symmetry work as expected, but it still can fail if the
mesh topology is not completely symmetrical.

Reviewed By: JacquesLucke

Maniphest Tasks: T89221

Differential Revision: https://developer.blender.org/D11642
2021-06-23 18:17:46 +02:00
c9f12b21e2 Compositor: Full frame ID Mask node
Adds full frame implementation to this node operations.
No functional changes.
1.2x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11638
2021-06-23 17:46:54 +02:00
35db01325f Compositor: Full frame Image node
Adds full frame implementation to Image node operations.
Mostly refactored into buffer utility methods for reuse in other
operations.
No functional changes.
1.8x faster than tiled fallback.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11559
2021-06-23 17:46:53 +02:00
8f4d991594 Cleanup: remove unused parameter 2021-06-23 17:46:53 +02:00
a50a51eef0 Fix T88769: GPencil smooth incorrect behavior in cyclic strokes
When use smooth tool in a cyclic stroke, the smoothing algorithm was not using the adjacent points if these are the end or start of stroke.

Now, the smooth uses the other extreme of the stroke to compute smoothness.
2021-06-23 17:28:01 +02:00
276790cbfa LibOverride: Also override owner collection in Outliner hierarchy override.
This change will ensure at least one 'local' collection can host the new
'local' override of all objects (indirectly) overridden by this
operation, such that no new override of object ends up in master
collection (which can become extremely messy in production files).

In practice, it means often at least one of the linked collection owning
those objects also has to be overridden.

NOTE: This only affect cases where root overridden linked object has
some dependencies outside of its own root linked collection. While this
situation should be avoided, it cannot always be, so we try to support
it as best as we can.
2021-06-23 17:07:35 +02:00
7dd7849ddd Memfile Undo: aslo tag embedded IDs for update.
This is again in the fuzzy area of how embedded IDs are handled
respectively by partial undo code and depsgraph... Should not be
necessary currently, but better be safe and explicit, and also tag
those embeded IDs from re-used owner ID.
2021-06-23 17:00:17 +02:00
7561e3dad0 CMake/win: Fix linker issue with OCIO
In certain CMake configurations it was possible
that OCIO gave linker errors due to it thinking
it was using the shared library rather than the
static library we ship.
2021-06-23 08:45:37 -06:00
354ecc2f1e Fix T89269: Memory corruption during extrusions of overlapping edges
The "extrude" operator with the "use_dissolve_ortho_edges" option assumed
the edges were connected.
2021-06-23 11:37:35 -03:00
157081069d Fix (studio reported) crash on Undo in some cases.
Would crash when adding or removing a collection directly to the master
collection of a scene.

Consequence of change to handle depsgraph-controlled evaluation of some
IDs (like excluded collections which do not get evaluated and do not get
a COW anymore). See rBcf4258673755 and D10907.

Note that this mostly demonstrates once again how weak and flacky our
handling of embedded IDs still remains, with some part of the code
handling them as independent IDs, some as fully local/private data, some
as a mix of both... and lots and lots of custom handling code and corner
cases that are a bottomless pit of issues.

Also quiet incredible that this was not reported already, luckily this
original change did not make it to 2.93 release.
2021-06-23 16:16:29 +02:00
befb9d99f8 Fix T89331: Cycles lights flicker when transformed
The check on the transformation introduced in rBb313525c1bd0 to fix
T88515 would sometimes prevent to update the light if the Blender object
changed. To fix this, reverse the order in which the checks happen so
that we do not shortcuit the object change check.
2021-06-23 16:07:06 +02:00
b964f73e7d Readfile: use CLOG instead of printf's.
Note that this commit uses a second LogRef (`blo.readfile.undo`) for undo
specific meassages. Allows to use `--log "*undo*"` cli option to match
all undo reporting.

Also did some minor tweaks to some reports on the way.
2021-06-23 14:23:54 +02:00
eed9ac5b6e Fix Scene/MasterCollection handling in BKE_main_collection_sync_remap().
Those were missing proper (explicit) object cache clear, and DEG
tagging.

Note that this was most likely not an common issue in practice (Collection
object cache clearing recursively goes into all parents, so master
collection would only miss it in case they had no child collections at
all, and tagging of those happens almost always at other steps on
remapping). But better to be explicit and consistent here in any case.
2021-06-23 12:15:09 +02:00
e291432f5f Fix T89342: Select mirror with a zero length central edge asserts 2021-06-23 20:07:19 +10:00
635b4db162 Fix T89367: Crash running edit-mesh select_linked_pick from Python 2021-06-23 19:45:48 +10:00
Pratik Borhade
a6f275cad3 Fix T88808: Set Origin missing from Text object in 2.93
Fix T88808.
Caused by {rB5f2c5e5bb8c15bf0d6679351e3482f9c38c00935}

object type for `TEXT object` was missing in following check
that's why `Set Origin` option was lost from object context menu.

Reviewed By: lichtwerk

Maniphest Tasks: T88808

Differential Revision: https://developer.blender.org/D11495
2021-06-23 11:12:13 +02:00
82c17082ba Revert "Revert "Enhanced stats/reports for blendfile reading.""
This reverts commit rB3a48147b8ab92, and fixes the issues with linking
etc.

Change compared to previous buggy commit (rBf8d219dfd4c31) is that
new `BlendFileReadReports` reports are now passed to the lowest level
function generating the `FileData` (`filedata_new()`), which ensures
(and asserts) that all code using it does have a valid non-NULL pointer
to a `BlendFileReadReport` data.

Sorry for the noise, it's always when you think a change is trivial and
do not test it well enough that you end up doing those kind of
mistakes...
2021-06-23 10:37:00 +02:00
071799d4fc Fix T89265: Crash when tabbing through num inputs
Fix by reverting the part of ec30cf0b74
that assigned `but->editval` in `ui_numedit_begin_set_values`.

Causing access freed memory when using tab to switch
to a numeric input and then leaving the textbox by clicking outside.
This was because `ui_numedit_begin_set_values` shouldn't need to set
`but->editval` and overwrite the pointer.
This would set a pointer that had previously been freed,
causing a `NULL` check to fail later on.

Ref D11679
2021-06-23 14:56:36 +10:00
61b22d27c8 Fix T89249: incorrect mesh validate error with zeroed vertex normals
It's not an error for centered vertices to have a zero normal.
2021-06-23 13:57:23 +10:00
5cc8e7ab53 Cleanup: reformat trailing comments that caused line wrapping 2021-06-23 13:54:12 +10:00
2c916c97ac Cleanup: clang-tidy quiet equals-default, nullptr warnings 2021-06-23 12:04:19 +10:00
0f427f4eb1 Cleanup: suppress clang-tidy warnings 2021-06-23 11:48:08 +10:00
58e58310b7 Cleanup: compiler warning for invalid argument type 2021-06-23 11:44:02 +10:00
a8f37763ca RNA Manual Reference: Update Mapping File 2021-06-22 19:37:45 -04:00
dbc054bb88 Fix T89374: Erasing/cutting in Grease Pencil makes Blender shut down
When cut a stroke of 1 point, the clean up done to avoid keep 1 point strokes removes the memory, but the pointer to the first stroke was not set to NULL. As this pointer is invalid now, any use of this produces a segment fault because the pointer is corrupted..
2021-06-22 23:12:04 +02:00
abb07a38b8 GHOST/XR: fix code format 2021-06-22 22:05:47 +01:00
c88c331384 PyDoc: Update Sphinx and pin dependencies
Sphinx has rather loose dependency requirements which can cause issues if we aren't careful.
As a solution they recommend that you pin sphinx dependency versions
2021-06-22 16:30:07 -04:00
Leon Leno
187e217b5a UI: Fix widget emboss: Also fade on the right side
Currently the emboss is only fading on left side of the widget,
resulting in the emboss extending vertically on the right side
and ending abruptly. This patch fixes this by also fading the
emboss on the right side and making it symmetric.

Differential Revision: https://developer.blender.org/D10810
2021-06-22 15:21:53 -05:00
fa1868ae97 Transform: display units for proportional edit value
This fixes T88346.

The code is also more readable by making a better distinction between
the texts used for Distances, "Proportional Size" and "AutoIK-Len".

And the text used to translate the "Proportional Size" is reused.
2021-06-22 17:17:44 -03:00
c3b641613c Cleanup: deduplicate code and rename variables
This makes it clearer that variables are strings and how they are used
in the Move header code.
2021-06-22 16:51:34 -03:00
0732a9f1b2 GHOST/XR: enable X11-EGL context for OpenXR 2021-06-22 20:00:40 +01:00
87833f8f95 GHOST/EGL: add GHOST_XrGraphicsBindingOpenGL as friend 2021-06-22 20:00:40 +01:00
b35ba22d84 GHOST/EGL: getters for display, config and context 2021-06-22 20:00:40 +01:00
c6e6a9046e GHOST/EGL: ignore unused variables 2021-06-22 20:00:40 +01:00
ee8b284d11 Fix T89327: Cube and ico sphere nodes do not create UVs
It turns out you have to add the UV custom data layer manually before
calling the BMesh primitive operators, even if you pass `calc_uvs=true`.
2021-06-22 13:22:40 -05:00
Leon Zandman
c317f111c1 Cleanup: Spelling Mistakes
This patch fixes many minor spelling mistakes, all in comments or
console output. Mostly contractions like can't, won't, don't, its/it's,
etc.

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

Reviewed by Harley Acheson
2021-06-22 10:54:50 -07:00
2fcd3f0296 Cleanup: Remove extra blank line 2021-06-22 19:52:16 +02:00
1917d0345e Fix T89366: GPencil hide layers above parented layer
The problem was the flag was not reset by layer in the loop.
2021-06-22 19:49:03 +02:00
ebfad93039 Fix T89343: Point cloud instances not transformed when realized
This problem has surprisingly been there for quite a few months.
For point clouds all attributes were handled the same, even "position",
which should be transformed when combining source points into the
destination.
2021-06-22 12:19:34 -05:00
3a48147b8a Revert "Enhanced stats/reports for blendfile reading."
This change crashes library linking operators, related tests and probably more.

This reverts commit f8d219dfd4.

Ref D11583
2021-06-22 19:13:50 +02:00
0b15353baa Geometry Nodes: Join curve attributes when realizing instances
Previously the code assumed that curve instances had no attributes.
This is true when the data came from curve objects, which don't support
attributes currently, but it isn't necessarily true when retrieving curves
from evaluated geometry sets.
2021-06-22 11:35:00 -05:00
f3eecfe386 Cleanup: Refactor spline copying functions
Make the virtual functions protected and simpler, so that the logic is
better contained in the base class's implementation. Also introduce a
`copy_without_attributes` method to be used for realizing instances.
2021-06-22 11:32:50 -05:00
026de343e3 Fix deadlock with shrinkwrap and other modifiers
More code that needs task isolation. Encountered in sprite fright production
file.

Ref D11603
2021-06-22 18:26:58 +02:00
f8d219dfd4 Enhanced stats/reports for blendfile reading.
Add direct user feedback (as a warning report) to user when recursive
resync of overrides was needed.

And some timing (as CLOG logs) about main readfile process steps.

This is essentially adding a new BlendFileReadReport structure that wraps
BKE_reports list, and adds some extra info (some timing, some info about
overrides and (recursive) resync, etc.).
2021-06-22 17:28:19 +02:00
6ff0d59967 Minor cleanup to previous commit introducing BLI_math_time.
Forgot to address latest review comments, sorry for the noise.`:wq
2021-06-22 17:02:45 +02:00
feaf309de7 Add initial BLI_math_time with a 'seconds decompose' function.
Allows to decompose a given amount of seconds into a random set of
days/hours/minutes/seconds/milliseconds values.

Also add matching test.

Differential Revision: https://developer.blender.org/D11581
2021-06-22 17:00:18 +02:00
f4e3b1e573 Fix T89360: Eevee transforms geometry when using "High Quality Normals"
Offset missed in rB44d2479dc36f
2021-06-22 10:14:13 -03:00
e3bdb189a7 Cleanup: split BKE_object_batch_cache_dirty_tag
Create a more specialized function `BKE_object_data_batch_cache_dirty_tag`
2021-06-22 09:06:33 -03:00
ab063db34d Cleanup: deduplicate free code
It is more appropriate that `depths` is freed in `ED_view3d_depths_free`.
2021-06-22 08:25:32 -03:00
3f1111b2a8 Draw: Added testcases for hair refine shaders. 2021-06-22 11:11:31 +02:00
ad9fd47d7b Fix T89347: Edit-mesh make planar faces doesn't update face normals
Invalid face normals were used for tessellation.
2021-06-22 18:32:51 +10:00
01234b430b Fix T89345: Edit-mesh decimate doesn't update face normals
Invalid face normals were used for tessellation.
2021-06-22 18:27:52 +10:00
956c539e59 Fix T89196: Depsgraph use-after-free after scene switching undo
Delay depsgraph visibility update tagging until it is known that
graph relations are up to date, and until it is known that the graph
is actually needed to be evaluated.

Differential Revision: https://developer.blender.org/D11660
2021-06-22 09:52:45 +02:00
d3a792431e Cleanup: Use more clear visibility tag function name
No functional changes. Just makes it clear this is not an immediate
update, and will make an upcoming change more localized.
2021-06-22 09:52:45 +02:00
53ba9f01e2 Fix error in context menu when built without freestyle 2021-06-22 17:19:02 +10:00
1725bfc3cb Cleanup: remove unused menu VIEW3D_MT_edit_mesh_edges_data
8aa17c5b12 missed removing the
menu definition when removing from the UI.
2021-06-22 17:18:28 +10:00
6a3bd04e42 Cleanup: rename playhead in the UI and code
Current convention is not to use this term, use "current frame",
and "timeline frame" in render.c as this is the argument passed in.
2021-06-22 17:03:22 +10:00
8af2c87f7e 3D View: adjust order of planes for occlusion check
Move far plane last since it's the least likely to intersect edges.
2021-06-22 15:59:15 +10:00
cd39e3dec1 OptiX: select BVH build options from Scene params
Currently, the OptiX BVH build options are selected based on whether
we are in background mode (final renders) or not (viewport renders).
In background mode, the BVH is built for fast path tracing and low
memory footprint, while in viewport, it is built for fast updates.

However, on platforms without OpenGL support, the background flag is
always set to true and prevents using fast BVH builds in the viewport.

Now, the BVH options derive from the Scene BVH settings:
* if BVH is static, a fast to trace BVH is built
* if BVH is dynamic, a fast to update BVH is built

Reviewed By: #cycles, brecht

Differential Revision: https://developer.blender.org/D11154
2021-06-22 07:38:28 +02:00
338be95874 Fix bone select failing with end-points outside the view
Apply the same fix for T32214 (edge-select failing) to bones
which also failed when their end-points were outside of the view.

- Add V3D_PROJ_TEST_CLIP_CONTENT support for edit & pose bone iterator
  and use for selection operators.
- Remove unnecessarily complicated checks with pose-mode lasso tagging.
- Correct error in pose-mode LassoSelectUserData.is_changed
  (currently harmless as it's not read back).
2021-06-22 14:23:37 +10:00
9ac56bad4c Cleanup: use early return for selection callbacks 2021-06-22 14:23:37 +10:00
67ee87a6e9 Cleanup: spelling 2021-06-22 14:23:37 +10:00
53e1442ac2 Cleanup: comment use C comment-blocks for GHOST_Types.h
Also use full sentences, and correct typos.
2021-06-22 14:23:37 +10:00
e1d6219731 Cleanup: Use "size" instead of "points_len" in spline code
Previously this was mostly consistent, but not completely. It's helpful
to use the same name for the same meaning everywhere in this area.
2021-06-21 23:07:26 -05:00
dc3b7602ee Cleanup: Rename variables, use shorter names
`src` and `dst` are perfectly clear, and avoid repeating unecessary
characters when writing the variables many times, allowing more space
for everything else.
2021-06-21 23:02:00 -05:00
d086570c7a UI: Sequencer: add refresh_all operator to all sequencer view menus
This commit piggybacks on rB3e695a27cdfad560d0b28e742cfa069d098200d6
2021-06-21 22:29:58 -04:00
4947aa29db CMake: Improve python version mismatch error
When CMake detects and incompatible Python version
it errors out with an error saying at-least python 3.9
is required, but doesn't mention the version it detected.

This makes troubleshooting the problem harder than it
needs to be.

This diff changes the error message to include the python
version CMake detected.

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

Reviewed By: Ray Molenkamp
2021-06-21 18:19:07 -06:00
d443dcc733 Build/Windows: Preliminary VS 2022 support.
This adds preliminary VS 2022 support, since
there currently is no CMake version that
supports the VS2022 IDE only ninja support
was tested.

IDE support should work without any additional
changes as soon as an updated CMake becomes
available.

As VS2022 appears to keep binary compatibility
with earlier MSVC versions, the current SVN
libraries will work for this version.
2021-06-21 18:11:30 -06:00
6f158f834d Refactor of Wintab to use Wintab supplied mouse movement once verified against system input.
Reviewed By: brecht, LazyDodo

Maniphest Tasks: T88852

Differential Revision: https://developer.blender.org/D11508
2021-06-21 14:38:51 -07:00
445d506ac9 Geometry Nodes: Use multithreading for the curve to mesh node
This commit optimizes the node for the case where it works on many
splines by allowing it to generate mesh data from their combinations
in parallel. By itself, this made the node around twice as fast in my
test file with a result of 20 million vertices, around 600ms instead of
1.2s before.

That isn't actually a very good result; it reveals another bottleneck,
a single threaded loop over all face corners in the mesh normal
calculation code. As a simple change that might improve performance
in some situations, this commit moves normal calculation out of this
node, so at least the work isn't wasted if the mesh is changed later
on in the node tree anyway.
2021-06-21 16:17:02 -05:00
Germano Cavalcante
b11a463e4f Refactor: Do not keep a copy of depth buffer in RegionView3D
The depth cache (located in `RegionView3D::depths`) is used for quick
and simple occlusion testing in:
- particle selection,
- "Draw Curve" operator and
- "Interactive Light Track to Cursor" operator,

However, keeping a texture buffer in cache is not a recommended practice.

For displays with high resolution like 8k this represents something
around 132MB.

Also, currently, each call to `ED_view3d_depth_override` invalidates
the depth cache. So that depth is never reused in multiple calls from
an operator (this was not the case in blender 2.79).

This commit allows to create a depth cache and release it in the same
operator. Thus, the buffer is kept in cache for a short time, freeing
up space.

No functional changes.
2021-06-21 16:41:50 -03:00
b665ad8621 Fix T89291: Objects with rotation deltas don't rotate in correct axes
Quaternion correction was not implemented and Euler values were being
incorrectly combined.
2021-06-21 14:31:45 -03:00
41af27c582 Fix deadlocks in mesh modifier evaluation and particles
The recent task isolation changes missed two mutex locks that also need task
isolation.

Ref D11603, T89194
2021-06-21 19:25:12 +02:00
47473bee34 GPencil: Disable Lights when duplicate layer
Missing to disable default light ON when use separate operator.
2021-06-21 16:59:20 +02:00
b9ccfb89ce Performance: Flush selection to edges/faces.
This patch uses threading to flush selection from verts to edges and
from edges to faces. The solution is lockless and should scale well on
modern CPU architectures.

Master:{F10185359}
Patch:{F10185361}

End user performance went from 3.9 to 4.6 FPS (Stanford Dragon) but that
was measured on a Intel Core i7-6700 CPU and AMD RX480 Gpu. The more
cores the better improvements you get.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11644
2021-06-21 16:35:28 +02:00
ce64cfd6ed Fix T89306: GPencil selection doesn't work correctly with modifiers
The problem was introduced with Bezier modification because the selection code was using the original stroke and not the evaluated version.
2021-06-21 16:08:26 +02:00
3cf39c09bf Cleanup: improve naming in Compositor 2021-06-21 13:51:51 +02:00
4246898ad3 Cleanup: move function parameter to member
Get current pass only when needed.
2021-06-21 13:51:51 +02:00
2851602052 Add a reason for why an Addon can not be loaded. This change gives a more detailed explanation of the issue and may help the Addon Developer to identify what exactly needs to be changed.
The current message 'addon not loaded' is a bit too sparse.

Differential Revision: https://developer.blender.org/D11655
2021-06-21 12:51:46 +02:00
4968a0bdf9 Fix T89122: crash when multi input is connected to multiple group inputs
The early `return` was wrong when there are multiple origin sockets
that need to be loaded.
2021-06-21 12:15:32 +02:00
Daniel Salazar
f383cad329 Fix T89329: icosphere subdivisions can be set to 0
Differential Revision: https://developer.blender.org/D11658
2021-06-21 11:11:11 +02:00
002d563bbb Cleanup: use doxy sections in view3d iterators 2021-06-21 18:17:02 +10:00
4d91808710 Cleanup: variable naming in view3d_iterators
Consistently use a/b instead of 0/1.
2021-06-21 18:01:12 +10:00
4044c29069 Fix T32214: Wireframe edge select fails with verts behind the view
This resolves a long standing bug in edge selection
(picking, circle, box & lasso).

Now when one of the edges vertices fails to project into screen space,
the edge is clipped by the viewport to calculate an on-screen location
that can be used instead.

This isn't default as it may be important for the on the screen location
not to be clipped by the viewport.
2021-06-21 17:27:56 +10:00
54d651c344 Cleanup: pass objects as const arguments 2021-06-21 17:25:10 +10:00
19df0e3cfd Cleanup: swap top/bottom args to planes_from_projmat
X & Z were ordered min/max, where as Y was max/min.
2021-06-21 17:25:09 +10:00
b2510b9e20 Fix T89271: Selecting all vertices doesn't select all edges.
Mistake in recent commit {rBea4309925f1d2d2a224bd1dce12269a58ade9b62}.
2021-06-21 07:55:49 +02:00
feb6fd632f Cleanup: Rename spline interpolation functions
The names were slightly longer than they needed to be clear,
and when they are shorter they tend to fit on one line better.
2021-06-20 22:05:57 -05:00
a1c3e45100 Geometry Nodes: Multithread curve resample node
Optimize the node for the case of many splines. In a test file with
14000 splines, the node is 3x faster (72ms to 24ms) on an 8 core CPU.
2021-06-20 21:57:47 -05:00
b45cee1aaf Cleanup: use early return in view3d iterator callbacks 2021-06-21 12:52:08 +10:00
5df6b4004c Docs: improve imbuf.write docstring
The file path wasn't documented as being optional.
2021-06-21 12:25:36 +10:00
5f71b1edd5 Delaunay add support for detecting and removing holes from output.
Adds two new output modes to the CDT api which detect and remove
holes. A hole is a face from which a ray shot to the outside
intersects an even number of constraint edges, except we don't
count constraint edges in the same connected region of faces,
where a region is connected via non-constraint edges.

These modes are useful for filling in outlines meant to represent
text characters and the like.

Original patch was from Erik Abrahamsson, modified by me to work
with the "valid Bmesh" output type too. I also added tests
for the new modes.
2021-06-20 20:57:22 -04:00
80083ac773 Fix T89310: Industry Compatible keymap not working
Caused by improper testing on my part, assuming a helper function
existed in the industry compatible keymap file, and also assuming it
also used the N and T keys for the left and right side-regions.
2021-06-20 18:52:01 -05:00
0cd34967c0 Curves: Multithread Curve to CurveEval conversion
A different data structure / implementation is used for curves in the
node tree currently. Converting from the DNA `Curve` structure to this
wasn't slow, but it's nice to decrease overhead. In a test of 14000
splines with 128000 points, this halves the runtime from about 5ms
to about 2.5ms.
2021-06-20 18:42:02 -05:00
6afafc46f6 Fix: Spreadsheet selection filter crash on non-mesh components
The spreadsheet filter tried to apply the mesh selection filter on non-
mesh geometry components. Add a check for the component type,
and also refactor the function to be more easily readable.
2021-06-20 17:39:18 -05:00
2d75b39b64 Fix T89302: Broken normals after mesh to curve node
The normals were broken because the normal calculation mode wasn't set.
This patch adds a default normal mode so all code creating a spline does
not necessarily have to set it manually. In the future there should be a
way to change this value in the node tree.
2021-06-20 13:07:49 -05:00
eee3529eaf Docs: improve poly_to_tri_count doc-string
It wasn't obvious this can be used for calculating the triangle index
from the polygon and loop index.
2021-06-21 00:05:26 +10:00
859b3ff346 Cleanup: remove contents of endif() in cmake
This convention is no longer used for Blender's CMake files.
2021-06-20 23:59:07 +10:00
bce482f476 Cleanup: use eSpace_Type enum type 2021-06-20 23:59:07 +10:00
d9b1592c88 Cleanup: make BKE_mesh_loops_to_tessdata a static function 2021-06-20 17:21:50 +10:00
3462b4c7ae Docs: add additional notes on tessellation, update comments 2021-06-20 17:18:53 +10:00
2d60c496a2 Mesh: minor optimization to concave quad check for tessellation
Use the face normal (when available) for a faster concave quad test.
2021-06-20 14:39:13 +10:00
513f566b40 Mesh: optimize object mode face tessellation
- Multi-thread BKE_mesh_recalc_looptri.

- Add BKE_mesh_recalc_looptri_with_normals,
  this skips having to calculate normals for ngons.

Exact performance depends on number of faces, size of ngons and
available CPU cores.

For high poly meshes the isolated improvement to BKE_mesh_recalc_looptri
in my tests was between 6.7x .. 25.0x, with the largest gains seen in
meshes containing ngons with many sides.

The overall speedup for high poly meshes containing quads and triangles
is only ~20% although ngon heavy meshes can be much faster.
2021-06-20 14:39:13 +10:00
b5e5fbcfc8 Cleanup: clang-format 2021-06-20 13:12:27 +10:00
3da25dc625 Cleanup: use doxy sections 2021-06-19 19:41:44 +10:00
f3c5a84bb9 Cleanup: clang-tidy 2021-06-19 18:42:57 +10:00
033641aa74 VSE: Remove seq->tmp usage
Remove `seq->tmp` usage from transform code. It was used to tag strips
that need to be "shuffled". Pass these strips in `SeqCollection`
instead.

Reviewed By: sergey, mano-wii

Differential Revision: https://developer.blender.org/D11631
2021-06-19 05:07:00 +02:00
f9aea19d98 Spreadsheet Editor: Row Filters
This patch adds support for filtering rows based on rules and values.
Filters will work for any attribute data source, they are a property
of the spreadsheet rather than of the attribute system. The properties
displayed in the row filter can depend on data type of the currently
visible column with that name. If the name is no longer visible, the
row filter filter is grayed out, but it will remember the value until
a column with its name is visible again.

Note: The comments in `screen.c` combined with tagging the sidebar
for redraw after the main region point to a lack of understanding
or technical debt, that is a point to improve in the future.

**Future Improvements**
* T89272: A search menu for visible columns when adding a new filter.
* T89273: Possibly a "Range" operation.

Differential Revision: https://developer.blender.org/D10959
2021-06-18 16:33:02 -05:00
d52b7dbe26 Fix T89261: Crash when calculating bmesh tessellation
Error passing `false` instead of a `BMeshCalcTessellation_Params` struct.
2021-06-18 15:20:36 -03:00
3e6f2c7a99 Cleanup: Remove dead code
This code was disabled in 2.8 and all other associated code/comments 
have been removed/cleared. These rna properties have been replaced with 
`seq_prev_type`
2021-06-18 13:54:00 -04:00
f7022fc73f Fix Build Warning
Removal of unused local variable. Calculation of underline thickness
no longer needed with change to text output of underscore character.

Introduced in aee04d4960

Differential Revision: https://developer.blender.org/D11641
2021-06-18 09:22:52 -07:00
8a048593ca Fix T89259: GPencil Duplicate point doesn't work for last point
The loop was checking the len of the island, but if the island started in the last point the copy was not executed.
2021-06-18 18:16:38 +02:00
b6030711a2 Armature: add automatic B-Bone Scale toggles.
Currently B-Bone scaling can only be controlled via their
properties, thus requiring up to 8 drivers per joint between
B-Bones to transfer scaling factors from the handle bone.

A Scale Easing option is added to multiply the easing value
by the Y scale channels to synchronize them - this produces a
natural scaling effect where both the shape of the curve and
the scale is affected.

In addition, four toggles are added for each handle, which
multiply each of the X, Y, Z and Ease values by the matching
Local Scale channel of the handle bone, thus replacing trivial
drivers. The Scale Easing option has no effect on this process
since it's easy to just enable both Length and Ease buttons.

Differential Revision: https://developer.blender.org/D9870
2021-06-18 18:56:04 +03:00
638c16f410 Armature: implement lengthwise scaling of B-Bone segments.
Implement actual behavior for the B-Bone Y Scale channels added
to DNA and UI in the previous commit in addition to the existing
X and Z Scale inputs.

The two length scale inputs control the ratio between the lengths
of the start and end segments of the bone: although for convenience
two inputs are provided, the whole chain is still uniformly scaled
to fit the curve.

Differential Revision: https://developer.blender.org/D9870
2021-06-18 18:56:03 +03:00
682a74e090 Armature: add B-Bone Y scale channel and extra flag fields to DNA.
In addition to the base bone transformation itself, B-Bones have
controls that affect transformation of its segments. For rotation
the features are quite complete, allowing to both reorient the
Bezier handles via properties, and to control them using custom
handle bones. However for scaling there are two deficiencies.

First, there are only X and Y scale factors (actually X and Z),
while lengthwise all segments have the same scaling. The ease
option merely affects the shape of the curve, and does not cause
actual scaling.

Second, scaling can only be controlled via properties, thus
requiring up to 6 drivers per joint between B-Bones to transfer
scaling factors from the handle bone. This is very inefficient.

Finally, the Z channels are confusingly called Y.

This commit adds a B-Bone Y Scale channel and extra B-Bone flag
fields to DNA with appropriate versioning (including for F-Curves
and drivers) in preparation to addressing these limitations.

Functionality is not changed, so the new fields are not used
until the following commits.

Differential Revision: https://developer.blender.org/D9870
2021-06-18 18:56:03 +03:00
aee04d4960 Fix T89246: No Mnemonic Underlines in Dialogs
When drawing mnemonic underlines for hotkeys, use text output of
underscore character instead of direct drawing a line. Otherwise these
are not visible in dialog buttons.

Introduced in 0fcc063fd9

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

Reviewed by Campbell Barton
2021-06-18 08:32:07 -07:00
4c19fe4707 UI: Sequencer: Use ampersand instead of slash for "Sequencer/Preview"
Using an ampersand here is more semantically correct. A slash indicates "or" while an ampersand indicates "and".
An ampersand here is best because the view type shows both the Sequencer and the Preview.
2021-06-18 11:13:00 -04:00
4998ceebfc GPencil: Missed flag in previous Copy Settings commit 2021-06-18 16:47:08 +02:00
408726000a GPencil: Move copy layer settings to function
Better to have a function that can be reused to duplicate the settings that need to be copied.
2021-06-18 16:40:44 +02:00
Jeroen Bakker
e0f2f07d1e DrawManager: Multithreaded counting of material buckets.
When having multiple materials in a mesh the triangles are sorted based
on material index. This sorting is done single threaded, but needs two
loops over the data. One to count the bucket size and the second one to
add the triangles to the right position in the buckets.

This patch will do the counting in a multithreaded approach that would
speed up the cache creation. It has been measured that this part is the
most blocking part of the cache creation.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11615
2021-06-18 16:10:28 +02:00
Jeroen Bakker
6d73d98fb6 BMesh: use threading to count total selection.
During selections the total selection is refreshed at the end. This
process was done single threaded. This patch will do a parallel iter
approach.

Master: 0.043612s Threaded 0.017964s.

Master: {F10179586}
This patch: {F10179587}

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11622
2021-06-18 16:06:36 +02:00
03a83b4eb5 Fix T89262: Crash in regular FileBrowser ID listing of 'asset' .blend files.
`ED_fileselect_get_asset_params` would only return actual data pointer
when file browser is in ASSET mode.

Calling that whole section only makes sense if filebrowser is in asset
mode anyway.

Regression introduced in rBf6c5af3d4753 I think.

@Severin committing this fix now as this is a fairly critical bug for
the studio, feel free to revert and do proper fix if this one is not the
best solution.
2021-06-18 15:49:50 +02:00
Jeroen Bakker
ea4309925f Performance: Limit recounting during selection mode flushing.
This patch ensures that selection mode flushing updates total selection
counts internally. This reduces recounting when we are sure that the
input total selection counts were up to date.

For example for circle selection the total selection counts were
correct. But during flushing the selection could have been changed and
therefore the selection was always recounted.

This increased the performance on selected system from 6.90 FPS to 8.25
FPS during circle selection operations.

Before: {F10179981}
After: {F10179982}

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11647
2021-06-18 15:44:08 +02:00
a9d5c8f97f Fix error passing in false as instead of a struct
Error in 8a1860bd9a.
2021-06-18 23:40:28 +10:00
847b66e81d Fix T88394: crash when editing animated Alembic properties
When an object, whose mesh gets loaded from Alembic, gets animated in
Blender and the Alembic CacheFile datablock also gets animated, editing
keyframes causes both datablock to be re-copied for evaluation. This
caused a threading issue and a double-free of some memory. This is fixed
by expanding the scope of the spin lock in
`BKE_cachefile_reader_free()`.
2021-06-18 13:57:46 +02:00
b8cf8e0bc2 Fix T89240: Crash when moving vertices on a linked duplicate
There is an attempt to free an illegal pointer in `extract_edge_fac_finish`.
2021-06-18 08:25:51 -03:00
80bc819d50 Fluid: Clang-format cleanup
Updated fluid source files in extern with clang-format.
2021-06-18 12:28:17 +02:00
adefdbc9df Fluid: Optimization for FLIP neighbor search radius
Contributed by @erik85 in D11400. The idea from this patch was placed in
a more generic context: A new FOR macro has been added that loops
over the neighbors of a cell within a given radius.
2021-06-18 12:18:21 +02:00
7c68147709 Fix T88605: Alembic import crashes when missing arbGeomParams
Add check for the `arbGeomParams` property being valid, before attempting
to access a sub-property from it.
2021-06-18 11:21:13 +02:00
060d668ae6 Cleanup: clang format 2021-06-18 10:50:19 +02:00
6c1fdd52c1 Fix invalid polygon normal array access building bake data
Pre computed normals index wasn't properly aligned.
Regression from 2ec00ea0c1.
2021-06-18 18:00:47 +10:00
3caafd24a9 Cleanup: use 'bmesh' prefix for BMesh tessellation utilities 2021-06-18 16:37:43 +10:00
c4958bc540 Cleanup: rename test_index_face -> BKE_mesh_mface_index_validate 2021-06-18 15:13:52 +10:00
2e8d7fa7ee Cleanup: remove unused MFace custom-data utilities
Remove:

- BKE_mesh_loops_to_mface_corners
- BKE_mesh_tangent_loops_to_tessdata
2021-06-18 15:08:23 +10:00
253c5d25f7 Cleanup: move mesh tessellation into it's own file
This matches BMesh which also has tessellation in it's own file.

Using a separate file helps with organization when
extracting code into smaller functions.
2021-06-18 15:03:31 +10:00
c290ac2ab1 CMake: remove workaround for version that's no longer supported 2021-06-18 14:41:24 +10:00
af4167441b Cleanup: clang-tidy 2021-06-18 14:41:24 +10:00
50a4b9d502 Cleanup: replace 'unsigned in' with 'uint' 2021-06-18 14:27:41 +10:00
5f0d4fef91 Cleanup: use standard identifier for uint64_t string formatting 2021-06-18 14:27:39 +10:00
68b06208d2 Fix undefs from previous commit 2021-06-17 22:27:09 -03:00
f3c88f8ba5 Fix T89210: Box selection can fail in graphics editor
Test the intersection of segment instead of point.
2021-06-17 22:20:50 -03:00
Fen
e178a273fa Fix T89247: Dereference arguments to comparison function correctly
`bm_face_len_cmp` incorrectly interpreted its arguments as `BMFace *`
instead of `BMFace **`, causing an out-of-bounds read.

Ref D11637
2021-06-18 11:13:09 +10:00
94c4a9995e Fix T89233: Incorrect attribute remove warning for curves
The curve attribute delete function didn't return whether it was
successful or not.
2021-06-17 17:22:09 -05:00
4b673ebb99 Raycast geometry node.
The //Raycast// node intersects rays from one geometry onto another.
It computes hit points on the target mesh and returns normals, distances
and any surface attribute specified by the user.

A ray starts on each point of the input //Geometry//. Rays continue
in the //Ray Direction// until they either hit the //Target Geometry//
or reach the //Ray Length// limit. If the target is hit, the value of the
//Is Hit// attribute in the output mesh will be true. //Hit Position//,
//Hit Normal//, //Hit Distance// and //Hit Index// are the properties of the
target mesh at the intersection point. In addition, a //Target Attribute//
can be specified that is interpolated at the hit point and the result
stored in //Hit Attribute//.

Docs: D11620

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11619
2021-06-17 21:11:32 +01:00
577d6d3f87 Fix T89234: Gpencil Separate doesn't copy settings in Stroke/Point mode
Some values were not copied from the old layer to the new one as Tint or Opacity factor.

The error affected to Strokes and Point mode
2021-06-17 20:41:53 +02:00
ed4222258e Geometry Nodes: Add Curve Subdivision Node
This node creates splines with more control points in between the
existing control points. The point is to give the splines more
definition for further tweaking like randomization with white noise,
instead of deforming a resampled poly spline with a noise texture.

For poly splines and NURBS, the node simply interpolates new values
between the existing control points. However, for Bezier splines,
the result follows the existing evaluated shape of the curve, changing
the handle positions and handle types to make that possible.

The number of "cuts" can be controlled by an integer input, or an
attribute can be used. Both spline and point domain attributes are
supported, so the number of cuts can vary using the value from the
point at the start of each segment.

Dynamic curve attributes are interpolated to the result with linear
interpolation.

Differential Revision: https://developer.blender.org/D11421
2021-06-17 11:39:23 -05:00
7c1bb239be Geometry Nodes: support minimum twist normal mode
The minimum twist mode is important because it allows creating
normals without sudden changes in direction. The disadvantage
of minimum twist normals is that the normals depend on all control
points. So changing one control point can change the normals
everywhere. The computed normals do not match the existing
code exactly, although they do match quite well on non-cyclic and
on some cyclic curves. I also noticed that the existing implementation
has some fairly simple failure cases that I haven't found in the new
implementation so far.

Differential Revision: https://developer.blender.org/D11621
2021-06-17 15:23:01 +02:00
56db09e2fd Geometry Nodes: fix ownership issue in spline to points conversion
Previously, `VArray_For_SplineToPoint` did not take ownership of the
virtual array leading to use-after-free errors.
2021-06-17 13:40:08 +02:00
1388e9de8a Geometry Nodes: improve node locking in evaluator
This makes the parts where a node is locked more explicit. Also, now the thread
is isolated when the node is locked. This prevents some kinds of deadlocks
(which haven't happened in practice yet).
2021-06-17 10:43:39 +02:00
a971409d5a Cleanup: use doxy sections for rna_mesh.c 2021-06-17 16:44:43 +10:00
ccd5f80550 Cleanup: rename rna_Mesh_update_data to rna_Mesh_update_data_deg_all
It's ambiguous what rna_Mesh_update_data does compared with functions
that use `rna_Mesh_update_data_*` as a prefix.

Noticed by @sybren D11377 review.
2021-06-17 16:38:19 +10:00
8ff6322152 Cleanup: improved comment for skipping updated with zero user meshes
Noticed by @sybren D11377 review.
2021-06-17 16:32:08 +10:00
6db290641e Cleanup: split BKE_mesh_copy_settings into two functions
- BKE_mesh_copy_parameters_for_eval to be used for evaluated meshes only
  as it doesn't handle ID user-counts.

- BKE_mesh_copy_parameters is a general function for copying parameters
  between meshes.
2021-06-17 15:08:19 +10:00
286bd87445 Cleanup: spelling 2021-06-17 14:43:25 +10:00
eb85de027c Cleanup: unused argument, function & shadow variable warning 2021-06-17 14:43:13 +10:00
78693d524c VSE: Refactor transform operator code
Refactor function `freeSeqData` so it is readable.

One strip can have multiple transform operations defined. To prevent
processing strip multiple times, build `SeqCollection` and use
sequencer iterator instead of iterating `TransData` directly.

No functional changes.

Differential Revision: https://developer.blender.org/D11618
2021-06-17 04:04:01 +02:00
e7003bc965 VSE: Reduce transform code complexity
Reduce complexity of sequencer transform code by removing recursivity.
This is possible by treating meta strips (mostly) as any other strip and
containing all transform code within SEQ_ functions.

Unfortunately internally meta strips still require special treatment,
but all complexity from code all over transform code seems to be
possible to contain within one function.

Functional change:
Previously adjusting handle of single image strip moved animation.
Now animation is not moved, which is behavior for all other strips.

Reviewed By: sergey, mano-wii

Differential Revision: https://developer.blender.org/D11493
2021-06-17 03:42:04 +02:00
c73be23e17 Revert "Fix T89204: slow repeated rendering with GPUOffscreen.draw_view3d"
This reverts commit d03b26edbd. There is some
refresh issue that needs to be solved before this can be enabled.
2021-06-17 02:06:26 +02:00
845f4cebad Fix T88342: 'To Sphere' and 'Push/Pull' not working in Pose mode
Some modes don't take into account that `TransData` may be in data space.
2021-06-16 16:47:46 -03:00
d03b26edbd Fix T89204: slow repeated rendering with GPUOffscreen.draw_view3d
Cache the GPUViewport so the framebuffers and associated textures are not
reallocated each time.
2021-06-16 20:19:34 +02:00
a1cc7042a7 Edge-scrolling for node editor
Starts scrolling when dragging a node or node link and going outside the current window.
Largely copied from the VIEW2D_OT_edge_pan operator.

Edge panning operator customdata and supporting functions now in
UI_view2d.h, so they could be used by operators in other editor
libraries. The VIEW2D_OT_edge_pan operator also uses this customdata and
shared functions now. Operators properties can be used to configure
edge panning margins and speed for each use case, rather than using
hardcoded values.

The speed function for edge panning has been tweaked somewhat:
* "Speed per pixel" has been replaced with a "speed ramp" distance.
  This is more intuitive and also creates an upper bound for the speed,
  which can otherwise become extreme with large cursor distance.
* "Max speed" is reached at the end of the speed ramp.
* Padding the region inside and outside is applied as before, but both
  values are operator properties now.

Node transform operator also supports edge panning. This requires
an offset for changes in the view2d rect, otherwise nodes are "stuck"
to the original view.

Transform operator had cursor wrapping categorically enabled, but this
gets quite confusing with the edge scrolling mechanism. A new TransInfo
option T_NO_CURSOR_WRAP has been introduced to disable this behavior.
The double negative is a bit annoying, but want to avoid affecting the
existing transform modes, so by default it should still set the
OP_IS_MODAL_GRAB_CURSOR flag (which then sets the WM_CURSOR_WRAP_XY
flag during modal execution).

Reviewed By: HooglyBoogly, JacquesLucke

Differential Revision: https://developer.blender.org/D11073
2021-06-16 18:35:52 +01:00
247abdbf41 LineArt: Cached calculation for modifiers in the same stack.
This allows line art to run only once for each modifier stacks,
with an option to toggle a specific line art modifier should
use cache or re-do their own calculations.

Reviewed By: Sebastian Parborg (zeddb), Hans Goudey (HooglyBoogly)

Differential Revision: https://developer.blender.org/D11291
2021-06-16 22:38:47 +08:00
b37093de7b BLI: add C++ wrapper for task isolation
This makes it easier to use task isolation in c++ code.
Previously, one either had to check `WITH_TBB` (possibly indirectly
through `WITH_OPENVDB`) or one had to use the C function which
is less convenient.
2021-06-16 16:29:21 +02:00
45d59e0df5 BLI: add threading namespace
This namespace groups threading related functions/classes. This avoids
adding more threading related stuff to the blender namespace. Also it
makes naming a bit easier, e.g. the c++ version of BLI_task_isolate could
become blender::threading::isolate_task or something similar.

Differential Revision: https://developer.blender.org/D11624
2021-06-16 16:14:02 +02:00
0cebe554d1 ShaderFX operators: Tweak a bit poll functions, forbid in liboverride cases.
Similar to what we do for constraints and modifiers, except that
currently adding or editing shaderfx in liboverride objects is
completely unsuported.

Fix T88974.
2021-06-16 16:09:28 +02:00
af3d7123c9 ShaderFX/LibOverride: Add BKE_shaderfx_is_nonlocal_in_liboverride util.
Used to detect if a shaderfx is purely local, or comes from linked data,
in case of a liboverride.

Not actually used yet since we do not currently support adding
shaderfx's to overrides, but will be in the future, and matches
constraints and modifiers code.
2021-06-16 16:09:28 +02:00
3953b82030 Tweaks to Constraints operators poll functions.
Mainly:
* Make `ED_operator_object_active_editable_ex` properly report poll
  messages on failure.
* Add `ED_operator_object_active_local_editable_posemode_exclusive` for
  bone constraints requiring pure local Object (non-override one).
* General cleanup and adding more poll messages on failures.
2021-06-16 16:09:28 +02:00
88aa056d1a Fix: Image node alpha socket converted to operations twice
On selecting a multi-layer image with a combined pass, a "Combined"
socket is created and default combined pass socket "Image" is
disabled by setting `SOCK_UNAVAIL` flag. When converting into
operations, `ImageNode` converts alpha socket on finding any socket with
a combined pass without checking the flag.

Since commit rB93e2491ee724 an assertion fails when mapping sockets
twice because now map `add_new` is used.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11566
2021-06-16 14:04:24 +02:00
b66600b9f3 Compositor: Full frame Value node
Adds full frame implementation to Value node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11594
2021-06-16 14:02:08 +02:00
b406b6717f Compositor: Full frame RGB node
Adds full frame implementation to RGB node operation.
No functional changes.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11593
2021-06-16 14:00:05 +02:00
94084b2d3c Geometry Nodes: fix z-up spline normal calculation
Previously it didn't work when the tangents were collinear to the z axis.
2021-06-16 12:20:28 +02:00
00fc110d3f Alembic procedural: support reading per-vertex UV sets
This adds support for importing UV sets which are defined per vertex,
instead of per face corners. Such UV sets can be generated when the
mesh is split according to UV islands, or when there is only one UV
island, in which cases only a single UV value can be stored per
vertex since vertices will never be on a seam.
2021-06-16 09:39:39 +02:00
1c0a490d0e Cleanup: minor simplification to status allocation 2021-06-16 17:17:15 +10:00
c3fa7b7e4f Fix pose-mode statistics with multi-object editing
- Include all objects in pose mode.
- Show the number of objects in pose mode.
- Show the number of objects in edit mode for all types of objects
  (not just meshes).
2021-06-16 17:17:15 +10:00
4b36c5b1a7 Cleanup: sculpt mode checks when calculating stats
Sculpting dynamic topology used to code-path for counting object
then never used the result.

Match object mode checks in string access & drawing.
2021-06-16 17:17:15 +10:00
3385c04598 Alembic: support reading per-vertex UV sets
This adds support for importing UV sets which are defined per vertex,
instead of per face corners. Such UV sets can be generated when the
mesh is split according to UV islands, or when there is only one UV
island, in which cases only a single UV value can be stored per
vertex since vertices will never be on a seam.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11584
2021-06-16 08:22:10 +02:00
9fed00341e Cleanup: reduce warnings when compiling release builds. 2021-06-16 08:00:52 +02:00
Johnny Matthews
ed4b2ba75a Geometry Nodes: Separate Components Node
Implementation of T86970. This node takes a geometry input with
multiple components and outputs them by component type. Meshes,
Curves, and Point Clouds support combining multiple input instances,
while volumes will only output the first volume component input until
suitable instance realization for multiple volumes is finished.

When direct geometry instancing is implemented it will be possible to
avoid realizing instances in this node.

Differential Revision: https://developer.blender.org/D11577
2021-06-15 22:31:57 -05:00
2209321f78 Screen: simplify internal logic for new full-screen areas
Creating a new full screen area had it's area initialized as empty,
updating the screen then set the area to a 3D view (as a fallback),
before the actual area type was set.

This made setting the intended space-type run the 3D views exit callback
on a 3D view without a View3D struct allocated, which the exit callback
needed to account for.

Resolve by calling ED_screen_change after the area type has been set.
2021-06-16 12:50:00 +10:00
be8a201a16 Cleanup: unused warning 2021-06-16 12:29:44 +10:00
0b0c7ca017 Cleanup: Fix inconsistent parameter name warning 2021-06-15 21:11:18 -05:00
c8e331f450 UI - LOCAL View3D overlay stats
This patch improves the 3DView statistics overlay to show LOCAL stats
while in local view. This means the stats can vary between 3DViews and
the statusbar when views are in local view, but this gives a much more
accurate count of the objects, and their components, that you are
directly working with rather than just scene values.

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

Reviewed by Campbell Barton
2021-06-15 19:01:53 -07:00
4891da8ae2 Fix T88263: Incorrect image offset from old file
Versioning code for converting strip offset property doesn't work, when
property was animated and disabled or when crop was used.

When offset property is animated and offset is enabled, animation is
converted to be used with new transform design. When offset is disabled,
animation is left untouched. New transform design doesn't have option
to disable offset, and therefore old unconverted animation is used
instead of converted static value.

Remove animation from propery if it was unused.

Another issue was that both X and Y offset animation was being corrected
by factor caluclated for X channel.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11370
2021-06-16 00:44:37 +02:00
1a5fa2b319 VSE: Improve animation evaluation performance
Use lookup string callback function for `sequences_all` RNA property
`rna_SequenceEditor_sequences_all_lookup_string` using a GHash for faster lookups.

When names are changed or strips are added/removed the lookup is tagged invalid.
The next time the lookup is used it will rebuild it.

Reviewed By: sergey, jbakker

Differential Revision: https://developer.blender.org/D11544
2021-06-16 00:29:17 +02:00
143a81ccce Geometry Nodes: Allow int attribute input fields with single value
Just like the way we often have a choice between an attribute input and
a single float, this adds the ability to choose between attribute and
integer input sockets, useful for D11421.
2021-06-15 16:38:28 -05:00
c29afa5156 Cleanup: Expose function publicly, rename
There is no particular reason these two functions shouldn't be used
outside of the bezier spline implementation since they don't do anything
particularly controversial.
2021-06-15 16:31:08 -05:00
732e8c723e Splines: Add resize method to CurveEval
This helps when adding splines to a new curve in parallel.
2021-06-15 16:24:11 -05:00
Germano Cavalcante
6bb980b0f4 DRW: sanitize 'DRW_mesh_batch_cache_dirty_tag'
Create maps that specify which batches have vbo or ibo as a reference
and use these maps to discard batches along with buffers.

Differential Revision: https://developer.blender.org/D11588
2021-06-15 17:03:19 -03:00
8e84938dd0 Cleanup: Add files for version independent versioning helpers
Adds `source/blender/blendloader/intern/versioning_common.cc` and
`versioning_common.h` for version independent versioning functions.

I only placed `do_versions_add_region_if_not_found()` in there for now.
`blo_do_version_old_trackto_to_constraints()` could also be added, but
that's so old, I prefer keeping that in `versioning_legacy.c`.
2021-06-15 19:33:00 +02:00
a4f840e15b UI: Support right aligned non-shortcut hints in widgets
Widget drawing code already supported drawing right-aligned, grayed out
shortcut strings. This patch generalizes things a bit so this can also
be used to draw other hints in the same way. There have been a few
instances in the past where this would've been useful, D11046 being the
latest one.

Note that besides some manual regression testing, I didn't check if this
works yet, as there is no code actually using it (other than the
shortcuts). Can be checked as part of further development for D11046.

A possible further improvement would be providing a way to define how
clipping should be done. E.g. sometimes the right-aligned text should be
clipped first (because it's just a hint), in other cases it should be
left untouched (like current code explicitly does it for shortcuts).

Removes the `UI_BUT_HAS_SHORTCUT` flag, which isn't needed anymore.
2021-06-15 19:13:09 +02:00
fcc844f8fb BLI: use explicit task isolation, no longer part of parallel operations
After looking into task isolation issues with Sergey, we couldn't find the
reason behind the deadlocks that we are getting in T87938 and a Sprite Fright
file involving motion blur renders.

There is no apparent place where we adding or waiting on tasks in a task group
from different isolation regions, which is what is known to cause problems. Yet
it still hangs. Either we do not understand some limitation of TBB isolation,
or there is a bug in TBB, but we could not figure it out.

Instead the idea is to use isolation only where we know we need it: when
holding a mutex lock and then doing some multithreaded operation within that
locked region. Three places where we do this now:
* Generated images
* Cached BVH tree building
* OpenVDB lazy grid loading

Compared to the more automatic approach previously used, there is the downside
that it is easy to miss places where we need isolation. Yet doing it more
automatically is also causing unexpected issue and bugs that we found no
solution for, so this seems better.

Patch implemented by Sergey and me.

Differential Revision: https://developer.blender.org/D11603
2021-06-15 17:28:44 +02:00
Germano Cavalcante
b3f0dc2907 Draw Cache: avoid recalculating 'poly_normals'
Call `BKE_mesh_ensure_normals_for_display` to avoid recalculating
poly_normals.

**Benchmark**
||master:|PATCH:
|---|---|---|
|looptris_test:|Average: 3.995076 FPS|Average: 4.047470 FPS
||rdata 11ms iter 91ms (frame 235ms)|rdata 11ms iter 86ms (frame 233ms)
|subdiv_mesh_cage_and_final:|Average: 1.884492 FPS|Average: 1.900114 FPS
||rdata 7ms iter 42ms (frame 268ms)|rdata 7ms iter 39ms (frame 265ms)
||rdata 7ms iter 44ms (frame 259ms)|rdata 7ms iter 42ms (frame 257ms)
|subdiv_mesh_final_only:|Average: 6.245944 FPS|Average: 6.289000 FPS
||rdata 3ms iter 23ms (frame 153ms)|rdata 3ms iter 21ms (frame 154ms)
|subdiv_mesh_final_only_ledge:|Average: 6.263482 FPS|Average: 6.187218 FPS
||rdata 3ms iter 23ms (frame 156ms)|rdata 3ms iter 22ms (frame 154ms)

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11527
2021-06-15 11:45:39 -03:00
71997921c4 Cleanup: use back-slash for doxygen comments 2021-06-16 00:08:34 +10:00
0c75a98561 CMake: disable TBB when not found 2021-06-16 00:08:34 +10:00
Jeroen Bakker
174ed69c1b DrawManager: Cache material offsets.
When using multiple materials in a single mesh the most time is spend in
counting the offsets of each material for the sorting.

This patch moves the counting of the offsets to render mesh data and
caches it as long as the geometry doesn't change.

This patch doesn't include multithreading of this code.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11612
2021-06-15 15:31:34 +02:00
7c8b9c7a9a Fix warning treated as an error
"void' function returning a value".
2021-06-15 09:57:57 -03:00
62906cdbea Cleanup: Added hierarchy in MeshBufferExtractionCache. 2021-06-15 12:34:13 +02:00
7f570a7174 Cleanup: Split mesh_render_data_loose_geom into multiple functions. 2021-06-15 11:39:36 +02:00
9cd2e80d5d Fix: wrong size check
This fixes a bad mistake by myself. Thanks Lukas Tönne for telling me.
2021-06-15 10:26:31 +02:00
462bd81399 Fix: Sequencer backdrop not updated during playback.
Caused by recent optimization in {7b76a160a4}.
2021-06-15 09:31:03 +02:00
819152527f BMesh: assert that face normals have been updated for tessellation
This catches missing normal updates that may cause invalid tessellation.
2021-06-15 14:54:34 +10:00
89e2b441ed Cleanup: remove return value from face normal calculation
This value is always 'sides - 2', no need to return this value.
2021-06-15 14:38:10 +10:00
ae34808114 Fix missing normal update in edit-mesh blend-from shape operator 2021-06-15 14:35:43 +10:00
fdad77d73d BMesh: use faster normal update method for edit-mesh coordinates
This wasn't included in the previous fix so it'd be 2.93 compatible.
2021-06-15 13:52:00 +10:00
0a361eb5ec Fix outdated face tessellation use when editing edit-mesh coodinates 2021-06-15 13:31:33 +10:00
2ba804d7b7 Screen: clear runtime structures on file-read & data-copy
Clear the runtime data structs instead of individual members,
this simplifies adding new runtime members as there are at least
two places they would need to be cleared.

Resolves error in D8883.
2021-06-15 12:52:59 +10:00
5dc0fd08a7 Cleanup: correct incomplete comment 2021-06-15 10:59:57 +10:00
2053e1f533 Fix image space missing mask display panel 2021-06-15 10:50:48 +10:00
4ae06b6123 Cleanup: remove "_" prefix for used arguments 2021-06-15 10:50:43 +10:00
013fc69ea8 Cleanup: unused argument & variable warnings 2021-06-15 10:50:43 +10:00
3bf98d1cec Cleanup: use private methods for internal operator utilities
Also remove unused argument.
2021-06-15 10:08:57 +10:00
9ce49af32e Cleanup: use doxygen comments for DNA_color_types
Also use enum instead of defines for Scopes.wavefrm_mode
2021-06-15 09:34:58 +10:00
1f251b7a27 Win8 cleanup, remove dead function pointer and macro. 2021-06-14 14:41:58 -07:00
61fdc45034 Geometry Nodes: Join dynamic curve attributes in the join geometry node
This commit lets the join geometry node transfer dynamic attributes
to the result, the same way that point cloud and mesh attributes are
joined. The implementation is different though, because of an
optimization implemented for curves to avoid copying splines.

The result attribute is added with the highest priority domain (points
over splines), and the highest complexity data type. If one curve had
the attribute on the spline domain but not others, the point domain
values will be used.

Generally this is a bit lower level than I would have liked this code
to be, but should be efficient, and it's really not too complicated.

Differential Revision: https://developer.blender.org/D11491
2021-06-14 15:13:43 -05:00
bf7f918a0e Geometry Nodes: Parallelize curve reverse node
Each spline can be handled separately here. This gives approximately a
2x speedup on my 8 core processor on an input of 80000 2 point splines.
2021-06-14 14:28:57 -05:00
fe0fa7cec6 Cleanup: Refactor join geometry node attribute gathering
Instead of building a set and then determining the final domain and
type for every attribute separately in the loop, construct a map with
the necessary data in the first place. This is simpler and should be
slightly more efficient.

Split from D11491
2021-06-14 13:58:11 -05:00
Johnny Matthews
4a540b9b48 Geometry Nodes: Curve Reverse Node
This is an implementation of T88722. It accepts a curve object and
for each spline, reverses the order of the points and all attributes.
This is more of a foundational node to support other nodes in the
future (like curve deform)

Selection takes spline domain attributes to determine which splines
are selected. If no selection is present all splines are reversed.

Differential Revision: https://developer.blender.org/D11538
2021-06-14 13:28:38 -05:00
fcbb20286a Geometry Nodes: Curve to Points Node for Evaluated Data
This node implements the second option of T87429, creating points
along the input splines with the necessary evaluated information
for instancing: `tangent`, `normal`, and `rotation` attributes.
All generic curve point and spline attributes are copied to the
result points as well.

The "Count" and "Length" methods are just like the current options
in the resample node, but the output is points instead of a curve.
The "Evaluated" method uses the points you see on the curve directly,
and therefore should be the fastest.

The rotation data is retrieved from a transform matrix built with the
same method that the curve to mesh node uses. The radius attribute is
divided by 10 so the points don't look absurdly huge in the viewport.
In the future that could be an option.

For the implementation, one thing that could use an improvement
is the amount of temporary allocations while resampling to evaluated
points before the final points. I expect that reusing a buffer for
each thread would give a nice improvement.

Differential Revision: https://developer.blender.org/D11539
2021-06-14 12:52:08 -05:00
d08e925ef1 Fix Build Warning
Marking unused function argument.

Introduced in bcff0ef9ca

Differential Revision: https://developer.blender.org/D10887
2021-06-14 10:42:28 -07:00
bcff0ef9ca UI: Windows Blend File Association
This patch allows Windows users to specify that their current blender
installation should be used to create thumbnails and be associated
with ".blend" files. This is done from Preferences / System. The only
way to do this currently is from the command-line and this is sometimes
inconvenient.

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

Reviewed by Brecht Van Lommel
2021-06-14 10:22:03 -07:00
2e5671a959 Fix: VSE seeking with proxy strips would fail on certain frames
If the last decoded frame had the same timestamp as the GOP current
packet, then we would skip over this frame when fast forwarding and we
would seek until the end of the file.

This would could only be triggered reliably in single threaded mode.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11601
2021-06-14 19:08:51 +02:00
aadd355028 Fix possible C-linkage warning on Clang
The warning would appear when using the `ENUM_OPERATORS()` macro inside
of an `extern "C"` block.
Didn't cause a warning in master currently, but in the
`asset-browser-poselib` branch.

After macro expansion, there would be C++ code in code with C linkage
(`extern "C"`). So make sure the expanded C++ code always uses C++
linkage.
The syntax used is totally C++ compliant: the C++ standard requires that
in such nested linkage specifications, the innermost one determines the
linking language (e.g. see
https://timsong-cpp.github.io/cppwp/n4659/dcl.link#4).
2021-06-14 19:00:13 +02:00
3de6fe0b3e Error Messages Creating Thumbnail Folders
On the Windows platform there will be some errors printed to the
console if the user's thumbnail cache folder doesn't already exist.
While creating those folders there is an attempt to do so multiple
times and so we get errors when trying to create when exists. This
is caused by paths that have hard-coded forward slashes, which causes
our path processing routines to not work correctly. This patch defines
those paths using platform-varying separator characters.

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

Reviewed by Brecht Van Lommel
2021-06-14 09:17:27 -07:00
e9b4de43d8 Cleanup: rename id to owner_id for python id properties
This is consistent with the naming in `PointerRNA`.
2021-06-14 18:13:27 +02:00
90b0fb135f PyAPI: remove deprecated bpy.app.binary_path_python 2021-06-14 23:52:08 +10:00
8a1860bd9a BMesh: support face-normal calculation in normal & looptri functions
Support calculating face normals when tessellating. When this is done
before updating vertex normals it gives ~20% performance improvement.

Now vertex normal calculation only needs to perform a single pass on the
mesh vertices when called after tessellation.

Extended versions of normal & looptri update functions have been added:

- BM_mesh_calc_tessellation_ex
- BM_mesh_normals_update_ex

Most callers don't need to be aware of this detail by using:

- BKE_editmesh_looptri_and_normals_calc
- BKE_editmesh_looptri_and_normals_calc_with_partial

- EDBM_update also takes advantage of this,
  where calling EDBM_update with calc_looptri & calc_normals
  enabled uses the faster normal updating logic.
2021-06-14 23:01:19 +10:00
6bef255904 BMesh: remove unit-length edge-vector cache from normal calculation
Bypass stored edge-vectors for ~16% performance gains.

While this increases unit-length edge-vector calculations by around ~4x
the overhead of a parallel loop over all edges makes it worthwhile.

Note that caching edge-vectors per-vertex performs better and may be
worth investigating further, although in my tests this increases code
complexity with barley measurable benefits over not using cache at all.

Details about performance and possible optimizations are noted in
bm_vert_calc_normals_impl.
2021-06-14 22:56:02 +10:00
8083527f90 Edit Mesh: use params arg for update function, add calc_normals arg
Rename function EDBM_update_generic to EDBM_update, use a parameters
argument for better readability.

Also add calc_normals argument, which will have benefits when
calculating normals and tessellation together is optimized.
2021-06-14 22:56:01 +10:00
1d2eb461b5 Cleanup: clang-format 2021-06-14 22:56:00 +10:00
Thomas Lachmann
b84707df17 Python API: option for render engines to disable image file saving
For some custom rendering engines it's advantageous not to write the image files to disk.
An example would be a network rendering engine which does it's own image writing.

This feature is only supported when bl_use_postprocess is also disabled, since render
engines can't influence the saving behavior of the sequencer or compositor.

Differential Revision: https://developer.blender.org/D11512
2021-06-14 14:20:04 +02:00
ada47c4772 Fix build error in release builds after recent changes 2021-06-14 13:22:11 +02:00
748475b943 BLI_math: Cleanup: Use mul_/madd_ functions.
Better to avoid explicit vectors components direct manipulation when a
generic operation for whole vector exists, if nothing else it avoids
potential mistakes in indices.
2021-06-14 12:32:38 +02:00
b21db5e698 BLI_math: Fix several division-by-zero cases.
Those were caused by various tools used on degenerate geometry, see
T79775.

Note that fixes are as low-level as possible, to ensure they cover as
much as possible of unreported issues too.

We still probably have many more of those hidden in BLI_math though.
2021-06-14 12:32:38 +02:00
Leon Zandman
5add6f2ed9 Fix T87867: file open dialog triggers OneDrive file downloads on macOS
Until OneDrive supports macOS's native placeholder file implementation, detect
the com.microsoft.OneDrive.RecallOnOpen extended file attribute.

Differential Revision: https://developer.blender.org/D11466
2021-06-14 12:26:07 +02:00
c9dc55301c Fix T88494: add missing depsgraph relation update tags
Adding e.g. a Collection Info node creates a new depsgraph relation.
Therefore the relations should be updated.
2021-06-14 11:35:36 +02:00
a19c9e9351 Fix T88947: invalid normals when converting point cloud to mesh 2021-06-14 11:07:42 +02:00
Campbell Barton
2db09f67a4 Nodes: remove redundant increment node tree current socket index
`ntree->cur_index` was being incremented twice in make_socket_interface.

Reviewed By: JacquesLucke

Ref D11590
2021-06-14 18:46:39 +10:00
03544ed54f Fix T88807: crash when there are multiple links between the same sockets
This commit does two things:

* Disallows creating more than one link from one socket to a multi socket input.
* Properly count links if there happen to be more than one link between the same sockets.

The new link counting should also be more efficient asymptotically.

Differential Revision: https://developer.blender.org/D11570
2021-06-14 10:04:52 +02:00
54a03d4247 Cleanup: Reduce indentation from redundant check 2021-06-13 18:56:52 -05:00
84adc23941 Cleanup: Order return argument last 2021-06-13 18:22:31 -05:00
0f68e5c30a Fix libmv new[]/delete[] mismatch 2021-06-13 15:13:08 +10:00
5181bc46b3 Cleanup: allocation size mismatch warning
While harmless, use fixed size int type for pixel data.
2021-06-13 14:54:54 +10:00
452590571c Cleanup: rename 'unsigned int' -> 'uint' 2021-06-13 14:54:54 +10:00
ab38223047 Cleanup: redundant initialization
These were limited to obvious cases. Some less obvious cases
were kept as refactoring might make them necessary in future.
2021-06-13 14:54:54 +10:00
f731bce6cd Cleanup: use ATTR_RETURNS_NONNULL function attribute 2021-06-13 14:47:19 +10:00
4c3bb60d0f Cleanup: use return arg prefix for ED_object_add_generic_get_opts 2021-06-13 14:47:18 +10:00
9ff4e0068f Cleanup: avoid the possibility of 'enter_editmode' being left unset
While in practice this isn't an issue currently, always set
'enter_editmode' in ED_object_add_generic_get_opts
to avoid problems in the future.
2021-06-13 14:47:07 +10:00
84e98ba182 Cleanup: misleading return argument for hair_create_input_mesh
- The argument with named with an `r_` prefix when it was in fact
  also read from.
- The argument passed in had to be 'psys->clmd->hairdata',
  if it was not - the function would not worked.
2021-06-13 14:47:04 +10:00
8e58f93215 Cleanup: remove redundant NULL check, reduce scope 2021-06-13 14:47:03 +10:00
aab4794512 Cleanup: missing include 2021-06-13 14:47:01 +10:00
952d6663e0 Fix modifier deform by armature check ignoring virtual modifiers
Regression in f00cb93dbe (fix for T63125)
2021-06-13 14:46:59 +10:00
7b0c8097a7 Fix missing directory in CMakeLists.txt 2021-06-12 00:00:29 -03:00
b313525c1b Fix T88515: Cycles does not update light transform from linked collections
When moving a linked collection, we seem to only receive a depsgraph update
for an empty object so the Blender synchronization cannot discriminate it
and tag the object(s) (light or geometry) for an update through
id_map.set_recalc.

This missing transform update only affects lights since we do not check
manually if the transformations were modified like we do for objects.

To fix this, add a check to see if the transformation is different provided
that a light was already created.

Reviewed By: brecht

Maniphest Tasks: T88515

Differential Revision: https://developer.blender.org/D11574
2021-06-12 04:13:43 +02:00
d75e45d10c Fix T88812: Child Windows on Vertical Monitors
This patch improves the positioning of child windows when on monitors
that are arranged vertically (any above any other). When calculating a
window position in Ghost coordinates from GL coordinates we were using
monitor height, which can give incorrect values when desktop is taller
than any single monitor. So use desktop height instead.

See D10637 for more details and examples.

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

Reviewed by Brecht Van Lommel
2021-06-11 14:39:19 -07:00
bd87ba90e6 Render Window as Non-Child on Win32 platform
This patch makes the "Render" window a top-level window, not a child of
the main window, which was the case in blender versions prior to 2.93.
This means it is no longer "on top", nor is the icon grouped on the
taskbar in the same way, but you can Alt-Tab between it and the main
window. This change only affects the Windows platform as the other
platforms behave this way.

See D11576 for links to negative feedback that prompts this change.

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

Reviewed by Brecht Van Lommel
2021-06-11 13:07:30 -07:00
Pablo Dobarro
7bc5246156 Overlays: Make flash on mode transfer an operator property
This moves the flash on mode transfer effect option from the overlays to
an operator property of the mode transfer operator.

- This effect is intended to show the target object when no overlays or
a minimal set of overlays is enabled. Making it part of the whole set of
overlays invalidates this use case.

- The effect is not intended to be configurable per viewport, it should
be a global option.

The effect is still implemented using the overlay engine (instead of a
draw modal callback) due to performance and drawing artifacts. Having it
implemented as an overlay with runtime timer data in the objects makes
also possible to run multiple animations at the same time without any
visual glitches.

Reviewed By: campbellbarton, JulienKaspar

Differential Revision: https://developer.blender.org/D11519
2021-06-11 21:48:59 +02:00
f6c5af3d47 Add option to link assets on drag & drop
Note: Linking in this case as in link vs. append. Easily confused with linking
a data-block to multiple usages (e.g. single material used by multiple
objects).

Adds a drop-down to the Asset Browser header to choose between Link and Append.
This is probably gonna be a temporary place, T54642 shows where this could be
placed eventually.

Linking support is crucial for usage of the asset browser in production
environments. It just wasn't enabled yet because a) the asset project currently
focuses on single user, not production assets, and b) because there were many
unkowns still for the workflow that have big impact on production use as well.
With the recently held asset workshop I'm more confident with enabling linking,
as design ideas relevant to production use were confirmed.

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

Reviewed by: Bastien Montagne
2021-06-11 16:46:20 +02:00
c8fcea0c33 Fix object assets getting duplicated after dropping
The operator run when dropping objects would duplicate the dropped object and
place that in the scene, even though that was just appended. Addressed by
making the duplication optional for the operator. If the duplication is not
requested, the object is just added to the scene (if needed), repositioned
based on the drop location and selected (deselecting other objects).
This makes the operator work as expected when using it to drop assets.

Reviewed as part of https://developer.blender.org/D11536.

Reviewed by: Bastien Montagne
2021-06-11 16:46:20 +02:00
20ece8736f Fix T89001: node search not working anymore 2021-06-11 16:27:56 +02:00
Maxime Casas
b4adb85933 Fix T89033: segfault reordering animation channels
Fix segmentation fault that can occur when reordering animation
channels.

Under some specific conditions, the list "act->curves" is empty in the
"join_groups_action_temp" function. In particular, this happens when a
scene contains an action that has not been pushed down, and with no
keyframe in it.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11569
2021-06-11 16:27:04 +02:00
605ce623be Nodes: cache socket identifier to index mapping
While this preprocessing does take some time upfront,
it avoids longer lookup later on, especially as nodes get
more sockets.

It's probably possible to make this more efficient in some cases
but this is good enough for now.
2021-06-11 16:21:23 +02:00
Jeroen Bakker
7b30a3e98d Performance: Use parallel range for ImBuf scanline processor.
Scanline processor did its own heurestic what didn't scale well when
having a multiple cores. In stead of using our own code this patch will
leave it to TBB to determine how to split the scanlines over the
available threads.

Performance of the IMB_transform before this change was 0.002123s, with
this change 0.001601s. This change increases performance in other areas
as well including color management conversions.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D11578
2021-06-11 15:55:22 +02:00
Jeroen Bakker
7b76a160a4 Sequencer: Do not redraw during playback.
When using large sequences including audio the drawing of the audio on
top of the strip takes a lot of time. This effects the playback
performance heavily.

During the animation playback performance there was a solution for this
by only drawing the playhead overlay. This was reverted for the sequence
editor as it didn't update the color strips when they were animated.

This patch checks if there are animated color strips if so the full
screen is redrawn, otherwise only the playhead is redrawn.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D11580
2021-06-11 15:51:26 +02:00
0eb9351296 Refactor: use 'BLI_task_parallel_range' in Draw Cache
One drawback to trying to predict the number of threads that will be
used in the `task_graph` is that we are only sure of the number when the
threads are running.

Using `BLI_task_parallel_range` allows the driver to
choose the best thread distribution through `parallel_reduce`.

The benefit is most evident on hardware with fewer cores.

This is the result on an 4-core laptop:
||before:|after:
|---|---|---|
|large_mesh_editing:|Average: 5.203638 FPS|Average: 5.398925 FPS
||rdata 15ms iter 43ms (frame 193ms)|rdata 14ms iter 36ms (frame 187ms)

Differential Revision: https://developer.blender.org/D11558
2021-06-11 10:49:50 -03:00
Germano Cavalcante
2330cec2c6 Refactor: Draw Cache: use 'BLI_task_parallel_range'
This is an adaptation of {D11488}.

A disadvantage of manually setting the iter ranges per thread is that
we don't know how many threads are running in the background and so we
don't know how to best distribute the ranges.

To solve this limitation we can use `parallel_reduce` and thus let the
driver choose the best distribution of ranges among the threads.

This proved to be especially beneficial for computers with few cores.

**Benchmarking:**
Here's the result on an 4-core laptop:
||master:|PATCH:
|---|---|---|
|large_mesh_editing:|Average: 5.203638 FPS|Average: 5.398925 FPS
||rdata 15ms iter 43ms (frame 193ms)|rdata 14ms iter 36ms (frame 187ms)

Here's the result on an 8-core PC:
||master:|PATCH:
|---|---|---|
|large_mesh_editing:|Average: 15.267482 FPS|Average: 15.906881 FPS
||rdata 9ms iter 28ms (frame 65ms)|rdata 9ms iter 25ms (frame 63ms)
|large_mesh_editing_ledge: |Average: 15.145966 FPS|Average: 15.520474 FPS
||rdata 9ms iter 29ms (frame 65ms)|rdata 9ms iter 25ms (frame 64ms)
|looptris_test:|Average: 4.001917 FPS|Average: 4.061105 FPS
||rdata 12ms iter 90ms (frame 236ms)|rdata 12ms iter 87ms (frame 230ms)
|subdiv_mesh_cage_and_final:|Average: 1.917769 FPS|Average: 1.971790 FPS
||rdata 7ms iter 37ms (frame 261ms)|rdata 7ms iter 31ms (frame 258ms)
||rdata 7ms iter 38ms (frame 252ms)|rdata 7ms iter 33ms (frame 249ms)
|subdiv_mesh_final_only:|Average: 6.387240 FPS|Average: 6.591251 FPS
||rdata 3ms iter 25ms (frame 151ms)|rdata 3ms iter 16ms (frame 145ms)
|subdiv_mesh_final_only_ledge:|Average: 6.247393 FPS|Average: 6.596024 FPS
||rdata 3ms iter 26ms (frame 158ms)|rdata 3ms iter 16ms (frame 148ms)

**Notes:**
- The improvement can only be noticed if all extracts are multithreaded.
- This patch touches different areas of the code, so it can be split into another patch if the idea is accepted.

These screenshots show how threads behave in a quadcore:
Master:
{F10164664}
Patch:
{F10164666}

Differential Revision: https://developer.blender.org/D11558
2021-06-11 10:45:12 -03:00
fe22635bf6 Nodes: add utilities to check if there are undefined nodes/sockets 2021-06-11 14:55:10 +02:00
c0367b19e2 Fix: VSE search in mpegts files would fail
ffmpeg_generic_seek_workaround did work properly and our start pts
calculation was wrong.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11562
2021-06-11 14:05:07 +02:00
4adbe31e2f Fix: VSE indexer seeking not working correctly
Because of the added sanity checks in rB14508ef100c9 (D11492), seeking
in proxies would not work correctly any more. This is because it wasn't
working as intended before, but in most cases this wouldn't be
noticeable. However now when the sanity checks are tripped it is very
noticeable that something is wrong

The indexer tried to use dts values for time stamps when we used pts in
our decode functions to get the time positions. This would make it
start in the wrong GOP frames when searching. Now that we enforce no
crossing of GOP frames when decoding after seek, this would lead to
issues.

Now we correctly use pts (or dts if pts is not available) and thus we
don't have any seeking issues because of time stamp format missmatch.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11561
2021-06-11 14:04:48 +02:00
1fb2eaf1c5 Fix: VSE timecodes being used even when turned off.
Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11567
2021-06-11 14:04:35 +02:00
2f280d4b92 LineArt: Fix crash due to empty duplicollection. 2021-06-11 17:55:33 +08:00
e9c8ae767a Performance: Split ImBuf sampling.
When sampling ImBuf can be a char or a float buffer. Current sampling
functions added overhead by checking which kind of buffer was passed
every pixel that was sampled. When performing image processing this
check can be removed outside the inner loop adding 5% of performance
increase in the `IMB_transform` operator.
2021-06-11 11:37:39 +02:00
Xing Liu
7fc220517f Fix T88068: Alt+I now respects keying set
Remap {key Alt I} from `anim.delete_key_v3d` to `anim.delete_key`. This
makes it keyframe removal symmetrical with keyframe insertion ({key I}).

Both the default keymap {key Alt I} and the Industry Compatible keymap
{key Alt S} have been updated.

Reviewed By: sybren, #animation_rigging

Maniphest Tasks: T88068

Differential Revision: https://developer.blender.org/D11528
2021-06-11 11:13:20 +02:00
Jeroen Bakker
28617bb167 Sequencer: Transform ImBuf Processor.
Inside the sequencer the cropping and transform of images/buffers were
implemented locally. This reduced the optimizations that a compiler
could do and added confusing code styles. This patch adds
`IMB_transform` to reduce the confusion and increases compiler
optimizations as more code can be inlined and we can keep track of
indices inside the inner loop.

This increases end-user performance by 30% when playing back aa video
in VSE.

Reviewed By: ISS, zeddb

Differential Revision: https://developer.blender.org/D11549
2021-06-11 09:34:44 +02:00
84f025c6fd Cleanup: use sentences for pose slide comments 2021-06-11 16:27:55 +10:00
Christoph Lendenfeld
066f5a4469 Cleanup: pose slider rename region to region_header
Reviewed By: sybren, campbellbarton

Ref D11365
2021-06-11 15:53:34 +10:00
Christoph Lendenfeld
d07cc5e680 Cleanup: pose slider use enum types
use enum types in `tPoseSlideOp` instead of `short`

Reviewed By: sybren, campbellbarton

Ref D11364
2021-06-11 15:40:07 +10:00
Christoph Lendenfeld
162cf8e81d Cleanup: pose slider use strncpy
use `STRNCPY` instead of `BLI_strncpy`

Reviewed By: sybren, campbellbarton

Ref D11363
2021-06-11 15:38:27 +10:00
Christoph Lendenfeld
fd5c94c48a Cleanup: pose slider data types
- change vec2f to float[2]
- pass rctf as pointer
- change `const struct rctf` to `const rctf`
2021-06-11 15:36:41 +10:00
Christoph Lendenfeld
2724d08cf5 Cleanup: pose slider rename "percentage" to "factor"
This patch changes occurrences of percentage to factor.

There are some usages of percentage left in there on purpose.
They are distinguished as follows:

- factor is 0-1 float
- percentage is 0-100 int

Ref D11361

Reviewed by: sybren, campbellbarton
2021-06-11 15:29:52 +10:00
Charlie Jolly
461ba4438f Nodes: move mix rgb node to C++
Prepare node for conversion to Geometry Nodes.

There should be no functional changes.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11506
2021-06-11 00:01:13 +01:00
d581c1b304 UI: Correct label naming mistake for VSE text strip box background
Seems to be a copy/paste error from 
rB235c309e5f86e84fb08e1ff2c5c11eb0b775c388
2021-06-10 17:45:16 -04:00
e8a4bddef4 deps/windows: add missing tbbmalloc_debug.lib
This file is being linked by blender without
it existing causing issues for debug builds.
2021-06-10 12:03:12 -06:00
fbd889ec28 Fix T86544: better cleanup of path given as command line argument.
When using non-default system separator in filename path, code would end up
with an absolute path mixing regular and alternative separator,
confusing the rest of the path manipulations later on.

So this commit add proper replacements of alternative separators, and
path normalization.
2021-06-10 18:37:46 +02:00
509e0c5b76 Cleanup: BLI_path_slash_native: use separator defines instead of literal values.
Even though this function is alredy using system-specific code, it's
still cleaner to use `SEP` and `ALTSEP` here.
2021-06-10 18:35:35 +02:00
7b62a54230 Fix T88578: crash when loading value from group output node
It remembered the wrong origin socket and couldn't find the value
anymore later on.
2021-06-10 17:24:53 +02:00
Eitan
53c98e45cf Geometry Nodes: Add Texture and Material options to switch node
These new socket types can be supported in the switch node
along with the others.

Differential Revision: https://developer.blender.org/D11560
2021-06-10 10:16:37 -05:00
bcefce33f2 BLI_mempool: split thread-safe iteration into the private API
Splitting out thread safe iteration logic means regular iteration
isn't checking for the thread-safe pointer each step.

This gives a small but measurable overall performance gain of 2-3%
when redrawing a high-poly mesh.

Ref D11564

Reviewed By: mont29
2021-06-11 00:31:16 +10:00
9df1e0cad5 Fix: Build error with MSVC
rB4f81b4b4ce29 mistakenly left out the changes
to platform_win32.cmake causing a linker error
when WITH_GMP and WITH_TBB_MALLOC_PROXY were on.
2021-06-10 06:50:05 -06:00
aa0bd29546 Docs: remove deprecated parameter from bmesh docs
The perimeter itself was removed but the documentation wasn't updated.

Resolves T89013
2021-06-10 21:32:30 +10:00
1a72ee4cbe Cleanup: move endian values from BKE_global into BLI_endian_defines
This change was prompted by D6408 which moves thumbnail extraction into
a shared function that happens use these endian defines but only links
blenlib.

There is no need for these defines to be associated with globals
so move into their own header.
2021-06-10 21:10:28 +10:00
e4ef8cbf7e Cleanup: add comment 2021-06-10 13:05:57 +02:00
5fa6cdb77a Add unit for time stored in seconds
Allows to define properties which will have proper units displayed
in the interface. The internal storage is expected to be seconds
(which matches how other times are stored in Blender).

Is not immediately used in Blender, but is required for the upcoming
feature in Cycles X (D11526)

The naming does not sound very exciting, but can't think of anything
better either.

For test it probably easiest to define FloatProperty with subdtype
of TIME_ABSOLUTE.

Differential Revision: https://developer.blender.org/D11532
2021-06-10 12:15:59 +02:00
5304c6ed7d DataTransfer: Fix vertices being wrongly added to vgroup.
Previously, a vertex from destination mesh would always be added to all
transferred vgroup (with a 0.0 weight), even if none of its matching
sources in source mesh belonged to the matching source vgroups.

Now a destination vertex is only added to a given destination vgroup if
at least one of its source vertices belong to the matching source
vgroup.

Issue found and initial investigation by @pls in D11524, thanks!
2021-06-10 11:33:53 +02:00
b669fd376a Cleanup: spelling in comments 2021-06-10 17:04:25 +10:00
4d4608363c Cleanup: quiet array-parameter warning from GCC11 2021-06-10 16:51:09 +10:00
7141eb75ef Docs: update oxygen configuration to v1.9.1 2021-06-10 16:34:58 +10:00
b282a065f1 Docs: Add preprocessor define for doxygen
Doxygen by default leaves out any functions inside
#ifdef blocks that it thinks are disabled.

This change adds a DOXYGEN symbol, so you can
still get the functions included in the
documentation even if the #ifdef would
have normally excluded them.

before

#if defined(_WIN32)

after

#if defined(_WIN32) || defined(DOXYGEN)

Patch provided by Campbell Barton on chat.
2021-06-09 18:44:39 -06:00
Erik Abrahamsson
4f81b4b4ce Windows: Use TBBMalloc for GMP
TBBmalloc_proxy already takes care of any allocations
being done from MSVC compiled code, some of the dependencies
like GMP cannot be build with MSVC and we have to use
mingw to build them. mingw however links against the older
msvcrt.dll for its allocation needs, which TBBMallocProxy
does not hook.

GMP has an option to supply your own allocation functions
so we can still manually redirect them to TBBMalloc.

In a test-file with a boolean geometry node, this patch
uses 32s effective CPU time compared to 52s before.

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

Reviewed by Campbell Barton, Ray Molenkamp
2021-06-09 18:34:17 -06:00
a3226bdf3e Fix: Point translate and point scale don't execute on curve data 2021-06-09 16:51:07 -05:00
Christoph Lendenfeld
d96e9de9de Fix T88546: Pose slider typed input not working
Remove an unnecessary call to pose_slide_mouse_update_percentage
That call was overriding the typed value

Reviewed By: #animation_rigging, Sybren A. Stüvel

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

Ref D11395
2021-06-09 22:31:10 +01:00
93fd07e19c Geometry Nodes: Copy spline attributes in the curve resample node
Previously only point domain attributes were copied to the result curve.
2021-06-09 15:54:26 -05:00
5f19646d7e Fix T88799: 3DViewport Stats Column Measurements
To draw the overlay stats in columns the strings must be measured to
find the longest one. In some circumstances this measurement can be
incorrect. We draw the text with a specific size yet do not explicitly
set the size before calling BLF_size. This patch properly sets the size
so that the measurement will match what will be used for output.

See T88799 for examples of measurement failure.

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

Reviewed by Hans Goudey
2021-06-09 13:39:08 -07:00
675677ec67 Splines: Add API functions for interpolating data
First, expand on the interpolation to evaluated points with a templated
helper function, and a function that takes a GSPan. Next, add a set of
functions to `Spline` for interpolating at arbitrary intervals between
the evaluated points. The code for doing that isn't that complicated
anyway, but it's nice to avoid repeating, and it might make it easier
to unroll the special cases for the first and last points if we require
the index factors to be sorted.
2021-06-09 14:53:39 -05:00
Henrik Dick
df2a19eac7 Geometry Nodes: Add Convex Hull Node
This commit adds a node to output the convex hull of any input geometry
as a mesh, which is an enclosing geometry around a set of points.
All geometry types are supported, besides volumes.

The code supports operating on instances to avoid copying all input
geometry before the operation. The implementation uses the same backend
as the operation in edit mode, but uses Mesh directly instead of BMesh.

Attribute transfer is not supported currently, but would be a point of
improvement for the future if it can work in a predictable way on
different geometry input types.

Differential Revision: https://developer.blender.org/D10925
2021-06-09 11:58:08 -05:00
2856f3b583 Fix T88974: Add missing liboverrides to GP modifiers and shaderfx.
Proper RNA code was simply never added for those...
2021-06-09 18:48:55 +02:00
965bd53e02 Cleanup: use doxy sections for task_iterator.c 2021-06-10 02:22:46 +10:00
05f15645ec Cleanup: missing NULL check in assert 2021-06-10 02:22:46 +10:00
cb0cab48ef Cleanup: redundant/unused assignments 2021-06-10 02:22:46 +10:00
029fb002dd Cleanup: replace 'else if' with 'else' 2021-06-10 02:22:46 +10:00
4443c4082e Cleanup: remove redundant checks which have already been tested
Note that these changes are limited simple cases as these kinds of
changes could allow for errors when refactoring code when the known
state is not so obvious.
2021-06-10 02:22:45 +10:00
bda8887e0c Cleanup: simplify grease pencil preset set logic 2021-06-10 02:22:45 +10:00
5575aba025 Cleanup: simplify grease pencil type checks 2021-06-10 02:22:45 +10:00
25d8ce16b5 Cleanup: spelling in comments 2021-06-10 02:22:45 +10:00
59553d47c0 Cleanup: quiet array-parameter warning 2021-06-10 02:22:45 +10:00
84af1eaa92 Fix invalid return value assignment in getEdgeVertexIndices 2021-06-10 02:22:45 +10:00
059f19d821 Fix uninitialized variable in task.MempoolIterTLS test
Error in 14f3b2cdad.
2021-06-10 02:21:59 +10:00
0f156a2436 LineArt: Camera marker update fix.
The original fix was probably flushed by some newer
line art commits. Fixed.

See https://developer.blender.org/T88464
2021-06-10 00:14:34 +08:00
f42a501c61 Revert "GPencil: Add custom normal entry to bGPDspoint."
This reverts commit f546b0800b.
2021-06-10 00:11:14 +08:00
d8b8b4d7e2 BMesh: multi-thread face tessellation
Use BM_iter_parallel for face tessellation, this gives around
6.5x speedup for BM_mesh_calc_tessellation on high poly meshes in my
tests, although exact speedup depends on available cores.
2021-06-10 01:19:58 +10:00
14f3b2cdad BLI_task: add TLS support to BLI_task_parallel_mempool
Support thread local storage for BLI_task_parallel_mempool,
as well as support for the reduce and free callbacks.

mempool_iter_threadsafe_* functions have been moved into a private
header thats only shared between task_iterator.c and BLI_mempool.c
so the TLS can be made part of the iterator array without having to
rely on passing in struct offsets.

Add test task.MempoolIterTLS that ensures reduce and free
are working as expected.

Reviewed By: mont29

Ref D11548
2021-06-10 00:55:04 +10:00
f546b0800b GPencil: Add custom normal entry to bGPDspoint.
Also modified existing utility functions to take
care of the new surface normal interpolation and so on.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D11543
2021-06-09 22:46:08 +08:00
92ae3ff84c Fix assigning material to linked object being forbidden in BKE.
While this should not be allowed in general, there are some cases
(library overrides at least) where supporting this is mandatory.

Further more, comment stating that this could crash is from 2011, could
not reproduce any issue with current code. Commit comment was referring
to undo/redo, but in use cases here those should not affect things.

Note that in general, such relatively high-level checks should be
handled by high-level, close to user code (like in ED area e.g.), not in
low-level BKE code anyway.
2021-06-09 16:33:34 +02:00
5954b351f0 Cleanup: Removed unused definition. 2021-06-09 16:31:28 +02:00
33c4eefabb Cleanup: Comment formatting 2021-06-09 09:28:23 -05:00
Jeroen Bakker
6e999e08ab T88352: Use threaded ibo.tris extraction for single material meshes.
This patch adds a specific extraction method when the mesh has only
one material. This method is multi-threaded.

There is a trade-off in this patch as the ibo isn't compressed (it adds
restart indexes for hidden faces). So it depends if threading is faster
than the additional GPU buffer upload.

# Subdivided cube
I used a cube subdivided 7 times, modifiers applied. that gives around 400000 faces.

The test is selecting some vertices and move them. During this test the next buffers are updated on each frame:
* vbo.pos_nor
* vbo.lnor
* vbo.edit_data
* ibo.tris
* ibo.points

System info:
|platform| Linux-5.11.0-7614-generic-x86_64-with-glibc2.33|
| renderer|      AMD SIENNA_CICHLID (DRM 3.40.0, 5.11.0-7614-generic, LLVM 11.0.1)|
|vendor|         AMD|
|version|        4.6 (Core Profile) Mesa 21.0.1|
|cpu|              Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz|
|compiler|     gcc version 10.3.0|

Timing have been measured using DEBUG_TIME in `draw_cache_extract_mesh`.

master: `rdata 8ms iter 45ms (frame 153ms)`
this patch `rdata 6ms iter 36ms (frame 132ms)`

Reviewed By: mano-wii

Maniphest Tasks: T88352

Differential Revision: https://developer.blender.org/D11290
2021-06-09 16:20:53 +02:00
ec98bb318b UI: Add the option to not display some socket labels
This commit adds a flag to disable displaying some socket labels which
just redundant eye sores. We still want to have a label, because that
information can potentially be accessed elsewhere in the UI.

The flag is used in a few geometry nodes.

Differential Revision: https://developer.blender.org/D11540
2021-06-09 09:13:09 -05:00
3a7ab62eac Fix T88885: Circle select deselects first selections after moving cursor
`is_active_prev` is always set after the first operation.
But this was not the case with `wait_for_input` `false`.
2021-06-09 10:59:33 -03:00
1f55e12206 Tests: temporarily increase threshold for OpenImageDenoise test
Until all platforms have the same version, this helps the tests pass.
2021-06-09 15:28:19 +02:00
ea3895558d Fix T88998: GPencil not projecting to the most front surface
It was projecting from the stroke position.

The behavior has changed in {rB5400be9ffee2}.
2021-06-09 09:32:50 -03:00
Germano Cavalcante
e4c6da29b2 Draw Cache: use threading for Mesh extract lines
This is an optimization, but the difference is still not that
significant as some extractions are still done in single thread.

**Benchmarking**
||before:|after:
|---|---|---|
|large_mesh_editing:|Average: 14.246502 FPS|Average: 15.438118 FPS
||rdata 9ms iter 31ms (frame 69ms)|rdata 9ms iter 27ms (frame 65ms)
|large_mesh_editing_ledge: |Average: 14.913622 FPS|Average: 15.856538 FPS
||rdata 9ms iter 30ms (frame 67ms)|rdata 9ms iter 26ms (frame 63ms)
|looptris_test:|Average: 3.970774 FPS|Average: 4.095200 FPS
||rdata 11ms iter 90ms (frame 235ms)|rdata 12ms iter 87ms (frame 229ms)

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11467
2021-06-09 08:58:08 -03:00
4ced8900f5 Fix T88983: GPencil toggle caps error in python enum
The value for default option was wrong in the python definition.
2021-06-09 12:52:44 +02:00
f087a225dc GPencil: Hide Brush panels for some tools
Some tools don't use brush and the panel must be hidden.

Reviewed By: mendio

Differential Revision: https://developer.blender.org/D11518
2021-06-09 12:52:44 +02:00
dd98f6b55c Fix missing free calls for task iterator
A single threaded task with thread data over 8192 bytes would leak.
While this didn't happen in practice, it could cause issues in the
future.

The free call for `task_parallel_iterator_do` wasn't running
if callbacks weren't set, also not an issue in practice but avoids
potential problems in the future too.
2021-06-09 20:33:40 +10:00
b18a214ecb Fix: Compositor test desintegrate failing on arm64
Changes introduced in commit rBe9f2f17e8518
can create different render results when there is
a Math or Mix operation after TextureOperation
on tiled execution model.
This is due to WriteBufferOperation forcing a single pixel
resolution when these operations use a preferred
resolution of 0 to check if their inputs have resolution.
Fixing this behaviour creates different renders too.

This patch keeps previous tiled implementation and
adds the new implementation only for full frame execution.

Reviewed By: Jeroen Bakker (jbakker)

Differential Revision: https://developer.blender.org/D11546
2021-06-09 11:21:23 +02:00
d7c812f15b Compositor: Refactor recursive methods to iterative
In order to reduce stack size this patch converts full frame 
recursive methods into iterative.
- No functional changes.
- No performance changes.
- Memory peak may slightly vary depending on the tree because
 now breadth-first traversal is used instead of depth-first.

Tests in D11113 have same results except for test1 memory peak:
360MBs instead of 329.50MBs.

Reviewed By: Jeroen Bakker (jbakker)

Differential Revision: https://developer.blender.org/D11515
2021-06-09 11:02:40 +02:00
3ba16afa1e Fix failing test case sequence_transform. 2021-06-09 08:12:04 +02:00
8c3f4f7edf Fix: Incorrect node bezier spline tangent calculation for end points
The code was using the useless dangling handle at each end of the spline
rather than the handle pointing inwards.
2021-06-08 23:52:29 -05:00
307f8c8e76 Fix: Prevent small memory leak in VSE indexer
We need to unref the packet to tell ffmpeg it is ok to free it after
use.
2021-06-08 23:18:31 +02:00
8bd09b1d77 Build: upgrade OpenImageDenoise to 1.4.0
CMake builder and install deps changes, precompiled libraries are still to be
committed.

Ref T88438, T88434

Differential Revision: https://developer.blender.org/D11486
2021-06-08 19:22:59 +02:00
f29a738e23 PyAPI: use keyword only arguments
Use keyword only arguments for the following functions.

- addon_utils.module_bl_info 2nd arg `info_basis`.
- addon_utils.modules 1st `module_cache`, 2nd arg `refresh`.
- addon_utils.modules_refresh 1st arg `module_cache`.
- bl_app_template_utils.activate 1nd arg `template_id`.
- bl_app_template_utils.import_from_id 2nd arg `ignore_not_found`.
- bl_app_template_utils.import_from_path 2nd arg `ignore_not_found`.
- bl_keymap_utils.keymap_from_toolbar.generate 2nd & 3rd args `use_fallback_keys` & `use_reset`.
- bl_keymap_utils.platform_helpers.keyconfig_data_oskey_from_ctrl 2nd arg `filter_fn`.
- bl_ui_utils.bug_report_url.url_prefill_from_blender 1st arg `addon_info`.
- bmesh.types.BMFace.copy 1st & 2nd args `verts`, `edges`.
- bmesh.types.BMesh.calc_volume 1st arg `signed`.
- bmesh.types.BMesh.from_mesh 2nd..4th args `face_normals`, `use_shape_key`, `shape_key_index`.
- bmesh.types.BMesh.from_object 3rd & 4th args `cage`, `face_normals`.
- bmesh.types.BMesh.transform 2nd arg `filter`.
- bmesh.types.BMesh.update_edit_mesh 2nd & 3rd args `loop_triangles`, `destructive`.
- bmesh.types.{BMVertSeq,BMEdgeSeq,BMFaceSeq}.sort 1st & 2nd arg `key`, `reverse`.
- bmesh.utils.face_split 4th..6th args `coords`, `use_exist`, `example`.
- bpy.data.libraries.load 2nd..4th args `link`, `relative`, `assets_only`.
- bpy.data.user_map 1st..3rd args `subset`, `key_types, `value_types`.
- bpy.msgbus.subscribe_rna 5th arg `options`.
- bpy.path.abspath 2nd & 3rd args `start` & `library`.
- bpy.path.clean_name 2nd arg `replace`.
- bpy.path.ensure_ext 3rd arg `case_sensitive`.
- bpy.path.module_names 2nd arg `recursive`.
- bpy.path.relpath 2nd arg `start`.
- bpy.types.EditBone.transform 2nd & 3rd arg `scale`, `roll`.
- bpy.types.Operator.as_keywords 1st arg `ignore`.
- bpy.types.Struct.{keyframe_insert,keyframe_delete} 2nd..5th args `index`, `frame`, `group`, `options`.
- bpy.types.WindowManager.popup_menu 2nd & 3rd arg `title`, `icon`.
- bpy.types.WindowManager.popup_menu_pie 3rd & 4th arg `title`, `icon`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.app_template_paths 1st arg `subdir`.
- bpy.utils.blend_paths 1st..3rd args `absolute`, `packed`, `local`.
- bpy.utils.execfile 2nd arg `mod`.
- bpy.utils.keyconfig_set 2nd arg `report`.
- bpy.utils.load_scripts 1st & 2nd `reload_scripts` & `refresh_scripts`.
- bpy.utils.preset_find 3rd & 4th args `display_name`, `ext`.
- bpy.utils.resource_path 2nd & 3rd arg `major`, `minor`.
- bpy.utils.script_paths 1st..4th args `subdir`, `user_pref`, `check_all`, `use_user`.
- bpy.utils.smpte_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.smpte_from_seconds 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.system_resource 2nd arg `subdir`.
- bpy.utils.time_from_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.time_to_frame 2nd & 3rd args `fps`, `fps_base`.
- bpy.utils.units.to_string 4th..6th `precision`, `split_unit`, `compatible_unit`.
- bpy.utils.units.to_value 4th arg `str_ref_unit`.
- bpy.utils.user_resource 2nd & 3rd args `subdir`, `create`
- bpy_extras.view3d_utils.location_3d_to_region_2d 4th arg `default`.
- bpy_extras.view3d_utils.region_2d_to_origin_3d 4th arg `clamp`.
- gpu.offscreen.unbind 1st arg `restore`.
- gpu_extras.batch.batch_for_shader 4th arg `indices`.
- gpu_extras.batch.presets.draw_circle_2d 4th arg `segments`.
- gpu_extras.presets.draw_circle_2d 4th arg `segments`.
- imbuf.types.ImBuf.resize 2nd arg `resize`.
- imbuf.write 2nd arg `filepath`.
- mathutils.kdtree.KDTree.find 2nd arg `filter`.
- nodeitems_utils.NodeCategory 3rd & 4th arg `descriptions`, `items`.
- nodeitems_utils.NodeItem 2nd..4th args `label`, `settings`, `poll`.
- nodeitems_utils.NodeItemCustom 1st & 2nd arg `poll`, `draw`.
- rna_prop_ui.draw 5th arg `use_edit`.
- rna_prop_ui.rna_idprop_ui_get 2nd arg `create`.
- rna_prop_ui.rna_idprop_ui_prop_clear 3rd arg `remove`.
- rna_prop_ui.rna_idprop_ui_prop_get 3rd arg `create`.
- rna_xml.xml2rna 2nd arg `root_rna`.
- rna_xml.xml_file_write 4th arg `skip_typemap`.
2021-06-09 03:05:44 +10:00
c18ff180e3 Cleanup: Apply clang-format (make format) 2021-06-08 18:53:39 +02:00
22ee056c3a Geometry Nodes: Rename bounding box mesh output to "Bounding Box"
This was decided by the geometry nodes team, because the
important part of this output is not that it's a mesh.
2021-06-08 11:11:49 -05:00
f5a2d93224 Geometry Nodes: Support curve instances in the bounding box node
Currently curve instances are misleading, since `CurveEval` is created
from scratch from the original `Curve`, but this won't always be true.
2021-06-08 10:51:52 -05:00
a31bd2609f Cleanup: Remove duplicate call to function
Missed in rBa2ebbeb836ae765
2021-06-08 09:55:14 -05:00
Jeroen Bakker
2e19649bb9 Sequencer: Performance image crop transform.
During transforming an image, a matrix multiplication per pixel was done.
The matrix in itself is always linear so it could be replaced by two additions.

During testing in debug builds playing back a movie went from 20fps to
300 fps.

Reviewed By: zeddb

Differential Revision: https://developer.blender.org/D11533
2021-06-08 16:46:57 +02:00
7124c66340 Fix T87703: Failed assert when dragging object data-block into 3D View
Talked with Bastien and we ended up looking into this. Issue is that the
dupliation through drag & drop should also be considered a
"sub-process", like Shift+D duplicating does. Added a comment explaining
why this is needed.
2021-06-08 16:45:34 +02:00
Jeroen Bakker
259b9c73d0 GPU: Thread safe index buffer builders.
Current index builder is designed to be used in a single thread.
This makes all index buffer extractions single threaded.
This patch adds a thread safe solution enabling multithreaded
building of index buffers.

To reduce locking the solution would provide a task/thread local
index buffer builder (called sub builder).
When a thread is finished this thread local index buffer builder
can be joined with the initial index buffer builder.

`GPU_indexbuf_subbuilder_init`: Initialized a sub builder. The
index list is shared between the parent and sub buffer, but the
counters are localized. Ensuring that updating counters would
not need any locking.

`GPU_indexbuf_subbuilder_finish`: merge the information of the
sub builder back to the parent builder. Needs to be invoked outside
the worker thread, or when sure that all worker threads have been
finished. Internal the function is not thread safe.

For testing purposes the extract_points extractor has been migrated to
the new API. Herefore changes to the mesh extractor were needed.

* When creating tasks, the task number of current task is stored in
  ExtractTaskData including the total number of tasks.
* Adding two functions  in `MeshExtract`.
** `task_init` will initialize the task specific userdata.
** `task_finish` should merge back the task specific userdata back.
* adding task_id parameter to the iteration functions so they can
  access the correct task data without any need for locking.

There is no noticeable change in end user performance.

Reviewed By: mano-wii

Differential Revision: https://developer.blender.org/D11499
2021-06-08 16:36:06 +02:00
08b0de45f3 Geometry Nodes: new Select by Material node
This node creates a boolean face attribute that is "true" for
every face that has the given material.

Differential Revision: https://developer.blender.org/D11324
2021-06-08 16:01:54 +02:00
Maxime Casas
2246d456aa Animation: Allow selection of FCurve + its keys
Selection of an FCurve with box/circle select now selects the entire
curve and all its keys:

- Box selecting a curve selects all the keyframes of the curve.
- Ctrl + box selecting of the curve deselects all the keyframes of the
  curve.
- Shift + box selecting of the curve extends the keyframe selection,
  adding all the keyframes of the curves that were just selected to the
  selection.
- In all cases, if the selection area contains a key, nothing is
  performed on the curves themselves (the action only impacts the
  selected keys).

Reviewed By: sybren, #animation_rigging

Differential Revision: https://developer.blender.org/D11181
2021-06-08 15:45:53 +02:00
9553ba1373 Fix compile error with 'WITH_CXX_GUARDEDALLOC'
Seen with msvc
2021-06-08 10:35:04 -03:00
a2ebbeb836 Fix T88934: Crash with line node count input < 0
Some of the primitive nodes can return null in an error condition.
This is confusing mixed with adding a maderial slot in calling
functions. This is the second crash caused by that confusion. It's
simpler to add the slot right when allocating the mesh, and it will
lend itself better to copy & paste coding in the future.

Differential Revision: https://developer.blender.org/D11530
2021-06-08 08:27:13 -05:00
5b014911a5 Revert "Cleanup: use cpp new/delete."
This reverts commit 43464c94f4.
2021-06-08 15:08:09 +02:00
23fd576cf8 Cleanup: replace NULL with nullptr. 2021-06-08 13:14:18 +02:00
43464c94f4 Cleanup: use cpp new/delete. 2021-06-08 13:12:49 +02:00
322a614497 Cleanup: replace typedef structs with structs. 2021-06-08 12:03:06 +02:00
340c535dbf Cleanup: Separate compile unit edituv. 2021-06-08 12:03:06 +02:00
088ea59b7e Cleanup: Separate compile unit lines_adjacency. 2021-06-08 12:03:06 +02:00
cac9828ae3 Cleanup: Separate compile unit lines_paint_mask. 2021-06-08 12:03:06 +02:00
9e9d45ae16 Cleanup: Separate fdots extraction in own compile unit. 2021-06-08 12:03:06 +02:00
89d0cc3a0c Fix T88719: Attribute Remove node input field does nothing
An unlinked multi-input socket was not handled correctly.
2021-06-08 11:51:45 +02:00
e54a4b355e CMake: Fix FindClang not finding system clang on linux in some cases.
In Debian e.g. Clang is part of LLVM, so we need to also check its root
directory sometimes to find Clang files.
2021-06-08 11:16:45 +02:00
933c2cffd6 Geometry Nodes: enable multi-threading in evaluator again
This reverts rB223c6e1ead2940a89465ff66765d16ac14a992b7
because T88598 is resolved now.
2021-06-08 10:43:57 +02:00
ed1fc9d96b BLI: support disabling task isolation in task pool
Under some circumstances using task isolation can cause deadlocks.
Previously, our task pool implementation would run all tasks in an
isolated region. Now using task isolation is optional and can be
turned on/off for individual task pools.

Task pools that spawn new tasks recursively should never enable
task isolation. There is a new check that finds these cases at runtime.
Right now this check is disabled, so that this commit is a pure refactor.
It will be enabled in an upcoming commit.

This fixes T88598.

Differential Revision: https://developer.blender.org/D11415
2021-06-08 10:39:33 +02:00
496045fc30 BMesh: simplify normal calculation, resolve partial update error
Simplify vertex normal calculation by moving the main normal
accumulation function to operate on vertices instead of faces.

Using faces had the down side that it needed to zero, accumulate and
normalize the vertex normals in 3 separate passes, accumulating also
needed a spin-lock for thread since the face would write it's normal
to all of it's vertices which could be shared with other faces.

Now a single loop over vertices is performed without locking.
This gives 5-6% speedup calculating all normals.

This also simplifies partial updates, fixing a problem where
all connected faces were being read from when calculating normals.
While this could have been resolved separately,
it's simpler to operate on vertices directly.
2021-06-08 17:13:15 +10:00
f651cc6c4e Cleanup: Silent compile warning in interface_widgets.c. 2021-06-08 08:25:39 +02:00
0efb627bbd Cleanup: Soilent compile warning in curve_bevel.c. 2021-06-08 07:45:53 +02:00
1b07b7a068 LineArt: Threaded Object Loading.
Move BMesh conversion and all loading code into worker.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11288
2021-06-08 13:03:37 +08:00
0abce91940 Fix test failure caused by earlier cleanup commit
rB8cbff7093d65 neglected to move the "pre-tesselation" modifier to the
next before calculating the second part of the curve modifier stack.
2021-06-07 22:33:05 -05:00
2e46a8c864 Remove noop code from WM_MOUSEWHEEL processing.
ChildWindowFromPoint retrieves the child of the provided window at a
point. In this case it always returns 0 because HWND_DESKTOP is flag
defined as 0, which is never a valid window handle and is not intended
for use in place of a window handle.

Forwarding of mousewheel events was added in adb08def61, and later
modified to the current unworking state in e9645806f5. Sending mouse
wheel events to the window under the cursor is a system preference and
therefore should not be overridden by Blender, therefore the noop code
has been removed.
2021-06-07 20:15:28 -07:00
ef5a362a5b Improve multires performance.
Added a new api function to stich multires grids
on specific faces in a mesh,
subdiv_ccg_average_faces_boundaries_and_corners,
and changed multires normal calc to use it.

VTune profiling showed that this was a major
performance hit once you get above 10,000 or so
base mesh faces and/or have a high number of
subdivision levels.

Here's a video comparing the difference. Note the
bpy.app_debug switch is not in the final commit.

{F10145323}

And the .blend file:

{F10145346}

Reviewed By: Sergey Sharybin (sergey)

Differential Revision:
https://developer.blender.org/D11334
2021-06-07 15:19:19 -07:00
a6715213c3 Revert "Improve multires performance."
. . .because I accidentally committed
submodule references.

This reverts commit 482465e18a.
2021-06-07 15:16:03 -07:00
482465e18a Improve multires performance.
Added a new api function to stich multires grids
on specific faces in a mesh,
subdiv_ccg_average_faces_boundaries_and_corners,
and changed multires normal calc to use it.

VTune profiling showed that this was a major
performance hit once you get above 10,000 or so
base mesh faces and/or have a high number of
subdivision levels.

Here's a video comparing the difference. Note the
bpy.app_debug switch is not in the final commit.

{F10145323}

And the .blend file:

{F10145346}

Reviewed By: Sergey Sharybin (sergey)

Differential Revision:
https://developer.blender.org/D11334
2021-06-07 15:11:31 -07:00
b0ec1d2747 Cleanup: Order return argument last 2021-06-07 17:04:31 -05:00
1ef33be2d4 UI: Remove property descriptions exactly the same as names
These two descriptions are exactly the same as the property names,
which only wastes people's time when reading tooltips
2021-06-07 16:47:13 -05:00
d2aee304e8 Cleanup: Use const arguments, return by value
Also use Curve as an argument instead of Object, since the object was
only used to retrieve the curve, and the calling code is already working
with curve data.
2021-06-07 13:58:47 -05:00
6e56b42faa Fix T77651: Black screen on Blender startup on ChromeOS
Apparently `textureSize` doesn't work with
`sampler1DArray` on this OS.

Thanks to @dave1853 for finding the source of the
problem.
2021-06-07 15:51:08 -03:00
1c6e338d59 Cleanup: Make function static
This was not used in any other file, and it's not likely to be used
elsewhere in the future anyway.
2021-06-07 13:42:41 -05:00
7313b243f2 Cleanup: Remove outdated/useless comments
Some of the comments referenced code that was no longer there, or even
defines that were removed. Other comments were more confusing and
vague than helpful. Also adjust formatting in a few cases.
2021-06-07 13:29:37 -05:00
1182c26978 Cleanup: Remove unused function, make function private 2021-06-07 13:12:06 -05:00
8cbff7093d Cleanup: Decrease variable scope
Also use const and bool in a few places.
2021-06-07 13:08:03 -05:00
0fcc063fd9 Fix T88801: Positioning of Menu Underlines
This patch improves the positioning of the little mnemonic underlines
shown under some hotkey letters in menus, especially when using custom
fonts.

see D11521 for details and examples.

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

Reviewed by Campbell Barton
2021-06-07 10:56:20 -07:00
1949643ee5 Fix: Wrong logic for checking if we can reuse decoded frame
We should only check if the new pts value lies inside the duration of
the current frame.
2021-06-07 18:16:33 +02:00
7bf9d2c580 Cleanup: use doxy groups for bmesh_mesh_normals.c 2021-06-08 01:19:18 +10:00
4a9c5c60b7 Cleanup: Move extract lines to compile unit. 2021-06-07 16:57:21 +02:00
0e285fa23c Cleanup: Move extract tris in own compile unit. 2021-06-07 16:55:09 +02:00
214a78a46f Revert most of rB93a865dde775e.
This revert went too far, only one line (the minimal version of FFMPEG
for `install_deps.sh` script`) actually needed to be reverted...

Sorry for the noise.
2021-06-07 16:54:02 +02:00
f87f8532c3 Cleanup: split bmesh normal calculation into separate files 2021-06-08 00:50:25 +10:00
3da0b52c97 Cleanup: compiler warnings signed/unsigned mismatch 2021-06-08 00:50:25 +10:00
785a518ebe Cleanup: silence warnings 2021-06-07 11:30:25 -03:00
2bf56f7fbb Fix: do not use threading for 'extract_points'
`extract_points` doesn't support multithreading yet.
2021-06-07 11:30:17 -03:00
93a865dde7 Revert "Bump FFmpeg version from 4.2.3 to 4.4"
This reverts commit 95690dd362.

Such high version restriction is no more needed after rB9225fe933ae990.

Missing bit in https://developer.blender.org/D11417.
2021-06-07 16:25:34 +02:00
72d2355af5 Cleanup: remove redundant cast, use const casts 2021-06-08 00:23:09 +10:00
dfac5a63bd Cleanup: remove unused value 2021-06-08 00:09:07 +10:00
c87327ddeb Cleanup: use keyword only argument in bpy.props argument parsing
No functional changes as logic elsewhere already ensured this.

This just makes it obvious to anyone reading over the code that
these arguments are keyword only.
2021-06-08 00:07:19 +10:00
7ca5ba14b5 Cleanup: use keywords for unit tests
Prepare for function calls to be keyword only.
2021-06-08 00:07:19 +10:00
51bf1680bd Cleanup: quiet warning accessing deprecated attribute in bl_test 2021-06-08 00:07:19 +10:00
91d3a54869 Fix build error, remove duplicate include. 2021-06-07 19:11:36 +05:30
ee0000b8bb LineArt: Shifting fix for different camera fitting.
FOV was expanded to cover the shifting range,
rather than to precisely cut at the image border. Now fixed.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11523
2021-06-07 21:07:17 +08:00
7f1d1b03ad Cleanup: Fix uninitialized variable warning 2021-06-07 07:54:49 -05:00
abee9a85d4 Cleanup: renamed function to extract_run_single_threaded. 2021-06-07 13:51:47 +02:00
Germano Cavalcante
223016a408 GPUIndexBuf: Find the minimum and maximum index through the builder
Moving the bounds code to the builder can be useful
for future optimizations like building multithreaded.

Reviewed By: fclem, jbakker

Differential Revision: https://developer.blender.org/D11455
2021-06-07 08:41:38 -03:00
6e6a1838ea Cleanup: Added Guarderalloc deallocators to CPP structs. 2021-06-07 13:34:30 +02:00
1d3ffc93ec Added TODO comment for putting parameters into struct. 2021-06-07 13:31:09 +02:00
e517aaa136 Cleanup: move extract points into own compile unit. 2021-06-07 13:27:38 +02:00
8b8c3c34dd Fix T88900: Crash when setting Edge Weight/Crease
The `recalcData` of "convert_mesh_edge" did more
than it was supposed to.
2021-06-07 07:52:34 -03:00
4f6cab176a Cleanup: remove trailing space from pipeline_config.json
Remove trailing spaces from `pipeline_config.json`

No functional changes.
2021-06-07 11:36:26 +02:00
98876d46ef Fix T88899: __file__ not set for text.as_module() 2021-06-07 14:04:26 +10:00
7ef2b760dc Event Simulate: and a --keep-open command line argument
It can be useful to investigate the state of the file
after event simulation runs.
2021-06-06 23:05:46 +10:00
c27b7df563 Cleanup: unused argument 2021-06-06 23:03:34 +10:00
a496af8680 LineArt: Fix edge clipping index error.
Small bug that's causing edge count to be incorrect in
final culled list, just being offset exactly 1 entry.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11513
2021-06-06 11:18:18 +08:00
54ce344bc7 VSE: Remove seq->tmp usage from transform code
This field was used for extend feature to get handle position of
metastrip children. Since D9972 extend feature works only on meta
strip itself, not it's children.
So `SEQ_transform_get_left_handle_frame()` second argument is always
false and can be removed.

Another instance of `seq->tmp usage` is hack to distinguish strips to be
shuffled, which is not covered by this patch.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10321
2021-06-06 03:05:45 +02:00
dbfde0fe70 Exact Boolean: fix last commit: pass an arg by reference instead of value. 2021-06-05 14:17:15 -07:00
8e43ef5f31 Exact Boolean: speed up when there are many separate components.
Use bounding box tests quickly tell that two components cannot
have a containment relation between each other. This change
cut about 0.6s off a test with 25 big icospheres.
2021-06-05 11:31:08 -07:00
edaaa2afdd Limit Rotation: explicitly orthogonalize the matrix before processing.
Add a call to orthogonalize the matrix before processing for the
same reasons as D8915, and an early exit in case no limits are
enabled for a bit of extra efficiency.

Since the constraint goes through Euler decomposition, it would
in fact remove shear even before this change, but the resulting
rotation won't make much sense.

This change allows using the constraint without any enabled limits
purely for the purpose of efficiently removing shear.

Differential Revision: https://developer.blender.org/D9626
2021-06-05 16:29:46 +03:00
d2dc452333 Limit Rotation: add an Euler Order option.
Since Limit Rotation is based on Euler decomposition, it should allow
specifying the order to use for the same reasons as Copy Rotation does,
namely, if the bone uses Quaternion rotation for its animation channels,
there is no way to choose the order for the constraint.

Ref D9626
2021-06-05 16:29:46 +03:00
2cd1bc3aa7 Fix T88859: Assert when changing view modes
The `loose_lines`' ibo was not being initialized.
2021-06-05 09:49:48 -03:00
1a912462f4 BMesh: avoid extra faces-of-edges loop building partial update data 2021-06-05 21:33:15 +10:00
bcf9c73cbc Fix assert check in BLI_polyfill_beautify 2021-06-05 17:16:37 +10:00
3c9c557580 Fix assert in gpencil_batches_ensure 2021-06-05 17:13:12 +10:00
c7fee64dea Cleanup: use ternary operator for icon argument 2021-06-05 17:05:11 +10:00
ca3891e83b Fix T88828: View/Navigation(Walk/Fly) disappeared from keymap
This was unintentionally removed in
f92f5d1ac6.
2021-06-05 15:06:48 +10:00
a5114bfb85 Cleanup: indentation 2021-06-05 15:06:47 +10:00
022f8b552d Cleanup: spelling in comments
Also remove reference to function that never existed for adding `bNode`.
2021-06-05 15:03:59 +10:00
14508ef100 FFmpeg: Fix seeking not returning the correct frame when not using TC index
Fixed the logic for seeking in ffmpeg video files.
The main fix is that we now apply a small offset in ffmpeg_get_seek_pos
to make sure we don't get the frame in front of the seek position when
seeking backward.

The rest of the changes is general cleanup and untangling code.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11492
2021-06-05 02:48:09 +02:00
bfaf09b5bc Fix T88813: Scalable allocator not used on win10
Due to the way we ship the CRT on windows TBB's
malloc proxy was unable to attach it self to
the memory management functions on windows 10.

This change moves ucrtbase.dll out of the blender.crt
folder and back into the main blender folder to side
step some undesirable behaviour on win10 making TBB
once more able to attach it self.

Having this work again, should give a speed
boost in memory allocation heavy workloads
such as mantaflow.

For details on how this only failed on Win10
see T88813
2021-06-04 17:22:31 -06:00
c2fa36999f Edit Mesh: partial updates for normal and face tessellation
This patch exposes functionality for performing partial mesh updates
for normal calculation and face tessellation while transforming a mesh.

The partial update data only needs to be generated once,
afterwards the cached connectivity information can be reused
(with the exception of changing proportional editing radius).

Currently this is only used for transform, in the future it could be
used for other operators as well as the transform panel.

The best-case overall speedup while transforming geometry is about
1.45x since the time to update a small number of normals and faces is
negligible.

For an additional speedup partial face tessellation is multi-threaded,
this gives ~15x speedup on my system (timing tessellation alone).
Exact results depend on the number of CPU cores available.

Ref D11494

Reviewed By: mano-wii
2021-06-05 08:35:31 +10:00
Charlie Jolly
00073651d4 Nodes: Add Multiply Add to Vector Math nodes
Cycles, Eevee, OSL, Geo, Attribute

This operator provides consistency with the standard math node. Allows users to use a single node instead of two nodes for this common operation.

Reviewed By: HooglyBoogly, brecht

Differential Revision: https://developer.blender.org/D10808
2021-06-04 16:59:28 +01:00
eb030204f1 windows/deps: Fix TBB build issues.
rB847579b42250 updated the TBB build script
which had some unintended consequences for
windows as the directory layout slightly
changed.

This change adjusts the builder to the new
structure, there are no version/functional
changes.
2021-06-04 09:16:03 -06:00
Philipp Oeser
56005ef499 Texture Paint: changing paint slots and viewport could go out of sync
When changing to another texture paint slot, the texture displayed in
the viewport should change accordingly (as well as the image displayed
in the Image Editor).

The procedure to find the texture to display in the viewport
(BKE_texpaint_slot_material_find_node) could fail
though because it assumed iterating nodes would always happen in the
same order (it was index based). This is not the case though, nodes can
get sorted differently based on selection (see ED_node_sort).

Now check the actual image being referenced in the paint slot for
comparison.

ref T88788 (probably enough to call this a fix, the other issue(s)
mentioned in the report are more likely a feature request)

Reviewed By: mano-wii

Maniphest Tasks: T88788

Differential Revision: https://developer.blender.org/D11496
2021-06-04 16:02:02 +02:00
b6d6d8a1aa LibOverride: Fix early break in some of the resync code.
This `break` moved out of its braces at some point in the previous
fixes/refctors... :(
2021-06-04 15:54:07 +02:00
0037e08b06 GPencil: Change Fill Boundary icon
The icon has been changed to `eye` because is more consistent with other areas.
2021-06-04 12:44:34 +02:00
b6b20c4d92 GPencil: Change Fill extend lines icon
The icon has been changed to `eye` because is more consistent with other areas.
2021-06-04 12:44:34 +02:00
Fynn Grotehans
d486ee2dbd Update Camera presets
The (tracking) camera presets have not been updated in the last 7 or
more years, so they are very outdated. I found it pointless to have a
few specific camera models in the list and instead add the most commonly
used sensor sizes/film sizes. This way the list is shorter, easier to
maintain/becomes later outdated, and is more user friendly for most people
who don't own any of the specific cameras. I added the Crop Factor to the
Beginning of the name, so it gets sortet in the correct order and presets
are easier to find based on the size.

Reviewed By: #render_cycles, #motion_tracking, brecht, sergey

Differential Revision: https://developer.blender.org/D10739
2021-06-04 12:19:58 +02:00
9ba6b64efa Greasepencil: show pressure curve widgets in the sidebar
These were only showing in the Properties Editor, but there is no reason
to have the panels be different in the sidebar (they should not show in
the top bar though).

agreed upon by both @anoniov and @mendio

ref T88787
2021-06-04 12:17:33 +02:00
e4ca6b93ad BlenLoad: Ensure linked IDs are properly sorted.
So far, linked IDs were not properly sorted at all, only the ones
explicitely linked from WM code would be, but any indirectly linked
data-blocks would end up in some random order in their lists.

While not ideal, this is not a huge issue in itself, but it had bad
side-effects, e.g. causing (recursive) resync of overrides to happen in
random order, leading to mismatches between name indices of newly-generated
override IDs and the one existings e.g.

And in general, it is much better to be consistent here.

Note that the file sub-version is bumped for this commit, since some
sorting (the directly linked IDs which we keep a reference to) should
never need to be re-done after relevant doversion process.
2021-06-04 12:09:05 +02:00
77d7cae266 GPencil: Cleanup unneeded variable assign
The variable is assigned below again and the initial value is not used.
2021-06-04 10:44:01 +02:00
f4e0a19d4f Fix T88803: GPencil Thickness modifier produces thicker lines
There was a double apply of the thickness due a bug in the fading new parameter.

Differential Revision: https://developer.blender.org/D11483
2021-06-04 10:34:05 +02:00
053082e9d8 Math: Added max_uu/min_uu variations. 2021-06-04 09:14:15 +02:00
Johnny Matthews
ddd4b2b785 Geometry Nodes: Curve Length Node
This commit adds a node that outputs the total length of all
evalauted curve splines in a geometry set as a float value.

Differential Revision: https://developer.blender.org/D11459
2021-06-03 19:12:38 -04:00
e5a1cadb2f Geometry Nodes: Support curve data in the geometry delete node
This commit implements support for deleting curve data in the geometry
delete node. Spline domain and point domain attributes are supported.

Differential Revision: https://developer.blender.org/D11464
2021-06-03 18:33:37 -04:00
c18675b12c Cleanup: Add comment explaining assert
This triggers fairly often during development, so it might save some
frustration at some point to have a comment here.
2021-06-03 18:06:31 -04:00
dba3fb9e09 Overlay: Flash on Mode Transfer overlay
This implements T87633

This overlay renders a flash animation on the target object when
transfering the mode to it using the mode transfer operator.
This provides visual feedback when switching between objects without
extra overlays that affect the general color and lighting in the scene.

Differences with the design task:

- This uses just a fade out animation instead of a fade in/out animation.
The code is ready for fade in/out, but as the rest of the overlays
(face sets, masks...) change instantly without animation, having a fade
in/out effect gives the impression that the object flashes twice (once
for the face sets, twice for the peak alpha of the flash animation).

- The rendering uses a flat color without fresnel for now, but this can
be improved in the future to make it look more like the shader in the
prototype.

- Not enabled by default (can be enabled in the overlays panel), maybe
the defaults can change for 3.0 to disable fade inactive and enable this
instead.

Reviewed By: jbakker, JulienKaspar

Differential Revision: https://developer.blender.org/D11055
2021-06-03 20:17:17 +02:00
3e695a27cd VSE: Add refresh_all operator to all sequencer regions
This operator is needed in some cases to update image preview.
In workspaces with smaller timelines this is limiting, because users
need to first check that mouse cursor is in correct place, then press
CTRL+R shortcut.
2021-06-03 19:58:36 +02:00
a1063fc6c2 VSE: Remove JPEG reference from proxy panel
Proxies doesn't use MJPEG codec anymore, but text still referenced it.
2021-06-03 19:44:00 +02:00
b414322f26 GHOST/wayland: fix restoring hidden cursor 2021-06-03 18:18:27 +01:00
899eefd1bb GHOST/wayland: fix non-moving normal cursor 2021-06-03 18:18:27 +01:00
72607feb91 GHOST/wayland: add 'xdg-decoration' support 2021-06-03 18:18:27 +01:00
870bcf6e1a GHOST/wayland: adapt window and cursor surface scale to support HiDPI screens 2021-06-03 18:18:27 +01:00
8b78510fc4 GHOST/wayland: handle return values for data sources 2021-06-03 18:18:27 +01:00
e0bc5c4087 GHOST/wayland: set parent relation only for dialogs to mimic X11 behaviour 2021-06-03 18:18:27 +01:00
1fd653dd82 GHOST/wayland: handle missing relative-pointer and pointer-constraints support 2021-06-03 18:18:27 +01:00
d9aae38bc8 GHOST/wayland: get cursor settings via D-Bus 2021-06-03 18:18:27 +01:00
efad9bcdda GHOST/wayland: inhibit warning 2021-06-03 18:18:27 +01:00
b5d7fb813f cmake: use absolute path for Wayland libraries 2021-06-03 18:18:27 +01:00
bb16f96973 GHOST/wayland: set swap interval to 0
The Wayland server will not update hidden surfaces. This will block the
main event loop and thus also block updates to visible windows in a multi-
window setup.
2021-06-03 18:18:27 +01:00
7197017ea9 WM: only use the tablet drag threshold for mouse button events
Keyboard click-drag events now use the "Drag Threshold".
This resolves a problem where keyboard click drag events
used a much smaller threshold when using a tablet.
2021-06-04 01:18:23 +10:00
ed6fd01ba9 LibOverride: fix previous commit (rB826bed4349fa). 2021-06-03 16:44:20 +02:00
826bed4349 LibOverride: Fix some fail cases with auto-resync.
In some cases e.g. only objects would actually need resync, so
collections on the override character would not be resynced, and if some
objects were sharing relationships with others those could be
lost/destroyed.
2021-06-03 16:12:26 +02:00
797f6e1483 Fix missing updates in RNA override create functions. 2021-06-03 15:44:23 +02:00
e011e4ce76 LibOverride: Add override_hierarchy_createto ID's RNA API. 2021-06-03 15:00:50 +02:00
92f8a6ac21 Fix T88762: UI using tab to enter next button could clamp the hard min/
max unneccessarily

Since rB298d5eb66916 [which was needed to update buttons with custom
property range functions correctly], using tab would always clamp
(hardmin/hardmax) properties which were using FLT_MAX / INT_MAX as range
in their property definitions.

The clamping of rB298d5eb66916 was copied over from rB9b7f44ceb56c
[where it was used for the softmin/softmax], and while the re-evaluation
of hardmin/hardmax is needed for custom property range functions, the
clamping should actually not take place.

There are many properties using FLT_MAX / INT_MAX etc. and while it
probably would be good to update these with ranges that make more sense
-- not using FLT_MAX / INT_MAX would not have done the clamping here --
there should not be an arbitrary limit to these and they should stay as
they are.

Maniphest Tasks: T88762

Differential Revision: https://developer.blender.org/D11473
2021-06-03 14:16:53 +02:00
7b8d812277 Cleanup: make format 2021-06-03 13:33:09 +02:00
2ae4e860f6 LibOverride: ensure proper indirect tag for 'virtual' linked IDs.
Ensure 'virtual' linked override IDs generated by the recursive resync
process are tagged as indirectly linked data.

This is needed to avoid the 'missing data' messages on those virtual
data-blocks after saving and reloading.
2021-06-03 10:27:05 +02:00
2ef192a55b IDManagement: Collection: Fix several issues in relationships building code.
`BKE_main_collections_parent_relations_rebuild`,
`BKE_collection_parent_relations_rebuild` anf their internal
dependencies had two issues fixed by this commit:

* Main one was that a same collection could be processed several times,
  sometimes even in an infinite loop (in some rare corner cases), by
  `collection_parents_rebuild_recursive`.
* More exotic, code here would not ensure that the collections it was
  processing were actually in Main (or a master one from a scene in
  Main), which became an issue with some advanced ID management
  processes involving partially out-of-main remapping, like liboverride
  resync.
2021-06-03 10:27:05 +02:00
a51f8f94d5 Cleanup: use ascii characters instead of unicode where possible
Follow own code style docs.
2021-06-03 11:32:53 +10:00
17f72be3cb Cleanup: spelling in comments, correct outdated comments 2021-06-03 10:47:02 +10:00
2a868d277e Cleanup: use doxy sections for node_relationships.cc 2021-06-03 10:35:46 +10:00
b60a72eaab Fix invalid return values from file_execute
Error in 6c8c30d865
2021-06-03 10:23:40 +10:00
2dcb6782e0 Draw Mesh Extractor: Fix used thread count
Some threads were always idle because of this.
2021-06-02 18:05:58 -03:00
4d64de2853 Cleanup: Remove unused 'ExtractTaskData's members 2021-06-02 17:55:25 -03:00
5af7225816 Cleanup: Fix build warnings 2021-06-02 21:52:36 +02:00
925df8ef26 VSE: Add strip-time intersection test function
Use SEQ_time_strip_intersects_frame function to test if strip intersects with frame.

Note: There are cases where this function should not be used. For example splitting
strips require at least 1 frame "inside" strip. Another example is drawing, where
playhead technically doesn't intersect strip, but it is rendered, because current
frame has "duration" or "thickness" of 1 frame.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11320
2021-06-02 21:41:38 +02:00
2ee575fc1f Cleanup: Strip duplication code
Remove unused flag `SEQ_DUPE_ANIM` and code used by this flag.
Remove flag `SEQ_DUPE_CONTEXT` and refactor code, to split operator
logic from duplication code.
Reduce indentation level in for loop.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11318
2021-06-02 21:41:17 +02:00
1f55786791 Fix T57397: Movies are blurred after sws_scale
Images with 4:2:2 and 4:4:4 chroma subsampling were blurred when
`SWS_FAST_BILINEAR` interpolation is set for `anim->img_convert_ctx`.

Use `SWS_BILINEAR` interpolation for all movies, as performance is
not impacted by this change.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11457
2021-06-02 21:29:38 +02:00
a9dfde7b49 FFmpeg: Update proxy settings
Changes in rBce649c73446e, affected established proxy codec preset.
Presets were not working and all presets were similar to `veryfast`.
Tunes are now working too, so `fastdecode` tune can be used. I have
measured little improvement, but I tested this only on 2 machines and
I have been informed that `fastdecode` tune does influence decoding
performance for some users.

Change preset from `slow` to `veryfast` and add tune `fastdecode`

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11454
2021-06-02 21:25:37 +02:00
0ea0ccc4ff FFmpeg: Fix H264 lossless render not lossless
While encoder parameters for lossless encoding are set correctly,
output is not lossless due to pixel format being set to
`AV_PIX_FMT_YUV420P` which is inherently lossy due to chroma subsampling.

This was reported in T61569 and was merged to T57397, but there were
2 bugs - one for encoding and one for decoding.

Set pixel format to `AV_PIX_FMT_YUV444P` when rendering lossless H264
files. This format isn't available in `codec->pix_fmts[0]` and it looks,
that it has to be hard-coded.

Reviewed By: sergey

Differential Revision: D11458
2021-06-02 21:24:09 +02:00
81366b7d2c Boolean exact: speedup by parallelizing a plane calculation.
This patch is from erik85, who says:
This patch makes populate_plane inside polymesh_from_trimesh_with_dissolve run in parallel.
On a test file with a boolean between two subdivided cubes (~6 million verts) this gives a 10% speed increase (49.5s to 45s) on my 6 core CPU.

Also there is an optimization of other_tri_if_manifold to skip the contains-call and get the pointer directly.
This reduces CPU time for find_patches from 5s to 2.2s on the same test file.
2021-06-02 12:08:46 -07:00
dc960a81d1 Boolean exact: speedup when there are many components.
When there are many components (separate pieces of connected mesh),
a part of the algorithm to determine component containment was slow.
Using a float version of finding the nearest point on a triangle
as a prefilter sped this up enormously. A case of 25 icospheres
subdivided twice goes 11 seconds faster on my Macbook pro with this
change.
2021-06-02 11:18:00 -07:00
4f8edc8e7f Nodes: move some files to C++
This just moves a couple of files in `space_node` to C++ and fixes
related errors.

The goal is to be able to use C++ data structures to simplify the code.

Differential Revision: https://developer.blender.org/D11451
2021-06-02 17:20:46 +02:00
b8ae30e9e3 Cleanup: unused variable 2021-06-03 01:12:00 +10:00
ae28ceb9d8 Fix swapped x/y in event simulation script
Incorrect area center calculation, also correct comments.
2021-06-03 01:11:47 +10:00
05b685989b Fix T88732: Curve to mesh node crash with empty input curve
The mesh to curve node generated an empty curve because no edges were
selected. This commit changes that node to not add a curve in that case.

This also changes the curve to mesh node to not add a material when
no mesh was created. Even though we don't expect null curves or meshes
in this case, the change is harmless.
2021-06-02 11:11:34 -04:00
7654203cc8 EEVEE: AOVs not same as cycles.
EEVEE uses hashing to sync aov names and types with the gpu.
For the type a hashed value was overridden making `decalA`
and `decalB` choose the same hash. This patches fixes this
by removing the most significant bit.
2021-06-02 16:58:36 +02:00
2489f72d79 Revert "EEVEE: AOVs not same as cycles."
This reverts commit 730a46e87d.
2021-06-02 16:56:10 +02:00
730a46e87d EEVEE: AOVs not same as cycles.
EEVEE uses hashing to sync aov names and types with the gpu. For the type a hashed value was overridden making `decalA` and `decalB` choose the same hash. This patches fixes this by removing the most significant bit.
2021-06-02 16:54:01 +02:00
f944121700 GPencil: New operator to Normalize strokes
Sometimes is required to reset the thickness or the opacity of the strokes. Actually this was done using a modifier, but this operators solves this.

Reviewed By: mendio, filedescriptor

Maniphest Tasks: T87427

Differential Revision: https://developer.blender.org/D11453
2021-06-02 16:43:37 +02:00
21de669141 Splines: Function to copy spline settings without data
Often you need to copy a spline to do an operation, but don't want
to manually copy over all of the settings. I've already forgotten to
do it once anyway. These functions copy a spline's "settings" into a
new spline, but not the data. I tried to avoid duplicating any copying
so this is easier to extend in the future.

Differential Revision: https://developer.blender.org/D11463
2021-06-02 09:11:35 -04:00
5b176b66da LineArt: Tolerance for faces perpendicular to view
This is due to cam->obmat precision issue,
where it affects view vector precision.

Reviewed by Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11461
2021-06-02 20:55:54 +08:00
a55b73417f Cleanup: Correct comments
This corrects an outdated comment in the vector header and a typo
in the index mask header.
2021-06-02 08:28:46 -04:00
ea6d099082 Cleanup: Clang format 2021-06-02 08:27:53 -04:00
34f99bc6be Geometry Nodes: Allow reading converted attribute directly from spline
Often it would be beneficial to avoid the virtual array implementation
in `geometry_component_curve.cc` that flattens an attribute for every
spline and instead read an attribute separately for every input spline.
This commit implements functions to do that.

The downside is some code duplication-- we now have two places handling
this conversion. However, we can head in this general direction for the
attribute API anyway and support accessing attributes in smaller
contiguous chunks where necessary.

No functional changes in this commit.

Differential Revision: https://developer.blender.org/D11456
2021-06-02 08:24:42 -04:00
6cd64f8caa Add workaround for gcc 11 compiler bug
Differential Revision: https://developer.blender.org/D11462
2021-06-02 14:13:55 +02:00
f92f5d1ac6 Keymap: use D-Key for view-pie menu
Use the D-key to access the view menu instead of the Tilda key,
which isn't accessible on some international layouts.

To resolve the conflicts the following changes have been made.

- `D` (motion) opens the view menu.
- `D` (mouse-button) uses grease-pencil (as it does currently).
- `Tilda` is used to for "Object Mode Transfer" instead of the View menu.

See T88092 for details.

Reviewed By: Severin

Ref D11189
2021-06-02 21:34:30 +10:00
69e15eb1e4 Object: support running transfer mode in any object mode
There is no need to limit this to sculpt mode,
prepare for key short cut changes, see: T88092.
2021-06-02 21:29:15 +10:00
facc62d0d5 Docs: 2.93 release description for Linux appdata 2021-06-02 13:22:16 +02:00
46447594de Fix T88567: Cryptomatte only works for the first View Layer.
The view layer was always set to 0. This patch increments it.
2021-06-02 10:05:39 +02:00
507c19c0f7 Docs: formalize naming for generic callbacks in BKE_callbacks.h
Add a doc-string explaining the purpose of each call back and
how they should be used.

Also add a currently unused callback 'POST_FAIL' that is to be used in
cases the action fails - giving script authors, a guarantee that a
call to `pre` will always have a matching `post/post_fail` call.

- D11422: adds a callback that can use 'post_fail'.
- T88696: proposed these conventions.
2021-06-02 17:35:24 +10:00
3b3742c75f Cleanup: trailing commas to avoid right shift
This matches most declarations already in this file.
2021-06-02 17:06:12 +10:00
b5a883fef9 Cleanup: spelling in comments 2021-06-02 17:04:57 +10:00
711ddea60e Fix assert with geometry node output
The previous commit (my own) returned early without providing a value
for the node's output geometry set, which is required.
2021-06-01 23:50:23 -04:00
6b5bbd22d9 Cleanup: Avoid duplicating node input retrieval
Pass the selection name and the invert argument to each component
instead of retrieving them every time.
2021-06-01 17:51:21 -04:00
Wannes Malfait
464797078d Geometry Nodes: Add Delete Geometry Node
This node is similar to the mask modifier, but it deletes the elements
of the geometry corresponding to the selection, which is retrieved as
a boolean attribute. The node currently supports both mesh and point
cloud data. For meshes, which elements are deleted depends on the
domain of the input selection attribute, just like how behavior depends
on the selection mode in mesh edit mode.

In the future this node will support curve data, and ideally volume
data in some way.

Differential Revision: https://developer.blender.org/D10748
2021-06-01 17:32:03 -04:00
3400ba329e VSE: Use own category for metadata panel
Metadata panel was visible in each category. In other editors, this
panel is usually placed in category with other source media properties.
In sequencer, metadata is transfered over while compositing and relation
to particular strip is lost, therefore separate category for metadata
seems to be best option. Since Metadata panel is alone in this category,
it will be open by default.
2021-06-01 23:06:31 +02:00
17b09b509c Geometry Nodes: Skip calculating normals in transform node
This commit skips the eager recalculation of mesh normals in the
transform node. Often another deformation or topology-altering
operation will happen after the transform node, which means the
recalculation was redundant anyway.

In one of my test cases this made the node more than 14x faster.
Though depending on the situation the cost of updating the normals
may just be shifted elsewhere.
2021-06-01 12:03:59 -04:00
5b6e0bad1b Fix T88715: particle size influence texture not working for 'keyed' or 'none' physics types
This was reported for the special case of mapping with "Strand /
Particle" coords, but was not working with other coordinates either.

Dont see a reason for not supporting Size influence textures for these
kinds of particles (and since these types of particles have an "age"
like all others as well, even the "Strand / Particle" coords are
supported here as well)

Maniphest Tasks: T88715

Differential Revision: https://developer.blender.org/D11449
2021-06-01 17:54:20 +02:00
404b946ac0 LibOverride: Fix again infinite loop in resync in some complex/degenerated cases.
Broken in recent refactor of (recursive)resync, reported by studio,
thanks.
2021-06-01 17:37:22 +02:00
6583fb67c6 Geometry Nodes: add empty material slot to new meshes
This fixes T88455 by adding an empty material slot to newly
generated meshes. This allows the object to overwrite the
"default" material without any extra nodes. Technically,
all polygons reference the material index 0 already, so it
makes sense to add a material slot for this material index.

Differential Revision: https://developer.blender.org/D11439
2021-06-01 15:25:01 +02:00
James Monteath
8a63466ca3 BuildBot: Cleanup
Removing scripts that were placed in the source tree that would drive
the old buildbot. With the new buildbot in place these scripts aren't
being used anymore.

The buildbit is currently driven by
`build_files/config/pipeline_config.json`. In the near future make
update would also use this config.

Overview of the new buildbot: https://wiki.blender.org/wiki/Infrastructure/BuildBot

Work done by James Monteath.
2021-06-01 15:18:11 +02:00
6899dcab53 Fix T88658: Force Fields of curve shape can crash if curve has only one point
`bvhtree_from_mesh_edges_create_tree` can actually leave the BVHTree
NULL (e.g. if no edges are present).

Now dont allocate `BVHTreeFromMesh` on the `SurfaceModifierData` at all
in case the tree would be NULL anyways.
Places like `get_effector_data` check for `SurfaceModifierData`-
>`BVHTreeFromMesh` and dont try to stuff like getting a closest point on
surface, which would crash as soon as BVHNodes would need to be accessed
(from the NULL BVHTree).

Maniphest Tasks: T88658

Differential Revision: https://developer.blender.org/D11443
2021-06-01 13:38:29 +02:00
c078540512 Cleanup: remove unused parameter. 2021-06-01 13:18:41 +02:00
6f1af44695 Cleanup: remove unused parameter. 2021-06-01 13:18:41 +02:00
633b70905a Cleanup: NULL->nullptr. 2021-06-01 13:18:41 +02:00
f0d93a71df Cleanup: API for MeshExtractRunTimeData. 2021-06-01 13:18:41 +02:00
98c6626729 DrawManager: Use CPP for Mesh Extraction Scheduling.
More cleanups will come to make this more CPP-like.
2021-06-01 13:18:41 +02:00
4b57bbac22 Cleanup: LibOverride: rename 'local' group tagging functions to 'overrides'.
Since we use them on linked data now as well, 'local' does not fit them
anymore.
2021-06-01 12:29:56 +02:00
bf8659930f Fix libOverride resync issues in some corner-cases.
This commit fixes two different issues:
* In some cases, when an object was added to a sub-collection and used
  into a different subcollection, and the root common collection would
  not need to be resynced, it would end up creating multiple overrides
  of the new object. This was affecting both normal and recursive
  resync.
* In recurisve resync case, the barrier code to define what is part or
  not of a override group/hierarchy was wrong.

Note that the current solution for the first issue is sub-optimal (it
goes back to the root of the override hierarchy and resync the whole
thing), a better solution is TODO for now.
2021-06-01 12:01:06 +02:00
f25316e97a IDManagement: BKE_libblock_rename: assert we get local ID.
For now at least, linked data should never be renamed that way.
2021-06-01 12:01:06 +02:00
84e16c4992 Fix BLI_libblock_ensure_unique_name not ignoring linked IDs.
This function would considere that there was a name conflict even in
case existing ID would be a linked one.

This is only a (symbolic) perforance improvement and logical fix, since
`BKE_id_new_name_validate` would not do that mistake anyway.
2021-06-01 12:01:06 +02:00
db15c9d1bd ID Management: Allow unique name check for linked IDs too.
This is mandatory for liboverride resync, since this feature may imply
we have to create linked overrides in libraries, and there may be
several copies of those.

This is also a first step to a more general support of IDmanagement-editing
library data.

Note that this commit should have absolutely no effect on current code,
as the only function allowed to check unique names for linked IDs
currently is `BKE_libblock_management_main_add`, which is unused.

This commit also adds some basic testing for `BKE_id_new_name_validate`.
2021-06-01 12:01:06 +02:00
27910ccce6 Cleanup: clang-tidy
* `readability-redundant-member-init`
* `readability-inconsistent-declaration-parameter-name`
* Remove constructor that can be defaulted.
2021-06-01 12:00:16 +02:00
9adfd278f7 Compositor: Full-frame base system
This patch adds the base code needed to make the full-frame system work for both current tiled/per-pixel implementation of operations and full-frame.

Two execution models:
- Tiled: Current implementation. Renders execution groups in tiles from outputs to input. Not all operations are buffered. Runs the tiled/per-pixel implementation.
- FullFrame: All operations are buffered. Fully renders operations from inputs to outputs. Runs full-frame implementation of operations if available otherwise the current tiled/per-pixel. Creates output buffers on first read and free them as soon as all its readers have finished, reducing peak memory usage of complex/long trees. Operations are multi-threaded but do not run in parallel as Tiled (will be done in another patch).

This should allow us to convert operations to full-frame in small steps with the system already working and solve the problem of high memory usage.

FullFrame breaking changes respect Tiled system, mainly:
- Translate, Rotate, Scale, and Transform take effect immediately instead of next buffered operation.
- Any sampling is always done over inputs instead of last buffered operation.

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D11113
2021-06-01 10:51:53 +02:00
930ad9257d Cleanup: Split draw_cache_extract_mesh into multiple files.
draw_cache_extract_mesh for task scheduling. Will be refactored to draw_cache_extract_mesh_scheduling later on after migrating to CPP.

draw_cache_extract_mesh_render_data extraction of mesh render data from edit mesh/mesh into a more generic structure.

draw_cache_extract_mesh_extractors containing all the extractors. This will be split up further into a single file per extractor.
2021-06-01 09:23:37 +02:00
13deb5088a Cleanup: split face tessellation into inline functions
Prepare for multiple code-paths that recalculate tessellation.
2021-06-01 15:30:53 +10:00
b8d0f28f70 Cleanup: split bmesh tessellation into it's own file
Prepare for further refactoring for these functions.
2021-06-01 14:04:00 +10:00
3a18e304be Cleanup: remove disabled face tessellation logic
This was kept since these blocks are easier to follow.
Remove as the overall result wasn't so readable
(especially with nested ifdef's).

Replace disabled code with comment on the indices used for quads/tris.
2021-06-01 13:26:26 +10:00
5e7fb77dc4 BMesh: remove checks for tessellating 2 sided faces
2 sided faces aren't supported and will cause problems in many areas
of Blender's code.

Removing (implied) support for faces with fewer than 3 sides
means the total number of triangles is known ahead of time.

This simplifies adding support for multi-threading and partial updates
to an existing tessellation - as the face and loop indices can be used
to access the range of triangles associated with a face.

Also correct outdated comments.
2021-06-01 13:25:00 +10:00
f8ce744c83 Cleanup: correct sculpt quat argument size 2021-06-01 12:50:01 +10:00
f71cf99616 GPU: add 2D projection function
When projecting into screen space Z value isn't always needed.
Add 2D projection functions, renaming them to avoid accidents
happening again.

- Add GPU_matrix_project_2fv
- Add ED_view3d_project_v2
- Rename ED_view3d_project to ED_view3d_project_v3
- Use the 2D versions of these functions when the Z value isn't used.
2021-06-01 12:49:53 +10:00
c145cb7998 Fix buffer overrun in paint_line_strokes_spacing
Error in 87cafe92ce
2021-06-01 12:49:20 +10:00
e7b8a3cb0a Cleanup: spelling in comments 2021-06-01 12:49:18 +10:00
c59d2c739d Cleanup: spelling in comments 2021-06-01 01:45:17 +02:00
f253e59221 Docs: Limit the OCIO env vars that we document
Brecht mentioned that these are a bit obscure and don't make much sense 
to override these.
2021-05-31 19:19:00 -04:00
8180d478e1 Speedup exact boolean by avoiding some mallocs and frees.
This is from patch D11432 from Erik Abrahamsson. He found that
in some mpq3 functions called frequently from loops, passing in
buffers for termporary mpq3 values can save substantial time.
On my machine, his example in that patch went from 9.48s to 7.50s
for the boolean part of the calculation. On his machine, a running
time went from 17s to 10.3s.
2021-05-31 17:03:48 -04:00
73967e2047 Fix undeclared identifiers with 'DEBUG_TIME'
These identifiers were accidentally removed in rB44d2479dc36f.
2021-05-31 16:28:14 -03:00
09fb81f66d Merge branch 'blender-v2.93-release' 2021-05-31 19:23:49 +02:00
25316ef9d7 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: https://developer.blender.org/D11182
2021-05-31 19:23:44 +02:00
875a8a6c79 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: https://developer.blender.org/D11430

Reviewed by Brecht Van Lommel
2021-05-31 10:08:58 -07:00
James Monteath
ee54a8ace7 Update all README to clearify intention or usage
Add snap configuration file used by Buildbot snap store steps1
2021-05-31 18:58:42 +02:00
261a10edb0 Display source video fps in the VSE
Now FPS is displayed in the video source for videos to provide easy
access.

Reviewed By: Richard Antalik

Differential Revision: http://developer.blender.org/D11441
2021-05-31 18:22:24 +02:00
d647e730fb 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.
2021-05-31 09:59:29 -06:00
b862916eaf VSE: Fix missing cache invalidation
Fixes T88606
2021-05-31 17:28:49 +02:00
Jeroen Bakker
44d2479dc3 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.

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

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

Differential Revision: https://developer.blender.org/D11425
2021-05-31 17:11:25 +02:00
aebeb85fe0 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
LoadLibrary/GetProcAddress.

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

Reviewed by: harley, nicholas_rishel
2021-05-31 08:56:57 -06:00
d67c13ca76 Cleanup: else-after-return 2021-05-31 15:48:06 +02:00
d94ba979d8 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
properly.

Maniphest Tasks: T88569

Differential Revision: https://developer.blender.org/D11436
2021-05-31 15:32:33 +02:00
e0a1c3da46 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.
2021-05-31 14:32:39 +02:00
e9f2f17e85 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: https://developer.blender.org/D11381
2021-05-31 12:26:46 +02:00
83fe479c7f Merge branch 'blender-v2.93-release' 2021-05-31 11:56:17 +02:00
ce649c7344 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
  video!

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: http://developer.blender.org/D11426
2021-05-31 11:29:08 +02:00
2534609262 Revert "Added v2.93 pipeline config for new buildbot."
This reverts commit 632bfee0a5.
This config is only intended for 2.93. Master will get its own config
file after testing that 2.93 is correct.
2021-05-31 11:16:13 +02:00
86eaddb3ca Merge branch 'blender-v2.93-release' 2021-05-31 11:15:50 +02:00
26fb7b9474 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.
2021-05-31 11:12:39 +02:00
421c0b45e5 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.
2021-05-31 10:20:23 +02:00
Jeroen Bakker
5f749a03ca 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
2021-05-31 09:33:31 +02:00
a1556fa05c 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.
2021-05-30 16:37:49 -04:00
e6a69f7653 Docs: Capitalize first word of sentence 2021-05-30 11:09:01 -04:00
7b5796dcaa Docs: clarify description and usage of 'bpy.app.version_file'
Fixes T88669
2021-05-30 11:07:38 -04:00
f5d14e36e8 PyDoc: Use em dash instead of comma for enum items 2021-05-29 12:16:13 -04:00
870aaf3fb6 Docs: Add documentation for 'material_index'
Fixes T88485
2021-05-29 11:22:58 -04:00
6f86d50b92 UI: Match tooltip with interface name 2021-05-29 11:22:58 -04:00
30f7acfffa Docs: Add relevant OCIO envvars to Blender's help message 2021-05-29 11:22:58 -04:00
115547991a Merge branch 'blender-v2.93-release' 2021-05-29 15:29:42 +02:00
James Monteath
ffe7a41540 Fix typos 2021-05-28 20:50:52 +02:00
James Monteath
74c7e21f6c Add and update README.md files for CI script removal 2021-05-28 19:46:53 +02:00
9225fe933a 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
2021-05-28 18:37:36 +02:00
3311350670 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.
2021-05-28 18:35:26 +02:00
5b8a41d387 Merge branch 'blender-v2.93-release' 2021-05-28 18:19:07 +02:00
653bbaa246 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
2021-05-28 12:17:04 -04:00
c0ce7fce89 Merge branch 'blender-v2.93-release' 2021-05-28 12:09:08 -04:00
James Monteath
fc2b56e68c Add branch based pipeline config file used by buildbot and make_update.py script. 2021-05-28 17:53:02 +02:00
a4700549e0 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.
2021-05-28 17:15:44 +02:00
c65f4b3d76 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.
2021-05-28 11:51:13 -03:00
11e32332dd 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
2021-05-28 10:42:22 -04:00
418888f1c9 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.
2021-05-28 07:57:21 -06:00
bdac47f8d4 Merge branch 'blender-v2.93-release' 2021-05-28 15:47:38 +02:00
97ccd592ce Fix crash in liboverride resync.
Reported by studio (@andy), thanks.
2021-05-28 15:33:04 +02:00
James Monteath
51bbdfbef3 Moved to new git repo 2021-05-28 12:16:45 +02:00
63e50cf265 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
2021-05-28 11:06:55 +02:00
James Monteath
5baf1dddd5 Buildbot related files have been moved to own repository 2021-05-28 10:16:39 +02:00
3ec57ce6c7 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.
2021-05-28 16:59:38 +10:00
3bee77bb7c Cleanup: use static set syntax 2021-05-28 16:58:50 +10:00
6b03621c01 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
2021-05-28 08:16:26 +02:00
4a1ba155d5 Merge branch 'blender-v2.93-release' 2021-05-27 21:27:48 -04:00
0a83f32d79 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
2021-05-27 19:53:23 +02:00
758c115103 Fix own crash in today's rBf68288a8746f. 2021-05-27 19:32:35 +02:00
311ffd967b 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...
2021-05-27 19:32:35 +02:00
530f2994e9 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.
2021-05-27 19:05:17 +02:00
dfa3dcbab9 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
2021-05-27 17:27:38 +02:00
8590cb26a9 Merge branch 'blender-v2.93-release' 2021-05-27 17:15:39 +02:00
3025c34825 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
2021-05-27 11:06:08 -04:00
24b2482ad9 Cleanup: Fix forward declaring class with "struct" 2021-05-27 11:00:00 -04:00
a3edf4a381 Fix build error: Make CurveEval a struct
We need a pointer to this in DNA, which means it cannot be a class.
2021-05-27 10:50:43 -04:00
e8ca635e43 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.
2021-05-27 08:10:31 -06:00
ac833108db 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
2021-05-27 10:08:40 -04:00
5621a8ed7f 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.
2021-05-27 09:37:19 -04:00
a12fd5c3ad Cleanup: Use consistent variable names 2021-05-27 09:27:08 -04:00
5721c89ba8 Cleanup: rename BKE_main_id_{clear_newpoins => newptr_and_tag_clear}
It wasn't obvious this function cleared the tag as well.
2021-05-27 22:44:02 +10:00
Erik Abrahamsson
9200e73136 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
2021-05-27 22:42:41 +10:00
6ad4b8b764 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
2021-05-27 20:33:02 +08:00
f45270b4fb Cleanup: Line art variable naming.
Change `reln` to `eln`.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11411
2021-05-27 18:47:13 +08:00
42fba7f0d2 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.
2021-05-27 11:55:31 +02:00
ac2266fe57 Cleanup: Unused include in Cycles 2021-05-27 11:36:30 +02:00
2414a5787d 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.
2021-05-27 11:36:30 +02:00
7b5f4c8837 Cleanup: Redundnat member init in Cycles viewport parameters 2021-05-27 11:36:30 +02:00
616b071c4f 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.
2021-05-27 11:36:30 +02:00
15df83e9c9 Cleanup: Use logical OR in Cycles background shader 2021-05-27 11:36:30 +02:00
8f43e31a71 Cleanup: const qualifier of return type 2021-05-27 11:36:30 +02:00
4ea7742973 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.
2021-05-27 11:36:30 +02:00
bf7a67c5c6 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.
2021-05-27 11:36:30 +02:00
06d48367fa 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.
2021-05-27 10:49:31 +02:00
46e1ad711c Cleanup: inconsistent parameter name 2021-05-27 10:46:43 +02:00
ffa2a1771e Cleanup: inconsistent parameter name 2021-05-27 10:41:40 +02:00
fd0bb24e4a 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.
2021-05-27 17:59:21 +10:00
41f2ea4045 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.
2021-05-27 17:59:21 +10:00
1276d0024f Cleanup: specify array sizes, remove warnings in comments 2021-05-27 17:59:21 +10:00
f0342065b1 Cleanup: spelling 2021-05-27 17:59:21 +10:00
2ad3a1c318 Nodes: fix material node copied over when socket is copied
This was missing from rB207472930834a2916cf18bbdff51bcd77c6dd0c0.
2021-05-27 09:58:45 +02:00
223c6e1ead 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
2021-05-27 09:43:11 +02:00
7d20cf92dd 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.
2021-05-27 16:44:21 +10:00
deb71cef38 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).
2021-05-27 16:44:21 +10:00
a10e41b02e Cleanup: Remove completed "TODO" comment
Since rBb67fe05d4bea, the dependency graph supports relations
on collection geometry, and the nodes modifier uses that.
2021-05-26 22:32:53 -04:00
b132dd042e 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.
2021-05-26 22:22:09 -04:00
c97b6215a3 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
2021-05-26 22:14:59 -04:00
f3944cf503 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
2021-05-26 20:02:35 -06:00
Germano Cavalcante
6fc9ec9257 Cleanup: Specify amount of buffers through preprocessor directives 2021-05-26 22:52:59 -03:00
e5b51cb511 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.
2021-05-26 21:12:38 -04:00
2c607ec2f6 Revert "DrawManager: Use Compute Shader to Update Hair."
This reverts commit 8f9599d17e.

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

```
2021-05-26 20:32:05 +02:00
7438f0c6c0 Cleanup: array-parameter warning with GCC 11
Pass the string size as this is less error prone in general.
2021-05-27 02:32:44 +10:00
de3d54eb9a 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`.
2021-05-26 18:23:31 +02:00
df32b50344 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
2021-05-27 01:52:45 +10:00
6b00df1105 Cleanup: shadow warning
Move reproject_type into an extern, to avoid declaring multiple times.
2021-05-27 01:52:45 +10:00
72d660443b 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.
2021-05-26 17:05:01 +02:00
51ca9833d9 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.
2021-05-26 17:05:01 +02:00
daf39af70a 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...
2021-05-26 17:05:01 +02:00
653d39cec3 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.
2021-05-26 17:05:01 +02:00
6cbe5dd1c3 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.
2021-05-26 17:05:01 +02:00
ee849ca0f8 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.
2021-05-26 17:05:00 +02:00
Jeroen Bakker
8f9599d17e 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
2021-05-26 17:03:37 +02:00
Jeroen Bakker
87055dc71b 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
2021-05-26 16:49:30 +02:00
e459a25e6c 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
2021-05-26 16:46:20 +02:00
a6f3bb36df Merge branch 'blender-v2.93-release' 2021-05-26 16:34:03 +02:00
3f27efd31e Merge branch 'blender-v2.93-release' 2021-05-26 16:20:24 +02:00
06f86dd4d9 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
2021-05-26 15:43:40 +02:00
b67423f806 Nodes: fix threading issues with node ui storage
Calling BKE_nodetree_attribute_hint_add from multiple threads still
was not safe before..
One issue was that context_map embedded its values directly. So
when context_map grows, all NodeUIStorage would move as well.
I could patch around that by using std::unique_ptr in a few places,
but that just becomes too complex for now.
Instead I simplified the locking a bit by adding just locking a mutex
in NodeTreeUIStorage all the time while an attribute hint is added.

Differential Revision: https://developer.blender.org/D11399
2021-05-26 14:19:01 +02:00
afec66c024 Fix T88588: crash when muting node with multi input socket
The bug existed before the new evaluator already, but the new evaluator
is more sensitive to this kind of error.
2021-05-26 12:25:48 +02:00
12a06292af Cycles: optimize attributes device updates
When an `AttributeSet` is tagged as modified, which happens after the addition or
removal of an `Attribute` from the set, during the following GeometryManager device
update, we update and repack the kernel data for all attribute types. However, if we
only add or remove a `float` attribute, `float2` or `float3` attributes should not
be repacked for efficiency.

This patch adds some mechanisms to detect which attribute types are modified from
the AttributeSet.

Firstly, this adds an `AttrKernelDataType` to map the data type of the Attribute to
the one used in the kernel as there is no one to one match between the two since e.g.
`Transform` or `float4` data are stored as `float3s` in the kernel.

Then, this replaces the `AttributeSet.modified` boolean with a set of flags to detect
which types have been modified. There is no specific flag type (e.g.
`enum ModifiedType`), rather the flags used derive simply from the
`AttrKernelDataType` enumeration, to keep things synchronized.

The logic to remove an `Attribute` from the `AttributeSet` and tag the latter as modified
is centralized in a new `AttributeSet.remove` method taking an iterator as input.

Lastly, as some attributes like standard normals are not stored in the various
kernel attribute arrays (`DeviceScene::attribute_*`), the modified flags are only
set if the associated standard corresponds to an attribute which will be stored
in the kernel's attribute arrays. This makes it so adding or removing such attributes
does not trigger an unnecessary update of other type-related attributes.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11373
2021-05-26 12:18:28 +02:00
2a09634d41 Fix particlesystem not duplicating their pointcache in NO_MAIN case.
Sharing data between duplicated IDs should be restricted to depsgraph
(CoW) cases, not all NO_MAIN ones...

While this was probably not an issue currently, we aim at using more and
more out-of-main IDs for temp data processing.

NOTE: Somewhat related to T88555, and similar issue as the one fixed in
rBdfb963c70df5.
2021-05-26 11:25:51 +02:00
534fcab994 Fix T88552: Cycles changing Render Passes in viewport does not work 2021-05-26 11:16:47 +02:00
a72a580948 Cleanup: Simplify Cycles viewport parameters
Use early output and access shading RNA object only once.
2021-05-26 11:10:56 +02:00
e6c0e6c2a9 Compositor: Use BLI_color in convert alpha node.
Recently the CPP colors module landed in master. This patch will use the
new module in the convert alpha node.
2021-05-26 10:46:46 +02:00
1e6b028580 Cleanup: Remove unused argument in Cycles sync
Makes it easier to see where exactly the viewport is used.
2021-05-26 10:45:27 +02:00
09e77f904d Fix T88534: Unable to add a Geometry Node Tree on Volume object
Volumes are supported, poll corrected.

Maniphest Tasks: T88534

Differential Revision: https://developer.blender.org/D11378
2021-05-26 10:28:16 +02:00
03c0fa1cdb Fix T88531: Mantaflow problem with geometry nodes
Objects modified by geometry nodes modifiers were not caught as being
"dynamic".

Now add this modifier type to the list of modifiers making them "dynamic"
in the eyes of mantaflow.

(noticed by @sebbas in chat)

Maniphest Tasks: T88531

Differential Revision: https://developer.blender.org/D11389
2021-05-26 10:21:39 +02:00
b813007a0f Fix T88566: Mantaflow inflow with shapekeys is not working anymore
(regression)

Code was actually checking for shapekeys, but these were not detected
properly (some effects like shape keys are added as virtual modifiers
before the user created modifiers)

Now go over virtual modifiers as well.

Maniphest Tasks: T88566

Differential Revision: https://developer.blender.org/D11388
2021-05-26 10:17:55 +02:00
ff35332610 Merge branch 'blender-v2.93-release' 2021-05-26 09:55:47 +02:00
c0bb7d9cb7 Cleanup: Fix short comparison with bool warning
For some reason the hide status is stored in a short and a char
(we cannot have bools in DNA).
2021-05-25 14:37:58 -04:00
95690dd362 Bump FFmpeg version from 4.2.3 to 4.4
Bump FFmpeg version to 4.4 to fix a problem where it would write the
wrong frame rate. Their old API was deprecated and Blender moved to the
new one in rB8d6264ea12bfac0912c7249f00af2ac8e3409ed1. The new one
produced files with the wrong frame rate, which was fixed in FFmpeg 4.4.

Manifest Task: T88568

Reviewed By: LazyDodo, zeddb

Differential Revision: https://developer.blender.org/D11392
2021-05-25 18:58:28 +02:00
490dd279cc deps: Fix broken boost link 2021-05-25 10:27:48 -06:00
45b28c0f88 GPencil: Add a use_light option when creating object.
This option is default off when creating line art objects
because line art seldom use lighting and the normal data
would be all over the place anyway.

Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D11372
2021-05-25 23:45:47 +08:00
9f60188cd8 Cleanup: Use ListBase in various places in line art.
This clarifies the data structures for storing edges
for different calculation stages.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11386
2021-05-25 23:32:04 +08:00
Jeroen Bakker
cb8a6814fd Blenlib: Explicit Colors.
Colors are often thought of as being 4 values that make up that can make any color.
But that is of course too limited. In C we didn’t spend time to annotate what we meant
when using colors.

Recently `BLI_color.hh` was made to facilitate color structures in CPP. CPP has possibilities to
enforce annotating structures during compilation and can adds conversions between them using
function overloading and explicit constructors.

The storage structs can hold 4 channels (r, g, b and a).

Usage:

Convert a theme byte color to a linearrgb premultiplied.
```
ColorTheme4b theme_color;
ColorSceneLinear4f<eAlpha::Premultiplied> linearrgb_color =
    BLI_color_convert_to_scene_linear(theme_color).premultiply_alpha();
```

The API is structured to make most use of inlining. Most notable are space
conversions done via `BLI_color_convert_to*` functions.

- Conversions between spaces (theme <=> scene linear) should always be done by
  invoking the `BLI_color_convert_to*` methods.
- Encoding colors (compressing to store colors inside a less precision storage)
  should be done by invoking the `encode` and `decode` methods.
- Changing alpha association should be done by invoking `premultiply_alpha` or
  `unpremultiply_alpha` methods.

# Encoding.

Color encoding is used to store colors with less precision as in using `uint8_t` in
stead of `float`. This encoding is supported for `eSpace::SceneLinear`.
To make this clear to the developer the `eSpace::SceneLinearByteEncoded`
space is added.

# Precision

Colors can be stored using `uint8_t` or `float` colors. The conversion
between the two precisions are available as methods. (`to_4b` and
`to_4f`).

# Alpha conversion

Alpha conversion is only supported in SceneLinear space.

Extending:
- This file can be extended with `ColorHex/Hsl/Hsv` for different representations
  of rgb based colors. `ColorHsl4f<eSpace::SceneLinear, eAlpha::Premultiplied>`
- Add non RGB spaces/storages ColorXyz.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D10978
2021-05-25 17:16:54 +02:00
00955cd31e Revert "Blenlib: Explicit Colors."
This reverts commit fd94e03344.
does not compile against latest master.
2021-05-25 17:03:54 +02:00
Jeroen Bakker
fd94e03344 Blenlib: Explicit Colors.
Colors are often thought of as being 4 values that make up that can make any color.
But that is of course too limited. In C we didn’t spend time to annotate what we meant
when using colors.

Recently `BLI_color.hh` was made to facilitate color structures in CPP. CPP has possibilities to
enforce annotating structures during compilation and can adds conversions between them using
function overloading and explicit constructors.

The storage structs can hold 4 channels (r, g, b and a).

Usage:

Convert a theme byte color to a linearrgb premultiplied.
```
ColorTheme4b theme_color;
ColorSceneLinear4f<eAlpha::Premultiplied> linearrgb_color =
    BLI_color_convert_to_scene_linear(theme_color).premultiply_alpha();
```

The API is structured to make most use of inlining. Most notable are space
conversions done via `BLI_color_convert_to*` functions.

- Conversions between spaces (theme <=> scene linear) should always be done by
  invoking the `BLI_color_convert_to*` methods.
- Encoding colors (compressing to store colors inside a less precision storage)
  should be done by invoking the `encode` and `decode` methods.
- Changing alpha association should be done by invoking `premultiply_alpha` or
  `unpremultiply_alpha` methods.

# Encoding.

Color encoding is used to store colors with less precision as in using `uint8_t` in
stead of `float`. This encoding is supported for `eSpace::SceneLinear`.
To make this clear to the developer the `eSpace::SceneLinearByteEncoded`
space is added.

# Precision

Colors can be stored using `uint8_t` or `float` colors. The conversion
between the two precisions are available as methods. (`to_4b` and
`to_4f`).

# Alpha conversion

Alpha conversion is only supported in SceneLinear space.

Extending:
- This file can be extended with `ColorHex/Hsl/Hsv` for different representations
  of rgb based colors. `ColorHsl4f<eSpace::SceneLinear, eAlpha::Premultiplied>`
- Add non RGB spaces/storages ColorXyz.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D10978
2021-05-25 17:01:26 +02:00
b046bc536b Fix T88096: Baking with OptiX and displacement fails
Using displacement runs the shader eval kernel, but since OptiX modules are not loaded when
baking is active, those were not available and therefore failed to launch. This fixes that by falling
back to the CUDA kernels.
2021-05-25 16:56:16 +02:00
8cd506639a Geometry Nodes: Add Shader Curve Nodes
Convert curve vec and curve rgb shader nodes to geometry nodes, based on node_shader_valToRgb.cc implementation.
2021-05-25 15:43:51 +01:00
54ae7baa4c Cleanup: Line art naming changes.
Make variable naming consistent with struct names.

Reviewed By: Sebastian Parborg (zeddb)

Differential Revision: https://developer.blender.org/D11382
2021-05-25 22:11:06 +08:00
c3c576c8c4 Cleanup: Convert to static type directly from CPPType 2021-05-25 09:52:08 -04:00
a20ef4207d Fix T86956: VSE shading mode ignores Grease Pencil Vertex colors.
Issue is that due to the strange definition of render in grease pencil
(meaning should be rendered similar to rendering). This included normal
viewport rendering in OB_RENDER and OpenGL render in OB_RENDER.

For other rendering modes the overlay vertex opacity would be used. This
patch sets this value to 1 when rendering via a scene strip override.

NOTE: that this isn't a good solution as I expect that users want to use
the opacity of the Grease pencil object. Perhaps the GPencil team has a
better solution for it.
2021-05-25 15:18:06 +02:00
1bdd5becc7 Unreported fix: vertex colors overlay not set for new 3d views.
Found during researching {T86956}.
2021-05-25 15:18:06 +02:00
5fddb5ab62 Merge branch 'blender-v2.93-release' 2021-05-25 15:09:54 +02:00
cccfcca33d Cleanup: use nullptr 2021-05-25 13:37:50 +02:00
067587e329 Cleanup: remove unused function 2021-05-25 13:12:54 +02:00
405534c756 Cleanup: remove unnecessary lambda capture 2021-05-25 13:10:44 +02:00
768d4c6cfe Fix T88549: ID sorting tests.
Forgot to initialize the ID types array...

Weird though that this only failed on Windows!

Thanks a lot to @deadpin for helping investigating this.
2021-05-25 12:16:24 +02:00
0a7bd3b6d2 Fix T88464: Incorrect baking with camera markers.
This will update active camera based on the maker for each frame.

Reviewed By: Sebastian Parborg (zeddb), Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D11358
2021-05-25 16:51:26 +08:00
e3faef686d Fix/Refactor RNA ID preview getter creating preview data.
Same as with forcefields, accessors should never generate data.
2021-05-25 10:38:56 +02:00
ad447705c0 Cleanup: spelling 2021-05-25 18:25:55 +10:00
8c7766dc03 Cleanup: clang-format 2021-05-25 18:25:44 +10:00
Pratik Borhade
0606a37e1a Fix T88500: Constrain window top position (Win32)
Do not allow a window to be created that has a top position that
can obscure all or part of title bar. Right and Left edges can
still be specified slightly outside of monitor bounds, but top
edge must be clamped to monitor top.

see D11371 for more details.

https://developer.blender.org/D11371

Reviewed by Ray Molenkamp
2021-05-24 11:46:35 -07:00
9c53690b30 Merge branch 'blender-v2.93-release' 2021-05-24 12:30:24 -03:00
1318cb26fe Cleanup: Refactor PlaneTrack and PlaneDistort operations
Deduplicates code by introducing a PlaneDirtortBaseOperation for common logic.

Reviewed By: #compositing, jbakker

Differential Revision: https://developer.blender.org/D11273
2021-05-24 14:31:55 +02:00
Charlie Jolly
6c2c16b5f8 Nodes: move shader curves node to C++
Prepare node for conversion to Geometry Nodes.

There should be no functional changes.

Reviewed By: JacquesLucke, LazyDodo

Differential Revision: https://developer.blender.org/D11226
2021-05-24 12:02:49 +01:00
24004e74fa Fix T88524: GPencil PDF does not take into account the marker camera
The camera was not checked before doing the export.
2021-05-24 12:36:13 +02:00
43153e2324 Fix T88466: Sound strips prevent strip rendering
When sound strip is above another strip such as movie strip, it prevents
from rendering movie strip.

This bug was introduced in 0b7744f4da. Function `must_render_strip()`
checks if there is any strip with `SEQ_BLEND_REPLACE` blending and
considers this strip as lowest strip in stack. Sound strips do have this
blend mode set, which caused the bug.

Remove all sound strips and muted strips from stack collection before
checking with `must_render_strip()` function
2021-05-24 05:57:53 +02:00
7e841c797f UI: Use title case for labels 2021-05-23 15:31:54 -04:00
9dcbc195ad Docs: Add readme for mikktspace 2021-05-23 13:57:22 -04:00
f7b22fc3d2 Cleanup: remove redundant property for transfer_mode key-map item
As the property isn't saved and defaults to disabled,
there is no need to set it.
2021-05-22 14:53:41 +10:00
7adbe62a09 Cleanup: tweaks for Object Non-modal keymap
Simplify adding non-legacy keymap items.
2021-05-22 13:14:28 +10:00
2175cbe2ce Cleanup: Move curve draw cache implementation to C++
I'd like to use this file to draw curves from geometry nodes, which
would otherwise require implementing a C API. The changes in this
commit are minimal, mostly just casts and changing to nullptr.

Differential Revision: https://developer.blender.org/D11350
2021-05-21 17:28:29 -04:00
2521e17a58 Merge branch 'blender-v2.93-release' 2021-05-21 14:44:17 -04:00
Wayde Moss
9c4ecef62f Fix T88375: Bone Size Small After V3D.View_All
The wrong matrix function was used and overwrote the custom bone shape
scale instead of reading from it.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D11330
2021-05-21 13:24:55 -04:00
4fb052f08d Fix T88384: Improved Win32 Window Sizing and Positioning
When creating Win32 windows, the sizes and placements can be out by a
small amount, mostly noticeable near monitor edges. This is because
Windows 10 includes a thin invisible border (typically 7 pixels) when
determining position. Therefore the correct values can sometimes be
just outside the monitor bounds, but we clamp them at those bounds.

This patch fixes this by first clamping the requested values to monitor
bounds, adjusting for window chrome with AdjustWindowRectEx(), and then
using those adjusted values in CreateWindowExW().

see D11314 for more details.

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

Reviewed by Ray Molenkamp
2021-05-21 09:34:58 -07:00
24deeee09e Fix some RNA physics accessors creating data.
Accessing data through RNA should never implicitely create it. Objects'
and particles' forcefields and collision settings were doing this.

Note that UI code also had to be tweaked to properly handle `None`
(NULL) cases.

Differential Revision: https://developer.blender.org/D11341
2021-05-21 17:22:43 +02:00
adf2f146d8 Fix particle ID init not creating particle deflect data.
This data (the force fields) are expected to always be there, but they
are currently created on the fly by RNA accessors (typically from UI
draw code), which is extremely wrong way to do it.

Differential Revision: https://developer.blender.org/D11341
2021-05-21 17:22:43 +02:00
305b08b521 GPencil: Speed up Occlude Eraser
This is an initial change to speed up the calculation of the Occlude eraser. In the future, we can add more optimizations, but at least this increase speed.

Intead to check always the 3 points, the check is skipped if it's not required.

Base in a solution by Philipp Oeser.

This is related to T88412
2021-05-21 17:00:33 +02:00
5158d1b42d Cleanup: use nullptr 2021-05-21 15:09:22 +02:00
Leon Zandman
865d1889da Cleanup: spelling
Includes fixes to misspelled function names.

Ref D11280
2021-05-21 22:23:07 +10:00
cf42586737 Fix T85752: Collection Instance Crash when instancing collections with disabled subcollections
Root of the issue was actually hidden deep in depsgraph itself: it would
not properly update all of its COW IDs using a datablock when depsgraph
decides to evaluate or un-evaluate it.

This would lead to evaluated IDs pointing to either:
 - orig IDs when there was an evaluated version of those (annoying bug,
   but not a crashing one).
 - old address of previously evaluated IDs that no longer exists in the
   depsgraph (causing the crash from the report e.g.).

This commit adds an extra step at the end of nodes building, that goes
over all of already existing IDs in the depsgraph to check whether they
do one of the two things above, and tag them for COW update if so.

NOTE: This only affects depsgraph (re-)building, not its evaluation.
This remains consistent with the fact that operations that may change
the depsgraph content (like Collection exclusion etc.) need to trigger a
rebuild.

NOTE: Performances: Worst case scenarii, like (un-)excluding a whole
character collection in a production file, lead to 5% to 10% extra
processing time in depsgraph building. Most of it comming from extra COW
processing (in depsgraph's update in `build_step_finalize`), the detection
loop itself only accounts for 1% to 2% of the whole building time.

Maniphest Tasks: T85752

Differential Revision: https://developer.blender.org/D10907
2021-05-21 12:43:32 +02:00
ff51c2e89a Cleanup: Use named unused arguments in Cycles Device 2021-05-21 11:19:33 +02:00
c154b078b5 Geometry Nodes: new Material Replace node
This node can change all faces that use a specific material to use a
different material. Using this node is significantly more efficient
than creating a selection from all faces with a specific material
index and then using the Material Assign node.

Ref T88055.

Differential Revision: https://developer.blender.org/D11325
2021-05-21 09:43:55 +02:00
aa6f0f3d1f Depsgraph: remove mesh edit-mode pointer duplication
Share the pointer with the original mesh instead, this matches behavior
of all other objects edit-mode data.

Duplicating the edit-mesh pointer makes updates to edit-mesh require
a COPY_ON_WRITE update, which is currently an expensive operation
(copying the entire mesh).

Notes:

- This change is from 802027f3f8
  so the edit-meshes object pointer `BMEditMesh.ob` referenced the COW
  version of the object. This pointer has since been removed, so the
  copy is no longer needed.

- Having a separate edit-mesh pointer could be used so linked duplicates
  could have their own generated meshes. For this to be supported,
  many other changes would be needed: see D10920.
2021-05-21 16:23:42 +10:00
12a91f7f5d Fix T88227: Eevee not working on AMD 535 cards.
Enabled HQ normals workaround for this specific configuration.
2021-05-21 07:46:20 +02:00
2b640622ff Transform: use ID_RECALC_GEOMETRY flag when updating object data
While this doesn't provide any noticeable benefits at the moment,
it allows for geometry updates skipping copy-on-write in edit-mode
in the future.
2021-05-21 15:45:25 +10:00
b13953b1f2 Cleanup: quiet -Warray-parameter warnings from GCC11
Some warnings remain that require larger changes.
2021-05-21 15:45:25 +10:00
6c6551c398 Cleanup: conversion warning 2021-05-21 15:45:23 +10:00
Iyad Ahmed
a43c7538b8 Eevee Wavelength Node Support
This patch adds wavelength node support to Eevee, similar to how
Eevee Blackbody node works, thus it is a little off from Cycles.

Reviewed By: #eevee_viewport, fclem, brecht
Differential Revision: https://developer.blender.org/D11326
2021-05-21 10:25:47 +05:30
b18d5dac53 Transform: remove ID_RECALC_SELECT for edit-mode armatures
This was added in 9516921c05
so overlays would redraw, as far as I can see it's no longer needed.

Reviewed By: fclem

Ref D11322
2021-05-21 10:58:07 +10:00
ba9cf91736 Cleanup: spelling 2021-05-21 01:06:20 +02:00
695fa3a4a1 Merge branch 'blender-v2.93-release' 2021-05-20 20:48:44 +02:00
1400fdf558 Fix petty comment.
I'm embarrassed this was in our codebase for 18 years
2021-05-20 12:38:01 -06:00
ef04fd9571 GPencil: Fix missing annotations in VSE strip
Since version 2.80, the annotations of the Scene strip were not displayed in VSE. Also, the UI panel was`Grease Pencil` and must be `Annotation`

The problem was the offscreen render hasn't evil_CTX and the section of the annotation was never called.

Differential Revision: https://developer.blender.org/D11329
2021-05-20 20:16:59 +02:00
677909cdc3 Merge branch 'blender-v2.93-release' into master 2021-05-20 21:58:34 +05:30
9fef934530 Merge branch 'blender-v2.93-release' 2021-05-20 12:20:05 -04:00
cd16123761 GPencil: Adding length modifier.
Reviewed By: Antonio Vazquez (antoniov)

Differential Revision: https://developer.blender.org/D8264
2021-05-20 23:35:53 +08:00
933999db75 Cleanup: rename incorrectly named experimental feature flag
The `WITH_GEOMETRY_NODES` flag does not make sense anymore,
it is just protecting the `Simulation` data block that is not used
currently.
2021-05-20 14:39:30 +02:00
0745afeddb Merge remote-tracking branch 'origin/blender-v2.93-release' 2021-05-20 13:00:07 +02:00
3e3ecc329c Geometry Nodes: new Material input node
This node is similar to the Value and Vector node.
It just provides a way to use the same material in multiple nodes
without exposing it outside of a node group.

Differential Revision: https://developer.blender.org/D11305
2021-05-20 12:29:06 +02:00
f41a753e75 Geometry Nodes: new Material Assign node
This adds a new Material Assign node. It can be used to change the
material used by an existing mesh or to assign a material to a mesh
that has been generated from scratch.

Differential Revision: https://developer.blender.org/D11155
2021-05-20 12:22:13 +02:00
f3a0267016 Materials: support materials when applying modifier
This fixes the `Apply Modifier` and `Visual Geometry to Mesh` operator
when a modifier changed materials on the evaluated geometry.

This is necessary since rB1a81d268a19f2f1402f408ad1dadf92c7a399607.

Differential Revision: https://developer.blender.org/D11303
2021-05-20 12:15:57 +02:00
b51bd859fd Fix: wrong rna pointer for material slot
This was missing from rB1a81d268a19f2f1402f408ad1dadf92c7a399607.
2021-05-20 12:14:31 +02:00
b084b57fbf Geometry Nodes: new geometry nodes evaluator
The old geometry nodes evaluator was quite basic and missed many features.
It was useful to get the geometry nodes project started. However, nowadays
we run into its limitations from time to time.

The new evaluator is more complex, but comes with new capabilities.
The two most important capabilities are that it can now execute nodes in
parallel and it supports lazy evaluation.

The performance improvement by multi-threading depends a lot on the specific
node tree. In our demo files, the speedup is measurable but not huge. This
is mainly because they are bottlenecked by one or two nodes that have to be
executed one after the other (often the Boolean or Attribute Proximity nodes)
or because the bottleneck is multi-threaded already (often openvdb nodes).

Lazy evaluation of inputs is only supported by the Switch node for now.
Previously, geometry nodes would always compute both inputs and then just
discard the one that is not used. Now, only the input that is required
is computed.

For some more details read D11191, T87620 and the in-code documentation.

Differential Revision: https://developer.blender.org/D11191
2021-05-20 11:35:13 +02:00
44e7192745 Cleanup: spelling 2021-05-20 17:55:35 +10:00
a5ac062c51 Cleanup: inconsistent parameter names 2021-05-20 09:00:42 +02:00
7655cc45eb VSE: Fix select strips at current frame feature
This feature of `select_side_of_frame` was disabled by removing option
from operator property enum but functional code was never removed.

Add back option to use this feature.

Feature was disabled due to keymap issue. Currently this feature doesn't
have keymap assigned.
2021-05-20 05:06:32 +02:00
acba8f617b Cleanup: Remove unused define
References to `SEQ_CACHE_COST_MAX` were removed in 38b77ef8b2.
2021-05-20 04:25:56 +02:00
47e88345a1 VSE: Fix animation duplication in split operator
Due to misunderstanding of how strip duplication works, animation data
was duplicated on all strips when any strip was split.

`SEQ_sequence_base_dupli_recursive()` duplicated data on strip that was
being split, and `SEQ_ensure_unique_name()` duplicated animation on all
strips.

Only duplication should be done with `SEQ_ensure_unique_name()` and only
on right side split strips, because only these strips are duplicated.
2021-05-20 01:27:12 +02:00
d1c9a99c07 Splines: Optimize interpolation in special case virtual array
When the input data is a virtual array for a single value, we don't need
to run any of the interpolation, instead just copy the input data.
2021-05-19 17:17:16 -04:00
0b7744f4da VSE: Fix rendering inconsistency
Fix issue described in T87678, which was partially a bug and partially
change in intended(at least as far as I can tell) behaior.

Function `evaluate_seq_frame_gen` that was partially responsible for
filtering strips in stack for rendering wasn't working correctly.
Intended functionality seems to be removing all effect inputs from stack
as it is unlikely that user would want these to be blended in. However
there was logic to exclude effects placed into same input, which because
of weak implementation caused, that any effect input, that is effect as
well will be considered to be part of stack to be blended in.
This bug was apparently used to produce effects like glow over original
image.

Even though this is originally unintended, I have kept this logic, but
I have made it explicit.

Another change is request made in T87678 to make it possible to keep
effect inputs as part of stack when they are placed above the effect,
which would imply that blending is intended. This change is again
explicitly defined.

Whole implementation has been refactored, so logic is consolidated
and code should be as explicit as possible and more readable.
`must_render_strip function` may be still quite hard to read, not sure
if I can make it nicer.

Last change is for remove gaps feature code - it used same rendering
code, which may be reason why its logic was split in first place.
Now it uses sequencer iterator, which will definitely be faster than
original code, but I could have used `LISTBASE_FOREACH` in this case.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11301
2021-05-19 22:59:33 +02:00
97cf2a9fb1 VSE: Refactor sorting functions
Recently `SEQ_sort()` function was split so functionality is provided
on per-seqbase basis. After discussion about this split, it turned out,
that per-seqbase operation is only that should be provided, because
RNA API functions need to be able to access arbitrary seqbase

Remove recently introduced function `seq_sort_seqbase` and change
`SEQ_sort` function to operate on seqbase.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11297
2021-05-19 22:52:57 +02:00
58893eaef8 Cleanup: Use consistent order for functions in node files
After this commit, all geometry node "init" and "update" functions are
at the top of each file, right below the "layout" function. This means
you can always scroll to the bottom of the file to see the entry point,
and the boring boilerplate code is grouped in one section.
2021-05-19 16:13:05 -04:00
3d604ba867 Geometry Nodes: Execute point rotate node on curve component
When adding attributes on the curve component, I missed calling this
node's execute function on the curve component, like the other nodes.
2021-05-19 15:58:34 -04:00
627f357127 Geometry Nodes: Support for dynamic attributes on curve splines
With this patch you will be able to add and remove attributes from curve
data inside of geometry nodes. The following is currently implemented:
* Adding attributes with any data type to splines or spline points.
* Support for working with multiple splines at the same time.
* Interaction with the three builtin point attributes.
* Resampling attributes in the resample node.

The following is not implemented in this patch:
* Joining attributes when joining splines with the join geometry node.
* Domain interpolation between spline and point domains.
* More efficient ways to call attribute operations once per spline.

Differential Revision: https://developer.blender.org/D11251
2021-05-19 13:22:09 -04:00
192a3f1a05 Cleanup: Use copy constructor for CurveEval
There is no need for a special "copy" method with a copy constructor,
which will be necessary to explicitly copy attributes anyway.
2021-05-19 13:02:53 -04:00
Severin
330fecc9b7 Assets: Use textures (and shadows) for automatic object previews
Textures may be important to be able to identify an object. They are also a way
to make many objects look more like when rendered with an advanced render
engine, without being that expensive.
So this seems like a simple way to increase usefulness of the automatic
previews.
2021-05-19 17:57:51 +02:00
857f39a3d7 GPencil: Apply NanoSVG fix
This fix is ported from official NanoSVG git
2021-05-19 17:56:26 +02:00
23b642cbb4 IDManagement: Enable ID sorting test for linked IDs. 2021-05-19 17:50:22 +02:00
ca74ebc96e IDManagement: Do not prevent sorting of linked IDs in BKE_id_new_name_validate.
While this function should (currently) not be called on linked ID, there
is no reason to treat those differently than local IDs, for the part
that they have in common: needs to be properly sorted.
2021-05-19 17:50:22 +02:00
3620dbbe97 IDManagement: Fix ID sorting in case of linked IDs.
`id_sort_by_name` would simply not deal properly with linked IDs, could
lead to mixing IDs from different libraries, and unsorted IDs within the
same library.
2021-05-19 17:50:22 +02:00
c810672ea7 IDManagement: Add basic test regarding id sorting in their listbase.
Note that while sorting of local IDs is fine, currently sorting of
linked IDs is a total unpredictable failure.

Next commit will fix this, ensuring that linked IDs are grouped by their
library, and properly name-sorted within this library group.
2021-05-19 17:50:22 +02:00
ee5ad46a0e Fix T87621: Win32 Do Not Create Preview Thumbnails for Offline Files
This patch turns off the creation of file thumbnails for files that are
offline and therefore not fully-present on the file system. These types
of files - typically cloud-based or stored on slower backup media -
only have their contents available when actually accessed, at which
point there will be a short delay. If we allow thumbnail creation in
this state then all offline files in a folder will be downloaded just
to view a listing, which can take a long time.

Files in this state will instead get a more generic thumbnail that
still indicates file type (icon in center) and that shows offline state
will a special icon at the bottom-left.

Although this currently only affects Windows users, most of this patch
is platform-agnostic. So other platforms inherit this behavior if they
only add FILE_ATTR_OFFLINE attribute to files in this state.

See D11101 for more information.

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

Reviewed by Julian Eisel
2021-05-19 08:40:00 -07:00
0fa4286ade Blender LTS: match download urls with latest changes in buildbot. 2021-05-19 16:39:22 +02:00
38450fc916 Merge branch 'blender-v2.93-release' 2021-05-19 13:58:16 +02:00
afb66b3c3a Cleanup: use nullptr 2021-05-19 13:04:12 +02:00
c5a898bcac Merge branch 'blender-v2.93-release' 2021-05-19 12:32:06 +02:00
81e3d904db Merge branch 'blender-v2.93-release' 2021-05-19 12:17:23 +02:00
7adb415070 Geometry Nodes: don't show grease pencil materials for now
Those materials cannot be on geometry handled by geometry nodes yet.
So it makes sense not to show those materials in the material socket.
2021-05-19 11:44:10 +02:00
5e6f3b8564 Geometry Nodes: take materials into account when joining geometries
Materials are now kept intact when using the Join Geometry node
or when realizing instaces.
2021-05-19 11:02:25 +02:00
02b80276b3 Fix issue in previous commit
When `PointerRNA->data` was null, it was interpreted as being
`None` in Python. This caused the materials slots to not show
correctly in the ui.
2021-05-19 10:51:36 +02:00
1a81d268a1 Materials: support changing materials during evaluation
This commit allows that the evaluated geometry of an object has
different materials from the original geometry. This is needed
for geometry nodes.

The main thing that changes for render engines and exporters
is that the number of material slots on an object and its geometry
might not match anymore. For original data, the slot counts are
still equal, but not for evaluated data.

Accessing material slots though rna stays the same. The behavior
adapts automatically depending on whether the object is evaluated.

When accessing materials of an object through `BKE_object_material_*`
one has to use a new api for evaluated objects:
`BKE_object_material_get_eval` and `BKE_object_material_count_eval`.
In the future, the different behavior might be hidden behind a more
general C api, but that would require quite a few more changes.

The ground truth for the number of materials is the number of materials
on the geometry now. This is important in the current design, because
Eevee needs to know the number of materials just based on the mesh in
`mesh_render_mat_len_get` and similar places.

In a few places I had to add a special case for mesh edit mode to get it
to work properly. This is unfortunate, but I don't see a way around that
for now.

Differential Revision: https://developer.blender.org/D11236
2021-05-19 10:23:09 +02:00
d373b43f07 VSE: Better handling of effect strip splitting
Splitting of effect strip alone wasn't handled properly. Previously
this resulted in duplicating effect strip, and it was broken at least
from 2.79.

Change in rB8ec6b34b8eb2 was intended to allow splitting strips
individually, so it can be used as RNA API function but also so it
requires as little glue logic as possible.

This is fixed by splitting all dependent strips at once in 2 separate
ListBases for left and right strips. Strips can be finally moved into
original `ListBase`.

With this fix it is still possible to split strips individually with
little glue logic. RNA API function could return list of split strips
as well, currently at least one strip in chain will be provided so
chain can be reconstructed on python side.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10209
2021-05-18 23:41:47 +02:00
f7a14c116c VSE: Move whole strip chain to meta
Python API function Sequence.move_to_meta() did delete effect chain
when strip with effects was moved.

Use iterator API to query effect strips and move whole chain to meta.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D11206
2021-05-18 23:41:47 +02:00
748b5f025d Merge branch 'blender-v2.93-release' 2021-05-18 22:37:38 +02:00
5400be9ffe Fix T88313: GPencil reproject operator projecting on the wrong surface
`ray_start` must start at the position of the gpencil point.
2021-05-18 17:31:10 -03:00
f9567f6c63 Alembic: read/write generated coordinates of meshes
Read and write generated coordinates (also known as "original
coordinates", "reference coordinates", or "orcos") from and to Alembic.
A custom geometry property named "Pref" is used for (hopefully)
interoperability with Maya and Houdini. For now it's only guaranteed for
Blender-to-Blender.

Export: writing generated coordinates is optional (on by default).

Import: generated coordinates are always read whenever the reading of
vertex data is enabled.

Manifest Task: T88081
2021-05-18 19:01:57 +02:00
a881b5272b Fix ID copying outside of Main affecting 'directly linked' status of other IDs.
Copying an ID outside of BMain should not assume that the datablocks it
uses are now directly linked. This would be wrong e.g. in case that new
no-main ID is copied from a linked data-block and is supposed to remain
a linked data.
2021-05-18 18:44:39 +02:00
3826c161ad Cleanup: typo in comment. 2021-05-18 18:44:39 +02:00
019ab774d4 Merge branch 'blender-v2.93-release' 2021-05-18 16:17:29 +02:00
7aa7cc4ca1 Merge branch 'blender-v2.93-release' 2021-05-18 15:43:06 +02:00
2b660e825b Fix T88365: GPUTexture.read returning a buffer with wrong size
The pixel components were not being considered.
2021-05-18 10:01:29 -03:00
ea7b00c64f Fix T88345: Blender crash on GPUFrameBuffer creation
Misuse of indexes.

`color_attachements` has only color ones while `config` has color and depth.
2021-05-18 09:39:31 -03:00
4402c3006b WM: check missing space-data & constraints in poll functions
Without this, menu search prints many errors in some contexts.
2021-05-18 20:57:40 +10:00
eaf3160f13 Merge branch 'blender-v2.93-release' 2021-05-18 12:52:29 +02:00
f4eae747f9 Tests: Remove threshold param from physics ocean mesh test
This was not the reason for the test failure on macOS arm64.
2021-05-18 12:44:53 +02:00
1f9eb7e2c6 Merge branch 'blender-v2.93-release' 2021-05-18 19:59:20 +10:00
97f1e4782a Cycles: Avoid unnecessary data updates in viewport
The BlenderSync will do quite a bit of work on every sync_data() call
even if there is nothing changed in the scene. There will be early
outputs done deeper in the call graph, but this is not really enough to
ensure best performance during viewport navigation.

This change makes it so sync_data() is only used when dependency graph
has any update tags: if something changed in the scene the dependency
graph will know it. If nothing changed there will be no IDs tagged for an
update in the dependency graph.

There are two weak parts in the current change:

- With the persistent data there is a special call to ignore the check
  of the dependency graph tags. This is more of a safety, because it is
  not immediately clear what the correct state of recalc flags is.

- Deletion of objects is detected indirectly, via tags of scene and
  collections.

It might not be bad for the first version of the change.

The test file used: {F10117322}

Simply open the file, start viewport render, and navigate the viewport.
On my computer this avoids 0.2sec spend on data_sync() on every
up[date of viewport navigation.

We can do way more granular updates in the future: for example, avoid
heavy objects sync when it is only camera object which changed. This
will need an extended support from the dependency graph API. Doing
nothing if nothing is changed is something we would want to do anyway.

Differential Revision: https://developer.blender.org/D11279
2021-05-18 10:13:09 +02:00
1c1fa15ce1 Merge branch 'blender-v2.93-release' 2021-05-18 17:48:14 +10:00
8a26fec6ea Cleanup: use const casts in mathutils API 2021-05-18 14:16:34 +10:00
4dfbaa34c9 PyAPI: allow any vector sequence for poly_3d_calc(..)
Previously only vectors were accepted for the second point argument:
mathutils.interpolate.poly_3d_calc()
2021-05-18 14:16:34 +10:00
5e67dcf3d2 Cleanup: format 2021-05-18 06:09:46 +02:00
52e53d61f5 Merge branch 'blender-v2.93-release' 2021-05-18 13:39:39 +10:00
8057b98572 Alembic procedural: fix wrong property used as base for attribute
lookups

We use the schema so that we can access top level attributes as well.
This is already done for polygon meshes and curves, so this only
modifies the behavior for subdivision objects.
2021-05-18 00:59:29 +02:00
38fe8d8b38 Alembic procedural: fix crash accessing invalid ICompoundProperties
Although it is not a pointer, accessing an ICompoundProperty
dereferences a pointer under the hood, so check for validity.
2021-05-18 00:56:45 +02:00
73080ddf38 Add comment regarding Fade Inactive Geometry property in overlays popover
Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D11249
2021-05-18 00:51:35 +02:00
f96a0f384d Merge branch 'blender-v2.93-release' 2021-05-18 00:32:48 +02:00
c17433bb55 Tests: Increased threshold param for physics_ocean test
Adjusting threshold to see what the buildbot will make of this.
2021-05-17 23:21:16 +02:00
c9afea5bbf Tests: Added threshold to physics ocean mesh test
The physics_ocean test is currently failing on macOS arm.
This is one attempt to fix this issue.
2021-05-17 21:13:35 +02:00
43046d82b7 Collada import: use black for Base Color when missing <diffuse>
Treat a missing <diffuse> the same as a black diffuse color.

The easiest way to see this bug is with a Collada shader like

```
          <constant>
            <emission>
              <color sid="emission">1 0 0 1</color>
            </emission>
          </constant>
```

The Collada spec says this should be just

```
color = <emission>
```

ie. red everywhere. The importer slots the red into the Principled Emission socket, but since it leaves the Base Color as the default off-white, this is added to red, and the material looks white-pink in the light and red only in the shadows.

Putting black in the Base Color makes it look red everywhere.

D10939 will also eliminate the much-less-noticeable specular term for this case.

Reviewed By: gaiaclary

Differential Revision: https://developer.blender.org/D10941
2021-05-17 21:10:05 +02:00
542b8da831 Merge branch 'blender-v2.93-release' 2021-05-17 20:18:39 +02:00
1b0ecb2f89 refactor: minor changes to previous commit
- rename boolean is_zero by more descriptive has_specularity
- add some clarifying comments (and TODO)
2021-05-17 20:04:56 +02:00
Scurest
1a4e7b16b2 Collada import: respect zero-specularity
Collada shaders with black <specular> should import with Specular=0.
(A missing <specular> is the same as black.)

The general specular conversion is hard, but this case is common and easy.
Fixes the specular for all <constant>/<lambert> shaders, and <blinn>/<phong>
shaders with black/omitted <specular>. Before this they all looked too "shiny".

Reviewed By: gaiaclary

Differential Revision: https://developer.blender.org/D10939
2021-05-17 19:56:01 +02:00
a86e815dd8 Mathutils: add a Matrix.LocRotScale constructor for combining channels.
Combining location, rotation and scale channels into a matrix is
a standard task, so while it is easily accomplished by constructing
and multiplying 3 matrices, having a standard utility allows for
more clear code.

The new constructor builds a 4x4 matrix from separate location,
rotation and scale values. Rotation can be represented as a 3x3
Matrix, Quaternion or Euler value, while the other two inputs
are vectors. Unneeded inputs can be replaced with None.

Differential Revision: https://developer.blender.org/D11264
2021-05-17 19:12:40 +03:00
f09606cc68 File List: micro optimization in the icon preview
No real functional changes.

When `i` is zero, `filelist_cache_previews_push` was called twice with
the same icon.

This caused the preview to be computed twice when only once is needed.
2021-05-17 09:09:12 -03:00
6cfa8531cc Cleanup: reduce indentation in filelist_cache_previews_push 2021-05-17 08:54:53 -03:00
50eceb2a37 Merge branch 'blender-v2.93-release' 2021-05-17 13:06:59 +02:00
Wannes Malfait
ba698f0812 Geometry Nodes: update callbacks with 2 new socket types 2021-05-17 11:11:25 +02:00
7e552b356d Merge branch 'blender-v2.93-release' 2021-05-17 18:04:22 +10:00
Henrik Dick
e95f71bf15 UI: use non-linear sliders
* Boolean Modifier > Fast > Overlap Threshold (Logarithmic).
* Remesh Modifier > Voxel > Voxel Size (Logarithmic).
* Sculpt > Dyntopo > Detail Size (Cubic).

Ref D9074
2021-05-17 17:33:59 +10:00
Henrik Dick
0447aedb96 UI: add non-linear slider support
This patch introduces non linear sliders. That means, that the movement
of the mouse doesn't map linearly to the value of the slider.

The following changes have been made.

- Free logarithmic sliders with maximum range of (`0 <= x < inf`)
- Logarithmic sliders with correct value indication bar.
- Free cubic sliders with maximum range of (`-inf < x < inf`)
- Cubic sliders with correct value indication bar.

Cubic mapping has been added as well, because it's used for brush sizes
in other applications (Krita for e.g.).

To make a slider have a different scale type use following line in RNA:
 `RNA_def_property_ui_scale_type(prop, PROP_SCALE_LOGARITHMIC);`
or:
 `RNA_def_property_ui_scale_type(prop, PROP_SCALE_CUBIC);`

Test the precision, step size and soft-min if you change the scale type
of a property as it will feel very different and may need tweaking.

Ref D9074
2021-05-17 17:33:55 +10:00
45863059f7 Cleanup: remove commented code, use function to access header region 2021-05-17 15:55:00 +10:00
67c40cc51c Cleanup: missing declaration warning 2021-05-17 15:22:19 +10:00
27c0d29138 Cleanup: clang-format 2021-05-17 15:12:41 +10:00
6a771175b6 Cleanup: Fix missing-braces warning on Linux / GCC 2021-05-17 15:05:14 +10:00
0e581f6196 Cleanup: Fix missing-braces warning on macOS Clang 2021-05-16 11:19:21 +05:30
49cb30bb0c Cleanup: Fix inconsistent-missing-override warning
macOS Clang
2021-05-16 11:19:04 +05:30
9dabb342ba Cleanup: Improve comments 2021-05-15 18:00:20 -05:00
4da16a0707 Cleanup: Use helper function
Use the `CurveEval` function introduced in the last commit.
2021-05-15 17:50:29 -05:00
038c6e229c Splines: Convenience methods for point offsets of multiple splines
Since spline data is stored separately for each spline, the data often
needs to be flattened into a separate array. It's helpful to have the
necessarily-sequential part of that split off into a separate method.
I've found myself using functions like these in quite a few places.
2021-05-15 17:44:33 -05:00
cb12fb78ca XR Controller Support Step 1: Internal Abstractions for OpenXR Actions
Adds internal API for creating and managing OpenXR actions at the
GHOST and WM layers. Does not bring about any changes for users since
XR action functionality is not yet exposed in the Python API (will be
added in a subsequent patch).

OpenXR actions are a means to communicate with XR input devices and
can be used to retrieve button/pose states or apply haptic feedback.
Actions are bound to device inputs via a semantic path binding
(https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-interaction-profiles),
which serves as an XR version of keymaps.

Main features:

- Abstraction of OpenXR action management functions to GHOST-XR,
  WM-XR APIs.
- New "xr_session_start_pre" callback for creating actions at
  appropriate point in the XR session.
- Creation of name-identifiable action sets/actions.
- Binding of actions to controller inputs.
- Acquisition of controller button states.
- Acquisition of controller poses.
- Application of controller haptic feedback.
- Carefully designed error handling and useful error reporting
  (e.g. action set/action name included in error message).

Reviewed By: Julian Eisel

Differential Revision: http://developer.blender.org/D10942
2021-05-16 03:36:31 +09:00
3e6609a0dc Cleanup: silence unused parameter warnings
Introduced in rB48fa029dd11b.
2021-05-15 14:13:22 -03:00
a56cc26b48 Merge branch 'blender-v2.93-release' 2021-05-15 18:34:28 +02:00
c2ee7ab2e3 Merge branch 'blender-v2.93-release' 2021-05-15 17:52:26 +02:00
6e8685e1fd GPencil: Add parameter removed by error in previous commit
This fix the compiler warning too.
2021-05-15 15:53:58 +02:00
65997a058f Merge branch 'blender-v2.93-release' 2021-05-15 02:55:25 +02:00
ccb22740c1 Merge branch 'blender-v2.93-release' 2021-05-15 02:34:47 +02:00
3458d09a74 Merge branch 'blender-v2.93-release' 2021-05-15 02:06:02 +02:00
e7e183aa2b Cleanup: Update / improve comments 2021-05-14 16:37:05 -05:00
3c978a73d1 Docs: PyAPI: Replace use of the bgl module in the RenderEngine example
The bgl module will be discontinued.

This example is seen at:
https://docs.blender.org/api/current/bpy.types.RenderEngine.html uses it.

Differential Revision: https://developer.blender.org/D11262
2021-05-14 18:29:23 -03:00
782ccbde70 Cleanup: Move attribute code to attribute header
This code in the geometry set header was not directly related to
geometry sets, it makes more sense in the attribute access header.
This makes it clearer that code for geometry components uses attribute
code, rather than the other way around. It also allows adding more
functionality to `BKE_attribute_access.hh` that depends on these things
without including `BKE_geometry_set.hh` there.
2021-05-14 15:53:43 -05:00
db59f0b943 Fix T88262: Curve to mesh crash with vector last segment
The code incorrectly used the size of the second to last segment rather
than the last segment's size. That was a problem when the last segment
is a vector segment but the second to last isn't.

I also used the opportunity to slightly refactor the control point
offsets cache, making it one longer so it also contains information
about the size of the last segment, simplifying other code.
2021-05-14 11:26:42 -05:00
7178e54122 Merge branch 'blender-v2.93-release' 2021-05-14 18:18:24 +02:00
7efe92f63b Merge branch 'blender-v2.93-release'
Conflicts:
	source/blender/editors/object/object_add.c
2021-05-14 18:10:12 +02:00
f6cb9433d4 GPencil: Refactor Append operators
Now the operators work like other areas of Blender using the list of selected objects.

Also, the name has been changed to:

```Layers:
- Copy Layer to Selected
- Copy All Layers to Selected

Materials:
- Copy Material to Selected
- Copy All Materials to Selected```

Reviewed By: mendio, pablovazquez, pepeland

Differential Revision: https://developer.blender.org/D11216
2021-05-14 18:02:04 +02:00
8c80267352 CLOG: Fix memleak in own recent improvement to CLOG filter.
Mistake in rBef5782e29744.
2021-05-14 17:50:55 +02:00
Germano Cavalcante
b11499939c Python GPU: Replace part of the code that uses 'bgl' with 'gpu'
This is part of the process described in T80730.

The aim is to deprecate the bgl module.

Reviewed By: fclem, brecht, campbellbarton

Revision: D11147
2021-05-14 12:26:40 -03:00
Germano Cavalcante
48fa029dd1 Python GPU: New 'platform' module
This module exposes the platform utils defined in the GPU module in C.

This will be useful for porting existing code with `bgl` to `gpu`.

Reviewed By: fclem, brecht, campbellbarton

Maniphest Tasks: T80730

Part of D11147
2021-05-14 12:26:40 -03:00
Germano Cavalcante
3f4f109646 Python GPU: New 'capabilities' module
This module exposes the capabilities defined in the GPU module in C.

This will be useful for porting existing code in `bgl` to `gpu`.

Reviewed By: fclem, brecht, campbellbarton

Maniphest Tasks: T80730

Part of D11147
2021-05-14 12:26:40 -03:00
079f415deb Cleanup: use enum types for screen direction variables
The term direction was used in 3 different ways in screen editing code,
making it hard to follow:

- 0-3 for as magic numbers mapped to [west,north,east,south].
- `h`, `v` characters for [horizontal,vertical] axes.
- Cycle direction SPACE_CONTEXT_CYCLE_PREV, SPACE_CONTEXT_CYCLE_NEXT

The following changes have been made:

- Add `eScreenDir` for [west,north,east,south], use variable name `dir`.
- Add `eScreenAxis` for [horizontal,vertical] values, use variable name
  `dir_axis`.
- Add `eScreenCycle` for existing enum `SPACE_CONTEXT_CYCLE_{PREV/NEXT}`.
- Add macros `SCREEN_DIR_IS_VERTICAL(dir)`,
  `SCREEN_DIR_IS_HORIZONTAL(dir)`.
  Replacing `ELEM(dir, 1, 3)`, `ELEM(dir, 0, 2)`.
- Move `ED_screen_draw_join_highlight`, `ED_screen_draw_split_preview`
  to `screen_intern.h`.

Reviewed By: Severin

Ref D11245
2021-05-15 00:49:49 +10:00
265d97556a PyAPI: use iterators for ID property methods (keys, values & items)
- Matches changes in Python 3.x dictionary methods.

- Iterating now raises a run-time error if the property-group changes
  size during iteration.

- IDPropertyGroup.iteritems() has been removed.

- IDPropertyGroup View & Iterator types have been added.

- Some set functionality from dict_keys/values/items aren't yet
  supported (isdisjoint method and boolean set style operations).

Proposed as part of T85675.
2021-05-15 00:36:49 +10:00
65f9550813 Nodes: fix connecting wrong sockets when inserting node
Differential Revision: https://developer.blender.org/D11231
2021-05-14 16:01:55 +02:00
a4f0780acf Merge branch 'blender-v2.93-release' 2021-05-14 13:45:48 +02:00
bd5bab961e Merge branch 'blender-v2.93-release' 2021-05-14 19:27:30 +10:00
2871fadcad Geometry Nodes: use texture socket in Attribute Sample Texture node
There is a new Texture data-block socket that we can use in Geometry
Nodes now. This commit replaces the texture property of a node and
gives it a texture input socket instead. That increases flexibility.

The texture socket still has some limitations that will be lifted in the
next couple of days (e.g. it's not supported by the switch node and
cannot be exposed the a modifier yet).

Differential Revision: https://developer.blender.org/D11222
2021-05-14 11:23:25 +02:00
a939317862 Cleanup: sort include dirs in CMakeLists.txt
Sort include dirs in just one file, not a big change
(`source/blender/editors/armature/CMakeLists.txt`).

No functional changes.
2021-05-14 11:12:35 +02:00
26b4ef6823 Geometry Nodes: remove some unnecessary updates
This fixes a few "obvious" places where we do unnecessary updates.
Those special cases were added in the early days of geometry nodes
when many updates were missing and we tried to get it to work at all.
There is a fairly high risk that with this change some required updates
will be missing again. Those can be fixed when we find thme.
Some of the update issues might have been fixed by rB58818cba40794905f9323080e60884e090f2d388
and similar changes we added over time.

Differential Revision: https://developer.blender.org/D11238
2021-05-14 11:06:00 +02:00
Christoph Lendenfeld
9797b95f61 Animation: Pose sliding tools improvements
Improve the "In Betweens" tools:
- Push Pose from Rest Pose
- Relax Pose to Rest Pose
- Push Pose from Breakdown
- Relax Pose to Breakdown
- Pose Breakdowner

These all now use the same new sliding tool:
- Actual visual indication of the blending/pushing percentage applied.
- Mouse wrapping to allow for extrapolation without having to worry
  about the initial placement of the mouse. This also means these tools
  are actually usable when chosen from the menu.
- Precision mode by holding {key Shift}.
- Snapping to 10% increments by holding {key Ctrl}.
- Overshoot protection; by default the tool doesn't allow overshoot
  (lower than 0% or higher than 100%), and it can be enabled by pressing
  {key E}.
- Bones are hidden while sliding, so the pose itself can be seen more
  clearly. This can be toggled by pressing {key H} while using the tool.

Reviewed By: #animation_rigging, zeddb, sybren, #user_interface, brecht, Severin, looch

Maniphest Tasks: T81836

Differential Revision: https://developer.blender.org/D9054
2021-05-14 11:00:17 +02:00
a156843112 Cleanup: spelling, rename metas to meta-strips / meta-balls 2021-05-14 17:38:16 +10:00
c1c0b661c0 Cleanup: clang-format 2021-05-14 17:35:08 +10:00
20c3db6604 DrawTest: Make setup method public.
This allows other tests to override it.
2021-05-14 08:34:13 +02:00
55b9b1ff50 Draw: Put DrawTest in its own compile unit.
DrawTest will be used by other tests as well.
2021-05-14 07:55:01 +02:00
bd76184966 Fix sculpt neighbor iterator not taking visibility into account
Sculpting tools are designed to ignore hidden geometry and behave like
hidden geometry does not exist.
When getting the neighbors of a vertex, now this takes into account
hidden geometry to avoid returing neighbors which connected edge is not
visible. This should make corner cases of a lot of tools work properly,
especially when working in low poly meshes when is common to have a
single face loop hidden.

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D11007
2021-05-14 03:08:01 +02:00
01718ad952 Merge branch 'blender-v2.93-release' 2021-05-14 02:42:19 +02:00
Pablo Dobarro
d70cfb90e0 Fix Sculpt tools showing the cursor of the previous active brush
When using a tool that is not a brush, the previously used brush
preset will still be active in the tool settings, so the cursor will
draw its custom reviews.
This checks if the current active tool is a brush before drawing its
previews. If it is not a brush tools, it draws a default white cursor.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9418
2021-05-14 00:56:13 +02:00
01a614c699 Fix build after last commit
Part of a rename change in rBc5d38a2be8 was lost when committing.
2021-05-13 17:52:30 -05:00
c5d38a2be8 Functions: Expose set_all method for generic virtual arrays
This is very similar to rB5613c61275fe6 and rB0061150e4c90d, basically
just exposing a `VMutableArray` method to its generic counterpart. This
is quite important for curve point attributes to avoid a lookup for
every point when there are multiple splines.
2021-05-13 17:47:46 -05:00
88aee2986f Cleanup: Clang format 2021-05-13 17:37:51 -05:00
Scurest
2953732fc5 Collada import: connect Emission texture to Emission socket
An emission texture is currently connected to the Base Color socket. It should connect to the Emission socket, like a constant does.

Reviewed By: gaiaclary

Differential Revision: https://developer.blender.org/D10990
2021-05-13 23:43:37 +02:00
d889e9684a Merge branch 'blender-v2.93-release' 2021-05-13 23:07:05 +02:00
b90fec5d46 BLI: simplify supporting heterogeneous lookup for new types
Heterogeneous lookup is useful when constructing a key in a
map/set is relatively expensive (e.g. `std::string`). When doing
lookups in the map/set, one usually does not want to construct
the type to avoid overhead. Instead, heterogeneous lookup
allows for using a different type (such as `StringRef`) as key.

This change makes it easier to implement heterogeneous
lookup for custom types. Before, one had to specialize
`blender::DefaultHash`. Now, one just has to implement
a `static uint64_t hash_as(value)` on the type itself.
One still has to provide the equality operator in addition
to the hash function of course.
2021-05-13 14:14:14 +02:00
23a788b8bd Modifiers: allow usage of tbb
Before, any usage of tbb wrappers used in modifier code would
just fall back to the non-threaded non-tbb version.

We ran into this issue a couple of times in patches.
2021-05-13 13:45:05 +02:00
64f1d5e7c1 Nodes: add utility method to get input/output of a DNode
This is a fairly common operation, so there should be a method
that does it to avoid unnecessary complexity at the caller site.
2021-05-13 13:42:38 +02:00
d288eeb79a BLI: support looking up a key stored in Map or VectorSet
Sometimes it is useful to find the key that compares equal
to a known key. Typically that happens when the key itself
has additional data attached that is not part of its hash.

Note that the returned key reference/pointer is const, because
the caller must not change the key in a way that changes its
hash or how it compares to other keys.
2021-05-13 13:39:23 +02:00
522868001c Functions: simplify adding a single input to a multi-function
This is used by the upcoming new geometry nodes evaluator.
2021-05-13 13:23:53 +02:00
8b87fc1c77 BLI: add initial wrapper for tbb::enumerable_thread_specific
The wrapper is necessary to support building without TBB.
This class is used by the upcoming new evaluator for
geometry nodes.
2021-05-13 13:20:16 +02:00
2fb0eeb707 Nodes: ignore unavailable sockets in logically linked sockets iterator
Unavailable sockets should generally be ignored during evaluation.
They mainly exist because we don't have a better mechanism to turn
some sockets on/off depending on node parameters.

Currently, it is still possible that a link connects an available with an
unavailable socket. This link is not displayed in the ui and should
generally be ignored.
2021-05-13 13:11:28 +02:00
777ba780a6 Cleanup: inconsistent parameter name 2021-05-13 13:06:42 +02:00
d4bca00a47 Cleanup: missing override 2021-05-13 13:06:28 +02:00
6b33dafb64 Geometry Nodes: add mutex for node ui storage
Previously, multiple threads adding information to node ui storage
at the same time resulted in memory corruption. The lock prevents
that, but might potentially become a bottleneck in the future.
For now favour correctness over a potential performance bottleneck.
2021-05-13 13:06:09 +02:00
250a5442cf BLI: add LinearAllocator.construct_array method
Previously, one could allocate an array, but not construct its
elements directly. This method just adds some convenience.
2021-05-13 12:58:02 +02:00
df07188750 Cleanup: use boolean argument 2021-05-13 12:44:58 +10:00
bddc987ba3 Cleanup: clang format 2021-05-13 12:44:28 +10:00
f1ecbf26b7 UI: Use term 'Preferences' instead of 'User Prefs'
'Preferences' is the term used elsewhere in Blender so this commit makes 
the option more consistent.

In the future, the "default" target could be changed to something more 
descriptive.
2021-05-12 21:10:17 -04:00
a5d2c19a5c PyAPI Docs: Cleanup Formatting 2021-05-12 21:10:17 -04:00
06e62adfb8 UI: Improved "Area Close" Neighbor Selection
The new "Close Area" operator can let any neighbor replace the area to
be closed. This patch improves the selection of the best, and most-
aligned, neighbor.  It maximizes the ratio of the shared edge lengths,
rather than minimize the absolute amount of misalignment. This follows
our expectations closer because it takes into account the relative
sizes of the areas and their edges.

see D11143 for details and examples.

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

Reviewed by Campbell Barton
2021-05-12 16:52:43 -07:00
fa472d46fc Merge branch 'blender-v2.93-release' 2021-05-12 20:25:16 +02:00
1a94ae9e47 Cleanup: Simplify public/private specifiers
By rearranging a few variables we can remove redundant specifiers
2021-05-12 11:50:35 -05:00
50bf033d3f Cleanup: Splines: Add accessors to spline vector
Not allowing external direct access to the vector of splines in the
curve will help for things like reallocating custom data when a spline
is added or removed.
2021-05-12 11:46:13 -05:00
3ef01692c8 UI: Colors for Texture/Material node sockets and small tweaks
* Set colors for the new texture and material sockets
  * Material uses the same color used for shading icons
  * Texture uses a plum color desaturated enough to not be confused with Vector's violet
* Image socket adjusted to be closer to Texture sockets but darker
* Integer socket toned down in saturation to not stand out so much
  (and be closer to float sockets which are gray)

Making this change now during bcon1 to gather feedback from the community,
and because Geometry Nodes needs to use the new texture/material sockets.
2021-05-12 18:00:03 +02:00
1892b131ed Geometry Nodes Curves: Expose first builtin point attributes
This commit exposes the first spline control point attributes. The
implementation incorporates the attributes into the virtual array
system, providing efficient methods to flatten the data into a
contiguous array and to apply changes from a flattened array. This
is only part of the eventual goal, which includes changes to run
attribute nodes separately for each spline to completely avoid copying.

So far `tilt` and `radius`, the two generic attributes common to
all spline types, are implemented. The more complex `position`
attribute is also added. It requires some special handling for Bezier
splines, where the control point handles need to be moved along with
the control points. To make that work I also added automatic handle
recalculation to the Bezier spline.

Differential Revision: https://developer.blender.org/D11187
2021-05-12 10:21:32 -05:00
8dc95f61f3 Merge branch 'blender-v2.93-release' 2021-05-12 22:20:51 +10:00
ead084b6e1 PyAPI: remove deprecated & unused BMesh.from_object deform argument
Ref T85675
2021-05-12 22:04:06 +10:00
44db4e50b2 PyAPI: remove context.active_base
All other access to the Base structure from Python was removed,
it seems this was left in by accident.

Ref T85675
2021-05-12 22:02:18 +10:00
aaa07a3a8f PyAPI: remove deprecated 'wiki_url' for add-ons 'bl_info'
This was only kept for compatibility with older add-ons and has been
deprecated since 2.83.

Ref T85675
2021-05-12 22:02:12 +10:00
bf23083852 Cleanup: use our own code style for doxy-gen comment blocks 2021-05-12 21:58:25 +10:00
3836d10faf Builder: updated download urls with upcoming naming scheme. 2021-05-12 13:17:06 +02:00
21bed44001 Fix custom bone shape scale affecting normal bone display
Also some clang-format changes.
2021-05-12 12:56:43 +02:00
2074729308 Nodes: add boilerplate for texture and material sockets
The sockets are not exposed in any nodes yet.
They work similar to the Object/Collection sockets, which also
just reference a data block.

This is part of D11222.
2021-05-12 12:41:30 +02:00
a43a455fdd Merge branch 'blender-v2.93-release' 2021-05-12 11:18:43 +01:00
2e750a42a1 Merge branch 'blender-v2.93-release' 2021-05-12 10:16:01 +02:00
93b7c9595b Merge branch 'blender-v2.93-release' 2021-05-12 10:01:14 +02:00
0d21228dce Cleanup: rename 'rt' to '_pad#' in DNA structs 2021-05-12 16:44:59 +10:00
193425ce1d Cycles: fix inconsistent-missing-override warnings
LLVM Clang 13, macOS.

Reviewed By: brecht
Differential Revision: https://developer.blender.org/D11207
2021-05-12 10:27:37 +05:30
9a6fd69993 Fix T87947: Trasnform: Keyboard input uses view orientation
When activated in modal, `translate`, `resize`, `rotate`, `shear` and
`edge_rotate_normal` use a different orientation than the set in scene.

This orientation needed to match since some of these modes can be switched
during operation.

The default orientation for these modes was `V3D_ORIENT_VIEW`.

And this changed when finishing the `translate` and `resize` to
`V3D_ORIENT_GLOBAL`.

But this could cause inconsistencies when inputting values from the
keyboard.

The solution now is to change the orientation when you change the mode.

---
Note: Although the user can expect the value entered to reflect the
orientation set in the scene, it would require a lot of changes and would
not be really useful.
2021-05-11 23:45:55 -03:00
cb385a117b Cleanup: Use enum to indicate the current orientation
Improves readability.
2021-05-11 23:44:50 -03:00
Wayde Moss
cbeeca8167 NLA: Extract ..get_inverted_upper_snapshot()
Extracts `nlasnapshot_blend_get_inverted_upper_snapshot()` from
`BKE_animsys_nla_remap_keyframe_values()`

This introduces a new struct member:
`NlaEvalChannelSnapshot->remap_domain` and marks which values of
`blended_snapshot` are processed for remapping/used-for-inverting.
Effectively, it marks which values have successfully been remapped and
can be further used for remapping.

`nlasnapshot_blend_get_inverted_upper_snapshot()`:
output snapshot `r_upper_snapshot` has each channel's `remap_domain`
written to which effectively marks the successfully remapped values.
The only reason a value is not in the remap domain is if inversion
failed or it wasn't marked to be remapped.

`..get_inverted_upper_snapshot()` has a variant `nlasnapshot_blend()`
from {D10220}, but this patch doesn't depend on it at all. A third
variant will later be added `..get_inverted_lower_snapshot()`.
Altogether, these three functions allow solving for any of
(lower_snapshot, upper_snapshot, blended_snapshot) given the other two.
The function `..get_inverted_lower_snapshot()` will also similarly
process the remap domain of the blended and lower snapshot.

added assertions within `nlasnapshot_blend()` and
`..get_inverted_upper_snapshot()` to future proof branches dealing with
blendmode and mixmodes. (suggested by sybren)

No user functional changes

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D10222
2021-05-11 22:00:07 -04:00
Wannes Malfait
65244ac1c3 Geometry Nodes: Link error when implicit conversion isn't possible
This turns links red if no implicit conversion can be made between the
from socket and the to socket. For geometry nodes this happens with
object, geometry, collection, and string sockets that are connected to
a different type. The change is simply implementing a callback that is
already implemented for other node tree types.

Differential Revision: https://developer.blender.org/D11229
2021-05-11 16:46:02 -05:00
2770d43da6 Merge branch 'blender-v2.93-release' 2021-05-11 23:35:49 +02:00
96bcd80c5a Merge branch 'blender-v2.93-release' 2021-05-11 23:05:57 +02:00
6796ff5880 Cleanup: unused variable warning 2021-05-11 14:03:40 +01:00
Charlie Jolly
93933ee8bb Geometry Nodes: Add Attribute Vector Rotate node
Port vector rotate node to geo attributes.

Request by @simonthommes

Reviewed By: simonthommes, HooglyBoogly
2021-05-11 11:15:06 +01:00
Yuki Shirakawa
fc5bf09fd8 Rigging: Add transform for custom bone shapes
Add translation/rotation/scale parameters for custom bones shapes. The
new scale is a 3D vector `custom_shape_scale_xyz`, and replaces the
`custom_shape_scale` float.

Reviewed By: #animation_rigging, sybren, zeddb

Differential Revision: https://developer.blender.org/D10974
2021-05-11 11:31:58 +02:00
a02be602f9 Merge branch 'blender-v2.93-release' 2021-05-11 10:25:12 +02:00
1151adf62d Cleanup: unnecessary extra lines for doxy sections 2021-05-11 16:04:03 +10:00
091d7336e6 Cleanup: remove unused baking struct members from soft-body 2021-05-11 16:00:38 +10:00
4226f19a03 Cleanup: Sort node type definitions alphabetically
Previously we had a lot merge conflicts since we always put the most
recently added node at the bottom. By sorting the list we will have
one fewer merge conflict when a node is added in most cases.
2021-05-10 23:10:56 -05:00
5bae9d4e38 Merge branch 'blender-v2.93-release' 2021-05-11 12:30:51 +10:00
5950208f04 Merge branch 'blender-v2.93-release' 2021-05-11 12:26:34 +10:00
7d187e91bb Merge branch 'blender-v2.93-release' 2021-05-11 11:28:46 +10:00
4333991b7b Cleanup: Reorder class variable declarations
The order was arbitrary, and rearranging the declarations
makes the class look less messy, and makes room for future comments.
2021-05-10 19:33:12 -05:00
a5761bbde2 Cleanup: Whitespace, add doxygen sections
The sections aren't helpful at the moment, but I will add more code
here soon that will benefit more from the visual separation.
2021-05-10 19:30:23 -05:00
6b1034d520 Cleanup: Use a helper function for repetitive code
Retrieving data from the component can be done in a separate function
to save some repetition.
2021-05-10 19:17:15 -05:00
5613c61275 Functions: Add materialize methods for generic mutable virtual array
Similar to how `GVArray_For_VArray` implements `materialize_impl` to
forward the work to its non-generic virtual array, we can do the same
thing for the mutable version, `GVMutableArray_For_VMutableArray`.

This commit should have no visible changes, since as far as I can tell
the only user of this class does not implement special materialize
methods anyway.
2021-05-10 19:12:04 -05:00
e19ee2e212 Merge branch 'blender-v2.93-release' 2021-05-11 00:19:39 +02:00
3a5f3fb7e4 Merge branch 'blender-v2.93-release' 2021-05-10 19:21:39 +02:00
0467979425 GPencil: Remove B key to create Blank Keyframe in Drawing mode
We have the `I` menu for that. This is part of the old code.
2021-05-10 16:34:27 +02:00
c3de3c2749 GPencil: Rename prop dilate_pixels to dilate
Better avoid units in name.
2021-05-10 16:26:50 +02:00
1ef5604e8c Merge remote-tracking branch 'origin/blender-v2.93-release' 2021-05-10 16:00:43 +02:00
cacfa75e67 Merge branch 'blender-v2.93-release' 2021-05-10 13:34:05 +02:00
bc868f7b52 Merge branch 'blender-v2.93-release' 2021-05-10 14:16:38 +03:00
Severin
273db9294a Fix warning on Apple Clang, missing override specifier
Was giving a warning:
```
BKE_spline.hh:293:35: warning: 'interpolate_to_evaluated_points' overrides a
member function but is not marked 'override' [-Winconsistent-missing-override]
```
2021-05-10 12:06:54 +02:00
0aa05c7fbb Merge branch 'blender-v2.93-release' 2021-05-10 12:00:34 +02:00
f966f6ed55 Compositor: Add vars and methods for easier image looping
These variables and methods should make it easier to loop through buffers elements/pixels. They take into account single element buffers.
Single element buffers can be used for set operations to reduce memory usage.

Usage example: P2078

Reviewed By: #compositing, jbakker

Differential Revision: https://developer.blender.org/D11015
2021-05-10 11:16:06 +02:00
eba9404cc7 Cleanup: too small loop variable type
Clang-Tidy: bugprone-too-small-loop-variable
2021-05-10 10:52:33 +02:00
0061150e4c Functions: support materialize virtual array to initialized span 2021-05-10 10:28:24 +02:00
f2370bb22d Cleanup: spelling 2021-05-10 16:19:40 +10:00
3b7df2e157 Cleanup: unused variable warning 2021-05-10 16:16:29 +10:00
1d6425cb64 Cleanup: Remove double import in previous commit. 2021-05-10 08:01:20 +02:00
c63d40c165 Enable CLog for GPU test cases. 2021-05-10 07:59:10 +02:00
2f61602497 Cleanup: correct/clarify PlayAnim comments 2021-05-10 15:32:18 +10:00
d800470ac2 LineArt: Custom UI for adding GP object.
This allows extra options (in-front and stroke order) to be shown when adding line art kind of grease pencil object.

Reviewed by: Antonio Vazquez (antoniov)

Diff: https://developer.blender.org/D11130
2021-05-10 09:15:33 +08:00
f694321db0 Fix: Curve resample duplicates last point for cyclic splines
The last point of the output was at the same location as the
first point of a cyclic spline. The fix is simple, just account for
the cyclic when choosing the sample edge length, and don't
hard code the last sample.
2021-05-09 01:33:34 -05:00
7029cc2f8a Fix T88126: Curve resample crash for single point input
The spline `length` function assumed that the curve always had evaluated
edges. That is clearly false. This commit adds a check to `length` and a
special case for a single point in the curve resample node.
2021-05-09 01:13:06 -05:00
518c5ce4cd Geometry Nodes: Improve point instance node performance
This commit uses two changes to improve the performance of the point
instance node.

**Prevent Reallocations**
At 64 bytes, the transform matrix for every instance is rather large,
so reallocating the vector as it grows can become a performance bottle-
neck. This commit reserves memory for the instances that will be added
to prevent unecessary reallocations as the instance vector grows.

In a test with 4 million instances of 3 objects in a collection, the
node was about 40% faster, from 370ms to 270ms for the node.

**Parallelization**
Currently the instances are added by appending to a vector. By changing
this slightly to fill indices instead, we can parallelize the operation
so that multiple threads can fill data at the same time. Tested on a
Ryzen 3700x, this reduced the runtime from the above 270ms to 44ms
average, bringing the total speedup to ~8x.

Note that displaying the instances in the viewport is still much slower
than the calculations in node, this change doesn't affect that.
2021-05-08 23:57:36 -05:00
b7afb8ea70 Merge branch 'blender-v2.93-release' 2021-05-09 01:52:33 +02:00
9569a522f2 Geometry Nodes: Refactor point instance node
This patch refactors the instance component to make use of the earlier
refactoring in rB4599cea15dcf. Now we don't have to build an array of
instance references the size of the point domain, and we can gather the
possible instances only once and use the same vector for all component
types. Generally the node should be a bit faster and use less memory.

The logic is moved around a bit, especially the hashing of the ID
attribute to pick from the instance list, but the result is unchanged.

Differential Revision: https://developer.blender.org/D11203
2021-05-08 14:53:32 -05:00
34439f05ab Cleanup: remove use of persistent data handles in geometry nodes
Those were mostly just left over from previous work on particle nodes.
They solved the problem of keeping a reference to an object over
multiple frames and in a cache. Currently, we do not have this problem
in geometry nodes, so we can also remove this layer of complexity
for now.
2021-05-08 14:54:48 +02:00
39044e68c2 Cleanup: correct PlayState.stopped state which was inverted 2021-05-08 16:13:17 +10:00
e1e23595f0 Cleanup: remove unused turbo struct member from PlayAnim
This was never used (since 2.25 at least).
2021-05-08 16:13:17 +10:00
9708215611 Cleanup: comment PlayAnim struct members 2021-05-08 16:13:17 +10:00
124572a6e5 Merge branch 'blender-v2.93-release' 2021-05-08 16:12:48 +10:00
57b473a10a Merge branch 'blender-v2.93-release' 2021-05-08 14:59:30 +10:00
e46b9de6ab Fix: Curve to mesh node assert when last profile segment is vector
We need to always add a single point to the last cyclic segment that
completes the loop, because that includes the starting point of the
evaluated edge. The existing code forgot about that point.
2021-05-07 18:16:15 -05:00
3185084efb Geometry Noes: Curve Resample Node
This node generates a naturally parametarized (even length edge) poly
spline version of every spline in the input. There are two modes,
"Count", and "Length". These are similar to the same options for the
line primitive node in end points mode.

I implemented this instead of a "Sample Points" node, because for this
operation it's trivial to keep the result as a curve, which is nice
since it increases flexibility, and because it can make instancing
simpler, i.e. using the transforms of each evaluated point rather than
requiring the construction of a "rotation" attribute.

Differential Revision: https://developer.blender.org/D11173
2021-05-07 15:37:06 -05:00
960535ddf3 GPencil: New Append operators
Now it's possible to append materials of one grease pencil object into another one. The operator allows active material or all materials.

Also, the Layer Copy To Object has been renamed to Layer Append to Object to keep consistency and now allows to append all layers at once.
2021-05-07 18:27:58 +02:00
c2b6dc7e53 Cleanup: Fix deinterlace code block style 2021-05-07 17:22:12 +02:00
9c509a7219 UI: Display indicator in the 3D Viewport when Clipping Region is on
Small addition inspired by [this tweet](https://twitter.com/Vorundor/status/1390645286624763909) of a user in a situation I also saw myself in the past.

Showing "(Clipped)" next to the view name in the `Text Info` overlay fits well since it's a per-viewport setting.

{F10059921, size=full}

While on Local view:
{F10059925, size=full}

Multiple viewports:
{F10059946, size=full}

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D11193
2021-05-07 17:17:29 +02:00
8f04ddbbc6 Node Editor: Show frame label only when a label is set
Avoids having frames with the word "Frame" on top, resulting in less visual noise.
(users were working this around by adding a space as label name).

Differential Revision: D11193
2021-05-07 17:12:39 +02:00
8d6264ea12 Cleanup: Remove deprecated variables and functions calls from our ffmpeg code
There need to be more cleanup for ffmpeg 4.5 (ffmpeg master branch).

However this now compiles on ffmpeg 4.4 without and deprication
warnings.

Reviewed By: Sergey, Richard Antalik

Differential Revision: http://developer.blender.org/D10338
2021-05-07 17:12:25 +02:00
5bfd5e77b7 Fix: Curve to mesh node fails with one point and no profile
Just because the spline is cyclic does not necessarily mean that it has
an edge.
2021-05-07 09:55:32 -05:00
36ffa5b915 Merge branch 'blender-v2.93-release' 2021-05-07 16:53:24 +02:00
Charlie Jolly
7d90b0ab11 Geometry Nodes: Parallelize Attribute Curve Map node
This adds `parallel_for` to the Attribute Curve Map node to improve performance.
Grain size set to 512.

Reviewed By: HooglyBoogly

Differential Revision: https://developer.blender.org/D11194
2021-05-07 15:27:15 +01:00
8e3a73bf81 Merge branch 'blender-v2.93-release' 2021-05-07 16:14:39 +02:00
bcfdbbf4b4 Cleanup: clang tidy
readability-inconsistent-declaration-parameter-name
2021-05-07 15:57:35 +02:00
94838ba661 Silence warnings 2021-05-07 15:45:52 +02:00
a932b9eab7 Cleanup: make format (clang-format) 2021-05-07 15:45:52 +02:00
b78a1c05a3 Merge remote-tracking branch 'origin/blender-v2.93-release' 2021-05-07 15:45:25 +02:00
c58bf31aed GPencil: Add Bracket keymaps to increase/decrease brush size
This add the missing keymaps.

Requested by Jukien Kaspar.

Differential Revision: https://developer.blender.org/D11183
2021-05-07 15:30:57 +02:00
e7312effb1 Merge branch 'blender-v2.93-release' 2021-05-07 12:54:30 +02:00
a54253f335 LibOverride: Add proper reports when deleting user-edited overrides as part of resync.
Logs are not enough here, we need proper warning visible for the user.
2021-05-07 12:54:13 +02:00
aa8e058a59 LibOverride: Do not preserve local overrides when their linked data disappear.
This is the opposite of previous code, which would keep those
'deprecated' overrides arround (often in a dedicated collection), when
they were detected as user-edited.

While this is a safe-ish way to (try to) preserve user-edited data, this
tends to add too much 'trash' data to production scenes, which cleaning
becomes a burden.

Note that user will get warnings in thos cases, and can always choose
not to save the current blend file and go fix the library issue instead.
2021-05-07 12:54:13 +02:00
23acca0c32 Fix T88100: Crash going to shading tab 2021-05-07 12:43:43 +02:00
6b46e9e524 Fix strict compiler warning in sequencer code 2021-05-07 12:39:11 +02:00
700fe73560 VSE: New iterator design
This iterator design provides means to create simple and flexible API
to query and work with collection of strips. It should be used in cases
when conditions require multiple stages of recursive iteration of all
strips or similar complex scenarios.

Quick API overview:
Basic queries are standalone functions that return SeqCollection
Use SEQ_collection_create() and SEQ_collection_free() to construct
such query functions.
Use these functions to get strips of known conditions, like selected
strips, movie strips, muted strips and so on.

Use SEQ_reference_query() when querying strips with relation to
some reference strip. For example to get its effects, strips that have
same type or use same input file and so on.
These aren't standalone functions because often you need to query strips
relative to each strip in collection.

Use SEQ_collection_expand() to query strips relative to each strip
in collection. These will be merged to original collection.

Use SEQ_collection_merge() to merge 2 collections

To iterate collection elements use macro SEQ_ITERATOR_FOREACH()

This API is quite specific, but I think it is best suited for tasks
that are usualy solved in sequencer codebase.

Old sequencer iterator has been completely removed.
SEQ_ALL_BEGIN and SEQ_ALL_END macros re-use new iterator design.

As initial use for this iterator select_grouped_effect_link()
function has been rewritten. It was not only broken, but also it used
DNA fields to aid iterating strips.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10337
2021-05-07 10:26:39 +02:00
232b10f663 Merge branch 'blender-v2.93-release' 2021-05-07 18:18:21 +10:00
cfc644186a Merge branch 'blender-v2.93-release' 2021-05-07 18:18:18 +10:00
5d7de5745b Merge branch 'blender-v2.93-release' 2021-05-07 18:18:15 +10:00
eaffa83fec Merge branch 'blender-v2.93-release' 2021-05-07 18:18:11 +10:00
f81dca971d Merge branch 'blender-v2.93-release' 2021-05-07 18:18:08 +10:00
c8cbaeb329 Merge branch 'blender-v2.93-release' 2021-05-07 10:05:19 +02:00
Charlie Jolly
ba06bc16ae Geometry Nodes: Add Attribute Curve Map Node
This node has the same functionality as the color and vector curve
mapping nodes in the shader editor. Here is works on every value for
the selected attribute, and it can also output a float value. Other
than that, the implementation is quite straightforward-- almost
completely boilerplate code.

Differential Revision: https://developer.blender.org/D10921
2021-05-06 23:47:51 -05:00
026a9cdc21 Cleanup: move UV element keymap items into a loop
Also add explanation for non-obvious dummy key-map item.
2021-05-07 13:36:29 +10:00
5a3307230e Cleanup: de-duplicate checks in object-mode item callback 2021-05-07 11:23:09 +10:00
ff1b35af39 Cleanup: remove OB_MODE_EDIT from GPencil compatibility check
All callers replace this with OB_MODE_EDIT_GPENCIL.
2021-05-07 11:23:09 +10:00
eb9762a159 Cleanup: remove redundant NULL check in ED_object_mode_compat_test 2021-05-07 11:23:09 +10:00
4243ee7d19 Object Mode: avoid error message with particle-edit mode switch
Mode switching passed through when the mode wasn't supported for all
modes except particle edit-mode.

Add a check to ED_object_mode_compat_test to prevent the error message.
2021-05-07 11:23:09 +10:00
78b2b5fc0e Merge branch 'blender-v2.93-release' 2021-05-07 10:54:52 +10:00
72cefdfd59 Update RNA to User Manual mapping 2021-05-06 17:23:39 -04:00
51b8032c70 Merge branch 'blender-v2.93-release' 2021-05-06 19:23:34 +02:00
20a878158f Merge branch 'blender-v2.93-release' 2021-05-06 19:02:38 +02:00
529de3d6f8 Merge branch 'blender-v2.93-release' 2021-05-06 18:21:43 +02:00
568d55d4bc Merge branch 'blender-v2.93-release' 2021-05-06 17:11:58 +02:00
ec30cf0b74 Fix T88058: Hover+return doesn't accept 0 as input
When the user hovered over a number input field, pressed Enter and then
typed in '0', confirming the input would always cancel the action. This
is because in this particular case `ui_textedit_begin` is called
instead of `ui_numedit_begin`. This function will not set
`data->startvalue` (leaving it at `0`) which will then trigger the
cancel in `ui_apply_but_NUM` which checks if the input changed (by
comparing the entered value with `data->startvalue`).

The fix makes sure that when `ui_textedit_begin` is called on a number
button, the `data->startvalue` is set correctly like in
`ui_numedit_begin`.

Breaking commit: rBSeb06ccc32462beaacbb114d6d0e450b6fc911047

Note: This also affects pressing tab to move to a new number field and
entering '0'. The fix will also cover this case.

Reviewed By: Severin, #user_interface

Maniphest Tasks: T88058

Differential Revision: https://developer.blender.org/D11168
2021-05-06 13:10:05 +02:00
3e77f747c0 Alembic export: export UV maps on every frame
Export UV maps to Alembic on every frame. This makes the export of UV
maps consistent with mesh normals. In the case of static UV maps it may
cause a slight slowdown (since they're exported on every frame now), but
due to the deduplication performed by the Alembic library, the resulting
files will be the same size anyway.

Thanks to @CodyWinch for providing the solution to the problem, and
writing the original patch D8397.

Differential Revision: https://developer.blender.org/D8397
2021-05-06 12:19:24 +02:00
47d76e0903 Merge branch 'blender-v2.93-release' 2021-05-06 11:01:21 +02:00
42e350b9a5 Merge branch 'blender-v2.93-release' 2021-05-06 08:44:23 +02:00
59df16e2e4 Merge branch 'blender-v2.93-release' 2021-05-06 15:34:16 +10:00
11b50b2b77 Cleanup: VSE: move functions from incorrect file
`SEQ_recursive_apply` and `SEQ_seqbase_recursive_apply` were incorrectly
refactored into `iterator.c` file, but they aren't part and don't use
sequencer iterator.

Functions are moved to `utils.c` file.
2021-05-06 05:57:39 +02:00
f74b7e6ce9 Cleanup: Move PlayAnim frame-cache variables into a struct
Naming was inconsistent and hard to follow.
2021-05-06 12:02:23 +10:00
c17792a709 Merge branch 'blender-v2.93-release' 2021-05-06 11:35:10 +10:00
0433bc7e4e Merge branch 'blender-v2.93-release' 2021-05-06 03:23:16 +02:00
efc6f4675d Cleanup: spelling 2021-05-06 08:09:05 +10:00
832f7170dc Cleanup: link directly to stackexchange URL 2021-05-06 08:08:12 +10:00
Severin
6c8c30d865 Fix T82002: ENTER does nothing when mouse cursor is over save dialog text field
The `file.execute` operator would early-exit because the mouse wasn't hovering
the file list. Caused by 4ba9d7d71e.

Although simpler solutions would have been possible, I decided it's better to
split add a new operator for executing based on the mouse (for double-clicking
files), to separate that from the window level execute operator
(`file.execute`). This allows more control and we can get rid of the implicit
assumption that the keymap would call `file.select` on mouse-press, and
`file.execute` on double-click, for the double-click behavior to work. The cost
is that we execute the file selection & activation logic twice on the
double-click, but that shouldn't be an issue at all.
Also removes the `need_active` property from the `file.execute` operator.
That's ancient and wasn't implemented well anyway.

To be clear, reason this fixes the bug is that `file.execute` works entirely
with the `execute()` callback now and doesn't early-exit based on the mouse
position anymore.

Might trigger warnings about the `need_active` property not being found for
custom keymaps. These can be ignored and the property can safely be removed
from the keymap. I don't expect other keymap breakages.
2021-05-05 20:53:06 +02:00
ebd912ca8f Merge branch 'blender-v2.93-release' 2021-05-05 18:40:58 +02:00
ccb5caef08 Remove printfs 2021-05-05 18:40:50 +02:00
c8293d6258 Fix T86037 EEVEE: SSR option changes render passes result
This was caused by the SSR option resetting the accumulation. But the
render passes were only cleared in the init phase. This means that
when SSR was resetting the `taa_render_sample` the actual renderpasses
would still contains 1 sample. This means the renderpasses were always
divided by the wrong number of samples.

The fix is to clear just before accumulation if the sample is 1.

The fact that it works for motion blur is kind of a blessing. This is because
we check `stl->effects->ssr_was_valid_double_buffer` before resetting the
sampling. So this only happens on the first motion step and does not affect
the rest of the rendering.

Differential Revision: https://developer.blender.org/D11033
2021-05-05 18:40:50 +02:00
5f7f90d5a2 Merge branch 'blender-v2.93-release' 2021-05-05 16:42:37 +02:00
632c3304bc Merge branch 'blender-v2.93-release' 2021-05-05 15:09:41 +02:00
1f184066ba Merge branch 'blender-v2.93-release' 2021-05-05 14:21:49 +02:00
8e0995d006 Merge branch 'blender-v2.93-release' 2021-05-05 12:29:24 +02:00
515afeb11b Merge branch 'blender-v2.93-release' 2021-05-05 18:09:37 +10:00
89bc6b5508 Merge branch 'blender-v2.93-release' 2021-05-05 07:22:10 +02:00
08f4bab658 System info: add OS version to sys_info.py
Match the output to the prefilled bug report script's output.
Make the output file self-contained.

Reviewed By: lichtwerk
Differential Revision: https://developer.blender.org/D11144
2021-05-05 10:08:04 +05:30
20aed341ee Cleanup: use doxy sections for info_ops.c 2021-05-05 12:12:20 +10:00
909506200a Cleanup: quiet warning about description ending with '.' 2021-05-05 12:11:39 +10:00
d08cc63e2f Nodes Splines: Apply tilt to normal evaluation
This patch makes the spline tilts (interpolated to the evaluated points)
affect the evaluated normals, allowing manual control of the rotation of
each profile in the curve to mesh node.

The method is based on Animation Nodes code, which keeps the data in
direction vector form, and rotates around the tangent vector.

Differential Revision: https://developer.blender.org/D11152
2021-05-04 17:35:48 -05:00
1f5710326f Fix: Splines: Use consistent bezier linear interpolation method
While the method of interpolating based on the curve length at each
evaluated point may be useful in some situations, for now it's best to
be consistent with the existing methods in Blender, so this commit adds
a simple linear-based-on-resolution sampling method to bezier splines.
2021-05-04 17:27:20 -05:00
d18be66a54 Fix T86871: Mesh.mesh_from_object creates empty mesh from curve
Regression in 2b723abea0
2021-05-05 08:08:33 +10:00
7ab7ae80c5 Fix: Incorrect cyclic interpolation for nodes bezier spline
The special case for the interpolation to the last point was being used
for every point in the last segment, because of the rounding. Instead,
make the function slightly more complicated to properly handle the
correct interolation in the cyclic and non-cyclic cases.
2021-05-04 16:28:22 -05:00
441160930b Fix: Incorrect type used for geometry nodes poly splines 2021-05-04 14:34:16 -05:00
5ea113a555 Fix missing header & footer toggle chevrons in Spreadsheet
The little chevron tab to open a hidden region wouldn't show up in the
Spreadsheet editor. Cause was an incorrect GPU-scissor usage:
While drawing regions, the scissors should be kept enabled, just the
scissor rectangle should be updated - and afterwards reset to what it
was before.
2021-05-04 20:20:15 +02:00
87ee8ddfe3 Fix compile error without Alembic
Thanks to @Severin for noticing and providing a little patch.
2021-05-04 17:30:49 +02:00
f8f6e0b256 GPencil: New Dilate parameter for Fill brush
Internally, when using Fill brush a dilate of the filled area was done, but this was hardcoded to 1 pixel.

In some situations, this was not enough, so now the value is accesible in the UI and can be set with different values.

Also, as this value is more used than `Leak Size`, the new Dilate is on Topbar, and Leak Size has been moved to Advanced panel.
2021-05-04 16:46:33 +02:00
Cody Winchester
7904899d02 Gpencil - Fix stroke normal from D10171
In my previous patch https://developer.blender.org/D10171 some code changing the direction the strokes normal was accidentally included. This patch reverts that back to the original normal calculation.

Reviewed By: #grease_pencil, antoniov

Differential Revision: https://developer.blender.org/D11148
2021-05-04 16:31:15 +02:00
d2311de218 Fix T87935: allow library overrides on NLA/FCurve modifiers
Mark NLA/FCurve modifier properties as library-overridable.

It was already allowed to add such modifiers to a library-overridden
object, but then the properties of those modifiers were read-only,
limiting their use.
2021-05-04 16:25:50 +02:00
46d56bd956 Animation: correct active track/strip pointers after copying NLA tracks
After copying NLA tracks from one `AnimData` to another, also ensure
that the `AnimData::act_track` and `AnimData::actstrip` pointers are
pointing to the copy rather than the original.

This is a necessary step to allow library overrides on NLA modifiers
without crashing Blender.

The remapping of the pointers is done by looping over the tracks/strips
and comparing pointers. Alternatively, I could update the copy functions
themselves to keep track of those pointers and return them, but IMO that
would produce more spaghetti (they're also used in cases where this
pointer-remapping is not desired).
2021-05-04 16:23:57 +02:00
191664acd2 Docs: "File > External Data pack operator" lookup for the manual 2021-05-04 16:20:56 +02:00
ee51e73355 "File > External Data" menu improvements and cleanup
All changes:
* Include `file.pack_libraries` and `file.unpack_libraries` to the menu
[1].
* Rename "Pack Blender Libraries" → "Pack Linked Libraries" [2].
* Rename "Unpack Blender Libraries" → "Unpack Linked Libraries" [2].
* Rename "Pack All Into .blend" → "Pack Resources" [3]
* Rename "Unpack All Into Files" → "Unpack Resources" [3]
* Rename "☑ Automatically Pack Into .blend" → "☑  Automatically Pack
Resources" [3]
* Rename "Make All Paths Relative" → "Make Paths Relative" [4]
* Rename "Make All Paths Absolute" → "Make Paths Absolute" [4]
* Add separators accordingly

---

[1] - This was never exposed since its original commit rB16411da41e40.
Now that operator not listed in menus don't
show up in the search, this became even more hidden.

[2] - The original name (Pack Blender Library) was not clear enough.
Pose Libraries and Asset Libraries are also technically Blender
libraries.

[3] - The term All was misleading since it didn't include the Linked
Libraries.

[4] - No need to use "All". It is not used in the Report/Find Missing
Files either.

This commit put this in the File > External Data menu.

Differential Revision: https://developer.blender.org/D11109
2021-05-04 16:20:56 +02:00
57b94cf34b Merge branch 'blender-v2.93-release' 2021-05-04 15:20:33 +02:00
d0b3f9c81b Fix T87489: Text Data-Blocks get deleted on Recursive Purge
Text data block were not considered special in the recursive purge
function.  So they would get deleted if they had no actual users.

To fix this we instead make text data block use "fake user" so that
addon authors can specify script files that should be removed if nothing
is using it anymore.

Per default, new text object have "fake user" set. So functionality
wise, the user has to explicitly specify that they want the text object
to be purge-able.

Reviewed By: Bastien

Differential Revision: http://developer.blender.org/D10983
2021-05-04 15:11:20 +02:00
4599cea15d Geometry Nodes: refactor instances component
The main goal of this refactor is to not store Object/Collection
pointers for every individual instance. Instead instances now
store a handle for the referenced data. The actual Object/Collection
pointers are stored in a new `InstanceReference` class.

This refactor also allows for some better optimizations further down
the line, because one does not have to search through all instances
anymore to find what data is instanced.

Furthermore, this refactor makes it easier to support instancing
`GeometrySet` or any other data that has to be owned by the
`InstancesComponent`.

Differential Revision: https://developer.blender.org/D11125
2021-05-04 10:16:24 +02:00
e6bf272abd Merge branch 'blender-v2.93-release' 2021-05-03 20:07:03 -03:00
Stefan Werner
042df5fd6a Cycles standalone: Fixed macOS dependencies.
Added IOKit and Accerelate as linked frameworks where necessary.
2021-05-03 22:07:09 +02:00
8216b759e9 Geometry Nodes: Initial basic curve data support
This patch adds initial curve support to geometry nodes. Currently
there is only one node available, the "Curve to Mesh" node, T87428.

However, the aim of the changes here is larger than just supporting
curve data in nodes-- it also uses the opportunity to add better spline
data structures, intended to replace the existing curve evaluation code.
The curve code in Blender is quite old, and it's generally regarded as
some of the messiest, hardest-to-understand code as well. The classes
in `BKE_spline.hh` aim to be faster, more extensible, and much more
easily understandable. Further explanation can be found in comments in
that file.

Initial builtin spline attributes are supported-- reading and writing
from the `cyclic` and `resolution` attributes works with any of the
attribute nodes. Also, only Z-up normal calculation is implemented
at the moment, and tilts do not apply yet.

**Limitations**
 - For now, you must bring curves into the node tree with an "Object
   Info" node. Changes to the curve modifier stack will come later.
 - Converting to a mesh is necessary to visualize the curve data.

Further progress can be tracked in: T87245
Higher level design document: https://wiki.blender.org/wiki/Modules/Physics_Nodes/Projects/EverythingNodes/CurveNodes

Differential Revision: https://developer.blender.org/D11091
2021-05-03 12:29:17 -05:00
c9d81678d7 Merge branch 'blender-v2.93-release' 2021-05-03 17:10:54 +02:00
73a76608c8 Merge branch 'blender-v2.93-release' 2021-05-03 16:57:34 +02:00
888a697e24 Cleanup: spelling 2021-05-04 00:44:53 +10:00
12d8720b9b WM: disable idle event handling timer when simulating events 2021-05-04 00:39:49 +10:00
0ac6852a42 Movieclip: Use first clip frame for size detection
Using scene frame 1 is not reliable in cases when there is a
frame offset is involved. Using frame 1 seems more reliable,
although might still fail under certain circumstances.

More reliable fix would require a deeper change in the data
structure and the logic about frame loading and size detection.
2021-05-03 16:30:19 +02:00
2f615ad3a9 Fix wrong tracking curves after changing clip offset
The issue was caused by frame start/offset change triggering clip
reload, which was happening with a hardcoded scene frame index of 1,
which could be outside of the actual clip frames.

Solved by removing source change tag from the frame start/offset
update. The source doesn't really change: the resolution will stay
the same, as well as media type, its duration. So the tag was not
needed.
2021-05-03 16:30:19 +02:00
9f1e20e74f Alembic Procedural: precompute vertex normals
This precomputes vertex normals in the procedural and caches them in case none
are found in the archive. This only applies to polygon meshes, as subdivision
meshes are yet to be subdivided, so it is useless to do this computation.

The goal here is to speed up data updates between frames, as computing normals
shows up in profiles even for large objects. This saves around 16% of update time
for a production file.
2021-05-03 16:20:06 +02:00
e2c671e34c Alembic Procedural: refactor data reading
This splits the data reading logic from the AlembicObject class and moves it to
separate files to better enforce a separation of concern. The goal was to simplify
and improve the logic to read data from an Alembic archive.

Since the procedural loads data for the entire animation, this requires looping
over the frame range and looking up data for each frame. Previously those loops
would be duplicated over the entire code causing divergences in how we might
skip or deduplicate data across frames (if only some data change over time and
not other on the same object, e.g. vertices and triangles might not have the
same animation times), and therefore, bugs.

Now, we only use a single function with callback to loop over the geometry data
for each requested frame, and another one to loop over attributes. Given how
attributes are accessed it is a bit tricky to simplify further and only use a
ingle function, however, this is left as a further improvement as it is not
impossible.

To read the data, we now use a set of structures to hold which data to read.
Those structures might seem redundant with the Alembic schemas as they are
somewhat a copy of the schemas' structures, however they will allow us in the
long run to treat the data of one object type as the data of another object
type (e.g. to ignore subdivision, or only loading the vertices as point clouds).

For attributes, this new system allows us to read arbitrary attributes, although
with some limitations still:
* only subdivision and polygon meshes are supported due to lack of examples for
  curve data;
* some data types might be missing: we support float, float2, float3, booleans,
  normals, uvs, rgb, and rbga at the moment, other types can be trivially added
* some attribute scopes (or domains) are not handled, again, due to lack of example
  files
* color types are always interpreted as vertex colors
2021-05-03 16:19:50 +02:00
3e4863376e Cleanup: use boolean for has_event variable & return value 2021-05-04 00:17:45 +10:00
efe9928545 Merge branch 'blender-v2.93-release' 2021-05-03 15:56:28 +02:00
2e9dc2b999 Merge branch 'blender-v2.93-release' 2021-05-03 15:40:58 +02:00
2b78d3d7f3 Merge branch 'blender-v2.93-release' 2021-05-03 15:11:23 +02:00
1d7ee50fef Geometry Nodes: Parallelize attribute nodes
This commit significantly speeds up many of the attribute nodes when
multiple threads are available in linear situations when parallelism
cannot be achieved elsewhere.

See the differential for a table of timing comparisons tested on a
Ryzen 3700x. For an attribute with 4 million elements, the nodes were
about 3 to 9 times faster.

The changes are not exhaustive, other nodes could still be parallelized
in the future. Also, it would be possible to further optimize the grain
size in `parallel_for`, but I'd rather make sure it isn't too small.
I tested some different values, but also relied on intuition--
increasing grain size for less complex operations and vice versa.

Differential Revision: https://developer.blender.org/D11139
2021-05-03 08:00:09 -05:00
2b46606af1 Merge branch 'blender-v2.93-release' 2021-05-03 14:03:00 +03:00
ee8593fe76 Cleanup: clang-tidy 2021-05-03 10:23:15 +02:00
da9b1b9636 Cleanup: clang-tidy 2021-05-03 10:22:12 +02:00
8884385afb Cleanup: format 2021-05-03 04:42:39 +02:00
3bc44233c0 Cycles: use reference count to detect used shaders
Shaders are only compiled if they are used by some other Node (Geometry, Light, etc.).
This usage detection is done before updating the Scene, however it fails at detecting
Shaders used by Procedurals not known to Cycles (e.g. ones defined by third party
applications), as Procedurals are only updated after the shaders are compiled.

To remedy this, we now use the Node reference counting mechanism to detect whether a
Shader is used and therefore should be compiled.

This removes `ShaderManager::update_shaders_used` as it is not needed anymore, however,
since it would also update the Shader ids, this is now performed in
`ShaderManager::device_update`, and a new virtual `device_update_specific` method was
added to handle device updates for SVM and OSL.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D10965
2021-05-03 01:21:12 +02:00
5a964664d6 Cycles: add reference counting to Nodes
This adds a reference count to Nodes which is incremented or decremented
whenever they are added to or removed from a socket, which will help us
track used Nodes throughout the scene graph generically without having to
add an explicit count or flag on specific Node types. This is especially
useful to track Nodes defined through Procedurals out of Cycles' control.

This also modifies the order in which nodes are deleted to ensure that
upon deletion, a Node does not attempt to decrement the reference
count of another Node which was already freed or deleted.

This is not currently used, but will be in the next commit.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D10965
2021-05-03 01:20:33 +02:00
5ffab01930 Merge branch 'blender-v2.93-release' 2021-05-02 16:40:40 -04:00
d8fdb06a81 Merge branch 'blender-v2.93-release' 2021-05-02 15:56:38 +02:00
6b6ae92436 Merge branch 'blender-v2.93-release' 2021-05-02 11:20:27 +02:00
ecc7a83798 UI: Object Thumbnails Orientation Change
Object orientation for thumbnail creation changed to be slightly
oblique (tilted to one side and from above) to better show shape,
especially when axis-aligned. Camera lens changed to 85 to avoid
distortion of close objects like human heads.

see D9940 for details and examples.

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

Reviewed by Julian Eisel
2021-05-01 09:15:03 -07:00
06af6a9efa Merge branch 'blender-v2.93-release' 2021-05-01 17:23:39 +02:00
Germano Cavalcante
6fff2427d6 Python GPU: Replace a few calls of the bgl module with gpu
Concludes these files:
[x]bpy_types.py
[x]operator_modal_draw.py

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D11129
2021-05-01 12:12:58 -03:00
Tomasz Kaye
6111ec8bd3 GPencil: Auto lock layers, tooltip grammar fix
Reviewed By: #grease_pencil, antoniov

Differential Revision: https://developer.blender.org/D11136
2021-05-01 16:41:14 +02:00
503dc97708 Merge branch 'blender-v2.93-release' 2021-05-02 00:13:02 +10:00
d540a858d8 Merge branch 'blender-v2.93-release' 2021-05-01 01:53:34 -04:00
f11a3c36e3 Docs: PyAPI: Fix css selector failing on some pages 2021-05-01 01:28:31 -04:00
5e53504b3b Merge branch 'blender-v2.93-release' 2021-04-30 18:49:44 +02:00
436529d4f6 Merge branch 'blender-v2.93-release' 2021-04-30 18:04:56 +02:00
75536b5a61 Cleanup: compiler warnings 2021-05-01 00:49:55 +10:00
405c3b59e4 Merge branch 'blender-v2.93-release' 2021-05-01 00:46:03 +10:00
313a1c072d BLI: support removing Map elements during iteration
While it was technically safe to call Map.remove while iterating over
a map, it wasn't really designed to work. Also it wasn't very efficient,
because to remove the element, the map would have to search it
again. Now it is possible to remove an element given an iterator
into the map. It is safe to remove the element while iterating over
the map. Obviously, the removed element must not be accessed
anymore after it has been removed.
2021-04-30 16:23:02 +02:00
e7274f9f2d BLI: add a common base class for Map iterators
This is useful for an upcoming commit that allows removing
an element based on an iterator.
2021-04-30 16:23:02 +02:00
2bd9a28ff8 Cleanup: Rename #if GPU_USE_PY_REFERENCES to #ifndef GPU_NO_USE_PY_REFERENCES
This is safer for incremental build.

And there was already a macro `GPU_USE_PY_REFERENCES` used elsewhere.
2021-04-30 11:20:39 -03:00
a711aa5b3c Fix accidental lines removed in the last commit 2021-04-30 11:03:39 -03:00
a35d33d520 Fix gross errors in previous commit 2021-04-30 11:00:57 -03:00
c3a980436d Documentation: Replace the bgl API in the gpu module exemples 2021-04-30 10:50:50 -03:00
2510bd3a5f Python GPU: Add new methods to port the code templates in the manual
This commit adds a new API tha allow to replace the bgl API in the exemples on:
https://docs.blender.org/api/current/gpu.html

**Overview (New API):**
```
gpu.state:      active_framebuffer_get
GPUFramebuffer: read_color
GPUOffscreen:   texture_color
```

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11031
2021-04-30 10:49:54 -03:00
Germano Cavalcante
04b6296e81 Python GPU: Add reference of PyObject GPU object to the GPU object itself
Instead of creating different python wrappers for the same GPU object,
return the same `PyObject` created earlier.

This also allows for more secure access to existing GPU objects.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D11044
2021-04-30 10:42:13 -03:00
c96506d54a Merge branch 'blender-v2.93-release' 2021-04-30 23:41:05 +10:00
8f27ea40d6 Merge branch 'blender-v2.93-release' 2021-04-30 23:13:34 +10:00
Charlie Jolly
95d2d0d35a Geometry Nodes: Add an "Auto" option for Attribute Convert data type
Currently there is an "Auto" option for the domain, this commit adds a
similar option for "Auto" data type, that uses the data type from the
target attribute or the source attribute (in that order).

Ref T87347

Differential Revision: https://developer.blender.org/D10932
2021-04-30 08:11:45 -05:00
6cf28e98fb Object: rename BKE_object_runtime_free, leave data cleared
Rename BKE_object_runtime_free -> BKE_object_runtime_free_data,
since the runtime pointer is part of the object, only the data is freed.

Leave the data cleared to avoid accidental use,
this is in keeping with other `*_free_data()` functions.
2021-04-30 22:38:40 +10:00
3182844914 Fix: missing return 2021-04-30 13:11:49 +02:00
a79b09e762 Merge branch 'blender-v2.93-release' 2021-04-30 20:50:08 +10:00
7f208be929 Fix all objects getting selected sometimes when droppping object
If no other object was selected while dragging one in (e.g. from the Outliner
or an object asset from the Asset Browser), all visible objects in the active
view layer would get selected.
Issue was caused by a wrong enum type use.

Mistake in bcdba7c34d.
2021-04-30 12:37:26 +02:00
7041568ff9 BLI: improve VectorSet data structure
This adds two new methods:
* `clear` just removes all keys from the vector set.
* `index_of_or_add` returns the index of a key and adds it if has not
  been added before.
2021-04-30 11:09:19 +02:00
2b723abea0 Object: improve on fix for Object.to_mesh() crash T86871
While fa7ddd0f43 fixed the reported issue,
the possibility of reusing runtime data during curve-to-mesh conversion
remained. Instead of treating the bounding-box as a special case,
clear all run-time data for temporary objects.

Ref D11026

Reviewed By: sergey
2021-04-30 16:29:03 +10:00
ea17a92cd7 Cleanup: interface_intern.h doc-strings
Also clarify some vague comments & add doxygen section for menu-memory.
2021-04-30 16:17:12 +10:00
67cd6beea0 Cleanup: correct comment 2021-04-30 15:58:04 +10:00
4d7d1b5dae Cleanup: comments in BMesh bisect, use doxygen sections 2021-04-30 15:49:33 +10:00
c51720a6ad Cleanup: rename BKE_pose_channel_{verify => ensure}
The term `verify` doesn't fit with what this function does
and is sometimes used to check data is valid or to control validity
checking as with `RNA_define_verify_sdna`.
use more common term `ensure`.
2021-04-30 15:30:41 +10:00
af3eda8185 Cleanup: rename BKE_pose_channels_hash_{make => ensure}
Use the term `ensure` since it makes it clear the data is
not manipulated if it already exists.
2021-04-30 15:28:13 +10:00
0dde73b4fc Cleanup: use early return in edittranslation_exec 2021-04-30 15:26:17 +10:00
b316aaa0d2 Cleanup: use const variables 2021-04-30 15:24:46 +10:00
5806d7ef54 Cleanup: avoid ambiguous parenthesis 2021-04-30 15:24:24 +10:00
d5ae0290e8 Cleanup: duplicate break 2021-04-30 15:22:59 +10:00
4a82df366f Cleanup: use 'else if' 2021-04-30 15:22:44 +10:00
d286adc26e Cleanup: remove redundant assignments & NULL pointer check 2021-04-30 15:20:44 +10:00
8a1d3bf2b1 Merge branch 'blender-v2.93-release' 2021-04-30 15:16:08 +10:00
a636909aa7 Merge branch 'blender-v2.93-release' 2021-04-30 15:16:06 +10:00
452f32dcb3 Merge branch 'blender-v2.93-release' 2021-04-30 15:16:05 +10:00
5a40c79520 Merge branch 'blender-v2.93-release' 2021-04-30 15:16:04 +10:00
a9a048c726 Merge branch 'blender-v2.93-release' 2021-04-30 15:16:02 +10:00
0959618c2e Merge branch 'blender-v2.93-release' 2021-04-30 15:15:14 +10:00
1597eb82d6 Merge branch 'blender-v2.93-release' 2021-04-30 15:14:47 +10:00
093ab05bcd Merge branch 'blender-v2.93-release' 2021-04-30 15:14:36 +10:00
d1cdbbc5fd Merge branch 'blender-v2.93-release' 2021-04-30 15:14:34 +10:00
3be50c849a Merge branch 'blender-v2.93-release' 2021-04-30 15:14:32 +10:00
Wannes Malfait
47aca2b4c4 Nodes: Add a callback to check for valid socket type
This adds a callback to bNodeTreeType to check which socket types are
valid for the tree type. Function has been implemented for the normal
tree types, and can be implemented for custom node trees with python,
by adding a `classmethod` to the tree. However, only builtin socket
types are supported.

This is relevant for T87049, but it also has the advantage that it is
now clear which node trees support which sockets. Previously this
was assumed to be known by all developers.

Differential Revision: https://developer.blender.org/D10938
2021-04-29 23:36:46 -05:00
ddaeaa4b98 Geometry Nodes: Add a template utility to mix two attribute values
This is just linear interpolation, but it's nice to have an equivalent
to `mix3` for only two values. It will be used for interpolation of
values between bezier spline control points.
2021-04-29 21:52:34 -05:00
45a14a20de Cleanup: Mismatched array bounds in function declaration 2021-04-29 21:25:34 -05:00
8dd5fdca3b Cleanup: Remove unecessary variable
The value of this variable was incremented, but never used.
2021-04-29 15:11:35 -05:00
Antonio Vazquez
41820e8a8e GPencil: Add "Convert Text to Gpencil"
Currently when you try to convert a Text-object to Grease pencil from the Object-menu or via the operator in some other way, the Text-object is only converted to a Curve.

This commit converts that curve to a Grease pencil object.

Differential Revision: https://developer.blender.org/D11117
2021-04-29 17:58:18 +02:00
c9d1143b33 Cleanup: Reduce indentation by returning early 2021-04-29 10:46:55 -05:00
48b8b17da0 Merge branch 'blender-v2.93-release' 2021-04-30 01:43:04 +10:00
Pratik Borhade
9291128bff Clean-up: Edit and comments
- Corrected spellings
- Comments added and edited

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D10991
2021-04-29 12:02:11 -03:00
bcf524328f Fix T87297: Gpencil - Disable Frames and Start delay when use Factor
After talking with the GP team, we agree in disable these options when the factor is used in Build modifier.
2021-04-29 17:01:39 +02:00
3e3363a6ed Merge branch 'blender-v2.93-release' 2021-04-30 00:59:52 +10:00
97923d9b98 GPencil: glow fx, add threshold value color mode
This patch adds a threshold value to the glow effect in color mode.
Currently, the threshold is hardcoded to 5%.
You can select a color and specify a higher threshold to include
similar colors in the effect.

Note: depends on D10670

Reviewed By: #grease_pencil, pepeland

Differential Revision: https://developer.blender.org/D10672
2021-04-29 16:50:21 +02:00
Himanshi Kalra
7134b9daca Added Operator tests: unsubdivide, shading, vertex connect and mark seam
Added tests for:
* Mark Seam
* Shade flat
* Shade smooth
* Unsubdivide
* Vertex Connect Path
* select nth (Checkered Deselect)

Notes:
1) Shade flat, shade smooth are base test cases (to check mesh doesn't change for real)

Updated blend file: tests/modeling/operators.blend

Reviewed By: zazizizou, mont29

Differential Revision: https://developer.blender.org/D10893
2021-04-29 20:15:11 +05:30
738a890025 Merge branch 'blender-v2.93-release' 2021-04-30 00:25:35 +10:00
9bdb2f5e0b Cleanup: Use BLI_findindex instead of loop 2021-04-29 16:04:50 +02:00
734c8f9a77 Merge branch 'blender-v2.93-release' 2021-04-29 16:00:05 +02:00
7627e0980d Merge branch 'blender-v2.93-release' 2021-04-29 23:57:42 +10:00
933de8201e Cleanup: Add float format 2021-04-29 15:45:03 +02:00
Cody Winchester
6a2bc40e01 Gpencil Offset Modifier - Add randomize offset options
This patch adds the Randomize options that exist in the Array modifier to the offset modifier.

Currently the patch uses
```
BLI_findindex(&gpf->strokes, gps);
```
to get the index of the current stroke for making each stroke a different seed value. This is how the noise modifier also gets the stroke seed value and it is noted there as well that this method is slow, and should be fixed in the future with another method of getting the stroke index.
Other methods were explored such as using the total number of points of the stroke, but that makes the randomize options incompatible with other modifiers before it such as Multiple Strokes, Array, Build, and Simplify.

{F9591325}

Differential Revision: https://developer.blender.org/D10171
2021-04-29 15:45:03 +02:00
4225a18b35 Function: add method to create shallow copy of virtual array
Creating a shallow copy is sometimes useful to get a unique ptr
for a virtual array when one only has a reference. It shouldn't
be used usually, but sometimes its the fastest way to do correct
ownership handling.
2021-04-29 15:42:32 +02:00
41945454f7 Correction to own previous commit: Add missing break
Small mistake in 88400f0c03.
Not having this break would be harmless, but we can avoid some unnecessary work
with it.
2021-04-29 13:37:06 +02:00
88400f0c03 Fix incorrect sorting in Asset Browser after renaming local asset
When renaming a data-block that is an asset, while the asset is visible in the
Asset Browser ("Current File" asset library), the list wouldn't re-sort items,
breaking the alphabetical sorting.
This was easily possible while changing the data-block name throught the Asset
Browser's sidebar, while in the "Current File" asset library.
2021-04-29 13:15:42 +02:00
4e10b196ac Functions: make copying virtual arrays to span more efficient
Sometimes functions expect a span instead of a virtual array.
If the virtual array is a span internally already, great. But if it is
not (e.g. the position attribute on a mesh), the elements have
to be copied over to a span.

This patch makes the copying process more efficient by giving
the compiler more opportunity for optimization.
2021-04-29 12:59:44 +02:00
Wannes Malfait
f903e3a3fd Fix build error: use of unintialized variable
Differential Revision: https://developer.blender.org/D11115
2021-04-29 14:49:19 +05:30
868c8e8617 Merge branch 'blender-v2.93-release' 2021-04-29 17:54:58 +10:00
b10649f27b Cleanup: unused variable, spelling 2021-04-29 17:22:26 +10:00
816fc5a308 Merge branch 'blender-v2.93-release' 2021-04-29 17:21:28 +10:00
737a1a85b4 Merge branch 'blender-v2.93-release' 2021-04-29 17:21:25 +10:00
4338595a97 Add break statement missing from 5cb1e18f72 2021-04-29 16:57:33 +10:00
4a2c92ea9c Merge branch 'blender-v2.93-release' 2021-04-29 16:24:10 +10:00
27370aef8f Cleanup: unused warning 2021-04-29 16:22:44 +10:00
14f59a0349 Merge branch 'blender-v2.93-release' 2021-04-28 18:27:47 -04:00
38ebac86cc Cleanup: Use const argument for context 2021-04-28 16:58:43 -05:00
5cb1e18f72 GPencil: Add Layer and Material to Blank objects
Instead to create only the Blank object, now a new Layer and a simple material is added.

This is a common request of artists.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D11110
2021-04-28 23:42:13 +02:00
baa51666ed Merge branch 'blender-v2.93-release' 2021-04-28 20:31:01 +02:00
1012e9bbfa Cleanup: Fix inconcistent array lengths in function declarations
In some cases functions were defined with arguments of different array
lengths in headers vs. implementations. This commit fixes some of the
cases I ran into, but probably not all of them.
2021-04-28 13:13:43 -05:00
cb09d34fde Merge branch 'blender-v2.93-release' 2021-04-28 17:22:55 +02:00
4273ec04be Cleanup: Add float format 2021-04-28 17:10:51 +02:00
YimingWu
f8f7c0ca6d GPencil: Fading based on distance to reference object in Opacity and Thickness modifiers
This patch allows you to dynamically control stroke's opacity and thickness using an object for distance reference in the modifier. Fading range is adjustable, and it is compatible with current curve/vertex group selection.

Reviewed By: #grease_pencil, antoniov, mendio

Maniphest Tasks: T82177, T80194

Differential Revision: https://developer.blender.org/D9091
2021-04-28 16:53:19 +02:00
67a52c8a40 Merge branch 'blender-v2.93-release' 2021-04-28 16:30:20 +02:00
Erik Abrahamsson
11dc674c78 Gpencil: Fix for SVG import arc and float errors
Fix for the Arc commands (A/a) to successfully parse the 4th and 5th arguments.
Fix for floats without a specified integer part, like `.123`

File for testing:
{F10042021}

Reviewed By: filedescriptor

Differential Revision: https://developer.blender.org/D11099
2021-04-28 15:53:12 +02:00
1b5b4b067e Spreadsheet: Add instance IDs from geometry set
Mostly the interesting information about the instances IDs whether they
are -1 or not, but it's still worth displaying them in the editor.
In the future when we can hide or show colums, we could decide to hide
this one by default.

Differential Revision: https://developer.blender.org/D11104
2021-04-28 08:22:10 -05:00
54c5835293 Merge branch 'blender-v2.93-release' 2021-04-28 15:08:19 +02:00
0b7bda808e Merge branch 'blender-v2.93-release' 2021-04-28 23:03:47 +10:00
85d4a733cf WM: quiet event warning when unknown keys are pressed 2021-04-28 22:31:23 +10:00
d71f96073f BLI: improve Vector.remove_and_reorder
The old version was correct as well but did a move even when not necessary.
2021-04-28 10:27:49 +02:00
8a41a12c71 Merge branch 'blender-v2.93-release' 2021-04-28 08:37:10 +02:00
Manuel Castilla
3d902b4b04 Fix Compositor: WorkScheduler task model deletes works
WorkScheduler task model deletes work packages after executing them. The other models don't do so. All models should handle packages the same way.

Reviewed By: #compositing, jbakker

Differential Revision: https://developer.blender.org/D11102
2021-04-28 08:35:31 +02:00
1128258c03 Merge branch 'blender-v2.93-release' 2021-04-28 16:09:19 +10:00
Tyler
a5bb028e78 Replace COM_DEBUG #define with constexpr. Fixes T87035
Reviewed By: jbakker

Maniphest Tasks: T87035

Differential Revision: https://developer.blender.org/D11068
2021-04-28 08:03:30 +02:00
1b6f655abe Merge branch 'blender-v2.93-release' 2021-04-27 23:38:49 -05:00
581f79e734 Merge branch 'blender-v2.93-release' 2021-04-28 13:37:17 +10:00
6a664cc945 UI: Change "Int" to "Integer" in enum item names
We shouldn't abbreviate words like this in the UI. "Int" is just a
programming term.
2021-04-27 19:49:22 -05:00
ac6f6d218c Merge branch 'blender-v2.93-release' 2021-04-27 21:42:31 +02:00
9cd9b35779 Fix T87816: Sculpt curve & line stroke hides dash settings
These settings are used though for these strokes (see
'paint_stroke_use_dash'), should be visible in the UI as well.

This was correctly added when dashing was introduced in rB15f82278d5d4
btw., but then messed up in rBfb74dcc5d69d.

Maniphest Tasks: T87816

Differential Revision: https://developer.blender.org/D11096
2021-04-27 21:20:01 +02:00
8a786fad01 Merge branch 'blender-v2.93-release' 2021-04-27 21:02:31 +02:00
eecaa59513 Fix: Self object missing from geometry nodes evaluator params
This was an oversight in the previous refactoring commit in this file.
2021-04-27 11:42:40 -05:00
4ddff574d7 Fix T87832: Incorrect FOV in line art when sensor fit is not Auto.
Reviewed by Sebastian Parborg

https://developer.blender.org/D11095
2021-04-27 22:34:20 +08:00
Stefan Werner
e714b3a1c3 Cycles: Removed unused macros.
These were leftovers from an earlier way of indexing textures.
2021-04-27 14:30:13 +02:00
3c269f01c3 Cleanup: clang format 2021-04-27 13:11:08 +02:00
908bb03630 Geometry Nodes: improve geometry nodes evaluator internal api
This is a first step towards T87620.
It should not have any functional changes.

Goals of this refactor:
* Move the evaluator out of `MOD_nodes.cc`. That makes it easier to
  improve it in isolation.
* Extract core input/out parameter management out of `GeoNodeExecParams`.
  Managing this is the responsibility of the evaluator. This separation of
  concerns will be useful once we have lazy evaluation of certain inputs/outputs.

Differential Revision: https://developer.blender.org/D11085
2021-04-27 13:03:40 +02:00
a022cffb72 Geometry Nodes: initial Attribute Transfer node
This is a first version of an Attribute Transfer node. It only supports two
modes for mapping attributes from one geometry to another for now.
More options are planned for the future.

Ref T87421.

Differential Revision: https://developer.blender.org/D11037
2021-04-27 12:56:13 +02:00
e240d94191 Merge branch 'blender-v2.93-release' 2021-04-27 12:35:48 +02:00
542f022afd Merge branch 'blender-v2.93-release' 2021-04-26 22:23:55 -05:00
77aac42fbc Cleanup: Make function static 2021-04-26 22:19:39 -05:00
2841d225a9 Merge branch 'blender-v2.93-release' 2021-04-26 22:17:00 -05:00
f5123b1fc9 Merge branch 'blender-v2.93-release' 2021-04-26 20:55:01 -04:00
676ef58a89 Cleanup: Fix unused variable warning in lite build 2021-04-26 17:03:06 -05:00
cb3ea6636e Merge branch 'blender-v2.93-release' 2021-04-26 17:02:15 -05:00
7e17dbfcf3 Cleanup: Move displist.cc to C++
This is a change split from the geometry nodes curves branch. Since
curve object modifier evaluation happens in this file, moving it to C++
will be quite helpful to support the `GeometrySet` type. Other than
that, the code in the branch intends to replace a fair amount of this
file anyway, so I don't plan to do any further cleanup here.

Differential Revision: https://developer.blender.org/D11078
2021-04-26 15:11:53 -05:00
e032ca2e25 Cleanup: Replace modifyVolume with modifyGeometrySet
This allows us to remove a callback from the modifier type info struct.
In the future the these modifiers might just be replaced by nodes
internally anyway, but in the meantime it's nice to unify the handling
of evaluated geometry a bit.

Differential Revision: https://developer.blender.org/D11080
2021-04-26 14:42:03 -05:00
a7bda03516 Fix T87842: Outliner in Blender File mode has large performance impact
The Outliner was doing a full rebuild of its tree in response to transform
notifiers. I don't see any reason for this, a simple redraw without rebuilding
should be just fine.
The same optimization could be done for other object notifiers, but I'll check
on them separately.
2021-04-26 19:30:31 +02:00
607cd463b3 Merge branch 'blender-v2.93-release' 2021-04-26 19:21:24 +02:00
eb0d680851 Merge branch 'blender-v2.93-release' 2021-04-26 18:05:10 +02:00
c266632ff6 LineArt: UI fixes to match the content for 2.93 manual.
Reviewed by: Sebastian Parborg

Differential Revision: https://developer.blender.org/D11089
2021-04-26 23:40:46 +08:00
d89d53b453 Merge branch 'blender-v2.93-release' 2021-04-26 16:44:06 +02:00
bac9562f15 Cleanup: spelling 2021-04-26 22:58:35 +10:00
8f03c9b19a Cleanup: compiler warning 2021-04-26 22:58:35 +10:00
e12a8aedce Cleanup: remove use of deprecated uint32, utin16 types 2021-04-26 22:58:35 +10:00
94960250b5 Cycles: Fix build with OptiX 7.3 SDK 2021-04-26 14:55:39 +02:00
d7c762d2f7 Cleanup: Rearrange the functions in 'transform_convert_mesh.c'
The creation of `TransCustomData` is best located at the beginning of the
file as it is a specific struct of the file and can be used a lot locally.
2021-04-26 09:35:03 -03:00
9b64927a8a Merge branch 'blender-v2.93-release' 2021-04-26 09:16:53 +02:00
c63142ca8f Remove print during compilation. 2021-04-26 07:52:46 +02:00
a200a8cf59 Cleanup: inconsistent naming for screen editing variables & args 2021-04-26 13:47:04 +10:00
36c4b79c30 Merge branch 'blender-v2.93-release' 2021-04-25 21:45:02 -05:00
Pratik Borhade
5341482064 Fix T87777: Fix typo in Prefs Scripts Dir tooltip
Correction to Prefs tooltip mention of 'add-ons' folder in Scripts Dir.

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

Reviewed by Harley Acheson
2021-04-25 18:39:32 -07:00
c76141e425 UI: Adding Constraint to the Area Join Operations
Removing mid-operation area re-targeting for safety and predictability.

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

Reviewed by Campbell Barton
2021-04-25 17:55:00 -07:00
c204e0c385 Fix T87170 Multi-Input socket activation zone error with lots of inputs
Calculation of bounding rect for multi-input socket was wrong.

 Reviewer: Hans Goudey (HooglyBoogly)

 Differential Revision: https://developer.blender.org/D11077
2021-04-25 23:32:41 +02:00
16b2b33d01 BLI: Add "first" method to MutableSpan and Vector
This is convenient because having a uniform interface is nice, and
because of the similarity to "last".

Differential Revision: https://developer.blender.org/D11076
2021-04-25 15:06:38 -05:00
20142b0823 Merge branch 'blender-v2.93-release' 2021-04-25 18:40:04 +02:00
ae58db91a2 Fix T87799: Crash when switching to Info Editor
Use of uninitialized variable.

Problem introduced in 87a70801c6.
2021-04-25 10:41:28 -03:00
87a70801c6 Fix build issue due to previous commit
Revert in rB05dddb71b098 did a poor job and left some
rubbish.
2021-04-24 18:18:43 -06:00
05dddb71b0 Revert "Info Editor: move to c++"
This reverts commit 9cce18a585.

rB9cce18a5858c broke the build in unforeseen ways, not easily fixable.
revert for now, so master will at least build again.
2021-04-24 18:14:15 -06:00
3a6f481d5a Fix windows build: Don't use designated initializers in C++
Removes a cast in an argument followed by an initializer list, and
designated initializers, which are only part of the C++20 standard.
2021-04-24 14:15:57 -05:00
c96f9bd340 Fix T87682 Boolean Exact crash.
The triangulator I made (using CDT) doesn't work if the face
self-intersects. Fall back to the polyfill triangulator when
that happens.
2021-04-24 14:48:44 -04:00
9cce18a585 Info Editor: move to c++
I'm currently doing some experiments in the info editor and
for that it is easier if the info editor is in c++ already.
2021-04-24 17:00:37 +02:00
82328797cf Cleanup: Remove unused flag 2021-04-24 11:46:41 -03:00
b6542f71e1 Cleanup/Refactor: Unify similar flags 2021-04-24 11:46:41 -03:00
f8d5d03ebc Cleanup/Refactor: Move FOREACH_TRANS_DATA_CONTAINER to outside of some functions
So we can reuse the same loop for different corrections.
2021-04-24 11:46:07 -03:00
b06d9069ad Cleanup: Add a common prefix for some transform functions 2021-04-24 11:46:06 -03:00
c2a0ca622b Cleanup: Move transform recaldata functions to their respective files 2021-04-24 11:35:05 -03:00
536a2fe7cc Cleanup: Add a common prefix for some transform functions 2021-04-24 11:35:05 -03:00
86ff35c7fc Merge branch 'blender-v2.93-release' 2021-04-24 23:52:15 +10:00
17fca62fff Merge branch 'blender-v2.93-release' into master 2021-04-24 01:55:49 +05:30
2e513afe80 GPencil: Fix unreported reproject error
This bug was introduced in e1acefd45e
2021-04-23 17:42:56 +02:00
e4cebec647 GPencil: Add Multiframe support to Move to Layer
Reviewed By: mendio

Maniphest Tasks: T87426

Differential Revision: https://developer.blender.org/D11013
2021-04-23 17:27:27 +02:00
be68d00c36 GPencil: Change maximum value for Fill precission
The old value of 5 was not enough for some situations.
2021-04-23 16:58:40 +02:00
17afa86336 Merge branch 'blender-v2.93-release' 2021-04-23 09:56:50 -05:00
8aa8537632 VSE: reset strip transform with "Set Render Size" operator
Reset the active strip offset and scale, in the "Set Render Size"
operator (`SEQUENCER_OT_rendersize`). This ensures that the active strip
will actually fit the new render size, which is what the operator is
intended to achieve.
2021-04-23 16:39:21 +02:00
5e509f966f Cleanup: VSE, reduce cognitive complexity of sequencer_rendersize_exec()
Reduce the cognitive complexity of the `sequencer_rendersize_exec()`
function by flipping some conditions and returning early.

No functional changes.
2021-04-23 16:28:37 +02:00
23185262ab Cleanup: clang-format 2021-04-24 00:03:14 +10:00
877711e9e4 Cleanup: use const arguments, reduce right shift 2021-04-24 00:02:44 +10:00
8adeac7c27 Merge branch 'blender-v2.93-release' 2021-04-23 14:35:40 +02:00
361579c86a Merge branch 'blender-v2.93-release' 2021-04-23 13:09:41 +02:00
4cb8438e08 Geometry Nodes: warn when output attribute has not been saved 2021-04-23 12:44:59 +02:00
f8e1526fa6 Fix T87661: Attribute Combine XYZ node can't overwrite existing attribute 2021-04-23 12:44:21 +02:00
ffa8563429 Merge branch 'blender-v2.93-release' 2021-04-23 10:17:25 +02:00
Jagannadhan Ravi
425e19bc1f Modifiers: Performance Simple Deformation
Use multiprocessing with simple deform modifiers.

Master 2.92 fps this patch 3.13 fps on Ryzen 1700X With Vega 64 GPU.

3970X: 2.85 fps -> 2.95 fps
3990X: 3.15 fps -> 3.41 fps
3995WX: 3.21 fps -> 3.38 fps

Reviewed By: jbakker

Differential Revision: https://developer.blender.org/D10609
2021-04-23 10:07:06 +02:00
cfa20ff03b Fix T86566: Do Not Close if File Cannot Be Saved
If saving a file using CloseSave dialog, do not close if there is an error doing so, like if read-only.

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

Reviewed by Julian Eisel
2021-04-22 20:08:17 -07:00
8b049e4c2a UI: Join or Close Any Screen Area
Corner action zones allow joining any neighbors. New 'Area Close' operator. Improved Header Context Menu.

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

Reviewed by Campbell Barton
2021-04-22 19:57:49 -07:00
5a33965627 Merge branch 'blender-v2.93-release' 2021-04-23 11:33:22 +10:00
76fcf58cdd Merge branch 'blender-v2.93-release' 2021-04-23 10:02:46 +10:00
47892d6695 Fix too big grid plane for Add Object tool on Retina displays
The grid plane was drawn too big on retina displays compared to other screens,
because the factor was multiplied by the native pixel-size, which is 2 for
Retina displays.
2021-04-22 19:45:44 +02:00
6ebe0b8cf0 Assets: Correct name of own recently added BPY functions
Makes the functions (introduced in 557b3d2762) follow existing naming
conventions for the API.

Changes:
`bpy.types.ID.mark_asset` to `bpy.types.ID.asset_mark`
`bpy.types.ID.clear_asset` to `bpy.types.ID.asset_clear`
2021-04-22 19:26:09 +02:00
bbb52a462e Fix T87688: Crash entering valid text into number field
When the user entered a driver expression like `#frame` into a number
field, Blender would crash sometime after. This is because
e1a9ba94c5 did not handle this case properly and ignored the fact
that the user can enter text into the field.

The fix makes sure that we only cancel if the value is a *number* equal
to the previous value in the field.

Note that this could also be handled by `ui_but_string_set` which would
be a bit nicer potentially. However, I was unable to find a clean way of
passing `data->startvalue` into that function. `uiHandleButtonData` is
only known locally inside `interface_handlers.c`.

Reviewed By: Severin

Maniphest Tasks: T87688

Differential Revision: https://developer.blender.org/D11049
2021-04-22 19:02:48 +02:00
d1ccc5b969 Geometry Nodes: Add initializer for attribute creation
Previously we always had to set attribute values after creating
the attribute. This patch adds an initializer argument to
`attribute_try_create` which can fill it in a few ways, which
are explained in code comments.

This fixes T87597.

Differential Revision: https://developer.blender.org/D11045
2021-04-22 09:20:03 -05:00
9fccbe2d13 Fix missing include 2021-04-22 10:09:15 -03:00
b9a7b40924 Geometry Nodes: Get attribute domain and type without allocation
Because we use virtual classes (and for other reasons), we had to do a
small allocation when simply retrieving the data type and domain of an
existing attribute. This happened quite a lot actually-- to determine
these values for result attributes.

This patch adds a simple function to retrieve this meta data without
building the virtual array. This should lower the overhead of every
attribute node, though the difference probably won't be noticible
unless a tree has very many nodes.

Differential Revision: https://developer.blender.org/D11047
2021-04-22 08:05:02 -05:00
f6efacfec7 Merge branch 'blender-v2.93-release' 2021-04-22 09:58:52 -03:00
c3701e2303 Merge branch 'blender-v2.93-release' 2021-04-22 14:26:29 +02:00
8c146d5efc Merge branch 'blender-v2.93-release' 2021-04-22 12:49:34 +02:00
1095d5964d Cleanup: doversion for 3.0 is using FileData 2021-04-22 12:19:01 +02:00
7192ab614b Animation: add "LocRotScaleCProp" keying set
Add a keying set that includes location, rotation, scale, and custom
properties.

The keying set is intentionally not based on the "Whole Character"
keying set. Instead, it is generic enough to be used in both object and
pose animation, making it possible to quickly switch between animating
characters and props without switching keying sets.

This is, according to @rikkert, what the Blender Studio animators need
99.9% of the time.
2021-04-22 10:33:07 +02:00
91c652e39a Fix: Deactivate audio settings when output is None 2021-04-22 10:23:02 +02:00
33d9a0c951 Merge branch 'blender-v2.93-release' 2021-04-22 16:33:37 +10:00
a4bd0fcabf Merge branch 'blender-v2.93-release' 2021-04-22 08:25:40 +02:00
48c5129d1f Fix errors in Buffer.dimensions setter
- Error accessing the length from a sequence.
- Error comparing a boolean to -1.

Issues introduced in 19360c2c1c
2021-04-22 12:34:26 +10:00
932b23782a Merge branch 'blender-v2.93-release' 2021-04-21 17:15:46 -03:00
19360c2c1c Python GPU Buffer: Add a 'setter' to Buffer.dimensions
The attribute `Buffer.dimensions` does not need to be readonly.
2021-04-21 17:07:11 -03:00
ef9551afd1 Merge branch 'blender-v2.93-release' 2021-04-21 18:00:26 +02:00
3da74c1c18 Geometry Nodes: add method to get attribute by name and type
This is needed by the upcoming Attribute Transfer node. It changes
its behavior based on what domain the attribute is on.
2021-04-21 17:07:00 +02:00
1dd17726f2 Geometry Nodes: extract mesh surface sampling functions to separate file 2021-04-21 17:02:19 +02:00
d5309bf4cf Functions: add slice method for generic spans 2021-04-21 16:59:22 +02:00
b9cbf7fc80 Geometry Nodes: add utility to convert CPPType to static type 2021-04-21 16:57:43 +02:00
9fa9854e2a Merge branch 'blender-v2.93-release' 2021-04-21 16:22:40 +02:00
7aa6444a65 UI: Use proper close file dialog for "Restore Last Session"
Was showing a simple confirm dialog, even if the file didn't contain
unsaved changes. The confirm dialog would also show up when choosing
"Restore Last Session" from the splash screen right after startup, which
is weird.

Instead show the proper file closing dialog that allows saving, but only
if there are actually unsaved changes.
2021-04-21 15:18:05 +02:00
e9e2805573 Cleanup: Deduplicate file closing dialog logic
Was doing almost the same thing in two places, plus I need the same for
a third case. So better have a helper function for it.
2021-04-21 15:18:05 +02:00
0b458e8322 Cleanup: Create/use types for generic WM callbacks
Makes it less of a hassle to pass these callbacks around as function
arguments, and deduplicates their signature when doing so.
2021-04-21 15:18:05 +02:00
2e3f072d5d Merge branch 'blender-v2.93-release' 2021-04-21 13:14:26 +02:00
183e3f6bb9 Fix T86968: Last UV factor in cyclic strokes
The UV factor of the last point of a cyclic stroke was using the factor of
the first point leading to unwanted scaling artifacts.

The fix sets the uv factor of the last point to the currect value (last UV
factor + length between last and first point).

Reviewed By: antoniov, fclem

Maniphest Tasks: T86968

Differential Revision: https://developer.blender.org/D10850
2021-04-21 12:16:32 +02:00
d17bff849d Merge branch 'blender-v2.93-release' 2021-04-21 11:19:57 +02:00
5fe3d2dc7d Merge branch 'blender-v2.93-release' 2021-04-21 11:05:40 +02:00
79d2f2c2f9 Merge branch 'blender-v2.93-release' 2021-04-21 17:43:55 +10:00
f9867c1f11 Merge branch 'blender-v2.93-release' 2021-04-21 17:43:51 +10:00
3003fbbecf Merge branch 'blender-v2.93-release' 2021-04-21 13:48:10 +10:00
c5cabb6eb7 Correction to previous commit: Avoid unnecessary notifier
Not a big deal, but nice to avoid notifiers when no change was done.
2021-04-20 22:43:43 +02:00
557b3d2762 Assets: Add BPY function to mark and clear assets
Adds `mark_asset()` and `clear_asset()` to ID data-blocks, e.g.
`bpy.context.active_object.mark_asset()`. They essentially do the same as the
mark and clear asset operators.

Scripts are generally discouraged from using operators where possible, but we
need to provide API functions to use instead. In this case it means scripts
don't have to override context to pass an ID to the operator.
2021-04-20 22:36:48 +02:00
847579b422 Add support for building on Linux aarch64
Differential Revision: https://developer.blender.org/D10958
2021-04-20 18:45:46 +02:00
f2626f1420 Merge branch 'blender-v2.93-release' 2021-04-20 17:45:36 +02:00
f1b61f5e7d Core: Add do_versions file for 3.0
Differential Revision: https://developer.blender.org/D11030
2021-04-20 17:13:20 +02:00
e2af5030b9 Cleanup: comments
- Restore comment removed by accident in
  8c5c55b8c9
- Use doxygen syntax.
2021-04-21 00:51:27 +10:00
2c1a2c9a99 Merge branch 'blender-v2.93-release' 2021-04-21 00:21:29 +10:00
eca5cf1460 Cleanup: keying sets, move common code to mix-in class
Move code common to the Whole Character keying sets ("Whole Character" and
"Whole Character (Selected Bones Only)" into a mix-in class. This avoids
the need to use direct assignments like
`poll = BUILTIN_KSI_WholeCharacter.poll`.

No functional changes.
2021-04-20 15:52:43 +02:00
26d778cd8a Cleanup: keying sets, use self as self-parameter
Use `self` as self-parameter of methods, instead of the non-standard and
cryptic `ksi`.

No functional changes.
2021-04-20 15:52:43 +02:00
e1a9ba94c5 Fix T87637: Dragging button value cancel not working
Dragging a number button, then holding the value and pressing escape
would not reset the value correctly.
This was because eb06ccc324 assumed that `data->value` and
`data->startvalue` were set during dragging which they are not.

The fix moves the if statement into the section where we check if a
number was entered (number edit) making sure that we only cancel
if the button was in "string enter" mode and that the value entered
was the same as before.

Reviewed By: HooglyBoogly, Severin

Maniphest Tasks: T87637

Differential Revision: https://developer.blender.org/D11021
2021-04-20 15:46:52 +02:00
7834fcc67d Merge branch 'blender-v2.93-release' 2021-04-20 11:19:43 +02:00
b2c6eb8640 Merge branch 'blender-v2.93-release' 2021-04-20 11:02:29 +02:00
2efd3509ee Merge branch 'blender-v2.93-release' 2021-04-20 10:06:30 +02:00
8c0f7d1772 Geometry Nodes: support geometry nodes modifier on volume objects
Differential Revision: https://developer.blender.org/D11011
2021-04-20 09:30:53 +02:00
5d2ec2bc08 Cleanup: clang tidy readability-inconsistent-declaration-parameter-name 2021-04-20 09:25:15 +02:00
8c5c55b8c9 Cleanup: uiBut.flag had an internal flag out of the documented range
Increase range of internal flags & order UI_SEARCH_FILTER_NO_MATCH
within this range, so public button flags aren't accidentally added
that overlap with internal flags.
2021-04-20 15:44:21 +10:00
5e82e77112 Cleanup: remove redundant code/comments from BKE_mesh_nomain_to_mesh 2021-04-20 15:28:27 +10:00
b760481f8d Merge branch 'blender-v2.93-release' 2021-04-20 15:21:25 +10:00
7ccd19fc12 PyAPI: update docs to include poll_message_set reference
Part of D9738
2021-04-20 12:29:04 +10:00
ebe04bd3ca PyAPI: support Operator.poll functions 'disabled' hint
Python scripts can now define the reason it's poll function fails using:

`Operator.poll_message_set(message, ...)`

This supports both regular text as well as delaying message creation
using a callback which should be used in situations where constructing
detailed messages is too much overhead for a poll function.

Ref D11001
2021-04-20 12:07:01 +10:00
985ccba77c Cleanup: add CTX_wm_operator_poll_msg_clear
Call this function instead of `CTX_wm_operator_poll_msg_set(C, NULL)`
2021-04-20 11:42:00 +10:00
795f024558 Merge branch 'blender-v2.93-release' 2021-04-19 22:49:14 +02:00
2d1d6fbb23 Merge branch 'blender-v2.93-release' 2021-04-19 21:07:42 +02:00
d1fbf1599f Cycles: include more transparency and emission in fast GI approximation
For indirect light rays, don't assume any hit is opaque, rather if it has
transparency or emission do the shading but don't do any further bounces.

Naturally this is slower when there are transparent surfaces, however
without this cutout opacity doesn't give sensible results.

Differential Revision: https://developer.blender.org/D10985
2021-04-19 21:07:40 +02:00
b42454be8b Cleanup: move BVH utility functions into own file 2021-04-19 21:07:34 +02:00
68cbf0a2be Cleanup: Clang tidy, clang format 2021-04-19 13:48:25 -05:00
c13b3dd168 Merge branch 'blender-v2.93-release' 2021-04-19 12:32:14 -05:00
2dc5961874 Merge branch 'blender-v2.93-release' 2021-04-19 12:25:45 -05:00
458cbcbfea Merge branch 'blender-v2.93-release' 2021-04-19 11:12:42 -05:00
8032bd98d8 GPencil: Add Layer Mask ordering buttons
Now the list of masks can be ordered as is done in Layers.

This can be used to organize list and in the future refquired for new masking options.
2021-04-19 17:44:40 +02:00
f99f884444 GPencil: Rename Draw" mode to Draw Mode` 2021-04-19 17:12:39 +02:00
feedf28549 Changes missed from 4402c2324b 2021-04-20 00:25:54 +10:00
4402c2324b Cleanup: use 'wmOperator.ptr' in draw functions
Draw functions used RNA_pointer_create to create the pointer,
however this already exists in the operator.
2021-04-20 00:14:37 +10:00
e1acefd45e GPencil: Add multiframe support to Reproject operator
Before only active frame was supported

Related to T87425
2021-04-19 15:58:41 +02:00
46a13482cb Cleanup: spelling 2021-04-19 23:56:12 +10:00
33440760a6 Merge branch 'blender-v2.93-release' 2021-04-19 23:54:06 +10:00
eb06ccc324 Fix T87448: Avoid uiBut update if value was same
Previously, clicking into a number field, changing nothing and then
clicking outside the field again would trigger an update (RNA prop
would be set to the same value again). This could potentially cause
an expensive operation (like a modifer) to run again, even if all the
parameters were identical.

The fix prevents this by treating unchanging values in the field as a
cancel operation.

Reviewed By: Severin

Maniphest Tasks: T87448

Differential Revision: https://developer.blender.org/D10976
2021-04-19 12:20:05 +02:00
Eitan
799f532f46 Geometry Nodes: new Switch node
This is a first iteration of a switch node. It can only switch between
two inputs values based on a boolean. A more sophisticated switch
node that has an integer selector will probably come later.

Currently, the geometry nodes evaluator does not support lazy evaluation
of individual inputs. Therefore, all inputs will be computed currently.
An improvement to the evaluator will be worked on separately.

Ref: T85374

Differential Revision: https://developer.blender.org/D10460
2021-04-19 10:38:50 +02:00
112fb77157 Merge branch 'blender-v2.93-release' 2021-04-19 17:36:59 +10:00
1d96493c2f Merge branch 'blender-v2.93-release' 2021-04-19 17:36:56 +10:00
969cc22a89 Merge branch 'blender-v2.93-release' 2021-04-19 17:36:54 +10:00
eae39a4973 Merge branch 'blender-v2.93-release' 2021-04-19 17:36:51 +10:00
0af28f007f Cleanup: Rename variables to indicate what is evaluated
`ob` --> `ob_eval`
`me` --> `me_eval`
`em` --> `em_eval`
2021-04-19 00:24:43 -03:00
950d8360f8 Fix typo in previous commit
`has_loose_edge` -> `has_loose_vert`
2021-04-18 20:45:06 -03:00
1825e67dea Transform Snap Object: Improve code that detects updates
The previous code had unclear hacks to avoid updating while transforming,
it was also duplicated in two functions causing an inconsistent
initialization of the looptris bvhtree (which could even generate
unpredictable snapping results).

Now, detection update and inicializatiom of common members are contained in
`snap_object_data_mesh_get` and `snap_object_data_editmesh_get`.

Also, the "Hack to avoid updating while transforming" is more evident.
2021-04-18 20:07:05 -03:00
c8dd684b65 Cleanup: Use utility to init userdata in 'transfrom_snap_object.c'
This deduplicates the code making it easier to edit.
2021-04-18 20:07:05 -03:00
6879868814 Merge branch 'blender-v2.93-release' 2021-04-18 20:06:32 -03:00
9a69653b42 Merge branch 'blender-v2.93-release' 2021-04-18 11:59:36 -05:00
76eae59648 Cleanup: make format 2021-04-18 09:51:03 +02:00
01448ee7ce Cleanup: clang tidy readability-else-after-return 2021-04-18 09:49:14 +02:00
8d30a7a1cf Merge branch 'blender-v2.93-release' 2021-04-17 17:13:12 -03:00
1544bcfc37 Measure Tool: Snap to Cage Geometry
For Measure tool, it is more useful to snap to what is really visible.

So use the cage instead of the geometry that may be hidden with Bmesh.
2021-04-17 16:51:19 -03:00
4e1507bd3b Snap Gizmo Refactor: Implement options for the gizmo behavior
The Snap Gizmo now has options for occlusion, selection filter and edit
geometry.

It will be useful to implement in current tools.
2021-04-17 16:51:19 -03:00
1fc446a908 Fix recent snap refactor
It is important to check if editmesh eval cage is also bmesh.
2021-04-17 16:50:49 -03:00
aca9a1bac3 Transform Snap Refactor: Use enum for cage snap options
This allows the addition of the `SNAP_GEOM_CAGE` option.
Currently unused.
2021-04-17 15:45:08 -03:00
ebcf49fe1a Merge branch 'blender-v2.93-release' 2021-04-17 14:22:57 -04:00
3516ee5a14 Merge branch 'blender-v2.93-release' 2021-04-17 19:23:12 +02:00
1a010450bc BLI: add unit tests for recently added methods 2021-04-17 19:06:48 +02:00
eff2b89446 BLI: support multiple parameters in Stack.push_as 2021-04-17 19:06:48 +02:00
686452fb1b BLI: add Vector.append_as method
This method is similar to `std::vector::emblace_back` in that it constructs
the new object inplace in the vector, removing the need for a move.

The `_as` suffix is consistent with similar behavior in Map and Set data structures.
2021-04-17 19:06:48 +02:00
e4990a5658 Fix wrong logic used in 'ED_view3d_depth_read_cached'
It is important to limit the pixels read on `BLI_array_iter_spiral_square`.

Fortunately `ED_view3d_depth_read_cached` was not being called with a
`margin` parameter.

Wrong logic introduced in rB44c76e4ce310.
2021-04-17 13:52:31 -03:00
d0d85742fc BLI: support multiple arguments for value in *_as methods of Map
This allows us to build more complex values in-place in the map.
Before those values had to be build separately and then moved into the map.

Existing calls to the Map API remain unchanged.
2021-04-17 18:39:35 +02:00
5cf6f570c6 Geometry Nodes: use virtual arrays in internal attribute api
A virtual array is a data structure that is similar to a normal array
in that its elements can be accessed by an index. However, a virtual
array does not have to be a contiguous array internally. Instead, its
elements can be layed out arbitrarily while element access happens
through a virtual function call. However, the virtual array data
structures are designed so that the virtual function call can be avoided
in cases where it could become a bottleneck.

Most commonly, a virtual array is backed by an actual array/span or
is a single value internally, that is the same for every index.
Besides those, there are many more specialized virtual arrays like the
ones that provides vertex positions based on the `MVert` struct or
vertex group weights.

Not all attributes used by geometry nodes are stored in simple contiguous
arrays. To provide uniform access to all kinds of attributes, the attribute
API has to provide virtual array functionality that hides the implementation
details of attributes.

Before this refactor, the attribute API provided its own virtual array
implementation as part of the `ReadAttribute` and `WriteAttribute` types.
That resulted in unnecessary code duplication with the virtual array system.
Even worse, it bound many algorithms used by geometry nodes to the specifics
of the attribute API, even though they could also use different data sources
(such as data from sockets, default values, later results of expressions, ...).

This refactor removes the `ReadAttribute` and `WriteAttribute` types and
replaces them with `GVArray` and `GVMutableArray` respectively. The `GV`
stands for "generic virtual". The "generic" means that the data type contained
in those virtual arrays is only known at run-time. There are the corresponding
statically typed types `VArray<T>` and `VMutableArray<T>` as well.

No regressions are expected from this refactor. It does come with one
improvement for users. The attribute API can convert the data type
on write now. This is especially useful when writing to builtin attributes
like `material_index` with e.g. the Attribute Math node (which usually
just writes to float attributes, while `material_index` is an integer attribute).

Differential Revision: https://developer.blender.org/D10994
2021-04-17 16:41:39 +02:00
4dca44086f Merge branch 'blender-v2.93-release' 2021-04-17 15:40:22 +02:00
3608891282 Functions: extend virtual array functionality
This adds support for mutable virtual arrays and provides many utilities
for creating virtual arrays for various kinds of data. This commit is
preparation for D10994.
2021-04-17 15:13:20 +02:00
e524a6ecf7 Snap Gizmo: Improve event comparison code
Better distinction between modifier key events and mouse position events.

No functional changes.
2021-04-16 14:44:10 -03:00
fc37b265c8 Merge branch 'blender-v2.93-release' 2021-04-16 11:42:36 -05:00
7eda4cde71 Merge branch 'blender-v2.93-release' 2021-04-16 18:00:38 +02:00
cf6d10ef46 Merge branch 'blender-v2.93-release' 2021-04-16 17:44:36 +02:00
537460b86d Merge branch 'blender-v2.93-release' 2021-04-17 01:32:28 +10:00
c7a8bcfa37 Merge branch 'blender-v2.93-release' 2021-04-17 00:21:30 +10:00
bfc0f483c6 Merge branch 'blender-v2.93-release' 2021-04-16 23:53:04 +10:00
7aa38de085 Merge branch 'blender-v2.93-release' 2021-04-16 22:14:56 +10:00
0edfa5350e Merge branch 'blender-v2.93-release' 2021-04-16 22:14:53 +10:00
be34d14575 Merge branch 'blender-v2.93-release' 2021-04-16 13:46:21 +02:00
45eafd6562 Merge branch 'blender-v2.93-release' 2021-04-16 15:10:57 +10:00
073ef4d265 Merge branch 'blender-v2.93-release' 2021-04-16 15:10:52 +10:00
cb4646a6df Merge branch 'blender-v2.93-release' 2021-04-16 12:20:38 +10:00
0567f2b0bb Merge branch 'blender-v2.93-release' 2021-04-15 23:15:24 -03:00
62bff15377 Fix various Blender 3.0 versioning issues
This changes the following items:

- package name is now `blender-3.0.0-git.09eb04c0a865-windows64`
  rather than `blender-3.00.0-git.09eb04c0a865-windows64`
- Fix version resource for blender.exe not building
- Data directories are now `3.0\...` rather than `3.00\....`
- User prefs are now in:
  `c:\Users\users\AppData\Roaming\Blender Foundation\Blender\3.0\`
  rather than:
  `c:\Users\users\AppData\Roaming\Blender Foundation\Blender\3.00\`
- Updating startup & preferences from previous release
  has a special exception for 3.0 to check for 3.93 and older.

See T87532

Ref D10986
2021-04-16 11:23:34 +10:00
ec241eb0d0 Merge branch 'blender-v2.93-release' 2021-04-15 19:14:23 +02:00
09eb04c0a8 Merge branch 'blender-v2.93-release' 2021-04-15 17:26:18 +02:00
ced26bacb7 Merge branch 'blender-v2.93-release' 2021-04-15 09:17:12 -05:00
27005f58c5 Blender Python version string to use the new version number system 2021-04-15 16:01:50 +02:00
bd8fd78b40 Merge branch 'blender-v2.93-release' 2021-04-15 15:52:44 +02:00
6e39da7948 Blender 3.0 version bump
Blender 3.0 is now in bcon1 (alpha).

There are likely a few places in Blender and the automated building pipeline
that may fail since we are switching our versioning number system.

For example, at the moment the splash and the status bar are showing
3.00.0, and it should show 3.1.0.

I suspect the Python API, version used to report a bug, buildname, are
all wrong too. These will be handled later.
2021-04-15 15:42:41 +02:00
61c3d7aa2c Bump subversion before starting the next release cycle 2021-04-15 15:32:17 +02:00
8380 changed files with 761841 additions and 587693 deletions

View File

@@ -180,6 +180,7 @@ ForEachMacros:
- CTX_DATA_BEGIN_WITH_ID
- DEG_OBJECT_ITER_BEGIN
- DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN
- DRW_ENABLED_ENGINE_ITER
- DRIVER_TARGETS_LOOPER_BEGIN
- DRIVER_TARGETS_USED_LOOPER_BEGIN
- FOREACH_BASE_IN_EDIT_MODE_BEGIN
@@ -255,6 +256,7 @@ ForEachMacros:
- SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN
- SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN
- SEQ_ALL_BEGIN
- SEQ_ITERATOR_FOREACH
- SURFACE_QUAD_ITER_BEGIN
- foreach
- ED_screen_areas_iter
@@ -264,4 +266,8 @@ ForEachMacros:
- VECTOR_SET_SLOT_PROBING_BEGIN
StatementMacros:
- PyObject_HEAD
- PyObject_VAR_HEAD
MacroBlockBegin: "^BSDF_CLOSURE_CLASS_BEGIN$"
MacroBlockEnd: "^BSDF_CLOSURE_CLASS_END$"

View File

@@ -12,6 +12,8 @@ Checks: >
-readability-avoid-const-params-in-decls,
-readability-simplify-boolean-expr,
-readability-make-member-function-const,
-readability-suspicious-call-argument,
-readability-redundant-member-init,
-readability-misleading-indentation,
@@ -25,6 +27,8 @@ Checks: >
-bugprone-branch-clone,
-bugprone-macro-parentheses,
-bugprone-reserved-identifier,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-sizeof-expression,
-bugprone-integer-division,
@@ -40,7 +44,8 @@ Checks: >
-modernize-pass-by-value,
# Cannot be enabled yet, because using raw string literals in tests breaks
# the windows compiler currently.
-modernize-raw-string-literal
-modernize-raw-string-literal,
-modernize-return-braced-init-list
CheckOptions:
- key: modernize-use-default-member-init.UseAssignment

View File

@@ -42,3 +42,12 @@ insert_final_newline = true
indent_style = space
indent_size = 3
max_line_length = 120
# Makefile
[{Makefile,GNUmakefile}]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = tab
indent_size = 4
max_line_length = 120

5
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,5 @@
This repository is only used as a mirror of git.blender.org. Blender development happens on
https://developer.blender.org.
To get started with contributing code, please see:
https://wiki.blender.org/wiki/Process/Contributing_Code

View File

@@ -1,23 +1,5 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2006, Blender Foundation
# All rights reserved.
#
# ***** END GPL LICENSE BLOCK *****
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2006 Blender Foundation. All rights reserved.
#-----------------------------------------------------------------------------
# We don't allow in-source builds. This causes no end of troubles because
@@ -30,7 +12,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
"CMake generation for blender is not allowed within the source directory!"
"\n Remove \"${CMAKE_SOURCE_DIR}/CMakeCache.txt\" and try again from another folder, e.g.:"
"\n "
"\n rm CMakeCache.txt"
"\n rm -rf CMakeCache.txt CMakeFiles"
"\n cd .."
"\n mkdir cmake-make"
"\n cd cmake-make"
@@ -110,6 +92,10 @@ if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# Install CODE|SCRIPT allow the use of generator expressions.
if(POLICY CMP0087)
cmake_policy(SET CMP0087 NEW)
endif()
#-----------------------------------------------------------------------------
# Load some macros.
include(build_files/cmake/macros.cmake)
@@ -152,6 +138,16 @@ get_blender_version()
option(WITH_BLENDER "Build blender (disable to build only the blender player)" ON)
mark_as_advanced(WITH_BLENDER)
if(APPLE)
# In future, can be used with `quicklookthumbnailing/qlthumbnailreply` to create file
# thumbnails for say Finder. Turn it off for now.
option(WITH_BLENDER_THUMBNAILER "Build \"blender-thumbnailer\" thumbnail extraction utility" OFF)
elseif(WIN32)
option(WITH_BLENDER_THUMBNAILER "Build \"BlendThumb.dll\" helper for Windows explorer integration" ON)
else()
option(WITH_BLENDER_THUMBNAILER "Build \"blender-thumbnailer\" thumbnail extraction utility" ON)
endif()
option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
@@ -174,6 +170,13 @@ mark_as_advanced(CPACK_OVERRIDE_PACKAGENAME)
mark_as_advanced(BUILDINFO_OVERRIDE_DATE)
mark_as_advanced(BUILDINFO_OVERRIDE_TIME)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16")
option(WITH_UNITY_BUILD "Enable unity build for modules that support it to improve compile times" ON)
mark_as_advanced(WITH_UNITY_BUILD)
else()
set(WITH_UNITY_BUILD OFF)
endif()
option(WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON)
option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke, ocean sim, and audio effects)" ON)
@@ -254,10 +257,12 @@ endif()
if(UNIX AND NOT APPLE)
option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" OFF)
option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system" ON)
option(WITH_SYSTEM_FREETYPE "Use the freetype library provided by the operating system" OFF)
else()
# not an option for other OS's
set(WITH_SYSTEM_GLEW OFF)
set(WITH_SYSTEM_GLES OFF)
set(WITH_SYSTEM_FREETYPE OFF)
endif()
@@ -279,6 +284,7 @@ option(WITH_IMAGE_TIFF "Enable LibTIFF Support" ON)
option(WITH_IMAGE_DDS "Enable DDS Image Support" ON)
option(WITH_IMAGE_CINEON "Enable CINEON and DPX Image Support" ON)
option(WITH_IMAGE_HDR "Enable HDR Image Support" ON)
option(WITH_IMAGE_WEBP "Enable WebP Image Support" OFF)
# Audio/Video format support
option(WITH_CODEC_AVI "Enable Blenders own AVI file support (raw/jpeg)" ON)
@@ -349,7 +355,7 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
# Misc
if(WIN32)
if(WIN32 OR APPLE)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
endif()
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
@@ -384,45 +390,75 @@ if(WITH_PYTHON_INSTALL)
set(PYTHON_REQUESTS_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'requests' module")
mark_as_advanced(PYTHON_REQUESTS_PATH)
endif()
option(WITH_PYTHON_INSTALL_ZSTANDARD "Copy zstandard into the blender install folder" ON)
set(PYTHON_ZSTANDARD_PATH "" CACHE PATH "Path to python site-packages or dist-packages containing 'zstandard' module")
mark_as_advanced(PYTHON_ZSTANDARD_PATH)
endif()
option(WITH_CPU_SIMD "Enable SIMD instruction if they're detected on the host machine" ON)
mark_as_advanced(WITH_CPU_SIMD)
# Cycles
option(WITH_CYCLES "Enable Cycles Render Engine" ON)
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
option(WITH_CYCLES_OSL "Build Cycles with OSL support" ON)
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON)
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX OPENCL)" )
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build Cycles with extra debug capabilities" OFF)
option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF)
option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF)
option(WITH_CYCLES "Enable Cycles Render Engine" ON)
option(WITH_CYCLES_OSL "Build Cycles with OpenShadingLanguage support" ON)
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG "Build Cycles with options useful for debugging (e.g., MIS)" OFF)
option(WITH_CYCLES_STANDALONE "Build Cycles standalone application" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build Cycles standalone with GUI" OFF)
option(WITH_CYCLES_HYDRA_RENDER_DELEGATE "Build Cycles Hydra render delegate" OFF)
option(WITH_CYCLES_DEBUG_NAN "Build Cycles with additional asserts for detecting NaNs and invalid values" OFF)
option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF)
option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF)
set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX HIP)" )
mark_as_advanced(WITH_CYCLES_KERNEL_ASAN)
mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG)
mark_as_advanced(WITH_CYCLES_DEBUG_NAN)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON)
option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles OptiX support" OFF)
option(WITH_CYCLES_DEVICE_OPENCL "Enable Cycles OpenCL compute support" ON)
option(WITH_CYCLES_NETWORK "Enable Cycles compute over network support (EXPERIMENTAL and unfinished)" OFF)
mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
mark_as_advanced(WITH_CYCLES_DEVICE_OPENCL)
mark_as_advanced(WITH_CYCLES_NETWORK)
# NVIDIA CUDA & OptiX
if(NOT APPLE)
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles NVIDIA CUDA compute support" ON)
option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles NVIDIA OptiX support" ON)
mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
mark_as_advanced(WITH_CUDA_DYNLOAD)
option(WITH_CYCLES_CUDA_BINARIES "Build Cycles NVIDIA CUDA binaries" OFF)
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime (for developers, makes cuda-gdb work)" ON)
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
mark_as_advanced(WITH_CUDA_DYNLOAD)
endif()
# AMD HIP
if(NOT APPLE)
if(WIN32)
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" ON)
else()
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" OFF)
endif()
option(WITH_CYCLES_HIP_BINARIES "Build Cycles AMD HIP binaries" OFF)
set(CYCLES_HIP_BINARIES_ARCH gfx900 gfx906 gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 CACHE STRING "AMD HIP architectures to build binaries for")
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
endif()
# Apple Metal
if(APPLE)
option(WITH_CYCLES_DEVICE_METAL "Enable Cycles Apple Metal compute support" ON)
endif()
# Draw Manager
option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF)
mark_as_advanced(WITH_DRAW_DEBUG)
# LLVM
option(WITH_LLVM "Use LLVM" OFF)
@@ -463,14 +499,13 @@ if(WIN32)
endif()
# This should be turned off when Blender enter beta/rc/release
if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR
"${BLENDER_VERSION_CYCLE}" STREQUAL "rc")
set(WITH_EXPERIMENTAL_FEATURES OFF)
else()
if("${BLENDER_VERSION_CYCLE}" STREQUAL "alpha")
set(WITH_EXPERIMENTAL_FEATURES ON)
else()
set(WITH_EXPERIMENTAL_FEATURES OFF)
endif()
# Unit testsing
# Unit testing
option(WITH_GTESTS "Enable GTest unit testing" OFF)
option(WITH_OPENGL_RENDER_TESTS "Enable OpenGL render related unit testing (Experimental)" OFF)
option(WITH_OPENGL_DRAW_TESTS "Enable OpenGL UI drawing related unit testing (Experimental)" OFF)
@@ -489,14 +524,29 @@ option(WITH_OPENGL "When off limits visibility of the opengl header
option(WITH_GLEW_ES "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)" OFF)
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (through either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
option(WITH_GPU_SHADER_BUILDER "Shader builder is a developer option enabling linting on GLSL during compilation" OFF)
mark_as_advanced(
WITH_OPENGL
WITH_GLEW_ES
WITH_GL_EGL
WITH_GL_PROFILE_ES20
WITH_GPU_SHADER_BUILDER
)
# Metal
if (APPLE)
option(WITH_METAL_BACKEND "Use Metal for graphics instead of (or as well as) OpenGL on macOS." OFF)
mark_as_advanced(WITH_METAL_BACKEND)
else()
set(WITH_METAL_BACKEND OFF)
endif()
if (WITH_METAL_BACKEND)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
endif()
if(WIN32)
option(WITH_GL_ANGLE "Link with the ANGLE library, an OpenGL ES 2.0 implementation based on Direct3D, instead of the system OpenGL library." OFF)
mark_as_advanced(WITH_GL_ANGLE)
@@ -512,12 +562,18 @@ if(WIN32)
set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
endif()
# Compiler toolchain
if(CMAKE_COMPILER_IS_GNUCC)
option(WITH_LINKER_GOLD "Use ld.gold linker which is usually faster than ld.bfd" ON)
mark_as_advanced(WITH_LINKER_GOLD)
option(WITH_LINKER_LLD "Use ld.lld linker which is usually faster than ld.gold" OFF)
mark_as_advanced(WITH_LINKER_LLD)
# Compiler tool-chain.
if(UNIX AND NOT APPLE)
if(CMAKE_COMPILER_IS_GNUCC)
option(WITH_LINKER_GOLD "Use ld.gold linker which is usually faster than ld.bfd" ON)
mark_as_advanced(WITH_LINKER_GOLD)
option(WITH_LINKER_LLD "Use ld.lld linker which is usually faster than ld.gold" OFF)
mark_as_advanced(WITH_LINKER_LLD)
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
option(WITH_LINKER_MOLD "Use ld.mold linker which is usually faster than ld.gold & ld.lld." OFF)
mark_as_advanced(WITH_LINKER_MOLD)
endif()
endif()
option(WITH_COMPILER_ASAN "Build and link against address sanitizer (only for Debug & RelWithDebInfo targets)." OFF)
@@ -604,12 +660,6 @@ if(WIN32)
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
mark_as_advanced(WITH_WINDOWS_FIND_MODULES)
option(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS "Organize the visual studio projects according to source folder structure." ON)
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
option(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS "Organize the source files in filters matching the source folders." ON)
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
option(WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF)
mark_as_advanced(WINDOWS_PYTHON_DEBUG)
@@ -622,11 +672,23 @@ if(WIN32)
option(WITH_WINDOWS_PDB "Generate a pdb file for client side stacktraces" ON)
mark_as_advanced(WITH_WINDOWS_PDB)
option(WITH_WINDOWS_STRIPPED_PDB "Use a stripped PDB file" On)
option(WITH_WINDOWS_STRIPPED_PDB "Use a stripped PDB file" ON)
mark_as_advanced(WITH_WINDOWS_STRIPPED_PDB)
endif()
if(WIN32 OR XCODE)
option(IDE_GROUP_SOURCES_IN_FOLDERS "Organize the source files in filters matching the source folders." ON)
mark_as_advanced(IDE_GROUP_SOURCES_IN_FOLDERS)
option(IDE_GROUP_PROJECTS_IN_FOLDERS "Organize the projects according to source folder structure." ON)
mark_as_advanced(IDE_GROUP_PROJECTS_IN_FOLDERS)
if(IDE_GROUP_PROJECTS_IN_FOLDERS)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
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)
@@ -647,9 +709,12 @@ if(UNIX AND NOT APPLE)
endif()
# Installation process.
option(POSTINSTALL_SCRIPT "Run given CMake script after installation process" OFF)
set(POSTINSTALL_SCRIPT "" CACHE FILEPATH "Run given CMake script after installation process")
mark_as_advanced(POSTINSTALL_SCRIPT)
set(POSTCONFIGURE_SCRIPT "" CACHE FILEPATH "Run given CMake script as the last step of CMake configuration")
mark_as_advanced(POSTCONFIGURE_SCRIPT)
# end option(...)
@@ -680,9 +745,10 @@ endif()
#-----------------------------------------------------------------------------
# Check for conflicting/unsupported configurations
if(NOT WITH_BLENDER AND NOT WITH_CYCLES_STANDALONE)
if(NOT WITH_BLENDER AND NOT WITH_CYCLES_STANDALONE AND NOT WITH_CYCLES_HYDRA_RENDER_DELEGATE)
message(FATAL_ERROR
"At least one of WITH_BLENDER or WITH_CYCLES_STANDALONE "
"or WITH_CYCLES_HYDRA_RENDER_DELEGATE "
"must be enabled, nothing to do!"
)
endif()
@@ -803,7 +869,7 @@ if(WITH_AUDASPACE)
endif()
# Auto-enable CUDA dynload if toolkit is not found.
if(NOT WITH_CUDA_DYNLOAD)
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_CUDA AND NOT WITH_CUDA_DYNLOAD)
find_package(CUDA)
if(NOT CUDA_FOUND)
message(STATUS "CUDA toolkit not found, using dynamic runtime loading of libraries (WITH_CUDA_DYNLOAD) instead")
@@ -811,8 +877,13 @@ if(NOT WITH_CUDA_DYNLOAD)
endif()
endif()
if(WITH_CYCLES_DEVICE_HIP)
# Currently HIP must be dynamically loaded, this may change in future toolkits
set(WITH_HIP_DYNLOAD ON)
endif()
#-----------------------------------------------------------------------------
# Check check if submodules are cloned
# Check if submodules are cloned.
if(WITH_INTERNATIONAL)
file(GLOB RESULT "${CMAKE_SOURCE_DIR}/release/datafiles/locale")
@@ -835,8 +906,8 @@ if(WITH_PYTHON)
# Do this before main 'platform_*' checks,
# because UNIX will search for the old Python paths which may not exist.
# giving errors about missing paths before this case is met.
if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.9")
message(FATAL_ERROR "At least Python 3.9 is required to build")
if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.10")
message(FATAL_ERROR "At least Python 3.10 is required to build, but found Python ${PYTHON_VERSION}")
endif()
file(GLOB RESULT "${CMAKE_SOURCE_DIR}/release/scripts/addons")
@@ -1028,7 +1099,7 @@ if(MSVC)
add_definitions(-D__LITTLE_ENDIAN__)
# OSX-Note: as we do cross-compiling with specific set architecture,
# endianess-detection and auto-setting is counterproductive
# endianness-detection and auto-setting is counterproductive
# so we just set endianness according CMAKE_OSX_ARCHITECTURES
elseif(CMAKE_OSX_ARCHITECTURES MATCHES i386 OR CMAKE_OSX_ARCHITECTURES MATCHES x86_64 OR CMAKE_OSX_ARCHITECTURES MATCHES arm64)
@@ -1220,6 +1291,16 @@ else()
list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_CORE)
endif()
#-----------------------------------------------------------------------------
# Configure Metal.
if (WITH_METAL_BACKEND)
add_definitions(-DWITH_METAL_BACKEND)
# No need to add frameworks here, all the ones we need for Metal and
# Metal-OpenGL Interop are already being added by
# build_files/cmake/platform/platform_apple.cmake
endif()
#-----------------------------------------------------------------------------
# Configure OpenMP.
if(WITH_OPENMP)
@@ -1584,6 +1665,9 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
# Using C++20 features while having C++17 as the project language isn't allowed by MSVC.
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_CXX20_DESIGNATOR -Wc++20-designator)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
@@ -1611,6 +1695,8 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_BUT_SET_VARIABLE -Wno-unused-but-set-variable)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
@@ -1703,24 +1789,26 @@ if(WITH_PYTHON)
elseif(WITH_PYTHON_INSTALL_REQUESTS)
find_python_package(requests "")
endif()
if(WIN32 OR APPLE)
# pass, we have this in lib/python/site-packages
elseif(WITH_PYTHON_INSTALL_ZSTANDARD)
find_python_package(zstandard "")
endif()
endif()
if(MSVC)
string(APPEND CMAKE_CXX_FLAGS " /std:c++17")
# Make MSVC properly report the value of the __cplusplus preprocessor macro
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
# of the C++ standard chosen above
if(MSVC_VERSION GREATER 1913)
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
endif()
elseif(
CMAKE_COMPILER_IS_GNUCC OR
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
CMAKE_C_COMPILER_ID MATCHES "Intel"
)
string(APPEND CMAKE_CXX_FLAGS " -std=c++17")
else()
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++17 build")
# Select C++17 as the standard for C++ projects.
set(CMAKE_CXX_STANDARD 17)
# If C++17 is not available, downgrading to an earlier standard is NOT OK.
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Do not enable compiler specific language extensions.
set(CMAKE_CXX_EXTENSIONS OFF)
# Make MSVC properly report the value of the __cplusplus preprocessor macro
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
# of the C++ standard chosen above.
if(MSVC AND MSVC_VERSION GREATER 1913)
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
endif()
# Visual Studio has all standards it supports available by default
@@ -1823,15 +1911,13 @@ if(WITH_BLENDER)
# source after intern and extern to gather all
# internal and external library information first, for test linking
add_subdirectory(source)
elseif(WITH_CYCLES_STANDALONE)
elseif(WITH_CYCLES_STANDALONE OR WITH_CYCLES_HYDRA_RENDER_DELEGATE)
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)
@@ -1841,6 +1927,9 @@ elseif(WITH_CYCLES_STANDALONE)
if(WITH_CUDA_DYNLOAD)
add_subdirectory(extern/cuew)
endif()
if(WITH_HIP_DYNLOAD)
add_subdirectory(extern/hipew)
endif()
if(NOT WITH_SYSTEM_GLEW)
add_subdirectory(extern/glew)
endif()
@@ -1885,7 +1974,7 @@ if(FIRST_RUN)
set(_msg " - ${_setting}")
string(LENGTH "${_msg}" _len)
while("32" GREATER "${_len}")
while("36" GREATER "${_len}")
string(APPEND _msg " ")
math(EXPR _len "${_len} + 1")
endwhile()
@@ -1915,6 +2004,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_INPUT_NDOF)
info_cfg_option(WITH_INPUT_IME)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_OPENCOLORIO)
@@ -1974,6 +2064,7 @@ if(FIRST_RUN)
endif()
info_cfg_option(WITH_PYTHON_INSTALL)
info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
info_cfg_option(WITH_PYTHON_INSTALL_ZSTANDARD)
info_cfg_option(WITH_PYTHON_MODULE)
info_cfg_option(WITH_PYTHON_SAFETY)
@@ -1998,3 +2089,8 @@ endif()
if(0)
print_all_vars()
endif()
# Should be the last step of configuration.
if(POSTCONFIGURE_SCRIPT)
include(${POSTCONFIGURE_SCRIPT})
endif()

View File

@@ -1,23 +1,4 @@
# -*- mode: gnumakefile; tab-width: 4; indent-tabs-mode: t; -*-
# vim: tabstop=4
#
# ##### 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 #####
# SPDX-License-Identifier: GPL-2.0-or-later
# This Makefile does an out-of-source CMake build in ../build_`OS`_`CPU`
# eg:
@@ -27,7 +8,7 @@
define HELP_TEXT
Blender Convenience Targets
Provided for building Blender, (multiple at once can be used).
Provided for building Blender (multiple targets can be used at once).
* debug: Build a debug binary.
* full: Enable all supported dependencies & options.
@@ -40,6 +21,8 @@ Blender Convenience Targets
* ninja: Use ninja build tool for faster builds.
* ccache: Use ccache for faster rebuilds.
Note: when passing in multiple targets their order is not important.
So for a fast build you can for e.g. run 'make lite ccache ninja'.
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.
@@ -49,7 +32,7 @@ Other Convenience Targets
* config: Run cmake configuration tool to set build options.
* deps: Build library dependencies (intended only for platform maintainers).
The existance of locally build dependancies overrides the pre-built dependencies from subversion.
The existence of locally build dependencies overrides the pre-built dependencies from subversion.
These must be manually removed from '../lib/' to go back to using the pre-compiled libraries.
Project Files
@@ -61,33 +44,32 @@ Project Files
Package Targets
* package_debian: Build a debian package.
* package_pacman: Build an arch linux pacman package.
* package_archive: Build an archive package.
* package_archive: Build an archive package.
Testing Targets
Not associated with building Blender.
* test:
Run automated tests with ctest.
* test_cmake:
Runs our own cmake file checker
which detects errors in the cmake file list definitions
* test_pep8:
Checks all python script are pep8
which are tagged to use the stricter formatting
* test_deprecated:
Checks for deprecation tags in our code which may need to be removed
Static Source Code Checking
Not associated with building Blender.
* check_cppcheck: Run blender source through cppcheck (C & C++).
* check_clang_array: Run blender source through clang array checking script (C & C++).
* check_deprecated: Check if there is any deprecated code to remove.
* check_splint: Run blenders source through splint (C only).
* check_sparse: Run blenders source through sparse (C only).
* check_smatch: Run blenders source through smatch (C only).
* check_descriptions: Check for duplicate/invalid descriptions.
* check_licenses: Check license headers follow the SPDX license specification,
using one of the accepted licenses in 'doc/license/SPDX-license-identifiers.txt'
Append with 'SHOW_HEADERS=1' to show all unique headers
which can be useful for spotting license irregularities.
* check_cmake: Runs our own cmake file checker which detects errors in the cmake file list definitions.
* check_pep8: Checks all Python script are pep8 which are tagged to use the stricter formatting.
* check_mypy: Checks all Python scripts using mypy,
see: source/tools/check_source/check_mypy_config.py scripts which are included.
Spell Checkers
This runs the spell checker from the developer tools repositor.
@@ -167,7 +149,7 @@ endef
# This makefile is not meant for Windows
ifeq ($(OS),Windows_NT)
$(error On Windows, use "cmd //c make.bat" instead of "make")
$(error On Windows, use "cmd //c make.bat" instead of "make")
endif
# System Vars
@@ -217,7 +199,7 @@ endif
# in libraries, or python 2 for running make update to get it.
ifeq ($(OS_NCASE),darwin)
ifeq (, $(shell command -v $(PYTHON)))
PYTHON:=$(DEPS_INSTALL_DIR)/python/bin/python3.7m
PYTHON:=$(DEPS_INSTALL_DIR)/python/bin/python3.10
ifeq (, $(shell command -v $(PYTHON)))
PYTHON:=python
endif
@@ -326,7 +308,7 @@ CMAKE_CONFIG = cmake $(CMAKE_CONFIG_ARGS) \
# -----------------------------------------------------------------------------
# Tool for 'make config'
# X11 spesific
# X11 specific.
ifdef DISPLAY
CMAKE_CONFIG_TOOL = cmake-gui
else
@@ -379,7 +361,7 @@ deps: .FORCE
@cmake -H"$(DEPS_SOURCE_DIR)" \
-B"$(DEPS_BUILD_DIR)" \
-DHARVEST_TARGET=$(DEPS_INSTALL_DIR)
-DHARVEST_TARGET=$(DEPS_INSTALL_DIR)
@echo
@echo Building dependencies ...
@@ -403,11 +385,6 @@ help: .FORCE
# -----------------------------------------------------------------------------
# Packages
#
package_debian: .FORCE
cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
package_pacman: .FORCE
cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg
package_archive: .FORCE
make -C "$(BUILD_DIR)" -s package_archive
@@ -418,21 +395,7 @@ package_archive: .FORCE
# Tests
#
test: .FORCE
$(PYTHON) ./build_files/utils/make_test.py "$(BUILD_DIR)"
# run pep8 check check on scripts we distribute.
test_pep8: .FORCE
$(PYTHON) tests/python/pep8.py > test_pep8.log 2>&1
@echo "written: test_pep8.log"
# run some checks on our cmakefiles.
test_cmake: .FORCE
$(PYTHON) build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
@echo "written: test_cmake_consistency.log"
# run deprecation tests, see if we have anything to remove.
test_deprecated: .FORCE
$(PYTHON) tests/check_deprecated.py
@$(PYTHON) ./build_files/utils/make_test.py "$(BUILD_DIR)"
# -----------------------------------------------------------------------------
@@ -454,43 +417,44 @@ project_eclipse: .FORCE
#
check_cppcheck: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) \
"$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
"$(BLENDER_DIR)/check_cppcheck.txt"
@echo "written: check_cppcheck.txt"
check_clang_array: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
check_splint: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
check_sparse: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
check_smatch: .FORCE
$(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
check_mypy: .FORCE
$(PYTHON) "$(BLENDER_DIR)/source/tools/check_source/check_mypy.py"
@$(PYTHON) "$(BLENDER_DIR)/source/tools/check_source/check_mypy.py"
check_spelling_py: .FORCE
cd "$(BUILD_DIR)" ; \
@cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
"$(BLENDER_DIR)/release/scripts"
check_spelling_c: .FORCE
cd "$(BUILD_DIR)" ; \
@cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
--cache-file=$(CHECK_SPELLING_CACHE) \
@@ -500,50 +464,71 @@ check_spelling_c: .FORCE
"$(BLENDER_DIR)/intern/ghost" \
check_spelling_osl: .FORCE
cd "$(BUILD_DIR)" ;\
@cd "$(BUILD_DIR)" ; \
PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
--cache-file=$(CHECK_SPELLING_CACHE) \
"$(BLENDER_DIR)/intern/cycles/kernel/shaders"
check_descriptions: .FORCE
$(BLENDER_BIN) --background -noaudio --factory-startup --python \
@$(BLENDER_BIN) --background -noaudio --factory-startup --python \
"$(BLENDER_DIR)/source/tools/check_source/check_descriptions.py"
check_deprecated: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
source/tools/check_source/check_deprecated.py
check_licenses: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
"$(BLENDER_DIR)/source/tools/check_source/check_licenses.py" \
"--show-headers=$(SHOW_HEADERS)"
check_pep8: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
tests/python/pep8.py
check_cmake: .FORCE
@PYTHONIOENCODING=utf_8 $(PYTHON) \
source/tools/check_source/check_cmake_consistency.py
# -----------------------------------------------------------------------------
# Utilities
#
source_archive: .FORCE
python3 ./build_files/utils/make_source_archive.py
@$(PYTHON) ./build_files/utils/make_source_archive.py
source_archive_complete: .FORCE
cmake -S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
@cmake \
-S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
# This assumes CMake is still using a default `PACKAGE_DIR` variable:
python3 ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages"
@$(PYTHON) ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages"
INKSCAPE_BIN?="inkscape"
icons: .FORCE
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
@BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
@INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
@INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/alert_icons_update.py"
icons_geom: .FORCE
BLENDER_BIN=$(BLENDER_BIN) \
@BLENDER_BIN=$(BLENDER_BIN) \
"$(BLENDER_DIR)/release/datafiles/blender_icons_geom_update.py"
update: .FORCE
$(PYTHON) ./build_files/utils/make_update.py
@$(PYTHON) ./build_files/utils/make_update.py
update_code: .FORCE
$(PYTHON) ./build_files/utils/make_update.py --no-libraries
@$(PYTHON) ./build_files/utils/make_update.py --no-libraries
format: .FORCE
PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
@PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
# -----------------------------------------------------------------------------
@@ -552,23 +537,25 @@ 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} \
$(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
@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
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'"
doc_doxy: .FORCE
cd doc/doxygen; doxygen Doxyfile
@cd doc/doxygen; doxygen Doxyfile
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
doc_dna: .FORCE
$(BLENDER_BIN) --background -noaudio --factory-startup \
--python doc/blender_file_format/BlendFileDnaExporter_25.py
@$(BLENDER_BIN) \
--background -noaudio --factory-startup \
--python doc/blender_file_format/BlendFileDnaExporter_25.py
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man: .FORCE
$(PYTHON) doc/manpage/blender.1.py $(BLENDER_BIN) blender.1
@$(PYTHON) doc/manpage/blender.1.py --blender="$(BLENDER_BIN)" --output=blender.1 --verbose
help_features: .FORCE
@$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_print_build_options.py" $(BLENDER_DIR)"/CMakeLists.txt"

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
####################################################################################################
#
@@ -56,12 +40,14 @@ else()
endif()
include(cmake/zlib.cmake)
include(cmake/zstd.cmake)
include(cmake/openal.cmake)
include(cmake/png.cmake)
include(cmake/jpeg.cmake)
include(cmake/blosc.cmake)
include(cmake/pthreads.cmake)
include(cmake/openexr.cmake)
include(cmake/brotli.cmake)
include(cmake/freetype.cmake)
include(cmake/freeglut.cmake)
include(cmake/glew.cmake)
@@ -81,7 +67,11 @@ if(UNIX)
endif()
include(cmake/openimageio.cmake)
include(cmake/tiff.cmake)
include(cmake/flexbison.cmake)
if(WIN32)
include(cmake/flexbison.cmake)
elseif(UNIX AND NOT APPLE)
include(cmake/flex.cmake)
endif()
include(cmake/osl.cmake)
include(cmake/tbb.cmake)
include(cmake/openvdb.cmake)
@@ -113,7 +103,7 @@ include(cmake/expat.cmake)
include(cmake/yamlcpp.cmake)
include(cmake/opencolorio.cmake)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
if(BLENDER_PLATFORM_ARM)
include(cmake/sse2neon.cmake)
endif()
@@ -164,6 +154,7 @@ endif()
if(UNIX AND NOT APPLE)
include(cmake/libglu.cmake)
include(cmake/mesa.cmake)
include(cmake/wayland_protocols.cmake)
endif()
include(cmake/harvest.cmake)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(ALEMBIC_EXTRA_ARGS
-DBUILDSTATIC=ON

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(BLOSC_EXTRA_ARGS
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
@@ -29,7 +13,7 @@ set(BLOSC_EXTRA_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
)
# Prevent blosc from including it's own local copy of zlib in the object file
# Prevent blosc from including its own local copy of zlib in the object file
# and cause linker errors with everybody else.
set(BLOSC_EXTRA_ARGS ${BLOSC_EXTRA_ARGS}
-DPREFER_EXTERNAL_ZLIB=ON

View File

@@ -1,26 +1,21 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(BOOST_ADDRESS_MODEL 64)
if(BLENDER_PLATFORM_ARM)
set(BOOST_ARCHITECTURE arm)
else()
set(BOOST_ARCHITECTURE x86)
endif()
if(WIN32)
set(BOOST_TOOLSET toolset=msvc-14.1)
set(BOOST_COMPILER_STRING -vc141)
if(MSVC_VERSION GREATER_EQUAL 1920) # 2019
set(BOOST_TOOLSET toolset=msvc-14.2)
set(BOOST_COMPILER_STRING -vc142)
else() # 2017
set(BOOST_TOOLSET toolset=msvc-14.1)
set(BOOST_COMPILER_STRING -vc141)
endif()
set(BOOST_CONFIGURE_COMMAND bootstrap.bat)
set(BOOST_BUILD_COMMAND b2)
@@ -29,7 +24,6 @@ if(WIN32)
if(BUILD_MODE STREQUAL Release)
set(BOOST_HARVEST_CMD ${BOOST_HARVEST_CMD} && ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/include/boost-${BOOST_VERSION_NODOTS_SHORT}/ ${HARVEST_TARGET}/boost/include/)
endif()
elseif(APPLE)
set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
set(BOOST_BUILD_COMMAND ./b2)
@@ -93,7 +87,7 @@ ExternalProject_Add(external_boost
UPDATE_COMMAND ""
PATCH_COMMAND ${BOOST_PATCH_COMMAND}
CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND}
BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=x86 address-model=${BOOST_ADDRESS_MODEL} link=static threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install
BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=${BOOST_ARCHITECTURE} address-model=${BOOST_ADDRESS_MODEL} link=static threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install
BUILD_IN_SOURCE 1
INSTALL_COMMAND "${BOOST_HARVEST_CMD}"
)

View File

@@ -0,0 +1,22 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(BROTLI_EXTRA_ARGS
)
ExternalProject_Add(external_brotli
URL file://${PACKAGE_DIR}/${BROTLI_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${BROTLI_HASH_TYPE}=${BROTLI_HASH}
PREFIX ${BUILD_DIR}/brotli
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/brotli ${DEFAULT_CMAKE_FLAGS} ${BROTLI_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/brotli
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_brotli after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/brotli/include ${HARVEST_TARGET}/brotli/include
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/brotli/lib/brotlidec-static${LIBEXT} ${HARVEST_TARGET}/brotli/lib/brotlidec-static${LIBEXT}
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/brotli/lib/brotlicommon-static${LIBEXT} ${HARVEST_TARGET}/brotli/lib/brotlicommon-static${LIBEXT}
DEPENDEES install
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(BZIP2_PREFIX "${LIBDIR}/bzip2")
set(BZIP2_CONFIGURE_ENV echo .)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(UNIX)
if(APPLE)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(CLEW_EXTRA_ARGS)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(CUEW_EXTRA_ARGS)

View File

@@ -1,9 +1,16 @@
# SPDX-License-Identifier: GPL-2.0-or-later
## Update and uncomment this in the release branch
# set(BLENDER_VERSION 3.1)
function(download_source dep)
set(TARGET_FILE ${${dep}_FILE})
set(TARGET_HASH_TYPE ${${dep}_HASH_TYPE})
set(TARGET_HASH ${${dep}_HASH})
if(PACKAGE_USE_UPSTREAM_SOURCES)
set(TARGET_URI ${${dep}_URI})
elseif(BLENDER_VERSION)
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/tags/blender-${BLENDER_VERSION}-release/lib/packages/${TARGET_FILE})
else()
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
endif()
@@ -87,7 +94,11 @@ download_source(LIBGLU)
download_source(MESA)
download_source(NASM)
download_source(XR_OPENXR_SDK)
download_source(WL_PROTOCOLS)
download_source(ISPC)
download_source(GMP)
download_source(POTRACE)
download_source(HARU)
download_source(ZSTD)
download_source(FLEX)
download_source(BROTLI)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
# Note the utility apps may use png/tiff/gif system libraries, but the
# library itself does not depend on them, so should give no problems.
@@ -43,11 +27,17 @@ endif()
if(WIN32)
set(EMBREE_BUILD_DIR ${BUILD_MODE}/)
if(BUILD_MODE STREQUAL Debug)
list(APPEND EMBREE_EXTRA_ARGS
-DEMBREE_TBBMALLOC_LIBRARY_NAME=tbbmalloc_debug
-DEMBREE_TBB_LIBRARY_NAME=tbb_debug
)
endif()
else()
set(EMBREE_BUILD_DIR)
endif()
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
if(BLENDER_PLATFORM_ARM)
ExternalProject_Add(external_embree
GIT_REPOSITORY ${EMBREE_ARM_GIT}
GIT_TAG "blender-arm"

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(EXPAT_EXTRA_ARGS
-DEXPAT_BUILD_DOCS=OFF

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_ffi
URL file://${PACKAGE_DIR}/${FFI_FILE}

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(FFMPEG_CFLAGS "-I${mingw_LIBDIR}/lame/include -I${mingw_LIBDIR}/openjpeg/include/ -I${mingw_LIBDIR}/ogg/include -I${mingw_LIBDIR}/vorbis/include -I${mingw_LIBDIR}/theora/include -I${mingw_LIBDIR}/opus/include -I${mingw_LIBDIR}/vpx/include -I${mingw_LIBDIR}/x264/include -I${mingw_LIBDIR}/xvidcore/include -I${mingw_LIBDIR}/zlib/include")
set(FFMPEG_LDFLAGS "-L${mingw_LIBDIR}/lame/lib -L${mingw_LIBDIR}/openjpeg/lib -L${mingw_LIBDIR}/ogg/lib -L${mingw_LIBDIR}/vorbis/lib -L${mingw_LIBDIR}/theora/lib -L${mingw_LIBDIR}/opus/lib -L${mingw_LIBDIR}/vpx/lib -L${mingw_LIBDIR}/x264/lib -L${mingw_LIBDIR}/xvidcore/lib -L${mingw_LIBDIR}/zlib/lib")
@@ -30,6 +14,7 @@ if(WIN32)
--enable-w32threads
--disable-pthreads
--enable-libopenjpeg
--disable-mediafoundation
)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
set(FFMPEG_EXTRA_FLAGS

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(FFTW_EXTRA_ARGS)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_flac
URL file://${PACKAGE_DIR}/${FLAC_FILE}

View File

@@ -0,0 +1,12 @@
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_flex
URL file://${PACKAGE_DIR}/${FLEX_FILE}
URL_HASH ${FLEX_HASH_TYPE}=${FLEX_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/flex
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/flex
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && make -j${MAKE_THREADS}
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && make install
INSTALL_DIR ${LIBDIR}/flex
)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(FLEXBISON_EXTRA_ARGS)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
if(BUILD_MODE STREQUAL Release)

View File

@@ -1,31 +1,15 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(FREETYPE_EXTRA_ARGS
-DCMAKE_RELEASE_POSTFIX:STRING=2ST
-DCMAKE_DEBUG_POSTFIX:STRING=2ST_d
-DWITH_BZip2=OFF
-DWITH_HarfBuzz=OFF
-DFT_WITH_HARFBUZZ=OFF
-DFT_WITH_BZIP2=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE)
-DFT_DISABLE_BZIP2=ON
-DFT_DISABLE_HARFBUZZ=ON
-DFT_DISABLE_PNG=ON
-DFT_REQUIRE_BROTLI=ON
-DPC_BROTLIDEC_INCLUDEDIR=${LIBDIR}/brotli/include
-DPC_BROTLIDEC_LIBDIR=${LIBDIR}/brotli/lib
)
ExternalProject_Add(external_freetype
URL file://${PACKAGE_DIR}/${FREETYPE_FILE}
@@ -36,6 +20,11 @@ ExternalProject_Add(external_freetype
INSTALL_DIR ${LIBDIR}/freetype
)
add_dependencies(
external_freetype
external_brotli
)
if(BUILD_MODE STREQUAL Release AND WIN32)
ExternalProject_Add_Step(external_freetype after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freetype ${HARVEST_TARGET}/freetype

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(GLEW_EXTRA_ARGS
-DBUILD_UTILS=Off

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(GLFW_EXTRA_ARGS)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(GMP_EXTRA_ARGS -enable-cxx)
@@ -25,19 +9,12 @@ else()
set(GMP_OPTIONS --enable-static --disable-shared )
endif()
if(APPLE)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
set(GMP_OPTIONS
${GMP_OPTIONS}
--disable-assembly
)
else()
set(GMP_OPTIONS
${GMP_OPTIONS}
--with-pic
)
endif()
elseif(UNIX)
if(APPLE AND NOT BLENDER_PLATFORM_ARM)
set(GMP_OPTIONS
${GMP_OPTIONS}
--with-pic
)
elseif(UNIX AND NOT APPLE)
set(GMP_OPTIONS
${GMP_OPTIONS}
--with-pic

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(HARU_EXTRA_ARGS
-DLIBHPDF_SHARED=OFF

View File

@@ -1,23 +1,7 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
########################################################################
# Copy all generated files to the proper strucure as blender prefers
# Copy all generated files to the proper structure as blender prefers
########################################################################
if(NOT DEFINED HARVEST_TARGET)
@@ -79,6 +63,8 @@ endfunction()
harvest(alembic/include alembic/include "*.h")
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
harvest(alembic/bin alembic/bin "*")
harvest(brotli/include brotli/include "*.h")
harvest(brotli/lib brotli/lib "*.a")
harvest(boost/include boost/include "*")
harvest(boost/lib boost/lib "*.a")
harvest(ffmpeg/include ffmpeg/include "*.h")
@@ -106,12 +92,13 @@ harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config")
harvest(llvm/lib llvm/lib "libLLVM*.a")
harvest(llvm/lib llvm/lib "libclang*.a")
harvest(llvm/lib/clang llvm/lib/clang "*.h")
if(APPLE)
harvest(openmp/lib openmp/lib "*")
harvest(openmp/include openmp/include "*.h")
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
harvest(sse2neon sse2neon "*.h")
endif()
endif()
if(BLENDER_PLATFORM_ARM)
harvest(sse2neon sse2neon "*.h")
endif()
harvest(ogg/lib ffmpeg/lib "*.a")
harvest(openal/include openal/include "*.h")
@@ -126,6 +113,8 @@ if(UNIX AND NOT APPLE)
harvest(xml2/include xml2/include "*.h")
harvest(xml2/lib xml2/lib "*.a")
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
else()
harvest(blosc/lib openvdb/lib "*.a")
harvest(xml2/lib opencollada/lib "*.a")
@@ -190,6 +179,8 @@ harvest(potrace/include potrace/include "*.h")
harvest(potrace/lib potrace/lib "*.a")
harvest(haru/include haru/include "*.h")
harvest(haru/lib haru/lib "*.a")
harvest(zstd/include zstd/include "*.h")
harvest(zstd/lib zstd/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*.so*")

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(ICONV_EXTRA_ARGS)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(ISPC_EXTRA_ARGS_WIN
@@ -35,6 +19,7 @@ elseif(APPLE)
else()
set(ISPC_EXTRA_ARGS_APPLE
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
-DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex
-DARM_ENABLED=Off
)
endif()
@@ -43,6 +28,7 @@ elseif(UNIX)
-DCMAKE_C_COMPILER=${LIBDIR}/llvm/bin/clang
-DCMAKE_CXX_COMPILER=${LIBDIR}/llvm/bin/clang++
-DARM_ENABLED=Off
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
)
endif()
@@ -82,4 +68,9 @@ if(WIN32)
external_ispc
external_flexbison
)
elseif(UNIX AND NOT APPLE)
add_dependencies(
external_ispc
external_flex
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_jemalloc
URL file://${PACKAGE_DIR}/${JEMALLOC_FILE}

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
# cmake for windows

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(LAME_EXTRA_ARGS)
if(MSVC)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(LIBGLU_CFLAGS "-static-libgcc")
set(LIBGLU_CXXFLAGS "-static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a")

View File

@@ -1,22 +1,6 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
if(BLENDER_PLATFORM_ARM)
set(LLVM_TARGETS AArch64$<SEMICOLON>ARM)
else()
set(LLVM_TARGETS X86)
@@ -66,7 +50,11 @@ ExternalProject_Add(ll
if(MSVC)
if(BUILD_MODE STREQUAL Release)
set(LLVM_HARVEST_COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/ ${HARVEST_TARGET}/llvm/ )
set(LLVM_HARVEST_COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib ${HARVEST_TARGET}/llvm/lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/include ${HARVEST_TARGET}/llvm/include &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/llvm/bin/clang-format.exe ${HARVEST_TARGET}/llvm/bin/clang-format.exe
)
else()
set(LLVM_HARVEST_COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib/ ${HARVEST_TARGET}/llvm/debug/lib/ &&

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(LZMA_PATCH_CMD echo .)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(MESA_CFLAGS "-static-libgcc")
set(MESA_CXXFLAGS "-static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a")

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(NANOVDB_EXTRA_ARGS
# NanoVDB is header-only, so only need the install target
@@ -42,6 +26,7 @@ ExternalProject_Add(nanovdb
URL_HASH ${NANOVDB_HASH_TYPE}=${NANOVDB_HASH}
PREFIX ${BUILD_DIR}/nanovdb
SOURCE_SUBDIR nanovdb
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/nanovdb/src/nanovdb < ${PATCH_DIR}/nanovdb.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/nanovdb ${DEFAULT_CMAKE_FLAGS} ${NANOVDB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/nanovdb
)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_nasm
URL file://${PACKAGE_DIR}/${NASM_FILE}

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(MSVC)
message("BIN >${PYTHON_BINARY}<")
@@ -38,7 +22,6 @@ ExternalProject_Add(external_numpy
PREFIX ${BUILD_DIR}/numpy
PATCH_COMMAND ${NUMPY_PATCH}
CONFIGURE_COMMAND ""
PATCH_COMMAND COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/numpy/src/external_numpy < ${PATCH_DIR}/numpy.diff
LOG_BUILD 1
BUILD_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/numpy/src/external_numpy/setup.py build ${NUMPY_BUILD_OPTION} install --old-and-unmanageable
INSTALL_COMMAND ""

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_ogg
URL file://${PACKAGE_DIR}/${OGG_FILE}

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(BUILD_MODE STREQUAL Release)
set(OPENAL_EXTRA_ARGS

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(UNIX)
set(OPENCOLLADA_EXTRA_ARGS

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(OPENCOLORIO_EXTRA_ARGS
-DOCIO_BUILD_APPS=OFF
@@ -36,7 +20,7 @@ set(OPENCOLORIO_EXTRA_ARGS
-Dyaml-cpp_ROOT=${LIBDIR}/yamlcpp
)
if(APPLE AND NOT("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
if(BLENDER_PLATFORM_ARM)
set(OPENCOLORIO_EXTRA_ARGS
${OPENCOLORIO_EXTRA_ARGS}
-DOCIO_USE_SSE=OFF

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(OPENEXR_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}")

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(OIDN_EXTRA_ARGS
@@ -45,7 +29,6 @@ ExternalProject_Add(external_openimagedenoise
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OIDN_HASH_TYPE}=${OIDN_HASH}
PREFIX ${BUILD_DIR}/openimagedenoise
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimagedenoise/src/external_openimagedenoise < ${PATCH_DIR}/oidn.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimagedenoise ${DEFAULT_CMAKE_FLAGS} ${OIDN_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openimagedenoise
)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(BUILD_MODE STREQUAL Release)
set(OIIO_TOOLS ON)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
# Note the encoder/decoder may use png/tiff/lcms system libraries, but the
# library itself does not depend on them, so should give no problems.

View File

@@ -1,30 +1,19 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(APPLE)
set(OPENMP_PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff)
else()
set(OPENMP_PATCH_COMMAND)
endif()
ExternalProject_Add(external_openmp
URL file://${PACKAGE_DIR}/${OPENMP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH}
PREFIX ${BUILD_DIR}/openmp
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff
PATCH_COMMAND ${OPENMP_PATCH_COMMAND}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @executable_path/../Resources/lib/libomp.dylib runtime/src/libomp.dylib && make install
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @rpath/libomp.dylib runtime/src/libomp.dylib && make install
INSTALL_DIR ${LIBDIR}/openmp
)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(OPENSUBDIV_EXTRA_ARGS
-DNO_EXAMPLES=ON

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(BUILD_MODE STREQUAL Debug)
set(BLOSC_POST _d)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/fftw3 by installing mingw64" ON)
@@ -39,7 +23,7 @@ endif()
set(DOWNLOAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/downloads" CACHE STRING "Path for downloaded files")
# This path must be hard-coded like this, so that the GNUmakefile knows where it is and can pass it to make_source_archive.py:
set(PACKAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/packages")
option(PACKAGE_USE_UPSTREAM_SOURCES "Use soures upstream to download the package sources, when OFF the blender mirror will be used" ON)
option(PACKAGE_USE_UPSTREAM_SOURCES "Use sources upstream to download the package sources, when OFF the blender mirror will be used" ON)
file(TO_CMAKE_PATH ${DOWNLOAD_DIR} DOWNLOAD_DIR)
file(TO_CMAKE_PATH ${PACKAGE_DIR} PACKAGE_DIR)
@@ -137,6 +121,10 @@ else()
endif()
set(OSX_SYSROOT ${XCODE_DEV_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
set(BLENDER_PLATFORM_ARM ON)
endif()
set(PLATFORM_CFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_CXXFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}")
set(PLATFORM_LDFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}")
@@ -151,6 +139,10 @@ else()
-DCMAKE_OSX_SYSROOT:PATH=${OSX_SYSROOT}
)
else()
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
set(BLENDER_PLATFORM_ARM ON)
endif()
set(PLATFORM_CFLAGS "-fPIC")
set(PLATFORM_CXXFLAGS "-std=c++11 -fPIC")
set(PLATFORM_LDFLAGS)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_opus
URL file://${PACKAGE_DIR}/${OPUS_FILE}

View File

@@ -1,31 +1,13 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}")
set(OSL_FLEX_BISON -DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe -DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe)
set(OSL_SIMD_FLAGS -DOIIO_NOSIMD=1 -DOIIO_SIMD=sse2)
SET(OSL_PLATFORM_FLAGS -DLINKSTATIC=ON)
else()
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES)
set(OSL_FLEX_BISON)
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}")
SET(OSL_PLATFORM_FLAGS)
endif()
set(OSL_ILMBASE_CUSTOM_LIBRARIES "${LIBDIR}/openexr/lib/Imath${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Half{OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/IlmThread${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Iex${OPENEXR_VERSION_POSTFIX}.lib")
@@ -51,12 +33,13 @@ set(OSL_EXTRA_ARGS
-DOpenImageIO_ROOT=${LIBDIR}/openimageio/
-DOSL_BUILD_TESTS=OFF
-DOSL_BUILD_MATERIALX=OFF
-DPNG_ROOT=${LIBDIR}/png
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
${OSL_FLEX_BISON}
-DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES}
-DBUILD_SHARED_LIBS=OFF
${OSL_PLATFORM_FLAGS}
-DLINKSTATIC=ON
-DOSL_BUILD_PLUGINS=OFF
-DSTOP_ON_WARNING=OFF
-DUSE_LLVM_BITCODE=OFF
@@ -69,13 +52,9 @@ set(OSL_EXTRA_ARGS
${OSL_SIMD_FLAGS}
-Dpugixml_ROOT=${LIBDIR}/pugixml
-DUSE_PYTHON=OFF
-DCMAKE_CXX_STANDARD=14
)
# Apple arm64 uses LLVM 11, LLVM 10+ requires C++14
if (APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
list(APPEND OSL_EXTRA_ARGS -DCMAKE_CXX_STANDARD=14)
endif()
ExternalProject_Add(external_osl
URL file://${PACKAGE_DIR}/${OSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -93,10 +72,20 @@ add_dependencies(
ll
external_openexr
external_zlib
external_flexbison
external_openimageio
external_pugixml
)
if(WIN32)
add_dependencies(
external_osl
external_flexbison
)
elseif(UNIX AND NOT APPLE)
add_dependencies(
external_osl
external_flex
)
endif()
if(WIN32)
if(BUILD_MODE STREQUAL Release)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(MSVC)
set(PYTARGET ${HARVEST_TARGET}/python/${PYTHON_SHORT_VERSION_NO_DOTS})
@@ -24,7 +8,7 @@ if(MSVC)
add_custom_command(
OUTPUT ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND echo packaging python
COMMAND echo this should ouput at ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND echo this should output at ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTARGET}/libs
COMMAND ${CMAKE_COMMAND} -E copy ${PYSRC}/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}.lib ${PYTARGET}/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}.lib
COMMAND ${CMAKE_COMMAND} -E copy ${PYSRC}/python.exe ${PYTARGET}/bin/python.exe
@@ -43,7 +27,7 @@ if(MSVC)
add_custom_command(
OUTPUT ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND echo packaging python
COMMAND echo this should ouput at ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND echo this should output at ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe
COMMAND ${CMAKE_COMMAND} -E make_directory ${PYTARGET}/libs
COMMAND ${CMAKE_COMMAND} -E copy ${PYSRC}/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}.lib ${PYTARGET}/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}${PYTHON_POSTFIX}.lib
COMMAND ${CMAKE_COMMAND} -E copy ${PYSRC}/python${PYTHON_POSTFIX}.exe ${PYTARGET}/bin/python${PYTHON_POSTFIX}.exe

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(PNG_EXTRA_ARGS
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
@@ -22,7 +6,7 @@ set(PNG_EXTRA_ARGS
-DPNG_STATIC=ON
)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
if(BLENDER_PLATFORM_ARM)
set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=on -DCMAKE_SYSTEM_PROCESSOR="aarch64")
endif()

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(POTRACE_EXTRA_ARGS
)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(PUGIXML_EXTRA_ARGS
)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(PYTHON_POSTFIX)
if(BUILD_MODE STREQUAL Debug)

View File

@@ -1,31 +1,21 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32 AND BUILD_MODE STREQUAL Debug)
set(SITE_PACKAGES_EXTRA --global-option build --global-option --debug)
# zstandard is determined to build and link release mode libs in a debug
# configuration, the only way to make it happy is to bend to its will
# and give it a library to link with.
set(PIP_CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}_d.lib ${LIBDIR}/python/libs/python${PYTHON_SHORT_VERSION_NO_DOTS}.lib)
else()
set(PIP_CONFIGURE_COMMAND echo ".")
endif()
ExternalProject_Add(external_python_site_packages
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND ""
CONFIGURE_COMMAND ${PIP_CONFIGURE_COMMAND}
BUILD_COMMAND ""
PREFIX ${BUILD_DIR}/site_packages
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} chardet==${CHARDET_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} --no-binary :all:
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} --no-binary :all:
)
if(USE_PIP_NUMPY)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(SDL_EXTRA_ARGS

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
####################################################################################################################
# Mingw64 Builds

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(SNDFILE_EXTRA_ARGS)
set(SNDFILE_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/flac/lib/pkgconfig:${mingw_LIBDIR})

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_spnav
URL file://${PACKAGE_DIR}/${SPNAV_FILE}

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(SQLITE_CONFIGURE_ENV echo .)
set(SQLITE_CONFIGURATION_ARGS)

View File

@@ -1,30 +1,12 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
ExternalProject_Add(external_sse2neon
GIT_REPOSITORY ${SSE2NEON_GIT}
GIT_TAG ${SSE2NEON_GIT_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/sse2neon
CONFIGURE_COMMAND echo sse2neon - Nothing to configure
BUILD_COMMAND echo sse2neon - nothing to build
INSTALL_COMMAND mkdir -p ${LIBDIR}/sse2neon && cp ${BUILD_DIR}/sse2neon/src/external_sse2neon/sse2neon.h ${LIBDIR}/sse2neon
INSTALL_DIR ${LIBDIR}/sse2neon
)
endif()
ExternalProject_Add(external_sse2neon
GIT_REPOSITORY ${SSE2NEON_GIT}
GIT_TAG ${SSE2NEON_GIT_HASH}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${BUILD_DIR}/sse2neon
CONFIGURE_COMMAND echo sse2neon - Nothing to configure
BUILD_COMMAND echo sse2neon - nothing to build
INSTALL_COMMAND mkdir -p ${LIBDIR}/sse2neon && cp ${BUILD_DIR}/sse2neon/src/external_sse2neon/sse2neon.h ${LIBDIR}/sse2neon
INSTALL_DIR ${LIBDIR}/sse2neon
)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(SSL_CONFIGURE_COMMAND ./Configure)
set(SSL_PATCH_CMD echo .)
@@ -22,7 +6,9 @@ set(SSL_PATCH_CMD echo .)
if(APPLE)
set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}")
else()
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
if(BLENDER_PLATFORM_ARM)
set(SSL_OS_COMPILER "blender-linux-aarch64")
elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(SSL_EXTRA_ARGS enable-ec_nistp_64_gcc_128)
set(SSL_OS_COMPILER "blender-linux-x86_64")
else()

View File

@@ -8,6 +8,11 @@ my %targets = (
inherit_from => [ "linux-x86_64" ],
cflags => add("-fPIC"),
},
"blender-linux-aarch64" => {
inherit_from => [ "linux-aarch64" ],
cxxflags => add("-fPIC"),
cflags => add("-fPIC"),
},
"blender-darwin-x86_64" => {
inherit_from => [ "darwin64-x86_64-cc" ],
cflags => add("-fPIC"),

View File

@@ -1,26 +1,12 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(TBB_EXTRA_ARGS
-DTBB_BUILD_SHARED=On
-DTBB_BUILD_TBBMALLOC=On
-DTBB_BUILD_TBBMALLOC_PROXY=On
-DTBB_BUILD_STATIC=Off
-DTBB_BUILD_TESTS=Off
-DCMAKE_DEBUG_POSTFIX=_debug
)
set(TBB_LIBRARY tbb)
set(TBB_STATIC_LIBRARY Off)
@@ -30,6 +16,7 @@ else()
-DTBB_BUILD_TBBMALLOC=On
-DTBB_BUILD_TBBMALLOC_PROXY=Off
-DTBB_BUILD_STATIC=On
-DTBB_BUILD_TESTS=Off
)
set(TBB_LIBRARY tbb_static)
set(TBB_STATIC_LIBRARY On)
@@ -42,7 +29,7 @@ ExternalProject_Add(external_tbb
URL_HASH ${TBB_HASH_TYPE}=${TBB_HASH}
PREFIX ${BUILD_DIR}/tbb
PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_tbb.txt ${BUILD_DIR}/tbb/src/external_tbb/CMakeLists.txt &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/tbb/src/external_tbb/build/vs2013/version_string.ver ${BUILD_DIR}/tbb/src/external_tbb/src/tbb/version_string.ver &&
${CMAKE_COMMAND} -E copy ${BUILD_DIR}/tbb/src/external_tbb/build/vs2013/version_string.ver ${BUILD_DIR}/tbb/src/external_tbb/build/version_string.ver.in &&
${PATCH_CMD} -p 1 -d ${BUILD_DIR}/tbb/src/external_tbb < ${PATCH_DIR}/tbb.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/tbb ${DEFAULT_CMAKE_FLAGS} ${TBB_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/tbb
@@ -53,17 +40,17 @@ if(WIN32)
ExternalProject_Add_Step(external_tbb after_install
# findtbb.cmake in some deps *NEEDS* to find tbb_debug.lib even if they are not going to use it
# to make that test pass, we place a copy with the right name in the lib folder.
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.dll ${HARVEST_TARGET}/tbb/lib/tbb_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${LIBDIR}/tbb/lib/tbb_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${LIBDIR}/tbb/lib/tbbmalloc_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbb.dll ${LIBDIR}/tbb/bin/tbb_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc.dll ${LIBDIR}/tbb/bin/tbbmalloc_debug.dll
# Normal collection of build artifacts
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${HARVEST_TARGET}/tbb/lib/tbb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.dll ${HARVEST_TARGET}/tbb/lib/tbb.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbb.dll ${HARVEST_TARGET}/tbb/bin/tbb.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc_proxy.dll
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tbb/include/ ${HARVEST_TARGET}/tbb/include/
DEPENDEES install
)
@@ -74,11 +61,12 @@ if(WIN32)
# to make that test pass, we place a copy with the right name in the lib folder.
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${LIBDIR}/tbb/lib/tbb.lib
# Normal collection of build artifacts
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${HARVEST_TARGET}/tbb/lib/debug/tbb_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.dll ${HARVEST_TARGET}/tbb/lib/debug/tbb_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/debug/tbbmalloc.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/lib/debug/tbbmalloc_proxy.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbb_debug.dll ${HARVEST_TARGET}/tbb/bin/tbb_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_debug.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy_debug.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc_debug.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc_proxy_debug.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc_proxy_debug.dll
DEPENDEES install
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(UNIX)
set(THEORA_CONFIGURE_ENV ${CONFIGURE_ENV} && export HAVE_PDFLATEX=no)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WITH_WEBP)
set(WITH_TIFF_WEBP ON)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(USD_EXTRA_ARGS
-DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
@@ -68,6 +52,14 @@ add_dependencies(
external_boost
)
# Since USD 21.11 the libraries are prefixed with "usd_", i.e. "libusd_m.a" became "libusd_usd_m.a".
# See https://github.com/PixarAnimationStudios/USD/blob/release/CHANGELOG.md#2111---2021-11-01
if (USD_VERSION VERSION_LESS 21.11)
set(PXR_LIB_PREFIX "")
else()
set(PXR_LIB_PREFIX "usd_")
endif()
if(WIN32)
# USD currently demands python be available at build time
# and then proceeds not to use it, but still checks that the
@@ -81,14 +73,14 @@ if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/ ${HARVEST_TARGET}/usd
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Release/usd_m.lib ${HARVEST_TARGET}/usd/lib/libusd_m.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Release/${PXR_LIB_PREFIX}usd_m.lib ${HARVEST_TARGET}/usd/lib/lib${PXR_LIB_PREFIX}usd_m.lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/usd/lib ${HARVEST_TARGET}/usd/lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Debug/usd_m_d.lib ${HARVEST_TARGET}/usd/lib/libusd_m_d.lib
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/Debug/${PXR_LIB_PREFIX}usd_m_d.lib ${HARVEST_TARGET}/usd/lib/lib${PXR_LIB_PREFIX}usd_m_d.lib
DEPENDEES install
)
endif()
@@ -100,7 +92,7 @@ else()
# case (only the shared library). As a result, we need to grab the `libusd_m.a`
# file from the build directory instead of from the install directory.
ExternalProject_Add_Step(external_usd after_install
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/libusd_m.a ${HARVEST_TARGET}/usd/lib/libusd_m.a
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/usd/src/external_usd-build/pxr/lib${PXR_LIB_PREFIX}usd_m.a ${HARVEST_TARGET}/usd/lib/lib${PXR_LIB_PREFIX}usd_m.a
DEPENDEES install
)
endif()

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(ZLIB_VERSION 1.2.11)
set(ZLIB_URI https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz)
@@ -43,7 +27,7 @@ set(JPEG_FILE libjpeg-turbo-${JPEG_VERSION}.tar.gz)
set(BOOST_VERSION 1.73.0)
set(BOOST_VERSION_NODOTS 1_73_0)
set(BOOST_VERSION_NODOTS_SHORT 1_73)
set(BOOST_URI https://dl.bintray.com/boostorg/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_URI https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_NODOTS}.tar.gz)
set(BOOST_HASH 4036cd27ef7548b8d29c30ea10956196)
set(BOOST_HASH_TYPE MD5)
set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz)
@@ -83,9 +67,9 @@ else()
set(OPENEXR_VERSION_POSTFIX)
endif()
set(FREETYPE_VERSION 2.10.2)
set(FREETYPE_VERSION 2.11.1)
set(FREETYPE_URI http://prdownloads.sourceforge.net/freetype/freetype-${FREETYPE_VERSION}.tar.gz)
set(FREETYPE_HASH b1cb620e4c875cd4d1bfa04945400945)
set(FREETYPE_HASH bd4e3b007474319909a6b79d50908e85)
set(FREETYPE_HASH_TYPE MD5)
set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
@@ -152,35 +136,28 @@ set(OPENCOLORIO_HASH 1a2e3478b6cd9a1549f24e1b2205e3f0)
set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
# Newer version required by ISPC with arm support.
set(LLVM_VERSION 11.0.1)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_HASH e700af40ab83463e4e9ab0ba3708312e)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_VERSION 12.0.0)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
if(APPLE)
# Cloth physics test is crashing due to this bug:
# https://bugs.llvm.org/show_bug.cgi?id=50579
set(OPENMP_VERSION 9.0.1)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
else()
set(LLVM_VERSION 9.0.1)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.tar.xz)
set(LLVM_HASH b4268e733dfe352960140dc07ef2efcb)
set(LLVM_HASH_TYPE MD5)
set(LLVM_FILE llvm-project-${LLVM_VERSION}.tar.xz)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${LLVM_VERSION}.src.tar.xz)
set(OPENMP_VERSION ${LLVM_VERSION})
set(OPENMP_HASH ac48ce3e4582ccb82f81ab59eb3fc9dc)
endif()
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENIMAGEIO_VERSION 2.1.15.0)
set(OPENIMAGEIO_VERSION 2.2.15.1)
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH f03aa5e3ac4795af04771ee4146e9832)
set(OPENIMAGEIO_HASH 3db5c5f0b3dc91597c75e5df09eb9072)
set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
@@ -190,17 +167,17 @@ set(TIFF_HASH 2165e7aba557463acc0664e71a3ed424)
set(TIFF_HASH_TYPE MD5)
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
set(OSL_VERSION 1.11.10.0)
set(OSL_VERSION 1.11.14.1)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH dfdc23597aeef083832cbada62211756)
set(OSL_HASH 1abd7ce40481771a9fa937f19595d2f2)
set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
set(PYTHON_VERSION 3.9.2)
set(PYTHON_SHORT_VERSION 3.9)
set(PYTHON_SHORT_VERSION_NO_DOTS 39)
set(PYTHON_VERSION 3.10.2)
set(PYTHON_SHORT_VERSION 3.10)
set(PYTHON_SHORT_VERSION_NO_DOTS 310)
set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz)
set(PYTHON_HASH f0dc9000312abeb16de4eccce9a870ab)
set(PYTHON_HASH 14e8c22458ed7779a1957b26cde01db9)
set(PYTHON_HASH_TYPE MD5)
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
@@ -216,23 +193,26 @@ set(OPENVDB_HASH 01b490be16cc0e15c690f9a153c21461)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
set(NANOVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(NANOVDB_GIT_UID dc37d8a631922e7bef46712947dc19b755f3e841)
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
set(NANOVDB_HASH 90919510bc6ccd630fedc56f748cb199)
set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
set(NANOVDB_HASH_TYPE MD5)
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)
set(IDNA_VERSION 2.10)
set(CHARDET_VERSION 4.0.0)
set(URLLIB3_VERSION 1.26.3)
set(CERTIFI_VERSION 2020.12.5)
set(REQUESTS_VERSION 2.25.1)
set(CYTHON_VERSION 0.29.21)
set(IDNA_VERSION 3.3)
set(CHARSET_NORMALIZER_VERSION 2.0.10)
set(URLLIB3_VERSION 1.26.8)
set(CERTIFI_VERSION 2021.10.8)
set(REQUESTS_VERSION 2.27.1)
set(CYTHON_VERSION 0.29.26)
# The version of the zstd library used to build the Python package should match ZSTD_VERSION defined below.
# At this time of writing, 0.17.0 was already released, but built against zstd 1.5.1, while we use 1.5.0.
set(ZSTANDARD_VERSION 0.16.0)
set(NUMPY_VERSION 1.19.5)
set(NUMPY_SHORT_VERSION 1.19)
set(NUMPY_VERSION 1.22.0)
set(NUMPY_SHORT_VERSION 1.22)
set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}/numpy-${NUMPY_VERSION}.zip)
set(NUMPY_HASH f6a1b48717c552bbc18f1adc3cc1fe0e)
set(NUMPY_HASH 252de134862a27bd66705d29622edbfe)
set(NUMPY_HASH_TYPE MD5)
set(NUMPY_FILE numpy-${NUMPY_VERSION}.zip)
@@ -297,10 +277,10 @@ set(OPENJPEG_HASH 63f5a4713ecafc86de51bfad89cc07bb788e9bba24ebbf0c4ca637621aadb6
set(OPENJPEG_HASH_TYPE SHA256)
set(OPENJPEG_FILE openjpeg-v${OPENJPEG_VERSION}.tar.gz)
set(FFMPEG_VERSION 4.2.3)
set(FFMPEG_VERSION 4.4)
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFMPEG_HASH 695fad11f3baf27784e24cb0e977b65a)
set(FFMPEG_HASH_TYPE MD5)
set(FFMPEG_HASH 42093549751b582cf0f338a21a3664f52e0a9fbe0d238d3c992005e493607d0e)
set(FFMPEG_HASH_TYPE SHA256)
set(FFMPEG_FILE ffmpeg-${FFMPEG_VERSION}.tar.bz2)
set(FFTW_VERSION 3.3.8)
@@ -370,12 +350,18 @@ set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
set(PUGIXML_HASH_TYPE MD5)
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
set(FLEXBISON_VERSION 2.5.5)
set(FLEXBISON_VERSION 2.5.24)
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
set(FLEXBISON_HASH d87a3938194520d904013abef3df10ce)
set(FLEXBISON_HASH 6b549d43e34ece0e8ed05af92daa31c4)
set(FLEXBISON_HASH_TYPE MD5)
set(FLEXBISON_FILE win_flex_bison-${FLEXBISON_VERSION}.zip)
set(FLEX_VERSION 2.6.4)
set(FLEX_URI https://github.com/westes/flex/releases/download/v${FLEX_VERSION}/flex-${FLEX_VERSION}.tar.gz)
set(FLEX_HASH 2882e3179748cc9f9c23ec593d6adc8d)
set(FLEX_HASH_TYPE MD5)
set(FLEX_FILE flex-${FLEX_VERSION}.tar.gz)
# Libraries to keep Python modules static on Linux.
# NOTE: bzip.org domain does no longer belong to BZip 2 project, so we download
@@ -398,11 +384,20 @@ set(LZMA_HASH 5117f930900b341493827d63aa910ff5e011e0b994197c3b71c08a20228a42df)
set(LZMA_HASH_TYPE SHA256)
set(LZMA_FILE xz-${LZMA_VERSION}.tar.bz2)
set(SSL_VERSION 1.1.1g)
set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz)
set(SSL_HASH ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46)
set(SSL_HASH_TYPE SHA256)
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
if(BLENDER_PLATFORM_ARM)
# Need at least 1.1.1i for aarch64 support (https://github.com/openssl/openssl/pull/13218)
set(SSL_VERSION 1.1.1i)
set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz)
set(SSL_HASH e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242)
set(SSL_HASH_TYPE SHA256)
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
else()
set(SSL_VERSION 1.1.1g)
set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz)
set(SSL_HASH ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46)
set(SSL_HASH_TYPE SHA256)
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
endif()
set(SQLITE_VERSION 3.31.1)
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
@@ -423,9 +418,9 @@ set(USD_HASH 1dd1e2092d085ed393c1f7c450a4155a)
set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
set(OIDN_VERSION 1.3.0)
set(OIDN_VERSION 1.4.1)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
set(OIDN_HASH 301a5a0958d375a942014df0679b9270)
set(OIDN_HASH df4007b0ab93b1c41cdf223b075d01c0)
set(OIDN_HASH_TYPE MD5)
set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz)
@@ -435,10 +430,10 @@ set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3)
set(LIBGLU_HASH_TYPE MD5)
set(LIBGLU_FILE glu-${LIBGLU_VERSION}.tar.xz)
set(MESA_VERSION 20.3.4)
set(MESA_VERSION 21.1.5)
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH 556338446aef8ae947a789b3e0b5e056)
set(MESA_HASH_TYPE MD5)
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
set(MESA_HASH_TYPE SHA256)
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
set(NASM_VERSION 2.15.02)
@@ -447,29 +442,27 @@ set(NASM_HASH aded8b796c996a486a56e0515c83e414116decc3b184d88043480b32eb0a8589)
set(NASM_HASH_TYPE SHA256)
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
set(XR_OPENXR_SDK_VERSION 1.0.14)
set(XR_OPENXR_SDK_VERSION 1.0.22)
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(XR_OPENXR_SDK_HASH 0df6b2fd6045423451a77ff6bc3e1a75)
set(XR_OPENXR_SDK_HASH a2623ebab3d0b340bc16311b14f02075)
set(XR_OPENXR_SDK_HASH_TYPE MD5)
set(XR_OPENXR_SDK_FILE OpenXR-SDK-${XR_OPENXR_SDK_VERSION}.tar.gz)
if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64"))
# Unreleased version with macOS arm support.
set(ISPC_URI https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
set(ISPC_HASH d382fea18d01dbd0cd05d9e1ede36d7d)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
else()
set(ISPC_VERSION v1.14.1)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 968fbc8dfd16a60ba4e32d2e0e03ea7a)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
endif()
set(WL_PROTOCOLS_VERSION 1.21)
set(WL_PROTOCOLS_FILE wayland-protocols-${WL_PROTOCOLS_VERSION}.tar.gz)
set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/${WL_PROTOCOLS_VERSION}/${WL_PROTOCOLS_FILE})
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
set(WL_PROTOCOLS_HASH_TYPE MD5)
set(GMP_VERSION 6.2.0)
set(ISPC_VERSION v1.16.0)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
set(ISPC_HASH 2e3abedbc0ea9aaec17d6562c632454d)
set(ISPC_HASH_TYPE MD5)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
set(GMP_VERSION 6.2.1)
set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)
set(GMP_HASH a325e3f09e6d91e62101e59f9bda3ec1)
set(GMP_HASH 0b82665c4a92fd2ade7440c13fcaa42b)
set(GMP_HASH_TYPE MD5)
set(GMP_FILE gmp-${GMP_VERSION}.tar.xz)
@@ -485,5 +478,17 @@ set(HARU_HASH 4f916aa49c3069b3a10850013c507460)
set(HARU_HASH_TYPE MD5)
set(HARU_FILE libharu-${HARU_VERSION}.tar.gz)
set(ZSTD_VERSION 1.5.0)
set(ZSTD_URI https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz)
set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
set(ZSTD_HASH_TYPE SHA256)
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git)
set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
set(BROTLI_VERSION v1.0.9)
set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/${BROTLI_VERSION}.tar.gz)
set(BROTLI_HASH f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46)
set(BROTLI_HASH_TYPE SHA256)
set(BROTLI_FILE brotli-${BROTLI_VERSION}.tar.gz)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_vorbis
URL file://${PACKAGE_DIR}/${VORBIS_FILE}

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")

View File

@@ -0,0 +1,11 @@
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_wayland_protocols
URL file://${PACKAGE_DIR}/${WL_PROTOCOLS_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${WL_PROTOCOLS_HASH_TYPE}=${WL_PROTOCOLS_HASH}
PREFIX ${BUILD_DIR}/wayland-protocols
CONFIGURE_COMMAND meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
# Note the utility apps may use png/tiff/gif system libraries, but the
# library itself does not depend on them, so should give no problems.

View File

@@ -1,43 +1,19 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(X264_EXTRA_ARGS --enable-win32thread --cross-prefix=${MINGW_HOST}- --host=${MINGW_HOST})
endif()
if(APPLE)
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
set(X264_EXTRA_ARGS ${X264_EXTRA_ARGS} "--disable-asm")
set(X264_CONFIGURE_ENV echo .)
else()
set(X264_CONFIGURE_ENV
export AS=${LIBDIR}/nasm/bin/nasm
)
endif()
else()
set(X264_CONFIGURE_ENV echo .)
if(BLENDER_PLATFORM_ARM)
set(X264_EXTRA_ARGS ${X264_EXTRA_ARGS} "--disable-asm")
endif()
if(UNIX AND NOT APPLE)
if((APPLE AND NOT BLENDER_PLATFORM_ARM) OR (UNIX AND NOT APPLE))
set(X264_CONFIGURE_ENV
export AS=${LIBDIR}/nasm/bin/nasm
)
else()
set(X264_CONFIGURE_ENV echo .)
endif()
ExternalProject_Add(external_x264

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_xml2
URL file://${PACKAGE_DIR}/${XML2_FILE}

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
# Keep flags in sync with install_deps.sh ones in compile_XR_OpenXR_SDK()

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
if(WIN32)
set(XVIDCORE_EXTRA_ARGS --host=${MINGW_HOST})

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
set(YAMLCPP_EXTRA_ARGS
-DYAML_CPP_BUILD_TESTS=OFF

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_zlib
URL file://${PACKAGE_DIR}/${ZLIB_FILE}

View File

@@ -1,20 +1,4 @@
# ***** 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 *****
# SPDX-License-Identifier: GPL-2.0-or-later
ExternalProject_Add(external_zlib_mingw
URL file://${PACKAGE_DIR}/${ZLIB_FILE}

View File

@@ -0,0 +1,35 @@
# SPDX-License-Identifier: GPL-2.0-or-later
set(ZSTD_EXTRA_ARGS
-DZSTD_BUILD_PROGRAMS=OFF
-DZSTD_BUILD_SHARED=OFF
-DZSTD_BUILD_STATIC=ON
-DZSTD_BUILD_TESTS=OFF
-DZSTD_LEGACY_SUPPORT=OFF
-DZSTD_LZ4_SUPPORT=OFF
-DZSTD_LZMA_SUPPORT=OFF
-DZSTD_MULTITHREAD_SUPPORT=ON
-DZSTD_PROGRAMS_LINK_SHARED=OFF
-DZSTD_USE_STATIC_RUNTIME=OFF
-DZSTD_ZLIB_SUPPORT=OFF
)
ExternalProject_Add(external_zstd
URL file://${PACKAGE_DIR}/${ZSTD_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${ZSTD_HASH_TYPE}=${ZSTD_HASH}
PREFIX ${BUILD_DIR}/zstd
SOURCE_SUBDIR build/cmake
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zstd ${DEFAULT_CMAKE_FLAGS} ${ZSTD_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/zstd
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_zstd after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/zstd/lib/zstd_static${LIBEXT} ${HARVEST_TARGET}/zstd/lib/zstd_static${LIBEXT}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/zstd/include/ ${HARVEST_TARGET}/zstd/include/
DEPENDEES install
)
endif()
endif()

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016 Blender Foundation.
# - Find BLOSC library
# Find the native BLOSC includes and library
# This module defines
@@ -11,17 +14,6 @@
# also defined, but not for general use are
# BLOSC_LIBRARY, where to find the BLOSC library.
#=============================================================================
# Copyright 2016 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If BLOSC_ROOT_DIR was defined in the environment, use it.
IF(NOT BLOSC_ROOT_DIR AND NOT $ENV{BLOSC_ROOT_DIR} STREQUAL "")
SET(BLOSC_ROOT_DIR $ENV{BLOSC_ROOT_DIR})

View File

@@ -1,3 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016 Blender Foundation.
# - Find CPPUNIT library
# Find the native CPPUNIT includes and library
# This module defines
@@ -11,17 +14,6 @@
# also defined, but not for general use are
# CPPUNIT_LIBRARY, where to find the CPPUNIT library.
#=============================================================================
# Copyright 2016 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If CPPUNIT_ROOT_DIR was defined in the environment, use it.
IF(NOT CPPUNIT_ROOT_DIR AND NOT $ENV{CPPUNIT_ROOT_DIR} STREQUAL "")
SET(CPPUNIT_ROOT_DIR $ENV{CPPUNIT_ROOT_DIR})

View File

@@ -1,3 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause
# Module to find IlmBase
#
# This module will first look into the directories defined by the variables:
@@ -20,7 +22,7 @@
# ILMBASE_LIBRARIES - list of libraries to link against when using IlmBase.
# ILMBASE_FOUND - True if IlmBase was found.
# Other standarnd issue macros
# Other standard issue macros
include(FindPackageHandleStandardArgs)
include(FindPackageMessage)
include(SelectLibraryConfigurations)

View File

@@ -1,3 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016 Blender Foundation.
# - Find LOGC4PLUS library
# Find the native LOGC4PLUS includes and library
# This module defines
@@ -11,17 +14,6 @@
# also defined, but not for general use are
# LOGC4PLUS_LIBRARY, where to find the LOGC4PLUS library.
#=============================================================================
# Copyright 2016 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If LOGC4PLUS_ROOT_DIR was defined in the environment, use it.
IF(NOT LOGC4PLUS_ROOT_DIR AND NOT $ENV{LOGC4PLUS_ROOT_DIR} STREQUAL "")
SET(LOGC4PLUS_ROOT_DIR $ENV{LOGC4PLUS_ROOT_DIR})

View File

@@ -1,3 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause
# Module to find OpenEXR.
#
# This module will first look into the directories defined by the variables:
@@ -22,7 +24,7 @@
# These are defined by the FindIlmBase module.
# OPENEXR_FOUND - True if OpenEXR was found.
# Other standarnd issue macros
# Other standard issue macros
include(SelectLibraryConfigurations)
include(FindPackageHandleStandardArgs)
include(FindPackageMessage)

View File

@@ -1,3 +1,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016 Blender Foundation.
# - Find TBB library
# Find the native TBB includes and library
# This module defines
@@ -11,17 +14,6 @@
# also defined, but not for general use are
# TBB_LIBRARY, where to find the TBB library.
#=============================================================================
# Copyright 2016 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If TBB_ROOT_DIR was defined in the environment, use it.
IF(NOT TBB_ROOT_DIR AND NOT $ENV{TBB_ROOT_DIR} STREQUAL "")
SET(TBB_ROOT_DIR $ENV{TBB_ROOT_DIR})

View File

@@ -1,3 +1,8 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2009 Kitware, Inc.
# 2009 Will Dicharry <wdicharry@stellarscience.com>
# 2005-2009 Kitware, Inc.
# select_library_configurations( basename )
#
# This macro takes a library base name as an argument, and will choose good
@@ -14,18 +19,6 @@
# or the generator in use does not support configuration types, then
# basename_LIBRARY and basename_LIBRARIES will take only the release values.
#=============================================================================
# Copyright 2009 Kitware, Inc.
# Copyright 2009 Will Dicharry <wdicharry@stellarscience.com>
# Copyright 2005-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)

View File

@@ -1,5 +1,32 @@
cmake_minimum_required (VERSION 2.8)
project(tbb CXX)
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
if (POLICY CMP0048)
# cmake warns if loaded from a min-3.0-required parent dir, so silence the warning:
cmake_policy(SET CMP0048 NEW)
endif()
project (tbb CXX)
include(CheckCXXCompilerFlag)
include(CheckCXXSourceRuns)
if(POLICY CMP0058)
cmake_policy(SET CMP0058 NEW)
endif()
if(POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
endif()
if (POLICY CMP0078)
# swig standard target names
cmake_policy(SET CMP0078 NEW)
endif ()
if (POLICY CMP0086)
# UseSWIG honors SWIG_MODULE_NAME via -module flag
cmake_policy(SET CMP0086 NEW)
endif ()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
@@ -8,12 +35,36 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"MinSizeRel" "RelWithDebInfo")
endif()
include_directories(include src src/rml/include )
if(NOT TBB_INSTALL_RUNTIME_DIR)
set(TBB_INSTALL_RUNTIME_DIR bin)
endif()
if(NOT TBB_INSTALL_LIBRARY_DIR)
set(TBB_INSTALL_LIBRARY_DIR lib)
endif()
if(NOT TBB_INSTALL_ARCHIVE_DIR)
set(TBB_INSTALL_ARCHIVE_DIR lib)
endif()
if(NOT TBB_INSTALL_INCLUDE_DIR)
set(TBB_INSTALL_INCLUDE_DIR include)
endif()
if(NOT TBB_CMAKE_PACKAGE_INSTALL_DIR)
set(TBB_CMAKE_PACKAGE_INSTALL_DIR lib/cmake/tbb)
endif()
include_directories(include src src/rml/include ${CMAKE_CURRENT_BINARY_DIR})
option(TBB_BUILD_SHARED "Build TBB shared library" ON)
option(TBB_BUILD_STATIC "Build TBB static library" ON)
option(TBB_BUILD_TBBMALLOC "Build TBB malloc library" ON)
option(TBB_BUILD_TBBMALLOC_PROXY "Build TBB malloc proxy library" ON)
option(TBB_BUILD_TESTS "Build TBB tests and enable testing infrastructure" ON)
option(TBB_NO_DATE "Do not save the configure date in the version string" OFF)
option(TBB_BUILD_PYTHON "Build TBB Python bindings" OFF)
option(TBB_SET_SOVERSION "Set the SOVERSION (shared library build version suffix)?" OFF)
# When this repository is part of a larger build system of a parent project
# we may not want TBB to set up default installation targets
option(TBB_INSTALL_TARGETS "Include build targets for 'make install'" ON)
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
@@ -39,66 +90,143 @@ set(tbbmalloc_proxy_src
src/tbbmalloc/proxy.cpp
src/tbbmalloc/tbb_function_replacement.cpp)
if (NOT APPLE)
add_definitions(-DDO_ITT_NOTIFY)
else()
# Disable annoying "has no symbols" warnings
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>")
add_library (tbb_interface INTERFACE)
add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(i386|x86_64)")
if (NOT APPLE AND NOT MINGW)
target_compile_definitions(tbb_interface INTERFACE DO_ITT_NOTIFY)
endif()
endif()
if (APPLE)
# Disable annoying "has no symbols" warnings
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>")
endif()
macro(CHECK_CXX_COMPILER_AND_LINKER_FLAGS _RESULT _CXX_FLAGS _LINKER_FLAGS)
set(CMAKE_REQUIRED_FLAGS ${_CXX_FLAGS})
set(CMAKE_REQUIRED_LIBRARIES ${_LINKER_FLAGS})
set(CMAKE_REQUIRED_QUIET TRUE)
check_cxx_source_runs("#include <iostream>\nint main(int argc, char **argv) { std::cout << \"test\"; return 0; }" ${_RESULT})
set(CMAKE_REQUIRED_FLAGS "")
set(CMAKE_REQUIRED_LIBRARIES "")
endmacro()
# Prefer libc++ in conjunction with Clang
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_CXX_FLAGS MATCHES "-stdlib=libc\\+\\+")
message(STATUS "TBB: using libc++.")
else()
CHECK_CXX_COMPILER_AND_LINKER_FLAGS(HAS_LIBCPP "-stdlib=libc++" "-stdlib=libc++")
if (HAS_LIBCPP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -D_LIBCPP_VERSION")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++")
message(STATUS "TBB: using libc++.")
else()
message(STATUS "TBB: NOT using libc++.")
endif()
endif()
endif()
set (CMAKE_CXX_STANDARD 11)
if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DUSE_PTHREAD")
if(NOT CMAKE_CXX_FLAGS MATCHES "-mno-rtm")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mrtm")
endif()
if (APPLE)
set(ARCH_PREFIX "mac")
else()
set(ARCH_PREFIX "lin")
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_PREFIX "${ARCH_PREFIX}64")
else()
set(ARCH_PREFIX "${ARCH_PREFIX}32")
endif()
set(ENABLE_RTTI "-frtti -fexceptions ")
set(DISABLE_RTTI "-fno-rtti -fno-exceptions ")
elseif(WIN32)
cmake_minimum_required (VERSION 3.1)
enable_language(ASM_MASM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS- /Zc:wchar_t /Zc:forScope /DUSE_WINTHREAD")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0600 /volatile:iso")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4800 /wd4146 /wd4244 /wd4018")
target_compile_definitions(tbb_interface INTERFACE USE_PTHREAD)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND tbb_src src/tbb/intel64-masm/atomic_support.asm
src/tbb/intel64-masm/itsx.asm src/tbb/intel64-masm/intel64_misc.asm)
list(APPEND tbbmalloc_src src/tbb/intel64-masm/atomic_support.asm)
set(CMAKE_ASM_MASM_FLAGS "/DEM64T=1")
set(ARCH_PREFIX "win64")
else()
list(APPEND tbb_src src/tbb/ia32-masm/atomic_support.asm
src/tbb/ia32-masm/itsx.asm src/tbb/ia32-masm/lock_byte.asm)
list(APPEND tbbmalloc_src src/tbb/ia32-masm/atomic_support.asm)
set(ARCH_PREFIX "win32")
endif()
set(ENABLE_RTTI "/EHsc /GR ")
set(DISABLE_RTTI "/EHs- /GR- ")
check_cxx_compiler_flag ("-mrtm -Werror" SUPPORTS_MRTM)
if (SUPPORTS_MRTM)
target_compile_options(tbb_interface INTERFACE "-mrtm")
endif ()
elseif(WIN32)
target_compile_definitions(tbb_interface INTERFACE USE_WINTHREAD _WIN32_WINNT=0x0600)
if (MSVC)
enable_language(ASM_MASM)
target_compile_options(tbb_interface INTERFACE /GS- /Zc:wchar_t /Zc:forScope)
check_cxx_compiler_flag ("/volatile:iso" SUPPORTS_VOLATILE_FLAG)
if (SUPPORTS_VOLATILE_FLAG)
target_compile_options(tbb_interface INTERFACE /volatile:iso)
endif ()
target_compile_options(tbb_interface INTERFACE $<$<COMPILE_LANGUAGE:CXX>:/wd4267 /wd4800 /wd4146 /wd4244 /wd4577 /wd4018>)
if (NOT CMAKE_SIZEOF_VOID_P)
message(FATAL_ERROR "'CMAKE_SIZEOF_VOID_P' is undefined. Please delete your build directory and rerun CMake again!")
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND tbb_src src/tbb/intel64-masm/atomic_support.asm
src/tbb/intel64-masm/itsx.asm src/tbb/intel64-masm/intel64_misc.asm)
list(APPEND tbbmalloc_src src/tbb/intel64-masm/atomic_support.asm)
set(CMAKE_ASM_MASM_FLAGS "/DEM64T=1 ${CMAKE_ASM_MASM_FLAGS}")
else()
list(APPEND tbb_src src/tbb/ia32-masm/atomic_support.asm
src/tbb/ia32-masm/itsx.asm src/tbb/ia32-masm/lock_byte.asm)
# Enable SAFESEH feature for assembly (x86 builds only).
set(CMAKE_ASM_MASM_FLAGS "/safeseh ${CMAKE_ASM_MASM_FLAGS}")
endif()
elseif (MINGW)
target_compile_options(tbb_interface INTERFACE "-mthreads")
endif ()
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-flifetime-dse=1" SUPPORTS_FLIFETIME)
if (SUPPORTS_FLIFETIME)
add_definitions(-flifetime-dse=1)
if (MSVC)
set(ENABLE_RTTI "/EHsc /GR ")
set(DISABLE_RTTI "/EHs- /GR- ")
elseif (UNIX)
set(ENABLE_RTTI "-frtti -fexceptions ")
set(DISABLE_RTTI "-fno-rtti -fno-exceptions ")
endif ()
##--------
# - Added TBB_USE_GLIBCXX_VERSION macro to specify the version of GNU
# libstdc++ when it cannot be properly recognized, e.g. when used
# with Clang on Linux* OS. Inspired by a contribution from David A.
if (NOT TBB_USE_GLIBCXX_VERSION AND UNIX AND NOT APPLE)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# using Clang
string(REPLACE "." "0" TBB_USE_GLIBCXX_VERSION ${CMAKE_CXX_COMPILER_VERSION})
endif()
endif()
if (TBB_USE_GLIBCXX_VERSION)
target_compile_definitions(tbb_interface INTERFACE TBB_USE_GLIBCXX_VERSION=${TBB_USE_GLIBCXX_VERSION})
endif()
##-------
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
check_cxx_compiler_flag ("-flifetime-dse=1" SUPPORTS_FLIFETIME)
if (SUPPORTS_FLIFETIME)
target_compile_options(tbb_interface INTERFACE -flifetime-dse=1)
endif()
endif()
# Linker export definitions
if (WIN32)
if (APPLE)
set (ARCH_PREFIX "mac")
elseif(WIN32)
set (ARCH_PREFIX "win")
else()
set (ARCH_PREFIX "lin")
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_PREFIX "${ARCH_PREFIX}64")
else()
set(ARCH_PREFIX "${ARCH_PREFIX}32")
endif()
if (MINGW)
set (ARCH_PREFIX "${ARCH_PREFIX}-gcc")
# there's no win32-gcc-tbb-export.def, use lin32-tbb-export.def
execute_process (COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/lin32-tbb-export.def ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/win32-gcc-tbb-export.def)
endif()
if (MSVC)
add_custom_command(OUTPUT tbb.def
COMMAND ${CMAKE_CXX_COMPILER} /TC /EP ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include > tbb.def
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def
@@ -110,18 +238,15 @@ if (WIN32)
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def
COMMENT "Preprocessing tbbmalloc.def"
)
list(APPEND tbb_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/tbb_resource.rc)
list(APPEND tbbmalloc_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/tbbmalloc.rc)
list(APPEND tbbmalloc_proxy_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/tbbmalloc.rc)
else()
add_custom_command(OUTPUT tbb.def
COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbb.def
COMMAND ${CMAKE_CXX_COMPILER} -xc++ -std=c++11 -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbb.def
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def
COMMENT "Preprocessing tbb.def"
)
add_custom_command(OUTPUT tbbmalloc.def
COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbbmalloc.def
COMMAND ${CMAKE_CXX_COMPILER} -xc++ -std=c++11 -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbbmalloc.def
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def
COMMENT "Preprocessing tbbmalloc.def"
)
@@ -132,34 +257,80 @@ add_custom_target(tbb_def_files DEPENDS tbb.def tbbmalloc.def)
# TBB library
if (TBB_BUILD_STATIC)
add_library(tbb_static STATIC ${tbb_src})
set_property(TARGET tbb_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_BUILD=1")
set_property(TARGET tbb_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_SOURCE_DIRECTLY_INCLUDED=1")
target_link_libraries(tbb_static PRIVATE tbb_interface)
target_include_directories(tbb_static INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" "$<INSTALL_INTERFACE:${TBB_INSTALL_INCLUDE_DIR}>")
set_property(TARGET tbb_static APPEND_STRING PROPERTY COMPILE_FLAGS ${ENABLE_RTTI})
install(TARGETS tbb_static ARCHIVE DESTINATION lib)
if (TBB_INSTALL_TARGETS)
install(TARGETS tbb_static ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR})
endif()
target_compile_definitions(tbb_static
PRIVATE
-D__TBB_BUILD=1
-D__TBB_DYNAMIC_LOAD_ENABLED=0
-D__TBB_SOURCE_DIRECTLY_INCLUDED=1)
if (MSVC)
target_compile_definitions(tbb_static
PUBLIC -D__TBB_NO_IMPLICIT_LINKAGE=1
PRIVATE -D_CRT_SECURE_NO_WARNINGS)
endif()
if (UNIX AND NOT APPLE)
target_link_libraries(tbb_static PUBLIC pthread dl)
endif()
endif()
if (TBB_BUILD_SHARED)
add_library(tbb SHARED ${tbb_src})
set_property(TARGET tbb APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_BUILD=1")
target_link_libraries(tbb PRIVATE tbb_interface)
target_include_directories(tbb INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" "$<INSTALL_INTERFACE:${TBB_INSTALL_INCLUDE_DIR}>")
set_property(TARGET tbb APPEND_STRING PROPERTY COMPILE_FLAGS ${ENABLE_RTTI})
add_dependencies(tbb tbb_def_files)
if (APPLE)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/tbb.def")
elseif(UNIX)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,${CMAKE_CURRENT_BINARY_DIR}/tbb.def")
elseif(WIN32)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/tbb.def")
if (TBB_SET_SOVERSION)
set_property(TARGET tbb PROPERTY SOVERSION 2)
endif ()
target_compile_definitions(tbb
PRIVATE -D__TBB_BUILD=1)
if (MSVC)
target_compile_definitions(tbb
PUBLIC -D__TBB_NO_IMPLICIT_LINKAGE=1
PRIVATE -D_CRT_SECURE_NO_WARNINGS)
endif()
install(TARGETS tbb DESTINATION lib)
if(WIN32)
set_target_properties(tbb PROPERTIES OUTPUT_NAME "tbb$<$<CONFIG:Debug>:_debug>")
add_dependencies(tbb tbb_def_files)
if (APPLE)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,\"${CMAKE_CURRENT_BINARY_DIR}/tbb.def\"")
elseif (MSVC)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "/DEF:\"${CMAKE_CURRENT_BINARY_DIR}/tbb.def\"")
else ()
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,\"${CMAKE_CURRENT_BINARY_DIR}/tbb.def\"")
endif()
if (TBB_INSTALL_TARGETS)
install(TARGETS tbb EXPORT TBB
LIBRARY DESTINATION ${TBB_INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR}
RUNTIME DESTINATION ${TBB_INSTALL_RUNTIME_DIR})
if (MSVC)
install(FILES $<TARGET_PDB_FILE:tbb> DESTINATION ${TBB_INSTALL_RUNTIME_DIR} OPTIONAL)
endif()
endif()
if (UNIX AND NOT APPLE)
target_link_libraries(tbb PUBLIC pthread dl)
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCC)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# Quench a warning on GCC
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/governor.cpp COMPILE_FLAGS "-Wno-missing-field-initializers ")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Quench a warning on Clang
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/itt_notify.cpp COMPILE_FLAGS "-Wno-varargs ")
elseif(MSVC)
# Quench a warning on MSVC
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/scheduler.cpp COMPILE_FLAGS "/wd4458 ")
@@ -169,24 +340,50 @@ if(TBB_BUILD_TBBMALLOC)
# TBB malloc library
if (TBB_BUILD_STATIC)
add_library(tbbmalloc_static STATIC ${tbbmalloc_static_src})
target_link_libraries(tbbmalloc_static PRIVATE tbb_interface)
set_property(TARGET tbbmalloc_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1")
set_property(TARGET tbbmalloc_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_DYNAMIC_LOAD_ENABLED=0")
set_property(TARGET tbbmalloc_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_SOURCE_DIRECTLY_INCLUDED=1")
set_property(TARGET tbbmalloc_static APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI})
install(TARGETS tbbmalloc_static ARCHIVE DESTINATION lib)
if (MSVC)
target_compile_definitions(tbbmalloc_static PUBLIC __TBB_NO_IMPLICIT_LINKAGE=1 __TBBMALLOC_NO_IMPLICIT_LINKAGE=1)
endif()
if (TBB_INSTALL_TARGETS)
install(TARGETS tbbmalloc_static ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR})
endif()
endif()
if (TBB_BUILD_SHARED)
add_library(tbbmalloc SHARED ${tbbmalloc_src})
target_link_libraries(tbbmalloc PRIVATE tbb_interface)
set_property(TARGET tbbmalloc APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1")
set_property(TARGET tbbmalloc APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI})
if (TBB_SET_SOVERSION)
set_property(TARGET tbbmalloc PROPERTY SOVERSION 2)
endif ()
add_dependencies(tbbmalloc tbb_def_files)
if (APPLE)
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def")
elseif(UNIX)
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def")
elseif(WIN32)
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def")
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,\"${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def\"")
elseif (MSVC)
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "/DEF:\"${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def\"")
else ()
set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,\"${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def\"")
endif()
if (MSVC)
target_compile_definitions(tbbmalloc PUBLIC __TBB_NO_IMPLICIT_LINKAGE=1 __TBBMALLOC_NO_IMPLICIT_LINKAGE=1)
endif()
if (TBB_INSTALL_TARGETS)
install(TARGETS tbbmalloc EXPORT TBB
LIBRARY DESTINATION ${TBB_INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR}
RUNTIME DESTINATION ${TBB_INSTALL_RUNTIME_DIR})
if (MSVC)
install(FILES $<TARGET_PDB_FILE:tbbmalloc> DESTINATION ${TBB_INSTALL_RUNTIME_DIR} OPTIONAL)
endif()
endif()
if (UNIX AND NOT APPLE)
target_link_libraries(tbbmalloc PUBLIC pthread dl)
endif()
install(TARGETS tbbmalloc DESTINATION lib)
endif()
endif()
@@ -194,19 +391,298 @@ if(TBB_BUILD_TBBMALLOC_PROXY)
# TBB malloc proxy library
if (TBB_BUILD_STATIC)
add_library(tbbmalloc_proxy_static STATIC ${tbbmalloc_proxy_src})
target_link_libraries(tbbmalloc_proxy_static PRIVATE tbb_interface)
set_property(TARGET tbbmalloc_proxy_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1")
set_property(TARGET tbbmalloc_proxy_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_DYNAMIC_LOAD_ENABLED=0")
set_property(TARGET tbbmalloc_proxy_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_SOURCE_DIRECTLY_INCLUDED=1")
set_property(TARGET tbbmalloc_proxy_static APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI})
link_libraries(tbbmalloc_proxy_static tbbmalloc)
install(TARGETS tbbmalloc_proxy_static ARCHIVE DESTINATION lib)
if (TBB_INSTALL_TARGETS)
install(TARGETS tbbmalloc_proxy_static ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR})
endif()
endif()
if (TBB_BUILD_SHARED)
add_library(tbbmalloc_proxy SHARED ${tbbmalloc_proxy_src})
target_link_libraries(tbbmalloc_proxy PRIVATE tbb_interface)
set_property(TARGET tbbmalloc_proxy APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1")
set_property(TARGET tbbmalloc_proxy APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI})
target_link_libraries(tbbmalloc_proxy tbbmalloc)
install(TARGETS tbbmalloc_proxy DESTINATION lib)
if (TBB_SET_SOVERSION)
set_property(TARGET tbbmalloc_proxy PROPERTY SOVERSION 2)
endif ()
target_link_libraries(tbbmalloc_proxy PUBLIC tbbmalloc)
if (TBB_INSTALL_TARGETS)
install(TARGETS tbbmalloc_proxy EXPORT TBB
LIBRARY DESTINATION ${TBB_INSTALL_LIBRARY_DIR}
ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR}
RUNTIME DESTINATION ${TBB_INSTALL_RUNTIME_DIR})
if (MSVC)
install(FILES $<TARGET_PDB_FILE:tbbmalloc_proxy> DESTINATION ${TBB_INSTALL_RUNTIME_DIR} OPTIONAL)
endif()
endif()
if (UNIX AND NOT APPLE)
target_link_libraries(tbbmalloc_proxy PUBLIC pthread dl)
endif()
endif()
endif()
install(DIRECTORY include/tbb DESTINATION include)
if (TBB_INSTALL_TARGETS)
install(DIRECTORY include/tbb DESTINATION ${TBB_INSTALL_INCLUDE_DIR})
if (TBB_BUILD_SHARED)
install(EXPORT TBB DESTINATION ${TBB_CMAKE_PACKAGE_INSTALL_DIR} NAMESPACE TBB:: FILE TBBConfig.cmake)
endif()
endif()
# version file
if (TBB_INSTALL_TARGETS)
set (_VERSION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/include/tbb/tbb_stddef.h)
file (STRINGS ${_VERSION_FILE} _VERSION_MAJOR_STRING REGEX ".*define[ ]+TBB_VERSION_MAJOR[ ]+[0-9]+.*")
file (STRINGS ${_VERSION_FILE} _VERSION_MINOR_STRING REGEX ".*define[ ]+TBB_VERSION_MINOR[ ]+[0-9]+.*")
string (REGEX REPLACE ".*TBB_VERSION_MAJOR[ ]+([0-9]+)" "\\1" TBB_MAJOR_VERSION ${_VERSION_MAJOR_STRING})
string (REGEX REPLACE ".*TBB_VERSION_MINOR[ ]+([0-9]+)" "\\1" TBB_MINOR_VERSION ${_VERSION_MINOR_STRING})
set (TBB_VERSION_STRING "${TBB_MAJOR_VERSION}.${TBB_MINOR_VERSION}")
include (CMakePackageConfigHelpers)
write_basic_package_version_file (TBBConfigVersion.cmake VERSION "${TBB_VERSION_STRING}" COMPATIBILITY AnyNewerVersion)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/TBBConfigVersion.cmake DESTINATION "${TBB_CMAKE_PACKAGE_INSTALL_DIR}")
endif()
# version_string.ver
if (UNIX AND NOT TBB_NO_DATE)
execute_process (COMMAND date "+%a, %d %b %Y %H:%M:%S %z"
OUTPUT_VARIABLE _configure_date
OUTPUT_STRIP_TRAILING_WHITESPACE)
elseif (WIN32 AND NOT TBB_NO_DATE)
execute_process (COMMAND cmd " /C date /T"
OUTPUT_VARIABLE _configure_date
OUTPUT_STRIP_TRAILING_WHITESPACE)
else ()
set (_configure_date "Unknown")
endif()
set (TBB_CONFIG_DATE "${_configure_date}" CACHE STRING "First time that TBB was configured")
set (_configure_date "${TBB_CONFIG_DATE}")
include_directories (${CMAKE_BINARY_DIR})
configure_file (build/version_string.ver.in version_string.ver @ONLY)
if (TBB_BUILD_TESTS)
enable_language (C)
enable_testing ()
find_library (LIBRT_LIBRARIES rt)
find_library (LIDL_LIBRARIES dl)
find_package (Threads)
if (NOT APPLE)
find_package (OpenMP)
endif()
macro (tbb_add_test testname)
set (full_testname tbb_test_${testname})
add_executable (${full_testname} src/test/test_${testname}.cpp)
target_link_libraries(${full_testname} PRIVATE tbb_interface)
if (TBB_BUILD_SHARED)
target_link_libraries (${full_testname} PRIVATE tbb tbbmalloc)
target_compile_definitions (${full_testname} PRIVATE __TBB_LIB_NAME=tbb)
else ()
target_link_libraries (${full_testname} PRIVATE tbb_static tbbmalloc_static)
target_compile_definitions (${full_testname} PRIVATE __TBB_LIB_NAME=tbb_static)
endif ()
if (LIBRT_LIBRARIES)
target_link_libraries (${full_testname} PRIVATE ${LIBRT_LIBRARIES})
endif ()
if (LIDL_LIBRARIES)
target_link_libraries (${full_testname} PRIVATE ${LIDL_LIBRARIES})
endif ()
if (Threads_FOUND)
target_link_libraries (${full_testname} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
endif ()
if (OPENMP_FOUND AND "${testname}" MATCHES "openmp")
set_target_properties (${full_testname} PROPERTIES COMPILE_FLAGS "${OpenMP_CXX_FLAGS}")
set_target_properties (${full_testname} PROPERTIES LINK_FLAGS "${OpenMP_CXX_FLAGS}")
endif()
if (MINGW)
target_link_libraries (${full_testname} PRIVATE psapi)
endif ()
add_test (NAME ${full_testname} COMMAND ${full_testname})
endmacro ()
tbb_add_test (aggregator)
tbb_add_test (aligned_space)
tbb_add_test (assembly)
if (NOT WIN32)
tbb_add_test (async_msg) # msvc64/debug timeouts
endif()
tbb_add_test (async_node)
# tbb_add_test (atomic) # msvc64/debug timeouts: Compile-time initialization fails for static tbb::atomic variables
tbb_add_test (blocked_range2d)
tbb_add_test (blocked_range3d)
tbb_add_test (blocked_range)
tbb_add_test (broadcast_node)
tbb_add_test (buffer_node)
tbb_add_test (cache_aligned_allocator)
if (NOT WIN32)
tbb_add_test (cache_aligned_allocator_STL)
endif()
tbb_add_test (cilk_dynamic_load)
tbb_add_test (cilk_interop)
tbb_add_test (combinable)
tbb_add_test (composite_node)
tbb_add_test (concurrent_hash_map)
tbb_add_test (concurrent_lru_cache)
# tbb_add_test (concurrent_monitor) # too long
# tbb_add_test (concurrent_priority_queue)
if (NOT WIN32)
tbb_add_test (concurrent_queue) # msvc64/debug timeouts
endif()
# tbb_add_test (concurrent_queue_whitebox)
tbb_add_test (concurrent_unordered_map)
# tbb_add_test (concurrent_unordered_set)
tbb_add_test (concurrent_vector)
tbb_add_test (continue_node)
tbb_add_test (critical_section)
tbb_add_test (dynamic_link)
# tbb_add_test (eh_algorithms)
tbb_add_test (eh_flow_graph)
# tbb_add_test (eh_tasks)
tbb_add_test (enumerable_thread_specific)
tbb_add_test (examples_common_utility)
# tbb_add_test (fast_random)
tbb_add_test (flow_graph)
tbb_add_test (flow_graph_whitebox)
# tbb_add_test (fp) # mingw: harness_fp.h:66, assertion !checkConsistency || (ctl.mxcsr & SSE_RND_MODE_MASK) >> 3 == (ctl.x87cw & FE_RND_MODE_MASK): failed
# tbb_add_test (function_node) # mingw:random timeout
# tbb_add_test (global_control)
# tbb_add_test (global_control_whitebox)
tbb_add_test (halt)
tbb_add_test (handle_perror)
# tbb_add_test (hw_concurrency)
tbb_add_test (indexer_node)
tbb_add_test (inits_loop)
tbb_add_test (intrusive_list)
tbb_add_test (ittnotify)
# tbb_add_test (join_node) #msvc/64: fatal error C1128: number of sections exceeded object file format limit: compile with /bigob
tbb_add_test (lambda)
tbb_add_test (limiter_node)
# tbb_add_test (malloc_atexit)
# tbb_add_test (malloc_compliance) #mingw: Limits should be decreased for the test to work
tbb_add_test (malloc_init_shutdown)
# tbb_add_test (malloc_lib_unload)
# tbb_add_test (malloc_overload)
tbb_add_test (malloc_pools)
tbb_add_test (malloc_regression)
# tbb_add_test (malloc_used_by_lib)
# tbb_add_test (malloc_whitebox)
tbb_add_test (model_plugin)
# tbb_add_test (multifunction_node) # too long
tbb_add_test (mutex)
tbb_add_test (mutex_native_threads)
# tbb_add_test (opencl_node)
if (OPENMP_FOUND)
tbb_add_test (openmp)
endif ()
tbb_add_test (overwrite_node)
# tbb_add_test (parallel_do)
# This seems to fail on CI platforms (AppVeyor/Travis), perhaps because the VM exposes just 1 core?
tbb_add_test (parallel_for)
tbb_add_test (parallel_for_each)
tbb_add_test (parallel_for_vectorization)
tbb_add_test (parallel_invoke)
tbb_add_test (parallel_pipeline)
tbb_add_test (parallel_reduce)
tbb_add_test (parallel_scan)
tbb_add_test (parallel_sort)
tbb_add_test (parallel_while)
# tbb_add_test (partitioner_whitebox) # too long
tbb_add_test (pipeline)
# tbb_add_test (pipeline_with_tbf) # takes forever on appveyor
tbb_add_test (priority_queue_node)
tbb_add_test (queue_node)
tbb_add_test (reader_writer_lock)
# tbb_add_test (runtime_loader) # LINK : fatal error LNK1104: cannot open file 'tbbproxy.lib' [C:\projects\tbb\test_runtime_loader.vcxproj]
tbb_add_test (rwm_upgrade_downgrade)
# tbb_add_test (ScalableAllocator)
if (NOT WIN32)
tbb_add_test (ScalableAllocator_STL)
endif()
tbb_add_test (semaphore)
# tbb_add_test (sequencer_node) # msvc: timeout
tbb_add_test (source_node)
tbb_add_test (split_node)
tbb_add_test (static_assert)
tbb_add_test (std_thread)
tbb_add_test (tagged_msg)
# tbb_add_test (task_arena) # LINK : fatal error LNK1104: cannot open file '__TBB_LIB_NAME.lib' [C:\projects\tbb\test_task_arena.vcxproj]
# tbb_add_test (task_assertions)
tbb_add_test (task_auto_init)
tbb_add_test (task)
# tbb_add_test (task_enqueue) # too long
tbb_add_test (task_group)
# tbb_add_test (task_leaks)
# tbb_add_test (task_priority)
# tbb_add_test (task_scheduler_init) # msvc: test_task_scheduler_init.cpp:68, assertion !test_mandatory_parallelism || Harness::CanReachConcurrencyLevel(threads): failed
tbb_add_test (task_scheduler_observer)
tbb_add_test (task_steal_limit)
tbb_add_test (tbb_condition_variable)
tbb_add_test (tbb_fork)
# tbb_add_test (tbb_header)
tbb_add_test (tbb_thread)
# tbb_add_test (tbb_version)
tbb_add_test (tick_count)
tbb_add_test (tuple)
tbb_add_test (write_once_node)
tbb_add_test (yield)
endif ()
if (TBB_BUILD_PYTHON)
find_package(PythonInterp)
find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT)
find_package(SWIG 3)
if (PythonLibs_FOUND AND SWIG_FOUND AND TBB_BUILD_SHARED)
include (${SWIG_USE_FILE})
set_source_files_properties (python/tbb/api.i PROPERTIES CPLUSPLUS ON)
set (CMAKE_SWIG_FLAGS "-threads")
# swig_add_module is deprecated
if (CMAKE_VERSION VERSION_LESS 3.8)
swig_add_module (api python python/tbb/api.i)
else ()
swig_add_library (api LANGUAGE python SOURCES python/tbb/api.i)
endif ()
# UseSWIG generates now standard target names
if (CMAKE_VERSION VERSION_LESS 3.13)
set (module_target ${SWIG_MODULE_api_REAL_NAME})
else ()
set (module_target api)
endif ()
target_include_directories(${module_target} PRIVATE ${PYTHON_INCLUDE_DIRS})
target_link_libraries(${module_target} PRIVATE tbb)
if(WIN32)
target_link_libraries(${module_target} ${PYTHON_LIBRARIES})
elseif(APPLE)
set_target_properties(${module_target} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
endif()
if (WIN32)
set (PYTHON_SITE_PACKAGES Lib/site-packages)
else ()
set (PYTHON_SITE_PACKAGES lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
endif ()
if (TBB_INSTALL_TARGETS)
install(FILES python/TBB.py
DESTINATION ${PYTHON_SITE_PACKAGES})
install(FILES python/tbb/__init__.py python/tbb/pool.py python/tbb/test.py python/tbb/__main__.py ${CMAKE_CURRENT_BINARY_DIR}/api.py
DESTINATION ${PYTHON_SITE_PACKAGES}/tbb)
install(TARGETS ${module_target}
DESTINATION ${PYTHON_SITE_PACKAGES}/tbb)
endif()
if(UNIX AND NOT APPLE)
add_library(irml SHARED python/rml/ipc_server.cpp python/rml/ipc_utils.cpp src/tbb/cache_aligned_allocator.cpp src/tbb/dynamic_link.cpp src/tbb/tbb_misc_ex.cpp src/tbb/tbb_misc.cpp)
target_compile_definitions(irml PRIVATE DO_ITT_NOTIFY=0 USE_PTHREAD=1)
target_link_libraries(irml PRIVATE tbb)
set_target_properties(irml PROPERTIES VERSION 1)
if (TBB_INSTALL_TARGETS)
install(TARGETS irml DESTINATION ${TBB_INSTALL_LIBRARY_DIR})
endif()
endif ()
endif ()
endif ()

View File

@@ -68,3 +68,34 @@
+
return ret;
}
--- a/libavcodec/rl.c
+++ b/libavcodec/rl.c
@@ -71,17 +71,19 @@
av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
{
int i, q;
- VLC_TYPE table[1500][2] = {{0}};
+ VLC_TYPE (*table)[2] = av_calloc(sizeof(VLC_TYPE), 1500 * 2);
VLC vlc = { .table = table, .table_allocated = static_size };
- av_assert0(static_size <= FF_ARRAY_ELEMS(table));
+ av_assert0(static_size < 1500);
init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
for (q = 0; q < 32; q++) {
int qmul = q * 2;
int qadd = (q - 1) | 1;
- if (!rl->rl_vlc[q])
+ if (!rl->rl_vlc[q]){
+ av_free(table);
return;
+ }
if (q == 0) {
qmul = 1;
@@ -113,4 +115,5 @@
rl->rl_vlc[q][i].run = run;
}
}
+ av_free(table);
}

View File

@@ -0,0 +1,374 @@
Index: nanovdb/nanovdb/NanoVDB.h
===================================================================
--- a/nanovdb/nanovdb/NanoVDB.h (revision 62751)
+++ b/nanovdb/nanovdb/NanoVDB.h (working copy)
@@ -152,8 +152,8 @@
#endif // __CUDACC_RTC__
-#ifdef __CUDACC__
-// Only define __hostdev__ when using NVIDIA CUDA compiler
+#if defined(__CUDACC__) || defined(__HIP__)
+// Only define __hostdev__ when using NVIDIA CUDA or HIP compiler
#define __hostdev__ __host__ __device__
#else
#define __hostdev__
@@ -461,7 +461,7 @@
/// Maximum floating-point values
template<typename T>
struct Maximum;
-#ifdef __CUDA_ARCH__
+#if defined(__CUDA_ARCH__) || defined(__HIP__)
template<>
struct Maximum<int>
{
@@ -1006,10 +1006,10 @@
using Vec3i = Vec3<int>;
/// @brief Return a single precision floating-point vector of this coordinate
-Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
+inline __hostdev__ Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
/// @brief Return a double precision floating-point vector of this coordinate
-Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
+inline __hostdev__ Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
// ----------------------------> Vec4 <--------------------------------------
@@ -1820,7 +1820,7 @@
}; // Map
template<typename Mat4T>
-void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
+__hostdev__ void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
{
float * mf = mMatF, *vf = mVecF;
float* mif = mInvMatF;
@@ -2170,7 +2170,7 @@
}; // Class Grid
template<typename TreeT>
-int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
+__hostdev__ int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
{
for (uint32_t i = 0, n = blindDataCount(); i < n; ++i)
if (blindMetaData(i).mSemantic == semantic)
@@ -2328,7 +2328,7 @@
}; // Tree class
template<typename RootT>
-void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
+__hostdev__ void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
{
min = this->root().valueMin();
max = this->root().valueMax();
@@ -2336,7 +2336,7 @@
template<typename RootT>
template<typename NodeT>
-const NodeT* Tree<RootT>::getNode(uint32_t i) const
+__hostdev__ const NodeT* Tree<RootT>::getNode(uint32_t i) const
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNode: unvalid node type");
NANOVDB_ASSERT(i < DataType::mCount[NodeT::LEVEL]);
@@ -2345,7 +2345,7 @@
template<typename RootT>
template<int LEVEL>
-const typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i) const
+__hostdev__ const typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i) const
{
NANOVDB_ASSERT(i < DataType::mCount[LEVEL]);
return reinterpret_cast<const TreeNodeT<LEVEL>*>(reinterpret_cast<const uint8_t*>(this) + DataType::mBytes[LEVEL]) + i;
@@ -2353,7 +2353,7 @@
template<typename RootT>
template<typename NodeT>
-NodeT* Tree<RootT>::getNode(uint32_t i)
+__hostdev__ NodeT* Tree<RootT>::getNode(uint32_t i)
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNode: invalid node type");
NANOVDB_ASSERT(i < DataType::mCount[NodeT::LEVEL]);
@@ -2362,7 +2362,7 @@
template<typename RootT>
template<int LEVEL>
-typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i)
+__hostdev__ typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i)
{
NANOVDB_ASSERT(i < DataType::mCount[LEVEL]);
return reinterpret_cast<TreeNodeT<LEVEL>*>(reinterpret_cast<uint8_t*>(this) + DataType::mBytes[LEVEL]) + i;
@@ -2370,7 +2370,7 @@
template<typename RootT>
template<typename NodeT>
-uint32_t Tree<RootT>::getNodeID(const NodeT& node) const
+__hostdev__ uint32_t Tree<RootT>::getNodeID(const NodeT& node) const
{
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNodeID: invalid node type");
const NodeT* first = reinterpret_cast<const NodeT*>(reinterpret_cast<const uint8_t*>(this) + DataType::mBytes[NodeT::LEVEL]);
@@ -2380,7 +2380,7 @@
template<typename RootT>
template<typename NodeT>
-uint32_t Tree<RootT>::getLinearOffset(const NodeT& node) const
+__hostdev__ uint32_t Tree<RootT>::getLinearOffset(const NodeT& node) const
{
return this->getNodeID(node) + DataType::mPFSum[NodeT::LEVEL];
}
@@ -3366,7 +3366,7 @@
}; // LeafNode class
template<typename ValueT, typename CoordT, template<uint32_t> class MaskT, uint32_t LOG2DIM>
-inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
+inline __hostdev__ void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
{
static_assert(LOG2DIM == 3, "LeafNode::updateBBox: only supports LOGDIM = 3!");
if (!this->isActive()) return;
Index: nanovdb/nanovdb/util/SampleFromVoxels.h
===================================================================
--- a/nanovdb/nanovdb/util/SampleFromVoxels.h (revision 62751)
+++ b/nanovdb/nanovdb/util/SampleFromVoxels.h (working copy)
@@ -22,7 +22,7 @@
#define NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED
// Only define __hostdev__ when compiling as NVIDIA CUDA
-#ifdef __CUDACC__
+#if defined(__CUDACC__) || defined(__HIP__)
#define __hostdev__ __host__ __device__
#else
#include <cmath> // for floor
@@ -136,7 +136,7 @@
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
{
const CoordT ijk = Round<CoordT>(xyz);
if (ijk != mPos) {
@@ -147,7 +147,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
{
if (ijk != mPos) {
mPos = ijk;
@@ -158,7 +158,7 @@
template<typename TreeOrAccT>
template<typename Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
{
return mAcc.getValue(Round<CoordT>(xyz));
}
@@ -195,7 +195,7 @@
}; // TrilinearSamplerBase
template<typename TreeOrAccT>
-void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
+__hostdev__ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
{
v[0][0][0] = mAcc.getValue(ijk); // i, j, k
@@ -224,7 +224,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
#if 0
auto lerp = [](ValueT a, ValueT b, ValueT w){ return fma(w, b-a, a); };// = w*(b-a) + a
@@ -239,7 +239,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::gradient requires a floating-point type");
#if 0
@@ -270,7 +270,7 @@
}
template<typename TreeOrAccT>
-bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
+__hostdev__ bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -363,7 +363,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
@@ -370,7 +370,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[0][0][0] : BaseT::mAcc.getValue(ijk);
}
@@ -377,7 +377,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::gradient(xyz, mVal);
@@ -393,7 +393,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -406,7 +406,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -418,7 +418,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
{
auto lerp = [](ValueT a, ValueT b, RealT w) { return a + ValueT(w) * (b - a); };
@@ -463,7 +463,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
+inline __hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -473,7 +473,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[2][2][2];
CoordT ijk = Floor<CoordT>(xyz);
@@ -510,7 +510,7 @@
}; // TriquadraticSamplerBase
template<typename TreeOrAccT>
-void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
+__hostdev__ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
{
CoordT p(ijk[0] - 1, 0, 0);
for (int dx = 0; dx < 3; ++dx, ++p[0]) {
@@ -526,7 +526,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
+__hostdev__ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
{
auto kernel = [](const ValueT* value, double weight)->ValueT {
return weight * (weight * (0.5f * (value[0] + value[2]) - value[1]) +
@@ -545,7 +545,7 @@
}
template<typename TreeOrAccT>
-bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
+__hostdev__ bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
{
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
const bool less = v[0][0][0] < ValueT(0);
@@ -624,7 +624,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mVal);
@@ -631,7 +631,7 @@
}
template<typename TreeOrAccT>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
{
return ijk == mPos ? mVal[1][1][1] : BaseT::mAcc.getValue(ijk);
}
@@ -646,7 +646,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {
@@ -657,7 +657,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -667,7 +667,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
{
ValueT val[3][3][3];
CoordT ijk = Floor<CoordT>(xyz);
@@ -710,7 +710,7 @@
}; // TricubicSampler
template<typename TreeOrAccT>
-void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
+__hostdev__ void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
{
auto fetch = [&](int i, int j, int k) -> ValueT& { return C[((i + 1) << 4) + ((j + 1) << 2) + k + 1]; };
@@ -929,7 +929,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
{
this->cache(xyz);
return BaseT::sample(xyz, mC);
@@ -937,7 +937,7 @@
template<typename TreeOrAccT>
template<typename RealT, template<typename...> class Vec3T>
-void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
{
CoordT ijk = Floor<CoordT>(xyz);
if (ijk != mPos) {

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